KiCad PCB EDA Suite
KIGFX::VIEW::DRAW_ITEM_VISITOR Struct Reference

Public Member Functions

 DRAW_ITEM_VISITOR (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 921 of file view.cpp.

Constructor & Destructor Documentation

◆ DRAW_ITEM_VISITOR()

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

Definition at line 923 of file view.cpp.

923 :
924 view( aView ),
925 layer( aLayer ),
926 useDrawPriority( aUseDrawPriority ),
927 reverseDrawOrder( aReverseDrawOrder )
928 {
929 }

Member Function Documentation

◆ deferredDraw()

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

Definition at line 949 of file view.cpp.

950 {
951 if( reverseDrawOrder )
952 {
953 std::sort( drawItems.begin(), drawItems.end(),
954 []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool
955 {
956 return b->viewPrivData()->m_drawPriority < a->viewPrivData()->m_drawPriority;
957 } );
958 }
959 else
960 {
961 std::sort( drawItems.begin(), drawItems.end(),
962 []( VIEW_ITEM* a, VIEW_ITEM* b ) -> bool
963 {
964 return a->viewPrivData()->m_drawPriority < b->viewPrivData()->m_drawPriority;
965 } );
966 }
967
968 for( VIEW_ITEM* item : drawItems )
969 view->draw( item, layer );
970 }
void draw(VIEW_ITEM *aItem, int aLayer, bool aImmediate=false)
Draw an item, but on a specified layers.
Definition: view.cpp:1012
friend class VIEW_ITEM
Definition: view.h:71
std::vector< VIEW_ITEM * > drawItems
Definition: view.cpp:975

References KIGFX::VIEW::draw(), drawItems, layer, reverseDrawOrder, and view.

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

◆ operator()()

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

Definition at line 931 of file view.cpp.

932 {
933 wxCHECK( aItem->viewPrivData(), false );
934
935 // Conditions that have to be fulfilled for an item to be drawn
936 bool drawCondition = aItem->viewPrivData()->isRenderable()
937 && aItem->ViewGetLOD( layer, view ) < view->m_scale;
938 if( !drawCondition )
939 return true;
940
941 if( useDrawPriority )
942 drawItems.push_back( aItem );
943 else
944 view->draw( aItem, layer );
945
946 return true;
947 }
double m_scale
Definition: view.h:848

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::DRAW_ITEM_VISITOR::drawItems

Definition at line 975 of file view.cpp.

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

◆ layer

int KIGFX::VIEW::DRAW_ITEM_VISITOR::layer

Definition at line 973 of file view.cpp.

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

◆ layers

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

Definition at line 973 of file view.cpp.

◆ reverseDrawOrder

bool KIGFX::VIEW::DRAW_ITEM_VISITOR::reverseDrawOrder

Definition at line 974 of file view.cpp.

Referenced by deferredDraw().

◆ useDrawPriority

bool KIGFX::VIEW::DRAW_ITEM_VISITOR::useDrawPriority

Definition at line 974 of file view.cpp.

Referenced by operator()().

◆ view

VIEW* KIGFX::VIEW::DRAW_ITEM_VISITOR::view

Definition at line 972 of file view.cpp.

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


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