|
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 | SetRelation (std::unique_ptr< EDIT_RELATION > aRelation) |
| Set a relation for an EDIT_POINT. | |
| EDIT_RELATION * | GetRelation () const |
| Return the relation imposed on an EDIT_POINT. | |
| virtual bool | IsConstrained () const |
| Check if point is constrained. | |
| virtual void | ApplyRelation (const GRID_HELPER &aGrid) |
| Correct coordinates of an EDIT_POINT by applying its relation. | |
| bool | IsActive () const |
| void | SetActive (bool aActive=true) |
| bool | IsHover () const |
| void | SetHover (bool aHover=true) |
| bool | IsSelected () const |
| void | SetSelected (bool aSelected=true) |
| bool | IsDependent () const |
| void | SetDependent (bool aDependent=true) |
| bool | DrawCircle () const |
| void | SetDrawCircle (bool aDrawCircle=true) |
| bool | DrivesWholeShape () const |
| Whether dragging this handle rebuilds the whole shape instead of placing one of its points, the way a rectangle's centre moves it and its radius handle rounds it. | |
| void | SetDrivesWholeShape (bool aDrives=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 |
Static Public Attributes | |
| static const int | POINT_SIZE = 8 |
| Single point size in pixels. | |
| 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. | |
| bool | m_isSelected |
| True if the user has picked this point. | |
| bool | m_isDependent |
| True if this point follows a point the user picked. | |
| bool | m_drawCircle |
| True if the point is drawn circular. | |
| bool | m_drivesWholeShape |
| True if dragging it rebuilds the whole shape. | |
| 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 |
| An optional connected item record used to mimic polyLine behavior with individual line segments. | |
| std::shared_ptr< EDIT_RELATION > | m_relation |
| Relation for the point, NULL if none. | |
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 43 of file edit_points.h.
|
inline |
| aPoint | stores coordinates for EDIT_POINT. |
| aConnected | is the item the EDIT_POINT is connected to. |
Definition at line 50 of file edit_points.h.
Referenced by EDIT_LINE::EDIT_LINE(), EDIT_LINE::GetEnd(), EDIT_LINE::GetEnd(), EDIT_LINE::GetOrigin(), EDIT_LINE::GetOrigin(), EDIT_LINE::operator==(), and operator==().
|
inlinevirtual |
Definition at line 64 of file edit_points.h.
|
inlinevirtual |
Correct coordinates of an EDIT_POINT by applying its relation.
Reimplemented in EDIT_LINE.
Definition at line 159 of file edit_points.h.
References m_relation.
Referenced by BlockDragApplyDisplacement(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 177 of file edit_points.h.
References m_drawCircle.
|
inline |
Whether dragging this handle rebuilds the whole shape instead of placing one of its points, the way a rectangle's centre moves it and its radius handle rounds it.
Definition at line 182 of file edit_points.h.
References m_drivesWholeShape.
Referenced by BlockDragHandlePickable(), and BOOST_AUTO_TEST_CASE().
|
inlinevirtual |
Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag.
Definition at line 80 of file edit_points.h.
References m_connected.
Referenced by LINE_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Definition at line 185 of file edit_points.h.
References m_gridConstraint.
Referenced by EDIT_RELATION::Apply().
|
inlinevirtual |
Return coordinates of an EDIT_POINT.
Reimplemented in EDIT_LINE.
Definition at line 72 of file edit_points.h.
References m_position.
Referenced by EDIT_RELATION::Apply(), POLYGON_EDGE_DRAG_POLICY::applyConverging(), authoredSnapRelation(), BLOCK_DRAG_SESSION::Begin(), BlockDragLassoPick(), BlockDragMoveOrigins(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), constraintMemberForEditPoint(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), findVertex(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_CENTER_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), EDA_ARC_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), GetX(), GetY(), SCH_POINT_EDITOR::Main(), PCB_POINT_EDITOR::OnSelectionChange(), EDIT_LINE::operator==(), EDIT_RELATION::PerpendicularTranslation(), EDIT_RELATION::PointOnLine(), POLYGON_EDGE_DRAG_POLICY::POLYGON_EDGE_DRAG_POLICY(), PCB_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), SCH_POINT_EDITOR::setEditedPoint(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), PCB_TUNING_PATTERN::UpdateFromEditPoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_ARC_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::UpdateItem(), GRID_POINT_EDIT_BEHAVIOR::UpdateItem(), LINE_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), SHAPE_GROUP_POINT_EDIT_BEHAVIOR::UpdateItem(), SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateOrthogonalDimension(), POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints(), EDIT_POINTS::ViewDraw(), and WithinPoint().
|
inline |
Return the relation imposed on an EDIT_POINT.
If there is no relation, NULL is returned.
Definition at line 141 of file edit_points.h.
References m_relation.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 188 of file edit_points.h.
References m_snapConstraint.
Referenced by BLOCK_DRAG_SESSION::Begin().
|
inline |
Return X coordinate of an EDIT_POINT.
Definition at line 88 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::x.
Referenced by BOOST_AUTO_TEST_CASE(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), and SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Return Y coordinate of an EDIT_POINT.
Definition at line 96 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Definition at line 165 of file edit_points.h.
References m_isActive.
Referenced by BOOST_AUTO_TEST_CASE(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), PCB_TUNING_PATTERN::UpdateFromEditPoints(), and EDIT_POINTS::ViewDraw().
|
inlinevirtual |
Check if point is constrained.
Reimplemented in EDIT_LINE.
Definition at line 151 of file edit_points.h.
References m_relation.
|
inline |
Definition at line 174 of file edit_points.h.
References m_isDependent.
Referenced by BOOST_AUTO_TEST_CASE(), and EDIT_POINTS::ViewDraw().
|
inline |
Definition at line 168 of file edit_points.h.
References m_isHover.
Referenced by BOOST_AUTO_TEST_CASE(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), and EDIT_POINTS::ViewDraw().
|
inline |
Definition at line 171 of file edit_points.h.
References m_isSelected.
Referenced by BOOST_AUTO_TEST_CASE(), and EDIT_POINTS::ViewDraw().
|
inline |
Definition at line 191 of file edit_points.h.
References EDIT_POINT(), and m_position.
|
inline |
Definition at line 166 of file edit_points.h.
References m_isActive.
Referenced by BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::OnSelectionChange().
|
inline |
Definition at line 175 of file edit_points.h.
References m_isDependent.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 178 of file edit_points.h.
References m_drawCircle.
Referenced by RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints(), and RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints().
|
inline |
Definition at line 183 of file edit_points.h.
References m_drivesWholeShape.
Referenced by EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::MakePoints(), and RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints().
|
inline |
Definition at line 186 of file edit_points.h.
References m_gridConstraint.
Referenced by EDIT_LINE::EDIT_LINE(), and PCB_TUNING_PATTERN::MakeEditPoints().
|
inline |
Definition at line 169 of file edit_points.h.
References m_isHover.
Referenced by BOOST_AUTO_TEST_CASE().
|
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 108 of file edit_points.h.
References m_position.
Referenced by EDIT_RELATION::Apply(), POLYGON_EDGE_DRAG_POLICY::applyConverging(), POLYGON_EDGE_DRAG_POLICY::applyFixedLength(), BlockDragApplyDisplacement(), PCB_TUNING_PATTERN::UpdateEditPoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdatePoints(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_ARC_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::UpdatePoints(), EDA_TABLECELL_POINT_EDIT_BEHAVIOR::UpdatePoints(), GRID_POINT_EDIT_BEHAVIOR::UpdatePoints(), LINE_POINT_EDIT_BEHAVIOR::UpdatePoints(), PAD_POINT_EDIT_BEHAVIOR::UpdatePoints(), PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdatePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdatePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdatePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdatePoints(), SHAPE_GROUP_POINT_EDIT_BEHAVIOR::UpdatePoints(), SHEET_POINT_EDIT_BEHAVIOR::UpdatePoints(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline().
|
inlinevirtual |
Definition at line 113 of file edit_points.h.
References m_position.
|
inline |
Set a relation for an EDIT_POINT.
| aRelation | is the relation to be set. |
Definition at line 132 of file edit_points.h.
References m_relation.
Referenced by BOOST_AUTO_TEST_CASE(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::MakePoints(), BARCODE_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_LEADER_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::MakePoints(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), and DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Definition at line 172 of file edit_points.h.
References m_isSelected.
Referenced by PCB_POINT_EDITOR::applyPickedFlags(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 189 of file edit_points.h.
References m_snapConstraint.
Referenced by ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_CENTER_POINT_EDIT_BEHAVIOR::MakePoints(), DIM_LEADER_POINT_EDIT_BEHAVIOR::MakePoints(), and DIM_RADIAL_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 203 of file edit_points.h.
Referenced by KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), and EDIT_POINTS::ViewDraw().
|
static |
Border size when hovering.
Definition at line 204 of file edit_points.h.
Referenced by EDIT_POINTS::ViewDraw().
|
private |
An optional connected item record used to mimic polyLine behavior with individual line segments.
Definition at line 220 of file edit_points.h.
Referenced by GetConnected().
|
private |
True if the point is drawn circular.
Definition at line 213 of file edit_points.h.
Referenced by DrawCircle(), and SetDrawCircle().
|
private |
True if dragging it rebuilds the whole shape.
Definition at line 214 of file edit_points.h.
Referenced by DrivesWholeShape(), and SetDrivesWholeShape().
|
private |
Describe the grid snapping behavior.
Definition at line 215 of file edit_points.h.
Referenced by GetGridConstraint(), and SetGridConstraint().
|
private |
True if this point is being manipulated.
Definition at line 209 of file edit_points.h.
Referenced by IsActive(), and SetActive().
|
private |
True if this point follows a point the user picked.
Definition at line 212 of file edit_points.h.
Referenced by IsDependent(), and SetDependent().
|
private |
True if this point is being hovered over.
Definition at line 210 of file edit_points.h.
Referenced by IsHover(), and SetHover().
|
private |
True if the user has picked this point.
Definition at line 211 of file edit_points.h.
Referenced by IsSelected(), and SetSelected().
|
private |
Position of EDIT_POINT.
Definition at line 208 of file edit_points.h.
Referenced by GetPosition(), operator==(), SetPosition(), and SetPosition().
|
private |
Relation for the point, NULL if none.
Definition at line 223 of file edit_points.h.
Referenced by ApplyRelation(), GetRelation(), IsConstrained(), and SetRelation().
|
private |
Describe the object snapping behavior.
Definition at line 216 of file edit_points.h.
Referenced by GetSnapConstraint(), and SetSnapConstraint().
|
static |
Single point size in pixels.
Definition at line 197 of file edit_points.h.
Referenced by SCH_POINT_EDITOR::addCornerCondition(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), EDIT_POINTS::FindPoint(), CONSTRAINT_BADGE_ITEM::ViewDraw(), EDIT_POINTS::ViewDraw(), and PCB_TUNING_PATTERN::ViewDraw().