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

Public Member Functions

 VIEW_ITEM_DATA ()
 
 ~VIEW_ITEM_DATA ()
 
int GetFlags () const
 

Private Member Functions

int getGroup (int aLayer) const
 Return number of the group id for the given layer, or -1 in case it was not cached before.
 
void setGroup (int aLayer, int aGroup)
 Set a group id for the item and the layer combination.
 
void deleteGroups ()
 Remove all of the stored group ids.
 
bool storesGroups () const
 Return information if the item uses at least one group id (ie.
 
void reorderGroups (std::unordered_map< int, int > aReorderMap)
 Reorder the stored groups (to facilitate reordering of layers).
 
void saveLayers (const std::vector< int > &aLayers)
 Save layers used by the item.
 
int requiredUpdate () const
 Return current update flag for an item.
 
void clearUpdateFlags ()
 Mark an item as already updated, so it is not going to be redrawn.
 
bool isRenderable () const
 Return if the item should be drawn or not.
 

Private Attributes

VIEWm_view
 Current dynamic view the item is assigned to.
 
int m_flags
 Visibility flags.
 
int m_requiredUpdate
 Flag required for updating.
 
int m_drawPriority
 Order to draw this item in a layer, lowest first.
 
int m_cachedIndex
 Cached index in m_allItems.
 
std::pair< int, int > * m_groups
 layer_number:group_id pairs for each layer the item occupies.
 
int m_groupsSize
 
std::vector< int > m_layers
 
BOX2I m_bbox
 Stores layer numbers used by the item.
 

Friends

class VIEW
 

Detailed Description

Definition at line 52 of file view.cpp.

Constructor & Destructor Documentation

◆ VIEW_ITEM_DATA()

KIGFX::VIEW_ITEM_DATA::VIEW_ITEM_DATA ( )
inline

Definition at line 55 of file view.cpp.

◆ ~VIEW_ITEM_DATA()

KIGFX::VIEW_ITEM_DATA::~VIEW_ITEM_DATA ( )
inline

Definition at line 64 of file view.cpp.

References deleteGroups().

Member Function Documentation

◆ clearUpdateFlags()

void KIGFX::VIEW_ITEM_DATA::clearUpdateFlags ( )
inlineprivate

Mark an item as already updated, so it is not going to be redrawn.

Definition at line 198 of file view.cpp.

References m_requiredUpdate, and KIGFX::NONE.

Referenced by KIGFX::VIEW::invalidateItem(), and KIGFX::VIEW::Remove().

◆ deleteGroups()

void KIGFX::VIEW_ITEM_DATA::deleteGroups ( )
inlineprivate

Remove all of the stored group ids.

Forces recaching of the item.

Definition at line 129 of file view.cpp.

References m_groups, and m_groupsSize.

Referenced by KIGFX::VIEW::CLEAR_LAYER_CACHE_VISITOR::operator()(), KIGFX::VIEW::Remove(), and ~VIEW_ITEM_DATA().

◆ GetFlags()

int KIGFX::VIEW_ITEM_DATA::GetFlags ( ) const
inline

Definition at line 69 of file view.cpp.

References m_flags.

◆ getGroup()

int KIGFX::VIEW_ITEM_DATA::getGroup ( int  aLayer) const
inlineprivate

Return number of the group id for the given layer, or -1 in case it was not cached before.

Parameters
aLayeris the layer number for which group id is queried.
Returns
group id or -1 in case there is no group id (ie. item is not cached).

Definition at line 83 of file view.cpp.

References m_groups, and m_groupsSize.

Referenced by KIGFX::VIEW::draw(), KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), KIGFX::VIEW::UPDATE_DEPTH_VISITOR::operator()(), KIGFX::VIEW::RECACHE_ITEM_VISITOR::operator()(), KIGFX::VIEW::Remove(), KIGFX::VIEW::UpdateAllLayersColor(), KIGFX::VIEW::UpdateAllLayersOrder(), KIGFX::VIEW::updateItemColor(), KIGFX::VIEW::updateItemGeometry(), and KIGFX::VIEW::updateLayers().

◆ isRenderable()

bool KIGFX::VIEW_ITEM_DATA::isRenderable ( ) const
inlineprivate

Return if the item should be drawn or not.

Definition at line 206 of file view.cpp.

References m_flags, and KIGFX::VISIBLE.

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

◆ reorderGroups()

void KIGFX::VIEW_ITEM_DATA::reorderGroups ( std::unordered_map< int, int >  aReorderMap)
inlineprivate

Reorder the stored groups (to facilitate reordering of layers).

See also
VIEW::ReorderLayerData
Parameters
aReorderMapis the mapping of old to new layer ids

Definition at line 155 of file view.cpp.

References m_groups, and m_groupsSize.

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

◆ requiredUpdate()

int KIGFX::VIEW_ITEM_DATA::requiredUpdate ( ) const
inlineprivate

Return current update flag for an item.

Definition at line 190 of file view.cpp.

References m_requiredUpdate.

◆ saveLayers()

void KIGFX::VIEW_ITEM_DATA::saveLayers ( const std::vector< int > &  aLayers)
inlineprivate

Save layers used by the item.

Parameters
aLayersis an array containing layer numbers to be saved.
aCountis the size of the array.

Definition at line 175 of file view.cpp.

References m_layers, and KIGFX::VIEW::VIEW_MAX_LAYERS.

Referenced by KIGFX::VIEW::Add(), KIGFX::VIEW::ReorderLayerData(), and KIGFX::VIEW::updateLayers().

◆ setGroup()

void KIGFX::VIEW_ITEM_DATA::setGroup ( int  aLayer,
int  aGroup 
)
inlineprivate

Set a group id for the item and the layer combination.

Parameters
aLayeris the layer number.
aGroupis the group id.

Definition at line 100 of file view.cpp.

References m_groups, and m_groupsSize.

Referenced by KIGFX::VIEW::RECACHE_ITEM_VISITOR::operator()(), KIGFX::VIEW::updateItemGeometry(), and KIGFX::VIEW::updateLayers().

◆ storesGroups()

bool KIGFX::VIEW_ITEM_DATA::storesGroups ( ) const
inlineprivate

Return information if the item uses at least one group id (ie.

if it is cached at all).

Returns
true in case it is cached at least for one layer.

Definition at line 142 of file view.cpp.

References m_groupsSize.

Friends And Related Function Documentation

◆ VIEW

friend class VIEW
friend

Definition at line 75 of file view.cpp.

Member Data Documentation

◆ m_bbox

BOX2I KIGFX::VIEW_ITEM_DATA::m_bbox
private

Stores layer numbers used by the item.

Definition at line 223 of file view.cpp.

Referenced by KIGFX::VIEW::Add(), KIGFX::VIEW::Remove(), KIGFX::VIEW::updateBbox(), and KIGFX::VIEW::updateLayers().

◆ m_cachedIndex

int KIGFX::VIEW_ITEM_DATA::m_cachedIndex
private

Cached index in m_allItems.

Definition at line 215 of file view.cpp.

Referenced by KIGFX::VIEW::Add(), and KIGFX::VIEW::Remove().

◆ m_drawPriority

int KIGFX::VIEW_ITEM_DATA::m_drawPriority
private

Order to draw this item in a layer, lowest first.

Definition at line 214 of file view.cpp.

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

◆ m_flags

int KIGFX::VIEW_ITEM_DATA::m_flags
private

◆ m_groups

std::pair<int, int>* KIGFX::VIEW_ITEM_DATA::m_groups
private

layer_number:group_id pairs for each layer the item occupies.

Definition at line 217 of file view.cpp.

Referenced by deleteGroups(), getGroup(), reorderGroups(), and setGroup().

◆ m_groupsSize

int KIGFX::VIEW_ITEM_DATA::m_groupsSize
private

Definition at line 219 of file view.cpp.

Referenced by deleteGroups(), getGroup(), reorderGroups(), setGroup(), and storesGroups().

◆ m_layers

std::vector<int> KIGFX::VIEW_ITEM_DATA::m_layers
private

◆ m_requiredUpdate

int KIGFX::VIEW_ITEM_DATA::m_requiredUpdate
private

Flag required for updating.

Definition at line 213 of file view.cpp.

Referenced by clearUpdateFlags(), KIGFX::VIEW::ReorderLayerData(), requiredUpdate(), and KIGFX::VIEW::Update().

◆ m_view

VIEW* KIGFX::VIEW_ITEM_DATA::m_view
private

Current dynamic view the item is assigned to.

Definition at line 211 of file view.cpp.

Referenced by KIGFX::VIEW::Add(), KIGFX::VIEW::HasItem(), KIGFX::VIEW::OnDestroy(), and KIGFX::VIEW::Remove().


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