KiCad PCB EDA Suite
PCB_POINT_EDITOR Class Reference

Tool that displays edit points allowing to modify items by dragging the points. More...

#include <pcb_point_editor.h>

Inheritance diagram for PCB_POINT_EDITOR:
PCB_TOOL_BASE 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

 PCB_POINT_EDITOR ()
 
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 OnSelectionChange (const TOOL_EVENT &aEvent)
 Change selection event handler. More...
 
bool HasPoint ()
 Indicate the cursor is over an edit point. More...
 
void SetIsFootprintEditor (bool aEnabled)
 Function SetIsFootprintEditor() More...
 
bool IsFootprintEditor () const
 
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 Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 0x01, IPO_FLIP = 0x02, IPO_SINGLE_CLICK = 0x04, IPO_REPEAT = 0x08 }
 Options for placing items interactively. More...
 

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
FOOTPRINTfootprint () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCB_SELECTIONselection () const
 
PCB_SELECTIONselection ()
 
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

bool m_isFootprintEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
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
 

Private Member Functions

void setTransitions () override
 < Set up handlers for various events. More...
 
void buildForPolyOutline (std::shared_ptr< EDIT_POINTS > points, const SHAPE_POLY_SET *aOutline)
 
std::shared_ptr< EDIT_POINTSmakePoints (EDA_ITEM *aItem)
 Update item's points with edit points. More...
 
void updateItem () const
 Apply the last changes to the edited item. More...
 
void finishItem ()
 
bool validatePolygon (SHAPE_POLY_SET &aModified) const
 Validate a polygon and displays a popup warning if invalid. More...
 
void updatePoints ()
 Update which point is being edited. More...
 
void updateEditedPoint (const TOOL_EVENT &aEvent)
 Set the current point being edited. NULL means none. More...
 
void setEditedPoint (EDIT_POINT *aPoint)
 
int getEditedPointIndex () const
 Return true if aPoint is the currently modified point. More...
 
bool isModified (const EDIT_POINT &aPoint) const
 Set up an alternative constraint (typically enabled upon a modifier key being pressed). More...
 
void setAltConstraint (bool aEnabled)
 Return a point that should be used as a constrainer for 45 degrees mode. More...
 
EDIT_POINT get45DegConstrainer () const
 Condition to display "Create corner" context menu entry. More...
 
bool removeCornerCondition (const SELECTION &aSelection)
 
int addCorner (const TOOL_EVENT &aEvent)
 TOOL_ACTION handlers. More...
 
int removeCorner (const TOOL_EVENT &aEvent)
 
int modifiedSelection (const TOOL_EVENT &aEvent)
 
