KiCad PCB EDA Suite
Loading...
Searching...
No Matches
POINT_EDIT_BEHAVIOR Class Referenceabstract

A helper class interface to manage the edit points for a single item. More...

#include <point_editor_behavior.h>

Inheritance diagram for POINT_EDIT_BEHAVIOR:
ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR ARC_POINT_EDIT_BEHAVIOR BITMAP_POINT_EDIT_BEHAVIOR DIM_CENTER_POINT_EDIT_BEHAVIOR DIM_LEADER_POINT_EDIT_BEHAVIOR DIM_RADIAL_POINT_EDIT_BEHAVIOR EDA_BEZIER_POINT_EDIT_BEHAVIOR EDA_CIRCLE_POINT_EDIT_BEHAVIOR EDA_SEGMENT_POINT_EDIT_BEHAVIOR EDA_TABLECELL_POINT_EDIT_BEHAVIOR GENERATOR_POINT_EDIT_BEHAVIOR LINE_POINT_EDIT_BEHAVIOR PAD_POINT_EDIT_BEHAVIOR POLYGON_POINT_EDIT_BEHAVIOR RECTANGLE_POINT_EDIT_BEHAVIOR REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR SHEET_POINT_EDIT_BEHAVIOR TEXTBOX_POINT_EDIT_BEHAVIOR

Public Member Functions

virtual ~POINT_EDIT_BEHAVIOR ()=default
 
virtual void MakePoints (EDIT_POINTS &aPoints)=0
 Construct the initial set of edit points for the item and append to the given list.
 
virtual void UpdatePoints (EDIT_POINTS &aPoints)=0
 Update the list of the edit points for the item.
 
virtual void UpdateItem (const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems)=0
 Update the item with the new positions of the edit points.
 
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 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.
 

Detailed Description

A helper class interface to manage the edit points for a single item.

Create one ofthese, and it will provide a way to keep a list of points updated.

For the moment this is implemented such that it mutates an external EDIT_POINTS object, but it might be able to also own the points.

Definition at line 42 of file point_editor_behavior.h.

Constructor & Destructor Documentation

◆ ~POINT_EDIT_BEHAVIOR()

virtual POINT_EDIT_BEHAVIOR::~POINT_EDIT_BEHAVIOR ( )
virtualdefault

Member Function Documentation

◆ Get45DegreeConstrainer()

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

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

Definition at line 96 of file point_editor_behavior.h.

◆ isModified()

◆ MakePoints()

◆ UpdateItem()

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

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

Implemented in ARC_POINT_EDIT_BEHAVIOR, BITMAP_POINT_EDIT_BEHAVIOR, SCH_TABLECELL_POINT_EDIT_BEHAVIOR, RECTANGLE_POINT_EDIT_BEHAVIOR, TEXTBOX_POINT_EDIT_BEHAVIOR, SHEET_POINT_EDIT_BEHAVIOR, POLYGON_POINT_EDIT_BEHAVIOR, EDA_SEGMENT_POINT_EDIT_BEHAVIOR, EDA_CIRCLE_POINT_EDIT_BEHAVIOR, EDA_BEZIER_POINT_EDIT_BEHAVIOR, RECTANGLE_POINT_EDIT_BEHAVIOR, ARC_POINT_EDIT_BEHAVIOR, ZONE_POINT_EDIT_BEHAVIOR, REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR, PCB_TABLECELL_POINT_EDIT_BEHAVIOR, PAD_POINT_EDIT_BEHAVIOR, GENERATOR_POINT_EDIT_BEHAVIOR, ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR, DIM_CENTER_POINT_EDIT_BEHAVIOR, DIM_RADIAL_POINT_EDIT_BEHAVIOR, DIM_LEADER_POINT_EDIT_BEHAVIOR, TEXTBOX_POINT_EDIT_BEHAVIOR, and LINE_POINT_EDIT_BEHAVIOR.

◆ UpdatePoints()

virtual void POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
pure virtual

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.

Implemented in LINE_POINT_EDIT_BEHAVIOR, ARC_POINT_EDIT_BEHAVIOR, BITMAP_POINT_EDIT_BEHAVIOR, RECTANGLE_POINT_EDIT_BEHAVIOR, TEXTBOX_POINT_EDIT_BEHAVIOR, SHEET_POINT_EDIT_BEHAVIOR, POLYGON_POINT_EDIT_BEHAVIOR, EDA_SEGMENT_POINT_EDIT_BEHAVIOR, EDA_CIRCLE_POINT_EDIT_BEHAVIOR, EDA_BEZIER_POINT_EDIT_BEHAVIOR, EDA_TABLECELL_POINT_EDIT_BEHAVIOR, RECTANGLE_POINT_EDIT_BEHAVIOR, ARC_POINT_EDIT_BEHAVIOR, REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR, PAD_POINT_EDIT_BEHAVIOR, GENERATOR_POINT_EDIT_BEHAVIOR, ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR, DIM_CENTER_POINT_EDIT_BEHAVIOR, DIM_RADIAL_POINT_EDIT_BEHAVIOR, DIM_LEADER_POINT_EDIT_BEHAVIOR, and TEXTBOX_POINT_EDIT_BEHAVIOR.


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