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

Constructor & Destructor Documentation

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

Definition at line 830 of file view.cpp.

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

Member Function Documentation

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

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

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

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

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

Member Data Documentation

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

Definition at line 867 of file view.cpp.

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

int KIGFX::VIEW::drawItem::layer

Definition at line 865 of file view.cpp.

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

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

Definition at line 865 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 866 of file view.cpp.

Referenced by operator()().

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

Definition at line 864 of file view.cpp.

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


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