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

Represent a line connecting two EDIT_POINTs. More...

#include <edit_points.h>

Inheritance diagram for EDIT_LINE:
EDIT_POINT

Public Member Functions

 EDIT_LINE (EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
 
virtual VECTOR2I GetPosition () const override
 Return coordinates of an EDIT_POINT. More...
 
virtual void SetPosition (const VECTOR2I &aPosition) override
 Correct coordinates of an EDIT_POINT by applying previously set constraint. More...
 
virtual void ApplyConstraint (const GRID_HELPER &aGrid) override
 Correct coordinates of an EDIT_POINT by applying previously set constraint. More...
 
void SetConstraint (EDIT_CONSTRAINT< EDIT_LINE > *aConstraint)
 Set a constraint for and EDIT_POINT. More...
 
EDIT_CONSTRAINT< EDIT_LINE > * GetConstraint () const
 Return the constraint imposed on an EDIT_POINT. More...
 
EDIT_POINTGetOrigin ()
 Return the origin EDIT_POINT. More...
 
const EDIT_POINTGetOrigin () const
 
EDIT_POINTGetEnd ()
 Return the end EDIT_POINT. More...
 
const EDIT_POINTGetEnd () const
 
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. More...
 
int GetX () const
 Return X coordinate of an EDIT_POINT. More...
 
int GetY () const
 Return Y coordinate of an EDIT_POINT. More...
 
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. More...
 
void SetConstraint (EDIT_CONSTRAINT< EDIT_POINT > *aConstraint)
 Set a constraint for and EDIT_POINT. More...
 
void ClearConstraint ()
 Remove previously set constraint. More...
 
bool IsConstrained () const
 Check if point is constrained. More...
 
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)
 

Static Public Attributes

static const int POINT_SIZE = 8
 Border size when not hovering. More...
 
static const int BORDER_SIZE = 2
 Border size when hovering. More...
 
static const int HOVER_SIZE = 5
 

Private Attributes

EDIT_POINTm_origin
 Origin point for a line. More...
 
EDIT_POINTm_end
 End point for a line. More...
 
std::shared_ptr< EDIT_CONSTRAINT< EDIT_LINE > > m_constraint
 
VECTOR2I m_position
 Position of EDIT_POINT. More...
 
bool m_isActive
 True if this point is being manipulated. More...
 
bool m_isHover
 True if this point is being hovered over. More...
 
GRID_CONSTRAINT_TYPE m_gridConstraint
 Describe the grid snapping behavior. More...
 
SNAP_CONSTRAINT_TYPE m_snapConstraint
 Describe the object snapping behavior. More...
 
std::pair< EDA_ITEM *, int > m_connected
 Constraint for the point, NULL if none. More...
 

Detailed Description

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 220 of file edit_points.h.

Constructor & Destructor Documentation

◆ EDIT_LINE()

EDIT_LINE::EDIT_LINE ( EDIT_POINT aOrigin,
EDIT_POINT aEnd 
)
inline
Parameters
aOriginis the origin of EDIT_LINE.
aEndis the end of EDIT_LINE. Return coordinates of an EDIT_POINT.
Note
It may be different than coordinates of a graphical item that is bound to the EDIT_POINT.

Definition at line 227 of file edit_points.h.

References EDIT_POINT::SetGridConstraint(), and SNAP_BY_GRID.

Member Function Documentation

◆ ApplyConstraint()

virtual void EDIT_LINE::ApplyConstraint ( const GRID_HELPER aGrid)
inlineoverridevirtual

Correct coordinates of an EDIT_POINT by applying previously set constraint.

Reimplemented from EDIT_POINT.

Definition at line 251 of file edit_points.h.

References EDIT_POINT::ApplyConstraint(), m_constraint, m_end, and m_origin.

◆ ClearConstraint()

void EDIT_POINT::ClearConstraint ( )
inlineinherited

Remove previously set constraint.

Definition at line 148 of file edit_points.h.

References EDIT_POINT::m_constraint.

◆ GetConnected()

virtual std::pair< EDA_ITEM *, int > EDIT_POINT::GetConnected ( ) const
inlinevirtualinherited

Return a connected item record comprising an EDA_ITEM* and a STARTPOINT/ENDPOINT flag.

Definition at line 79 of file edit_points.h.

References EDIT_POINT::m_connected.

◆ GetConstraint()

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

Return the constraint imposed on an EDIT_POINT.

