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 816 of file view.cpp.

Constructor & Destructor Documentation

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

Definition at line 818 of file view.cpp.

818  :
819  view( aView ), layer( aLayer ), useDrawPriority( aUseDrawPriority )
820  {
821  }

Member Function Documentation

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

Definition at line 841 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().

842  {
843  std::sort( drawItems.begin(), drawItems.end(),
844  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
845  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
846  });
847 
848  for( auto item : drawItems )
849  view->draw( item, layer );
850  }
friend class VIEW_ITEM
Definition: view.h:61
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:855
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:878
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 823 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().

824  {
825  wxASSERT( aItem->viewPrivData() );
826 
827  // Conditions that have te be fulfilled for an item to be drawn
828  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
829  aItem->ViewGetLOD( layer, view ) < view->m_scale;
830  if( !drawCondition )
831  return true;
832 
833  if( useDrawPriority )
834  drawItems.push_back( aItem );
835  else
836  view->draw( aItem, layer );
837 
838  return true;
839  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:855
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:878
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:758

Member Data Documentation

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

Definition at line 855 of file view.cpp.

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

int KIGFX::VIEW::drawItem::layer

Definition at line 853 of file view.cpp.

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

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

Definition at line 853 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 854 of file view.cpp.

Referenced by operator()().

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

Definition at line 852 of file view.cpp.

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


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