KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EDIT_POINT Class Reference

Represent a single point that can be used for modifying items. More...

#include <edit_points.h>

Inheritance diagram for EDIT_POINT:
EDIT_LINE

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)
 
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)
 
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_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.
 
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_constraint
 Constraint for the point, NULL if none.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ EDIT_POINT()

EDIT_POINT::EDIT_POINT ( const VECTOR2I & aPoint,
std::pair< EDA_ITEM *, int > aConnected = { nullptr, 0 } )
inline

◆ ~EDIT_POINT()

virtual EDIT_POINT::~EDIT_POINT ( )
inlinevirtual

Definition at line 64 of file edit_points.h.

Member Function Documentation

◆ ApplyConstraint()

virtual void EDIT_POINT::ApplyConstraint ( const GRID_HELPER & aGrid)
inlinevirtual

Correct coordinates of an EDIT_POINT by applying previously set constraint.

Reimplemented in EDIT_LINE.

Definition at line 167 of file edit_points.h.

References m_constraint.

◆ ClearConstraint()

void EDIT_POINT::ClearConstraint ( )
inline

Remove previously set constraint.

Definition at line 149 of file edit_points.h.

References m_constraint.

◆ DrawCircle()

bool EDIT_POINT::DrawCircle ( ) const
inline

Definition at line 179 of file edit_points.h.

References m_drawCircle.

◆ GetConnected()

virtual std::pair< EDA_ITEM *, int > EDIT_POINT::GetConnected ( ) const
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().

◆ GetConstraint()

EDIT_CONSTRAINT< EDIT_POINT > * EDIT_POINT::GetConstraint ( ) const
inline

Return the constraint imposed on an EDIT_POINT.

If there are no constraints, NULL is returned.

Definition at line 141 of file edit_points.h.

References m_constraint.

◆ GetGridConstraint()

GRID_CONSTRAINT_TYPE EDIT_POINT::GetGridConstraint ( ) const
inline

◆ GetPosition()

virtual VECTOR2I EDIT_POINT::GetPosition ( ) const
inlinevirtual

Return coordinates of an EDIT_POINT.

Note
It may be different than coordinates of a graphical item that is bound to the EDIT_POINT.

Reimplemented in EDIT_LINE.

Definition at line 72 of file edit_points.h.

References m_position.

Referenced by EC_45DEGREE::Apply(), EC_90DEGREE::Apply(), EC_CIRCLE::Apply(), EC_CONVERGING::Apply(), EC_HORIZONTAL::Apply(), EC_LINE::Apply(), EC_PERPLINE::Apply(), EC_VERTICAL::Apply(), KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), EC_CONVERGING::EC_CONVERGING(), EC_PERPLINE::EC_PERPLINE(), 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(), EDIT_LINE::operator==(), PCB_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), SCH_POINT_EDITOR::setEditedPoint(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), PCB_TUNING_PATTERN::UpdateFromEditPoints(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), 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_SEGMENT_POINT_EDIT_BEHAVIOR::UpdateItem(), LINE_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_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().

◆ GetSnapConstraint()

SNAP_CONSTRAINT_TYPE EDIT_POINT::GetSnapConstraint ( ) const
inline

Definition at line 185 of file edit_points.h.

References m_snapConstraint.

◆ GetX()

◆ GetY()

int EDIT_POINT::GetY ( ) const
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 PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), and SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem().

◆ IsActive()

bool EDIT_POINT::IsActive ( ) const
inline

◆ IsConstrained()

bool EDIT_POINT::IsConstrained ( ) const
inline

Check if point is constrained.

Returns
True is point is constrained, false otherwise.

Definition at line 159 of file edit_points.h.

References m_constraint.

◆ IsHover()

bool EDIT_POINT::IsHover ( ) const
inline

Definition at line 176 of file edit_points.h.

References m_isHover.