If there are no constraints, NULL is returned.

Definition at line 274 of file edit_points.h.

References m_constraint.

◆ GetEnd() [1/2]

EDIT_POINT & EDIT_LINE::GetEnd ( )
inline

Return the end EDIT_POINT.

Definition at line 295 of file edit_points.h.

References m_end.

Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_CONVERGING::EC_CONVERGING(), and EC_PERPLINE::EC_PERPLINE().

◆ GetEnd() [2/2]

const EDIT_POINT & EDIT_LINE::GetEnd ( ) const
inline

Definition at line 300 of file edit_points.h.

References m_end.

◆ GetGridConstraint()

GRID_CONSTRAINT_TYPE EDIT_POINT::GetGridConstraint ( ) const
inlineinherited

◆ GetOrigin() [1/2]

EDIT_POINT & EDIT_LINE::GetOrigin ( )
inline

Return the origin EDIT_POINT.

Definition at line 282 of file edit_points.h.

References m_origin.

Referenced by EC_CONVERGING::Apply(), EC_PERPLINE::Apply(), EC_CONVERGING::EC_CONVERGING(), and EC_PERPLINE::EC_PERPLINE().

◆ GetOrigin() [2/2]

const EDIT_POINT & EDIT_LINE::GetOrigin ( ) const
inline

Definition at line 287 of file edit_points.h.

References m_origin.

◆ GetPosition()

virtual VECTOR2I EDIT_LINE::GetPosition ( ) const
inlineoverridevirtual

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 from EDIT_POINT.

Definition at line 236 of file edit_points.h.

References EDIT_POINT::GetPosition(), m_end, and m_origin.

Referenced by EC_PERPLINE::Apply(), EC_PERPLINE::EC_PERPLINE(), operator==(), and SetPosition().

◆ GetSnapConstraint()

SNAP_CONSTRAINT_TYPE EDIT_POINT::GetSnapConstraint ( ) const
inlineinherited

Definition at line 181 of file edit_points.h.

References EDIT_POINT::m_snapConstraint.

Referenced by PCB_POINT_EDITOR::OnSelectionChange().

◆ GetX()

int EDIT_POINT::GetX ( ) const
inlineinherited

Return X coordinate of an EDIT_POINT.

Definition at line 87 of file edit_points.h.

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

◆ GetY()

int EDIT_POINT::GetY ( ) const
inlineinherited

Return Y coordinate of an EDIT_POINT.

Definition at line 95 of file edit_points.h.

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

◆ IsActive()

bool EDIT_POINT::IsActive ( ) const
inlineinherited

Definition at line 172 of file edit_points.h.

References EDIT_POINT::m_isActive.

Referenced by EDIT_POINTS::ViewDraw().

◆ IsConstrained()

bool EDIT_POINT::IsConstrained ( ) const
inlineinherited

Check if point is constrained.

Returns
True is point is constrained, false otherwise.

Definition at line 158 of file edit_points.h.

References EDIT_POINT::m_constraint.

Referenced by PCB_POINT_EDITOR::OnSelectionChange().

◆ IsHover()

bool EDIT_POINT::IsHover ( ) const
inlineinherited

Definition at line 175 of file edit_points.h.

References EDIT_POINT::m_isHover.

Referenced by EDIT_POINTS::ViewDraw().

◆ operator==() [1/2]

bool EDIT_LINE::operator== ( const EDIT_LINE aOther) const
inline

Definition at line 310 of file edit_points.h.

References m_end, and m_origin.

◆ operator==() [2/2]

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

Definition at line 305 of file edit_points.h.

References EDIT_POINT::GetPosition(), and GetPosition().

◆ SetActive()

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

Definition at line 173 of file edit_points.h.

References EDIT_POINT::m_isActive.

Referenced by PCB_POINT_EDITOR::OnSelectionChange().

◆ SetConstraint() [1/2]

void EDIT_LINE::SetConstraint ( EDIT_CONSTRAINT< EDIT_LINE > *  aConstraint)
inline

Set a constraint for and EDIT_POINT.

Parameters
aConstraintis the constraint to be set.

Definition at line 265 of file edit_points.h.

References m_constraint.

◆ SetConstraint() [2/2]

void EDIT_POINT::SetConstraint ( EDIT_CONSTRAINT< EDIT_POINT > *  aConstraint)
inlineinherited

Set a constraint for and EDIT_POINT.

Parameters
aConstraintis the constraint to be set.

