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
 
EDA_RECT GetBoundingBox () const override
 
void SetScreen (SCH_SCREEN *aScreen)
 
SCH_SCREENGetScreen ()
 
void GetSymbols (SCH_REFERENCE_LIST &aReferences, const SCH_SHEET_PATH &aSelectionPath, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false)
 Adds SCH_REFERENCE object to aReferences for each symbol in the selection. More...
 
void GetMultiUnitSymbols (SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, const SCH_SHEET_PATH &aSelectionPath, bool aIncludePowerSymbols=true)
 Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the selection. More...
 
bool AllItemsHaveLineStroke () const
 Checks if all items in the selection support line strokes. More...
 
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
 
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 ()
 
template<class T >
T * FirstOfKind () const
 
bool HasType (KICAD_T aType) const
 Checks if there is at least one item of requested kind. More...
 
virtual const VIEW_GROUP::ITEMS updateDrawList () const override
 Layer on which the group is drawn. More...
 
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...
 
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)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Protected Types

typedef std::vector< VIEW_ITEM * > ITEMS
 

Protected Attributes

OPT< VECTOR2Im_referencePoint
 
std::deque< EDA_ITEM * > m_items
 
bool m_isHover
 
int m_layer
 Container for storing VIEW_ITEMs. More...
 
ITEMS m_groupItems
 

Private Attributes

SCH_SCREENm_screen
 Screen of selected objects. More...
 

Detailed Description

Definition at line 36 of file ee_selection.h.

Member Typedef Documentation

◆ CITER

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

Definition at line 61 of file selection.h.

◆ ITEMS

typedef std::vector<VIEW_ITEM*> KIGFX::VIEW_GROUP::ITEMS
protectedinherited

Definition at line 119 of file view_group.h.

◆ ITER

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

Definition at line 60 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:41
SELECTION()
Definition: selection.h:40

References m_screen.

Member Function Documentation

◆ Add() [1/2]

void VIEW_GROUP::Add ( VIEW_ITEM aItem)
virtualinherited

◆ Add() [2/2]

void SELECTION::Add ( EDA_ITEM aItem)
virtualinherited

Definition at line 31 of file selection.cpp.

32 {
33  // We're not sorting here; this is just a time-optimized way to do an
34  // inclusion check. std::lower_bound will return the first i >= aItem
35  // and the second i > aItem check rules out i == aItem.
36  ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
37 
38  if( i == m_items.end() || *i > aItem )
39  m_items.insert( i, aItem );
40 }
PTREE::iterator ITER
Definition: ptree.cpp:36
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by EE_GRID_HELPER::BestSnapAnchor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), SCH_EDIT_FRAME::FixupJunctions(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_EDIT_TOOL::RepeatDrawItem(), and GERBVIEW_SELECTION_TOOL::select().

◆ AllItemsHaveLineStroke()

bool EE_SELECTION::AllItemsHaveLineStroke ( ) const

Checks if all items in the selection support line strokes.

Returns
True if all items support line strokes

Definition at line 129 of file ee_selection.cpp.

130 {
131  for( const EDA_ITEM* item : m_items )
132  {
133  const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
134 
135  if( !schItem || !schItem->HasLineStroke() )
136  return false;
137  }
138 
139  return true;
140 }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
Definition: sch_item.h:458
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:193

References SCH_ITEM::HasLineStroke(), and SELECTION::m_items.

Referenced by SCH_EDIT_TOOL::Properties().

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

134 {
135  return ( std::all_of( m_items.begin() + 1, m_items.end(),
136  [&]( const EDA_ITEM* r )
137  {
138  return r->Type() == m_items.front()->Type();
139  } ) );
140 }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SELECTION::m_items.

Referenced by SCH_EDIT_TOOL::Properties().

◆ begin() [1/2]

ITER SELECTION::begin ( )
inlineinherited

Definition at line 63 of file selection.h.

63 { return m_items.begin(); }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), and EDIT_TOOL::FilletTracks().

◆ begin() [2/2]

CITER SELECTION::begin ( ) const
inlineinherited

Definition at line 65 of file selection.h.

65 { return m_items.cbegin(); }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

◆ Clear()

◆ ClearReferencePoint()

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Contains()

bool SELECTION::Contains ( EDA_ITEM aItem) const
inherited

Definition at line 61 of file selection.cpp.

62 {
63  CITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
64 
65  return !( i == m_items.end() || *i > aItem );
66 }
PTREE::const_iterator CITER
Definition: ptree.cpp:35
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

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

◆ Empty()

bool SELECTION::Empty ( ) const
inlineinherited

Checks if there is anything selected.

Definition at line 97 of file selection.h.

98  {
99  return m_items.empty();
100  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::ChangeSymbols(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), ZONE_CREATE_HELPER::createNewZone(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), BOARD_INSPECTION_TOOL::doHideNet(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SELECTION_CONDITIONS::Empty(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SELECTION_CONDITIONS::NotEmpty(), PCB_SELECTION_CONDITIONS::OnlyConnectedItems(), PCB_SELECTION_CONDITIONS::onlyGraphicShapeTypesFunc(), SELECTION_CONDITIONS::onlyTypeFunc(), SELECTION_CONDITIONS::onlyTypesFunc(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), GROUP_TOOL::PickNewMember(), POSITION_RELATIVE_TOOL::PositionRelative(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), EDIT_TOOL::Remove(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), EDIT_TOOL::Rotate(), PCB_SELECTION_CONDITIONS::sameLayerFunc(), PCB_SELECTION_CONDITIONS::sameNetFunc(), CLIPBOARD_IO::SaveSelection(), SCH_EDIT_FRAME::SaveSymbolToSchematic(), EE_SELECTION_TOOL::SelectConnection(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), EE_INSPECTION_TOOL::ShowDatasheet(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::unselect(), and BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest().

◆ end() [1/2]

ITER SELECTION::end ( )
inlineinherited

Definition at line 64 of file selection.h.

64 { return m_items.end(); }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), and EDIT_TOOL::FilletTracks().

◆ end() [2/2]

CITER SELECTION::end ( ) const
inlineinherited

Definition at line 66 of file selection.h.

66 { return m_items.cend(); }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

◆ FirstOfKind()

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

Definition at line 155 of file selection.h.

156  {
157  for( auto item : m_items )
158  {
159  if( IsA<T, EDA_ITEM>( item ) )
160  return static_cast<T*> ( item );
161  }
162 
163  return nullptr;
164  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

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 198 of file view_group.cpp.

199 {
200  for( unsigned int i = 0 ; i < GetSize(); i++ )
201  delete GetItem( i );
202 
203  Clear();
204 }
virtual void Clear()
Remove all the stored items from the group.
Definition: view_group.cpp:75
virtual VIEW_ITEM * GetItem(unsigned int aIdx) const
Definition: view_group.cpp:87
virtual unsigned int GetSize() const
Return the number of stored items.
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 144 of file selection.h.

145  {
146  return m_items.size() ? m_items.front() : nullptr;
147  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by PCB_POINT_EDITOR::addCornerCondition(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeSymbols(), SCH_EDIT_TOOL::CleanupSheetPins(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), PL_EDIT_TOOL::DoDelete(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), 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(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), DRAWING_TOOL::PlaceImportedGraphics(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_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(), SCH_DRAWING_TOOLS::SingleClickPlace(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), BUS_UNFOLD_MENU::update(), PCB_CONTROL::UpdateMessagePanel(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and GERBVIEW_SELECTION::ViewBBox().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
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  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ GetBoundingBox()

EDA_RECT EE_SELECTION::GetBoundingBox ( ) const
overridevirtual

Reimplemented from SELECTION.

Definition at line 64 of file ee_selection.cpp.

65 {
66  EDA_RECT bbox;
67 
68  for( EDA_ITEM* item : m_items )
69  {
70  if( item->Type() == SCH_SYMBOL_T )
71  {
72  // Quiet Coverity warning. The LIB_SYMBOL field container is a Boost ptr_vector
73  // so the exception is legit.
74  try
75  {
76  bbox.Merge( static_cast<SCH_SYMBOL*>( item )->GetBoundingBox( false ) );
77  }
78  catch( const boost::bad_pointer& exc )
79  {
80  wxFAIL_MSG( "Invalid pointer." );
81  }
82  }
83  else if( item->Type() == SCH_SHEET_T )
84  {
85  bbox.Merge( static_cast<SCH_SHEET*>( item )->GetBodyBoundingBox() );
86  }
87  else
88  {
89  bbox.Merge( item->GetBoundingBox() );
90  }
91  }
92 
93  return bbox;
94 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
EDA_RECT GetBoundingBox() const override
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SELECTION::m_items, EDA_RECT::Merge(), SCH_SHEET_T, and SCH_SYMBOL_T.

Referenced by EE_SELECTION_TOOL::Main().

◆ GetCenter()

VECTOR2I SELECTION::GetCenter ( ) const
virtualinherited

Returns the center point of the selection area bounding box.

Reimplemented in GERBVIEW_SELECTION.

Definition at line 70 of file selection.cpp.

71 {
73  bool includeLabels = true;
74 
75  // If the selection contains at least one non-label then don't include labels when
76  // calculating the centerpoint.
77 
78  for( EDA_ITEM* item : m_items )
79  {
80  if( !item->IsType( labelTypes ) )
81  {
82  includeLabels = false;
83  break;
84  }
85  }
86 
87  EDA_RECT bbox;
88 
89  for( EDA_ITEM* item : m_items )
90  {
91  if( !item->IsType( labelTypes ) || includeLabels )
92  bbox.Merge( item->GetBoundingBox() );
93  }
94 
95  return static_cast<VECTOR2I>( bbox.Centre() );
96 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
wxPoint Centre() const
Definition: eda_rect.h:55

References EDA_RECT::Centre(), EOT, SELECTION::m_items, EDA_RECT::Merge(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, and SCH_LABEL_T.

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

◆ GetItem()

◆ GetItems()

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

◆ GetMultiUnitSymbols()

void EE_SELECTION::GetMultiUnitSymbols ( SCH_MULTI_UNIT_REFERENCE_MAP aRefList,
const SCH_SHEET_PATH aSelectionPath,
bool  aIncludePowerSymbols = true 
)

Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the selection.

The map key for each element will be the reference designator.

Parameters
aRefListMap of reference designators to reference lists
aSelectionPathThe path to the sheet containing this selection.
aIncludePowerSymbolsSet to false to only get normal symbols.

Definition at line 114 of file ee_selection.cpp.

117 {
118  for( EDA_ITEM* item : Items() )
119  {
120  if( item->Type() != SCH_SYMBOL_T )
121  continue;
122 
123  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
124  aSelectionPath.AppendMultiUnitSymbol( aRefList, symbol, aIncludePowerSymbols );
125  }
126 }
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:149
void AppendMultiUnitSymbol(SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true) const
Append a SCH_REFERENCE_LIST object to aRefList based on aSymbol, storing same-reference set of multi-...
Schematic symbol object.
Definition: sch_symbol.h:78
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SCH_SHEET_PATH::AppendMultiUnitSymbol(), SELECTION::Items(), and SCH_SYMBOL_T.

◆ GetPosition()

VECTOR2I SELECTION::GetPosition ( ) const
inlineinherited

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

Definition at line 124 of file selection.h.

125  {
126  return static_cast<VECTOR2I>( GetBoundingBox().GetPosition() );
127  }
VECTOR2I GetPosition() const
Returns the top left point of the selection area bounding box.
Definition: selection.h:124
virtual EDA_RECT GetBoundingBox() const
Definition: selection.cpp:99

References SELECTION::GetBoundingBox().

◆ GetReferencePoint()

VECTOR2I SELECTION::GetReferencePoint ( ) const
inlineinherited

Definition at line 181 of file selection.h.

182  {
183  return *m_referencePoint;
184  }
OPT< VECTOR2I > m_referencePoint
Definition: selection.h:204

References SELECTION::m_referencePoint.

Referenced by EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Flip(), EDIT_TOOL::Mirror(), EDIT_TOOL::Rotate(), and CLIPBOARD_IO::SaveSelection().

◆ GetScreen()

SCH_SCREEN* EE_SELECTION::GetScreen ( )
inline

Definition at line 51 of file ee_selection.h.

51 { return m_screen; }
SCH_SCREEN * m_screen
Screen of selected objects.
Definition: ee_selection.h:41

References m_screen.

Referenced by SCH_SEXPR_PLUGIN::Format().

◆ GetSize()

◆ GetSymbols()

void EE_SELECTION::GetSymbols ( SCH_REFERENCE_LIST aReferences,
const SCH_SHEET_PATH aSelectionPath,
bool  aIncludePowerSymbols = true,
bool  aForceIncludeOrphanSymbols = false 
)

Adds SCH_REFERENCE object to aReferences for each symbol in the selection.

Parameters
aReferencesList of references to populate.
aSelectionPathThe path to the sheet containing this selection.
aIncludePowerSymbolsset to false to only get normal symbols.
aForceIncludeOrphanSymbolsset to true to include symbols having no symbol found in lib. The normal option is false, and set to true only to build the full list of symbols.

Definition at line 97 of file ee_selection.cpp.

101 {
102  for( EDA_ITEM* item : Items() )
103  {
104  if( item->Type() != SCH_SYMBOL_T )
105  continue;
106 
107  SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
108  aSelectionPath.AppendSymbol( aReferences, symbol, aIncludePowerSymbols,
109  aForceIncludeOrphanSymbols );
110  }
111 }
std::deque< EDA_ITEM * > & Items()
Definition: selection.h:149
void AppendSymbol(SCH_REFERENCE_LIST &aReferences, SCH_SYMBOL *aSymbol, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Append a SCH_REFERENCE object to aReferences based on aSymbol.
Schematic symbol object.
Definition: sch_symbol.h:78
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SCH_SHEET_PATH::AppendSymbol(), SELECTION::Items(), and SCH_SYMBOL_T.

Referenced by SCH_EDIT_FRAME::CheckAnnotate().

◆ 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* topLeftItem = nullptr;
43  wxPoint topLeftPos;
44 
45  // find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item
46  // in the selection
47  for( EDA_ITEM* item : m_items )
48  {
49  wxPoint pos = item->GetPosition();
50 
51  if( ( topLeftItem == nullptr )
52  || ( pos.x < topLeftPos.x )
53  || ( topLeftPos.x == pos.x && pos.y < topLeftPos.y ) )
54  {
55  topLeftItem = item;
56  topLeftPos = pos;
57  }
58  }
59 
60  return topLeftItem;
61 }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

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

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

◆ HasReferencePoint()

bool SELECTION::HasReferencePoint ( ) const
inlineinherited

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

111 {
112  for( auto item : m_items )
113  {
114  if( item->Type() == aType )
115  return true;
116  }
117 
118  return false;
119 }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by EDIT_TOOL::Remove().

◆ IsHover()

◆ Items()

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

Definition at line 149 of file selection.h.

150  {
151  return m_items;
152  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by GetMultiUnitSymbols(), GetSymbols(), and SCH_EDIT_TOOL::Properties().

◆ operator[]()

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

Definition at line 136 of file selection.h.

137  {
138  if( aIdx < m_items.size() )
139  return m_items[ aIdx ];
140 
141  return nullptr;
142  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

◆ Remove() [1/2]

void VIEW_GROUP::Remove ( VIEW_ITEM aItem)
virtualinherited

Remove an item from the group.

Parameters
aItemis the item to be removed.

Definition at line 62 of file view_group.cpp.

63 {
64  for( auto iter = m_groupItems.begin(); iter != m_groupItems.end(); ++iter )
65  {
66  if( aItem == *iter )
67  {
68  m_groupItems.erase( iter );
69  break;
70  }
71  }
72 }

References KIGFX::VIEW_GROUP::m_groupItems.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and BOARD_EDITOR_CONTROL::PlaceTarget().

◆ Remove() [2/2]

void SELECTION::Remove ( EDA_ITEM aItem)
virtualinherited

Definition at line 43 of file selection.cpp.

44 {
45  ITER i = std::lower_bound( m_items.begin(), m_items.end(), aItem );
46 
47  if( !( i == m_items.end() || *i > aItem ) )
48  m_items.erase( i );
49 }
PTREE::iterator ITER
Definition: ptree.cpp:36
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

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

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetIsHover()

◆ SetLayer()

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

Set layer used to draw the group.

Parameters
aLayeris the layer used for drawing.

Definition at line 108 of file view_group.h.

109  {
110  m_layer = aLayer;
111  }
int m_layer
Container for storing VIEW_ITEMs.
Definition: view_group.h:124

References KIGFX::VIEW_GROUP::m_layer.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), PNS_KICAD_IFACE::SetView(), and PNS_PCBNEW_DEBUG_DECORATOR::SetView().

◆ SetReferencePoint()

◆ SetScreen()

void EE_SELECTION::SetScreen ( SCH_SCREEN aScreen)
inline

Definition at line 50 of file ee_selection.h.

50 { m_screen = aScreen; }
SCH_SCREEN * m_screen
Screen of selected objects.
Definition: ee_selection.h:41

References m_screen.

◆ Size()

int SELECTION::Size ( ) const
inlineinherited

Returns the number of selected parts.

Definition at line 103 of file selection.h.

104  {
105  return m_items.size();
106  }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

Referenced by PCB_POINT_EDITOR::addCornerCondition(), ROUTER_TOOL::CanInlineDrag(), PAD_TOOL::copyPadSettings(), SELECTION_CONDITIONS::countFunc(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), PL_EDIT_TOOL::DoDelete(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), PAD_TOOL::EditPad(), PCB_SELECTION_TOOL::expandConnection(), 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_POINT_EDITOR::Main(), SELECTION_CONDITIONS::moreThanFunc(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_CONTROL::placeBoardItems(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::selectNet(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), EE_SELECTION_TOOL::updateReferencePoint(), GERBVIEW_SELECTION::ViewBBox(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ updateDrawList()

const KIGFX::VIEW_GROUP::ITEMS SELECTION::updateDrawList ( ) const
overridevirtualinherited

Layer on which the group is drawn.

Reimplemented from KIGFX::VIEW_GROUP.

Reimplemented in PCB_SELECTION.

Definition at line 122 of file selection.cpp.

123 {
124  std::vector<VIEW_ITEM*> items;
125 
126  for( auto item : m_items )
127  items.push_back( item );
128 
129  return items;
130 }
std::deque< EDA_ITEM * > m_items
Definition: selection.h:205

References SELECTION::m_items.

◆ ViewBBox()

virtual const BOX2I SELECTION::ViewBBox ( ) const
inlineoverridevirtualinherited

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

Returns
The current bounding box

Reimplemented from KIGFX::VIEW_GROUP.

Reimplemented in GERBVIEW_SELECTION.

Definition at line 116 of file selection.h.

117  {
118  BOX2I r;
119  r.SetMaximum();
120  return r;
121  }
A 2D bounding box built on top of an origin point and size vector.
Definition: box2.h:41
void SetMaximum()
Definition: box2.h:57

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 113 of file view_group.cpp.

114 {
115  KIGFX::GAL* gal = aView->GetGAL();
116  PAINTER* painter = aView->GetPainter();
117  bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
118 
119  const std::vector<VIEW_ITEM*> drawList = updateDrawList();
120 
121  std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
122 
123  // Build a list of layers used by the items in the group
124  for( VIEW_ITEM* item : drawList )
125  {
126  int item_layers[VIEW::VIEW_MAX_LAYERS], item_layers_count;
127  item->ViewGetLayers( item_layers, item_layers_count );
128 
129  for( int i = 0; i < item_layers_count; i++ )
130  {
131  if( layer_item_map.count( item_layers[i] ) == 0 )
132  {
133  layer_item_map.emplace( std::make_pair( item_layers[i],
134  std::vector<VIEW_ITEM*>() ) );
135  }
136 
137  layer_item_map[ item_layers[i] ].push_back( item );
138  }
139  }
140 
141  int layers[VIEW::VIEW_MAX_LAYERS] = { 0 };
142  int layers_count = 0;
143 
144  for( const std::pair<const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
145  layers[ layers_count++ ] = entry.first;
146 
147  aView->SortLayers( layers, layers_count );
148 
149  // Now draw the layers in sorted order
150 
151  gal->PushDepth();
152 
153  for( int i = 0; i < layers_count; i++ )
154  {
155  int layer = layers[i];
156  bool draw = aView->IsLayerVisible( layer );
157 
158  if( isSelection )
159  {
160  switch( layer )
161  {
162  case LAYER_PADS_TH:
164  case LAYER_PAD_HOLEWALLS:
165  case LAYER_PAD_FR:
166  case LAYER_PAD_BK:
167  draw = true;
168  break;
169  default:
170  break;
171  }
172  }
173 
174  if( draw )
175  {
176  gal->AdvanceDepth();
177 
178  for( VIEW_ITEM* item : layer_item_map[ layers[i] ] )
179  {
180  if( !painter->Draw( item, layers[i] ) )
181  item->ViewDraw( layers[i], aView ); // Alternative drawing method
182  }
183  }
184  }
185 
186  gal->PopDepth();
187 }
currently selected items overlay
Definition: layer_ids.h:214
smd pads, front layer
Definition: layer_ids.h:197
smd pads, back layer
Definition: layer_ids.h:198
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:81
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:726
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:656
virtual const ITEMS updateDrawList() const
Layer on which the group is drawn.
Definition: view_group.cpp:207
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
void PopDepth()
Restore previously stored drawing depth for the depth stack.
int m_layer
Container for storing VIEW_ITEMs.
Definition: view_group.h:124
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.
void PushDepth()
Store current drawing depth on the depth stack.
multilayer pads, usually with holes
Definition: layer_ids.h:208
to draw pad holes (plated)
Definition: layer_ids.h:209
void AdvanceDepth()
Change the current depth to deeper, so it is possible to draw objects right beneath other.
Abstract interface for drawing on a 2D-surface.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405

References KIGFX::GAL::AdvanceDepth(), KIGFX::PAINTER::Draw(), KIGFX::VIEW::GetGAL(), KIGFX::VIEW::GetPainter(), KIGFX::VIEW::IsLayerVisible(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PAD_HOLEWALLS, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, LAYER_SELECT_OVERLAY, 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 190 of file view_group.cpp.

191 {
192  // Everything is displayed on a single layer
193  aLayers[0] = m_layer;
194  aCount = 1;
195 }
int m_layer
Container for storing VIEW_ITEMs.
Definition: view_group.h:124

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 FP_ZONE, PAD, FOOTPRINT, PCB_VIA, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

Definition at line 137 of file view_item.h.

138  {
139  // By default always show the item
140  return 0.0;
141  }

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

◆ viewPrivData()

Member Data Documentation

◆ m_groupItems

◆ m_isHover

bool SELECTION::m_isHover
protectedinherited

◆ m_items

◆ m_layer

int KIGFX::VIEW_GROUP::m_layer
protectedinherited

Container for storing VIEW_ITEMs.

Definition at line 124 of file view_group.h.

Referenced by KIGFX::VIEW_GROUP::SetLayer(), KIGFX::VIEW_GROUP::ViewDraw(), and KIGFX::VIEW_GROUP::ViewGetLayers().

◆ m_referencePoint

OPT<VECTOR2I> SELECTION::m_referencePoint
protectedinherited

◆ m_screen

SCH_SCREEN* EE_SELECTION::m_screen
private

Screen of selected objects.

Used to fetch library symbols for copy.

Definition at line 41 of file ee_selection.h.

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


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