KiCad PCB EDA Suite
|
Represent a single point that can be used for modifying items. More...
#include <edit_points.h>
Public Member Functions | |
EDIT_POINT (const VECTOR2I &aPoint, std::pair< EDA_ITEM *, int > aConnected={ nullptr, 0 }) | |
virtual | ~EDIT_POINT () |
virtual VECTOR2I | GetPosition () const |
Return coordinates of an EDIT_POINT. | |
virtual std::pair< EDA_ITEM *, int > | GetConnected () const |
Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag. | |
int | GetX () const |
Return X coordinate of an EDIT_POINT. | |
int | GetY () const |
Return Y coordinate of an EDIT_POINT. | |
virtual void | SetPosition (const VECTOR2I &aPosition) |
Set new coordinates for an EDIT_POINT. | |
virtual void | SetPosition (int x, int y) |
bool | WithinPoint (const VECTOR2I &aPoint, unsigned int aSize) const |
Check if given point is within a square centered in the EDIT_POINT position. | |
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. | |
void | ClearConstraint () |
Remove previously set constraint. | |
bool | IsConstrained () const |
Check if point is constrained. | |
virtual void | ApplyConstraint (const GRID_HELPER &aGrid) |
Correct coordinates of an EDIT_POINT by applying previously set constraint. | |
bool | IsActive () const |
void | SetActive (bool aActive=true) |
bool | IsHover () const |
void | SetHover (bool aHover=true) |
GRID_CONSTRAINT_TYPE | GetGridConstraint () const |
void | SetGridConstraint (GRID_CONSTRAINT_TYPE aConstraint) |
SNAP_CONSTRAINT_TYPE | GetSnapConstraint () const |
void | SetSnapConstraint (SNAP_CONSTRAINT_TYPE aConstraint) |
bool | operator== (const EDIT_POINT &aOther) const |
Single point size in pixels. | |
Static Public Attributes | |
static const int | POINT_SIZE = 8 |
static const int | BORDER_SIZE = 2 |
Border size when not hovering. | |
static const int | HOVER_SIZE = 5 |
Border size when hovering. | |
Private Attributes | |
VECTOR2I | m_position |
Position of EDIT_POINT. | |
bool | m_isActive |
True if this point is being manipulated. | |
bool | m_isHover |
True if this point is being hovered over. | |
GRID_CONSTRAINT_TYPE | m_gridConstraint |
Describe the grid snapping behavior. | |
SNAP_CONSTRAINT_TYPE | m_snapConstraint |
Describe the object snapping behavior. | |
std::pair< EDA_ITEM *, int > | m_connected |
Constraint for the point, NULL if none. | |
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > | m_constraint |
Represent a single point that can be used for modifying items.
It is directly related to one of points in a graphical item (e.g. vertex of a zone or center of a circle).
Definition at line 47 of file edit_points.h.
|
inline |
aPoint | stores coordinates for EDIT_POINT. |
Definition at line 53 of file edit_points.h.
|
inlinevirtual |
Definition at line 63 of file edit_points.h.
|
inlinevirtual |
Correct coordinates of an EDIT_POINT by applying previously set constraint.
Reimplemented in EDIT_LINE.
Definition at line 166 of file edit_points.h.
References m_constraint.
Referenced by EDIT_LINE::ApplyConstraint(), and PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Remove previously set constraint.
Definition at line 148 of file edit_points.h.
References m_constraint.
|
inlinevirtual |
Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag.
Definition at line 79 of file edit_points.h.
References m_connected.
Referenced by LINE_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Return the constraint imposed on an EDIT_POINT.
If there are no constraints, NULL is returned.
Definition at line 140 of file edit_points.h.
References m_constraint.
|
inline |
Definition at line 178 of file edit_points.h.
References m_gridConstraint.
Referenced by EC_VERTICAL::Apply(), EC_HORIZONTAL::Apply(), EC_45DEGREE::Apply(), EC_LINE::Apply(), and PCB_POINT_EDITOR::OnSelectionChange().
|
inlinevirtual |
Return coordinates of an EDIT_POINT.
Reimplemented in EDIT_LINE.
Definition at line 71 of file edit_points.h.
References m_position.
Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_VERTICAL::Apply(), EC_HORIZONTAL::Apply(), EC_45DEGREE::Apply(), EC_LINE::Apply(), EC_CIRCLE::Apply(), EC_CONVERGING::EC_CONVERGING(), EC_LINE::EC_LINE(), EC_PERPLINE::EC_PERPLINE(), findVertex(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), ARC_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_CENTER_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), EDIT_LINE::GetPosition(), GetX(), GetY(), PCB_POINT_EDITOR::movePoint(), PCB_POINT_EDITOR::OnSelectionChange(), EDIT_LINE::operator==(), EE_POINT_EDITOR::removeCornerCondition(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), EDIT_LINE::SetPosition(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), PCB_TUNING_PATTERN::UpdateFromEditPoints(), ARC_POINT_EDIT_BEHAVIOR::UpdateItem(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdateItem(), LINE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateOrthogonalDimension(), POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints(), EDIT_POINTS::ViewDraw(), and WithinPoint().
|
inline |
Definition at line 181 of file edit_points.h.
References m_snapConstraint.
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Return X coordinate of an EDIT_POINT.
Definition at line 87 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::x.
Referenced by SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), and PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Return Y coordinate of an EDIT_POINT.
Definition at line 95 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::y.
Referenced by SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), and PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Definition at line 172 of file edit_points.h.
References m_isActive.
Referenced by PCB_TUNING_PATTERN::UpdateFromEditPoints(), and EDIT_POINTS::ViewDraw().
|
inline |
Check if point is constrained.
Definition at line 158 of file edit_points.h.
References m_constraint.
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Definition at line 175 of file edit_points.h.
References m_isHover.
Referenced by EDIT_POINTS::ViewDraw().
|
inline |
|
inline |
Definition at line 173 of file edit_points.h.
References m_isActive.
Referenced by PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Set a constraint for and EDIT_POINT.
aConstraint | is the constraint to be set. |
Definition at line 131 of file edit_points.h.
References m_constraint.
Referenced by ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_LEADER_POINT_EDIT_BEHAVIOR::MakePoints(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), and DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Definition at line 179 of file edit_points.h.
References m_gridConstraint.
Referenced by EDIT_LINE::EDIT_LINE(), and PCB_TUNING_PATTERN::MakeEditPoints().
|
inline |
Definition at line 176 of file edit_points.h.
References m_isHover.
Referenced by PCB_POINT_EDITOR::updateEditedPoint().
|
inlinevirtual |
Set new coordinates for an EDIT_POINT.
It does not change the coordinates of a graphical item.
aPosition | are new coordinates. |
Reimplemented in EDIT_LINE.
Definition at line 107 of file edit_points.h.
References m_position.
Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_VERTICAL::Apply(), EC_HORIZONTAL::Apply(), EC_45DEGREE::Apply(), EC_LINE::Apply(), EC_CIRCLE::Apply(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_POINT_EDITOR::movePoint(), PCB_POINT_EDITOR::OnSelectionChange(), EDIT_LINE::SetPosition(), PCB_TUNING_PATTERN::UpdateEditPoints(), LINE_POINT_EDIT_BEHAVIOR::UpdatePoints(), ARC_POINT_EDIT_BEHAVIOR::UpdatePoints(), BITMAP_POINT_EDIT_BEHAVIOR::UpdatePoints(), SHEET_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_TABLECELL_POINT_EDIT_BEHAVIOR::UpdatePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdatePoints(), PAD_POINT_EDIT_BEHAVIOR::UpdatePoints(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdatePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdatePoints(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline().
|
inlinevirtual |
Definition at line 112 of file edit_points.h.
References m_position, VECTOR2< T >::x, and VECTOR2< T >::y.
|
inline |
Definition at line 182 of file edit_points.h.
References m_snapConstraint.
Referenced by ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::MakePoints(), and DIM_LEADER_POINT_EDIT_BEHAVIOR::MakePoints().
bool EDIT_POINT::WithinPoint | ( | const VECTOR2I & | aPoint, |
unsigned int | aSize | ||
) | const |
Check if given point is within a square centered in the EDIT_POINT position.
aPoint | is point to be checked. |
aSize | is length of the square side. |
Definition at line 33 of file edit_points.cpp.
References GetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
static |
Border size when not hovering.
Definition at line 196 of file edit_points.h.
Referenced by EDIT_POINTS::ViewDraw().
|
static |
Border size when hovering.
Definition at line 197 of file edit_points.h.
Referenced by EDIT_POINTS::ViewDraw().
|
private |
Constraint for the point, NULL if none.
Definition at line 209 of file edit_points.h.
Referenced by GetConnected().
|
private |
Definition at line 212 of file edit_points.h.
Referenced by ApplyConstraint(), ClearConstraint(), GetConstraint(), IsConstrained(), and SetConstraint().
|
private |
Describe the grid snapping behavior.
Definition at line 204 of file edit_points.h.
Referenced by GetGridConstraint(), and SetGridConstraint().
|
private |
True if this point is being manipulated.
Definition at line 202 of file edit_points.h.
Referenced by IsActive(), and SetActive().
|
private |
True if this point is being hovered over.
Definition at line 203 of file edit_points.h.
Referenced by IsHover(), and SetHover().
|
private |
Position of EDIT_POINT.
Definition at line 201 of file edit_points.h.
Referenced by GetPosition(), operator==(), and SetPosition().
|
private |
Describe the object snapping behavior.
An optional connected item record used to mimic polyLine behavior with individual line segments.
Definition at line 205 of file edit_points.h.
Referenced by GetSnapConstraint(), and SetSnapConstraint().
|
static |
Definition at line 190 of file edit_points.h.
Referenced by EE_POINT_EDITOR::addCornerCondition(), EDIT_POINTS::FindPoint(), EDIT_POINTS::ViewDraw(), and PCB_TUNING_PATTERN::ViewDraw().