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

Public Member Functions

 ZONE_POINT_EDIT_BEHAVIOR (ZONE &aZone)
 
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.
 
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 FinalizeItem (EDIT_POINTS &aPoints, COMMIT &aCommit) override
 Finalize the edit operation.
 
virtual OPT_VECTOR2I Get45DegreeConstrainer (const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const
 Get the 45-degree constrainer for the item, when the given point is moved.
 

Static Public Member Functions

static void BuildForPolyOutline (EDIT_POINTS &aPoints, const SHAPE_POLY_SET &aOutline)
 Build the edit points for the given polygon outline.
 
static void UpdatePointsFromOutline (const SHAPE_POLY_SET &aOutline, EDIT_POINTS &aPoints)
 Update the edit points with the current polygon outline.
 
static void UpdateOutlineFromPoints (SHAPE_POLY_SET &aOutline, const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints)
 Update the polygon outline with the new positions of the edit 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

ZONEm_zone
 
SHAPE_POLY_SETm_polygon
 

Detailed Description

Definition at line 476 of file pcb_point_editor.cpp.

Constructor & Destructor Documentation

◆ ZONE_POINT_EDIT_BEHAVIOR()

ZONE_POINT_EDIT_BEHAVIOR::ZONE_POINT_EDIT_BEHAVIOR ( ZONE & aZone)
inline

Member Function Documentation

◆ BuildForPolyOutline()

void POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline ( EDIT_POINTS & aPoints,
const SHAPE_POLY_SET & aOutline )
staticinherited

◆ FinalizeItem()

void POLYGON_POINT_EDIT_BEHAVIOR::FinalizeItem ( EDIT_POINTS & aPoints,
COMMIT & aCommit )
overridevirtualinherited

Finalize the edit operation.

(optional)

This is called once, after the user has finished editing (e.g. released the mouse button).

Parameters
aPointsThe final positions of the edit points.
aCommitThe commit object to use to modify the item.

Reimplemented from POINT_EDIT_BEHAVIOR.

Definition at line 105 of file point_editor_behavior.cpp.

References m_polygon.

◆ Get45DegreeConstrainer()

virtual OPT_VECTOR2I POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer ( const EDIT_POINT & aEditedPoint,
EDIT_POINTS & aPoints ) const
inlinevirtualinherited

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 in ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR, DIM_CENTER_POINT_EDIT_BEHAVIOR, DIM_RADIAL_POINT_EDIT_BEHAVIOR, EDA_ARC_POINT_EDIT_BEHAVIOR, EDA_CIRCLE_POINT_EDIT_BEHAVIOR, and EDA_SEGMENT_POINT_EDIT_BEHAVIOR.

Definition at line 109 of file point_editor_behavior.h.

◆ isModified()

◆ MakePoints()

void POLYGON_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS & aPoints)
inlineoverridevirtualinherited

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 166 of file point_editor_behavior.h.

References BuildForPolyOutline(), and m_polygon.

◆ UpdateItem()

void ZONE_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).

Reimplemented from POLYGON_POINT_EDIT_BEHAVIOR.

Definition at line 485 of file pcb_point_editor.cpp.

References m_zone, and POLYGON_POINT_EDIT_BEHAVIOR::UpdateItem().

◆ UpdateOutlineFromPoints()

void POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints ( SHAPE_POLY_SET & aOutline,
const EDIT_POINT & aEditedPoint,
EDIT_POINTS & aPoints )
staticinherited

◆ UpdatePoints()

void POLYGON_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS & aPoints)
inlineoverridevirtualinherited

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 171 of file point_editor_behavior.h.

References m_polygon, and UpdatePointsFromOutline().

◆ UpdatePointsFromOutline()

void POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline ( const SHAPE_POLY_SET & aOutline,
EDIT_POINTS & aPoints )
staticinherited

Update the edit points with the current polygon outline.

If the point sizes differ, the points are rebuilt entirely (in-place)

Definition at line 64 of file point_editor_behavior.cpp.

References BuildForPolyOutline(), EDIT_POINTS::Clear(), SHAPE_POLY_SET::CVertex(), EDIT_POINTS::Point(), EDIT_POINTS::PointsSize(), EDIT_POINT::SetPosition(), and SHAPE_POLY_SET::TotalVertices().

Referenced by UpdatePoints().

Member Data Documentation

◆ m_polygon

SHAPE_POLY_SET& POLYGON_POINT_EDIT_BEHAVIOR::m_polygon
privateinherited

◆ m_zone

ZONE& ZONE_POINT_EDIT_BEHAVIOR::m_zone
private

Definition at line 497 of file pcb_point_editor.cpp.

Referenced by UpdateItem(), and ZONE_POINT_EDIT_BEHAVIOR().


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