void editArcEndpointKeepTangent (PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
 Move an end point of the arc, while keeping the tangent at the other endpoint. More...
 
void editArcEndpointKeepCenter (PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
 Move an end point of the arc around the circumference. More...
 
void editArcMidKeepEndpoints (PCB_SHAPE *aArc, VECTOR2I aStart, VECTOR2I aEnd, const VECTOR2I aCursor) const
 Move the mid point of the arc, while keeping the two endpoints. More...
 
void editArcMidKeepCenter (PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
 Move the mid point of the arc, while keeping the angle. More...
 
int changeEditMethod (const TOOL_EVENT &aEvent)
 

Static Private Member Functions

static bool addCornerCondition (const SELECTION &aSelection)
 Determine if the tool can currently add a corner to the given item. More...
 
static bool canAddCorner (const EDA_ITEM &aItem)
 Condition to display "Remove corner" context menu entry. More...
 

Private Attributes

PCB_SELECTION_TOOLm_selectionTool
 
std::unique_ptr< STATUS_TEXT_POPUPm_statusPopup
 
std::shared_ptr< EDIT_POINTSm_editPoints
 
EDIT_POINTm_editedPoint
 
EDIT_POINTm_hoveredPoint
 
EDIT_POINT m_original
 Original position for the current drag point. More...
 
bool m_refill
 
bool m_altEditMethod
 
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
 
EDIT_POINT m_altConstrainer
 

Detailed Description

Tool that displays edit points allowing to modify items by dragging the points.

Definition at line 43 of file pcb_point_editor.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

Handle the rotate action in the loop by calling the item's rotate method.

IPO_FLIP 

Handle flip action in the loop by calling the item's flip method.

IPO_SINGLE_CLICK 

Create an item immediately on placement starting, otherwise show the pencil cursor until the item is created.

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 111 of file pcb_tool_base.h.

111  {
113  IPO_ROTATE = 0x01,
114 
116  IPO_FLIP = 0x02,
117 
120  IPO_SINGLE_CLICK = 0x04,
121 
123  IPO_REPEAT = 0x08
124  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ 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

◆ PCB_POINT_EDITOR()

PCB_POINT_EDITOR::PCB_POINT_EDITOR ( )

Definition at line 91 of file pcb_point_editor.cpp.

91  :
92  PCB_TOOL_BASE( "pcbnew.PointEditor" ),
93  m_selectionTool( nullptr ),
94  m_editedPoint( nullptr ),
95  m_hoveredPoint( nullptr ),
96  m_original( VECTOR2I( 0, 0 ) ),
97  m_refill( false ),
98  m_altEditMethod( false ),
99  m_altConstrainer( VECTOR2I( 0, 0 ) )
100 {
101 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
EDIT_POINT * m_editedPoint
EDIT_POINT m_altConstrainer
PCB_SELECTION_TOOL * m_selectionTool
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:78
EDIT_POINT m_original
Original position for the current drag point.
EDIT_POINT * m_hoveredPoint

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

◆ addCorner()

int PCB_POINT_EDITOR::addCorner ( const TOOL_EVENT aEvent)
private

TOOL_ACTION handlers.

Definition at line 1985 of file pcb_point_editor.cpp.

1986 {
1987  if( !m_editPoints )
1988  return 0;
1989 
1990  EDA_ITEM* item = m_editPoints->GetParent();
1991  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1992  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
1993 
1994  // called without an active edited polygon
1995  if( !item || !canAddCorner( *item ) )
1996  return 0;
1997 
1998  PCB_SHAPE* graphicItem = dynamic_cast<PCB_SHAPE*>( item );
1999  BOARD_COMMIT commit( frame );
2000 
2001  if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T
2002  || ( graphicItem && graphicItem->GetShape() == S_POLYGON ) )
2003  {
2004  unsigned int nearestIdx = 0;
2005  unsigned int nextNearestIdx = 0;
2006  unsigned int nearestDist = INT_MAX;
2007  unsigned int firstPointInContour = 0;
2008  SHAPE_POLY_SET* zoneOutline;
2009 
2010  if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2011  {
2012  ZONE* zone = static_cast<ZONE*>( item );
2013  zoneOutline = zone->Outline();
2014  zone->SetNeedRefill( true );
2015  }
2016  else
2017  zoneOutline = &( graphicItem->GetPolyShape() );
2018 
2019  commit.Modify( item );
2020 
2021  // Search the best outline segment to add a new corner
2022  // and therefore break this segment into two segments
2023 
2024  // Object to iterate through the corners of the outlines (main contour and its holes)
2025  SHAPE_POLY_SET::ITERATOR iterator = zoneOutline->Iterate( 0, zoneOutline->OutlineCount()-1,
2026  /* IterateHoles */ true );
2027  int curr_idx = 0;
2028 
2029  // Iterate through all the corners of the outlines and search the best segment
2030  for( ; iterator; iterator++, curr_idx++ )
2031  {
2032  int jj = curr_idx+1;
2033 
2034  if( iterator.IsEndContour() )
2035  { // We reach the last point of the current contour (main or hole)
2036  jj = firstPointInContour;
2037  firstPointInContour = curr_idx+1; // Prepare next contour analysis
2038  }
2039 
2040  SEG curr_segment( zoneOutline->CVertex( curr_idx ), zoneOutline->CVertex( jj ) );
2041 
2042  unsigned int distance = curr_segment.Distance( cursorPos );
2043 
2044  if( distance < nearestDist )
2045  {
2046  nearestDist = distance;
2047  nearestIdx = curr_idx;
2048  nextNearestIdx = jj;
2049  }
2050  }
2051 
2052  // Find the point on the closest segment
2053  auto& sideOrigin = zoneOutline->CVertex( nearestIdx );
2054  auto& sideEnd = zoneOutline->CVertex( nextNearestIdx );
2055  SEG nearestSide( sideOrigin, sideEnd );
2056  VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos );
2057 
2058  // Do not add points that have the same coordinates as ones that already belong to polygon
2059  // instead, add a point in the middle of the side
2060  if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
2061  nearestPoint = ( sideOrigin + sideEnd ) / 2;
2062 
2063  zoneOutline->InsertVertex( nextNearestIdx, nearestPoint );
2064 
2065  // We re-hatch the filled zones but not polygons
2066  if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2067  static_cast<ZONE*>( item )->HatchBorder();
2068 
2069 
2070  commit.Push( _( "Add a zone corner" ) );
2071  }
2072 
2073  else if( graphicItem && graphicItem->GetShape() == S_SEGMENT )
2074  {
2075  commit.Modify( graphicItem );
2076 
2077  SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() );
2078  VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
2079 
2080  // Move the end of the line to the break point..
2081  graphicItem->SetEnd( wxPoint( nearestPoint.x, nearestPoint.y ) );
2082 
2083  if( graphicItem->Type() == PCB_FP_SHAPE_T )
2084  static_cast<FP_SHAPE*>( graphicItem )->SetLocalCoord();
2085 
2086  // and add another one starting from the break point
2087  PCB_SHAPE* newSegment;
2088 
2089  if( item->Type() == PCB_FP_SHAPE_T )
2090  {
2091  FP_SHAPE* edge = static_cast<FP_SHAPE*>( graphicItem );
2092  assert( edge->GetParent()->Type() == PCB_FOOTPRINT_T );
2093  newSegment = new FP_SHAPE( *edge );
2094  }
2095  else
2096  {
2097  newSegment = new PCB_SHAPE( *graphicItem );
2098  }
2099 
2100  newSegment->ClearSelected();
2101  newSegment->SetStart( wxPoint( nearestPoint.x, nearestPoint.y ) );
2102  newSegment->SetEnd( wxPoint( seg.B.x, seg.B.y ) );
2103 
2104  if( newSegment->Type() == PCB_FP_SHAPE_T )
2105  static_cast<FP_SHAPE*>( newSegment )->SetLocalCoord();
2106 
2107  commit.Add( newSegment );
2108  commit.Push( _( "Split segment" ) );
2109  }
2110 
2111  updatePoints();
2112  return 0;
2113 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void updatePoints()
Update which point is being edited.
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
void ClearSelected()
Definition: eda_item.h:182
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
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
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.
std::shared_ptr< EDIT_POINTS > m_editPoints
PCB_BASE_EDIT_FRAME * frame() const
static bool canAddCorner(const EDA_ITEM &aItem)
Condition to display "Remove corner" context menu entry.
Represent a set of closed polygons.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Definition: seg.h:41
Common, abstract interface for edit frames.
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:148
#define _(s)
Definition: 3d_actions.cpp:33
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void InsertVertex(int aGlobalIndex, VECTOR2I aNewVertex)
Adds a vertex in the globally indexed position aGlobalIndex.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:235
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:159
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, COMMIT::Add(), canAddCorner(), EDA_ITEM::ClearSelected(), SHAPE_POLY_SET::CVertex(), distance(), PCB_TOOL_BASE::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), PCB_SHAPE::GetEnd(), BOARD_ITEM::GetParent(), PCB_SHAPE::GetPolyShape(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetStart(), TOOL_BASE::getViewControls(), SHAPE_POLY_SET::InsertVertex(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), SHAPE_POLY_SET::Iterate(), m_editPoints, COMMIT::Modify(), SEG::NearestPoint(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_ZONE_T, BOARD_COMMIT::Push(), S_POLYGON, S_SEGMENT, PCB_SHAPE::SetEnd(), ZONE::SetNeedRefill(), PCB_SHAPE::SetStart(), EDA_ITEM::Type(), and updatePoints().

Referenced by setTransitions().

◆ addCornerCondition()

bool PCB_POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
staticprivate

Determine if the tool can currently add a corner to the given item.

Definition at line 1905 of file pcb_point_editor.cpp.

1906 {
1907  if( aSelection.Size() != 1 )
1908  return false;
1909 
1910  const EDA_ITEM* item = aSelection.Front();
1911 
1912  return ( item != nullptr ) && canAddCorner( *item );
1913 }
static bool canAddCorner(const EDA_ITEM &aItem)
Condition to display "Remove corner" context menu entry.
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
EDA_ITEM * Front() const
Definition: selection.h:203

References canAddCorner(), SELECTION::Front(), and SELECTION::Size().

Referenced by Init().

◆ 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().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 160 of file pcb_tool_base.h.

160 { return getModel<BOARD>(); }

Referenced by PCB_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), BOARD_INSPECTION_TOOL::ClearHighlight(), EDIT_TOOL::copyToClipboard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), PCB_TOOL_BASE::footprint(), PCB_SELECTION_TOOL::GetBoard(), PCB_SELECTION_TOOL::getCollectorsGuide(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), PCB_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PAD_TOOL::PlacePad(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), BOARD_EDITOR_CONTROL::RepairBoard(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectAllItemsOnNet(), PCB_SELECTION_TOOL::selectAllItemsOnSheet(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectPoint(), PCB_CONTROL::TrackDisplayMode(), GROUP_TOOL::Ungroup(), PCB_CONTROL::ViaDisplayMode(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ buildForPolyOutline()

void PCB_POINT_EDITOR::buildForPolyOutline ( std::shared_ptr< EDIT_POINTS points,
const SHAPE_POLY_SET aOutline 
)
private

Definition at line 133 of file pcb_point_editor.cpp.

135 {
136  int cornersCount = aOutline->TotalVertices();
137 
138  for( auto iterator = aOutline->CIterateWithHoles(); iterator; iterator++ )
139  {
140  points->AddPoint( *iterator );
141 
142  if( iterator.IsEndContour() )
143  points->AddBreak();
144  }
145 
146  // Lines have to be added after creating edit points,
147  // as they use EDIT_POINT references
148  for( int i = 0; i < cornersCount - 1; ++i )
149  {
150  if( points->IsContourEnd( i ) )
151  points->AddLine( points->Point( i ), points->Point( points->GetContourStartIdx( i ) ) );
152  else
153  points->AddLine( points->Point( i ), points->Point( i + 1 ) );
154 
155  points->Line( i ).SetConstraint( new EC_PERPLINE( points->Line( i ) ) );
156  }
157 
158  // The last missing line, connecting the last and the first polygon point
159  points->AddLine( points->Point( cornersCount - 1 ),
160  points->Point( points->GetContourStartIdx( cornersCount - 1 ) ) );
161 
162  points->Line( points->LinesSize() - 1 )
163  .SetConstraint( new EC_PERPLINE( points->Line( points->LinesSize() - 1 ) ) );
164 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
EDIT_CONSTRAINT for a EDIT_LINE, that constrains the line to move perpendicular to the line itself.
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and SHAPE_POLY_SET::TotalVertices().

Referenced by makePoints().

◆ canAddCorner()

bool PCB_POINT_EDITOR::canAddCorner ( const EDA_ITEM aItem)
staticprivate

Condition to display "Remove corner" context menu entry.

Definition at line 1887 of file pcb_point_editor.cpp.

1888 {
1889  const auto type = aItem.Type();
1890 
1891  // Works only for zones and line segments
1892  if( type == PCB_ZONE_T || type == PCB_FP_ZONE_T )
1893  return true;
1894 
1895  if( type == PCB_SHAPE_T || type == PCB_FP_SHAPE_T )
1896  {
1897  const PCB_SHAPE& shape = static_cast<const PCB_SHAPE&>( aItem );
1898  return shape.GetShape() == S_SEGMENT || shape.GetShape() == S_POLYGON;
1899  }
1900 
1901  return false;
1902 }
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
class ZONE, a copper pour area
Definition: typeinfo.h:105
class ZONE, managed by a footprint
Definition: typeinfo.h:94
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References PCB_SHAPE::GetShape(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, S_POLYGON, S_SEGMENT, and EDA_ITEM::Type().

Referenced by addCorner(), and addCornerCondition().

◆ canvas()

◆ changeEditMethod()

int PCB_POINT_EDITOR::changeEditMethod ( const TOOL_EVENT aEvent)
private

Definition at line 2198 of file pcb_point_editor.cpp.

2199 {
2201  return 0;
2202 }

References m_altEditMethod.

Referenced by setTransitions().

◆ controls()

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 290 of file pcb_tool_base.cpp.

291 {
292  return frame()->GetDisplayOptions();
293 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCB_BASE_EDIT_FRAME * frame() const

References PCB_TOOL_BASE::frame(), and PCB_BASE_FRAME::GetDisplayOptions().

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_CONTROL::HighContrastMode(), PCB_CONTROL::HighContrastModeCycle(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PNS::TOOL_BASE::pickSingleItem(), PCB_CONTROL::ToggleRatsnest(), PCB_CONTROL::TrackDisplayMode(), PCB_CONTROL::ViaDisplayMode(), and PCB_CONTROL::ZoneDisplayMode().

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 35 of file pcb_tool_base.cpp.

38 {
39  using namespace std::placeholders;
40  std::unique_ptr<BOARD_ITEM> newItem;
41 
42  frame()->PushTool( aTool );
43  Activate();
44 
45  BOARD_COMMIT commit( frame() );
46 
48 
49  // do not capture or auto-pan until we start placing an item
50  controls()->ShowCursor( true );
51 
52  // Add a VIEW_GROUP that serves as a preview for the new item
53  PCB_SELECTION preview;
54  view()->Add( &preview );
55 
56  aPlacer->m_board = board();
57  aPlacer->m_frame = frame();
58  aPlacer->m_modifiers = 0;
59 
60  auto makeNewItem =
61  [&]( VECTOR2I aPosition )
62  {
63  if( frame()->GetModel() )
64  newItem = aPlacer->CreateItem();
65 
66  if( newItem )
67  {
68  newItem->SetPosition( (wxPoint) aPosition );
69  preview.Add( newItem.get() );
70 
71  if( newItem->Type() == PCB_FOOTPRINT_T )
72  {
73  FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( newItem.get() );
74 
75  // footprints have more drawable parts
76  fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
77  }
78  }
79  };
80 
81  if( aOptions & IPO_SINGLE_CLICK )
82  makeNewItem( controls()->GetCursorPosition() );
83 
84  auto setCursor =
85  [&]()
86  {
87  if( !newItem )
89  else
91  };
92 
93  // Set initial cursor
94  setCursor();
95 
96  // Main loop: keep receiving events
97  while( TOOL_EVENT* evt = Wait() )
98  {
99  setCursor();
100 
101  VECTOR2I cursorPos = controls()->GetCursorPosition();
102  aPlacer->m_modifiers = evt->Modifier();
103 
104  auto cleanup =
105  [&] ()
106  {
107  newItem = nullptr;
108  preview.Clear();
109  view()->Update( &preview );
110  controls()->SetAutoPan( false );
111  controls()->CaptureCursor( false );
112  controls()->ShowCursor( true );
113  };
114 
115  if( evt->IsCancelInteractive() )
116  {
117  if( aOptions & IPO_SINGLE_CLICK )
118  {
119  cleanup();
120  frame()->PopTool( aTool );
121  break;
122  }
123  else if( newItem )
124  cleanup();
125  else
126  {
127  frame()->PopTool( aTool );
128  break;
129  }
130  }
131  else if( evt->IsActivate() )
132  {
133  if( newItem )
134  cleanup();
135 
136  if( evt->IsPointEditor() )
137  {
138  // don't exit (the point editor runs in the background)
139  }
140  else if( evt->IsMoveTool() )
141  {
142  // leave ourselves on the stack so we come back after the move
143  break;
144  }
145  else
146  {
147  frame()->PopTool( aTool );
148  break;
149  }
150  }
151  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
152  {
153  if( !newItem )
154  {
155  // create the item if possible
156  makeNewItem( cursorPos );
157 
158  // no item created, so wait for another click
159  if( !newItem )
160  continue;
161 
162  controls()->CaptureCursor( true );
163  controls()->SetAutoPan( true );
164  }
165  else
166  {
167  auto oldFlags = newItem->GetFlags();
168  newItem->ClearFlags();
169 
170  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
171  {
172  newItem->SetFlags( oldFlags );
173  continue;
174  }
175 
176  preview.Clear();
177  newItem.release();
178  commit.Push( aCommitMessage );
179 
180  controls()->CaptureCursor( false );
181  controls()->SetAutoPan( false );
182  controls()->ShowCursor( true );
183 
184  if( !( aOptions & IPO_REPEAT ) )
185  break;
186 
187  if( aOptions & IPO_SINGLE_CLICK )
188  makeNewItem( controls()->GetCursorPosition() );
189 
190  setCursor();
191  }
192  }
193  else if( evt->IsClick( BUT_RIGHT ) )
194  {
196  }
197  else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
198  {
200  }
201  else if( newItem && evt->Category() == TC_COMMAND )
202  {
203  /*
204  * Handle any events that can affect the item as we move it around
205  */
206  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
207  {
208  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
209  newItem->Rotate( newItem->GetPosition(), rotationAngle );
210  view()->Update( &preview );
211  }
212  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
213  {
214  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
215  view()->Update( &preview );
216  }
217  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
218  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
219  {
220  // Refresh preview after event runs
222  }
223  else if( evt->IsAction( &PCB_ACTIONS::properties ) )
224  {
225  frame()->OnEditItemRequest( newItem.get() );
226 
227  // Notify other tools of the changes
229  }
230  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
231  {
232  preview.Clear();
233  newItem.release();
234 
235  makeNewItem( (wxPoint) cursorPos );
236  aPlacer->SnapItem( newItem.get() );
237  view()->Update( &preview );
238  }
239  else
240  {
241  evt->SetPassEvent();
242  }
243  }
244  else if( newItem && evt->IsMotion() )
245  {
246  // track the cursor
247  newItem->SetPosition( (wxPoint) cursorPos );
248  aPlacer->SnapItem( newItem.get() );
249 
250  // Show a preview of the item
251  view()->Update( &preview );
252  }
253  else
254  {
255  evt->SetPassEvent();
256  }
257  }
258 
259  view()->Remove( &preview );
261 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:63
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:96
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Handle flip action in the loop by calling the item's flip method.
BOARD * board() const
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:302
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:121
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:305
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:206
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:77
TOOL_MANAGER * GetManager() const
Return the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:144
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
const PCB_SELECTION & selection() const
Allow repeat placement of the item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
Generic, UI-independent tool event.
Definition: tool_event.h:173
KIGFX::PCB_VIEW * view() const
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
Definition: view_group.cpp:56
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:109
Handle the rotate action in the loop by calling the item's rotate method.
KIGFX::VIEW_CONTROLS * controls() const
PCBNEW_SETTINGS & Settings()
void Activate()
Run the tool.
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1175
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:65
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:303
static TOOL_ACTION refreshPreview
Definition: actions.h:109
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), ARROW, PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_BASE_EDIT_FRAME::OnEditItemRequest(), PCB_FOOTPRINT_T, PENCIL, PLACE, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::ProcessEvent(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), FOOTPRINT::RunOnChildren(), EVENTS::SelectedItemsModified, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, PCB_ACTIONS::trackViaSizeChanged, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and PAD_TOOL::PlacePad().

◆ editArcEndpointKeepCenter()

void PCB_POINT_EDITOR::editArcEndpointKeepCenter ( PCB_SHAPE aArc,
VECTOR2I  aCenter,
VECTOR2I  aStart,
VECTOR2I  aMid,
VECTOR2I  aEnd,
const VECTOR2I  aCursor 
) const
private

Move an end point of the arc around the circumference.

Definition at line 860 of file pcb_point_editor.cpp.

863 {
864  bool clockwise;
865  bool movingStart;
866 
867  VECTOR2I *p1, *p2;
868  VECTOR2I target;
869 
870  // p1 does not move, p2 does.
871 
872  if( aStart != aArc->GetArcStart() )
873  {
874  p1 = &aEnd;
875  p2 = &aStart;
876  movingStart = true;
877  }
878  else
879  {
880  p1 = &aStart;
881  p2 = &aEnd;
882  movingStart = false;
883  }
884 
885  target = *p2 - aCenter;
886 
887  double sqRadius = ( *p1 - aCenter ).SquaredEuclideanNorm();
888 
889  *p1 = *p1 - aCenter;
890  *p2 = *p2 - aCenter;
891 
892  // Circle : x^2 + y^2 = R ^ 2
893  // In this coordinate system, the angular position of the cursor is (r, theta)
894  // The line coming from the center of the circle is y = start.y / start.x * x
895  // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
896 
897  if( target.x == 0 )
898  {
899  p2->x = 0;
900  p2->y = ( target.y > 0 ) ? sqrt( sqRadius ) : -sqrt( sqRadius );
901  }
902  else
903  {
904  double tan = target.y / static_cast<double>( target.x );
905  // The divider is always greater than 1 ( cannot be 0 )
906  double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) );
907  // Move to the correct quadrant
908  tmp = target.x > 0 ? tmp : -tmp;
909  p2->y = target.y / static_cast<double>( target.x ) * tmp;
910  p2->x = tmp;
911  }
912 
913  *p1 = *p1 + aCenter;
914  *p2 = *p2 + aCenter;
915 
916  clockwise = aArc->GetAngle() > 0;
917 
918  VECTOR2D startLine = aStart - aCenter;
919  VECTOR2D endLine = aEnd - aCenter;
920  double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
921 
922  if( clockwise && newAngle < 0.0 )
923  newAngle += 3600.0;
924  else if( !clockwise && newAngle > 0.0 )
925  newAngle -= 3600.0;
926 
927  aArc->SetAngle( newAngle, false );
928  aArc->SetCenter( (wxPoint) aCenter );
929 
930  if( movingStart )
931  aArc->SetArcStart( (wxPoint) aStart );
932  else
933  aArc->SetArcEnd( (wxPoint) aEnd );
934 }
double RAD2DECIDEG(double rad)
Definition: trigo.h:236
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
Definition: pcb_shape.h:229
double Angle() const
Compute the angle of the vector.
Definition: vector2d.h:307
double GetAngle() const
Definition: pcb_shape.h:127
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:222
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
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:213

References VECTOR2< T >::Angle(), PCB_SHAPE::GetAngle(), PCB_SHAPE::GetArcStart(), RAD2DECIDEG(), PCB_SHAPE::SetAngle(), PCB_SHAPE::SetArcEnd(), PCB_SHAPE::SetArcStart(), PCB_SHAPE::SetCenter(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by updateItem().

◆ editArcEndpointKeepTangent()

void PCB_POINT_EDITOR::editArcEndpointKeepTangent ( PCB_SHAPE aArc,
VECTOR2I  aCenter,
VECTOR2I  aStart,
VECTOR2I  aMid,
VECTOR2I  aEnd,
const VECTOR2I  aCursor 
) const
private

Move an end point of the arc, while keeping the tangent at the other endpoint.

Definition at line 588 of file pcb_point_editor.cpp.

591 {
592  VECTOR2D startLine = aStart - aCenter;
593  VECTOR2D endLine = aEnd - aCenter;
594  double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
595 
596  bool clockwise;
597  bool movingStart;
598  bool arcValid = true;
599 
600  VECTOR2I *p1, *p2, *p3;
601  // p1 does not move, p2 does.
602 
603  if( aStart != aArc->GetArcStart() )
604  {
605  aStart = aCursor;
606  p1 = &aEnd;
607  p2 = &aStart;
608  p3 = &aMid;
609  movingStart = true;
610  }
611  else if( aEnd != aArc->GetArcEnd() )
612  {
613  aEnd = aCursor;
614  p1 = &aStart;
615  p2 = &aEnd;
616  p3 = &aMid;
617  movingStart = false;
618  }
619  else
620  {
621  return;
622  }
623 
624  VECTOR2D v1, v2, v3, v4;
625 
626  // Move the coordinate system
627  v1 = *p1 - aCenter;
628  v2 = *p2 - aCenter;
629  v3 = *p3 - aCenter;
630 
631  VECTOR2D u1, u2, u3;
632 
633  // A point cannot be both the center and on the arc.
634  if( ( v1.EuclideanNorm() == 0 ) || ( v2.EuclideanNorm() == 0 ) )
635  return;
636 
637  u1 = v1 / v1.EuclideanNorm();
638  u2 = v3 - ( u1.x * v3.x + u1.y * v3.y ) * u1;
639  u2 = u2 / u2.EuclideanNorm();
640 
641  // [ u1, u3 ] is a base centered on the circle with:
642  // u1 : unit vector toward the point that does not move
643  // u2 : unit vector toward the mid point.
644 
645  // Get vectors v1, and v2 in that coordinate system.
646 
647  double det = u1.x * u2.y - u2.x * u1.y;
648 
649  // u1 and u2 are unit vectors, and perpendicular.
650  // det should not be 0. In case it is, do not change the arc.
651  if( det == 0 )
652  return;
653 
654  double tmpx = v1.x * u2.y - v1.y * u2.x;
655  double tmpy = -v1.x * u1.y + v1.y * u1.x;
656  v1.x = tmpx;
657  v1.y = tmpy;
658  v1 = v1 / det;
659 
660  tmpx = v2.x * u2.y - v2.y * u2.x;
661  tmpy = -v2.x * u1.y + v2.y * u1.x;
662  v2.x = tmpx;
663  v2.y = tmpy;
664  v2 = v2 / det;
665 
666  double R = v1.EuclideanNorm();
667  bool transformCircle = false;
668 
669  /* p2
670  * X***
671  * ** <---- This is the arc
672  * y ^ **
673  * | R *
674  * | <-----------> *
675  * x------x------>--------x p1
676  * C' <----> C x
677  * delta
678  *
679  * p1 does not move, and the tangent at p1 remains the same.
680  * => The new center, C', will be on the C-p1 axis.
681  * p2 moves
682  *
683  * The radius of the new circle is delta + R
684  *
685  * || C' p2 || = || C' P1 ||
686  * is the same as :
687  * ( delta + p2.x ) ^ 2 + p2.y ^ 2 = ( R + delta ) ^ 2
688  *
689  * delta = ( R^2 - p2.x ^ 2 - p2.y ^2 ) / ( 2 * p2.x - 2 * R )
690  *
691  * We can use this equation for any point p2 with p2.x < R
692  */
693 
694  if( v2.x == R )
695  {
696  // Straight line, do nothing
697  }
698  else
699  {
700  if( v2.x > R )
701  {
702  // If we need to invert the curvature.
703  // We modify the input so we can use the same equation
704  transformCircle = true;
705  v2.x = 2 * R - v2.x;
706  }
707  // We can keep the tangent constraint.
708  double delta = ( R * R - v2.x * v2.x - v2.y * v2.y ) / ( 2 * v2.x - 2 * R );
709 
710  // This is just to limit the radius, so nothing overflows later when drawing.
711  if( abs( v2.y / ( R - v2.x ) ) > ADVANCED_CFG::GetCfg().m_DrawArcCenterMaxAngle )
712  {
713  arcValid = false;
714  }
715  // Never recorded a problem, but still checking.
716  if( !std::isfinite( delta ) )
717  {
718  arcValid = false;
719  }
720  // v4 is the new center
721  v4 = ( !transformCircle ) ? VECTOR2D( -delta, 0 ) : VECTOR2D( 2 * R + delta, 0 );
722 
723  clockwise = aArc->GetAngle() > 0;
724 
725  if( transformCircle )
726  clockwise = !clockwise;
727 
728  tmpx = v4.x * u1.x + v4.y * u2.x;
729  tmpy = v4.x * u1.y + v4.y * u2.y;
730  v4.x = tmpx;
731  v4.y = tmpy;
732 
733  aCenter = v4 + aCenter;
734 
735  startLine = aStart - aCenter;
736  endLine = aEnd - aCenter;
737  newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
738 
739  if( clockwise && newAngle < 0.0 )
740  newAngle += 3600.0;
741  else if( !clockwise && newAngle > 0.0 )
742  newAngle -= 3600.0;
743 
744  if( arcValid )
745  {
746  aArc->SetAngle( newAngle, false );
747  aArc->SetCenter( wxPoint( aCenter.x, aCenter.y ) );
748 
749  if( movingStart )
750  aArc->SetArcStart( wxPoint( aStart.x, aStart.y ) );
751  else
752  aArc->SetArcEnd( wxPoint( aEnd.x, aEnd.y ) );
753  }
754  }
755 }
wxPoint GetArcEnd() const
Definition: pcb_shape.cpp:374
VECTOR2I v2(1, 0)
Test suite for KiCad math code.
double RAD2DECIDEG(double rad)
Definition: trigo.h:236
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
Definition: pcb_shape.h:229
double Angle() const
Compute the angle of the vector.
Definition: vector2d.h:307
double GetAngle() const
Definition: pcb_shape.h:127
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:222
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector2d.h:293
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
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:213

References VECTOR2< T >::Angle(), VECTOR2< T >::EuclideanNorm(), PCB_SHAPE::GetAngle(), PCB_SHAPE::GetArcEnd(), PCB_SHAPE::GetArcStart(), ADVANCED_CFG::GetCfg(), ADVANCED_CFG::m_DrawArcCenterMaxAngle, RAD2DECIDEG(), PCB_SHAPE::SetAngle(), PCB_SHAPE::SetArcEnd(), PCB_SHAPE::SetArcStart(), PCB_SHAPE::SetCenter(), v2, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by updateItem().

◆ editArcMidKeepCenter()

void PCB_POINT_EDITOR::editArcMidKeepCenter ( PCB_SHAPE aArc,
VECTOR2I  aCenter,
VECTOR2I  aStart,
VECTOR2I  aMid,
VECTOR2I  aEnd,
const VECTOR2I  aCursor 
) const
private

Move the mid point of the arc, while keeping the angle.

Change the edit method to an alternative method ( currently, arcs only )

Definition at line 937 of file pcb_point_editor.cpp.

940 {
941  // Now, update the edit point position
942  // Express the point in a cercle-centered coordinate system.
943  aStart = aStart - aCenter;
944  aEnd = aEnd - aCenter;
945 
946  double sqRadius = ( aCursor - aCenter ).SquaredEuclideanNorm();
947 
948  // Special case, because the tangent would lead to +/- infinity
949  if( aStart.x == 0 )
950  {
951  aStart.y = aCursor.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius );
952  }
953  else
954  {
955  // Circle : x^2 + y^2 = R ^ 2
956  // In this coordinate system, the angular position of the cursor is (r, theta)
957  // The line coming from the center of the circle is y = start.y / start.x * x
958  // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
959 
960  double tan = aStart.y / static_cast<double>( aStart.x );
961  double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) );
962  // Move to the correct quadrant
963  tmp = aStart.x > 0 ? tmp : -tmp;
964  aStart.y = aStart.y / static_cast<double>( aStart.x ) * tmp;
965  aStart.x = tmp;
966  }
967 
968  // Special case, because the tangent would lead to +/- infinity
969  if( aEnd.x == 0 )
970  {
971  aEnd.y = aMid.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius );
972  }
973  else
974  {
975  // Circle : x^2 + y^2 = R ^ 2
976  // In this coordinate system, the angular position of the cursor is (r, theta)
977  // The line coming from the center of the circle is y = start.y / start.x * x
978  // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
979 
980  double tan = aEnd.y / static_cast<double>( aEnd.x );
981  double tmp = sqrt( sqRadius / ( 1.0 + tan * tan ) );
982  // Move to the correct quadrant
983  tmp = aEnd.x > 0 ? tmp : -tmp;
984  aEnd.y = aEnd.y / static_cast<double>( aEnd.x ) * tmp;
985  aEnd.x = tmp;
986  }
987 
988  aStart = aStart + aCenter;
989  aEnd = aEnd + aCenter;
990 
991  aArc->SetArcStart( (wxPoint) aStart );
992  aArc->SetArcEnd( (wxPoint) aEnd );
993 }
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:222
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:213

References PCB_SHAPE::SetArcEnd(), PCB_SHAPE::SetArcStart(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by updateItem().

◆ editArcMidKeepEndpoints()

void PCB_POINT_EDITOR::editArcMidKeepEndpoints ( PCB_SHAPE aArc,
VECTOR2I  aStart,
VECTOR2I  aEnd,
const VECTOR2I  aCursor 
) const
private

Move the mid point of the arc, while keeping the two endpoints.

Definition at line 996 of file pcb_point_editor.cpp.

998 {
999  // Let 'm' be the middle point of the chord between the start and end points
1000  VECTOR2I m = ( aStart + aEnd ) / 2;
1001 
1002  // Legal midpoints lie on a vector starting just off the chord midpoint and extending out
1003  // past the existing midpoint. We do not allow arc inflection while point editing.
1004  const int JUST_OFF = ( aStart - aEnd ).EuclideanNorm() / 100;
1005  VECTOR2I v = (VECTOR2I) aArc->GetArcMid() - m;
1006  SEG legal( m + v.Resize( JUST_OFF ), m + v.Resize( INT_MAX / 2 ) );
1007  VECTOR2I mid = legal.NearestPoint( aCursor );
1008 
1009  aArc->SetArcGeometry( (wxPoint) aStart, (wxPoint) mid, (wxPoint) aEnd );
1010 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:148
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void SetArcGeometry(const wxPoint &aStart, const wxPoint &aMid, const wxPoint &aEnd)
Set the three controlling points for an arc.
Definition: pcb_shape.cpp:443
Definition: seg.h:41
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:404
wxPoint GetArcMid() const
Definition: pcb_shape.cpp:392

References EuclideanNorm(), PCB_SHAPE::GetArcMid(), VECTOR2< T >::Resize(), and PCB_SHAPE::SetArcGeometry().

Referenced by updateItem().

◆ finishItem()

void PCB_POINT_EDITOR::finishItem ( )
private

Definition at line 1512 of file pcb_point_editor.cpp.

1513 {
1514  auto item = m_editPoints->GetParent();
1515 
1516  if( !item )
1517  return;
1518 
1519  // TODO Refill edited zones when KiCad supports auto re-fill
1520 }
std::shared_ptr< EDIT_POINTS > m_editPoints

References m_editPoints.

Referenced by OnSelectionChange().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 155 of file pcb_tool_base.h.

156  {
157  return getEditFrame<PCB_BASE_EDIT_FRAME>();
158  }

Referenced by addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), ROUTER_TOOL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), OnSelectionChange(), PCB_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), removeCorner(), PCB_SELECTION_TOOL::RequestSelection(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ get45DegConstrainer()

EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer ( ) const
private

Condition to display "Create corner" context menu entry.

Definition at line 1832 of file pcb_point_editor.cpp.

1833 {
1834  EDA_ITEM* item = m_editPoints->GetParent();
1835 
1836  switch( item->Type() )
1837  {
1838  case PCB_SHAPE_T:
1839  case PCB_FP_SHAPE_T:
1840  switch( static_cast<const PCB_SHAPE*>( item )->GetShape() )
1841  {
1842  case S_SEGMENT:
1843  return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
1844 
1845  case S_ARC:
1846  case S_CIRCLE:
1847  return m_editPoints->Point( CIRC_CENTER );
1848 
1849  default: // suppress warnings
1850  break;
1851  }
1852 
1853  break;
1854 
1855  case PCB_DIM_ALIGNED_T:
1856  {
1857  // Constraint for crossbar
1858  if( isModified( m_editPoints->Point( DIM_START ) ) )
1859  return m_editPoints->Point( DIM_END );
1860 
1861  else if( isModified( m_editPoints->Point( DIM_END ) ) )
1862  return m_editPoints->Point( DIM_START );
1863 
1864  else
1865  return EDIT_POINT( m_editedPoint->GetPosition() ); // no constraint
1866 
1867  break;
1868  }
1869 
1870  case PCB_DIM_CENTER_T:
1871  {
1872  if( isModified( m_editPoints->Point( DIM_END ) ) )
1873  return m_editPoints->Point( DIM_START );
1874 
1875  break;
1876  }
1877 
1878  default:
1879  break;
1880  }
1881 
1882  // In any other case we may align item to its original position
1883  return m_original;
1884 }
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
usual segment : line with rounded ends
Definition: board_item.h:50
Arcs (with rounded ends)
Definition: board_item.h:52
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
std::shared_ptr< EDIT_POINTS > m_editPoints
EDIT_POINT * m_editedPoint
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
EDIT_POINT m_original
Original position for the current drag point.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
bool isModified(const EDIT_POINT &aPoint) const
Set up an alternative constraint (typically enabled upon a modifier key being pressed).
ring
Definition: board_item.h:53
Represent a single point that can be used for modifying items.
Definition: edit_points.h:47
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References CIRC_CENTER, DIM_END, DIM_START, EDIT_POINT::GetPosition(), isModified(), m_editedPoint, m_editPoints, m_original, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_FP_SHAPE_T, PCB_SHAPE_T, S_ARC, S_CIRCLE, S_SEGMENT, and EDA_ITEM::Type().

Referenced by setAltConstraint().

◆ getEditedPointIndex()

int PCB_POINT_EDITOR::getEditedPointIndex ( ) const
inlineprivate

Return true if aPoint is the currently modified point.

Definition at line 97 of file pcb_point_editor.h.

References m_editedPoint, and m_editPoints.

Referenced by updateItem().

◆ 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().

◆ 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(), 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(), updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), 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(), 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(), 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(), 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(), setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), updateEditedPoint(), 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(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), 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().

◆ HasPoint()

bool PCB_POINT_EDITOR::HasPoint ( )
inline

Indicate the cursor is over an edit point.

Used to coordinate cursor shapes with other tools.

Definition at line 64 of file pcb_point_editor.h.

64 { return m_editedPoint != nullptr; }
EDIT_POINT * m_editedPoint

References m_editedPoint.

◆ Init()

bool PCB_POINT_EDITOR::Init ( void  )
overridevirtual

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

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

Reimplemented from PCB_TOOL_BASE.

Definition at line 117 of file pcb_point_editor.cpp.

118 {
119  // Find the selection tool, so they can cooperate
121 
122  wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" );
123 
124  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
127  std::bind( &PCB_POINT_EDITOR::removeCornerCondition, this, _1 ) );
128 
129  return true;
130 }
bool removeCornerCondition(const SELECTION &aSelection)
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_MENU & GetToolMenu()
PCB_SELECTION_TOOL * m_selectionTool
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:215
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:218
The selection tool: currently supports:
static bool addCornerCondition(const SELECTION &aSelection)
Determine if the tool can currently add a corner to the given item.
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 addCornerCondition(), CONDITIONAL_MENU::AddItem(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), m_selectionTool, TOOL_BASE::m_toolMgr, PCB_ACTIONS::pointEditorAddCorner, PCB_ACTIONS::pointEditorRemoveCorner, and removeCornerCondition().

◆ IsFootprintEditor()

◆ isModified()

bool PCB_POINT_EDITOR::isModified ( const EDIT_POINT aPoint) const
inlineprivate

Set up an alternative constraint (typically enabled upon a modifier key being pressed).

Definition at line 109 of file pcb_point_editor.h.

References m_editedPoint.

Referenced by get45DegConstrainer(), and updateItem().

◆ 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().

◆ makePoints()

std::shared_ptr< EDIT_POINTS > PCB_POINT_EDITOR::makePoints ( EDA_ITEM aItem)
private

Update item's points with edit points.

Definition at line 167 of file pcb_point_editor.cpp.

168 {
169  std::shared_ptr<EDIT_POINTS> points = std::make_shared<EDIT_POINTS>( aItem );
170 
171  if( !aItem )
172  return points;
173 
174  // Generate list of edit points basing on the item type
175  switch( aItem->Type() )
176  {
177  case PCB_SHAPE_T:
178  case PCB_FP_SHAPE_T:
179  {
180  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
181 
182  switch( shape->GetShape() )
183  {
184  case S_SEGMENT:
185  points->AddPoint( shape->GetStart() );
186  points->AddPoint( shape->GetEnd() );
187  break;
188 
189  case S_RECT:
190  points->AddPoint( shape->GetStart() );
191  points->AddPoint( wxPoint( shape->GetEnd().x, shape->GetStart().y ) );
192  points->AddPoint( shape->GetEnd() );
193  points->AddPoint( wxPoint( shape->GetStart().x, shape->GetEnd().y ) );
194 
195  points->AddLine( points->Point( RECT_TOP_LEFT ), points->Point( RECT_TOP_RIGHT ) );
196  points->Line( RECT_TOP ).SetConstraint( new EC_PERPLINE( points->Line( RECT_TOP ) ) );
197  points->AddLine( points->Point( RECT_TOP_RIGHT ), points->Point( RECT_BOT_RIGHT ) );
198  points->Line( RECT_RIGHT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_RIGHT ) ) );
199  points->AddLine( points->Point( RECT_BOT_RIGHT ), points->Point( RECT_BOT_LEFT ) );
200  points->Line( RECT_BOT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_BOT ) ) );
201  points->AddLine( points->Point( RECT_BOT_LEFT ), points->Point( RECT_TOP_LEFT ) );
202  points->Line( RECT_LEFT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_LEFT ) ) );
203 
204  break;
205 
206  case S_ARC:
207  points->AddPoint( shape->GetCenter() );
208  points->AddPoint( shape->GetArcStart() );
209  points->AddPoint( shape->GetArcMid() );
210  points->AddPoint( shape->GetArcEnd() );
211 
212  points->Point( ARC_MID ).SetGridConstraint( IGNORE_GRID );
213  points->Point( ARC_START ).SetGridConstraint( SNAP_TO_GRID );
214  points->Point( ARC_CENTER ).SetGridConstraint( SNAP_BY_GRID );
215  points->Point( ARC_END ).SetGridConstraint( SNAP_TO_GRID );
216  break;
217 
218  case S_CIRCLE:
219  points->AddPoint( shape->GetCenter() );
220  points->AddPoint( shape->GetEnd() );
221  break;
222 
223  case S_POLYGON:
224  buildForPolyOutline( points, &shape->GetPolyShape() );
225  break;
226 
227  case S_CURVE:
228  points->AddPoint( shape->GetStart() );
229  points->AddPoint( shape->GetBezControl1() );
230  points->AddPoint( shape->GetBezControl2() );
231  points->AddPoint( shape->GetEnd() );
232  break;
233 
234  default: // suppress warnings
235  break;
236  }
237 
238  break;
239  }
240 
241  case PCB_PAD_T:
242  {
243  const PAD* pad = static_cast<const PAD*>( aItem );
244  wxPoint shapePos = pad->ShapePos();
245  wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
246 
247  if( !m_isFootprintEditor || pad->IsLocked() )
248  break;
249 
250  switch( pad->GetShape() )
251  {
252  case PAD_SHAPE_CIRCLE:
253  points->AddPoint( shapePos );
254  points->AddPoint( wxPoint( shapePos.x + halfSize.x, shapePos.y ) );
255  break;
256 
257  case PAD_SHAPE_OVAL:
258  case PAD_SHAPE_TRAPEZOID:
259  case PAD_SHAPE_RECT:
260  case PAD_SHAPE_ROUNDRECT:
262  {
263  if( (int) pad->GetOrientation() % 900 != 0 )
264  break;
265 
266  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
267  std::swap( halfSize.x, halfSize.y );
268 
269  points->AddPoint( shapePos - halfSize );
270  points->AddPoint( wxPoint( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
271  points->AddPoint( shapePos + halfSize );
272  points->AddPoint( wxPoint( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
273  }
274  break;
275 
276  default: // suppress warnings
277  break;
278  }
279  }
280  break;
281 
282  case PCB_FP_ZONE_T:
283  case PCB_ZONE_T:
284  {
285  const ZONE* zone = static_cast<const ZONE*>( aItem );
286  buildForPolyOutline( points, zone->Outline() );
287  }
288  break;
289 
290  case PCB_DIM_ALIGNED_T:
292  {
293  const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( aItem );
294 
295  points->AddPoint( dimension->GetStart() );
296  points->AddPoint( dimension->GetEnd() );
297  points->AddPoint( dimension->Text().GetPosition() );
298  points->AddPoint( dimension->GetCrossbarStart() );
299  points->AddPoint( dimension->GetCrossbarEnd() );
300 
301  if( aItem->Type() == PCB_DIM_ALIGNED_T )
302  {
303  // Dimension height setting - edit points should move only along the feature lines
304  points->Point( DIM_CROSSBARSTART )
305  .SetConstraint( new EC_LINE( points->Point( DIM_CROSSBARSTART ),
306  points->Point( DIM_START ) ) );
307  points->Point( DIM_CROSSBAREND )
308  .SetConstraint( new EC_LINE( points->Point( DIM_CROSSBAREND ),
309  points->Point( DIM_END ) ) );
310  }
311 
312  break;
313  }
314 
315  case PCB_DIM_CENTER_T:
316  {
317  const CENTER_DIMENSION* dimension = static_cast<const CENTER_DIMENSION*>( aItem );
318 
319  points->AddPoint( dimension->GetStart() );
320  points->AddPoint( dimension->GetEnd() );
321 
322  points->Point( DIM_END ).SetConstraint( new EC_45DEGREE( points->Point( DIM_END ),
323  points->Point( DIM_START ) ) );
324 
325  break;
326  }
327 
328  case PCB_DIM_LEADER_T:
329  {
330  const LEADER* dimension = static_cast<const LEADER*>( aItem );
331 
332  points->AddPoint( dimension->GetStart() );
333  points->AddPoint( dimension->GetEnd() );
334  points->AddPoint( dimension->Text().GetPosition() );
335 
336  break;
337  }
338 
339  default:
340  points.reset();
341  break;
342  }
343 
344  return points;
345 }
wxPoint GetArcEnd() const
Definition: pcb_shape.cpp:374
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
void buildForPolyOutline(std::shared_ptr< EDIT_POINTS > points, const SHAPE_POLY_SET *aOutline)
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
Definition: dimension.h:121
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
EDIT_CONSTRAINT for a EDIT_LINE, that constrains the line to move perpendicular to the line itself.
usual segment : line with rounded ends
Definition: board_item.h:50
Arcs (with rounded ends)
Definition: board_item.h:52
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
segment with non rounded ends
Definition: board_item.h:51
const wxPoint & GetCrossbarStart() const
Definition: dimension.h:363
EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a line (determined by 2 points).
EDIT_CONSTRAINT that imposes a constraint that two points have to be located at angle of 45 degree mu...
const wxPoint & GetCrossbarEnd() const
Definition: dimension.h:365
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
virtual wxPoint GetPosition() const override
Definition: pcb_text.h:72
A leader is a dimension-like object pointing to a specific point.
Definition: dimension.h:478
PCB_TEXT & Text()
Definition: dimension.h:209
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
bool m_isFootprintEditor
const wxPoint & GetBezControl2() const
Definition: pcb_shape.h:136
class ZONE, managed by a footprint
Definition: typeinfo.h:94
ring
Definition: board_item.h:53
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
wxPoint GetArcMid() const
Definition: pcb_shape.cpp:392
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
Definition: pad.h:60
For better understanding of the points that make a dimension:
Definition: dimension.h:334
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Bezier Curve.
Definition: board_item.h:55
virtual const wxPoint & GetEnd() const
Definition: dimension.h:124
const wxPoint & GetBezControl1() const
Definition: pcb_shape.h:133
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
Marks the center of a circle or arc with a cross shape The size and orientation of the cross is adjus...
Definition: dimension.h:517

References ARC_CENTER, ARC_END, ARC_MID, ARC_START, buildForPolyOutline(), DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_START, PCB_SHAPE::GetArcEnd(), PCB_SHAPE::GetArcMid(), PCB_SHAPE::GetArcStart(), PCB_SHAPE::GetBezControl1(), PCB_SHAPE::GetBezControl2(), PCB_SHAPE::GetCenter(), ALIGNED_DIMENSION::GetCrossbarEnd(), ALIGNED_DIMENSION::GetCrossbarStart(), DIMENSION_BASE::GetEnd(), PCB_SHAPE::GetEnd(), PCB_SHAPE::GetPolyShape(), PCB_TEXT::GetPosition(), PCB_SHAPE::GetShape(), DIMENSION_BASE::GetStart(), PCB_SHAPE::GetStart(), IGNORE_GRID, PCB_TOOL_BASE::m_isFootprintEditor, ZONE::Outline(), pad, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_ZONE_T, RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SNAP_BY_GRID, SNAP_TO_GRID, DIMENSION_BASE::Text(), and EDA_ITEM::Type().

Referenced by OnSelectionChange(), and updatePoints().

◆ modifiedSelection()

int PCB_POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 2192 of file pcb_point_editor.cpp.

2193 {
2194  updatePoints();
2195  return 0;
2196 }
void updatePoints()
Update which point is being edited.

References updatePoints().

Referenced by setTransitions().

◆ OnSelectionChange()

int PCB_POINT_EDITOR::OnSelectionChange ( const TOOL_EVENT aEvent)

Change selection event handler.

Definition at line 389 of file pcb_point_editor.cpp.

390 {
392  return 0;
393 
395 
396  if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
397  return 0;
398 
399  Activate();
400 
402  KIGFX::VIEW* view = getView();
403  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
404 
405  controls->ShowCursor( true );
406 
408  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
409 
410  if( !item )
411  return 0;
412 
413  m_editPoints = makePoints( item );
414 
415  if( !m_editPoints )
416  return 0;
417 
418  view->Add( m_editPoints.get() );
419  setEditedPoint( nullptr );
420  updateEditedPoint( aEvent );
421  m_refill = false;
422  bool inDrag = false;
423 
424  BOARD_COMMIT commit( editFrame );
425  LSET snapLayers = item->GetLayerSet();
426 
427  if( BaseType( item->Type() ) == PCB_DIMENSION_T )
428  snapLayers = LSET::AllLayersMask();
429 
430  // Main loop: keep receiving events
431  while( TOOL_EVENT* evt = Wait() )
432  {
433  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
434  grid.SetUseGrid( view->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
435 
436  if( !m_editPoints || evt->IsSelectionEvent() ||
437  evt->Matches( EVENTS::InhibitSelectionEditing ) )
438  {
439  break;
440  }
441 
442  EDIT_POINT* prevHover = m_hoveredPoint;
443 
444  if( !inDrag )
445  updateEditedPoint( *evt );
446 
447  if( prevHover != m_hoveredPoint )
448  getView()->Update( m_editPoints.get() );
449 
450  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
451  {
452  if( !inDrag )
453  {
454  frame()->UndoRedoBlock( true );
455 
456  commit.StageItems( selection, CHT_MODIFY );
457 
458  controls->ForceCursorPosition( false );
459  m_original = *m_editedPoint; // Save the original position
460  controls->SetAutoPan( true );
461  inDrag = true;
462 
464  grid.SetAuxAxes( true, m_original.GetPosition() );
465 
466  setAltConstraint( true );
468  }
469 
470  VECTOR2I pos = evt->Position();
471 
472  //TODO: unify the constraints to solve simultaneously instead of sequentially
473  switch( m_editedPoint->GetGridConstraint() )
474  {
475  case IGNORE_GRID:
476  m_editedPoint->SetPosition( pos );
477  break;
478 
479  case SNAP_TO_GRID:
480  m_editedPoint->SetPosition( grid.BestSnapAnchor( pos, snapLayers, { item } ) );
481  break;
482 
483  case SNAP_BY_GRID:
484  {
485  if( grid.GetUseGrid() )
486  {
487  VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } );
488 
490  VECTOR2I delta = pos - last;
491  VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {}, { item } );
492 
493  if( abs( delta.x ) > grid.GetGrid().x / 2 )
494  pos.x = last.x + deltaGrid.x;
495  else
496  pos.x = last.x;
497 
498  if( abs( delta.y ) > grid.GetGrid().y / 2 )
499  pos.y = last.y + deltaGrid.y;
500  else
501  pos.y = last.y;
502  }
503 
504  m_editedPoint->SetPosition( pos );
505  }
506  break;
507  }
508 
509  // The alternative constraint limits to 45 degrees
510  bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
511 
512  if( enableAltConstraint )
513  m_altConstraint->Apply();
514  else
516 
518  m_editedPoint->SetPosition( grid.BestSnapAnchor( pos, snapLayers, { item } ) );
519 
520  updateItem();
522  updatePoints();
523  }
524  else if( m_editedPoint && evt->Action() == TA_MOUSE_DOWN && evt->Buttons() == BUT_LEFT )
525  {
527  getView()->Update( m_editPoints.get() );
528  }
529  else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
530  {
531  if( m_editedPoint )
532  {
533  m_editedPoint->SetActive( false );
534  getView()->Update( m_editPoints.get() );
535  }
536 
537  controls->SetAutoPan( false );
538  setAltConstraint( false );
539 
540  commit.Push( _( "Drag a corner" ) );
541  inDrag = false;
542  frame()->UndoRedoBlock( false );
543 
544  m_refill = true;
545  }
546 
547  else if( evt->IsCancelInteractive() || evt->IsActivate() )
548  {
549  if( inDrag ) // Restore the last change
550  {
551  commit.Revert();
552  inDrag = false;
553  frame()->UndoRedoBlock( false );
554  }
555  else if( evt->IsCancelInteractive() )
556  {
557  break;
558  }
559 
560  if( evt->IsActivate() && !evt->IsMoveTool() )
561  break;
562  }
563 
564  else if( evt->Action() == TA_UNDO_REDO_POST )
565  {
566  break;
567  }
568 
569  else
570  {
571  evt->SetPassEvent();
572  }
573  }
574 
575  if( m_editPoints )
576  {
577  view->Remove( m_editPoints.get() );
578 
579  finishItem();
580  m_editPoints.reset();
581  }
582 
583  frame()->UpdateMsgPanel();
584 
585  return 0;
586 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void updatePoints()
Update which point is being edited.
void updateEditedPoint(const TOOL_EVENT &aEvent)
Set the current point being edited. NULL means none.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
void setEditedPoint(EDIT_POINT *aPoint)
constexpr KICAD_T BaseType(const KICAD_T aType)
Returns the underlying type of the given type.
Definition: typeinfo.h:235
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:189
void UndoRedoBlock(bool aBlock=true)
Enable/disable undo and redo operations.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
std::shared_ptr< EDIT_POINTS > m_editPoints
GRID_CONSTRAINT_TYPE GetGridConstraint() const
Definition: edit_points.h:177
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
EDIT_POINT * m_editedPoint
std::shared_ptr< EDIT_POINTS > makePoints(EDA_ITEM *aItem)
Update item's points with edit points.
PCB_BASE_EDIT_FRAME * frame() const
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
bool GetGridSnapping() const
void SetActive(bool aActive=true)
Definition: edit_points.h:172
LSET is a set of PCB_LAYER_IDs.
const PCB_SELECTION & selection() const
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
PCB_SELECTION_TOOL * m_selectionTool
STATUS_FLAGS GetEditFlags() const
Definition: eda_item.h:208
void setAltConstraint(bool aEnabled)
Return a point that should be used as a constrainer for 45 degrees mode.
Generic, UI-independent tool event.
Definition: tool_event.h:173
KIGFX::PCB_VIEW * view() const
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
static LSET AllLayersMask()
Definition: lset.cpp:787
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:373
class DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:99
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
EDIT_POINT m_original
Original position for the current drag point.
KIGFX::VIEW_CONTROLS * controls() const
Common, abstract interface for edit frames.
#define _(s)
Definition: 3d_actions.cpp:33
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
static const TOOL_EVENT InhibitSelectionEditing
Definition: actions.h:212
void Activate()
Run the tool.
EDIT_POINT * m_hoveredPoint
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
Represent a single point that can be used for modifying items.
Definition: edit_points.h:47
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
void updateItem() const
Apply the last changes to the edited item.
virtual void ApplyConstraint()
Correct coordinates of an EDIT_POINT by applying previously set constraint.
Definition: edit_points.h:165
EDA_ITEM * Front() const
Definition: selection.h:203
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503
virtual void UpdateMsgPanel()
Redraw the message panel.
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
Definition: edit_points.h:106

References _, TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), LSET::AllLayersMask(), EDIT_POINT::ApplyConstraint(), BaseType(), BUT_LEFT, CHT_MODIFY, PCB_TOOL_BASE::controls(), finishItem(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), SELECTION::Front(), EDA_ITEM::GetEditFlags(), KIGFX::VIEW::GetGAL(), EDIT_POINT::GetGridConstraint(), KIGFX::GAL::GetGridSnapping(), PCB_BASE_FRAME::GetMagneticItemsSettings(), EDIT_POINT::GetPosition(), PCB_SELECTION_TOOL::GetSelection(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, IGNORE_GRID, EVENTS::InhibitSelectionEditing, m_altConstraint, m_editedPoint, m_editPoints, m_hoveredPoint, m_original, m_refill, m_selectionTool, TOOL_BASE::m_toolMgr, makePoints(), TOOL_EVENT::Matches(), MD_ALT, MD_CTRL, MD_SHIFT, PCB_DIMENSION_T, BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), BOARD_COMMIT::Revert(), PCB_TOOL_BASE::selection(), EDIT_POINT::SetActive(), setAltConstraint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), setEditedPoint(), EDIT_POINT::SetPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), SNAP_BY_GRID, SNAP_TO_GRID, COMMIT::StageItems(), TA_MOUSE_DOWN, TA_UNDO_REDO_POST, PCB_BASE_EDIT_FRAME::UndoRedoBlock(), KIGFX::VIEW::Update(), updateEditedPoint(), updateItem(), EDA_DRAW_FRAME::UpdateMsgPanel(), updatePoints(), PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ removeCorner()

