|
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) | |
| virtual bool | IsCommutative () const =0 |
| False if the order of the polygons matters. | |
| void | ProcessShape (PCB_SHAPE &aPcbShape) |
| void | Finalize () |
| Clear up any outstanding work. | |
| virtual std::optional< wxString > | GetStatusMessage () const =0 |
| Get a status message to show when the routine is complete. | |
| unsigned | GetSuccesses () const |
| unsigned | GetFailures () const |
| virtual wxString | GetCommitDescription () const =0 |
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. | |
| void | SplitCornerConstraint (const CONSTRAINT_MEMBER &aCornerA, const CONSTRAINT_MEMBER &aCornerB, const CONSTRAINT_MEMBER &aInsertedForA, const CONSTRAINT_MEMBER &aInsertedForB) |
| Hold each line to a shape just inserted at their shared corner, in place of the coincident constraint that held the two lines to each other. | |
| 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 |
| FILL_T | m_fillMode = FILL_T::NO_FILL |
| 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 342 of file item_modification_routine.h.
|
inline |
Definition at line 345 of file item_modification_routine.h.
References ITEM_MODIFICATION_ROUTINE::ITEM_MODIFICATION_ROUTINE().
Referenced by POLYGON_INTERSECT_ROUTINE::POLYGON_INTERSECT_ROUTINE(), POLYGON_MERGE_ROUTINE::POLYGON_MERGE_ROUTINE(), and POLYGON_SUBTRACT_ROUTINE::POLYGON_SUBTRACT_ROUTINE().
|
inlineprotectedinherited |
Mark that one of the actions failed.
Definition at line 182 of file item_modification_routine.h.
References m_numFailures.
Referenced by OUTSET_ROUTINE::ProcessItem(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_FILLET_ROUTINE::ProcessLinePair(), and POLYGON_BOOLEAN_ROUTINE::ProcessShape().
|
inlineprotectedinherited |
Mark that one of the actions succeeded.
Definition at line 177 of file item_modification_routine.h.
References m_numSuccesses.
Referenced by OUTSET_ROUTINE::ProcessItem(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_EXTENSION_ROUTINE::ProcessLinePair(), LINE_FILLET_ROUTINE::ProcessLinePair(), and POLYGON_BOOLEAN_ROUTINE::ProcessShape().
| void POLYGON_BOOLEAN_ROUTINE::Finalize | ( | ) |
Clear up any outstanding work.
Definition at line 604 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::AddNewItem(), ITEM_MODIFICATION_ROUTINE::GetBoard(), ITEM_MODIFICATION_ROUTINE::GetHandler(), m_fillMode, m_firstPolygon, m_layer, m_width, m_workingPolygons, and POLY.
|
inlineprotectedinherited |
The BOARD used when creating new shapes.
Definition at line 172 of file item_modification_routine.h.
References m_board.
Referenced by POLYGON_BOOLEAN_ROUTINE::Finalize(), OUTSET_ROUTINE::ProcessItem(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_FILLET_ROUTINE::ProcessLinePair(), and SplitCornerConstraint().
|
pure virtualinherited |
|
inlineinherited |
Definition at line 164 of file item_modification_routine.h.
References m_numFailures.
Referenced by DOGBONE_CORNER_ROUTINE::GetStatusMessage(), LINE_CHAMFER_ROUTINE::GetStatusMessage(), LINE_EXTENSION_ROUTINE::GetStatusMessage(), LINE_FILLET_ROUTINE::GetStatusMessage(), OUTSET_ROUTINE::GetStatusMessage(), POLYGON_INTERSECT_ROUTINE::GetStatusMessage(), POLYGON_MERGE_ROUTINE::GetStatusMessage(), POLYGON_SUBTRACT_ROUTINE::GetStatusMessage(), and OUTSET_ROUTINE::ProcessItem().
|
inlineprotectedinherited |
Access the handler for making changes to the board.
Definition at line 204 of file item_modification_routine.h.
References m_handler.
Referenced by POLYGON_BOOLEAN_ROUTINE::Finalize(), ModifyLineOrDeleteIfZeroLength(), OUTSET_ROUTINE::ProcessItem(), DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), LINE_EXTENSION_ROUTINE::ProcessLinePair(), LINE_FILLET_ROUTINE::ProcessLinePair(), POLYGON_BOOLEAN_ROUTINE::ProcessShape(), and SplitCornerConstraint().
|
pure virtual |
Get a status message to show when the routine is complete.
Usually this will be an error or nothing.
Implemented in POLYGON_INTERSECT_ROUTINE, POLYGON_MERGE_ROUTINE, and POLYGON_SUBTRACT_ROUTINE.
|
inlineinherited |
Definition at line 162 of file item_modification_routine.h.
References m_numSuccesses.
Referenced by DOGBONE_CORNER_ROUTINE::GetStatusMessage(), LINE_CHAMFER_ROUTINE::GetStatusMessage(), LINE_EXTENSION_ROUTINE::GetStatusMessage(), LINE_FILLET_ROUTINE::GetStatusMessage(), OUTSET_ROUTINE::GetStatusMessage(), POLYGON_INTERSECT_ROUTINE::GetStatusMessage(), POLYGON_MERGE_ROUTINE::GetStatusMessage(), POLYGON_SUBTRACT_ROUTINE::GetStatusMessage(), and OUTSET_ROUTINE::ProcessItem().
|
inlineprotected |
Definition at line 370 of file item_modification_routine.h.
References m_workingPolygons.
Referenced by POLYGON_INTERSECT_ROUTINE::ProcessSubsequentPolygon(), POLYGON_MERGE_ROUTINE::ProcessSubsequentPolygon(), and POLYGON_SUBTRACT_ROUTINE::ProcessSubsequentPolygon().
|
pure virtual |
False if the order of the polygons matters.
Implemented in POLYGON_INTERSECT_ROUTINE, POLYGON_MERGE_ROUTINE, and POLYGON_SUBTRACT_ROUTINE.
|
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(), GetHandler(), EDA_SHAPE::GetShape(), ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::MarkItemModified(), SEGMENT, PCB_SHAPE::SetEnd(), and PCB_SHAPE::SetStart().
Referenced by DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), and LINE_FILLET_ROUTINE::ProcessLinePair().
| void POLYGON_BOOLEAN_ROUTINE::ProcessShape | ( | PCB_SHAPE & | aPcbShape | ) |
Definition at line 528 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::AddFailure(), ITEM_MODIFICATION_ROUTINE::AddSuccess(), CIRCLE, ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::DeleteItem(), FULL_CIRCLE, PCB_SHAPE::GetCenter(), EDA_SHAPE::GetFillMode(), ITEM_MODIFICATION_ROUTINE::GetHandler(), PCB_SHAPE::GetLayer(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetRectCorners(), EDA_SHAPE::GetShape(), PCB_SHAPE::GetWidth(), m_fillMode, m_firstPolygon, m_layer, m_width, m_workingPolygons, POLY, ProcessSubsequentPolygon(), and RECTANGLE.
|
protectedpure virtual |
Implemented in POLYGON_INTERSECT_ROUTINE, POLYGON_MERGE_ROUTINE, and POLYGON_SUBTRACT_ROUTINE.
Referenced by ProcessShape().
|
protectedinherited |
Hold each line to a shape just inserted at their shared corner, in place of the coincident constraint that held the two lines to each other.
The line members are the anchors as they stand after the insertion.
Definition at line 99 of file item_modification_routine.cpp.
References ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::AddNewItem(), COINCIDENT, BOARD::Constraints(), BOARD::Footprints(), BOARD_ITEM::GetBoard(), GetBoard(), GetHandler(), CONSTRAINT_MEMBER::m_anchor, CONSTRAINT_MEMBER::m_index, CONSTRAINT_MEMBER::m_item, ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::MarkItemModified(), and split().
Referenced by DOGBONE_CORNER_ROUTINE::ProcessLinePair(), LINE_CHAMFER_ROUTINE::ProcessLinePair(), and LINE_FILLET_ROUTINE::ProcessLinePair().
|
privateinherited |
Definition at line 207 of file item_modification_routine.h.
Referenced by GetBoard(), and ITEM_MODIFICATION_ROUTINE().
|
private |
Definition at line 381 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
private |
Definition at line 378 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
privateinherited |
Definition at line 208 of file item_modification_routine.h.
Referenced by GetHandler(), and ITEM_MODIFICATION_ROUTINE().
|
private |
Definition at line 380 of file item_modification_routine.h.
Referenced by Finalize(), and ProcessShape().
|
privateinherited |
Definition at line 211 of file item_modification_routine.h.
Referenced by AddFailure(), GetFailures(), and ITEM_MODIFICATION_ROUTINE().
|
privateinherited |
Definition at line 210 of file item_modification_routine.h.
Referenced by AddSuccess(), GetSuccesses(), and ITEM_MODIFICATION_ROUTINE().
|
private |
Definition at line 379 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 376 of file item_modification_routine.h.
Referenced by Finalize(), GetWorkingPolygons(), and ProcessShape().