KiCad PCB EDA Suite
EE_SELECTION Class Reference

#include <ee_selection.h>

Inheritance diagram for EE_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

 EE_SELECTION (SCH_SCREEN *aScreen=nullptr)
 
EDA_ITEMGetTopLeftItem (bool onlyModules=false) const override
 
BOX2I GetBoundingBox () const override
 
void SetScreen (SCH_SCREEN *aScreen)
 
SCH_SCREENGetScreen ()
 
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...
 
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
 
virtual const std::vector< KIGFX::VIEW_ITEM * > updateDrawList () const override
 
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

SCH_SCREENm_screen
 Screen of selected objects. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Definition at line 37 of file ee_selection.h.

Member Typedef Documentation

◆ CITER

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

Definition at line 69 of file selection.h.

◆ ITER

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

Definition at line 68 of file selection.h.

Constructor & Destructor Documentation

◆ EE_SELECTION()

EE_SELECTION::EE_SELECTION ( SCH_SCREEN aScreen = nullptr)

Definition at line 33 of file ee_selection.cpp.

33 :
34 SELECTION()
35{
36 m_screen = aScreen;
37}
SCH_SCREEN * m_screen
Screen of selected objects.
Definition: ee_selection.h:42
SELECTION()
Definition: selection.h:40

References m_screen.

Member Function Documentation

◆ Add() [1/2]

void SELECTION::Add ( EDA_ITEM aItem)
virtualinherited

Definition at line 32 of file selection.cpp.

33{
34 // We're not sorting here; this is just a time-optimized way to do an
35 // inclusion check. std::lower_bound will return the first i >= aItem
36 // and the second i > aItem check rules out i == aItem.
37 ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
38
39 if( i == m_items.end() || *i > aItem )
40 {
41 m_itemsOrders.insert( m_itemsOrders.begin() + std::distance( m_items.begin(), i ),
43 m_items.insert( i, aItem );
45 m_lastAddedItem = aItem;
46 }
47}
std::deque< EDA_ITEM * > m_items
Definition: selection.h:277
int m_orderCounter
Definition: selection.h:279
std::deque< int > m_itemsOrders
Definition: selection.h:278
EDA_ITEM * m_lastAddedItem
Definition: selection.h:280
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_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), SCH_EDIT_FRAME::FixupJunctions(), 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]

void VIEW_GROUP::Add ( VIEW_ITEM aItem)
virtualinherited

Add an item to the group.

Definition at line 57 of file view_group.cpp.

58{
59 m_groupItems.push_back( aItem );
60}
std::vector< VIEW_ITEM * > m_groupItems
Definition: view_group.h:113

References KIGFX::VIEW_GROUP::m_groupItems.

Referenced by PNS_KICAD_IFACE::DisplayItem(), PNS_KICAD_IFACE::DisplayRatline(), PCB_TOOL_BASE::doInteractiveItemPlacement(), and PCB_SELECTION_TOOL::EnterGroup().

◆ 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 171 of file selection.cpp.

172{
173 return ( std::all_of( m_items.begin() + 1, m_items.end(),
174 [&]( const EDA_ITEM* r )
175 {
176 return r->Type() == m_items.front()->Type();
177 } ) );
178}
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
E_SERIE r
Definition: eserie.cpp:41

References SELECTION::m_items, and r.

◆ begin() [1/2]

ITER SELECTION::begin ( )
inlineinherited

Definition at line 71 of file selection.h.

71{ return m_items.begin(); }

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest().

◆ begin() [2/2]

CITER SELECTION::begin ( ) const
inlineinherited

Definition at line 73 of file selection.h.