int PCB_POINT_EDITOR::removeCorner ( const TOOL_EVENT aEvent)
private

Definition at line 2116 of file pcb_point_editor.cpp.

2117 {
2118  if( !m_editPoints || !m_editedPoint )
2119  return 0;
2120 
2121  EDA_ITEM* item = m_editPoints->GetParent();
2122 
2123  if( !item )
2124  return 0;
2125 
2126  SHAPE_POLY_SET* polygon = nullptr;
2127 
2128  if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2129  {
2130  ZONE* zone = static_cast<ZONE*>( item );
2131  polygon = zone->Outline();
2132  zone->SetNeedRefill( true );
2133  }
2134  else if( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T )
2135  {
2136  PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
2137 
2138  if( shape->GetShape() == S_POLYGON )
2139  polygon = &shape->GetPolyShape();
2140  }
2141 
2142  if( !polygon )
2143  return 0;
2144 
2145  PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
2146  BOARD_COMMIT commit( frame );
2147  auto vertex = findVertex( *polygon, *m_editedPoint );
2148 
2149  if( vertex.first )
2150  {
2151  const auto& vertexIdx = vertex.second;
2152  auto& outline = polygon->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
2153 
2154  if( outline.PointCount() > 3 )
2155  {
2156  // the usual case: remove just the corner when there are >3 vertices
2157  commit.Modify( item );
2158  polygon->RemoveVertex( vertexIdx );
2159  validatePolygon( *polygon );
2160  }
2161  else
2162  {
2163  // either remove a hole or the polygon when there are <= 3 corners
2164  if( vertexIdx.m_contour > 0 )
2165  {
2166  // remove hole
2167  commit.Modify( item );
2168  polygon->RemoveContour( vertexIdx.m_contour );
2169  }
2170  else
2171  {
2173  commit.Remove( item );
2174  }
2175  }
2176 
2177  setEditedPoint( nullptr );
2178 
2179  commit.Push( _( "Remove a zone/polygon corner" ) );
2180 
2181  // Refresh zone hatching
2182  if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2183  static_cast<ZONE*>( item )->HatchBorder();
2184 
2185  updatePoints();
2186  }
2187 
2188  return 0;
2189 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:63
void updatePoints()
Update which point is being edited.
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
void setEditedPoint(EDIT_POINT *aPoint)
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)
std::shared_ptr< EDIT_POINTS > m_editPoints
EDIT_POINT * m_editedPoint
PCB_BASE_EDIT_FRAME * frame() const
Represent a set of closed polygons.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
#define _(s)
Definition: 3d_actions.cpp:33
void RemoveVertex(int aGlobalIndex)
Delete the aGlobalIndex-th vertex.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:235
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
POLYGON & Polygon(int aIndex)
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validate a polygon and displays a popup warning if invalid.
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.

