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

Constructor & Destructor Documentation

◆ drawItem()

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

Definition at line 960 of file view.cpp.

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

Member Function Documentation

◆ deferredDraw()

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

Definition at line 985 of file view.cpp.

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

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

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

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

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

◆ layer

int KIGFX::VIEW::drawItem::layer

Definition at line 1003 of file view.cpp.

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

◆ layers

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

Definition at line 1003 of file view.cpp.

◆ reverseDrawOrder

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 1004 of file view.cpp.

Referenced by deferredDraw().

◆ useDrawPriority

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 1004 of file view.cpp.

Referenced by operator()().

◆ view

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

Definition at line 1002 of file view.cpp.

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


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