27 #ifndef EDIT_POINTS_H_ 28 #define EDIT_POINTS_H_ 360 void AddPoint(
const VECTOR2I& aPoint, std::pair<EDA_ITEM*, int> aConnected = {
nullptr, 0 } )
383 m_lines.emplace_back( aOrigin, aEnd );
505 void Show(
int x, std::ostream& st )
const override 517 return wxT(
"EDIT_POINTS" );
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_constraint
void SetConstraint(EDIT_CONSTRAINT< EDIT_LINE > *aConstraint)
Set a constraint for and EDIT_POINT.
EDIT_LINE(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
Return coordinates of an EDIT_POINT.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_LINE > > m_constraint
void AddPoint(const VECTOR2I &aPoint, std::pair< EDA_ITEM *, int > aConnected={ nullptr, 0 })
Add an EDIT_POINT.
int GetContourEndIdx(int aPointIdx) const
Return index of the contour finish for a point with given index.
std::list< int > m_contours
Indices of end contour points.
std::deque< EDIT_POINT > m_points
EDIT_POINTs for modifying m_parent.
virtual void SetPosition(int x, int y)
void SetConstraint(EDIT_CONSTRAINT< EDIT_POINT > *aConstraint)
Set a constraint for and EDIT_POINT.
EDIT_LINE & Line(unsigned int aIndex)
const EDIT_LINE & Line(unsigned int aIndex) const
std::deque< EDIT_LINE > m_lines
EDIT_LINEs for modifying m_parent.
void AddBreak()
Adds a break, indicating the end of a contour.
Represent a line connecting two EDIT_POINTs.
void AddLine(const EDIT_LINE &aLine)
Adds an EDIT_LINE.
EDIT_POINT * Next(const EDIT_POINT &aPoint, bool aTraverseContours=true)
Return the point that is before the given point in the list.
virtual const BOX2I ViewBBox() const override
static const int BORDER_SIZE
Border size when hovering.
bool m_allowPoints
If false, only allow editing of EDIT_LINES.
bool IsContourStart(int aPointIdx) const
Check if a point with given index is a contour origin.
EDA_ITEM * m_parent
Parent of the EDIT_POINTs.
virtual VECTOR2I GetPosition() const override
Return coordinates of an EDIT_POINT.
bool IsContourEnd(int aPointIdx) const
Check is a point with given index is a contour finish.
int GetY() const
Return Y coordinate of an EDIT_POINT.
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
EDIT_CONSTRAINT< EDIT_LINE > * GetConstraint() const
Return the constraint imposed on an EDIT_POINT.
GRID_CONSTRAINT_TYPE GetGridConstraint() const
EDIT_POINT & GetOrigin()
Return the origin EDIT_POINT.
void AddPoint(const EDIT_POINT &aPoint)
Add an EDIT_POINT.
EDIT_POINT & m_end
End point for a line.
const EDIT_POINT & GetEnd() const
void ClearConstraint()
Remove previously set constraint.
const EDIT_POINT & Point(unsigned int aIndex) const
EDIT_POINT & GetEnd()
Return the end EDIT_POINT.
void SetActive(bool aActive=true)
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.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
bool operator==(const EDIT_LINE &aOther) const
bool m_isHover
True if this point is being hovered over.
unsigned int LinesSize() const
Return number of stored EDIT_LINEs.
virtual void SetPosition(const VECTOR2I &aPosition) override
Correct coordinates of an EDIT_POINT by applying previously set constraint.
int GetX() const
Return X coordinate of an EDIT_POINT.
int GetContourStartIdx(int aPointIdx) const
Return index of the contour origin for a point with given index.
bool m_isActive
True if this point is being manipulated.
VECTOR2I m_position
Position of EDIT_POINT.
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
EDIT_POINT(const VECTOR2I &aPoint, std::pair< EDA_ITEM *, int > aConnected={ nullptr, 0 })
bool operator==(const EDIT_POINT &aOther) const
void AddLine(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
Adds an EDIT_LINE.
EDA_ITEM * GetParent() const
Return parent of the EDIT_POINTS.
virtual std::pair< EDA_ITEM *, int > GetConnected() const
Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag.
EDIT_POINT & Point(unsigned int aIndex)
virtual void ApplyConstraint() override
Correct coordinates of an EDIT_POINT by applying previously set constraint.
const EDIT_POINT & GetOrigin() const
void SetHover(bool aHover=true)
bool IsConstrained() const
Check if point is constrained.
bool operator==(const EDIT_POINT &aOther) const
Single point size in pixels.
EDIT_POINTS(EDA_ITEM *aParent)
A base class for most all the KiCad significant classes used in schematics and boards.
static const int POINT_SIZE
Border size when not hovering.
unsigned int PointsSize() const
Return number of stored EDIT_POINTs.
EDIT_CONSTRAINT< EDIT_POINT > * GetConstraint() const
Return the constraint imposed on an EDIT_POINT.
virtual wxString GetClass() const override
Get the class name.
EDIT_POINT & m_origin
Origin point for a line.
EDIT_POINT * Previous(const EDIT_POINT &aPoint, bool aTraverseContours=true)
Return the point that is after the given point in the list.
Represent a single point that can be used for modifying items.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
std::pair< EDA_ITEM *, int > m_connected
Constraint for the point, NULL if none.
void SetGridConstraint(GRID_CONSTRAINT_TYPE aConstraint)
GRID_CONSTRAINT_TYPE m_gridConstraint
Describe the grid snapping behavior.
static const int HOVER_SIZE
virtual void ApplyConstraint()
Correct coordinates of an EDIT_POINT by applying previously set constraint.
bool WithinPoint(const VECTOR2I &aPoint, unsigned int aSize) const
Check if given point is within a square centered in the EDIT_POINT position.
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.