References _, findVertex(), PCB_TOOL_BASE::frame(), PCB_SHAPE::GetPolyShape(), PCB_SHAPE::GetShape(), m_editedPoint, m_editPoints, TOOL_BASE::m_toolMgr, COMMIT::Modify(), ZONE::Outline(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, SHAPE_POLY_SET::Polygon(), BOARD_COMMIT::Push(), COMMIT::Remove(), SHAPE_POLY_SET::RemoveContour(), SHAPE_POLY_SET::RemoveVertex(), TOOL_MANAGER::RunAction(), S_POLYGON, PCB_ACTIONS::selectionClear, setEditedPoint(), ZONE::SetNeedRefill(), EDA_ITEM::Type(), updatePoints(), and validatePolygon().

Referenced by setTransitions().

◆ removeCornerCondition()

bool PCB_POINT_EDITOR::removeCornerCondition ( const SELECTION aSelection)
private

Definition at line 1932 of file pcb_point_editor.cpp.

1933 {
1934  if( !m_editPoints || !m_editedPoint )
1935  return false;
1936 
1937  EDA_ITEM* item = m_editPoints->GetParent();
1938  SHAPE_POLY_SET* polyset = nullptr;
1939 
1940  if( !item )
1941  return false;
1942 
1943  switch( item->Type() )
1944  {
1945  case PCB_ZONE_T:
1946  case PCB_FP_ZONE_T:
1947  polyset = static_cast<ZONE*>( item )->Outline();
1948  break;
1949 
1950  case PCB_SHAPE_T:
1951  case PCB_FP_SHAPE_T:
1952  if( static_cast<PCB_SHAPE*>( item )->GetShape() == S_POLYGON )
1953  polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
1954  else
1955  return false;
1956 
1957  break;
1958 
1959  default:
1960  return false;
1961  }
1962 
1963  auto vertex = findVertex( *polyset, *m_editedPoint );
1964 
1965  if( !vertex.first )
1966  return false;
1967 
1968  const auto& vertexIdx = vertex.second;
1969 
1970  // Check if there are enough vertices so one can be removed without
1971  // degenerating the polygon.
1972  // The first condition allows one to remove all corners from holes (when
1973  // there are only 2 vertices left, a hole is removed).
1974  if( vertexIdx.m_contour == 0 && polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 )
1975  return false;
1976 
1977  // Remove corner does not work with lines
1978  if( dynamic_cast<EDIT_LINE*>( m_editedPoint ) )
1979  return false;
1980 
1981  return m_editedPoint != NULL;
1982 }
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)
std::shared_ptr< EDIT_POINTS > m_editPoints
EDIT_POINT * m_editedPoint
#define NULL
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
class ZONE, a copper pour area
Definition: typeinfo.h:105
class ZONE, managed by a footprint
Definition: typeinfo.h:94
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
POLYGON & Polygon(int aIndex)
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References findVertex(), m_editedPoint, m_editPoints, NULL, SHAPE_POLY_SET::Outline(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, SHAPE_POLY_SET::Polygon(), S_POLYGON, and EDA_ITEM::Type().

Referenced by Init().

◆ Reset()

void PCB_POINT_EDITOR::Reset ( RESET_REASON  aReason)
overridevirtual

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.

Reimplemented from PCB_TOOL_BASE.

Definition at line 104 of file pcb_point_editor.cpp.

105 {
106  m_refill = false;
107  m_editPoints.reset();
108  m_altConstraint.reset();
109  getViewControls()->SetAutoPan( false );
110 
111  m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
112  m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
113  m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
114 }
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
std::shared_ptr< EDIT_POINTS > m_editPoints
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
#define _(s)
Definition: 3d_actions.cpp:33
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

References _, TOOL_BASE::getViewControls(), m_altConstraint, m_editPoints, m_refill, m_statusPopup, and KIGFX::VIEW_CONTROLS::SetAutoPan().

◆ 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().

◆ selection() [1/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 301 of file pcb_tool_base.cpp.

302 {
304 
305  return selTool->GetSelection();
306 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

References PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), GROUP_TOOL::EnterGroup(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), OnSelectionChange(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), GROUP_TOOL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), GROUP_TOOL::Ungroup(), PCB_CONTROL::UpdateMessagePanel(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 309 of file pcb_tool_base.cpp.

310 {
312 
313  return selTool->GetSelection();
314 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

References PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), and TOOL_BASE::m_toolMgr.

◆ setAltConstraint()

void PCB_POINT_EDITOR::setAltConstraint ( bool  aEnabled)
private

Return a point that should be used as a constrainer for 45 degrees mode.

Definition at line 1789 of file pcb_point_editor.cpp.

1790 {
1791  if( aEnabled )
1792  {
1793  EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
1794  bool isPoly;
1795 
1796  switch( m_editPoints->GetParent()->Type() )
1797  {
1798  case PCB_ZONE_T:
1799  case PCB_FP_ZONE_T:
1800  isPoly = true;
1801  break;
1802 
1803  case PCB_SHAPE_T:
1804  case PCB_FP_SHAPE_T:
1805  isPoly = static_cast<PCB_SHAPE*>( m_editPoints->GetParent() )->GetShape() == S_POLYGON;
1806  break;
1807 
1808  default:
1809  isPoly = false;
1810  break;
1811  }
1812 
1813  if( line && isPoly )
1814  {
1815  EC_CONVERGING* altConstraint = new EC_CONVERGING( *line, *m_editPoints );
1816  m_altConstraint.reset( (EDIT_CONSTRAINT<EDIT_POINT>*) altConstraint );
1817  }
1818  else
1819  {
1820  // Find a proper constraining point for 45 degrees mode
1823  }
1824  }
1825  else
1826  {
1827  m_altConstraint.reset();
1828  }
1829 }
EDIT_CONSTRAINT for 3 segments: dragged and two adjacent ones, enforcing to keep their slopes and all...
EDIT_POINT get45DegConstrainer() const
Condition to display "Create corner" context menu entry.
Represent a line connecting two EDIT_POINTs.
Definition: edit_points.h:215
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
std::shared_ptr< EDIT_POINTS > m_editPoints
EDIT_CONSTRAINT that imposes a constraint that two points have to be located at angle of 45 degree mu...
EDIT_POINT * m_editedPoint
EDIT_POINT m_altConstrainer
class ZONE, a copper pour area
Definition: typeinfo.h:105
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
class ZONE, managed by a footprint
Definition: typeinfo.h:94
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90

References get45DegConstrainer(), m_altConstrainer, m_altConstraint, m_editedPoint, m_editPoints, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, and S_POLYGON.

Referenced by OnSelectionChange().

◆ 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().

◆ setEditedPoint()

void PCB_POINT_EDITOR::setEditedPoint ( EDIT_POINT aPoint)
private

Definition at line 1767 of file pcb_point_editor.cpp.

1768 {
1770 
1771  if( aPoint )
1772  {
1774  controls->ForceCursorPosition( true, aPoint->GetPosition() );
1775  controls->ShowCursor( true );
1776  }
1777  else
1778  {
1779  if( frame()->ToolStackIsEmpty() )
1780  controls->ShowCursor( false );
1781 
1782  controls->ForceCursorPosition( false );
1783  }
1784 
1785  m_editedPoint = aPoint;
1786 }
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EDIT_POINT * m_editedPoint
PCB_BASE_EDIT_FRAME * frame() const
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
KIGFX::VIEW_CONTROLS * controls() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

References ARROW, PCB_TOOL_BASE::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), EDIT_POINT::GetPosition(), TOOL_BASE::getViewControls(), m_editedPoint, EDA_DRAW_PANEL_GAL::SetCurrentCursor(), and KIGFX::VIEW_CONTROLS::ShowCursor().

Referenced by OnSelectionChange(), removeCorner(), and updateEditedPoint().

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

Toggles edit footprint mode. When enabled, one may select parts of footprints individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 104 of file pcb_tool_base.h.

104 { m_isFootprintEditor = aEnabled; }
bool m_isFootprintEditor

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void PCB_POINT_EDITOR::setTransitions ( )
overrideprivatevirtual

< Set up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 2204 of file pcb_point_editor.cpp.

2205 {
2215 }
int removeCorner(const TOOL_EVENT &aEvent)
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
static TOOL_ACTION activatePointEditor
Definition: actions.h:171
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
int addCorner(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.
static TOOL_ACTION changeEditMethod
Definition: actions.h:172
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).
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:206
int modifiedSelection(const TOOL_EVENT &aEvent)
int OnSelectionChange(const TOOL_EVENT &aEvent)
Change selection event handler.
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:215
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:218
int changeEditMethod(const TOOL_EVENT &aEvent)
static const TOOL_EVENT UninhibitSelectionEditing
Definition: actions.h:213
static const TOOL_EVENT InhibitSelectionEditing
Definition: actions.h:212

References ACTIONS::activatePointEditor, addCorner(), changeEditMethod(), ACTIONS::changeEditMethod, TOOL_INTERACTIVE::Go(), EVENTS::InhibitSelectionEditing, modifiedSelection(), OnSelectionChange(), PCB_ACTIONS::pointEditorAddCorner, PCB_ACTIONS::pointEditorRemoveCorner, removeCorner(), EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, EVENTS::UninhibitSelectionEditing, and EVENTS::UnselectedEvent.

◆ updateEditedPoint()

void PCB_POINT_EDITOR::updateEditedPoint ( const TOOL_EVENT aEvent)
private

Set the current point being edited. NULL means none.

Definition at line 348 of file pcb_point_editor.cpp.

349 {
350  EDIT_POINT* point;
351  EDIT_POINT* hovered = nullptr;
352 
353  if( aEvent.IsMotion() )
354  {
355  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
356  hovered = point;
357  }
358  else if( aEvent.IsDrag( BUT_LEFT ) )
359  {
360  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
361  }
362  else
363  {
364  point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
365  }
366 
367  if( hovered )
368  {
369  if( m_hoveredPoint != hovered )
370  {
371  if( m_hoveredPoint )
372  m_hoveredPoint->SetHover( false );
373 
374  m_hoveredPoint = hovered;
376  }
377  }
378  else if( m_hoveredPoint )
379  {
380  m_hoveredPoint->SetHover( false );
381  m_hoveredPoint = nullptr;
382  }
383 
384  if( m_editedPoint != point )
385  setEditedPoint( point );
386 }
void setEditedPoint(EDIT_POINT *aPoint)
bool IsMotion() const
Definition: tool_event.h:316
std::shared_ptr< EDIT_POINTS > m_editPoints
EDIT_POINT * m_editedPoint
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:306
const VECTOR2D DragOrigin() const
Returns information about mouse buttons state.
Definition: tool_event.h:290
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void SetHover(bool aHover=true)
Definition: edit_points.h:175
EDIT_POINT * m_hoveredPoint
Represent a single point that can be used for modifying items.
Definition: edit_points.h:47
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:284

References BUT_LEFT, TOOL_EVENT::DragOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVENT::IsDrag(), TOOL_EVENT::IsMotion(), m_editedPoint, m_editPoints, m_hoveredPoint, TOOL_EVENT::Position(), setEditedPoint(), and EDIT_POINT::SetHover().

Referenced by OnSelectionChange().

◆ updateItem()

void PCB_POINT_EDITOR::updateItem ( ) const
private

Apply the last changes to the edited item.

Definition at line 1013 of file pcb_point_editor.cpp.

1014 {
1015  EDA_ITEM* item = m_editPoints->GetParent();
1016 
1017  if( !item )
1018  return;
1019 
1020  switch( item->Type() )
1021  {
1022  case PCB_SHAPE_T:
1023  case PCB_FP_SHAPE_T:
1024  {
1025  PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
1026 
1027  switch( shape->GetShape() )
1028  {
1029  case S_SEGMENT:
1030  if( isModified( m_editPoints->Point( SEG_START ) ) )
1031  {
1032  shape->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x,
1033  m_editPoints->Point( SEG_START ).GetPosition().y ) );
1034  }
1035  else if( isModified( m_editPoints->Point( SEG_END ) ) )
1036  {
1037  shape->SetEnd( wxPoint( m_editPoints->Point( SEG_END ).GetPosition().x,
1038  m_editPoints->Point( SEG_END ).GetPosition().y ) );
1039  }
1040 
1041  break;
1042 
1043  case S_RECT:
1044  {
1045  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
1046  {
1047  shape->SetStart((wxPoint) m_editPoints->Point( RECT_TOP_LEFT ).GetPosition() );
1048  }
1049  else if( isModified( m_editPoints->Point( RECT_TOP_RIGHT ) ) )
1050  {
1051  shape->SetStartY( m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().y );
1052  shape->SetEndX( m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().x );
1053  }
1054  else if( isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
1055  {
1056  shape->SetEnd((wxPoint) m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition() );
1057  }
1058  else if( isModified( m_editPoints->Point( RECT_BOT_LEFT ) ) )
1059  {
1060  shape->SetStartX( m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().x );
1061  shape->SetEndY( m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().y );
1062  }
1063  else if( isModified( m_editPoints->Line( RECT_TOP ) ) )
1064  {
1065  shape->SetStartY( m_editPoints->Point( RECT_TOP_LEFT ).GetPosition().y );
1066  }
1067  else if( isModified( m_editPoints->Line( RECT_LEFT ) ) )
1068  {
1069  shape->SetStartX( m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().x );
1070  }
1071  else if( isModified( m_editPoints->Line( RECT_BOT ) ) )
1072  {
1073  shape->SetEndY( m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition().y );
1074  }
1075  else if( isModified( m_editPoints->Line( RECT_RIGHT ) ) )
1076  {
1077  shape->SetEndX( m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().x );
1078  }
1079 
1080  for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1081  {
1082  if( !isModified( m_editPoints->Line( i ) ) )
1083  m_editPoints->Line( i ).SetConstraint( new EC_PERPLINE( m_editPoints->Line( i ) ) );
1084  }
1085  }
1086  break;
1087 
1088  case S_ARC:
1089  {
1090  VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
1091  VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
1092  VECTOR2I start = m_editPoints->Point( ARC_START ).GetPosition();
1093  VECTOR2I end = m_editPoints->Point( ARC_END ).GetPosition();
1094 
1095  if( isModified( m_editPoints->Point( ARC_CENTER ) ) )
1096  {
1097  wxPoint moveVector = wxPoint( center.x, center.y ) - shape->GetCenter();
1098  shape->Move( moveVector );
1099  }
1100  else if( isModified( m_editPoints->Point( ARC_MID ) ) )
1101  {
1102  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition( false );
1103 
1104  if( m_altEditMethod )
1105  editArcMidKeepCenter( shape, center, start, mid, end, cursorPos );
1106  else
1107  editArcMidKeepEndpoints( shape, start, end, cursorPos );
1108  }
1109  else if( isModified( m_editPoints->Point( ARC_START ) )
1110  || isModified( m_editPoints->Point( ARC_END ) ) )
1111  {
1112  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
1113 
1114  if( m_altEditMethod )
1115  editArcEndpointKeepCenter( shape, center, start, mid, end, cursorPos );
1116  else
1117  editArcEndpointKeepTangent( shape, center, start, mid, end, cursorPos );
1118  }
1119  }
1120  break;
1121 
1122  case S_CIRCLE:
1123  {
1124  const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
1125  const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
1126 
1127  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
1128  {
1129  wxPoint moveVector = wxPoint( center.x, center.y ) - shape->GetCenter();
1130  shape->Move( moveVector );
1131  }
1132  else
1133  {
1134  shape->SetEnd( wxPoint( end.x, end.y ) );
1135  }
1136  }
1137  break;
1138 
1139  case S_POLYGON:
1140  {
1141  SHAPE_POLY_SET& outline = shape->GetPolyShape();
1142 
1143  for( int i = 0; i < outline.TotalVertices(); ++i )
1144  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
1145 
1146  for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1147  {
1148  if( !isModified( m_editPoints->Line( i ) ) )
1149  m_editPoints->Line( i ).SetConstraint( new EC_PERPLINE( m_editPoints->Line( i ) ) );
1150  }
1151 
1152  validatePolygon( outline );
1153  }
1154  break;
1155 
1156  case S_CURVE:
1157  if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
1158  shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() );
1159  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
1160  shape->SetBezControl1( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition() );
1161  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
1162  shape->SetBezControl2( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition() );
1163  else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
1164  shape->SetEnd( (wxPoint) m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() );
1165 
1166  shape->RebuildBezierToSegmentsPointsList( shape->GetWidth() );
1167  break;
1168 
1169  default: // suppress warnings
1170  break;
1171  }
1172 
1173  // Update relative coordinates for footprint shapes
1174  if( FP_SHAPE* fpShape = dyn_cast<FP_SHAPE*>( item ) )
1175  fpShape->SetLocalCoord();
1176 
1177  break;
1178  }
1179 
1180  case PCB_PAD_T:
1181  {
1182  PAD* pad = static_cast<PAD*>( item );
1183 
1184  switch( pad->GetShape() )
1185  {
1186  case PAD_SHAPE_CIRCLE:
1187  {
1188  wxPoint center = (wxPoint) m_editPoints->Point( CIRC_CENTER ).GetPosition();
1189  wxPoint end = (wxPoint) m_editPoints->Point( CIRC_END ).GetPosition();
1190 
1191  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
1192  {
1193  wxPoint moveVector = center - pad->ShapePos();
1194  pad->SetOffset( pad->GetOffset() + moveVector );
1195  }
1196  else
1197  {
1198  int diameter = (int) EuclideanNorm( end - center ) * 2;
1199  pad->SetSize( wxSize( diameter, diameter ) );
1200  }
1201  }
1202  break;
1203 
1204  case PAD_SHAPE_OVAL:
1205  case PAD_SHAPE_TRAPEZOID:
1206  case PAD_SHAPE_RECT:
1207  case PAD_SHAPE_ROUNDRECT:
1209  {
1210  VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition();
1211  VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
1212  VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition();
1213  VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition();
1214 
1215  pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight,
1216  botLeft, botRight,pad->GetPosition(), pad->GetDrillSize() );
1217 
1218  if( ( pad->GetOffset().x || pad->GetOffset().y )
1219  || ( pad->GetDrillSize().x && pad->GetDrillSize().y ) )
1220  {
1221  // Keep hole pinned at the current location; adjust the pad around the hole
1222 
1223  wxPoint center = pad->GetPosition();
1224  int dist[4];
1225 
1226  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
1227  || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
1228  {
1229  dist[0] = center.x - topLeft.x;
1230  dist[1] = center.y - topLeft.y;
1231  dist[2] = botRight.x - center.x;
1232  dist[3] = botRight.y - center.y;
1233  }
1234  else
1235  {
1236  dist[0] = center.x - botLeft.x;
1237  dist[1] = center.y - topRight.y;
1238  dist[2] = topRight.x - center.x;
1239  dist[3] = botLeft.y - center.y;
1240  }
1241 
1242  wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] );
1243  wxPoint deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] );
1244 
1245  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
1246  std::swap( padSize.x, padSize.y );
1247 
1248  RotatePoint( &deltaOffset, -pad->GetOrientation() );
1249 
1250  pad->SetSize( padSize );
1251  pad->SetOffset( -deltaOffset );
1252  }
1253  else
1254  {
1255  // Keep pad position at the center of the pad shape
1256 
1257  int left, top, right, bottom;
1258 
1259  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
1260  || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
1261  {
1262  left = topLeft.x;
1263  top = topLeft.y;
1264  right = botRight.x;
1265  bottom = botRight.y;
1266  }
1267  else
1268  {
1269  left = botLeft.x;
1270  top = topRight.y;
1271  right = topRight.x;
1272  bottom = botLeft.y;
1273  }
1274 
1275  wxSize padSize( abs( right - left ), abs( bottom - top ) );
1276 
1277  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
1278  std::swap( padSize.x, padSize.y );
1279 
1280  pad->SetSize( padSize );
1281  pad->SetPosition( wxPoint( ( left + right ) / 2, ( top + bottom ) / 2 ) );
1282  }
1283  }
1284  break;
1285 
1286  default: // suppress warnings
1287  break;
1288  }
1289  }
1290  break;
1291 
1292  case PCB_FP_ZONE_T:
1293  case PCB_ZONE_T:
1294  {
1295  ZONE* zone = static_cast<ZONE*>( item );
1296  zone->UnFill();
1297  SHAPE_POLY_SET& outline = *zone->Outline();
1298 
1299  for( int i = 0; i < outline.TotalVertices(); ++i )
1300  {
1301  if( outline.CVertex( i ) != m_editPoints->Point( i ).GetPosition() )
1302  zone->SetNeedRefill( true );
1303 
1304  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
1305  }
1306 
1307  for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1308  {
1309  if( !isModified( m_editPoints->Line( i ) ) )
1310  m_editPoints->Line( i ).SetConstraint( new EC_PERPLINE( m_editPoints->Line( i ) ) );
1311  }
1312 
1313  validatePolygon( outline );
1314  zone->HatchBorder();
1315  // TODO Refill zone when KiCad supports auto re-fill
1316  break;
1317  }
1318 
1319  case PCB_DIM_ALIGNED_T:
1320  {
1321  ALIGNED_DIMENSION* dimension = static_cast<ALIGNED_DIMENSION*>( item );
1322 
1323  // Check which point is currently modified and updated dimension's points respectively
1324  if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) )
1325  {
1326  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetStart() );
1327  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetStart() );
1328 
1329  if( featureLine.Cross( crossBar ) > 0 )
1330  dimension->SetHeight( -featureLine.EuclideanNorm() );
1331  else
1332  dimension->SetHeight( featureLine.EuclideanNorm() );
1333 
1334  dimension->Update();
1335  }
1336  else if( isModified( m_editPoints->Point( DIM_CROSSBAREND ) ) )
1337  {
1338  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
1339  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetStart() );
1340 
1341  if( featureLine.Cross( crossBar ) > 0 )
1342  dimension->SetHeight( -featureLine.EuclideanNorm() );
1343  else
1344  dimension->SetHeight( featureLine.EuclideanNorm() );
1345 
1346  dimension->Update();
1347  }
1348  else if( isModified( m_editPoints->Point( DIM_START ) ) )
1349  {
1350  dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
1351  m_editedPoint->GetPosition().y ) );
1352  dimension->Update();
1353 
1354  m_editPoints->Point( DIM_CROSSBARSTART ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
1355  m_editPoints->Point( DIM_START ) ) );
1356  m_editPoints->Point( DIM_CROSSBAREND ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
1357  m_editPoints->Point( DIM_END ) ) );
1358  }
1359  else if( isModified( m_editPoints->Point( DIM_END ) ) )
1360  {
1361  dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x,
1362  m_editedPoint->GetPosition().y ) );
1363  dimension->Update();
1364 
1365  m_editPoints->Point( DIM_CROSSBARSTART ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
1366  m_editPoints->Point( DIM_START ) ) );
1367  m_editPoints->Point( DIM_CROSSBAREND ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
1368  m_editPoints->Point( DIM_END ) ) );
1369  }
1370  else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
1371  {
1372  // Force manual mode if we weren't already in it
1374  dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
1375  dimension->Update();
1376  }
1377 
1378  break;
1379  }
1380 
1381  case PCB_DIM_ORTHOGONAL_T:
1382  {
1383  ORTHOGONAL_DIMENSION* dimension = static_cast<ORTHOGONAL_DIMENSION*>( item );
1384 
1385  if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) ||
1386  isModified( m_editPoints->Point( DIM_CROSSBAREND ) ) )
1387  {
1388  BOX2I bounds( dimension->GetStart(), dimension->GetEnd() - dimension->GetStart() );
1389 
1390  const VECTOR2I& cursorPos = m_editedPoint->GetPosition();
1391 
1392  // Find vector from nearest dimension point to edit position
1393  VECTOR2I directionA( cursorPos - dimension->GetStart() );
1394  VECTOR2I directionB( cursorPos - dimension->GetEnd() );
1395  VECTOR2I direction = ( directionA < directionB ) ? directionA : directionB;
1396 
1397  bool vert;
1398  VECTOR2D featureLine( cursorPos - dimension->GetStart() );
1399 
1400  // Only change the orientation when we move outside the bounds
1401  if( !bounds.Contains( cursorPos ) )
1402  {
1403  // If the dimension is horizontal or vertical, set correct orientation
1404  // otherwise, test if we're left/right of the bounding box or above/below it
1405  if( bounds.GetWidth() == 0 )
1406  {
1407  vert = true;
1408  }
1409  else if( bounds.GetHeight() == 0 )
1410  {
1411  vert = false;
1412  }
1413  else if( cursorPos.x > bounds.GetLeft() && cursorPos.x < bounds.GetRight() )
1414  {
1415  vert = false;
1416  }
1417  else if( cursorPos.y > bounds.GetTop() && cursorPos.y < bounds.GetBottom() )
1418  {
1419  vert = true;
1420  }
1421  else
1422  {
1423  vert = std::abs( direction.y ) < std::abs( direction.x );
1424  }
1427  }
1428  else
1429  {
1430  vert = dimension->GetOrientation() == ORTHOGONAL_DIMENSION::DIR::VERTICAL;
1431  }
1432 
1433  dimension->SetHeight( vert ? featureLine.x : featureLine.y );
1434  }
1435  else if( isModified( m_editPoints->Point( DIM_START ) ) )
1436  {
1437  dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
1438  m_editedPoint->GetPosition().y ) );
1439  }
1440  else if( isModified( m_editPoints->Point( DIM_END ) ) )
1441  {
1442  dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x,
1443  m_editedPoint->GetPosition().y ) );
1444  }
1445  else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
1446  {
1447  // Force manual mode if we weren't already in it
1449  dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
1450  }
1451 
1452  dimension->Update();
1453 
1454  break;
1455  }
1456 
1457  case PCB_DIM_CENTER_T:
1458  {
1459  CENTER_DIMENSION* dimension = static_cast<CENTER_DIMENSION*>( item );
1460 
1461  if( isModified( m_editPoints->Point( DIM_START ) ) )
1462  {
1463  dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
1464  m_editedPoint->GetPosition().y ) );
1465  }
1466  else if( isModified( m_editPoints->Point( DIM_END ) ) )
1467  {
1468  dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x,
1469  m_editedPoint->GetPosition().y ) );
1470  }
1471 
1472  dimension->Update();
1473 
1474  break;
1475  }
1476 
1477  case PCB_DIM_LEADER_T:
1478  {
1479  LEADER* dimension = static_cast<LEADER*>( item );
1480 
1481  if( isModified( m_editPoints->Point( DIM_START ) ) )
1482  {
1483  dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
1484  m_editedPoint->GetPosition().y ) );
1485  }
1486  else if( isModified( m_editPoints->Point( DIM_END ) ) )
1487  {
1488  wxPoint newPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y );
1489  wxPoint delta = newPoint - dimension->GetEnd();
1490 
1491  dimension->SetEnd( newPoint );
1492  dimension->Text().SetPosition( dimension->Text().GetPosition() + delta );
1493  }
1494  else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
1495  {
1496  dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
1497  }
1498 
1499  dimension->Update();
1500 
1501  break;
1502  }
1503 
1504  default:
1505  break;
1506  }
1507 
1508  getView()->Update( item );
1509 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:148
int TotalVertices() const
Delete aIdx-th polygon from the set.
void SetStartX(int x)
Definition: pcb_shape.h:150
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
virtual void SetStart(const wxPoint &aPoint)
Definition: dimension.h:122
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
virtual void SetPosition(const wxPoint &aPos) override
Definition: pcb_text.h:77
void SetBezControl2(const wxPoint &aPoint)
Definition: pcb_shape.h:135
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
int GetWidth() const
Definition: pcb_shape.h:118
static void pinEditedCorner(int aEditedPointIndex, int aMinWidth, int aMinHeight, VECTOR2I &aTopLeft, VECTOR2I &aTopRight, VECTOR2I &aBotLeft, VECTOR2I &aBotRight, VECTOR2I aHole, VECTOR2I aHoleSize)
Update the coordinates of 4 corners of a rectangle, according to pad constraints and the moved corner...
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
Definition: dimension.h:121
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:54
EDIT_CONSTRAINT for a EDIT_LINE, that constrains the line to move perpendicular to the line itself.
usual segment : line with rounded ends
Definition: board_item.h:50
Arcs (with rounded ends)
Definition: board_item.h:52
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
void Update()
Updates the dimension's cached text and geometry.
Definition: dimension.h:146
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
segment with non rounded ends
Definition: board_item.h:51
std::shared_ptr< EDIT_POINTS > m_editPoints
void editArcEndpointKeepCenter(PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
Move an end point of the arc around the circumference.
EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a line (determined by 2 points).
EDIT_POINT * m_editedPoint
int getEditedPointIndex() const
Return true if aPoint is the currently modified point.
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
virtual void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: pcb_shape.cpp:113
void SetHeight(int aHeight)
Sets the distance from the feature points to the crossbar line.
Definition: dimension.h:371
void SetEndY(int y)
Definition: pcb_shape.h:160
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:70
virtual wxPoint GetPosition() const override
Definition: pcb_text.h:72
A leader is a dimension-like object pointing to a specific point.
Definition: dimension.h:478
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.
PCB_TEXT & Text()
Definition: dimension.h:209
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
DIR GetOrientation() const
Definition: dimension.h:448
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
Definition: dimension.h:414
virtual void SetEnd(const wxPoint &aPoint)
Definition: dimension.h:125
Text placement is manually set by the user.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
void SetBezControl1(const wxPoint &aPoint)
Definition: pcb_shape.h:132
void SetOrientation(DIR aOrientation)
Sets the orientation of the dimension line (so, perpendicular to the feature lines)
Definition: dimension.h:447
void SetEndX(int x)
Definition: pcb_shape.h:161
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void editArcMidKeepEndpoints(PCB_SHAPE *aArc, VECTOR2I aStart, VECTOR2I aEnd, const VECTOR2I aCursor) const
Move the mid point of the arc, while keeping the two endpoints.
void editArcMidKeepCenter(PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
Move the mid point of the arc, while keeping the angle.
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:148
void editArcEndpointKeepTangent(PCB_SHAPE *aArc, VECTOR2I aCenter, VECTOR2I aStart, VECTOR2I aMid, VECTOR2I aEnd, const VECTOR2I aCursor) const
Move an end point of the arc, while keeping the tangent at the other endpoint.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
Definition: pcb_shape.cpp:316
bool isModified(const EDIT_POINT &aPoint) const
Set up an alternative constraint (typically enabled upon a modifier key being pressed).
ring
Definition: board_item.h:53
void SetStartY(int y)
Definition: pcb_shape.h:149
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:235
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Definition: pad.h:60
For better understanding of the points that make a dimension:
Definition: dimension.h:334
bool UnFill()
Removes the zone filling.
Definition: zone.cpp:186
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validate a polygon and displays a popup warning if invalid.
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
Definition: dimension.h:178
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Bezier Curve.
Definition: board_item.h:55
virtual const wxPoint & GetEnd() const
Definition: dimension.h:124
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:159
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
Marks the center of a circle or arc with a cross shape The size and orientation of the cross is adjus...
Definition: dimension.h:517

References ARC_CENTER, ARC_END, ARC_MID, ARC_START, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, CIRC_CENTER, CIRC_END, SHAPE_POLY_SET::CVertex(), DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_START, DIM_TEXT, editArcEndpointKeepCenter(), editArcEndpointKeepTangent(), editArcMidKeepCenter(), editArcMidKeepEndpoints(), EuclideanNorm(), PCB_SHAPE::GetCenter(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), getEditedPointIndex(), DIMENSION_BASE::GetEnd(), ORTHOGONAL_DIMENSION::GetOrientation(), PCB_SHAPE::GetPolyShape(), EDIT_POINT::GetPosition(), PCB_TEXT::GetPosition(), PCB_SHAPE::GetShape(), DIMENSION_BASE::GetStart(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), PCB_SHAPE::GetWidth(), ZONE::HatchBorder(), ORTHOGONAL_DIMENSION::HORIZONTAL, isModified(), left, m_altEditMethod, m_editedPoint, m_editPoints, MANUAL, PCB_SHAPE::Move(), ZONE::Outline(), pad, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_ZONE_T, pinEditedCorner(), PCB_SHAPE::RebuildBezierToSegmentsPointsList(), RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, right, RotatePoint(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SEG_END, SEG_START, PCB_SHAPE::SetBezControl1(), PCB_SHAPE::SetBezControl2(), DIMENSION_BASE::SetEnd(), PCB_SHAPE::SetEnd(), PCB_SHAPE::SetEndX(), PCB_SHAPE::SetEndY(), ALIGNED_DIMENSION::SetHeight(), ZONE::SetNeedRefill(), ORTHOGONAL_DIMENSION::SetOrientation(), PCB_TEXT::SetPosition(), DIMENSION_BASE::SetStart(), PCB_SHAPE::SetStart(), PCB_SHAPE::SetStartX(), PCB_SHAPE::SetStartY(), DIMENSION_BASE::SetTextPositionMode(), SHAPE_POLY_SET::SetVertex(), DIMENSION_BASE::Text(), SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), ZONE::UnFill(), DIMENSION_BASE::Update(), KIGFX::VIEW::Update(), validatePolygon(), ORTHOGONAL_DIMENSION::VERTICAL, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by OnSelectionChange().

◆ updatePoints()

void PCB_POINT_EDITOR::updatePoints ( )
private

Update which point is being edited.

Definition at line 1545 of file pcb_point_editor.cpp.

1546 {
1547  if( !m_editPoints )
1548  return;
1549 
1550  EDA_ITEM* item = m_editPoints->GetParent();
1551 
1552  if( !item )
1553  return;
1554 
1555  switch( item->Type() )
1556  {
1557  case PCB_SHAPE_T:
1558  case PCB_FP_SHAPE_T:
1559  {
1560  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
1561 
1562  switch( shape->GetShape() )
1563  {
1564  case S_SEGMENT:
1565  m_editPoints->Point( SEG_START ).SetPosition( shape->GetStart() );
1566  m_editPoints->Point( SEG_END ).SetPosition( shape->GetEnd() );
1567  break;
1568 
1569  case S_RECT:
1570  m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shape->GetStart() );
1571  m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( shape->GetEnd().x,
1572  shape->GetStart().y );
1573  m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shape->GetEnd() );
1574  m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( shape->GetStart().x,
1575  shape->GetEnd().y );
1576  break;
1577 
1578  case S_ARC:
1579  m_editPoints->Point( ARC_CENTER ).SetPosition( shape->GetCenter() );
1580  m_editPoints->Point( ARC_START ).SetPosition( shape->GetArcStart() );
1581  m_editPoints->Point( ARC_MID ).SetPosition( shape->GetArcMid() );
1582  m_editPoints->Point( ARC_END ).SetPosition( shape->GetArcEnd() );
1583  break;
1584 
1585  case S_CIRCLE:
1586  m_editPoints->Point( CIRC_CENTER ).SetPosition( shape->GetCenter() );
1587  m_editPoints->Point( CIRC_END ).SetPosition( shape->GetEnd() );
1588  break;
1589 
1590  case S_POLYGON:
1591  {
1592  const auto& points = shape->BuildPolyPointsList();
1593 
1594  if( m_editPoints->PointsSize() != (unsigned) points.size() )
1595  {
1596  getView()->Remove( m_editPoints.get() );
1597  m_editedPoint = nullptr;
1598 
1599  m_editPoints = makePoints( item );
1600 
1601  if( m_editPoints )
1602  getView()->Add( m_editPoints.get() );
1603  }
1604  else
1605  {
1606  for( unsigned i = 0; i < points.size(); i++ )
1607  m_editPoints->Point( i ).SetPosition( points[i] );
1608  }
1609  break;
1610  }
1611 
1612  case S_CURVE:
1613  m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( shape->GetStart() );
1614  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( shape->GetBezControl1() );
1615  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( shape->GetBezControl2() );
1616  m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( shape->GetEnd() );
1617  break;
1618 
1619  default: // suppress warnings
1620  break;
1621  }
1622 
1623  break;
1624  }
1625 
1626  case PCB_PAD_T:
1627  {
1628  const PAD* pad = static_cast<const PAD*>( item );
1629  bool locked = pad->GetParent() && pad->IsLocked();
1630  wxPoint shapePos = pad->ShapePos();
1631  wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
1632 
1633  switch( pad->GetShape() )
1634  {
1635  case PAD_SHAPE_CIRCLE:
1636  {
1637  int target = locked ? 0 : 2;
1638 
1639  // Careful; pad shape is mutable...
1640  if( int( m_editPoints->PointsSize() ) != target )
1641  {
1642  getView()->Remove( m_editPoints.get() );
1643  m_editedPoint = nullptr;
1644 
1645  m_editPoints = makePoints( item );
1646 
1647  if( m_editPoints )
1648  getView()->Add( m_editPoints.get() );
1649  }
1650  else if( target == 2 )
1651  {
1652  VECTOR2I vec = m_editPoints->Point( CIRC_END ).GetPosition()
1653  - m_editPoints->Point( CIRC_CENTER ).GetPosition();
1654  vec.Resize( halfSize.x );
1655 
1656  m_editPoints->Point( CIRC_CENTER ).SetPosition( shapePos );
1657  m_editPoints->Point( CIRC_END ).SetPosition( vec + shapePos );
1658  }
1659  }
1660  break;
1661 
1662  case PAD_SHAPE_OVAL:
1663  case PAD_SHAPE_TRAPEZOID:
1664  case PAD_SHAPE_RECT:
1665  case PAD_SHAPE_ROUNDRECT:
1667  {
1668  // Careful; pad shape and orientation are mutable...
1669  int target = locked || (int) pad->GetOrientation() % 900 > 0 ? 0 : 4;
1670 
1671  if( int( m_editPoints->PointsSize() ) != target )
1672  {
1673  getView()->Remove( m_editPoints.get() );
1674  m_editedPoint = nullptr;
1675 
1676  m_editPoints = makePoints( item );
1677 
1678  if( m_editPoints )
1679  getView()->Add( m_editPoints.get() );
1680  }
1681  else if( target == 4 )
1682  {
1683  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
1684  std::swap( halfSize.x, halfSize.y );
1685 
1686  m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shapePos - halfSize );
1687  m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( wxPoint( shapePos.x + halfSize.x,
1688  shapePos.y - halfSize.y ) );
1689  m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shapePos + halfSize );
1690  m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( wxPoint( shapePos.x - halfSize.x,
1691  shapePos.y + halfSize.y ) );
1692  }
1693  }
1694  break;
1695 
1696  default: // suppress warnings
1697  break;
1698  }
1699  }
1700  break;
1701 
1702  case PCB_FP_ZONE_T:
1703  case PCB_ZONE_T:
1704  {
1705  ZONE* zone = static_cast<ZONE*>( item );
1706  const SHAPE_POLY_SET* outline = zone->Outline();
1707 
1708  if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() )
1709  {
1710  getView()->Remove( m_editPoints.get() );
1711  m_editedPoint = nullptr;
1712 
1713  m_editPoints = makePoints( item );
1714 
1715  if( m_editPoints )
1716  getView()->Add( m_editPoints.get() );
1717  }
1718  else
1719  {
1720  for( int i = 0; i < outline->TotalVertices(); ++i )
1721  m_editPoints->Point( i ).SetPosition( outline->CVertex( i ) );
1722  }
1723 
1724  break;
1725  }
1726 
1727  case PCB_DIM_ALIGNED_T:
1728  case PCB_DIM_ORTHOGONAL_T:
1729  {
1730  const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( item );
1731 
1732  m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1733  m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1734  m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
1735  m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() );
1736  m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() );
1737  break;
1738  }
1739 
1740  case PCB_DIM_CENTER_T:
1741  {
1742  const CENTER_DIMENSION* dimension = static_cast<const CENTER_DIMENSION*>( item );
1743 
1744  m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1745  m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1746  break;
1747  }
1748 
1749  case PCB_DIM_LEADER_T:
1750  {
1751  const LEADER* dimension = static_cast<const LEADER*>( item );
1752 
1753  m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1754  m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1755  m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
1756  break;
1757  }
1758 
1759  default:
1760  break;
1761  }
1762 
1763  getView()->Update( m_editPoints.get() );
1764 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
wxPoint GetArcEnd() const
Definition: pcb_shape.cpp:374
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
Definition: dimension.h:121
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:352
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
Arcs (with rounded ends)
Definition: board_item.h:52
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
segment with non rounded ends
Definition: board_item.h:51
const wxPoint & GetCrossbarStart() const
Definition: dimension.h:363
std::shared_ptr< EDIT_POINTS > m_editPoints
const wxPoint & GetCrossbarEnd() const
Definition: dimension.h:365
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
EDIT_POINT * m_editedPoint
std::shared_ptr< EDIT_POINTS > makePoints(EDA_ITEM *aItem)
Update item's points with edit points.
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
Definition: pcb_shape.cpp:1198
virtual wxPoint GetPosition() const override
Definition: pcb_text.h:72
A leader is a dimension-like object pointing to a specific point.
Definition: dimension.h:478
Represent a set of closed polygons.
PCB_TEXT & Text()
Definition: dimension.h:209
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:404
const wxPoint & GetBezControl2() const
Definition: pcb_shape.h:136
class ZONE, managed by a footprint
Definition: typeinfo.h:94
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
ring
Definition: board_item.h:53
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
wxPoint GetArcMid() const
Definition: pcb_shape.cpp:392
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:322
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:130
Definition: pad.h:60
For better understanding of the points that make a dimension:
Definition: dimension.h:334
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Bezier Curve.
Definition: board_item.h:55
virtual const wxPoint & GetEnd() const
Definition: dimension.h:124
const wxPoint & GetBezControl1() const
Definition: pcb_shape.h:133
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
Marks the center of a circle or arc with a cross shape The size and orientation of the cross is adjus...
Definition: dimension.h:517

