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

Public Member Functions

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

Public Attributes

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

Detailed Description

Definition at line 817 of file view.cpp.

Constructor & Destructor Documentation

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

Definition at line 819 of file view.cpp.

819  :
820  view( aView ), layer( aLayer ),
821  useDrawPriority( aUseDrawPriority ),
822  reverseDrawOrder( aReverseDrawOrder )
823  {
824  }

Member Function Documentation

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

Definition at line 844 of file view.cpp.

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

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

845  {
846  if( reverseDrawOrder )
847  std::sort( drawItems.begin(), drawItems.end(),
848  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
849  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
850  });
851  else
852  std::sort( drawItems.begin(), drawItems.end(),
853  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
854  return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
855  });
856 
857  for( auto item : drawItems )
858  view->draw( item, layer );
859  }
friend class VIEW_ITEM
Definition: view.h:61
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:864
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:887
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

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

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

Member Data Documentation

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

Definition at line 864 of file view.cpp.

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

int KIGFX::VIEW::drawItem::layer

Definition at line 862 of file view.cpp.

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

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

Definition at line 862 of file view.cpp.

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 863 of file view.cpp.

Referenced by deferredDraw().

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 863 of file view.cpp.

Referenced by operator()().

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

Definition at line 861 of file view.cpp.

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


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