KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ITEM_MODIFICATION_ROUTINE Class Referenceabstract

An object that has the ability to modify items on a board. More...

#include <item_modification_routine.h>

Inheritance diagram for ITEM_MODIFICATION_ROUTINE:
PAIRWISE_LINE_ROUTINE POLYGON_BOOLEAN_ROUTINE LINE_CHAMFER_ROUTINE LINE_EXTENSION_ROUTINE LINE_FILLET_ROUTINE POLYGON_INTERSECT_ROUTINE POLYGON_MERGE_ROUTINE POLYGON_SUBTRACT_ROUTINE

Classes

class  CALLABLE_BASED_HANDLER
 A handler that is based on a set of callbacks provided by the user of the ITEM_MODIFICATION_ROUTINE. More...
 
class  CHANGE_HANDLER
 

Public Member Functions

 ITEM_MODIFICATION_ROUTINE (BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
 
virtual ~ITEM_MODIFICATION_ROUTINE ()=default
 
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

BOARD_ITEMGetBoard () 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 SEG &aSeg)
 Helper function useful for multiple tools: modify a line or delete it if it has zero length.
 
CHANGE_HANDLERGetHandler ()
 Access the handler for making changes to the board.
 

Private Attributes

BOARD_ITEMm_board
 
CHANGE_HANDLERm_handler
 
unsigned m_numSuccesses
 
unsigned m_numFailures
 

Detailed Description

An object that has the ability to modify items on a board.

For example, such an object could take pairs of lines and fillet them, or produce other modification to items.

Deliberately not called a "tool" to distinguish it from true tools that are used interactively by the user.

Definition at line 46 of file item_modification_routine.h.

Constructor & Destructor Documentation

◆ ITEM_MODIFICATION_ROUTINE()

ITEM_MODIFICATION_ROUTINE::ITEM_MODIFICATION_ROUTINE ( BOARD_ITEM aBoard,
CHANGE_HANDLER aHandler 
)
inline

Definition at line 155 of file item_modification_routine.h.

◆ ~ITEM_MODIFICATION_ROUTINE()

virtual ITEM_MODIFICATION_ROUTINE::~ITEM_MODIFICATION_ROUTINE ( )
virtualdefault

Member Function Documentation

◆ AddFailure()

void ITEM_MODIFICATION_ROUTINE::AddFailure ( )
inlineprotected

◆ AddSuccess()

void ITEM_MODIFICATION_ROUTINE::AddSuccess ( )
inlineprotected

◆ GetBoard()

BOARD_ITEM * ITEM_MODIFICATION_ROUTINE::GetBoard ( ) const
inlineprotected

◆ GetCommitDescription()

virtual wxString ITEM_MODIFICATION_ROUTINE::GetCommitDescription ( ) const
pure virtual

◆ GetFailures()

◆ GetHandler()

CHANGE_HANDLER & ITEM_MODIFICATION_ROUTINE::GetHandler ( )
inlineprotected

◆ GetStatusMessage()

virtual std::optional< wxString > ITEM_MODIFICATION_ROUTINE::GetStatusMessage ( ) const
pure virtual

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, POLYGON_MERGE_ROUTINE, POLYGON_SUBTRACT_ROUTINE, and POLYGON_INTERSECT_ROUTINE.

◆ GetSuccesses()

◆ ModifyLineOrDeleteIfZeroLength()

bool ITEM_MODIFICATION_ROUTINE::ModifyLineOrDeleteIfZeroLength ( PCB_SHAPE aItem,
const SEG aSeg 
)
protected

Helper function useful for multiple tools: modify a line or delete it if it has zero length.

Parameters
aItemthe line to modify
aSegthe new line geometry

Definition at line 41 of file item_modification_routine.cpp.

References SEG::A, SEG::B, ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::DeleteItem(), GetHandler(), EDA_SHAPE::GetShape(), SEG::Length(), ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::MarkItemModified(), EDA_SHAPE::SetEnd(), and EDA_SHAPE::SetStart().

Referenced by LINE_FILLET_ROUTINE::ProcessLinePair(), and LINE_CHAMFER_ROUTINE::ProcessLinePair().

Member Data Documentation

◆ m_board

BOARD_ITEM* ITEM_MODIFICATION_ROUTINE::m_board
private

Definition at line 209 of file item_modification_routine.h.

Referenced by GetBoard().

◆ m_handler

CHANGE_HANDLER& ITEM_MODIFICATION_ROUTINE::m_handler
private

Definition at line 210 of file item_modification_routine.h.

Referenced by GetHandler().

◆ m_numFailures

unsigned ITEM_MODIFICATION_ROUTINE::m_numFailures
private

Definition at line 213 of file item_modification_routine.h.

Referenced by AddFailure(), and GetFailures().

◆ m_numSuccesses

unsigned ITEM_MODIFICATION_ROUTINE::m_numSuccesses
private

Definition at line 212 of file item_modification_routine.h.

Referenced by AddSuccess(), and GetSuccesses().


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