KiCad PCB EDA Suite
PCB_SELECTION Class Reference

#include <pcb_selection.h>

Inheritance diagram for PCB_SELECTION:
SELECTION KIGFX::VIEW_GROUP KIGFX::VIEW_ITEM INSPECTABLE

Public Types

using ITER = std::deque< EDA_ITEM * >::iterator
 
using CITER = std::deque< EDA_ITEM * >::const_iterator
 

Public Member Functions

EDA_ITEMGetTopLeftItem (bool aFootprintsOnly=false) const override
 
const std::vector< KIGFX::VIEW_ITEM * > updateDrawList () const override
 
const LSET GetSelectionLayers ()
 
bool operator== (const SELECTION &aOther)
 
ITER begin ()
 
CITER begin () const
 
ITER end ()
 
CITER end () const
 
void SetIsHover (bool aIsHover)
 
bool IsHover () const
 
virtual void Add (EDA_ITEM *aItem)
 
virtual void Add (VIEW_ITEM *aItem)
 Add an item to the group. More...
 
virtual void Remove (EDA_ITEM *aItem)
 
virtual void Remove (VIEW_ITEM *aItem)
 Remove an item from the group. More...
 
virtual void Clear () override
 Remove all the stored items from the group. More...
 
virtual unsigned int GetSize () const override
 Return the number of stored items. More...
 
virtual KIGFX::VIEW_ITEMGetItem (unsigned int aIdx) const override
 
bool Contains (EDA_ITEM *aItem) const
 
bool Empty () const
 Checks if there is anything selected. More...
 
int Size () const
 Returns the number of selected parts. More...
 
const std::deque< EDA_ITEM * > GetItems () const
 
EDA_ITEMGetLastAddedItem () const
 
const std::vector< EDA_ITEM * > GetItemsSortedByTypeAndXY (bool leftBeforeRight=true, bool topBeforeBottom=true) const
 Returns a copy of this selection of items sorted by their X then Y position. More...
 
const std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder () const
 
virtual VECTOR2I GetCenter () const
 Returns the center point of the selection area bounding box. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box for all stored items covering all its layers. More...
 
VECTOR2I GetPosition () const
 Returns the top left point of the selection area bounding box. More...
 
virtual BOX2I GetBoundingBox () const
 
EDA_ITEMoperator[] (const size_t aIdx) const
 
EDA_ITEMFront () const
 
std::deque< EDA_ITEM * > & Items ()
 
const std::deque< EDA_ITEM * > & Items () const
 
template<class T >
T * FirstOfKind () const
 
bool HasType (KICAD_T aType) const
 Checks if there is at least one item of requested kind. More...
 
size_t CountType (KICAD_T aType) const
 
bool HasReferencePoint () const
 
VECTOR2I GetReferencePoint () const
 
void SetReferencePoint (const VECTOR2I &aP)
 
void ClearReferencePoint ()
 
bool AreAllItemsIdentical () const
 Checks if all items in the selection are the same KICAD_T type. More...
 
bool OnlyContains (std::vector< KICAD_T > aList) const
 Checks if all items in the selection have a type in aList. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const override
 Draw all the stored items in the group on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return all the layers used by the stored items. More...
 
virtual void SetLayer (int aLayer)
 Set layer used to draw the group. More...
 
void FreeItems ()
 Free all the items that were added to the group. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Protected Attributes

std::optional< VECTOR2Im_referencePoint
 
std::deque< EDA_ITEM * > m_items
 
std::deque< int > m_itemsOrders
 
int m_orderCounter
 
EDA_ITEMm_lastAddedItem
 
bool m_isHover
 
int m_layer
 
std::vector< VIEW_ITEM * > m_groupItems
 

Private Attributes

VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Definition at line 31 of file pcb_selection.h.

Member Typedef Documentation

◆ CITER

using SELECTION::CITER = std::deque<EDA_ITEM*>::const_iterator
inherited

Definition at line 71 of file selection.h.

◆ ITER

using SELECTION::ITER = std::deque<EDA_ITEM*>::iterator
inherited

Definition at line 70 of file selection.h.

Member Function Documentation

◆ Add() [1/2]

void SELECTION::Add ( EDA_ITEM aItem)
virtualinherited

Definition at line 42 of file selection.cpp.

43{
44 // We're not sorting here; this is just a time-optimized way to do an
45 // inclusion check. std::lower_bound will return the first i >= aItem
46 // and the second i > aItem check rules out i == aItem.
47 ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
48
49 if( i == m_items.end() || *i > aItem )
50 {
51 m_itemsOrders.insert( m_itemsOrders.begin() + std::distance( m_items.begin(), i ),
53 m_items.insert( i, aItem );
55 m_lastAddedItem = aItem;
56 }
57}
std::deque< EDA_ITEM * > m_items
Definition: selection.h:285
int m_orderCounter
Definition: selection.h:287
std::deque< int > m_itemsOrders
Definition: selection.h:286
EDA_ITEM * m_lastAddedItem
Definition: selection.h:288
PTREE::iterator ITER
Definition: ptree.cpp:36
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)

References distance(), SELECTION::m_items, SELECTION::m_itemsOrders, SELECTION::m_lastAddedItem, and SELECTION::m_orderCounter.

Referenced by EE_GRID_HELPER::BestSnapAnchor(), PCB_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), ARRAY_CREATOR::Invoke(), SCH_MOVE_TOOL::Main(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_EDIT_TOOL::RepeatDrawItem(), and GERBVIEW_SELECTION_TOOL::select().

◆ Add() [2/2]

◆ AreAllItemsIdentical()

bool SELECTION::AreAllItemsIdentical ( ) const
inherited

Checks if all items in the selection are the same KICAD_T type.

Returns
True if all items are the same type, this includes zero or single items

Definition at line 181 of file selection.cpp.

182{
183 return ( std::all_of( m_items.begin() + 1, m_items.end(),
184 [&]( const EDA_ITEM* r )
185 {
186 return r->Type() == m_items.front()->Type();
187 } ) );
188}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85

References SELECTION::m_items.

◆ begin() [1/2]

ITER SELECTION::begin ( )
inlineinherited

Definition at line 73 of file selection.h.

73{ return m_items.begin(); }

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), and GetCurrentSelection().

◆ begin() [2/2]

CITER SELECTION::begin ( ) const
inlineinherited

Definition at line 75 of file selection.h.

75{ return m_items.cbegin(); }

References SELECTION::m_items.

◆ Clear()

◆ ClearReferencePoint()

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Contains()

bool SELECTION::Contains ( EDA_ITEM aItem) const
inherited

Definition at line 84 of file selection.cpp.

85{
86 CITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
87
88 return !( i == m_items.end() || *i > aItem );
89}
PTREE::const_iterator CITER
Definition: ptree.cpp:35

References SELECTION::m_items.

Referenced by EDIT_TOOL::FilletTracks(), PCB_EDIT_FRAME::RebuildAndRefresh(), and PCB_SELECTION_TOOL::select().

◆ CountType()

size_t SELECTION::CountType ( KICAD_T  aType) const
inherited

Definition at line 156 of file selection.cpp.

157{
158 size_t count = 0;
159
160 for( const EDA_ITEM* item : m_items )
161 {
162 if( item->IsType( { aType } ) )
163 count++;
164 }
165
166 return count;
167}

References SELECTION::m_items.

Referenced by EDIT_TOOL::Remove().

◆ Empty()

bool SELECTION::Empty ( ) const
inlineinherited

Checks if there is anything selected.

Definition at line 109 of file selection.h.

110 {
111 return m_items.empty();
112 }

References SELECTION::m_items.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::ChangeSymbols(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), ZONE_CREATE_HELPER::createNewZone(), CONVERT_TOOL::CreatePolys(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SELECTION_CONDITIONS::Empty(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), SELECTION_CONDITIONS::hasTypeFunc(), SELECTION_CONDITIONS::hasTypesFunc(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::onlyTypesFunc(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), GROUP_TOOL::PickNewMember(), POSITION_RELATIVE_TOOL::PositionRelative(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), PROPERTIES_PANEL::rebuildProperties(), GROUP_TOOL::RemoveFromGroup(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDIT_TOOL::Rotate(), PCB_SELECTION_CONDITIONS::sameLayerFunc(), PCB_SELECTION_CONDITIONS::sameNetFunc(), CLIPBOARD_IO::SaveSelection(), EE_SELECTION_TOOL::SelectConnection(), PCB_SELECTION_TOOL::selectCursor(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), EE_INSPECTION_TOOL::ShowDatasheet(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::unselect(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), PCB_CONTROL::UpdateMessagePanel(), and EDIT_TOOL::updateModificationPoint().

◆ end() [1/2]

ITER SELECTION::end ( )
inlineinherited

Definition at line 74 of file selection.h.

74{ return m_items.end(); }

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), and GetCurrentSelection().

◆ end() [2/2]

CITER SELECTION::end ( ) const
inlineinherited

Definition at line 76 of file selection.h.

76{ return m_items.cend(); }

References SELECTION::m_items.

◆ FirstOfKind()

template<class T >
T * SELECTION::FirstOfKind ( ) const
inlineinherited

Definition at line 224 of file selection.h.

225 {
226 for( auto item : m_items )
227 {
228 if( IsA<T, EDA_ITEM>( item ) )
229 return static_cast<T*> ( item );
230 }
231
232 return nullptr;
233 }

Referenced by BOARD_EDITOR_CONTROL::EditFpInFpEditor(), and GLOBAL_EDIT_TOOL::ExchangeFootprints().

◆ FreeItems()

void VIEW_GROUP::FreeItems ( )
inherited

Free all the items that were added to the group.

Definition at line 191 of file view_group.cpp.

192{
193 for( unsigned int i = 0 ; i < GetSize(); i++ )
194 delete GetItem( i );
195
196 Clear();
197}
virtual void Clear()
Remove all the stored items from the group.
Definition: view_group.cpp:69
virtual unsigned int GetSize() const
Return the number of stored items.
Definition: view_group.cpp:75
virtual VIEW_ITEM * GetItem(unsigned int aIdx) const
Definition: view_group.cpp:81

References KIGFX::VIEW_GROUP::Clear(), KIGFX::VIEW_GROUP::GetItem(), and KIGFX::VIEW_GROUP::GetSize().

Referenced by PNS_PCBNEW_DEBUG_DECORATOR::Clear(), PNS_KICAD_IFACE::EraseView(), PNS_KICAD_IFACE::SetView(), and PNS_KICAD_IFACE::~PNS_KICAD_IFACE().

◆ Front()

EDA_ITEM * SELECTION::Front ( ) const
inlineinherited

Definition at line 208 of file selection.h.

209 {
210 return m_items.size() ? m_items.front() : nullptr;
211 }

Referenced by PCB_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeSymbols(), SCH_EDIT_TOOL::CleanupSheetPins(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), CONVERT_TOOL::CreatePolys(), DRC_TOOL::CrossProbe(), PL_EDIT_TOOL::DoDelete(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::EditPageNumber(), EDIT_TOOL::Flip(), GERBVIEW_SELECTION::GetCenter(), SCH_FIND_REPLACE_TOOL::getCurrentMatch(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SYMBOL_EDITOR_PIN_TOOL::PushPinProperties(), PROPERTIES_PANEL::rebuildProperties(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), CLIPBOARD_IO::SaveSelection(), EE_SELECTION_TOOL::SelectConnection(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), EE_INSPECTION_TOOL::ShowDatasheet(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), and GERBVIEW_SELECTION::ViewBBox().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:352
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:63
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PROPERTIES_PANEL::getItemValue(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetBoundingBox()

BOX2I SELECTION::GetBoundingBox ( ) const
virtualinherited

Reimplemented in EE_SELECTION.

Definition at line 133 of file selection.cpp.

134{
135 BOX2I bbox;
136
137 for( EDA_ITEM* item : m_items )
138 bbox.Merge( item->GetBoundingBox() );
139
140 return bbox;
141}
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588

References SELECTION::m_items, and BOX2< Vec >::Merge().

Referenced by PCB_SELECTION_TOOL::doSyncSelection(), EDIT_TOOL::MoveExact(), and PCB_SELECTION_TOOL::zoomFitSelection().

◆ GetCenter()

VECTOR2I SELECTION::GetCenter ( ) const
virtualinherited

Returns the center point of the selection area bounding box.

Reimplemented in GERBVIEW_SELECTION.

Definition at line 93 of file selection.cpp.

94{
95 bool hasOnlyText = true;
96
97 // If the selection contains only texts calculate the center as the mean of all positions
98 // instead of using the center of the total bounding box. Otherwise rotating the selection will
99 // also translate it.
100
101 for( EDA_ITEM* item : m_items )
102 {
103 if( !item->IsType( { SCH_TEXT_T, SCH_LABEL_LOCATE_ANY_T } ) )
104 {
105 hasOnlyText = false;
106 break;
107 }
108 }
109
110 BOX2I bbox;
111
112 if( hasOnlyText )
113 {
114 VECTOR2I center( 0, 0 );
115
116 for( EDA_ITEM* item : m_items )
117 center += item->GetPosition();
118
119 center = center / static_cast<int>( m_items.size() );
120 return static_cast<VECTOR2I>( center );
121 }
122
123 for( EDA_ITEM* item : m_items )
124 {
125 if( !item->IsType( { SCH_TEXT_T, SCH_LABEL_LOCATE_ANY_T } ) )
126 bbox.Merge( item->GetBoundingBox() );
127 }
128
129 return static_cast<VECTOR2I>( bbox.GetCenter() );
130}
const Vec GetCenter() const
Definition: box2.h:195
@ SCH_LABEL_LOCATE_ANY_T
Definition: typeinfo.h:175
@ SCH_TEXT_T
Definition: typeinfo.h:150

References SELECTION::m_items, BOX2< Vec >::Merge(), SCH_LABEL_LOCATE_ANY_T, and SCH_TEXT_T.

Referenced by EDIT_TOOL::Flip(), ARRAY_CREATOR::Invoke(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), and EDIT_TOOL::updateModificationPoint().

◆ GetItem()

◆ GetItems()

◆ GetItemsSortedBySelectionOrder()

const std::vector< EDA_ITEM * > SELECTION::GetItemsSortedBySelectionOrder ( ) const
inherited

Definition at line 201 of file selection.cpp.

202{
203 using pairedIterators =
204 std::pair<decltype( m_items.begin() ), decltype( m_itemsOrders.begin() )>;
205
206 // Create a vector of all {selection item, selection order} iterator pairs
207 std::vector<pairedIterators> pairs;
208 auto item = m_items.begin();
209 auto order = m_itemsOrders.begin();
210
211 for( ; item != m_items.end(); ++item, ++order )
212 pairs.emplace_back( make_pair( item, order ) );
213
214 // Sort the pairs by the selection order
215 std::sort( pairs.begin(), pairs.end(),
216 []( pairedIterators const& a, pairedIterators const& b )
217 {
218 return *a.second < *b.second;
219 } );
220
221 // Make a vector of just the sortedItems
222 std::vector<EDA_ITEM*> sortedItems;
223
224 for( pairedIterators sortedItem : pairs )
225 sortedItems.emplace_back( *sortedItem.first );
226
227 return sortedItems;
228}

References SELECTION::m_items, and SELECTION::m_itemsOrders.

Referenced by EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::RouteSelected(), and SCH_EDIT_TOOL::Swap().

◆ GetItemsSortedByTypeAndXY()

const std::vector< EDA_ITEM * > SELECTION::GetItemsSortedByTypeAndXY ( bool  leftBeforeRight = true,
bool  topBeforeBottom = true 
) const
inlineinherited

Returns a copy of this selection of items sorted by their X then Y position.

Returns
Vector of sorted items

Definition at line 135 of file selection.h.

137 {
138 std::vector<EDA_ITEM*> sorted_items = std::vector<EDA_ITEM*>( m_items.begin(),
139 m_items.end() );
140
141 std::sort( sorted_items.begin(), sorted_items.end(),
142 [&]( EDA_ITEM* a, EDA_ITEM* b )
143 {
144 if( a->Type() == b->Type() )
145 {
146 if( a->GetSortPosition().x == b->GetSortPosition().x )
147 {
148 // Ensure deterministic sort
149 if( a->GetSortPosition().y == b->GetSortPosition().y )
150 return a->m_Uuid < b->m_Uuid;
151
152 if( topBeforeBottom )
153 return a->GetSortPosition().y < b->GetSortPosition().y;
154 else
155 return a->GetSortPosition().y > b->GetSortPosition().y;
156 }
157 else if( leftBeforeRight )
158 {
159 return a->GetSortPosition().x < b->GetSortPosition().x;
160 }
161 else
162 {
163 return a->GetSortPosition().x > b->GetSortPosition().x;
164 }
165 }
166 else
167 {
168 return a->Type() < b->Type();
169 }
170 } );
171
172 return sorted_items;
173 }

References SELECTION::m_items.

Referenced by SCH_MOVE_TOOL::Main().

◆ GetLastAddedItem()

EDA_ITEM * SELECTION::GetLastAddedItem ( ) const
inlineinherited

Definition at line 125 of file selection.h.

126 {
127 return m_lastAddedItem;
128 }

References SELECTION::m_lastAddedItem.

Referenced by BOARD_EDITOR_CONTROL::doCrossProbePcbToSch().

◆ GetPosition()

VECTOR2I SELECTION::GetPosition ( ) const
inlineinherited

Returns the top left point of the selection area bounding box.

Definition at line 188 of file selection.h.

189 {
190 return GetBoundingBox().GetPosition();
191 }
const Vec & GetPosition() const
Definition: box2.h:184
virtual BOX2I GetBoundingBox() const
Definition: selection.cpp:133

◆ GetReferencePoint()

VECTOR2I SELECTION::GetReferencePoint ( ) const
inlineinherited

◆ GetSelectionLayers()

const LSET PCB_SELECTION::GetSelectionLayers ( )

Definition at line 119 of file pcb_selection.cpp.

120{
121 LSET retval;
122
123 for( EDA_ITEM* item : m_items )
124 {
125 if( BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item ) )
126 retval |= board_item->GetLayerSet();
127 }
128
129 return retval;
130}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532

References SELECTION::m_items.

Referenced by EDIT_TOOL::doMoveSelection().

◆ GetSize()

◆ GetTopLeftItem()

EDA_ITEM * PCB_SELECTION::GetTopLeftItem ( bool  aFootprintsOnly = false) const
overridevirtual

Reimplemented from SELECTION.

Definition at line 51 of file pcb_selection.cpp.

52{
53 EDA_ITEM* topLeftItem = nullptr;
54
55 VECTOR2I pnt;
56
57 // find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item in the selection
58 for( EDA_ITEM* item : m_items )
59 {
60 pnt = item->GetPosition();
61
62 if( ( item->Type() != PCB_FOOTPRINT_T ) && aFootprintsOnly )
63 {
64 continue;
65 }
66 else
67 {
68 if( topLeftItem == nullptr )
69 {
70 topLeftItem = item;
71 }
72 else if( ( pnt.x < topLeftItem->GetPosition().x ) ||
73 ( ( topLeftItem->GetPosition().x == pnt.x ) &&
74 ( pnt.y < topLeftItem->GetPosition().y ) ) )
75 {
76 topLeftItem = item;
77 }
78 }
79 }
80
81 return topLeftItem;
82}
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86

References EDA_ITEM::GetPosition(), SELECTION::m_items, PCB_FOOTPRINT_T, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), and POSITION_RELATIVE_TOOL::PositionRelative().

◆ HasReferencePoint()

◆ HasType()

bool SELECTION::HasType ( KICAD_T  aType) const
inherited

Checks if there is at least one item of requested kind.

Parameters
aTypeis the type to check for.
Returns
True if there is at least one item of such kind.

Definition at line 144 of file selection.cpp.

145{
146 for( const EDA_ITEM* item : m_items )
147 {
148 if( item->IsType( { aType } ) )
149 return true;
150 }
151
152 return false;
153}

References SELECTION::m_items.

Referenced by POSITION_RELATIVE_TOOL::PositionRelative(), and EDIT_TOOL::Remove().

◆ IsHover()

◆ Items() [1/2]

◆ Items() [2/2]

const std::deque< EDA_ITEM * > & SELECTION::Items ( ) const
inlineinherited

Definition at line 218 of file selection.h.

219 {
220 return m_items;
221 }

◆ OnlyContains()

bool SELECTION::OnlyContains ( std::vector< KICAD_T aList) const
inherited

Checks if all items in the selection have a type in aList.

Returns
False if any item in the selection has a type not included in aList

Definition at line 191 of file selection.cpp.

192{
193 return ( std::all_of( m_items.begin(), m_items.end(),
194 [&]( const EDA_ITEM* r )
195 {
196 return r->IsType( aList );
197 } ) );
198}

References SELECTION::m_items.

Referenced by EE_GRID_HELPER::BestDragOrigin().

◆ operator==()

bool SELECTION::operator== ( const SELECTION aOther)
inherited

Definition at line 32 of file selection.cpp.

33{
34 return ( m_items == aOther.m_items
35 && m_itemsOrders == aOther.m_itemsOrders
36 && m_isHover == aOther.m_isHover
38 && m_orderCounter == aOther.m_orderCounter );
39}

References SELECTION::m_isHover, SELECTION::m_items, SELECTION::m_itemsOrders, SELECTION::m_lastAddedItem, and SELECTION::m_orderCounter.

◆ operator[]()

EDA_ITEM * SELECTION::operator[] ( const size_t  aIdx) const
inlineinherited

Definition at line 200 of file selection.h.

201 {
202 if( aIdx < m_items.size() )
203 return m_items[ aIdx ];
204
205 return nullptr;
206 }

◆ Remove() [1/2]

void SELECTION::Remove ( EDA_ITEM aItem)
virtualinherited

Definition at line 60 of file selection.cpp.

61{
62 ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
63
64 if( !( i == m_items.end() || *i > aItem ) )
65 {
66 m_itemsOrders.erase( m_itemsOrders.begin() + std::distance( m_items.begin(), i ) );
67 m_items.erase( i );
68
69 if( aItem == m_lastAddedItem )
70 m_lastAddedItem = nullptr;
71 }
72}

References distance(), SELECTION::m_items, SELECTION::m_itemsOrders, and SELECTION::m_lastAddedItem.

Referenced by DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::PlaceImportedGraphics(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), and GERBVIEW_SELECTION_TOOL::unselect().

◆ Remove() [2/2]

void VIEW_GROUP::Remove ( VIEW_ITEM aItem)
virtualinherited

Remove an item from the group.

Definition at line 63 of file view_group.cpp.

64{
66}
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
Definition: kicad_algo.h:164

References alg::delete_matching(), and KIGFX::VIEW_GROUP::m_groupItems.

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:325

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetIsHover()

◆ SetLayer()

virtual void KIGFX::VIEW_GROUP::SetLayer ( int  aLayer)
inlinevirtualinherited

Set layer used to draw the group.

Definition at line 98 of file view_group.h.

99 {
100 m_layer = aLayer;
101 }

References KIGFX::VIEW_GROUP::m_layer.

Referenced by SELECTION_TOOL::doSelectionMenu(), PNS_PCBNEW_DEBUG_DECORATOR::SetView(), and PNS_KICAD_IFACE::SetView().

◆ SetReferencePoint()

◆ Size()

int SELECTION::Size ( ) const
inlineinherited

Returns the number of selected parts.

Definition at line 115 of file selection.h.

116 {
117 return m_items.size();
118 }

References SELECTION::m_items.

Referenced by PCB_POINT_EDITOR::addCornerCondition(), EE_GRID_HELPER::BestDragOrigin(), ROUTER_TOOL::CanInlineDrag(), PAD_TOOL::copyPadSettings(), SELECTION_CONDITIONS::countFunc(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), PL_EDIT_TOOL::DoDelete(), PCB_SELECTION_TOOL::doSyncSelection(), EDIT_TOOL::DragArcTrack(), SCH_DRAWING_TOOLS::DrawSheet(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), PAD_TOOL::EditPad(), EDIT_TOOL::FilletTracks(), GERBVIEW_SELECTION::GetCenter(), DRAWING_TOOL::getSourceZoneForAction(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), ARRAY_CREATOR::Invoke(), SELECTION_CONDITIONS::lessThanFunc(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), SELECTION_CONDITIONS::moreThanFunc(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_CONTROL::placeBoardItems(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), PROPERTIES_PANEL::rebuildProperties(), ROUTER_TOOL::RouteSelected(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::selectAllConnectedTracks(), PCB_SELECTION_TOOL::selectNet(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), EDIT_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EE_SELECTION_TOOL::updateReferencePoint(), GERBVIEW_SELECTION::ViewBBox(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ updateDrawList()

const std::vector< KIGFX::VIEW_ITEM * > PCB_SELECTION::updateDrawList ( ) const
overridevirtual

Reimplemented from SELECTION.

Definition at line 85 of file pcb_selection.cpp.

86{
87 std::vector<VIEW_ITEM*> items;
88
89 std::function<void ( EDA_ITEM* )> addItem;
90 addItem = [&]( EDA_ITEM* item )
91 {
92 items.push_back( item );
93
94 if( item->Type() == PCB_FOOTPRINT_T )
95 {
96 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
97 footprint->RunOnChildren( [&]( BOARD_ITEM* bitem )
98 {
99 addItem( bitem );
100 } );
101 }
102 else if( item->Type() == PCB_GROUP_T )
103 {
104 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
105 group->RunOnChildren( [&]( BOARD_ITEM* bitem )
106 {
107 addItem( bitem );
108 } );
109 }
110 };
111
112 for( EDA_ITEM* item : m_items )
113 addItem( item );
114
115 return items;
116}
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:1393
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115

References group, SELECTION::m_items, PCB_FOOTPRINT_T, PCB_GROUP_T, and FOOTPRINT::RunOnChildren().

◆ ViewBBox()

virtual const BOX2I SELECTION::ViewBBox ( ) const
inlineoverridevirtualinherited

Return the bounding box for all stored items covering all its layers.

Reimplemented from KIGFX::VIEW_GROUP.

Reimplemented in GERBVIEW_SELECTION.

Definition at line 180 of file selection.h.

181 {
182 BOX2I r;
183 r.SetMaximum();
184 return r;
185 }
void SetMaximum()
Definition: box2.h:63

References BOX2< Vec >::SetMaximum().

◆ ViewDraw()

void VIEW_GROUP::ViewDraw ( int  aLayer,
VIEW aView 
) const
overridevirtualinherited

Draw all the stored items in the group on the given layer.

Parameters
aLayeris the layer which should be drawn.
aViewis the VIEW that should be used for drawing.

Reimplemented from KIGFX::VIEW_ITEM.

Definition at line 107 of file view_group.cpp.

108{
109 KIGFX::GAL* gal = aView->GetGAL();
110 PAINTER* painter = aView->GetPainter();
111 bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
112
113 const std::vector<VIEW_ITEM*> drawList = updateDrawList();
114
115 std::map<int, std::vector<VIEW_ITEM*>> layer_item_map;
116
117 // Build a list of layers used by the items in the group
118 for( VIEW_ITEM* item : drawList )
119 {
120 int item_layers[VIEW::VIEW_MAX_LAYERS], item_layers_count;
121 item->ViewGetLayers( item_layers, item_layers_count );
122
123 for( int i = 0; i < item_layers_count; i++ )
124 {
125 wxCHECK2_MSG( item_layers[i] <= LAYER_ID_COUNT, continue, wxT( "Invalid item layer" ) );
126 layer_item_map[ item_layers[i] ].push_back( item );
127 }
128 }
129
130 int layers[VIEW::VIEW_MAX_LAYERS] = { 0 };
131 int layers_count = 0;
132
133 for( const std::pair<const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
134 layers[ layers_count++ ] = entry.first;
135
136 aView->SortLayers( layers, layers_count );
137
138 // Now draw the layers in sorted order
139
140 gal->PushDepth();
141
142 for( int i = 0; i < layers_count; i++ )
143 {
144 int layer = layers[i];
145
146 if( IsZoneFillLayer( layer ) )
147 layer = layer - LAYER_ZONE_START;
148
149 bool draw = aView->IsLayerVisible( layer );
150
151 if( isSelection )
152 {
153 switch( layer )
154 {
155 case LAYER_PADS_TH:
158 case LAYER_PAD_FR:
159 case LAYER_PAD_BK:
160 draw = true;
161 break;
162 default:
163 break;
164 }
165 }
166
167 if( draw )
168 {
169 gal->AdvanceDepth();
170
171 for( VIEW_ITEM* item : layer_item_map[ layers[i] ] )
172 {
173 if( !painter->Draw( item, layers[i] ) )
174 item->ViewDraw( layers[i], aView ); // Alternative drawing method
175 }
176 }
177 }
178
179 gal->PopDepth();
180}
Abstract interface for drawing on a 2D-surface.
void AdvanceDepth()
Change the current depth to deeper, so it is possible to draw objects right beneath other.
void PushDepth()
Store current drawing depth on the depth stack.
void PopDepth()
Restore previously stored drawing depth for the depth stack.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:58
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer)=0
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
virtual const std::vector< VIEW_ITEM * > updateDrawList() const
Definition: view_group.cpp:200
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
void SortLayers(int aLayers[], int &aCount) const
Change the order of given layer ids, so after sorting the order corresponds to layers rendering order...
Definition: view.cpp:648
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195
static constexpr int VIEW_MAX_LAYERS
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:727
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:410
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:451
@ LAYER_PAD_FR
smd pads, front layer
Definition: layer_ids.h:202
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition: layer_ids.h:214
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:253
@ LAYER_PAD_BK
smd pads, back layer
Definition: layer_ids.h:203
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layer_ids.h:213
@ LAYER_SELECT_OVERLAY
currently selected items overlay
Definition: layer_ids.h:219
@ LAYER_PAD_HOLEWALLS
Definition: layer_ids.h:233
bool IsZoneFillLayer(int aLayer)
Definition: layer_ids.h:997

References KIGFX::GAL::AdvanceDepth(), KIGFX::PAINTER::Draw(), KIGFX::VIEW::GetGAL(), KIGFX::VIEW::GetPainter(), KIGFX::VIEW::IsLayerVisible(), IsZoneFillLayer(), LAYER_ID_COUNT, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PAD_HOLEWALLS, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, LAYER_SELECT_OVERLAY, LAYER_ZONE_START, KIGFX::VIEW_GROUP::m_layer, KIGFX::GAL::PopDepth(), KIGFX::GAL::PushDepth(), KIGFX::VIEW::SortLayers(), KIGFX::VIEW_GROUP::updateDrawList(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

◆ ViewGetLayers()

void VIEW_GROUP::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Return all the layers used by the stored items.

Parameters
aLayers[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Implements KIGFX::VIEW_ITEM.

Definition at line 183 of file view_group.cpp.

184{
185 // Everything is displayed on a single layer
186 aLayers[0] = m_layer;
187 aCount = 1;
188}

References KIGFX::VIEW_GROUP::m_layer.

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in SCH_LINE, GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

133 {
134 // By default always show the item
135 return 0.0;
136 }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ viewPrivData()

Member Data Documentation

◆ m_groupItems

◆ m_isHover

bool SELECTION::m_isHover
protectedinherited

◆ m_items

◆ m_itemsOrders

std::deque<int> SELECTION::m_itemsOrders
protectedinherited

◆ m_lastAddedItem

EDA_ITEM* SELECTION::m_lastAddedItem
protectedinherited

◆ m_layer

int KIGFX::VIEW_GROUP::m_layer
protectedinherited

◆ m_orderCounter

int SELECTION::m_orderCounter
protectedinherited

◆ m_referencePoint

std::optional<VECTOR2I> SELECTION::m_referencePoint
protectedinherited

Definition at line 284 of file selection.h.

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

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