61 return wxT(
"VIEW_GROUP" );
108 bb.
Merge( item->ViewBBox() );
123 std::map<int, std::vector<VIEW_ITEM*>> layer_item_map;
131 std::vector<int> layers = item->ViewGetLayers();
133 for(
auto layer : layers )
135 wxCHECK2_MSG( layer <=
LAYER_ID_COUNT,
continue, wxT(
"Invalid item layer" ) );
136 layer_item_map[ layer ].push_back( item );
140 if( layer_item_map.empty() )
143 std::vector<int> layers;
144 layers.reserve( layer_item_map.size() );
146 for(
const std::pair<
const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
147 layers.push_back( entry.first );
155 for(
int layer : layers )
196 for(
VIEW_ITEM* item : layer_item_map[ layer ] )
200 if( item->ViewGetLOD( layer, aView ) ==
LOD_HIDE )
203 if( !painter->
Draw( item, layer ) )
204 item->ViewDraw( layer, aView );
220 for(
unsigned int i = 0 ; i <
GetSize(); i++ )
constexpr void SetMaximum()
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
void AdvanceDepth()
Change the current depth to deeper, so it is possible to draw objects right beneath other.
Contains all the knowledge about how to draw graphical object onto any particular output device.
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.
virtual void Clear()
Remove all the stored items from the group.
virtual unsigned int GetSize() const
Return the number of stored items.
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Draw all the stored items in the group on the given layer.
virtual VIEW_ITEM * GetItem(unsigned int aIdx) const
void FreeItems()
Free all the items that were added to the group.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
std::vector< VIEW_ITEM * > m_groupItems
wxString GetClass() const override
Return the class name.
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
VIEW_GROUP(VIEW *aView=nullptr)
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
virtual const std::vector< VIEW_ITEM * > updateDrawList() const
virtual const BOX2I ViewBBox() const override
Return the bounding box for all stored items covering all its layers.
An abstract base class for deriving all objects that can be added to a VIEW.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
bool IsHiddenOnOverlay(const VIEW_ITEM *aItem) const
void SortLayers(std::vector< int > &aLayers) const
Change the order of given layer ids, so after sorting the order corresponds to layers rendering order...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
bool IsPadCopperLayer(int aLayer)
#define LAYER_ID_COUNT
Must update this if you add any enums after Gerbview!
bool IsClearanceLayer(int aLayer)
@ LAYER_PAD_COPPER_START
Virtual layers for pad copper on a given copper layer.
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ LAYER_VIA_COPPER_START
Virtual layers for via copper on a given copper layer.
@ LAYER_CLEARANCE_START
Virtual layers for pad/via/track clearance outlines for a given copper layer.
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
@ LAYER_SELECT_OVERLAY
Selected items overlay.
bool IsViaCopperLayer(int aLayer)
bool IsZoneFillLayer(int aLayer)
The Cairo implementation of the graphics abstraction layer.