KiCad PCB EDA Suite
|
Public Member Functions | |
RECTANGLE_POINT_EDIT_BEHAVIOR (SCH_SHAPE &aRect, EDA_DRAW_FRAME &aFrame) | |
void | MakePoints (EDIT_POINTS &aPoints) override |
Construct the initial set of edit points for the item and append to the given list. | |
bool | 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. | |
RECTANGLE_POINT_EDIT_BEHAVIOR (PCB_SHAPE &aRectangle) | |
void | MakePoints (EDIT_POINTS &aPoints) override |
Construct the initial set of edit points for the item and append to the given list. | |
bool | 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 void | FinalizeItem (EDIT_POINTS &aPoints, COMMIT &aCommit) |
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 | MakePoints (SCH_SHAPE &aRect, EDIT_POINTS &aPoints) |
static void | UpdatePoints (SCH_SHAPE &aRect, EDIT_POINTS &aPoints) |
static void | PinEditedCorner (const EDIT_POINT &aEditedPoint, const EDIT_POINTS &aPoints, int minWidth, int minHeight, VECTOR2I &topLeft, VECTOR2I &topRight, VECTOR2I &botLeft, VECTOR2I &botRight) |
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner. | |
static void | UpdateItem (SCH_SHAPE &aRect, const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) |
static void | MakePoints (const PCB_SHAPE &aRectangle, EDIT_POINTS &aPoints) |
Standard rectangle points construction utility (other shapes may use this as well) | |
static void | UpdateItem (PCB_SHAPE &aRectangle, const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) |
static void | UpdatePoints (const PCB_SHAPE &aRectangle, EDIT_POINTS &aPoints) |
static void | PinEditedCorner (const EDIT_POINT &aEditedPoint, const EDIT_POINTS &aEditPoints, VECTOR2I &aTopLeft, VECTOR2I &aTopRight, VECTOR2I &aBotLeft, VECTOR2I &aBotRight, const VECTOR2I &aHole={ 0, 0 }, const VECTOR2I &aHoleSize={ 0, 0 }) |
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner. | |
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 Member Functions | |
void | dragPinsOnEdge (const std::vector< SEG > &aOldEdges, const std::vector< VECTOR2I > &aMoveVecs, int aEdgeUnit, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) const |
Private Attributes | |
SCH_SHAPE & | m_rect |
EDA_DRAW_FRAME & | m_frame |
PCB_SHAPE & | m_rectangle |
Definition at line 382 of file sch_point_editor.cpp.
|
inline |
Definition at line 385 of file sch_point_editor.cpp.
|
inline |
Definition at line 227 of file pcb_point_editor.cpp.
References m_rectangle, and RECTANGLE.
|
inlineprivate |
Definition at line 635 of file sch_point_editor.cpp.
References editor, FRAME_SCH_SYMBOL_EDITOR, LIB_SYMBOL::GetGraphicalPins(), m_frame, COMMIT::Modify(), and pin.
Referenced by UpdateItem().
|
inlinevirtualinherited |
Finalize the edit operation.
(optional)
This is called once, after the user has finished editing a point (e.g. released the mouse button).
aPoints | The final positions of the edit points. |
aCommit | The commit object to use to modify the item. |
Reimplemented in POLYGON_POINT_EDIT_BEHAVIOR.
Definition at line 81 of file point_editor_behavior.h.
|
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 108 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 119 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(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_CENTER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_LEADER_POINT_EDIT_BEHAVIOR::UpdateItem(), DIM_RADIAL_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_ARC_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_BEZIER_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_CIRCLE_POINT_EDIT_BEHAVIOR::UpdateItem(), EDA_SEGMENT_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), PCB_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), RECTANGLE_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), SCH_TABLECELL_POINT_EDIT_BEHAVIOR::UpdateItem(), SHAPE_GROUP_POINT_EDIT_BEHAVIOR::UpdateItem(), SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR::updateOrthogonalDimension(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints().
|
inlinestatic |
Standard rectangle points construction utility (other shapes may use this as well)
Definition at line 237 of file pcb_point_editor.cpp.
References EDIT_POINTS::AddLine(), EDIT_POINTS::AddPoint(), EDA_SHAPE::GetBotRight(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetCornerRadius(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetTopLeft(), EDIT_POINTS::Line(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RADIUS, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, RECTANGLE, EDIT_LINE::SetConstraint(), EDIT_POINT::SetDrawCircle(), EDIT_POINTS::SetSwapX(), EDIT_POINTS::SetSwapY(), EDIT_POINTS::SwapX(), EDIT_POINTS::SwapY(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
inlineoverridevirtual |
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 543 of file sch_point_editor.cpp.
References m_rect, and MakePoints().
|
inlineoverridevirtual |
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 383 of file pcb_point_editor.cpp.
References m_rectangle, and MakePoints().
|
inlinestatic |
Definition at line 391 of file sch_point_editor.cpp.
References EDIT_POINTS::AddLine(), EDIT_POINTS::AddPoint(), SCH_SHAPE::GetCenter(), EDA_SHAPE::GetCornerRadius(), EDA_SHAPE::GetEnd(), SCH_SHAPE::GetPosition(), EDIT_POINTS::Line(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_LEFT, RECT_RADIUS, RECT_RIGHT, RECT_TOP, RECT_TOPLEFT, RECT_TOPRIGHT, EDIT_LINE::SetConstraint(), EDIT_POINT::SetDrawCircle(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BARCODE_POINT_EDIT_BEHAVIOR::MakePoints(), MakePoints(), and TEXTBOX_POINT_EDIT_BEHAVIOR::MakePoints().
|
inlinestatic |
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner.
aPoints | the points list |
aTopLeft | [in/out] is the RECT_TOPLEFT to constraint |
aTopRight | [in/out] is the RECT_TOPRIGHT to constraint |
aBotLeft | [in/out] is the RECT_BOTLEFT to constraint |
aBotRight | [in/out] is the RECT_BOTRIGHT to constraint |
aHole | the location of the pad's hole |
aHoleSize | the pad's hole size (or {0,0} if it has no hole) |
Definition at line 418 of file pcb_point_editor.cpp.
|
inlinestatic |
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner.
minWidth | is the minimal width constraint |
minHeight | is the minimal height constraint |
topLeft | is the RECT_TOPLEFT to constraint |
topRight | is the RECT_TOPRIGHT to constraint |
botLeft | is the RECT_BOTLEFT to constraint |
botRight | is the RECT_BOTRIGHT to constraint |
Definition at line 437 of file sch_point_editor.cpp.
References POINT_EDIT_BEHAVIOR::isModified(), EDIT_POINTS::Line(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOPLEFT, RECT_TOPRIGHT, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), UpdateItem(), UpdateItem(), UpdateItem(), SHAPE_GROUP_POINT_EDIT_BEHAVIOR::UpdateItem(), and SHEET_POINT_EDIT_BEHAVIOR::UpdateItem().
|
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).
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.
Definition at line 556 of file sch_point_editor.cpp.
References std::abs(), BOX2< VECTOR2I >::ByCorners(), dragPinsOnEdge(), DIRECTION_45::E, BOX2< Vec >::GetBottom(), BOX2< Vec >::GetCenter(), BOX2< Vec >::GetLeft(), EDIT_POINT::GetPosition(), BOX2< Vec >::GetRight(), KIGEOM::GetSegsInDirection(), BOX2< Vec >::GetTop(), EDIT_POINT::GetX(), POINT_EDIT_BEHAVIOR::isModified(), EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), m_rect, DIRECTION_45::N, PinEditedCorner(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_CENTER, RECT_LEFT, RECT_RADIUS, RECT_RIGHT, RECT_TOP, RECT_TOPLEFT, RECT_TOPRIGHT, DIRECTION_45::S, schIUScale, EDIT_LINE::SetConstraint(), EDIT_POINT::SetPosition(), DIRECTION_45::W, VECTOR2< T >::x, and VECTOR2< T >::y.
|
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).
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.
Definition at line 399 of file pcb_point_editor.cpp.
References m_rectangle, and UpdateItem().
|
inlinestatic |
Definition at line 271 of file pcb_point_editor.cpp.
References std::abs(), CHECK_POINT_COUNT_GE, PCB_SHAPE::GetCenter(), EDIT_POINT::GetPosition(), EDIT_POINT::GetX(), POINT_EDIT_BEHAVIOR::isModified(), left, EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), PCB_SHAPE::Move(), PinEditedCorner(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_CENTER, RECT_LEFT, RECT_MAX_POINTS, RECT_RADIUS, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, right, EDA_SHAPE::SetBottom(), EDIT_LINE::SetConstraint(), EDA_SHAPE::SetCornerRadius(), EDA_SHAPE::SetLeft(), EDIT_POINT::SetPosition(), EDA_SHAPE::SetRight(), EDA_SHAPE::SetTop(), EDIT_POINTS::SwapX(), EDIT_POINTS::SwapY(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
inlinestatic |
Definition at line 499 of file sch_point_editor.cpp.
References EDIT_POINT::GetPosition(), POINT_EDIT_BEHAVIOR::isModified(), EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), PinEditedCorner(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOPLEFT, RECT_TOPRIGHT, schIUScale, EDIT_LINE::SetConstraint(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetEndX(), EDA_SHAPE::SetEndY(), SCH_SHAPE::SetPosition(), EDA_SHAPE::SetStartX(), EDA_SHAPE::SetStartY(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BARCODE_POINT_EDIT_BEHAVIOR::UpdateItem(), UpdateItem(), and TEXTBOX_POINT_EDIT_BEHAVIOR::UpdateItem().
|
inlinestatic |
Definition at line 359 of file pcb_point_editor.cpp.
References EDA_SHAPE::GetBotRight(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetCornerRadius(), EDA_SHAPE::GetTopLeft(), EDIT_POINTS::Point(), EDIT_POINTS::PointsSize(), RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_CENTER, RECT_MAX_POINTS, RECT_RADIUS, RECT_TOP_LEFT, RECT_TOP_RIGHT, EDIT_POINT::SetPosition(), EDIT_POINTS::SetSwapX(), EDIT_POINTS::SetSwapY(), EDIT_POINTS::SwapX(), EDIT_POINTS::SwapY(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
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 big they 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).
If the behavior itself must change (for instance, a rectangle is non-cardinallly rotated to a polygon), the method should return false.
aPoints | The list of edit points to update. |
Implements POINT_EDIT_BEHAVIOR.
Definition at line 549 of file sch_point_editor.cpp.
References m_rect, and UpdatePoints().
|
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 big they 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).
If the behavior itself must change (for instance, a rectangle is non-cardinallly rotated to a polygon), the method should return false.
aPoints | The list of edit points to update. |
Implements POINT_EDIT_BEHAVIOR.
Definition at line 389 of file pcb_point_editor.cpp.
References m_rectangle, EDIT_POINTS::PointsSize(), RECTANGLE, and UpdatePoints().
|
inlinestatic |
Definition at line 414 of file sch_point_editor.cpp.
References SCH_SHAPE::GetCenter(), EDA_SHAPE::GetCornerRadius(), EDA_SHAPE::GetEnd(), SCH_SHAPE::GetPosition(), EDIT_POINTS::Point(), RECT_BOTLEFT, RECT_BOTRIGHT, RECT_CENTER, RECT_RADIUS, RECT_TOPLEFT, RECT_TOPRIGHT, EDIT_POINT::SetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BARCODE_POINT_EDIT_BEHAVIOR::UpdatePoints(), UpdatePoints(), and TEXTBOX_POINT_EDIT_BEHAVIOR::UpdatePoints().
|
private |
Definition at line 702 of file sch_point_editor.cpp.
Referenced by dragPinsOnEdge(), and RECTANGLE_POINT_EDIT_BEHAVIOR().
|
private |
Definition at line 701 of file sch_point_editor.cpp.
Referenced by MakePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR(), UpdateItem(), and UpdatePoints().
|
private |
Definition at line 520 of file pcb_point_editor.cpp.
Referenced by MakePoints(), RECTANGLE_POINT_EDIT_BEHAVIOR(), UpdateItem(), and UpdatePoints().