73{ 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 74 of file selection.cpp.

75{
76 CITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
77
78 return !( i == m_items.end() || *i > aItem );
79}
PTREE::const_iterator CITER
Definition: ptree.cpp:35

References SELECTION::m_items.

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

◆ CountType()

size_t SELECTION::CountType ( KICAD_T  aType) const
inherited

Definition at line 146 of file selection.cpp.

147{
148 size_t count = 0;
149
150 for( const EDA_ITEM* item : m_items )
151 {
152 if( item->Type() == aType )
153 count++;
154 }
155
156 return count;
157}

References SELECTION::m_items.

Referenced by EDIT_TOOL::Remove().

◆ Empty()

bool SELECTION::Empty ( ) const
inlineinherited

Checks if there is anything selected.

Definition at line 107 of file selection.h.

108 {
109 return m_items.empty();
110 }

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(), 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(), PROPERTIES_PANEL::update(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), PCB_CONTROL::UpdateMessagePanel(), and EDIT_TOOL::updateModificationPoint().

◆ end() [1/2]

ITER SELECTION::end ( )
inlineinherited

Definition at line 72 of file selection.h.

72{ return m_items.end(); }

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest().

◆ end() [2/2]

CITER SELECTION::end ( ) const
inlineinherited

Definition at line 74 of file selection.h.

74{ return m_items.cend(); }

References SELECTION::m_items.

◆ FirstOfKind()

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

Definition at line 216 of file selection.h.

217 {
218 for( auto item : m_items )
219 {
220 if( IsA<T, EDA_ITEM>( item ) )
221 return static_cast<T*> ( item );
222 }
223
224 return nullptr;
225 }

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 200 of file selection.h.

201 {
202 return m_items.size() ? m_items.front() : nullptr;
203 }

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(), SCH_EDITOR_CONTROL::FindNext(), EDIT_TOOL::Flip(), GERBVIEW_SELECTION::GetCenter(), SCH_EDITOR_CONTROL::HasMatch(), 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(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SYMBOL_EDITOR_PIN_TOOL::PushPinProperties(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), 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(), EDIT_TOOL::Swap(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), PROPERTIES_PANEL::update(), 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:270
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:63
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
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:60
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42

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(), 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 EE_SELECTION::GetBoundingBox ( ) const
overridevirtual

Reimplemented from SELECTION.

Definition at line 85 of file ee_selection.cpp.

86{
87 BOX2I bbox;
88
89 for( EDA_ITEM* item : m_items )
90 {
91 if( item->Type() == SCH_SYMBOL_T )
92 {
93 // Quiet Coverity warning. The LIB_SYMBOL field container is a Boost ptr_vector
94 // so the exception is legit.
95 try
96 {
97 bbox.Merge( static_cast<SCH_SYMBOL*>( item )->GetBoundingBox() );
98 }
99 catch( const boost::bad_pointer& )
100 {
101 wxFAIL_MSG( "Invalid pointer." );
102 }
103 }
104 else if( item->Type() == SCH_SHEET_T )
105 {
106 bbox.Merge( static_cast<SCH_SHEET*>( item )->GetBodyBoundingBox() );
107 }
108 else
109 {
110 bbox.Merge( item->GetBoundingBox() );
111 }
112 }
113
114 return bbox;
115}
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
BOX2I GetBoundingBox() const override
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:55
Schematic symbol object.
Definition: sch_symbol.h:79
@ SCH_SYMBOL_T
Definition: typeinfo.h:155
@ SCH_SHEET_T
Definition: typeinfo.h:157

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

Referenced by SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), GetBoundingBox(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::SyncSelection(), and SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires().

◆ GetCenter()

VECTOR2I SELECTION::GetCenter ( ) const
virtualinherited

Returns the center point of the selection area bounding box.

Reimplemented in GERBVIEW_SELECTION.

Definition at line 83 of file selection.cpp.

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

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 202 of file selection.cpp.

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

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

Referenced by EDIT_TOOL::MoveIndividually(), ROUTER_TOOL::RouteSelected(), SCH_EDIT_TOOL::Swap(), and 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 133 of file selection.h.

135 {
136 std::vector<EDA_ITEM*> sorted_items = std::vector<EDA_ITEM*>( m_items.begin(),
137 m_items.end() );
138
139 std::sort( sorted_items.begin(), sorted_items.end(),
140 [&]( EDA_ITEM* a, EDA_ITEM* b )
141 {
142 if( a->Type() == b->Type() )
143 {
144 if( a->GetSortPosition().x == b->GetSortPosition().x )
145 {
146 // Ensure deterministic sort
147 if( a->GetSortPosition().y == b->GetSortPosition().y )
148 return a->m_Uuid < b->m_Uuid;
149
150 if( topBeforeBottom )
151 return a->GetSortPosition().y < b->GetSortPosition().y;
152 else
153 return a->GetSortPosition().y > b->GetSortPosition().y;
154 }
155 else if( leftBeforeRight )
156 return a->GetSortPosition().x < b->GetSortPosition().x;
157 else
158 return a->GetSortPosition().x > b->GetSortPosition().x;
159 }
160 else
161 return a->Type() < b->Type();
162 } );
163
164 return sorted_items;
165 }
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:111

References SELECTION::m_items, and EDA_ITEM::Type().

Referenced by SCH_MOVE_TOOL::Main().

◆ GetLastAddedItem()

EDA_ITEM * SELECTION::GetLastAddedItem ( ) const
inlineinherited

Definition at line 123 of file selection.h.

124 {
125 return m_lastAddedItem;
126 }

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 180 of file selection.h.

181 {
182 return GetBoundingBox().GetPosition();
183 }
const Vec & GetPosition() const
Definition: box2.h:184
virtual BOX2I GetBoundingBox() const
Definition: selection.cpp:123

◆ GetReferencePoint()

VECTOR2I SELECTION::GetReferencePoint ( ) const
inlineinherited

◆ GetScreen()

SCH_SCREEN * EE_SELECTION::GetScreen ( )
inline

Definition at line 52 of file ee_selection.h.

52{ return m_screen; }

References m_screen.

Referenced by SCH_SEXPR_PLUGIN::Format().

◆ GetSize()

◆ GetTopLeftItem()

EDA_ITEM * EE_SELECTION::GetTopLeftItem ( bool  onlyModules = false) const
overridevirtual

Reimplemented from SELECTION.

Definition at line 40 of file ee_selection.cpp.

41{
42 EDA_ITEM* topLeftConnectedItem = nullptr;
43 VECTOR2I topLeftConnectedPos;
44
45 EDA_ITEM* topLeftItem = nullptr;
46 VECTOR2I topLeftPos;
47
48 auto processItem =
49 []( EDA_ITEM* aItem, EDA_ITEM** aCurrent, VECTOR2I* aCurrentPos )
50 {
51 VECTOR2I pos = aItem->GetPosition();
52
53 if( ( *aCurrent == nullptr )
54 || ( pos.x < aCurrentPos->x )
55 || ( pos.x == aCurrentPos->x && pos.y < aCurrentPos->y ) )
56 {
57 *aCurrent = aItem;
58 *aCurrentPos = pos;
59 }
60 };
61
62 // Find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item
63 // in the selection
64
65 for( EDA_ITEM* item : m_items )
66 {
67 SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
68 LIB_PIN* lib_pin = dynamic_cast<LIB_PIN*>( item );
69
70 // Prefer connection points (which should remain on grid)
71
72 if( ( sch_item && sch_item->IsConnectable() ) || lib_pin )
73 processItem( item, &topLeftConnectedItem, &topLeftConnectedPos );
74
75 processItem( item, &topLeftItem, &topLeftPos );
76 }
77
78 if( topLeftConnectedItem )
79 return topLeftConnectedItem;
80 else
81 return topLeftItem;
82}
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:263
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual bool IsConnectable() const
Definition: sch_item.h:340

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

Referenced by SCH_EDITOR_CONTROL::Paste(), and EE_SELECTION_TOOL::updateReferencePoint().

◆ 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 134 of file selection.cpp.

135{
136 for( const EDA_ITEM* item : m_items )
137 {
138 if( item->Type() == aType )
139 return true;
140 }
141
142 return false;
143}

References SELECTION::m_items.

Referenced by EDIT_TOOL::Remove().

◆ IsHover()

◆ Items() [1/2]

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

Definition at line 205 of file selection.h.

206 {
207 return m_items;
208 }

Referenced by SCH_EDIT_TOOL::Properties().

◆ Items() [2/2]

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

Definition at line 210 of file selection.h.

211 {
212 return m_items;
213 }

◆ 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 181 of file selection.cpp.

182{
183 return ( std::all_of( m_items.begin(), m_items.end(),
184 [&]( const EDA_ITEM* r )
185 {
186 bool ok = false;
187
188 for( const KICAD_T& type : aList )
189 {
190 if( r->Type() == type )
191 {
192 ok = true;
193 break;
194 }
195 }
196
197 return ok;
198 } ) );
199}

References SELECTION::m_items, and r.

Referenced by EE_GRID_HELPER::BestDragOrigin().

◆ operator[]()

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

Definition at line 192 of file selection.h.

193 {
194 if( aIdx < m_items.size() )
195 return m_items[ aIdx ];
196
197 return nullptr;
198 }

◆ Remove() [1/2]

void SELECTION::Remove ( EDA_ITEM aItem)
virtualinherited

Definition at line 50 of file selection.cpp.

51{
52 ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
53
54 if( !( i == m_items.end() || *i > aItem ) )
55 {
56 m_itemsOrders.erase( m_itemsOrders.begin() + std::distance( m_items.begin(), i ) );
57 m_items.erase( i );
58
59 if( aItem == m_lastAddedItem )
60 m_lastAddedItem = nullptr;
61 }
62}

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

Referenced by DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), 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:263

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

◆ SetScreen()

void EE_SELECTION::SetScreen ( SCH_SCREEN aScreen)
inline

Definition at line 51 of file ee_selection.h.

51{ m_screen = aScreen; }

References m_screen.

◆ Size()

int SELECTION::Size ( ) const
inlineinherited

Returns the number of selected parts.

Definition at line 113 of file selection.h.

114 {
115 return m_items.size();
116 }

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(), PCB_SELECTION_TOOL::expandConnection(), EDIT_TOOL::FilletTracks(), GERBVIEW_SELECTION::GetCenter(), DRAWING_TOOL::getSourceZoneForAction(), BOARD::GroupLegalOps(), 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(), 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(), EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), PROPERTIES_PANEL::update(), 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 * > SELECTION::updateDrawList ( ) const
overridevirtualinherited

Reimplemented from KIGFX::VIEW_GROUP.

Reimplemented in PCB_SELECTION.

Definition at line 160 of file selection.cpp.

161{
162 std::vector<VIEW_ITEM*> items;
163
164 for( EDA_ITEM* item : m_items )
165 items.push_back( item );
166
167 return items;
168}

References SELECTION::m_items.

◆ 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 172 of file selection.h.

173 {
174 BOX2I r;
175 r.SetMaximum();
176 return r;
177 }

References r.

◆ 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( IsZoneLayer( 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:645
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:720
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
bool IsZoneLayer(int aLayer)
Definition: layer_ids.h:995
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:449
@ 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

References KIGFX::GAL::AdvanceDepth(), KIGFX::PAINTER::Draw(), KIGFX::VIEW::GetGAL(), KIGFX::VIEW::GetPainter(), KIGFX::VIEW::IsLayerVisible(), IsZoneLayer(), 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 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 276 of file selection.h.

◆ m_screen

SCH_SCREEN* EE_SELECTION::m_screen
private

Screen of selected objects.

Used to fetch library symbols for copy.

Definition at line 42 of file ee_selection.h.

Referenced by EE_SELECTION(), GetScreen(), and SetScreen().

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

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