24 #ifndef PREVIEW_POLYGON_GEOM_MANAGER__H_ 25 #define PREVIEW_POLYGON_GEOM_MANAGER__H_ 202 #endif // PREVIEW_POLYGON_GEOM_MANAGER__H_ virtual void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr)=0
Called when the polygon is complete.
SHAPE_LINE_CHAIN m_lockedPoints
Points in the temporary "leader" line(s)
LEADER_MODE
The kind of the leader line.
POLYGON_GEOM_MANAGER(CLIENT &aClient)
const SHAPE_LINE_CHAIN & GetLeaderLinePoints() const
Get the points comprising the leader line (the line from the last locked-in point to the current curs...
Define a general 2D-vector/point.
LEADER_MODE m_leaderMode
Flag enabling self-intersecting polygons.
CLIENT & m_client
The current mode of the leader line.
bool NewPointClosesOutline(const VECTOR2I &aPt) const
void SetLeaderMode(LEADER_MODE aMode)
Set the leader mode to use when calculating the leader/returner lines.
LEADER_MODE GetLeaderMode() const
bool IntersectionsAllowed() const
Check whether self-intersecting polygons are enabled.
"Listener" interface for a class that wants to be updated about polygon geometry changes
virtual bool OnFirstPoint(POLYGON_GEOM_MANAGER &aMgr)=0
Called before the first point is added - clients can do initialization here, and can veto the start o...
bool IsSelfIntersecting(bool aIncludeLeaderPts) const
Check whether the locked points constitute a self-intersecting outline.
bool IsPolygonInProgress() const
Unconstrained point-to-point.
void AllowIntersections(bool aEnabled)
Enables/disables self-intersecting polygons.
void DeleteLastCorner()
Remove the last-added point from the polygon.
bool m_intersectionsAllowed
Point that have been "locked in".
void Reset()
Clear the manager state and start again.
const SHAPE_LINE_CHAIN & GetLockedInPoints() const
Get the "locked-in" points that describe the polygon itself.
virtual void OnComplete(const POLYGON_GEOM_MANAGER &aMgr)=0
void updateLeaderPoints(const VECTOR2I &aEndPoint, LEADER_MODE aModifier=LEADER_MODE::DIRECT)
Update the leader line points based on a new endpoint (probably a cursor position)
bool AddPoint(const VECTOR2I &aPt)
Lock in a polygon point.
void SetCursorPosition(const VECTOR2I &aPos)
Set the current cursor position.
void SetFinished()
Mark the polygon finished and update the client.
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
SHAPE_LINE_CHAIN m_leaderPts