24#ifndef ITEM_MODIFICATION_ROUTINE_H_
25#define ITEM_MODIFICATION_ROUTINE_H_
72 virtual void AddNewItem( std::unique_ptr<PCB_SHAPE> aItem ) = 0;
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
A handler that is based on a set of callbacks provided by the user of the ITEM_MODIFICATION_ROUTINE.
void DeleteItem(PCB_SHAPE &aItem) override
Report that the tool has deleted an item on the board.
std::function< void(PCB_SHAPE &)> MODIFICATION_HANDLER
Handler for modifying or deleting an existing item on the board.
void AddNewItem(std::unique_ptr< PCB_SHAPE > aItem) override
Report that the tools wants to add a new item to the board.
MODIFICATION_HANDLER m_modificationHandler
std::function< void(PCB_SHAPE &)> DELETION_HANDLER
Handler for modifying or deleting an existing item on the board.
std::function< void(std::unique_ptr< PCB_SHAPE >)> 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 MarkItemModified(PCB_SHAPE &aItem) override
Report that the tool has modified an item on the board.
CREATION_HANDLER m_creationHandler
virtual void DeleteItem(PCB_SHAPE &aItem)=0
Report that the tool has deleted an item on the board.
virtual ~CHANGE_HANDLER()=default
virtual void MarkItemModified(PCB_SHAPE &aItem)=0
Report that the tool has modified an item on the board.
virtual void AddNewItem(std::unique_ptr< PCB_SHAPE > 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.
CHANGE_HANDLER & m_handler
bool ModifyLineOrDeleteIfZeroLength(PCB_SHAPE &aItem, const SEG &aSeg)
Helper function useful for multiple tools: modify a line or delete it if it has zero length.
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)
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.
PCB_SHAPE * m_workingPolygon
POLYGON_BOOLEAN_ROUTINE(BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
PCB_SHAPE * GetWorkingPolygon() const
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.
Parameters that define a simple chamfer operation.