KiCad PCB EDA Suite
|
"Standard" polygon editing behavior for EDA_SHAPE polygons. More...
#include <point_editor_behavior.h>
Public Member Functions | |
EDA_POLYGON_POINT_EDIT_BEHAVIOR (EDA_SHAPE &aPolygon) | |
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. | |
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 | |
SHAPE_POLY_SET & | m_polygon |
"Standard" polygon editing behavior for EDA_SHAPE polygons.
As long as updating the EDA_SHAPE's SHAPE_POLY_SET in-place is enough, this will do the job.
Definition at line 176 of file point_editor_behavior.h.
|
inline |
Definition at line 180 of file point_editor_behavior.h.
References EDA_SHAPE::GetShape().
|
staticinherited |
Build the edit points for the given polygon outline.
Definition at line 29 of file point_editor_behavior.cpp.
References EDIT_POINTS::AddBreak(), EDIT_POINTS::AddLine(), EDIT_POINTS::AddPoint(), SHAPE_POLY_SET::CIterateWithHoles(), EDIT_POINTS::GetContourStartIdx(), EDIT_POINTS::IsContourEnd(), EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), EDIT_POINTS::Point(), EDIT_LINE::SetConstraint(), and SHAPE_POLY_SET::TotalVertices().
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::MakePoints(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline().
|
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 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.
|
inlinestaticprotectedinherited |
Checks if two points are the same instance - which means the point is being edited.
Definition at line 107 of file point_editor_behavior.h.
Referenced by ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_CENTER_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::Get45DegreeConstrainer(), RECTANGLE_POINT_EDIT_BEHAVIOR::PinEditedCorner(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateAlignedDimension(), ARC_POINT_EDIT_BEHAVIOR::UpdateItem(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateOrthogonalDimension(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints().
|
inlineoverridevirtualinherited |
Construct the initial set of edit points for the item and append to the given list.
aPoints | The list of edit points to fill. |
Implements POINT_EDIT_BEHAVIOR.
Definition at line 149 of file point_editor_behavior.h.
References POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline(), and POLYGON_POINT_EDIT_BEHAVIOR::m_polygon.
|
inlineoverridevirtualinherited |
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).
aEditedPoint | The point that was dragged. You can use this to check by address which point to update. |
aPoints | The new positions of the edit points. |
aCommit | The commit object to use to modify the item. |
aUpdatedItems | The 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.
Reimplemented in ZONE_POINT_EDIT_BEHAVIOR.
Definition at line 159 of file point_editor_behavior.h.
References POLYGON_POINT_EDIT_BEHAVIOR::m_polygon, and POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints().
Referenced by ZONE_POINT_EDIT_BEHAVIOR::UpdateItem().
|
staticinherited |
Update the polygon outline with the new positions of the edit points.
Definition at line 83 of file point_editor_behavior.cpp.
References CHECK_POINT_COUNT_GE, EDIT_POINT::GetPosition(), POINT_EDIT_BEHAVIOR::isModified(), EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), EDIT_POINTS::Point(), EDIT_LINE::SetConstraint(), SHAPE_POLY_SET::SetVertex(), and SHAPE_POLY_SET::TotalVertices().
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::UpdateItem().
|
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).
aPoints | The list of edit points to update. |
Implements POINT_EDIT_BEHAVIOR.
Definition at line 154 of file point_editor_behavior.h.
References POLYGON_POINT_EDIT_BEHAVIOR::m_polygon, and POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline().
|
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 62 of file point_editor_behavior.cpp.
References POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline(), EDIT_POINTS::Clear(), SHAPE_POLY_SET::CVertex(), EDIT_POINTS::Point(), EDIT_POINTS::PointsSize(), EDIT_POINT::SetPosition(), and SHAPE_POLY_SET::TotalVertices().
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::UpdatePoints().
|
privateinherited |
Definition at line 166 of file point_editor_behavior.h.
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::MakePoints(), POLYGON_POINT_EDIT_BEHAVIOR::UpdateItem(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdatePoints().