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

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.
 
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.
 
 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.
 
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 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 (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 pad 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_SHAPEm_rect
 
EDA_DRAW_FRAMEm_frame
 
PCB_SHAPEm_rectangle
 

Detailed Description

Definition at line 400 of file ee_point_editor.cpp.

Constructor & Destructor Documentation

◆ RECTANGLE_POINT_EDIT_BEHAVIOR() [1/2]

RECTANGLE_POINT_EDIT_BEHAVIOR::RECTANGLE_POINT_EDIT_BEHAVIOR ( SCH_SHAPE aRect,
EDA_DRAW_FRAME aFrame 
)
inline

Definition at line 403 of file ee_point_editor.cpp.

◆ RECTANGLE_POINT_EDIT_BEHAVIOR() [2/2]

RECTANGLE_POINT_EDIT_BEHAVIOR::RECTANGLE_POINT_EDIT_BEHAVIOR ( PCB_SHAPE aRectangle)
inline

Definition at line 110 of file pcb_point_editor.cpp.

References EDA_SHAPE::GetShape(), and m_rectangle.

Member Function Documentation

◆ dragPinsOnEdge()

void RECTANGLE_POINT_EDIT_BEHAVIOR::dragPinsOnEdge ( const std::vector< SEG > &  aOldEdges,
const std::vector< VECTOR2I > &  aMoveVecs,
int  aEdgeUnit,
COMMIT aCommit,
std::vector< EDA_ITEM * > &  aUpdatedItems 
) const
inlineprivate

◆ 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 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() [1/4]

◆ MakePoints() [2/4]

void RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

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 557 of file ee_point_editor.cpp.

References m_rect, MakePoints(), and SCH_SHAPE::Normalize().

◆ MakePoints() [3/4]

void RECTANGLE_POINT_EDIT_BEHAVIOR::MakePoints ( EDIT_POINTS aPoints)
inlineoverridevirtual

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 251 of file pcb_point_editor.cpp.

References m_rectangle, and MakePoints().

◆ MakePoints() [4/4]

◆ PinEditedCorner() [1/2]

static void RECTANGLE_POINT_EDIT_BEHAVIOR::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 } 
)
inlinestatic

Update the coordinates of 4 corners of a rectangle, according to pad constraints and the moved corner.

Parameters
aPointsthe 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
aHolethe location of the pad's hole
aHoleSizethe pad's hole size (or {0,0} if it has no hole)

Definition at line 281 of file pcb_point_editor.cpp.

◆ PinEditedCorner() [2/2]

static void RECTANGLE_POINT_EDIT_BEHAVIOR::PinEditedCorner ( const EDIT_POINT aEditedPoint,
const EDIT_POINTS aPoints,
int  minWidth,
int  minHeight,
VECTOR2I topLeft,
VECTOR2I topRight,
VECTOR2I botLeft,
VECTOR2I botRight 
)
inlinestatic

Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner.

Parameters
minWidthis the minimal width constraint
minHeightis the minimal height constraint
topLeftis the RECT_TOPLEFT to constraint
topRightis the RECT_TOPRIGHT to constraint
botLeftis the RECT_BOTLEFT to constraint
botRightis the RECT_BOTRIGHT to constraint

Definition at line 451 of file ee_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 SHEET_POINT_EDIT_BEHAVIOR::UpdateItem(), PAD_POINT_EDIT_BEHAVIOR::UpdateItem(), and UpdateItem().

◆ UpdateItem() [1/4]

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

Implements POINT_EDIT_BEHAVIOR.

Definition at line 569 of file ee_point_editor.cpp.

References BOX2< VECTOR2I >::ByCorners(), dragPinsOnEdge(), DIRECTION_45::E, BOX2< Vec >::GetBottom(), BOX2< Vec >::GetCenter(), EDA_SHAPE::GetEnd(), BOX2< Vec >::GetLeft(), EDIT_POINT::GetPosition(), BOX2< Vec >::GetRight(), KIGEOM::GetSegsInDirection(), EDA_SHAPE::GetStart(), BOX2< Vec >::GetTop(), SCH_ITEM::GetUnit(), POINT_EDIT_BEHAVIOR::isModified(), EDIT_POINTS::Line(), EDIT_POINTS::LinesSize(), m_rect, EDA_IU_SCALE::MilsToIU(), SCH_SHAPE::Move(), DIRECTION_45::N, PinEditedCorner(), EDIT_POINTS::Point(), RECT_BOT, RECT_BOTLEFT, RECT_BOTRIGHT, RECT_CENTER, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOPLEFT, RECT_TOPRIGHT, DIRECTION_45::S, schIUScale, EDIT_LINE::SetConstraint(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetEndX(), EDA_SHAPE::SetEndY(), SCH_SHAPE::SetPosition(), EDA_SHAPE::SetStartX(), EDA_SHAPE::SetStartY(), DIRECTION_45::W, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ UpdateItem() [2/4]

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

Implements POINT_EDIT_BEHAVIOR.

Definition at line 262 of file pcb_point_editor.cpp.

References m_rectangle, and UpdateItem().

◆ UpdateItem() [3/4]

◆ UpdateItem() [4/4]

◆ UpdatePoints() [1/4]

void RECTANGLE_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
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 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 563 of file ee_point_editor.cpp.

References m_rect, SCH_SHAPE::Normalize(), and UpdatePoints().

◆ UpdatePoints() [2/4]

void RECTANGLE_POINT_EDIT_BEHAVIOR::UpdatePoints ( EDIT_POINTS aPoints)
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 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 257 of file pcb_point_editor.cpp.

References m_rectangle, and UpdatePoints().

◆ UpdatePoints() [3/4]

◆ UpdatePoints() [4/4]

Member Data Documentation

◆ m_frame

EDA_DRAW_FRAME& RECTANGLE_POINT_EDIT_BEHAVIOR::m_frame
private

Definition at line 708 of file ee_point_editor.cpp.

Referenced by dragPinsOnEdge().

◆ m_rect

SCH_SHAPE& RECTANGLE_POINT_EDIT_BEHAVIOR::m_rect
private

Definition at line 707 of file ee_point_editor.cpp.

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

◆ m_rectangle

PCB_SHAPE& RECTANGLE_POINT_EDIT_BEHAVIOR::m_rectangle
private

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