Referenced by KIGFX::PREVIEW::ANGLE_ITEM::drawPreviewShape(), and EDIT_POINTS::ViewDraw().

◆ operator==()

bool EDIT_POINT::operator== ( const EDIT_POINT & aOther) const
inline

Definition at line 188 of file edit_points.h.

References EDIT_POINT(), and m_position.

◆ SetActive()

void EDIT_POINT::SetActive ( bool aActive = true)
inline

Definition at line 174 of file edit_points.h.

References m_isActive.

Referenced by PCB_POINT_EDITOR::OnSelectionChange().

◆ SetConstraint()

◆ SetDrawCircle()

void EDIT_POINT::SetDrawCircle ( bool aDrawCircle = true)
inline

◆ SetGridConstraint()

void EDIT_POINT::SetGridConstraint ( GRID_CONSTRAINT_TYPE aConstraint)
inline

Definition at line 183 of file edit_points.h.

References m_gridConstraint.

Referenced by EDIT_LINE::EDIT_LINE(), and PCB_TUNING_PATTERN::MakeEditPoints().

◆ SetHover()

void EDIT_POINT::SetHover ( bool aHover = true)
inline

Definition at line 177 of file edit_points.h.

References m_isHover.

◆ SetPosition() [1/2]

◆ SetPosition() [2/2]

virtual void EDIT_POINT::SetPosition ( int x,
int y )
inlinevirtual

Definition at line 113 of file edit_points.h.

References m_position.

◆ SetSnapConstraint()

◆ WithinPoint()

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.

Parameters
aPointis point to be checked.
aSizeis length of the square side.

Definition at line 37 of file edit_points.cpp.

References GetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.

Member Data Documentation

◆ BORDER_SIZE

const int EDIT_POINT::BORDER_SIZE = 2
static

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().

◆ HOVER_SIZE

const int EDIT_POINT::HOVER_SIZE = 5
static

Border size when hovering.

Definition at line 201 of file edit_points.h.

Referenced by EDIT_POINTS::ViewDraw().

◆ m_connected

std::pair<EDA_ITEM*, int> EDIT_POINT::m_connected
private

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().

◆ m_constraint

std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT> > EDIT_POINT::m_constraint
private

Constraint for the point, NULL if none.

Definition at line 217 of file edit_points.h.

Referenced by ApplyConstraint(), ClearConstraint(), GetConstraint(), IsConstrained(), and SetConstraint().

◆ m_drawCircle

bool EDIT_POINT::m_drawCircle
private

True if the point is drawn circular.

Definition at line 208 of file edit_points.h.

Referenced by DrawCircle(), and SetDrawCircle().

◆ m_gridConstraint

GRID_CONSTRAINT_TYPE EDIT_POINT::m_gridConstraint
private

Describe the grid snapping behavior.

Definition at line 209 of file edit_points.h.

Referenced by GetGridConstraint(), and SetGridConstraint().

◆ m_isActive

bool EDIT_POINT::m_isActive
private

True if this point is being manipulated.

Definition at line 206 of file edit_points.h.

Referenced by IsActive(), and SetActive().

◆ m_isHover

bool EDIT_POINT::m_isHover
private

True if this point is being hovered over.

Definition at line 207 of file edit_points.h.

Referenced by IsHover(), and SetHover().

◆ m_position

VECTOR2I EDIT_POINT::m_position
private

Position of EDIT_POINT.

Definition at line 205 of file edit_points.h.

Referenced by GetPosition(), operator==(), SetPosition(), and SetPosition().

◆ m_snapConstraint

SNAP_CONSTRAINT_TYPE EDIT_POINT::m_snapConstraint
private

Describe the object snapping behavior.

Definition at line 210 of file edit_points.h.

Referenced by GetSnapConstraint(), and SetSnapConstraint().

◆ POINT_SIZE

const int EDIT_POINT::POINT_SIZE = 8
static

The documentation for this class was generated from the following files: