29 using namespace std::placeholders;
34 #include <clipper.hpp> 73 SetTitle(
_(
"Select" ) );
109 m_enteredGroup( nullptr ),
110 m_priv(
std::make_unique<
PRIV>() )
137 auto frame = getEditFrame<PCB_BASE_FRAME>();
146 auto selectMenu = std::make_shared<SELECT_MENU>();
147 selectMenu->SetTool(
this );
152 auto activeToolCondition =
158 auto inGroupCondition =
167 menu.AddSeparator( 1000 );
173 menu.AddSeparator( 1 );
187 m_frame = getEditFrame<PCB_BASE_FRAME>();
227 wxMouseState keyboardState = wxGetMouseState();
230 keyboardState.AltDown() );
254 evt->Modifier(
MD_ALT ) );
266 else if( evt->IsMouseDown(
BUT_LEFT ) )
302 bool selectionCancelled =
false;
306 selectPoint( evt->Position(),
false, &selectionCancelled );
310 if( !selectionCancelled )
313 else if( evt->IsDblClick(
BUT_LEFT ) )
367 auto zoneFilledAreaFilter =
371 wxPoint location = wxPoint( aWhere );
372 int accuracy =
KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() );
373 std::set<EDA_ITEM*> remove;
379 ZONE* zone = static_cast<ZONE*>( item );
383 remove.insert( zone );
388 aCollector.Remove( item );
422 else if( evt->IsCancel() )
441 if( !modifier_enabled
444 && evt->HasPosition()
467 wxT(
"EnterGroup called when selection is not a single group" ) );
509 bool aConfirmLockedItems )
522 enum DISPOSITION { BEFORE = 1, AFTER, BOTH };
524 std::map<EDA_ITEM*, DISPOSITION> itemDispositions;
530 itemDispositions[ item ] = BEFORE;
533 aClientFilter(
VECTOR2I(), collector,
this );
537 if( itemDispositions.count( item ) )
538 itemDispositions[ item ] = BOTH;
540 itemDispositions[ item ] = AFTER;
548 for( std::pair<EDA_ITEM* const, DISPOSITION> itemDisposition : itemDispositions )
550 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( itemDisposition.first );
551 DISPOSITION disposition = itemDisposition.second;
553 if( disposition == BEFORE )
557 for( std::pair<EDA_ITEM* const, DISPOSITION> itemDisposition : itemDispositions )
559 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( itemDisposition.first );
560 DISPOSITION disposition = itemDisposition.second;
564 if( disposition == AFTER || disposition == BOTH )
571 if( aConfirmLockedItems )
573 std::vector<BOARD_ITEM*> lockedItems;
577 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
582 bool lockedDescendant =
false;
584 group->RunOnDescendants(
588 lockedDescendant =
true;
591 if( lockedDescendant )
592 lockedItems.push_back(
group );
596 lockedItems.push_back( boardItem );
600 if( !lockedItems.empty() )
604 switch( dlg.ShowModal() )
657 bool* aSelectionCancelledFlag,
671 (wxPoint) aWhere, guide );
674 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
676 if( !
Selectable( collector[ i ] ) || ( aOnDrag && collector[i]->IsLocked() ) )
685 aClientFilter( aWhere, collector,
this );
704 if( aSelectionCancelledFlag )
705 *aSelectionCancelledFlag =
true;
711 bool anyAdded =
false;
712 bool anySubtracted =
false;
719 anySubtracted =
true;
725 for(
int i = 0; i < collector.
GetCount(); ++i )
730 anySubtracted =
true;
745 else if( anySubtracted )
782 bool cancelled =
false;
789 bool anyAdded =
false;
790 bool anySubtracted =
false;
800 bool windowSelection = width >= 0 ? true :
false;
803 windowSelection = !windowSelection;
808 if( evt->IsCancelInteractive() || evt->IsActivate() )
820 anySubtracted =
true;
827 area.
SetEnd( evt->Position() );
844 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> candidates;
857 for(
auto it = candidates.begin(), it_end = candidates.end(); it != it_end; ++it )
859 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it->first );
861 if( item &&
Selectable( item ) && item->
HitTest( selectionRect, windowSelection ) )
872 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( i );
877 anySubtracted =
true;
891 else if( anySubtracted )
925 wxMouseState keyboardState = wxGetMouseState();
928 keyboardState.AltDown() );
959 std::vector<BOARD_ITEM*>* items = aEvent.
Parameter<std::vector<BOARD_ITEM*>*>();
986 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
995 view->
Query( selectionBox, selectedItems );
999 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( item_pair.first );
1004 collection.
Append( item );
1010 select( static_cast<BOARD_ITEM*>( item ) );
1033 std::vector<BOARD_ITEM*>* items = aEvent.
Parameter<std::vector<BOARD_ITEM*>*>();
1038 for(
auto item : *items )
1087 std::set<int> representedNets;
1089 for(
int i = aCollector.
GetCount() - 1; i >= 0; i-- )
1094 else if ( representedNets.count( item->
GetNetCode() ) )
1097 representedNets.insert( item->
GetNetCode() );
1104 unsigned initialCount = 0;
1108 if( dynamic_cast<const BOARD_CONNECTED_ITEM*>( item ) )
1112 if( initialCount == 0 )
1120 for(
EDA_ITEM* item : selectedItems )
1121 item->ClearTempFlags();
1123 for(
EDA_ITEM* item : selectedItems )
1125 PCB_TRACK* trackItem = dynamic_cast<PCB_TRACK*>( item );
1151 auto connectedItems = connectivity->GetConnectedItems( &aStartItem, types,
true );
1153 std::map<wxPoint, std::vector<PCB_TRACK*>> trackMap;
1154 std::map<wxPoint, PCB_VIA*> viaMap;
1155 std::map<wxPoint, PAD*> padMap;
1160 switch( item->Type() )
1165 PCB_TRACK* track = static_cast<PCB_TRACK*>( item );
1166 trackMap[ track->
GetStart() ].push_back( track );
1167 trackMap[ track->
GetEnd() ].push_back( track );
1173 PCB_VIA*
via = static_cast<PCB_VIA*>( item );
1174 viaMap[
via->GetStart() ] =
via;
1180 PAD*
pad = static_cast<PAD*>( item );
1181 padMap[
pad->GetPosition() ] =
pad;
1192 std::vector< std::pair<wxPoint, PCB_LAYER_ID> > activePts;
1195 switch( aStartItem.
Type() )
1200 PCB_TRACK* track = static_cast<PCB_TRACK*>( &aStartItem );
1208 activePts.push_back( { aStartItem.
GetPosition(), ALL_LAYERS } );
1212 activePts.push_back( { aStartItem.
GetPosition(), ALL_LAYERS } );
1223 while( expand && failSafe++ < 100000 )
1227 for(
int i = activePts.size() - 1; i >= 0; --i )
1229 wxPoint pt = activePts[i].first;
1231 size_t pt_count = 0;
1235 if( layer == ALL_LAYERS || layer == track->GetLayer() )
1242 || ( viaMap.count( pt ) && layer != ALL_LAYERS )
1243 || ( padMap.count( pt ) && layer != ALL_LAYERS ) )
1245 activePts.erase( activePts.begin() + i );
1251 if( padMap.count( pt ) )
1253 activePts.erase( activePts.begin() + i );
1258 if( padMap.count( pt ) )
1265 activePts.push_back( {
pad->GetPosition(), ALL_LAYERS } );
1270 for(
PCB_TRACK* track : trackMap[ pt ] )
1272 if( layer != ALL_LAYERS && track->GetLayer() != layer )
1275 if( !track->IsSelected() )
1279 if( track->GetStart() == pt )
1280 activePts.push_back( { track->GetEnd(), track->GetLayer() } );
1282 activePts.push_back( { track->GetStart(), track->GetLayer() } );
1288 if( viaMap.count( pt ) )
1292 if( !
via->IsSelected() )
1295 activePts.push_back( {
via->GetPosition(), ALL_LAYERS } );
1300 activePts.erase( activePts.begin() + i );
1324 int netcode = aEvent.
Parameter<intptr_t>();
1356 std::list<FOOTPRINT*> footprintList;
1366 if( aSheetPath.IsEmpty() )
1369 if( footprint_path.StartsWith( aSheetPath ) )
1374 std::list<int> netcodeList;
1375 std::list<PAD*> padList;
1381 if(
pad->IsConnected() )
1383 netcodeList.push_back(
pad->GetNetCode() );
1384 padList.push_back(
pad );
1391 netcodeList.unique();
1393 for(
PAD*
pad : padList )
1398 std::list<int> removeCodeList;
1401 for(
int netCode : netcodeList )
1411 removeCodeList.push_back( netCode );
1418 removeCodeList.sort();
1419 removeCodeList.unique();
1421 for(
int removeCode : removeCodeList )
1423 netcodeList.remove( removeCode );
1426 std::list<BOARD_CONNECTED_ITEM*> localConnectionList;
1429 for(
int netCode : netcodeList )
1433 localConnectionList.push_back( item );
1457 screenSize.
x = std::max( 10.0, screenSize.
x );
1458 screenSize.
y = std::max( 10.0, screenSize.
y );
1460 if( selectionBox.GetWidth() != 0 || selectionBox.GetHeight() != 0 )
1462 VECTOR2D vsize = selectionBox.GetSize();
1464 fabs( vsize.
y / screenSize.
y ) );
1477 wxString sheetPath = *aEvent.
Parameter<wxString*>();
1511 if( sheetPath.IsEmpty() )
1526 bool cleared =
false;
1561 bool include =
true;
1567 switch( aItem.
Type() )
1571 const FOOTPRINT& footprint = static_cast<const FOOTPRINT&>( aItem );
1627 const int cmd = dlg.ShowModal();
1629 if( cmd != wxID_OK )
1640 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( i );
1658 std::set<BOARD_ITEM*> rejected;
1662 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( i );
1665 rejected.insert( item );
1669 aCollector.Remove( item );
1691 switch( aItem->
Type() )
1721 ZONE* zone = static_cast<ZONE*>( aItem );
1791 bool enteredGroupFound =
false;
1794 [&](
EDA_ITEM* item,
void* testData )
1810 enteredGroupFound =
true;
1823 if( !enteredGroupFound )
1845 bool selectAll =
false;
1846 bool expandSelection =
false;
1854 if( expandSelection )
1857 expandSelection =
false;
1859 int limit = std::min( 9, aCollector->
GetCount() );
1862 for(
int i = 0; i < limit; ++i )
1872 menu.AppendSeparator();
1882 menu.DisplayTitle(
true );
1886 menu.DisplayTitle(
false );
1897 for(
int i = 0; i < aCollector->
GetCount(); ++i )
1905 int id = *evt->GetCommandId();
1908 if(
id > 0 &&
id <= limit )
1910 current = ( *aCollector )[
id - 1];
1919 if(
id == limit + 1 )
1921 for(
int i = 0; i < aCollector->
GetCount(); ++i )
1934 for(
int i = 0; i < aCollector->
GetCount(); ++i )
1945 if(
id == limit + 1 )
1950 else if(
id == limit + 2 )
1952 expandSelection =
true;
1957 else if(
id && ( *
id > 0 ) && ( *
id <= limit ) )
1960 current = ( *aCollector )[*
id - 1];
1973 }
while( expandSelection );
1983 aCollector->
Empty();
1984 aCollector->
Append( current );
1996 auto visibleLayers =
2004 set.set( layer,
view()->IsLayerVisible( layer ) );
2017 bool onActiveLayer =
false;
2019 for(
unsigned int layer : activeLayers )
2022 if( layer < PCB_LAYER_ID_COUNT && aItem->IsOnLayer(
ToLAYER_ID( layer ) ) )
2024 onActiveLayer =
true;
2029 if( !onActiveLayer )
2071 PCB_GROUP*
group = const_cast<PCB_GROUP*>( static_cast<const PCB_GROUP*>( aItem ) );
2084 const ZONE* zone =
nullptr;
2086 const PAD*
pad =
nullptr;
2089 switch( aItem->
Type() )
2096 zone = static_cast<const ZONE*>( aItem );
2102 && !checkVisibilityOnly )
2108 if( !( zone->
GetLayerSet() & visibleLayers() ).any() )
2135 via = static_cast<const PCB_VIA*>( aItem );
2138 if( !( visibleLayers() &
via->GetLayerSet() ).any() )
2146 text = static_cast<const FP_TEXT*>( aItem );
2174 if( !checkVisibilityOnly )
2194 pad = static_cast<const PAD*>( aItem );
2215 if( !(
pad->GetLayerSet() & visibleLayers() ).any() )
2261 aGroup->
Add( aItem );
2285 static_cast<FOOTPRINT*>( aItem )->RunOnChildren(
2293 static_cast<PCB_GROUP*>( aItem )->RunOnChildren(
2328 static_cast<FOOTPRINT*>( aItem )->RunOnChildren(
2336 static_cast<PCB_GROUP*>( aItem )->RunOnChildren(
2357 (wxPoint) aPoint, guide );
2359 for(
int i = collector.
GetCount() - 1; i >= 0; --i )
2372 int aMaxDistance )
const 2377 SEG loc( aWhere, aWhere );
2379 switch( aItem->
Type() )
2384 text->GetEffectiveTextShape()->Collide( loc, aMaxDistance, &
distance );
2391 text->GetEffectiveTextShape()->Collide( loc, aMaxDistance, &
distance );
2397 ZONE* zone = static_cast<ZONE*>( aItem );
2419 catch(
const ClipperLib::clipperException& exc )
2423 wxLogError( wxT(
"Clipper library exception '%s' occurred." ), exc.what() );
2435 PCB_MARKER* marker = static_cast<PCB_MARKER*>( aItem );
2479 std::set<BOARD_ITEM*> preferred;
2480 std::set<BOARD_ITEM*> rejected;
2481 wxPoint where( aWhere.
x, aWhere.
y );
2486 if( silkLayers[activeLayer] )
2488 for(
int i = 0; i < aCollector.
GetCount(); ++i )
2496 preferred.insert( item );
2500 if( preferred.size() > 0 )
2505 aCollector.
Append( item );
2512 constexpr
int MAX_SLOP = 5;
2515 int minSlop = INT_MAX;
2517 std::map<BOARD_ITEM*, int> itemsBySloppiness;
2519 for(
int i = 0; i < aCollector.
GetCount(); ++i )
2524 itemsBySloppiness[ item ] = itemSlop;
2526 if( itemSlop < minSlop )
2531 if( minSlop < INT_MAX )
2533 for( std::pair<BOARD_ITEM*, int> pair : itemsBySloppiness )
2535 if( pair.second > minSlop + pixel )
2542 constexpr
double sizeRatio = 1.5;
2544 std::vector<std::pair<BOARD_ITEM*, double>> itemsByArea;
2546 for(
int i = 0; i < aCollector.
GetCount(); ++i )
2552 && static_cast<ZONE*>( item )->HitTestForEdge( where, MAX_SLOP * pixel / 2 ) )
2561 area =
SEG::Square( static_cast<PCB_VIA*>( item )->GetDrill() / 2 ) * 1.5;
2569 catch(
const ClipperLib::clipperException& e )
2571 wxLogError( wxT(
"A clipper exception %s was detected." ), e.what() );
2575 itemsByArea.emplace_back( item, area );
2578 std::sort( itemsByArea.begin(), itemsByArea.end(),
2579 [](
const std::pair<BOARD_ITEM*, double>& lhs,
2580 const std::pair<BOARD_ITEM*, double>& rhs ) ->
bool 2582 return lhs.second < rhs.second;
2585 bool rejecting =
false;
2587 for(
int i = 1; i < (int) itemsByArea.size(); ++i )
2589 if( itemsByArea[i].second > itemsByArea[i-1].second * sizeRatio )
2593 rejected.insert( itemsByArea[i].first );
2598 constexpr
double maxCoverRatio = 0.70;
2600 for(
int i = 0; i < aCollector.
GetCount(); ++i )
2610 if( (
unsigned) aCollector.
GetCount() > rejected.size() )
2622 bool haveItemOnActive =
false;
2625 for(
int i = 0; i < aCollector.
GetCount(); ++i )
2627 if( !aCollector[i]->IsOnLayer( activeLayer ) )
2628 rejected.insert( aCollector[i] );
2630 haveItemOnActive =
true;
2633 if( haveItemOnActive )
2641 bool aMultiselect )
const 2643 std::unordered_set<BOARD_ITEM*> toAdd;
2647 for(
int j = 0; j < aCollector.
GetCount(); j++ )
2649 if( aCollector[j]->GetParent() )
2655 for(
int j = 0; j < aCollector.
GetCount(); j++ )
2659 for(
int j = 0; j < aCollector.
GetCount(); )
2676 toAdd.insert( aTop );
2679 aCollector.
Remove( item );
2687 aCollector.
Remove( item );
2695 aCollector.
Remove( item );
2704 if( !aCollector.
HasItem( item ) )
2705 aCollector.
Append( item );
2712 std::set<BOARD_ITEM*> to_add;
2715 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2725 aCollector.
Remove( item );
2730 aCollector.
Append( item );
2737 for(
int i = aCollector.
GetCount() - 1; i >= 0; --i )
2742 aCollector.
Remove( item );
2759 CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
2761 if( conditionalMenu )
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
void Empty()
Clear the list.
static TOOL_ACTION selectionClear
Clear the current selection.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
void ClearReferencePoint()
const std::set< unsigned int > GetHighContrastLayers() const
Returns the set of currently high-contrast layers.
const wxPoint & GetPos() const
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void SetIgnoreTracks(bool ignore)
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
currently selected items overlay
static const KICAD_T FootprintItems[]
A scan list for primary footprint items.
static const TOOL_EVENT SelectedEvent
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
static TOOL_ACTION move
move or drag an item
void SetOnePixelInIU(double aValue)
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
virtual void Clear() override
Remove all the stored items from the group.
void ForceRefresh()
Force a redraw.
class PCB_DIM_LEADER, a leader dimension (graphic item)
bool otherItems
Anything not fitting one of the above categories.
static TOOL_ACTION groupLeave
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
class FP_TEXT, text in a footprint
static const KICAD_T AllBoardItems[]
A scan list for all editable board items.
void SetIgnoreBlindBuriedVias(bool ignore)
static TOOL_ACTION zoomInCenter
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const wxPoint & GetEnd() const
static const TOOL_EVENT UnselectedEvent
#define IS_NEW
New item, just created.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
virtual void Add(EDA_ITEM *aItem)
class PCB_GROUP, a set of BOARD_ITEMs
static const TOOL_EVENT DisambiguatePoint
Meta control for all pads opacity/visibility (color ignored)
show footprints values (when texts are visible)
A set of BOARD_ITEMs (i.e., without duplicates).
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
virtual double OnePixelInIU() const =0
void SetIgnoreModulesVals(bool ignore)
void SetIgnoreMicroVias(bool ignore)
class PCB_DIM_CENTER, a center point marking (graphic item)
void SetIgnoreModulesOnBack(bool ignore)
static TOOL_ACTION unselectItem
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
the 3d code uses this value
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
static TOOL_ACTION dragFreeAngle
void Move(const VECTOR2I &aVector) override
static TOOL_ACTION unselectItems
static TOOL_ACTION cancelInteractive
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
static TOOL_ACTION properties
Activation of the edit tool.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
static TOOL_ACTION cursorRight
static TOOL_ACTION zoomFitScreen
void SetFlags(EDA_ITEM_FLAGS aMask)
class PCB_TEXT, text on a layer
void SetIgnoreModulesRefs(bool ignore)
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
static TOOL_ACTION selectConnection
Select tracks between junctions or expands an existing selection to pads or the entire connection.
class PCB_ARC, an arc track segment on a copper layer
static TOOL_ACTION cursorRightFast
void SetExclusiveOr(bool aExclusiveOr)
static PCB_GROUP * TopLevelGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
static TOOL_ACTION drag45Degree
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
double OnePixelInIU() const override
virtual void Clear()
Remove all the stored items from the group.
static TOOL_ACTION zoomFitObjects
Struct that will be set with the result of the user choices in the dialog.
const EDA_RECT GetBoundingBox() const override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
virtual wxPoint GetPosition() const
static TOOL_ACTION panLeft
virtual bool IsLocked() const
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
static SEG::ecoord Square(int a)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
bool Contains(const wxPoint &aPoint) const
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a corner.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
static TOOL_ACTION zoomOutCenter
class PCB_TRACK, a track segment (segment on a copper layer)
bool HasPoint()
Indicate the cursor is over an edit point.
Control for copper zone opacity/visibility (color ignored)
void SetIsHover(bool aIsHover)
void Append(EDA_ITEM *item)
Add an item to the end of the list.
void SetAdditive(bool aAdditive)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
virtual PCB_LAYER_ID GetActiveLayer() const
bool includeLockedModules
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
int GetCount() const
Return the number of objects in the list.
void SetOrigin(const VECTOR2I &aOrigin)
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
like PAD_PTH, but not plated
Container for display options like enable/disable some optional drawings.
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...
const COLLECTORS_GUIDE * GetGuide() const
Item needs to be redrawn.
LSET is a set of PCB_LAYER_IDs.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
bool text
Text (free or attached to a footprint)
#define IS_MOVING
Item being moved.
static TOOL_ACTION panDown
Meta control for all vias opacity/visibility.
void SetIgnoreMTextsOnBack(bool ignore)
std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Used to inspect and possibly collect the (search) results of iterating over a list or tree of KICAD_T...
TRACK_DRAG_ACTION m_TrackDragAction
bool dimensions
Dimension items.
void SetIgnorePadsOnFront(bool ignore)
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
bool keepouts
Keepout zones.
bool graphics
Graphic lines, shapes, polygons.
void SetIgnoreMTextsOnFront(bool ignore)
coord_type GetWidth() const
static TOOL_ACTION cursorUpFast
static TOOL_ACTION cursorDownFast
static TOOL_ACTION cursorLeft
static TOOL_ACTION panRight
bool Contains(EDA_ITEM *aItem) const
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
const std::deque< EDA_ITEM * > GetItems() const
bool HasItem(const EDA_ITEM *aItem) const
Tests if aItem has already been collected.
static const TOOL_EVENT UninhibitSelectionEditing
Used to inform tool that it should display the disambiguation menu.
EDA_ITEM * GetParent() const
Items that may change while the view stays the same (noncached)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
static LSET AllLayersMask()
static bool WithinScope(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
Handle a list of polygons defining a copper zone.
class ZONE, a copper pour area
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
static TOOL_ACTION cursorLeftFast
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
bool tracks
Copper tracks.
static TOOL_ACTION updateMenu
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
void SetIgnoreMTextsMarkedNoShow(bool ignore)
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
static TOOL_ACTION hideDynamicRatsnest
bool footprints
Allow selecting entire footprints.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void FocusOnItem(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
bool Empty() const
Checks if there is anything selected.
class PCB_TARGET, a target (graphic item)
EDA_ITEM_FLAGS GetFlags() const
class FOOTPRINT, a footprint
bool IsMirroredX() const
Return true if view is flipped across the X axis.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if point aP lies closer to us than aClearance.
void SetSubtractive(bool aSubtractive)
const Vec & GetPosition() const
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
virtual unsigned int GetSize() const override
Return the number of stored items.
bool vias
Vias (all types>
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
static TOOL_ACTION filterSelection
Filter the items in the current selection (invokes dialog)
void Normalize()
Ensures that the height ant width are positive.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
show footprints references (when texts are visible)
bool GetHighContrast() const
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
#define ENTERED
indicates a group has been entered
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
bool lockedItems
Allow selecting locked items.
class PCB_MARKER, a marker used to show something
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a segment defined by 2 corners.
Tool that displays edit points allowing to modify items by dragging the points.
bool HasAdditionalItems()
Test if the collector has heuristic backup items.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
static TOOL_ACTION highlightNet
multilayer pads, usually with holes
bool IsType(FRAME_T aType) const
#define TEMP_SELECTED
flag indicating that the structure has already selected
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
static TOOL_ACTION zoomCenter
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
static TOOL_ACTION selectOnSheetFromEeschema
Select all components on sheet from Eeschema crossprobing.
Information pertinent to a Pcbnew printed circuit board.
static TOOL_ACTION cursorUp
Cursor control with keyboard.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PCB_LAYER_ID
A quick note on layer IDs:
bool includeItemsOnTechLayers
void SetIgnoreModulesOnFront(bool ignore)
Used when the right click button is pressed, or when the select tool is in effect.
void SetIgnoreThroughVias(bool ignore)
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
wxString AsString() const
class NETINFO_ITEM, a description of a net
virtual void Remove(EDA_ITEM *aItem)
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
class ZONE, managed by a footprint
Handle the component boundary box.
VECTOR2I GetOrigin() const
ZONE_DISPLAY_MODE m_ZoneDisplayMode
PCBNEW_SETTINGS & Settings()
int Size() const
Returns the number of selected parts.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
static const TOOL_EVENT InhibitSelectionEditing
coord_type GetHeight() const
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all members of the group.
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
void Combine()
Re-combine the backup list into the main list of the collector.
static TOOL_ACTION zoomIn
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
static TOOL_ACTION zoomOut
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
class PCB_VIA, a via (like a track segment on a copper layer)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
bool includeBoardOutlineLayer
const Vec & GetSize() const
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
A general implementation of a COLLECTORS_GUIDE.
BOARD_ITEM_CONTAINER * GetParent() const
static TOOL_ACTION cursorDown
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions.
class PCB_SHAPE, a segment not on copper layers
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
static TOOL_ACTION selectAll
virtual EDA_RECT GetBoundingBox() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
void SetIgnoreThroughHolePads(bool ignore)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetIgnoreZoneFills(bool ignore)
const wxPoint & GetStart() const
virtual double ViewGetLOD(int aLayer, VIEW *aView) const
Return the level of detail (LOD) of the item.
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...
KICAD_T Type() const
Returns the type of object.
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
#define BRIGHTENED
item is drawn with a bright contour
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
void SetIgnorePadsOnBack(bool ignore)