390 void AddPoint(
const VECTOR2I& aPoint, std::pair<EDA_ITEM*, int> aConnected = {
nullptr, 0 } )
413 m_lines.emplace_back( aOrigin, aEnd );
551 void Show(
int x, std::ostream& st )
const override
563 return wxT(
"EDIT_POINTS" );
A base class for most all the KiCad significant classes used in schematics and boards.
Describe constraints between two edit handles.
Represent a line connecting two EDIT_POINTs.
virtual void SetPosition(const VECTOR2I &aPosition) override
Correct coordinates of an EDIT_POINT by applying previously set constraint.
EDIT_LINE(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
const EDIT_POINT & GetEnd() const
bool operator==(const EDIT_LINE &aOther) const
void SetHasCenterPoint(bool aHasCenterPoint)
Set if the center-point of the line should be shown.
EDIT_POINT & GetEnd()
Return the end EDIT_POINT.
EDIT_POINT & GetOrigin()
Return the origin EDIT_POINT.
bool DrawLine() const
Should the line itself be drawn, or just the end and/or center points?
bool m_showLine
True if the line itself should be drawn.
EDIT_POINT & m_end
End point for a line.
void SetConstraint(EDIT_CONSTRAINT< EDIT_LINE > *aConstraint)
Set a constraint for and EDIT_POINT.
virtual VECTOR2I GetPosition() const override
Return coordinates of an EDIT_POINT.
void SetDrawLine(bool aShowLine)
Set if the line itself should be drawn.
EDIT_CONSTRAINT< EDIT_LINE > * GetConstraint() const
Return the constraint imposed on an EDIT_POINT.
const EDIT_POINT & GetOrigin() const
EDIT_POINT & m_origin
Origin point for a line.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_LINE > > m_constraint
bool m_hasCenterPoint
True if the line has a (useful) center point.
virtual void ApplyConstraint(const GRID_HELPER &aGrid) override
Correct coordinates of an EDIT_POINT by applying previously set constraint.
bool operator==(const EDIT_POINT &aOther) const
bool HasCenterPoint() const
Is the center-point of the line useful to be shown?
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
unsigned int PointsSize() const
Return number of stored EDIT_POINTs.
bool IsContourStart(int aPointIdx) const
Check if a point with given index is a contour origin.
bool m_allowPoints
If false, only allow editing of EDIT_LINES.
int GetContourEndIdx(int aPointIdx) const
Return index of the contour finish for a point with given index.
void AddPoint(const EDIT_POINT &aPoint)
Add an EDIT_POINT.
const EDIT_LINE & Line(unsigned int aIndex) const
void SetSwapY(bool aSwap)
virtual const BOX2I ViewBBox() const override
EDIT_POINT * Previous(const EDIT_POINT &aPoint, bool aTraverseContours=true)
Return the point that is after the given point in the list.
EDIT_POINT * Next(const EDIT_POINT &aPoint, bool aTraverseContours=true)
Return the point that is before the given point in the list.
std::deque< EDIT_LINE > m_lines
EDIT_LINEs for modifying m_parent.
std::list< int > m_contours
Indices of end contour points.
void AddPoint(const VECTOR2I &aPoint, std::pair< EDA_ITEM *, int > aConnected={ nullptr, 0 })
Add an EDIT_POINT.
EDIT_LINE & Line(unsigned int aIndex)
virtual wxString GetClass() const override
Get the class name.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
bool m_swapY
Parent's Y coords are inverted.
const EDIT_POINT & Point(unsigned int aIndex) const
bool IsContourEnd(int aPointIdx) const
Check is a point with given index is a contour finish.
EDA_ITEM * m_parent
Parent of the EDIT_POINTs.
void AddIndicatorLine(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
Adds an EDIT_LINE that is shown as an indicator, rather than an editable line (no center point drag,...
std::deque< EDIT_POINT > m_points
EDIT_POINTs for modifying m_parent.
bool m_swapX
Parent's X coords are inverted.
EDIT_POINT * FindPoint(const VECTOR2I &aLocation, KIGFX::VIEW *aView)
Return a point that is at given coordinates or NULL if there is no such point.
void SetSwapX(bool aSwap)
void AddBreak()
Adds a break, indicating the end of a contour.
int GetContourStartIdx(int aPointIdx) const
Return index of the contour origin for a point with given index.
EDA_ITEM * GetParent() const
Return parent of the EDIT_POINTS.
unsigned int LinesSize() const
Return number of stored EDIT_LINEs.
void AddLine(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
Adds an EDIT_LINE.
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
EDIT_POINT & Point(unsigned int aIndex)
void AddLine(const EDIT_LINE &aLine)
Adds an EDIT_LINE.
Represent a single point that can be used for modifying items.
virtual std::pair< EDA_ITEM *, int > GetConnected() const
Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag.
void SetGridConstraint(GRID_CONSTRAINT_TYPE aConstraint)
static const int HOVER_SIZE
Border size when hovering.
std::pair< EDA_ITEM *, int > m_connected
Constraint for the point, NULL if none.
int GetY() const
Return Y coordinate of an EDIT_POINT.
void ClearConstraint()
Remove previously set constraint.
bool m_isHover
True if this point is being hovered over.
virtual void SetPosition(int x, int y)
static const int POINT_SIZE
GRID_CONSTRAINT_TYPE m_gridConstraint
Describe the grid snapping behavior.
SNAP_CONSTRAINT_TYPE GetSnapConstraint() const
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
VECTOR2I m_position
Position of EDIT_POINT.
EDIT_POINT(const VECTOR2I &aPoint, std::pair< EDA_ITEM *, int > aConnected={ nullptr, 0 })
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
void SetSnapConstraint(SNAP_CONSTRAINT_TYPE aConstraint)
bool WithinPoint(const VECTOR2I &aPoint, unsigned int aSize) const
Check if given point is within a square centered in the EDIT_POINT position.
SNAP_CONSTRAINT_TYPE m_snapConstraint
Describe the object snapping behavior.
virtual void ApplyConstraint(const GRID_HELPER &aGrid)
Correct coordinates of an EDIT_POINT by applying previously set constraint.
void SetHover(bool aHover=true)
bool IsConstrained() const
Check if point is constrained.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_constraint
void SetConstraint(EDIT_CONSTRAINT< EDIT_POINT > *aConstraint)
Set a constraint for and EDIT_POINT.
EDIT_CONSTRAINT< EDIT_POINT > * GetConstraint() const
Return the constraint imposed on an EDIT_POINT.
bool operator==(const EDIT_POINT &aOther) const
Single point size in pixels.
int GetX() const
Return X coordinate of an EDIT_POINT.
void SetActive(bool aActive=true)
static const int BORDER_SIZE
Border size when not hovering.
GRID_CONSTRAINT_TYPE GetGridConstraint() const
bool m_isActive
True if this point is being manipulated.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
@ LAYER_GP_OVERLAY
general purpose overlay