KiCad PCB EDA Suite
|
A routine that modifies polygons using boolean operations. More...
#include <item_modification_routine.h>
Public Member Functions | |
POLYGON_BOOLEAN_ROUTINE (BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler) | |
void | ProcessShape (PCB_SHAPE &aPcbShape) |
void | Finalize () |
Clear up any outstanding work. | |
unsigned | GetSuccesses () const |
unsigned | GetFailures () const |
virtual wxString | GetCommitDescription () const =0 |
virtual std::optional< wxString > | GetStatusMessage () const =0 |
Get a status message to show when the routine is complete. | |
Protected Member Functions | |
SHAPE_POLY_SET & | GetWorkingPolygons () |
virtual bool | ProcessSubsequentPolygon (const SHAPE_POLY_SET &aPolygon)=0 |
BOARD_ITEM * | GetBoard () const |
The BOARD used when creating new shapes. | |
void | AddSuccess () |
Mark that one of the actions succeeded. | |
void | AddFailure () |
Mark that one of the actions failed. | |
bool | ModifyLineOrDeleteIfZeroLength (PCB_SHAPE &aItem, const std::optional< SEG > &aSeg) |
Helper function useful for multiple tools: modify a line or delete it if it has zero length. | |
CHANGE_HANDLER & | GetHandler () |
Access the handler for making changes to the board. | |
Private Attributes | |
SHAPE_POLY_SET | m_workingPolygons |
This can be disjoint, which will be fixed at the end. | |
bool | m_firstPolygon = true |
int | m_width = 0 |
PCB_LAYER_ID | m_layer = PCB_LAYER_ID::UNDEFINED_LAYER |
bool | m_filled = false |
BOARD_ITEM * | m_board |
CHANGE_HANDLER & | m_handler |
unsigned | m_numSuccesses |
unsigned | m_numFailures |
A routine that modifies polygons using boolean operations.
Definition at line 336 of file item_modification_routine.h.
|
inline |
Definition at line 339 of file item_modification_routine.h.
|
inlineprotectedinherited |
Mark that one of the actions failed.
Definition at line 192 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_numFailures.
Referenced by LINE_FILLET_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), and ProcessShape().
|
inlineprotectedinherited |
Mark that one of the actions succeeded.
Definition at line 187 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_numSuccesses.
Referenced by OUTSET_ROUTINE::ProcessItem(), LINE_FILLET_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_EXTENSION_ROUTINE::ProcessLinePair(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), and ProcessShape().
void POLYGON_BOOLEAN_ROUTINE::Finalize | ( | ) |
Clear up any outstanding work.
Definition at line 518 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::AddNewItem(), ITEM_MODIFICATION_ROUTINE::GetBoard(), ITEM_MODIFICATION_ROUTINE::GetHandler(), m_filled, m_firstPolygon, m_layer, m_width, m_workingPolygons, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::SetWidth().
|
inlineprotectedinherited |
The BOARD used when creating new shapes.
Definition at line 182 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_board.
Referenced by Finalize(), OUTSET_ROUTINE::ProcessItem(), LINE_FILLET_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), and DOGBONE_CORNER_ROUTINE::ProcessLinePair().
|
pure virtualinherited |
|
inlineinherited |
Definition at line 167 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_numFailures.
Referenced by LINE_FILLET_ROUTINE::GetStatusMessage(), LINE_CHAMFER_ROUTINE::GetStatusMessage(), LINE_EXTENSION_ROUTINE::GetStatusMessage(), DOGBONE_CORNER_ROUTINE::GetStatusMessage(), POLYGON_MERGE_ROUTINE::GetStatusMessage(), POLYGON_SUBTRACT_ROUTINE::GetStatusMessage(), POLYGON_INTERSECT_ROUTINE::GetStatusMessage(), and OUTSET_ROUTINE::GetStatusMessage().
|
inlineprotectedinherited |
Access the handler for making changes to the board.
Definition at line 206 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_handler.
Referenced by Finalize(), ITEM_MODIFICATION_ROUTINE::ModifyLineOrDeleteIfZeroLength(), OUTSET_ROUTINE::ProcessItem(), LINE_FILLET_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_EXTENSION_ROUTINE::ProcessLinePair(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), and ProcessShape().
|
pure virtualinherited |
Get a status message to show when the routine is complete.
Usually this will be an error or nothing.
Implemented in LINE_FILLET_ROUTINE, LINE_CHAMFER_ROUTINE, LINE_EXTENSION_ROUTINE, DOGBONE_CORNER_ROUTINE, POLYGON_MERGE_ROUTINE, POLYGON_SUBTRACT_ROUTINE, POLYGON_INTERSECT_ROUTINE, and OUTSET_ROUTINE.
|
inlineinherited |
Definition at line 165 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::m_numSuccesses.
Referenced by LINE_FILLET_ROUTINE::GetStatusMessage(), LINE_CHAMFER_ROUTINE::GetStatusMessage(), LINE_EXTENSION_ROUTINE::GetStatusMessage(), DOGBONE_CORNER_ROUTINE::GetStatusMessage(), POLYGON_MERGE_ROUTINE::GetStatusMessage(), POLYGON_SUBTRACT_ROUTINE::GetStatusMessage(), POLYGON_INTERSECT_ROUTINE::GetStatusMessage(), and OUTSET_ROUTINE::GetStatusMessage().
|
inlineprotected |
Definition at line 352 of file item_modification_routine.h.
References m_workingPolygons.
Referenced by POLYGON_MERGE_ROUTINE::ProcessSubsequentPolygon(), POLYGON_SUBTRACT_ROUTINE::ProcessSubsequentPolygon(), and POLYGON_INTERSECT_ROUTINE::ProcessSubsequentPolygon().
|
protectedinherited |
Helper function useful for multiple tools: modify a line or delete it if it has zero length.
aItem | the line to modify |
aSeg | the new line geometry |
Definition at line 76 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::DeleteItem(), ITEM_MODIFICATION_ROUTINE::GetHandler(), EDA_SHAPE::GetShape(), ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::MarkItemModified(), EDA_SHAPE::SetEnd(), and EDA_SHAPE::SetStart().
Referenced by LINE_FILLET_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), and DOGBONE_CORNER_ROUTINE::ProcessLinePair().
void POLYGON_BOOLEAN_ROUTINE::ProcessShape | ( | PCB_SHAPE & | aPcbShape | ) |
Definition at line 453 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::AddFailure(), ITEM_MODIFICATION_ROUTINE::AddSuccess(), SHAPE_POLY_SET::Append(), ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::DeleteItem(), ITEM_MODIFICATION_ROUTINE::GetHandler(), PCB_SHAPE::GetLayer(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetRectCorners(), EDA_SHAPE::GetShape(), PCB_SHAPE::GetWidth(), EDA_SHAPE::IsFilled(), m_filled, m_firstPolygon, m_layer, m_width, m_workingPolygons, SHAPE_POLY_SET::NewOutline(), and ProcessSubsequentPolygon().
|
protectedpure virtual |
Implemented in POLYGON_MERGE_ROUTINE, POLYGON_SUBTRACT_ROUTINE, and POLYGON_INTERSECT_ROUTINE.
Referenced by ProcessShape().
|
privateinherited |
Definition at line 209 of file item_modification_routine.h.
Referenced by ITEM_MODIFICATION_ROUTINE::GetBoard().
|
private |
Definition at line 363 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
private |
Definition at line 360 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
privateinherited |
Definition at line 210 of file item_modification_routine.h.
Referenced by ITEM_MODIFICATION_ROUTINE::GetHandler().
|
private |
Definition at line 362 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
privateinherited |
Definition at line 213 of file item_modification_routine.h.
Referenced by ITEM_MODIFICATION_ROUTINE::AddFailure(), and ITEM_MODIFICATION_ROUTINE::GetFailures().
|
privateinherited |
Definition at line 212 of file item_modification_routine.h.
Referenced by ITEM_MODIFICATION_ROUTINE::AddSuccess(), and ITEM_MODIFICATION_ROUTINE::GetSuccesses().
|
private |
Definition at line 361 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
private |
This can be disjoint, which will be fixed at the end.
Definition at line 358 of file item_modification_routine.h.
Referenced by Finalize(), GetWorkingPolygons(), and ProcessShape().