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

Constructor & Destructor Documentation

◆ drawItem()

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

Definition at line 961 of file view.cpp.

961  :
962  view( aView ), layer( aLayer ),
963  useDrawPriority( aUseDrawPriority ),
964  reverseDrawOrder( aReverseDrawOrder )
965  {
966  }

Member Function Documentation

◆ deferredDraw()

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

Definition at line 986 of file view.cpp.

987  {
988  if( reverseDrawOrder )
989  std::sort( drawItems.begin(), drawItems.end(),
990  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
991  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
992  });
993  else
994  std::sort( drawItems.begin(), drawItems.end(),
995  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
996  return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
997  });
998 
999  for( auto item : drawItems )
1000  view->draw( item, layer );
1001  }
friend class VIEW_ITEM
Definition: view.h:64
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:1006
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1029

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

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

◆ operator()()

bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 968 of file view.cpp.

969  {
970  wxCHECK( aItem->viewPrivData(), false );
971 
972  // Conditions that have to be fulfilled for an item to be drawn
973  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
974  aItem->ViewGetLOD( layer, view ) < view->m_scale;
975  if( !drawCondition )
976  return true;
977 
978  if( useDrawPriority )
979  drawItems.push_back( aItem );
980  else
981  view->draw( aItem, layer );
982 
983  return true;
984  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:1006
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1029
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:827

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().

Member Data Documentation

◆ drawItems

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

Definition at line 1006 of file view.cpp.

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

◆ layer

int KIGFX::VIEW::drawItem::layer

Definition at line 1004 of file view.cpp.

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

◆ layers

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

Definition at line 1004 of file view.cpp.

◆ reverseDrawOrder

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 1005 of file view.cpp.

Referenced by deferredDraw().

◆ useDrawPriority

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 1005 of file view.cpp.

Referenced by operator()().

◆ view

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

Definition at line 1003 of file view.cpp.

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


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