KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::VIEW_GROUP Class Reference

Extend VIEW_ITEM by possibility of grouping items into a single object. More...

#include <view_group.h>

Inheritance diagram for KIGFX::VIEW_GROUP:
KIGFX::VIEW_ITEM INSPECTABLE SELECTION EE_SELECTION GERBVIEW_SELECTION PCB_SELECTION PL_SELECTION

Public Member Functions

 VIEW_GROUP (VIEW *aView=nullptr)
 
virtual ~VIEW_GROUP ()
 
virtual unsigned int GetSize () const
 Return the number of stored items.
 
virtual void Add (VIEW_ITEM *aItem)
 Add an item to the group.
 
virtual void Remove (VIEW_ITEM *aItem)
 Remove an item from the group.
 
virtual void Clear ()
 Remove all the stored items from the group.
 
virtual VIEW_ITEMGetItem (unsigned int aIdx) const
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box for all stored items covering all its layers.
 
virtual void ViewDraw (int aLayer, VIEW *aView) const override
 Draw all the stored items in the group on the given layer.
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return all the layers used by the stored items.
 
virtual void SetLayer (int aLayer)
 Set layer used to draw the group.
 
void FreeItems ()
 Free all the items that were added to the group.
 
bool IsSCH_ITEM () const
 
bool IsBOARD_ITEM () const
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item.
 
VIEW_ITEM_DATAviewPrivData () const
 
void SetForcedTransparency (double aForcedTransparency)
 
double GetForcedTransparency () const
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue, bool aNotify=true)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue, bool aNotify=true)
 
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 Member Functions

virtual const std::vector< VIEW_ITEM * > updateDrawList () const
 

Protected Attributes

int m_layer
 
std::vector< VIEW_ITEM * > m_groupItems
 

Private Attributes

bool m_isSCH_ITEM
 
bool m_isBOARD_ITEM
 
VIEW_ITEM_DATAm_viewPrivData
 
double m_forcedTransparency
 Additional transparency for diff'ing items.
 

Detailed Description

Extend VIEW_ITEM by possibility of grouping items into a single object.

VIEW_GROUP does not take over ownership of the held items. The main purpose of this class is to group items and draw them on a single layer (in particular the overlay).

Definition at line 47 of file view_group.h.

Constructor & Destructor Documentation

◆ VIEW_GROUP()

VIEW_GROUP::VIEW_GROUP ( VIEW aView = nullptr)

Definition at line 45 of file view_group.cpp.

◆ ~VIEW_GROUP()

VIEW_GROUP::~VIEW_GROUP ( )
virtual

Definition at line 52 of file view_group.cpp.

Member Function Documentation

◆ Add()

◆ Clear()

void VIEW_GROUP::Clear ( )
virtual

Remove all the stored items from the group.

Reimplemented in SELECTION.

Definition at line 70 of file view_group.cpp.

References m_groupItems.

Referenced by PCB_SELECTION_TOOL::ExitGroup(), FreeItems(), and PCB_SELECTION_TOOL::RebuildSelection().

◆ FreeItems()

◆ Get() [1/3]

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

◆ Get() [2/3]

◆ Get() [3/3]

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

◆ GetForcedTransparency()

double KIGFX::VIEW_ITEM::GetForcedTransparency ( ) const
inlineinherited

◆ GetItem()

VIEW_ITEM * VIEW_GROUP::GetItem ( unsigned int  aIdx) const
virtual

Reimplemented in SELECTION.

Definition at line 82 of file view_group.cpp.

References m_groupItems.

Referenced by KIGFX::VIEW::draw(), and FreeItems().

◆ GetSize()

unsigned int VIEW_GROUP::GetSize ( ) const
virtual

Return the number of stored items.

Reimplemented in SELECTION.

Definition at line 76 of file view_group.cpp.

References m_groupItems.

Referenced by KIGFX::VIEW::draw(), and FreeItems().

◆ IsBOARD_ITEM()

◆ IsSCH_ITEM()

bool KIGFX::VIEW_ITEM::IsSCH_ITEM ( ) const
inlineinherited

Definition at line 99 of file view_item.h.

◆ Remove()

void VIEW_GROUP::Remove ( VIEW_ITEM aItem)
virtual

Remove an item from the group.

Definition at line 64 of file view_group.cpp.

References alg::delete_matching(), and m_groupItems.

◆ Set() [1/3]

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

◆ Set() [2/3]

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

◆ Set() [3/3]

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

◆ SetForcedTransparency()

void KIGFX::VIEW_ITEM::SetForcedTransparency ( double  aForcedTransparency)
inlineinherited

◆ SetLayer()

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

Set layer used to draw the group.

Definition at line 99 of file view_group.h.

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

◆ updateDrawList()

const std::vector< VIEW_ITEM * > VIEW_GROUP::updateDrawList ( ) const
protectedvirtual

Reimplemented in EE_SELECTION, SELECTION, and PCB_SELECTION.

Definition at line 208 of file view_group.cpp.

References m_groupItems.

Referenced by ViewDraw().

◆ ViewBBox()

const BOX2I VIEW_GROUP::ViewBBox ( ) const
overridevirtual

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

Implements KIGFX::VIEW_ITEM.

Reimplemented in GERBVIEW_SELECTION, and SELECTION.

Definition at line 88 of file view_group.cpp.

References m_groupItems, BOX2< Vec >::Merge(), and BOX2< Vec >::SetMaximum().

◆ ViewDraw()

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

◆ ViewGetLayers()

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

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

References 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, FOOTPRINT, PAD, PCB_FIELD, PCB_GROUP, PCB_REFERENCE_IMAGE, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, and ZONE.

Definition at line 145 of file view_item.h.

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

◆ viewPrivData()

Member Data Documentation

◆ m_forcedTransparency

double KIGFX::VIEW_ITEM::m_forcedTransparency
privateinherited

Additional transparency for diff'ing items.

Definition at line 172 of file view_item.h.

Referenced by KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()().

◆ m_groupItems

std::vector<VIEW_ITEM*> KIGFX::VIEW_GROUP::m_groupItems
protected

Definition at line 114 of file view_group.h.

Referenced by Add(), Clear(), GetItem(), GetSize(), Remove(), updateDrawList(), and ViewBBox().

◆ m_isBOARD_ITEM

bool KIGFX::VIEW_ITEM::m_isBOARD_ITEM
privateinherited

Definition at line 170 of file view_item.h.

◆ m_isSCH_ITEM

bool KIGFX::VIEW_ITEM::m_isSCH_ITEM
privateinherited

Definition at line 169 of file view_item.h.

◆ m_layer

int KIGFX::VIEW_GROUP::m_layer
protected

Definition at line 113 of file view_group.h.

Referenced by ViewDraw(), and ViewGetLayers().

◆ m_viewPrivData


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