The LineFigure class
A line is drawn between two points, represented by the firstPoint
field to the lastPoint
field in the LineFigure
class, as shown in the following image:
The header
file overrides some of the methods of its DrawFigure
base class. The DoubleClick
method does nothing. As I see it, there is no really meaningful response to a double-click on a line. However, we still need to override the DoubleClick
method, since it is a pure virtual method in the DrawFigure
base class. If we do not override it, the LineFigure
class will be abstract.
LineFigure.h
class LineFigure : public DrawFigure { public: LineFigure(const Window* windowPtr); virtual FigureId GetId() const {return LineId;} virtual void SetFirstPoint(Point point); virtual bool IsClick(Point mousePoint); virtual bool IsInside(Rect rectangleArea); virtual void DoubleClick(Point mousePoint) {/* Empty. */} virtual void Modify(Size distanceSize...