42 using namespace KIGFX;
100 bb.
Merge( item->ViewBBox() );
115 std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
121 item->ViewGetLayers( item_layers, item_layers_count );
123 for(
int i = 0; i < item_layers_count; i++ )
125 if( layer_item_map.count( item_layers[i] ) == 0 )
127 layer_item_map.emplace( std::make_pair( item_layers[i],
128 std::vector<VIEW_ITEM*>() ) );
131 layer_item_map[ item_layers[i] ].push_back( item );
136 int layers_count = 0;
138 for(
const std::pair<
const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
139 layers[ layers_count++ ] = entry.first;
147 for(
int i = 0; i < layers_count; i++ )
149 int layer = layers[i];
176 for(
VIEW_ITEM* item : layer_item_map[ layers[i] ] )
178 if( !painter->
Draw( item, layers[i] ) )
179 item->ViewDraw( layers[i], aView );
198 for(
unsigned int i = 0 ; i <
GetSize(); i++ )
currently selected items overlay
The Cairo implementation of the graphics abstraction layer.
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
VIEW_GROUP(VIEW *aView=nullptr)
virtual void Clear()
Remove all the stored items from the group.
An abstract base class for deriving all objects that can be added to a VIEW.
virtual VIEW_ITEM * GetItem(unsigned int aIdx) const
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Draw all the stored items in the group on the given layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
void SortLayers(int aLayers[], int &aCount) const
Change the order of given layer ids, so after sorting the order corresponds to layers rendering order...
virtual unsigned int GetSize() const
Return the number of stored items.
virtual const BOX2I ViewBBox() const override
Return the bounding box for all stored items covering all its layers.
Contains all the knowledge about how to draw graphical object onto any particular output device.
void FreeItems()
Free all the items that were added to the group.
void PopDepth()
Restore previously stored drawing depth for the depth stack.
Virtual layers for stacking zones and tracks on a given copper layer.
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
std::vector< VIEW_ITEM * > m_groupItems
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
virtual const std::vector< VIEW_ITEM * > updateDrawList() const
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer)=0
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
void PushDepth()
Store current drawing depth on the depth stack.
multilayer pads, usually with holes
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return all the layers used by the stored items.
to draw pad holes (plated)
bool IsZoneLayer(LAYER_NUM aLayer)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
void AdvanceDepth()
Change the current depth to deeper, so it is possible to draw objects right beneath other.
Abstract interface for drawing on a 2D-surface.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.