KiCad PCB EDA Suite
CONVERT_TOOL Class Reference

#include <convert_tool.h>

Inheritance diagram for CONVERT_TOOL:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 CONVERT_TOOL ()
 
virtual ~CONVERT_TOOL ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int LinesToPoly (const TOOL_EVENT &aEvent)
 Convert selected lines to a polygon, if possible. More...
 
int PolyToLines (const TOOL_EVENT &aEvent)
 Convert selected polygon-like object to graphic lines, if possible. More...
 
int SegmentToArc (const TOOL_EVENT &aEvent)
 Convert selected segment (graphic or track) to an arc of the same type. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Static Private Member Functions

static OPT< SEGgetStartEndPoints (EDA_ITEM *aItem, int *aWidth)
 Retrieve the start and end points for a generic item. More...
 
static SHAPE_POLY_SET makePolysFromSegs (const std::deque< EDA_ITEM * > &aItems)
 Try to make polygons from segments in the selected items. More...
 
static SHAPE_POLY_SET makePolysFromRects (const std::deque< EDA_ITEM * > &aItems)
 Try to make polygons from rectangles. More...
 
static SHAPE_POLY_SET makePolysFromCircles (const std::deque< EDA_ITEM * > &aItems)
 Try to make polygons from circles. More...
 

Private Attributes

PCB_SELECTION_TOOLm_selectionTool
 
CONDITIONAL_MENUm_menu
 
PCB_BASE_FRAMEm_frame
 

Detailed Description

Definition at line 36 of file convert_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 78 of file tool_base.h.

79  {
80  RUN,
81  MODEL_RELOAD,
82  GAL_SWITCH
83  };
Model changes (required full reload)
Definition: tool_base.h:81
Tool is invoked after being inactive.
Definition: tool_base.h:80
Rendering engine changes.
Definition: tool_base.h:82

Constructor & Destructor Documentation

◆ CONVERT_TOOL()

CONVERT_TOOL::CONVERT_TOOL ( )

Definition at line 47 of file convert_tool.cpp.

