KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LINE_EXTENSION_ROUTINE Class Reference

Pairwise extend to corner or meeting tool. More...

#include <item_modification_routine.h>

Inheritance diagram for LINE_EXTENSION_ROUTINE:
PAIRWISE_LINE_ROUTINE ITEM_MODIFICATION_ROUTINE

Public Member Functions

 LINE_EXTENSION_ROUTINE (BOARD_ITEM *aBoard, CHANGE_HANDLER &aHandler)
 
wxString GetCommitDescription () const override
 
std::optional< wxString > GetStatusMessage () const override
 Get a status message to show when the routine is complete.
 
void ProcessLinePair (PCB_SHAPE &aLineA, PCB_SHAPE &aLineB) override
 Perform the action on the pair of lines given.
 
unsigned GetSuccesses () const
 
unsigned GetFailures () const
 

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

Pairwise extend to corner or meeting tool.

Definition at line 290 of file item_modification_routine.h.

Constructor & Destructor Documentation

◆ LINE_EXTENSION_ROUTINE()

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

Definition at line 293 of file item_modification_routine.h.

Member Function Documentation

◆ AddFailure()

void ITEM_MODIFICATION_ROUTINE::AddFailure ( )
inlineprotectedinherited

◆ AddSuccess()

void ITEM_MODIFICATION_ROUTINE::AddSuccess ( )
inlineprotectedinherited

◆ GetBoard()

BOARD_ITEM * ITEM_MODIFICATION_ROUTINE::GetBoard ( ) const
inlineprotectedinherited

◆ GetCommitDescription()

wxString LINE_EXTENSION_ROUTINE::GetCommitDescription ( ) const
overridevirtual

Implements ITEM_MODIFICATION_ROUTINE.

Definition at line 241 of file item_modification_routine.cpp.

References _.

◆ GetFailures()

◆ GetHandler()

CHANGE_HANDLER & ITEM_MODIFICATION_ROUTINE::GetHandler ( )
inlineprotectedinherited

◆ GetStatusMessage()

std::optional< wxString > LINE_EXTENSION_ROUTINE::GetStatusMessage ( ) const
overridevirtual

Get a status message to show when the routine is complete.

Usually this will be an error or nothing.

Implements ITEM_MODIFICATION_ROUTINE.

Definition at line 247 of file item_modification_routine.cpp.

References _, ITEM_MODIFICATION_ROUTINE::GetFailures(), and ITEM_MODIFICATION_ROUTINE::GetSuccesses().

◆ GetSuccesses()

◆ ModifyLineOrDeleteIfZeroLength()

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

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(), ITEM_MODIFICATION_ROUTINE::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().

◆ ProcessLinePair()

void LINE_EXTENSION_ROUTINE::ProcessLinePair ( PCB_SHAPE aLineA,
PCB_SHAPE aLineB 
)
overridevirtual

Perform the action on the pair of lines given.

The routine will be called repeatedly with all possible pairs of lines in the selection. The tools should handle the ones it's interested in. This means that the same line can appear multiple times with different partners.

The routine can skip lines that it's not interested in by returning without adding to the success or failure count.

Parameters
aLineAthe first line
aLineBthe second line
Returns
did the action succeed

Implements PAIRWISE_LINE_ROUTINE.

Definition at line 261 of file item_modification_routine.cpp.

References SEG::A, ITEM_MODIFICATION_ROUTINE::AddSuccess(), SEG::B, SEG::Contains(), EuclideanNorm(), GetClampedCoords(), EDA_SHAPE::GetEnd(), ITEM_MODIFICATION_ROUTINE::GetHandler(), EDA_SHAPE::GetLength(), EDA_SHAPE::GetStart(), SEG::IntersectLines(), SEG::Intersects(), ITEM_MODIFICATION_ROUTINE::CHANGE_HANDLER::MarkItemModified(), EDA_IU_SCALE::mmToIU(), and pcbIUScale.

Member Data Documentation

◆ m_board

BOARD_ITEM* ITEM_MODIFICATION_ROUTINE::m_board
privateinherited

Definition at line 209 of file item_modification_routine.h.

Referenced by ITEM_MODIFICATION_ROUTINE::GetBoard().

◆ m_handler

CHANGE_HANDLER& ITEM_MODIFICATION_ROUTINE::m_handler
privateinherited

Definition at line 210 of file item_modification_routine.h.

Referenced by ITEM_MODIFICATION_ROUTINE::GetHandler().

◆ m_numFailures

unsigned ITEM_MODIFICATION_ROUTINE::m_numFailures
privateinherited

◆ m_numSuccesses

unsigned ITEM_MODIFICATION_ROUTINE::m_numSuccesses
privateinherited

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