24#ifndef ITEM_MODIFICATION_ROUTINE_H_
25#define ITEM_MODIFICATION_ROUTINE_H_
72 virtual void AddNewItem( std::unique_ptr<BOARD_ITEM> aItem ) = 0;
131 void AddNewItem( std::unique_ptr<BOARD_ITEM> aItem )
override
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Pairwise add dogbone corners to an internal corner.
DOGBONE_CORNER_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler, PARAMETERS aParams)
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
wxString GetCommitDescription() const override
void ProcessLinePair(PCB_SHAPE &aLineA, PCB_SHAPE &aLineB) override
Perform the action on the pair of lines given.
A handler that is based on a set of callbacks provided by the user of the ITEM_MODIFICATION_ROUTINE.
MODIFICATION_HANDLER m_modificationHandler
void MarkItemModified(BOARD_ITEM &aItem) override
Report that the tool has modified an item on the board.
std::function< void(BOARD_ITEM &)> MODIFICATION_HANDLER
Handler for modifying or deleting an existing item on the board.
std::function< void(std::unique_ptr< BOARD_ITEM >)> CREATION_HANDLER
Handler for creating a new item on the board.
CALLABLE_BASED_HANDLER(CREATION_HANDLER aCreationHandler, MODIFICATION_HANDLER aModificationHandler, DELETION_HANDLER aDeletionHandler)
DELETION_HANDLER m_deletionHandler
void DeleteItem(BOARD_ITEM &aItem) override
Report that the tool has deleted an item on the board.
void AddNewItem(std::unique_ptr< BOARD_ITEM > aItem) override
Report that the tools wants to add a new item to the board.
std::function< void(BOARD_ITEM &)> DELETION_HANDLER
Handler for modifying or deleting an existing item on the board.
CREATION_HANDLER m_creationHandler
virtual ~CHANGE_HANDLER()=default
virtual void MarkItemModified(BOARD_ITEM &aItem)=0
Report that the tool has modified an item on the board.
virtual void DeleteItem(BOARD_ITEM &aItem)=0
Report that the tool has deleted an item on the board.
virtual void AddNewItem(std::unique_ptr< BOARD_ITEM > aItem)=0
Report that the tools wants to add a new item to the board.
An object that has the ability to modify items on a board.
unsigned GetFailures() const
ITEM_MODIFICATION_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
void AddFailure()
Mark that one of the actions failed.
unsigned GetSuccesses() const
virtual wxString GetCommitDescription() const =0
virtual std::optional< wxString > GetStatusMessage() const =0
Get a status message to show when the routine is complete.
void AddSuccess()
Mark that one of the actions succeeded.
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 & m_handler
BOARD_ITEM * GetBoard() const
The BOARD used when creating new shapes.
virtual ~ITEM_MODIFICATION_ROUTINE()=default
CHANGE_HANDLER & GetHandler()
Access the handler for making changes to the board.
Pairwise line tool that adds a chamfer between the lines.
wxString GetCommitDescription() const override
void ProcessLinePair(PCB_SHAPE &aLineA, PCB_SHAPE &aLineB) override
Perform the action on the pair of lines given.
const CHAMFER_PARAMS m_chamferParams
LINE_CHAMFER_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler, CHAMFER_PARAMS aChamferParams)
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
Pairwise extend to corner or meeting tool.
wxString GetCommitDescription() const override
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
LINE_EXTENSION_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
void ProcessLinePair(PCB_SHAPE &aLineA, PCB_SHAPE &aLineB) override
Perform the action on the pair of lines given.
Pairwise line tool that adds a fillet to the lines.
wxString GetCommitDescription() const override
void ProcessLinePair(PCB_SHAPE &aLineA, PCB_SHAPE &aLineB) override
Perform the action on the pair of lines given.
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
LINE_FILLET_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler, int filletRadiusIU)
void ProcessItem(BOARD_ITEM &aItem)
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
const PARAMETERS m_params
OUTSET_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler, const PARAMETERS &aParams)
wxString GetCommitDescription() const override
A tool that acts on a pair of lines.
PAIRWISE_LINE_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
virtual void ProcessLinePair(PCB_SHAPE &aLineA, PCB_SHAPE &aLineB)=0
Perform the action on the pair of lines given.
A routine that modifies polygons using boolean operations.
SHAPE_POLY_SET m_workingPolygons
This can be disjoint, which will be fixed at the end.
void Finalize()
Clear up any outstanding work.
SHAPE_POLY_SET & GetWorkingPolygons()
POLYGON_BOOLEAN_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
void ProcessShape(PCB_SHAPE &aPcbShape)
virtual bool ProcessSubsequentPolygon(const SHAPE_POLY_SET &aPolygon)=0
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
wxString GetCommitDescription() const override
POLYGON_INTERSECT_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
bool ProcessSubsequentPolygon(const SHAPE_POLY_SET &aPolygon) override
bool ProcessSubsequentPolygon(const SHAPE_POLY_SET &aPolygon) override
wxString GetCommitDescription() const override
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
POLYGON_MERGE_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
wxString GetCommitDescription() const override
POLYGON_SUBTRACT_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
std::optional< wxString > GetStatusMessage() const override
Get a status message to show when the routine is complete.
bool ProcessSubsequentPolygon(const SHAPE_POLY_SET &aPolygon) override
Represent a set of closed polygons.
PCB_LAYER_ID
A quick note on layer IDs:
Parameters that define a simple chamfer operation.
std::optional< int > gridRounding