47  :
48  TOOL_INTERACTIVE( "pcbnew.Convert" ),
50  m_menu( NULL ),
51  m_frame( NULL )
52 {
53 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
PCB_SELECTION_TOOL * m_selectionTool
Definition: convert_tool.h:103
#define NULL
PCB_BASE_FRAME * m_frame
Definition: convert_tool.h:105
CONDITIONAL_MENU * m_menu
Definition: convert_tool.h:104

◆ ~CONVERT_TOOL()

CONVERT_TOOL::~CONVERT_TOOL ( )
virtual

Definition at line 55 of file convert_tool.cpp.

56 {
57  delete m_menu;
58 }
CONDITIONAL_MENU * m_menu
Definition: convert_tool.h:104

References m_menu.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Return the application window object, casted to requested user type.

Definition at line 185 of file tool_base.h.

186  {
187 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
188  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
189 #endif
190  return static_cast<T*>( getToolHolderInt() );
191  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 144 of file tool_base.h.

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), and ZONE_CREATE_HELPER::createZoneFromExisting().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

135  {
136  return m_toolName;
137  }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ getStartEndPoints()

OPT< SEG > CONVERT_TOOL::getStartEndPoints ( EDA_ITEM aItem,
int *  aWidth 
)
staticprivate

Retrieve the start and end points for a generic item.

Parameters
aItemis an item that has a start and end point.
Returns
a segment from start to end, or NULLOPT if invalid.

Definition at line 677 of file convert_tool.cpp.

678 {
679  switch( aItem->Type() )
680  {
681  case PCB_SHAPE_T:
682  case PCB_FP_SHAPE_T:
683  {
684  PCB_SHAPE* line = static_cast<PCB_SHAPE*>( aItem );
685 
686  if( aWidth )
687  *aWidth = line->GetWidth();
688 
689  return boost::make_optional<SEG>( { VECTOR2I( line->GetStart() ),
690  VECTOR2I( line->GetEnd() ) } );
691  }
692 
693  case PCB_TRACE_T:
694  {
695  TRACK* line = static_cast<TRACK*>( aItem );
696 
697  if( aWidth )
698  *aWidth = line->GetWidth();
699 
700  return boost::make_optional<SEG>( { VECTOR2I( line->GetStart() ),
701  VECTOR2I( line->GetEnd() ) } );
702  }
703 
704  case PCB_ARC_T:
705  {
706  ARC* arc = static_cast<ARC*>( aItem );
707 
708  if( aWidth )
709  *aWidth = arc->GetWidth();
710 
711  return boost::make_optional<SEG>( { VECTOR2I( arc->GetStart() ),
712  VECTOR2I( arc->GetEnd() ) } );
713  }
714 
715  default:
716  return NULLOPT;
717  }
718 }
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
const wxPoint & GetStart() const
Definition: track.h:116
int GetWidth() const
Definition: pcb_shape.h:118
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const auto NULLOPT
Definition: optional.h:9
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
int GetWidth() const
Definition: track.h:110
Definition: track.h:262
const wxPoint & GetEnd() const
Definition: track.h:113
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Definition: track.h:83
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References TRACK::GetEnd(), PCB_SHAPE::GetEnd(), TRACK::GetStart(), PCB_SHAPE::GetStart(), TRACK::GetWidth(), PCB_SHAPE::GetWidth(), NULLOPT, PCB_ARC_T, PCB_FP_SHAPE_T, PCB_SHAPE_T, PCB_TRACE_T, and EDA_ITEM::Type().

Referenced by makePolysFromSegs(), and SegmentToArc().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

110  {
111  return m_type;
112  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:207

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:291

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

130 {
131  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
132 
133  goInternal( sptr, aConditions );
134 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool CONVERT_TOOL::Init ( void  )
overridevirtual

Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 65 of file convert_tool.cpp.

66 {
68  m_frame = getEditFrame<PCB_BASE_FRAME>();
69 
70  // Create a context menu and make it available through selection tool
71  m_menu = new CONDITIONAL_MENU( this );
73  m_menu->SetTitle( _( "Convert" ) );
74 
75  static KICAD_T convertableTracks[] = { PCB_TRACE_T, PCB_ARC_T, EOT };
76  static KICAD_T zones[] = { PCB_ZONE_T, PCB_FP_ZONE_T, EOT };
77 
78  auto graphicLines = P_S_C::OnlyGraphicShapeTypes( { S_SEGMENT, S_RECT, S_CIRCLE } )
79  && P_S_C::SameLayer();
80 
81  auto trackLines = S_C::MoreThan( 1 ) && S_C::OnlyTypes( convertableTracks )
82  && P_S_C::SameLayer();
83 
84  auto anyLines = graphicLines || trackLines;
85 
86  auto anyPolys = S_C::OnlyTypes( zones )
88 
89  auto lineToArc = S_C::Count( 1 ) && ( P_S_C::OnlyGraphicShapeTypes( { S_SEGMENT } )
90  || S_C::OnlyType( PCB_TRACE_T ) );
91 
92  auto showConvert = anyPolys || anyLines || lineToArc;
93 
98 
99  // Currently the code exists, but tracks are not really existing in footprints
100  // only segments on copper layers
103 
105 
107  selToolMenu.AddMenu( m_menu, showConvert, 100 );
108 
109  return true;
110 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
static TOOL_ACTION convertToTracks
Definition: pcb_actions.h:477
static TOOL_ACTION convertToLines
Definition: pcb_actions.h:475
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:72
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static SELECTION_CONDITION OnlyGraphicShapeTypes(const std::set< PCB_SHAPE_TYPE_T > aTypes)
Create a functor that tests if the selection contains PCB_SHAPE* items of certain shapes.
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
TOOL_MENU & GetToolMenu()
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
usual segment : line with rounded ends
Definition: board_item.h:50
segment with non rounded ends
Definition: board_item.h:51
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
PCB_SELECTION_TOOL * m_selectionTool
Definition: convert_tool.h:103
static SELECTION_CONDITION SameLayer()
Creates a functor that tests if selection contains items that belong exclusively to the same layer.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
static TOOL_ACTION convertToZone
Definition: pcb_actions.h:473
static TOOL_ACTION convertToKeepout
Definition: pcb_actions.h:474
class ZONE, a copper pour area
Definition: typeinfo.h:105
PCB_BASE_FRAME * m_frame
Definition: convert_tool.h:105
static TOOL_ACTION convertToArc
Definition: pcb_actions.h:476
CONDITIONAL_MENU * m_menu
Definition: convert_tool.h:104
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:90
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
The selection tool: currently supports:
ring
Definition: board_item.h:53
static TOOL_ACTION convertToPoly
Definition: pcb_actions.h:472
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.

References _, CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), convert, PCB_ACTIONS::convertToArc, PCB_ACTIONS::convertToKeepout, PCB_ACTIONS::convertToLines, PCB_ACTIONS::convertToPoly, PCB_ACTIONS::convertToTracks, PCB_ACTIONS::convertToZone, SELECTION_CONDITIONS::Count(), EOT, FRAME_PCB_EDITOR, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), EDA_BASE_FRAME::IsType(), m_frame, m_menu, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::MoreThan(), PCB_SELECTION_CONDITIONS::OnlyGraphicShapeTypes(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), PCB_ARC_T, PCB_FP_ZONE_T, PCB_TRACE_T, PCB_ZONE_T, S_CIRCLE, S_POLYGON, S_RECT, S_SEGMENT, PCB_SELECTION_CONDITIONS::SameLayer(), ACTION_MENU::SetIcon(), and ACTION_MENU::SetTitle().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ LinesToPoly()

int CONVERT_TOOL::LinesToPoly ( const TOOL_EVENT aEvent)

Convert selected lines to a polygon, if possible.

Definition at line 113 of file convert_tool.cpp.

114 {
115  FOOTPRINT* parentFootprint = nullptr;
116 
117  auto& selection = m_selectionTool->RequestSelection(
118  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
119  {
120  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
121  {
122  BOARD_ITEM* item = aCollector[i];
123 
124  switch( item->Type() )
125  {
126  case PCB_SHAPE_T:
127  case PCB_FP_SHAPE_T:
128  switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
129  {
130  case S_SEGMENT:
131  case S_RECT:
132  case S_CIRCLE:
133  // case S_ARC: // Not yet
134  break;
135 
136  default:
137  aCollector.Remove( item );
138  }
139 
140  break;
141 
142  case PCB_TRACE_T:
143  // case PCB_ARC_T: // Not yet
144  break;
145 
146  default:
147  aCollector.Remove( item );
148  }
149  }
150  } );
151 
152  if( selection.Empty() )
153  return 0;
154 
155  // TODO(JE) From a context menu, the selection condition enforces that the items are on
156  // a single layer. But, you can still trigger this with items on multiple layer selected.
157  // Technically we should make this work if each contiguous poly shares a layer
158  PCB_LAYER_ID destLayer = static_cast<BOARD_ITEM*>( selection.Front() )->GetLayer();
159 
160  SHAPE_POLY_SET polySet = makePolysFromSegs( selection.GetItems() );
161 
162  polySet.Append( makePolysFromRects( selection.GetItems() ) );
163 
164  polySet.Append( makePolysFromCircles( selection.GetItems() ) );
165 
166  if( polySet.IsEmpty() )
167  return 0;
168 
169  bool isFootprint = m_frame->IsType( FRAME_FOOTPRINT_EDITOR );
170 
171  if( FP_SHAPE* graphic = dynamic_cast<FP_SHAPE*>( selection.Front() ) )
172  parentFootprint = graphic->GetParentFootprint();
173 
174  BOARD_COMMIT commit( m_frame );
175 
176  // For now, we convert each outline in the returned shape to its own polygon
177  std::vector<SHAPE_POLY_SET> polys;
178 
179  for( int i = 0; i < polySet.OutlineCount(); i++ )
180  polys.emplace_back( SHAPE_POLY_SET( polySet.COutline( i ) ) );
181 
182  if( aEvent.IsAction( &PCB_ACTIONS::convertToPoly ) )
183  {
184  for( const SHAPE_POLY_SET& poly : polys )
185  {
186  PCB_SHAPE* graphic = isFootprint ? new FP_SHAPE( parentFootprint ) : new PCB_SHAPE;
187 
188  graphic->SetShape( S_POLYGON );
189  graphic->SetFilled( false );
190  graphic->SetWidth( poly.Outline( 0 ).Width() );
191  graphic->SetLayer( destLayer );
192  graphic->SetPolyShape( poly );
193 
194  commit.Add( graphic );
195  }
196 
197  commit.Push( _( "Convert shapes to polygon" ) );
198  }
199  else
200  {
201  // Creating zone or keepout
202  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
203  BOARD_ITEM_CONTAINER* parent = frame->GetModel();
204  ZONE_SETTINGS zoneInfo = frame->GetZoneSettings();
205 
206  int ret;
207 
208  if( aEvent.IsAction( &PCB_ACTIONS::convertToKeepout ) )
209  ret = InvokeRuleAreaEditor( frame, &zoneInfo );
210  else
211  ret = InvokeCopperZonesEditor( frame, &zoneInfo );
212 
213  if( ret == wxID_CANCEL )
214  return 0;
215 
216  for( const SHAPE_POLY_SET& poly : polys )
217  {
218  ZONE* zone = isFootprint ? new FP_ZONE( parent ) : new ZONE( parent );
219 
220  *zone->Outline() = poly;
221  zone->HatchBorder();
222 
223  zoneInfo.ExportSetting( *zone );
224 
225  commit.Add( zone );
226  }
227 
228  commit.Push( _( "Convert shapes to zone" ) );
229  }
230 
231  return 0;
232 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void SetFilled(bool aFlag)
Definition: pcb_shape.h:94
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
bool IsEmpty() const
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
static SHAPE_POLY_SET makePolysFromCircles(const std::deque< EDA_ITEM * > &aItems)
Try to make polygons from circles.
usual segment : line with rounded ends
Definition: board_item.h:50
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
segment with non rounded ends
Definition: board_item.h:51
PCB_SELECTION_TOOL * m_selectionTool
Definition: convert_tool.h:103
static SHAPE_POLY_SET makePolysFromRects(const std::deque< EDA_ITEM * > &aItems)
Try to make polygons from rectangles.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
PCB_LAYER_ID
A quick note on layer IDs:
void SetShape(PCB_SHAPE_TYPE_T aShape)
Definition: pcb_shape.h:129
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:924
Represent a set of closed polygons.
const ZONE_SETTINGS & GetZoneSettings() const
static TOOL_ACTION convertToKeepout
Definition: pcb_actions.h:474
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeRuleAreaEditor invokes up a modal dialog window for copper zone editing.
ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:67
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
PCB_BASE_FRAME * m_frame
Definition: convert_tool.h:105
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
bool IsType(FRAME_T aType) const
Common, abstract interface for edit frames.
#define _(s)
Definition: 3d_actions.cpp:33
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void SetWidth(int aWidth)
Definition: pcb_shape.h:117
The selection tool: currently supports:
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
ring
Definition: board_item.h:53
static TOOL_ACTION convertToPoly
Definition: pcb_actions.h:472
void SetPolyShape(const SHAPE_POLY_SET &aShape)
Definition: pcb_shape.h:276
static SHAPE_POLY_SET makePolysFromSegs(const std::deque< EDA_ITEM * > &aItems)
Try to make polygons from segments in the selected items.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
A specialization of ZONE for use in footprints.
Definition: zone.h:943
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References _, COMMIT::Add(), SHAPE_POLY_SET::Append(), PCB_ACTIONS::convertToKeepout, PCB_ACTIONS::convertToPoly, SHAPE_POLY_SET::COutline(), ZONE_SETTINGS::ExportSetting(), FRAME_FOOTPRINT_EDITOR, COLLECTOR::GetCount(), PCB_BASE_FRAME::GetModel(), PCB_BASE_FRAME::GetZoneSettings(), ZONE::HatchBorder(), InvokeCopperZonesEditor(), InvokeRuleAreaEditor(), TOOL_EVENT::IsAction(), SHAPE_POLY_SET::IsEmpty(), EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, makePolysFromCircles(), makePolysFromRects(), makePolysFromSegs(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), PCB_FP_SHAPE_T, PCB_SHAPE_T, PCB_TRACE_T, BOARD_COMMIT::Push(), COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), S_CIRCLE, S_POLYGON, S_RECT, S_SEGMENT, PCB_SHAPE::SetFilled(), BOARD_ITEM::SetLayer(), PCB_SHAPE::SetPolyShape(), PCB_SHAPE::SetShape(), PCB_SHAPE::SetWidth(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ makePolysFromCircles()

SHAPE_POLY_SET CONVERT_TOOL::makePolysFromCircles ( const std::deque< EDA_ITEM * > &  aItems)
staticprivate

Try to make polygons from circles.

Parameters
aItemsis a list of circle shapes to process.
Returns
a SHAPE_POLY_SET containing any polygons that were created.

Definition at line 366 of file convert_tool.cpp.

367 {
368  SHAPE_POLY_SET poly;
369 
370  for( EDA_ITEM* item : aItems )
371  {
372  if( item->Type() != PCB_SHAPE_T && item->Type() != PCB_FP_SHAPE_T )
373  continue;
374 
375  PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
376 
377  if( graphic->GetShape() != S_CIRCLE )
378  continue;
379 
380  BOARD_DESIGN_SETTINGS& bds = graphic->GetBoard()->GetDesignSettings();
381  SHAPE_LINE_CHAIN outline;
382 
383  TransformCircleToPolygon( outline, graphic->GetPosition(), graphic->GetRadius(),
384  bds.m_MaxError, ERROR_OUTSIDE );
385 
386  poly.AddOutline( outline );
387  }
388 
389  return poly;
390 }
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
Represent a set of closed polygons.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
wxPoint GetPosition() const override
Definition: pcb_shape.cpp:68
SHAPE_LINE_CHAIN.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aCornerBuffer, wxPoint aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
ring
Definition: board_item.h:53
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Container for design settings for a BOARD object.

References SHAPE_POLY_SET::AddOutline(), ERROR_OUTSIDE, BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), PCB_SHAPE::GetPosition(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetShape(), BOARD_DESIGN_SETTINGS::m_MaxError, PCB_FP_SHAPE_T, PCB_SHAPE_T, S_CIRCLE, and TransformCircleToPolygon().

Referenced by LinesToPoly().

◆ makePolysFromRects()

SHAPE_POLY_SET CONVERT_TOOL::makePolysFromRects ( const std::deque< EDA_ITEM * > &  aItems)
staticprivate

Try to make polygons from rectangles.

Parameters
aItemsis a list of rect shapes to process.
Returns
a SHAPE_POLY_SET containing any polygons that were created.

Definition at line 333 of file convert_tool.cpp.

334 {
335  SHAPE_POLY_SET poly;
336 
337  for( EDA_ITEM* item : aItems )
338  {
339  if( item->Type() != PCB_SHAPE_T && item->Type() != PCB_FP_SHAPE_T )
340  continue;
341 
342  PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
343 
344  if( graphic->GetShape() != S_RECT )
345  continue;
346 
347  SHAPE_LINE_CHAIN outline;
348  VECTOR2I start( graphic->GetStart() );
349  VECTOR2I end( graphic->GetEnd() );
350 
351  outline.Append( start );
352  outline.Append( VECTOR2I( end.x, start.y ) );
353  outline.Append( end );
354  outline.Append( VECTOR2I( start.x, end.y ) );
355  outline.SetClosed( true );
356 
357  outline.SetWidth( graphic->GetWidth() );
358 
359  poly.AddOutline( outline );
360  }
361 
362  return poly;
363 }
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
int GetWidth() const
Definition: pcb_shape.h:118
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
segment with non rounded ends
Definition: board_item.h:51
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetWidth(int aWidth)
Sets the width of all segments in the chain.
void SetClosed(bool aClosed)
Function SetClosed()
Represent a set of closed polygons.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90

References SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::Append(), PCB_SHAPE::GetEnd(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), PCB_FP_SHAPE_T, PCB_SHAPE_T, S_RECT, SHAPE_LINE_CHAIN::SetClosed(), and SHAPE_LINE_CHAIN::SetWidth().

Referenced by LinesToPoly().

◆ makePolysFromSegs()

SHAPE_POLY_SET CONVERT_TOOL::makePolysFromSegs ( const std::deque< EDA_ITEM * > &  aItems)
staticprivate

Try to make polygons from segments in the selected items.

Polygons are formed from chains of lines/arcs. Each set containing two or more lines/arcs that are connected will be added to the return SHAPE_POLY_SET as an outline. No attempt is made to guess at holes.

Parameters
aItemsis a list of items to process.
Returns
a SHAPE_POLY_SET containing any polygons that were created.

Definition at line 235 of file convert_tool.cpp.

236 {
237  SHAPE_POLY_SET poly;
238 
239  std::map<VECTOR2I, std::vector<EDA_ITEM*>> connections;
240  std::set<EDA_ITEM*> used;
241  std::deque<EDA_ITEM*> toCheck;
242 
243  for( EDA_ITEM* item : aItems )
244  {
245  if( OPT<SEG> seg = getStartEndPoints( item, nullptr ) )
246  {
247  toCheck.push_back( item );
248  connections[seg->A].emplace_back( item );
249  connections[seg->B].emplace_back( item );
250  }
251  }
252 
253  while( !toCheck.empty() )
254  {
255  EDA_ITEM* candidate = toCheck.front();
256  toCheck.pop_front();
257 
258  if( used.count( candidate ) )
259  continue;
260 
261  int width = -1;
262  OPT<SEG> seg = getStartEndPoints( candidate, &width );
263  wxASSERT( seg );
264 
265  SHAPE_LINE_CHAIN outline;
266  std::deque<VECTOR2I> points;
267 
268  // aDirection == true for walking "right" and appending to the end of points
269  // false for walking "left" and prepending to the beginning
270  std::function<void( EDA_ITEM*, bool )> process =
271  [&]( EDA_ITEM* aItem, bool aDirection )
272  {
273  if( used.count( aItem ) )
274  return;
275 
276  used.insert( aItem );
277 
278  OPT<SEG> nextSeg = getStartEndPoints( aItem, &width );
279  wxASSERT( nextSeg );
280 
281  // The reference point, i.e. last added point in the direction we're headed
282  VECTOR2I& ref = aDirection ? points.back() : points.front();
283 
284  // The next point, i.e. the other point on this segment
285  VECTOR2I& next = ( ref == nextSeg->A ) ? nextSeg->B : nextSeg->A;
286 
287  if( aDirection )
288  points.push_back( next );
289  else
290  points.push_front( next );
291 
292  for( EDA_ITEM* neighbor : connections[next] )
293  process( neighbor, aDirection );
294  };
295 
296  // Start with just one point and walk one direction
297  points.push_back( seg->A );
298  process( candidate, true );
299 
300  // check for any candidates on the "left"
301  EDA_ITEM* left = nullptr;
302 
303  for( EDA_ITEM* possibleLeft : connections[seg->A] )
304  {
305  if( possibleLeft != candidate )
306  {
307  left = possibleLeft;
308  break;
309  }
310  }
311 
312  if( left )
313  process( left, false );
314 
315  if( points.size() < 3 )
316  continue;
317 
318  for( const VECTOR2I& point : points )
319  outline.Append( point );
320 
321  outline.SetClosed( true );
322 
323  if( width >= 0 )
324  outline.SetWidth( width );
325 
326  poly.AddOutline( outline );
327  }
328 
329  return poly;
330 }
CITER next(CITER it)
Definition: ptree.cpp:126
static OPT< SEG > getStartEndPoints(EDA_ITEM *aItem, int *aWidth)
Retrieve the start and end points for a generic item.
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetWidth(int aWidth)
Sets the width of all segments in the chain.
void SetClosed(bool aClosed)
Function SetClosed()
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN.
void process(const BOARD_CONNECTED_ITEM *item, int net)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
boost::optional< T > OPT
Definition: optional.h:7

References SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::Append(), getStartEndPoints(), left, next(), process(), SHAPE_LINE_CHAIN::SetClosed(), and SHAPE_LINE_CHAIN::SetWidth().

Referenced by LinesToPoly().

◆ PolyToLines()

int CONVERT_TOOL::PolyToLines ( const TOOL_EVENT aEvent)

Convert selected polygon-like object to graphic lines, if possible.

Definition at line 393 of file convert_tool.cpp.

394 {
395  auto& selection = m_selectionTool->RequestSelection(
396  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
397  {
398  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
399  {
400  BOARD_ITEM* item = aCollector[i];
401 
402  switch( item->Type() )
403  {
404  case PCB_SHAPE_T:
405  case PCB_FP_SHAPE_T:
406  switch( static_cast<PCB_SHAPE*>( item )->GetShape() )
407  {
408  case S_POLYGON:
409  break;
410 
411  case S_RECT:
412  break;
413 
414  default:
415  aCollector.Remove( item );
416  }
417 
418  break;
419 
420  case PCB_ZONE_T:
421  case PCB_FP_ZONE_T:
422  break;
423 
424  default:
425  aCollector.Remove( item );
426  }
427  }
428  } );
429 
430  if( selection.Empty() )
431  return 0;
432 
433  auto getPolySet =
434  []( EDA_ITEM* aItem )
435  {
436  SHAPE_POLY_SET set;
437 
438  switch( aItem->Type() )
439  {
440  case PCB_ZONE_T:
441  case PCB_FP_ZONE_T:
442  set = *static_cast<ZONE*>( aItem )->Outline();
443  break;
444 
445  case PCB_SHAPE_T:
446  case PCB_FP_SHAPE_T:
447  {
448  PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( aItem );
449 
450  if( graphic->GetShape() == S_POLYGON )
451  {
452  set = graphic->GetPolyShape();
453  }
454  else if( graphic->GetShape() == S_RECT )
455  {
456  SHAPE_LINE_CHAIN outline;
457  VECTOR2I start( graphic->GetStart() );
458  VECTOR2I end( graphic->GetEnd() );
459 
460  outline.Append( start );
461  outline.Append( VECTOR2I( end.x, start.y ) );
462  outline.Append( end );
463  outline.Append( VECTOR2I( start.x, end.y ) );
464  outline.SetClosed( true );
465 
466  set.AddOutline( outline );
467  }
468  else
469  {
470  wxFAIL_MSG( "Unhandled graphic shape type in PolyToLines - getPolySet" );
471  }
472  break;
473  }
474 
475  default:
476  wxFAIL_MSG( "Unhandled type in PolyToLines - getPolySet" );
477  break;
478  }
479 
480  return set;
481  };
482 
483  auto getSegList =
484  []( SHAPE_POLY_SET& aPoly )
485  {
486  std::vector<SEG> segs;
487 
488  // Our input should be valid polys, so OK to assert here
489  wxASSERT( aPoly.VertexCount() >= 2 );
490 
491  for( int i = 1; i < aPoly.VertexCount(); i++ )
492  segs.emplace_back( SEG( aPoly.CVertex( i - 1 ), aPoly.CVertex( i ) ) );
493 
494  segs.emplace_back( SEG( aPoly.CVertex( aPoly.VertexCount() - 1 ),
495  aPoly.CVertex( 0 ) ) );
496 
497  return segs;
498  };
499 
500  BOARD_COMMIT commit( m_frame );
501  FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
502 
503  FOOTPRINT* footprint = nullptr;
504 
505  if( fpEditor )
506  footprint = fpEditor->GetBoard()->GetFirstFootprint();
507 
508  for( EDA_ITEM* item : selection )
509  {
510  PCB_LAYER_ID layer = static_cast<BOARD_ITEM*>( item )->GetLayer();
511  SHAPE_POLY_SET polySet = getPolySet( item );
512  std::vector<SEG> segs = getSegList( polySet );
513 
514  if( aEvent.IsAction( &PCB_ACTIONS::convertToLines ) )
515  {
516  for( SEG& seg : segs )
517  {
518  if( fpEditor )
519  {
520  FP_SHAPE* graphic = new FP_SHAPE( footprint, S_SEGMENT );
521 
522  graphic->SetLayer( layer );
523  graphic->SetStart( wxPoint( seg.A ) );
524  graphic->SetStart0( wxPoint( seg.A ) );
525  graphic->SetEnd( wxPoint( seg.B ) );
526  graphic->SetEnd0( wxPoint( seg.B ) );
527  commit.Add( graphic );
528  }
529  else
530  {
531  PCB_SHAPE* graphic = new PCB_SHAPE;
532 
533  graphic->SetShape( S_SEGMENT );
534  graphic->SetLayer( layer );
535  graphic->SetStart( wxPoint( seg.A ) );
536  graphic->SetEnd( wxPoint( seg.B ) );
537  commit.Add( graphic );
538  }
539  }
540  }
541  else
542  {
543  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
544  BOARD_ITEM_CONTAINER* parent = frame->GetModel();
545 
546  if( !IsCopperLayer( layer ) )
547  layer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
548 
549  // I am really unsure converting a polygon to "tracks" (i.e. segments on
550  // copper layers) make sense for footprints, but anyway this code exists
551  if( fpEditor )
552  {
553  // Creating segments on copper layer
554  for( SEG& seg : segs )
555  {
556  FP_SHAPE* graphic = new FP_SHAPE( footprint, S_SEGMENT );
557  graphic->SetLayer( layer );
558  graphic->SetStart( wxPoint( seg.A ) );
559  graphic->SetStart0( wxPoint( seg.A ) );
560  graphic->SetEnd( wxPoint( seg.B ) );
561  graphic->SetEnd0( wxPoint( seg.B ) );
562  commit.Add( graphic );
563  }
564  }
565  else
566  {
567  // Creating tracks
568  for( SEG& seg : segs )
569  {
570  TRACK* track = new TRACK( parent );
571 
572  track->SetLayer( layer );
573  track->SetStart( wxPoint( seg.A ) );
574  track->SetEnd( wxPoint( seg.B ) );
575  commit.Add( track );
576  }
577  }
578  }
579  }
580 
581  commit.Push( _( "Convert polygons to lines" ) );
582 
583  return 0;
584 }
PCB_LAYER_ID SelectOneLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Show the dialog box for a layer selection.
Definition: sel_layer.cpp:225
void SetEnd0(const wxPoint &aPoint)
Definition: fp_shape.h:114
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
static TOOL_ACTION convertToLines
Definition: pcb_actions.h:475
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void SetEnd(const wxPoint &aEnd)
Definition: track.h:112
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:773
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
usual segment : line with rounded ends
Definition: board_item.h:50
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
segment with non rounded ends
Definition: board_item.h:51
PCB_SELECTION_TOOL * m_selectionTool
Definition: convert_tool.h:103
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:70
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void SetClosed(bool aClosed)
Function SetClosed()
PCB_LAYER_ID
A quick note on layer IDs:
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:382
void SetShape(PCB_SHAPE_TYPE_T aShape)
Definition: pcb_shape.h:129
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
class ZONE, a copper pour area
Definition: typeinfo.h:105
void SetStart0(const wxPoint &aPoint)
Definition: fp_shape.h:111
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Definition: seg.h:41
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
PCB_BASE_FRAME * m_frame
Definition: convert_tool.h:105
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
Common, abstract interface for edit frames.
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:148
#define _(s)
Definition: 3d_actions.cpp:33
SHAPE_LINE_CHAIN.
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
class ZONE, managed by a footprint
Definition: typeinfo.h:94
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
void SetStart(const wxPoint &aStart)
Definition: track.h:115
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD * GetBoard() const
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
Definition: track.h:83
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:159
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, COMMIT::Add(), SHAPE_POLY_SET::AddOutline(), LSET::AllNonCuMask(), SHAPE_LINE_CHAIN::Append(), PCB_ACTIONS::convertToLines, F_Cu, PCB_BASE_FRAME::GetBoard(), COLLECTOR::GetCount(), PCB_SHAPE::GetEnd(), BOARD::GetFirstFootprint(), BOARD_ITEM::GetLayer(), PCB_BASE_FRAME::GetModel(), PCB_SHAPE::GetPolyShape(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetStart(), TOOL_EVENT::IsAction(), IsCopperLayer(), m_frame, m_selectionTool, SHAPE_POLY_SET::Outline(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, BOARD_COMMIT::Push(), COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), S_POLYGON, S_RECT, S_SEGMENT, PCB_BASE_FRAME::SelectOneLayer(), SHAPE_LINE_CHAIN::SetClosed(), TRACK::SetEnd(), PCB_SHAPE::SetEnd(), FP_SHAPE::SetEnd0(), BOARD_ITEM::SetLayer(), PCB_SHAPE::SetShape(), TRACK::SetStart(), PCB_SHAPE::SetStart(), FP_SHAPE::SetStart0(), TRACK, and EDA_ITEM::Type().

Referenced by setTransitions().

◆ Reset()

void CONVERT_TOOL::Reset ( RESET_REASON  aReason)
inlineoverridevirtual

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 43 of file convert_tool.h.

43 {}

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ SegmentToArc()

int CONVERT_TOOL::SegmentToArc ( const TOOL_EVENT aEvent)

Convert selected segment (graphic or track) to an arc of the same type.

This method is meant to be overridden in order to specify handlers for events. It is called every time tool is reset or finished.

Definition at line 587 of file convert_tool.cpp.

588 {
589  auto& selection = m_selectionTool->RequestSelection(
590  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
591  {
592  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
593  {
594  BOARD_ITEM* item = aCollector[i];
595 
596  if( !( item->Type() == PCB_SHAPE_T ||
597  item->Type() == PCB_TRACE_T ||
598  item->Type() == PCB_FP_SHAPE_T ) )
599  {
600  aCollector.Remove( item );
601  }
602  }
603  } );
604 
605  EDA_ITEM* source = selection.Front();
606  VECTOR2I start, end, mid;
607 
608  // Offset the midpoint along the normal a little bit so that it's more obviously an arc
609  const double offsetRatio = 0.1;
610 
611  if( OPT<SEG> seg = getStartEndPoints( source, nullptr ) )
612  {
613  start = seg->A;
614  end = seg->B;
615 
616  VECTOR2I normal = ( seg->B - seg->A ).Perpendicular().Resize( offsetRatio * seg->Length() );
617  mid = seg->Center() + normal;
618  }
619  else
620  {
621  return -1;
622  }
623 
624  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
625  BOARD_ITEM_CONTAINER* parent = frame->GetModel();
626 
627  BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( source );
628 
629  // Don't continue processing if we don't actually have a board item
630  if( !boardItem )
631  return 0;
632 
633  PCB_LAYER_ID layer = boardItem->GetLayer();
634 
635  BOARD_COMMIT commit( m_frame );
636 
637  if( source->Type() == PCB_SHAPE_T || source->Type() == PCB_FP_SHAPE_T )
638  {
639  PCB_SHAPE* line = static_cast<PCB_SHAPE*>( source );
640  PCB_SHAPE* arc = new PCB_SHAPE( parent );
641 
642  VECTOR2I center = GetArcCenter( start, mid, end );
643 
644  arc->SetShape( S_ARC );
645  arc->SetFilled( false );
646  arc->SetLayer( layer );
647  arc->SetWidth( line->GetWidth() );
648 
649  arc->SetCenter( wxPoint( center ) );
650  arc->SetArcStart( wxPoint( start ) );
651  arc->SetAngle( GetArcAngle( start, mid, end ) );
652 
653  arc->SetArcEnd( wxPoint( end ) );
654  commit.Add( arc );
655  }
656  else
657  {
658  wxASSERT( source->Type() == PCB_TRACE_T );
659  TRACK* line = static_cast<TRACK*>( source );
660  ARC* arc = new ARC( parent );
661 
662  arc->SetLayer( layer );
663  arc->SetWidth( line->GetWidth() );
664  arc->SetStart( wxPoint( start ) );
665  arc->SetMid( wxPoint( mid ) );
666  arc->SetEnd( wxPoint( end ) );
667 
668  commit.Add( arc );
669  }
670 
671  commit.Push( _( "Create arc from line segment" ) );
672 
673  return 0;
674 }
static OPT< SEG > getStartEndPoints(EDA_ITEM *aItem, int *aWidth)
Retrieve the start and end points for a generic item.
double GetArcAngle(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Returns the subtended angle for a given arc.
Definition: trigo.cpp:492
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void SetEnd(const wxPoint &aEnd)
Definition: track.h:112
void SetFilled(bool aFlag)
Definition: pcb_shape.h:94
int GetWidth() const
Definition: pcb_shape.h:118
Arcs (with rounded ends)
Definition: board_item.h:52
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
PCB_SELECTION_TOOL * m_selectionTool
Definition: convert_tool.h:103
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void SetWidth(int aWidth)
Definition: track.h:109
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
PCB_LAYER_ID
A quick note on layer IDs:
void SetShape(PCB_SHAPE_TYPE_T aShape)
Definition: pcb_shape.h:129
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
Definition: pcb_shape.h:229
void SetMid(const wxPoint &aMid)
Definition: track.h:291
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
PCB_BASE_FRAME * m_frame
Definition: convert_tool.h:105
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
Common, abstract interface for edit frames.
Definition: track.h:262
#define _(s)
Definition: 3d_actions.cpp:33
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
void SetWidth(int aWidth)
Definition: pcb_shape.h:117
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:222
boost::optional< T > OPT
Definition: optional.h:7
void SetStart(const wxPoint &aStart)
Definition: track.h:115
Abstract interface for BOARD_ITEMs capable of storing other items inside.
const VECTOR2I GetArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
Definition: trigo.cpp:450
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: pcb_shape.cpp:466
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
Definition: track.h:83
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:213
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, COMMIT::Add(), ARC, GetArcAngle(), GetArcCenter(), COLLECTOR::GetCount(), BOARD_ITEM::GetLayer(), PCB_BASE_FRAME::GetModel(), getStartEndPoints(), PCB_SHAPE::GetWidth(), m_frame, m_selectionTool, normal, PCB_FP_SHAPE_T, PCB_SHAPE_T, PCB_TRACE_T, BOARD_COMMIT::Push(), COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), S_ARC, PCB_SHAPE::SetAngle(), PCB_SHAPE::SetArcEnd(), PCB_SHAPE::SetArcStart(), PCB_SHAPE::SetCenter(), TRACK::SetEnd(), PCB_SHAPE::SetFilled(), BOARD_ITEM::SetLayer(), ARC::SetMid(), PCB_SHAPE::SetShape(), TRACK::SetStart(), TRACK::SetWidth(), PCB_SHAPE::SetWidth(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void CONVERT_TOOL::setTransitions ( )
overridevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 721 of file convert_tool.cpp.

722 {
729 }
static TOOL_ACTION convertToTracks
Definition: pcb_actions.h:477
static TOOL_ACTION convertToLines
Definition: pcb_actions.h:475
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
int LinesToPoly(const TOOL_EVENT &aEvent)
Convert selected lines to a polygon, if possible.
static TOOL_ACTION convertToZone
Definition: pcb_actions.h:473
static TOOL_ACTION convertToKeepout
Definition: pcb_actions.h:474
static TOOL_ACTION convertToArc
Definition: pcb_actions.h:476
static TOOL_ACTION convertToPoly
Definition: pcb_actions.h:472
int PolyToLines(const TOOL_EVENT &aEvent)
Convert selected polygon-like object to graphic lines, if possible.
int SegmentToArc(const TOOL_EVENT &aEvent)
Convert selected segment (graphic or track) to an arc of the same type.

References PCB_ACTIONS::convertToArc, PCB_ACTIONS::convertToKeepout, PCB_ACTIONS::convertToLines, PCB_ACTIONS::convertToPoly, PCB_ACTIONS::convertToTracks, PCB_ACTIONS::convertToZone, TOOL_INTERACTIVE::Go(), LinesToPoly(), PolyToLines(), and SegmentToArc().

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_frame

PCB_BASE_FRAME* CONVERT_TOOL::m_frame
private

Definition at line 105 of file convert_tool.h.

Referenced by Init(), LinesToPoly(), PolyToLines(), and SegmentToArc().

◆ m_menu

CONDITIONAL_MENU* CONVERT_TOOL::m_menu
private

Definition at line 104 of file convert_tool.h.

Referenced by Init(), and ~CONVERT_TOOL().

◆ m_selectionTool

PCB_SELECTION_TOOL* CONVERT_TOOL::m_selectionTool
private

Definition at line 103 of file convert_tool.h.

Referenced by Init(), LinesToPoly(), PolyToLines(), and SegmentToArc().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 210 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), EE_SELECTION_TOOL::GetNode(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), EE_SELECTION_TOOL::GuessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), BOARD_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GROUP_TOOL::Init(), Init(), GLOBAL_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), PCB_POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), BOARD_INSPECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().


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