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

Constructor & Destructor Documentation

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

Definition at line 901 of file view.cpp.

901  :
902  view( aView ), layer( aLayer ),
903  useDrawPriority( aUseDrawPriority ),
904  reverseDrawOrder( aReverseDrawOrder )
905  {
906  }

Member Function Documentation

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

Definition at line 926 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::m_drawPriority, and KIGFX::VIEW_ITEM::viewPrivData().

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

927  {
928  if( reverseDrawOrder )
929  std::sort( drawItems.begin(), drawItems.end(),
930  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
931  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
932  });
933  else
934  std::sort( drawItems.begin(), drawItems.end(),
935  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
936  return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
937  });
938 
939  for( auto item : drawItems )
940  view->draw( item, layer );
941  }
friend class VIEW_ITEM
Definition: view.h:61
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:946
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:969
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 908 of file view.cpp.

References KIGFX::VIEW_ITEM_DATA::isRenderable(), KIGFX::VIEW_ITEM::ViewGetLOD(), and KIGFX::VIEW_ITEM::viewPrivData().

909  {
910  wxASSERT( aItem->viewPrivData() );
911 
912  // Conditions that have to be fulfilled for an item to be drawn
913  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
914  aItem->ViewGetLOD( layer, view ) < view->m_scale;
915  if( !drawCondition )
916  return true;
917 
918  if( useDrawPriority )
919  drawItems.push_back( aItem );
920  else
921  view->draw( aItem, layer );
922 
923  return true;
924  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:946
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:969
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:800

Member Data Documentation

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

Definition at line 946 of file view.cpp.

int KIGFX::VIEW::drawItem::layer

Definition at line 944 of file view.cpp.

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

Definition at line 944 of file view.cpp.

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 945 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 945 of file view.cpp.

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

Definition at line 943 of file view.cpp.


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