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

"Standard" circle editing behavior for EDA_SHAPE circles. More...

#include <point_editor_behavior.h>

Inheritance diagram for EDA_CIRCLE_POINT_EDIT_BEHAVIOR:
POINT_EDIT_BEHAVIOR

Public Member Functions

 EDA_CIRCLE_POINT_EDIT_BEHAVIOR (EDA_SHAPE &aCircle)
 
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.
 

Protected Types

enum  CIRCLE_POINTS { CIRC_CENTER , CIRC_END , CIRC_MAX_POINTS }
 

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 Attributes

EDA_SHAPEm_circle
 

Detailed Description

"Standard" circle editing behavior for EDA_SHAPE circles.

Definition at line 226 of file point_editor_behavior.h.

Member Enumeration Documentation

◆ CIRCLE_POINTS

Enumerator
CIRC_CENTER 
CIRC_END 
CIRC_MAX_POINTS 

Definition at line 245 of file point_editor_behavior.h.

Constructor & Destructor Documentation

◆ EDA_CIRCLE_POINT_EDIT_BEHAVIOR()

EDA_CIRCLE_POINT_EDIT_BEHAVIOR::EDA_CIRCLE_POINT_EDIT_BEHAVIOR ( EDA_SHAPE aCircle)
inline

Definition at line 229 of file point_editor_behavior.h.

References EDA_SHAPE::GetShape().

Member Function Documentation

◆ Get45DegreeConstrainer()

OPT_VECTOR2I EDA_CIRCLE_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer ( const EDIT_POINT aEditedPoint,
EDIT_POINTS aPoints 
) const
overridevirtual

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 177 of file point_editor_behavior.cpp.

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

◆ isModified()

◆ MakePoints()

void EDA_CIRCLE_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS aPoints)
overridevirtual

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 140 of file point_editor_behavior.cpp.

References EDIT_POINTS::AddPoint(), EDA_SHAPE::getCenter(), EDA_SHAPE::GetEnd(), and m_circle.

◆ UpdateItem()

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

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 156 of file point_editor_behavior.cpp.

References CHECK_POINT_COUNT, CIRC_CENTER, CIRC_END, CIRC_MAX_POINTS, EDIT_POINT::GetPosition(), POINT_EDIT_BEHAVIOR::isModified(), m_circle, EDIT_POINTS::Point(), EDA_SHAPE::SetCenter(), EDA_SHAPE::SetEnd(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ UpdatePoints()

void EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
overridevirtual

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 147 of file point_editor_behavior.cpp.

References CHECK_POINT_COUNT, CIRC_CENTER, CIRC_END, CIRC_MAX_POINTS, EDA_SHAPE::getCenter(), EDA_SHAPE::GetEnd(), m_circle, EDIT_POINTS::Point(), and EDIT_POINT::SetPosition().

Member Data Documentation

◆ m_circle

EDA_SHAPE& EDA_CIRCLE_POINT_EDIT_BEHAVIOR::m_circle
private

Definition at line 254 of file point_editor_behavior.h.

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


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