KiCad PCB EDA Suite
|
Represent a line connecting two EDIT_POINTs. More...
#include <edit_points.h>
Public Member Functions | |
EDIT_LINE (EDIT_POINT &aOrigin, EDIT_POINT &aEnd) | |
virtual VECTOR2I | GetPosition () const override |
Return coordinates of an EDIT_POINT. | |
virtual void | SetPosition (const VECTOR2I &aPosition) override |
Return coordinates of an EDIT_POINT. | |
virtual void | ApplyConstraint (const GRID_HELPER &aGrid) override |
Correct coordinates of an EDIT_POINT by applying previously set constraint. | |
void | SetConstraint (EDIT_CONSTRAINT< EDIT_LINE > *aConstraint) |
Set a constraint for and EDIT_POINT. | |
EDIT_CONSTRAINT< EDIT_LINE > * | GetConstraint () const |
Return the constraint imposed on an EDIT_POINT. | |
EDIT_POINT & | GetOrigin () |
Return the origin EDIT_POINT. | |
const EDIT_POINT & | GetOrigin () const |
EDIT_POINT & | GetEnd () |
Return the end EDIT_POINT. | |
const EDIT_POINT & | GetEnd () const |
bool | HasCenterPoint () const |
Is the center-point of the line useful to be shown? | |
void | SetHasCenterPoint (bool aHasCenterPoint) |
Set if the center-point of the line should be shown. | |
bool | DrawLine () const |
Should the line itself be drawn, or just the end and/or center points? | |
void | SetDrawLine (bool aShowLine) |
Set if the line itself should be drawn. | |
bool | operator== (const EDIT_POINT &aOther) const |
bool | operator== (const EDIT_LINE &aOther) const |
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 (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. | |
void | ClearConstraint () |
Remove previously set constraint. | |
bool | IsConstrained () const |
Check if point is constrained. | |
bool | IsActive () const |
void | SetActive (bool aActive=true) |
bool | IsHover () const |
void | SetHover (bool aHover=true) |
bool | DrawCircle () const |
void | SetDrawCircle (bool aDrawCircle=true) |
GRID_CONSTRAINT_TYPE | GetGridConstraint () const |
void | SetGridConstraint (GRID_CONSTRAINT_TYPE aConstraint) |
SNAP_CONSTRAINT_TYPE | GetSnapConstraint () const |
void | SetSnapConstraint (SNAP_CONSTRAINT_TYPE aConstraint) |
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 | |
EDIT_POINT & | m_origin |
Origin point for a line. | |
EDIT_POINT & | m_end |
End point for a line. | |
bool | m_hasCenterPoint = true |
True if the line has a (useful) center point. | |
bool | m_showLine = false |
True if the line itself should be drawn. | |
std::shared_ptr< EDIT_CONSTRAINT< EDIT_LINE > > | m_constraint |
Constraint for the point, NULL if none. | |
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_drawCircle |
True if the point is drawn circular. | |
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. | |
Represent a line connecting two EDIT_POINTs.
This allows one to move them both by dragging the EDIT_POINT in the middle. It uses references to EDIT_POINTs, all coordinates are automatically synchronized.
Definition at line 227 of file edit_points.h.
|
inline |
Definition at line 234 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), GetPosition(), m_end, m_origin, EDIT_POINT::SetGridConstraint(), and SNAP_BY_GRID.
Referenced by operator==().
|
inlineoverridevirtual |
Correct coordinates of an EDIT_POINT by applying previously set constraint.
Reimplemented from EDIT_POINT.
Definition at line 258 of file edit_points.h.
References m_constraint, m_end, and m_origin.
|
inlineinherited |
Remove previously set constraint.
Definition at line 149 of file edit_points.h.
References m_constraint.
|
inlineinherited |
Definition at line 179 of file edit_points.h.
References m_drawCircle.
|
inline |
Should the line itself be drawn, or just the end and/or center points?
Definition at line 325 of file edit_points.h.
References m_showLine.
|
inlinevirtualinherited |
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 |
Return the constraint imposed on an EDIT_POINT.
If there are no constraints, NULL is returned.
Definition at line 281 of file edit_points.h.
References m_constraint.
|
inline |
Return the end EDIT_POINT.
Definition at line 302 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), and m_end.
Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_CONVERGING::EC_CONVERGING(), and EC_PERPLINE::EC_PERPLINE().
|
inline |
Definition at line 307 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), and m_end.
|
inlineinherited |
Definition at line 182 of file edit_points.h.
References m_gridConstraint.
Referenced by EC_45DEGREE::Apply(), EC_90DEGREE::Apply(), EC_HORIZONTAL::Apply(), EC_LINE::Apply(), and EC_VERTICAL::Apply().
|
inline |
Return the origin EDIT_POINT.
Definition at line 289 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), and m_origin.
Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_CONVERGING::EC_CONVERGING(), and EC_PERPLINE::EC_PERPLINE().
|
inline |
Definition at line 294 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), and m_origin.
|
inlineoverridevirtual |
Return coordinates of an EDIT_POINT.
Reimplemented from EDIT_POINT.
Definition at line 243 of file edit_points.h.
References m_end, and m_origin.
Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_CONVERGING::EC_CONVERGING(), EC_PERPLINE::EC_PERPLINE(), EDIT_LINE(), operator==(), and SetPosition().
|
inlineinherited |
Definition at line 185 of file edit_points.h.
References m_snapConstraint.
|
inlineinherited |
Return X coordinate of an EDIT_POINT.
Definition at line 88 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::x.
Referenced by PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), and SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inlineinherited |
Return Y coordinate of an EDIT_POINT.
Definition at line 96 of file edit_points.h.
References GetPosition(), and VECTOR2< T >::y.
Referenced by PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), and SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inline |
Is the center-point of the line useful to be shown?
Definition at line 315 of file edit_points.h.
References m_hasCenterPoint.
|
inlineinherited |
Definition at line 173 of file edit_points.h.
References m_isActive.
Referenced by KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), PCB_TUNING_PATTERN::UpdateFromEditPoints(), and EDIT_POINTS::ViewDraw().
|
inlineinherited |
Check if point is constrained.
Definition at line 159 of file edit_points.h.
References m_constraint.
|
inlineinherited |
Definition at line 176 of file edit_points.h.
References m_isHover.
Referenced by KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), and EDIT_POINTS::ViewDraw().
|
inline |
Definition at line 337 of file edit_points.h.
References EDIT_LINE(), m_end, and m_origin.
|
inline |
Definition at line 332 of file edit_points.h.
References EDIT_POINT::EDIT_POINT(), GetPosition(), and EDIT_POINT::GetPosition().
|
inlineinherited |
Definition at line 174 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 272 of file edit_points.h.
References m_constraint.
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline(), RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints(), SHEET_POINT_EDIT_BEHAVIOR::MakePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints().
|
inlineinherited |
Set a constraint for and EDIT_POINT.
aConstraint | is the constraint to be set. |
Definition at line 132 of file edit_points.h.
References m_constraint.
Referenced by ALIGNED_DIMENSION_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().
|
inlineinherited |
Definition at line 180 of file edit_points.h.
References m_drawCircle.
Referenced by RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints(), and RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints().
|
inline |
Set if the line itself should be drawn.
Definition at line 330 of file edit_points.h.
References m_showLine.
Referenced by EDIT_POINTS::AddIndicatorLine().
|
inlineinherited |
Definition at line 183 of file edit_points.h.
References m_gridConstraint.
Referenced by EDIT_LINE::EDIT_LINE(), and PCB_TUNING_PATTERN::MakeEditPoints().
|
inline |
Set if the center-point of the line should be shown.
Definition at line 320 of file edit_points.h.
References m_hasCenterPoint.
Referenced by EDIT_POINTS::AddIndicatorLine().
|
inlineinherited |
Definition at line 177 of file edit_points.h.
References m_isHover.
|
inlineoverridevirtual |
Return coordinates of an EDIT_POINT.
Reimplemented from EDIT_POINT.
Definition at line 249 of file edit_points.h.
References GetPosition(), m_end, and m_origin.
Referenced by EC_CONVERGING::Apply(), and EC_PERPLINE::Apply().
|
inlinevirtualinherited |
Definition at line 113 of file edit_points.h.
References m_position.
|
inlineinherited |
Definition at line 186 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().
|
inherited |
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 37 of file edit_points.cpp.
References GetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
staticinherited |
Border size when not hovering.
Definition at line 200 of file edit_points.h.
Referenced by KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), and EDIT_POINTS::ViewDraw().
|
staticinherited |
Border size when hovering.
Definition at line 201 of file edit_points.h.
Referenced by EDIT_POINTS::ViewDraw().
|
privateinherited |
An optional connected item record used to mimic polyLine behavior with individual line segments.
Definition at line 214 of file edit_points.h.
Referenced by GetConnected().
|
private |
Constraint for the point, NULL if none.
Definition at line 350 of file edit_points.h.
Referenced by ApplyConstraint(), GetConstraint(), and SetConstraint().
|
privateinherited |
True if the point is drawn circular.
Definition at line 208 of file edit_points.h.
Referenced by DrawCircle(), and SetDrawCircle().
|
private |
End point for a line.
Definition at line 344 of file edit_points.h.
Referenced by ApplyConstraint(), EDIT_LINE(), GetEnd(), GetEnd(), GetPosition(), operator==(), and SetPosition().
|
privateinherited |
Describe the grid snapping behavior.
Definition at line 209 of file edit_points.h.
Referenced by GetGridConstraint(), and SetGridConstraint().
|
private |
True if the line has a (useful) center point.
Definition at line 346 of file edit_points.h.
Referenced by HasCenterPoint(), and SetHasCenterPoint().
|
privateinherited |
True if this point is being manipulated.
Definition at line 206 of file edit_points.h.
Referenced by IsActive(), and SetActive().
|
privateinherited |
True if this point is being hovered over.
Definition at line 207 of file edit_points.h.
Referenced by IsHover(), and SetHover().
|
private |
Origin point for a line.
Definition at line 343 of file edit_points.h.
Referenced by ApplyConstraint(), EDIT_LINE(), GetOrigin(), GetOrigin(), GetPosition(), operator==(), and SetPosition().
|
privateinherited |
Position of EDIT_POINT.
Definition at line 205 of file edit_points.h.
Referenced by GetPosition(), operator==(), SetPosition(), and SetPosition().
|
private |
True if the line itself should be drawn.
Definition at line 347 of file edit_points.h.
Referenced by DrawLine(), and SetDrawLine().
|
privateinherited |
Describe the object snapping behavior.
Definition at line 210 of file edit_points.h.
Referenced by GetSnapConstraint(), and SetSnapConstraint().
|
staticinherited |
Single point size in pixels.
Definition at line 194 of file edit_points.h.
Referenced by SCH_POINT_EDITOR::addCornerCondition(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), EDIT_POINTS::FindPoint(), EDIT_POINTS::ViewDraw(), and PCB_TUNING_PATTERN::ViewDraw().