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

Constructor & Destructor Documentation

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

Definition at line 949 of file view.cpp.

949  :
950  view( aView ), layer( aLayer ),
951  useDrawPriority( aUseDrawPriority ),
952  reverseDrawOrder( aReverseDrawOrder )
953  {
954  }

Member Function Documentation

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

Definition at line 974 of file view.cpp.

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

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

975  {
976  if( reverseDrawOrder )
977  std::sort( drawItems.begin(), drawItems.end(),
978  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
979  return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
980  });
981  else
982  std::sort( drawItems.begin(), drawItems.end(),
983  []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool {
984  return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
985  });
986 
987  for( auto item : drawItems )
988  view->draw( item, layer );
989  }
friend class VIEW_ITEM
Definition: view.h:64
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:994
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1017
bool KIGFX::VIEW::drawItem::operator() ( VIEW_ITEM aItem)
inline

Definition at line 956 of file view.cpp.

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

957  {
958  wxCHECK( aItem->viewPrivData(), false );
959 
960  // Conditions that have to be fulfilled for an item to be drawn
961  bool drawCondition = aItem->viewPrivData()->isRenderable() &&
962  aItem->ViewGetLOD( layer, view ) < view->m_scale;
963  if( !drawCondition )
964  return true;
965 
966  if( useDrawPriority )
967  drawItems.push_back( aItem );
968  else
969  view->draw( aItem, layer );
970 
971  return true;
972  }
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:994
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Function draw() Draws an item, but on a specified layers.
Definition: view.cpp:1017
double m_scale
Scale of displayed VIEW_ITEMs.
Definition: view.h:825

Member Data Documentation

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

Definition at line 994 of file view.cpp.

int KIGFX::VIEW::drawItem::layer

Definition at line 992 of file view.cpp.

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

Definition at line 992 of file view.cpp.

bool KIGFX::VIEW::drawItem::reverseDrawOrder

Definition at line 993 of file view.cpp.

bool KIGFX::VIEW::drawItem::useDrawPriority

Definition at line 993 of file view.cpp.

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

Definition at line 991 of file view.cpp.


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