KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ARC_POINT_EDIT_BEHAVIOR Class Reference
Inheritance diagram for ARC_POINT_EDIT_BEHAVIOR:
POINT_EDIT_BEHAVIOR

Public Member Functions

 ARC_POINT_EDIT_BEHAVIOR (SCH_SHAPE &aArc)
 
void MakePoints (EDIT_POINTS &aPoints) override
 Construct the initial set of edit points for the item and append to the given list.
 
void UpdatePoints (EDIT_POINTS &aPoints) override
 Update the list of the edit points for the item.
 
void UpdateItem (const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
 Update the item with the new positions of the edit points.
 
 ARC_POINT_EDIT_BEHAVIOR (PCB_SHAPE &aArc, const ARC_EDIT_MODE &aArcEditMode, KIGFX::VIEW_CONTROLS &aViewContols)
 
void MakePoints (EDIT_POINTS &aPoints) override
 Construct the initial set of edit points for the item and append to the given list.
 
void UpdatePoints (EDIT_POINTS &aPoints) override
 Update the list of the edit points for the item.
 
void UpdateItem (const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
 Update the item with the new positions of the edit points.
 
OPT_VECTOR2I Get45DegreeConstrainer (const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const override
 Get the 45-degree constrainer for the item, when the given point is moved.
 

Static Protected Member Functions

static bool isModified (const EDIT_POINT &aEditedPoint, const EDIT_POINT &aPoint)
 Checks if two points are the same instance - which means the point is being edited.
 

Private Types

enum  ARC_POINTS { ARC_START , ARC_MID , ARC_END , ARC_CENTER }
 

Private Member Functions

void editArcMidKeepCenter (PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
 Move the mid point of the arc, while keeping the two endpoints.
 

Static Private Member Functions

static void editArcEndpointKeepTangent (PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
 Move an end point of the arc, while keeping the tangent at the other endpoint.
 
static void editArcCenterKeepEndpoints (PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
 Move the arc center but keep endpoint locations.
 
static void editArcEndpointKeepCenter (PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
 Move an end point of the arc around the circumference.
 
static void editArcMidKeepEndpoints (PCB_SHAPE &aArc, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
 Move the mid point of the arc, while keeping the angle.
 

Private Attributes

SCH_SHAPEm_arc
 
PCB_SHAPEm_arc
 
const ARC_EDIT_MODEm_arcEditMode
 
KIGFX::VIEW_CONTROLSm_viewControls
 

Detailed Description

Definition at line 184 of file ee_point_editor.cpp.

Member Enumeration Documentation

◆ ARC_POINTS

Enumerator
ARC_START 
ARC_MID 
ARC_END 
ARC_CENTER 

Definition at line 391 of file pcb_point_editor.cpp.

Constructor & Destructor Documentation

◆ ARC_POINT_EDIT_BEHAVIOR() [1/2]

ARC_POINT_EDIT_BEHAVIOR::ARC_POINT_EDIT_BEHAVIOR ( SCH_SHAPE aArc)
inline

Definition at line 187 of file ee_point_editor.cpp.

References EDA_SHAPE::GetShape(), and m_arc.

◆ ARC_POINT_EDIT_BEHAVIOR() [2/2]

ARC_POINT_EDIT_BEHAVIOR::ARC_POINT_EDIT_BEHAVIOR ( PCB_SHAPE aArc,
const ARC_EDIT_MODE aArcEditMode,
KIGFX::VIEW_CONTROLS aViewContols 
)
inline

Definition at line 400 of file pcb_point_editor.cpp.

References EDA_SHAPE::GetShape(), and m_arc.

Member Function Documentation

◆ editArcCenterKeepEndpoints()

static void ARC_POINT_EDIT_BEHAVIOR::editArcCenterKeepEndpoints ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd 
)
inlinestaticprivate

Move the arc center but keep endpoint locations.

Definition at line 635 of file pcb_point_editor.cpp.

References SEG::A, SEG::B, VECTOR2< int32_t >::ECOORD_MAX, SEG::IntersectLines(), VECTOR2< T >::Resize(), EDA_SHAPE::SetCenter(), and SEG::SquaredDistance().

Referenced by UpdateItem().

◆ editArcEndpointKeepCenter()

static void ARC_POINT_EDIT_BEHAVIOR::editArcEndpointKeepCenter ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
)
inlinestaticprivate

◆ editArcEndpointKeepTangent()

static void ARC_POINT_EDIT_BEHAVIOR::editArcEndpointKeepTangent ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
)
inlinestaticprivate

◆ editArcMidKeepCenter()

void ARC_POINT_EDIT_BEHAVIOR::editArcMidKeepCenter ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
)
inlineprivate

Move the mid point of the arc, while keeping the two endpoints.

Definition at line 741 of file pcb_point_editor.cpp.

References EDA_UNIT_UTILS::Mils2IU(), pcbIUScale, VECTOR2< T >::Resize(), EDA_SHAPE::SetEnd(), and EDA_SHAPE::SetStart().

Referenced by UpdateItem().

◆ editArcMidKeepEndpoints()

static void ARC_POINT_EDIT_BEHAVIOR::editArcMidKeepEndpoints ( PCB_SHAPE aArc,
const VECTOR2I aStart,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
)
inlinestaticprivate

Move the mid point of the arc, while keeping the angle.

Definition at line 771 of file pcb_point_editor.cpp.

References EDA_SHAPE::GetArcMid(), SEG::NearestPoint(), VECTOR2< T >::Resize(), and EDA_SHAPE::SetArcGeometry().

Referenced by UpdateItem().

◆ Get45DegreeConstrainer()

OPT_VECTOR2I ARC_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer ( const EDIT_POINT aEditedPoint,
EDIT_POINTS aPoints 
) const
inlineoverridevirtual

Get the 45-degree constrainer for the item, when the given point is moved.

Return std::nullopt if not, and the caller can decide.

If you want to actively disable constraining, return the aEditedPoint position.

Reimplemented from POINT_EDIT_BEHAVIOR.

Definition at line 471 of file pcb_point_editor.cpp.

References ARC_CENTER, EDIT_POINT::GetPosition(), and EDIT_POINTS::Point().

◆ isModified()

◆ MakePoints() [1/2]

void ARC_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

Construct the initial set of edit points for the item and append to the given list.

Parameters
aPointsThe list of edit points to fill.

Implements POINT_EDIT_BEHAVIOR.

Definition at line 193 of file ee_point_editor.cpp.

References EDIT_POINTS::AddIndicatorLine(), EDIT_POINTS::AddPoint(), ARC_CENTER, ARC_END, ARC_START, EDA_SHAPE::GetEnd(), SCH_SHAPE::GetPosition(), EDA_SHAPE::GetStart(), m_arc, and EDIT_POINTS::Point().

◆ MakePoints() [2/2]

void ARC_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

Construct the initial set of edit points for the item and append to the given list.

Parameters
aPointsThe list of edit points to fill.

Implements POINT_EDIT_BEHAVIOR.

Definition at line 407 of file pcb_point_editor.cpp.

References EDIT_POINTS::AddIndicatorLine(), EDIT_POINTS::AddPoint(), ARC_CENTER, ARC_END, ARC_START, EDA_SHAPE::GetArcMid(), SCH_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), m_arc, and EDIT_POINTS::Point().

◆ UpdateItem() [1/2]

void ARC_POINT_EDIT_BEHAVIOR::UpdateItem ( const EDIT_POINT aEditedPoint,
EDIT_POINTS aPoints,
COMMIT aCommit,
std::vector< EDA_ITEM * > &  aUpdatedItems 
)
inlineoverridevirtual

Update the item with the new positions of the edit points.

This method should all commit and add to the update list anything that is NOT the parent item of the EDIT_POINTs. For example, connected lines, parent tables, etc. The item itself is already handled (most behaviors don't need more than that).

Parameters
aEditedPointThe point that was dragged. You can use this to check by address which point to update.
aPointsThe new positions of the edit points.
aCommitThe commit object to use to modify the item.
aUpdatedItemsThe list of items that were updated by the edit (not only the item that was being edited, but also any other items that were affected, e.g. by being conneted to the edited item).

Implements POINT_EDIT_BEHAVIOR.

Definition at line 210 of file ee_point_editor.cpp.

References ARC_CENTER, ARC_END, ARC_START, SCH_SHAPE::CalcEdit(), EDIT_POINT::GetPosition(), POINT_EDIT_BEHAVIOR::isModified(), m_arc, EDIT_POINTS::Point(), and SCH_SHAPE::SetEditState().

◆ UpdateItem() [2/2]

void ARC_POINT_EDIT_BEHAVIOR::UpdateItem ( const EDIT_POINT aEditedPoint,
EDIT_POINTS aPoints,
COMMIT aCommit,
std::vector< EDA_ITEM * > &  aUpdatedItems 
)
inlineoverridevirtual

Update the item with the new positions of the edit points.

This method should all commit and add to the update list anything that is NOT the parent item of the EDIT_POINTs. For example, connected lines, parent tables, etc. The item itself is already handled (most behaviors don't need more than that).

Parameters
aEditedPointThe point that was dragged. You can use this to check by address which point to update.
aPointsThe new positions of the edit points.
aCommitThe commit object to use to modify the item.
aUpdatedItemsThe list of items that were updated by the edit (not only the item that was being edited, but also any other items that were affected, e.g. by being conneted to the edited item).

Implements POINT_EDIT_BEHAVIOR.

Definition at line 428 of file pcb_point_editor.cpp.

References ARC_CENTER, ARC_END, ARC_START, CHECK_POINT_COUNT, editArcCenterKeepEndpoints(), editArcEndpointKeepCenter(), editArcEndpointKeepTangent(), editArcMidKeepCenter(), editArcMidKeepEndpoints(), SCH_SHAPE::GetCenter(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDIT_POINT::GetPosition(), POINT_EDIT_BEHAVIOR::isModified(), m_arc, m_arcEditMode, m_viewControls, SCH_SHAPE::Move(), EDIT_POINTS::Point(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ UpdatePoints() [1/2]

void ARC_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

Update the list of the edit points for the item.

Be very careful not to overrun the list of points - this class knows how bug there are because it made them in the first place.

If item has changed such that that number of points needs to change, this method has to handle that (probably by clearing the list and refilling it).

Parameters
aPointsThe list of edit points to update.

Implements POINT_EDIT_BEHAVIOR.

Definition at line 203 of file ee_point_editor.cpp.

References ARC_CENTER, ARC_END, ARC_START, EDA_SHAPE::GetEnd(), SCH_SHAPE::GetPosition(), EDA_SHAPE::GetStart(), m_arc, EDIT_POINTS::Point(), and EDIT_POINT::SetPosition().

◆ UpdatePoints() [2/2]

void ARC_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

Update the list of the edit points for the item.

Be very careful not to overrun the list of points - this class knows how bug there are because it made them in the first place.

If item has changed such that that number of points needs to change, this method has to handle that (probably by clearing the list and refilling it).

Parameters
aPointsThe list of edit points to update.

Implements POINT_EDIT_BEHAVIOR.

Definition at line 418 of file pcb_point_editor.cpp.

References ARC_CENTER, ARC_END, ARC_START, CHECK_POINT_COUNT, EDA_SHAPE::GetArcMid(), SCH_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), m_arc, EDIT_POINTS::Point(), and EDIT_POINT::SetPosition().

Member Data Documentation

◆ m_arc [1/2]

SCH_SHAPE& ARC_POINT_EDIT_BEHAVIOR::m_arc
private

Definition at line 233 of file ee_point_editor.cpp.

Referenced by ARC_POINT_EDIT_BEHAVIOR(), MakePoints(), UpdateItem(), and UpdatePoints().

◆ m_arc [2/2]

PCB_SHAPE& ARC_POINT_EDIT_BEHAVIOR::m_arc
private

Definition at line 787 of file pcb_point_editor.cpp.

◆ m_arcEditMode

const ARC_EDIT_MODE& ARC_POINT_EDIT_BEHAVIOR::m_arcEditMode
private

Definition at line 789 of file pcb_point_editor.cpp.

Referenced by UpdateItem().

◆ m_viewControls

KIGFX::VIEW_CONTROLS& ARC_POINT_EDIT_BEHAVIOR::m_viewControls
private

Definition at line 790 of file pcb_point_editor.cpp.

Referenced by UpdateItem().


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