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

Constructor & Destructor Documentation

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

Definition at line 940 of file view.cpp.

940  :
941  view( aView ), layer( aLayer ),
942  useDrawPriority( aUseDrawPriority ),
943  reverseDrawOrder( aReverseDrawOrder )
944  {
945  }

Member Function Documentation

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

Definition at line 965 of file view.cpp.

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

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

966  {
967  if( reverseDrawOrder )
968  std::sort( drawItems.begin(), drawItems.end(),
969  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
970  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
971  });
972  else
973  std::sort( drawItems.begin(), drawItems.end(),
974  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
975  return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
976  });
977 
978  for( auto item : drawItems )
979  view->draw( item, layer );
980  }
friend class VIEW_ITEM
Definition: view.h:64
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:985
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1008
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 947 of file view.cpp.

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

948  {
949  wxASSERT( aItem->viewPrivData() );
950 
951  // Conditions that have to be fulfilled for an item to be drawn
952  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
953  aItem->ViewGetLOD( layer, view ) < view->m_scale;
954  if( !drawCondition )
955  return true;
956 
957  if( useDrawPriority )
958  drawItems.push_back( aItem );
959  else
960  view->draw( aItem, layer );
961 
962  return true;
963  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:985
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1008
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:813

Member Data Documentation

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

Definition at line 985 of file view.cpp.

int KIGFX::VIEW::drawItem::layer

Definition at line 983 of file view.cpp.

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

Definition at line 983 of file view.cpp.

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 984 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 984 of file view.cpp.

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

Definition at line 982 of file view.cpp.


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