Definition at line 131 of file edit_points.h.

References EDIT_POINT::m_constraint.

◆ SetGridConstraint()

void EDIT_POINT::SetGridConstraint ( GRID_CONSTRAINT_TYPE  aConstraint)
inlineinherited

Definition at line 179 of file edit_points.h.

References EDIT_POINT::m_gridConstraint.

Referenced by EDIT_LINE().

◆ SetHover()

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

Definition at line 176 of file edit_points.h.

References EDIT_POINT::m_isHover.

Referenced by PCB_POINT_EDITOR::updateEditedPoint().

◆ SetPosition() [1/2]

virtual void EDIT_LINE::SetPosition ( const VECTOR2I aPosition)
inlineoverridevirtual

Correct coordinates of an EDIT_POINT by applying previously set constraint.

Reimplemented from EDIT_POINT.

Definition at line 242 of file edit_points.h.

References EDIT_POINT::GetPosition(), GetPosition(), m_end, m_origin, and EDIT_POINT::SetPosition().

Referenced by EC_PERPLINE::Apply().

◆ SetPosition() [2/2]

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

Definition at line 112 of file edit_points.h.

References EDIT_POINT::m_position, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetSnapConstraint()

void EDIT_POINT::SetSnapConstraint ( SNAP_CONSTRAINT_TYPE  aConstraint)
inlineinherited

Definition at line 182 of file edit_points.h.

References EDIT_POINT::m_snapConstraint.

◆ WithinPoint()

bool EDIT_POINT::WithinPoint ( const VECTOR2I aPoint,
unsigned int  aSize 
) const
inherited

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 33 of file edit_points.cpp.

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

Member Data Documentation

◆ BORDER_SIZE

const int EDIT_POINT::BORDER_SIZE = 2
staticinherited

Border size when hovering.

Definition at line 193 of file edit_points.h.

Referenced by EDIT_POINTS::ViewDraw().

◆ HOVER_SIZE

const int EDIT_POINT::HOVER_SIZE = 5
staticinherited

Definition at line 196 of file edit_points.h.

Referenced by EDIT_POINTS::ViewDraw().

◆ m_connected

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

Constraint for the point, NULL if none.

Definition at line 207 of file edit_points.h.

Referenced by EDIT_POINT::GetConnected().

◆ m_constraint

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

Definition at line 320 of file edit_points.h.

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

◆ m_end

EDIT_POINT& EDIT_LINE::m_end
private

End point for a line.

Constraint for the point, NULL if none

Definition at line 317 of file edit_points.h.

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

◆ m_gridConstraint

GRID_CONSTRAINT_TYPE EDIT_POINT::m_gridConstraint
privateinherited

Describe the grid snapping behavior.

Definition at line 202 of file edit_points.h.

Referenced by EDIT_POINT::GetGridConstraint(), and EDIT_POINT::SetGridConstraint().

◆ m_isActive

bool EDIT_POINT::m_isActive
privateinherited

True if this point is being manipulated.

Definition at line 200 of file edit_points.h.

Referenced by EDIT_POINT::IsActive(), and EDIT_POINT::SetActive().

◆ m_isHover

bool EDIT_POINT::m_isHover
privateinherited

True if this point is being hovered over.

Definition at line 201 of file edit_points.h.

Referenced by EDIT_POINT::IsHover(), and EDIT_POINT::SetHover().

◆ m_origin

EDIT_POINT& EDIT_LINE::m_origin
private

Origin point for a line.

Definition at line 316 of file edit_points.h.

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

◆ m_position

VECTOR2I EDIT_POINT::m_position
privateinherited

Position of EDIT_POINT.

Definition at line 199 of file edit_points.h.

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

◆ m_snapConstraint

SNAP_CONSTRAINT_TYPE EDIT_POINT::m_snapConstraint
privateinherited

Describe the object snapping behavior.

An optional connected item record used to mimic polyLine behavior with individual line segments.

Definition at line 203 of file edit_points.h.

Referenced by EDIT_POINT::GetSnapConstraint(), and EDIT_POINT::SetSnapConstraint().

◆ POINT_SIZE

const int EDIT_POINT::POINT_SIZE = 8
staticinherited

Border size when not hovering.

Definition at line 190 of file edit_points.h.

Referenced by EE_POINT_EDITOR::addCornerCondition(), EDIT_POINTS::FindPoint(), and EDIT_POINTS::ViewDraw().


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