References KIGFX::VIEW::Add(), ARC_CENTER, ARC_END, ARC_MID, ARC_START, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, PCB_SHAPE::BuildPolyPointsList(), CIRC_CENTER, CIRC_END, SHAPE_POLY_SET::CVertex(), DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_START, DIM_TEXT, PCB_SHAPE::GetArcEnd(), PCB_SHAPE::GetArcMid(), PCB_SHAPE::GetArcStart(), PCB_SHAPE::GetBezControl1(), PCB_SHAPE::GetBezControl2(), PCB_SHAPE::GetCenter(), ALIGNED_DIMENSION::GetCrossbarEnd(), ALIGNED_DIMENSION::GetCrossbarStart(), DIMENSION_BASE::GetEnd(), PCB_SHAPE::GetEnd(), PCB_TEXT::GetPosition(), PCB_SHAPE::GetShape(), DIMENSION_BASE::GetStart(), PCB_SHAPE::GetStart(), TOOL_BASE::getView(), locked, m_editedPoint, m_editPoints, makePoints(), ZONE::Outline(), pad, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_ZONE_T, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_TOP_LEFT, RECT_TOP_RIGHT, KIGFX::VIEW::Remove(), VECTOR2< T >::Resize(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SEG_END, SEG_START, DIMENSION_BASE::Text(), SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by addCorner(), modifiedSelection(), OnSelectionChange(), and removeCorner().

◆ validatePolygon()

bool PCB_POINT_EDITOR::validatePolygon ( SHAPE_POLY_SET aModified) const
private

Validate a polygon and displays a popup warning if invalid.

Parameters
aModifiedis the polygon to be checked.
Returns
True if polygon is valid.Update edit points with item's points.

Definition at line 1523 of file pcb_point_editor.cpp.

1524 {
1525  bool valid = !aPoly.IsSelfIntersecting();
1526 
1527  if( m_statusPopup )
1528  {
1529  if( valid )
1530  {
1531  m_statusPopup->Hide();
1532  }
1533  else
1534  {
1535  wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
1536  m_statusPopup->Move( p );
1537  m_statusPopup->PopupFor( 1500 );
1538  }
1539  }
1540 
1541  return valid;
1542 }
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup

References SHAPE_POLY_SET::IsSelfIntersecting(), and m_statusPopup.

Referenced by removeCorner(), and updateItem().

◆ view()

◆ 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(), 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_altConstrainer

EDIT_POINT PCB_POINT_EDITOR::m_altConstrainer
private

Definition at line 175 of file pcb_point_editor.h.

Referenced by setAltConstraint().

◆ m_altConstraint

std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT> > PCB_POINT_EDITOR::m_altConstraint
private

Definition at line 174 of file pcb_point_editor.h.

Referenced by OnSelectionChange(), Reset(), and setAltConstraint().

◆ m_altEditMethod

bool PCB_POINT_EDITOR::m_altEditMethod
private

Definition at line 171 of file pcb_point_editor.h.

Referenced by changeEditMethod(), and updateItem().

◆ m_editedPoint

◆ m_editPoints

◆ m_hoveredPoint

EDIT_POINT* PCB_POINT_EDITOR::m_hoveredPoint
private

Definition at line 166 of file pcb_point_editor.h.

Referenced by OnSelectionChange(), and updateEditedPoint().

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 106 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), 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(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::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(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), 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(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_original

EDIT_POINT PCB_POINT_EDITOR::m_original
private

Original position for the current drag point.

Definition at line 168 of file pcb_point_editor.h.

Referenced by get45DegConstrainer(), and OnSelectionChange().

◆ m_refill

bool PCB_POINT_EDITOR::m_refill
private

Definition at line 170 of file pcb_point_editor.h.

Referenced by OnSelectionChange(), and Reset().

◆ m_selectionTool

PCB_SELECTION_TOOL* PCB_POINT_EDITOR::m_selectionTool
private

Definition at line 161 of file pcb_point_editor.h.

Referenced by Init(), and OnSelectionChange().

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> PCB_POINT_EDITOR::m_statusPopup
private

Definition at line 162 of file pcb_point_editor.h.

Referenced by Reset(), and validatePolygon().

◆ 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(), CONVERT_TOOL::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(), 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(), 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(), 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: