KiCad PCB EDA Suite
KIGFX::VIEW::drawItem Struct Reference

Public Member Functions

 drawItem (VIEW *aView, int aLayer, bool aUseDrawPriority)
 
bool operator() (VIEW_ITEM *aItem)
 
void deferredDraw ()
 

Public Attributes

VIEWview
 
int layer
 
int layers [VIEW_MAX_LAYERS]
 
bool useDrawPriority
 
std::vector< VIEW_ITEM * > drawItems
 

Detailed Description

Definition at line 827 of file view.cpp.

Constructor & Destructor Documentation

KIGFX::VIEW::drawItem::drawItem ( VIEW aView,
int  aLayer,
bool  aUseDrawPriority 
)
inline

Definition at line 829 of file view.cpp.

829  :
830  view( aView ), layer( aLayer ), useDrawPriority( aUseDrawPriority )
831  {
832  }

Member Function Documentation

void KIGFX::VIEW::drawItem::deferredDraw ( )
inline

Definition at line 852 of file view.cpp.

References KIGFX::VIEW::draw(), drawItems, layer, KIGFX::VIEW_ITEM_DATA::m_drawPriority, view, and KIGFX::VIEW_ITEM::viewPrivData().

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

853  {
854  std::sort( drawItems.begin(), drawItems.end(),
855  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
856  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
857  });
858 
859  for( auto item : drawItems )
860  view->draw( item, layer );
861  }
friend class VIEW_ITEM
Definition: view.h:61
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:866
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:889
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 834 of file view.cpp.

References KIGFX::VIEW::draw(), drawItems, KIGFX::VIEW_ITEM_DATA::isRenderable(), layer, KIGFX::VIEW::m_scale, useDrawPriority, view, KIGFX::VIEW_ITEM::ViewGetLOD(), and KIGFX::VIEW_ITEM::viewPrivData().

835  {
836  wxASSERT( aItem->viewPrivData() );
837 
838  // Conditions that have te be fulfilled for an item to be drawn
839  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
840  aItem->ViewGetLOD( layer, view ) < view->m_scale;
841  if( !drawCondition )
842  return true;
843 
844  if( useDrawPriority )
845  drawItems.push_back( aItem );
846  else
847  view->draw( aItem, layer );
848 
849  return true;
850  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:866
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:889
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:764

Member Data Documentation

std::vector<VIEW_ITEM*> KIGFX::VIEW::drawItem::drawItems

Definition at line 866 of file view.cpp.

Referenced by deferredDraw(), and operator()().

int KIGFX::VIEW::drawItem::layer

Definition at line 864 of file view.cpp.

Referenced by deferredDraw(), and operator()().

int KIGFX::VIEW::drawItem::layers[VIEW_MAX_LAYERS]

Definition at line 864 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 865 of file view.cpp.

Referenced by operator()().

VIEW* KIGFX::VIEW::drawItem::view

Definition at line 863 of file view.cpp.

Referenced by deferredDraw(), and operator()().


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