mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Cleanup ViewGetLayers()
Old style c-array replaced with vector returns
This commit is contained in:
parent
838c3c2503
commit
9dfcb6a362
@ -69,24 +69,24 @@ const KIFONT::METRICS& DS_DRAW_ITEM_BASE::GetFontMetrics() const
|
||||
}
|
||||
|
||||
|
||||
void DS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> DS_DRAW_ITEM_BASE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 1;
|
||||
std::vector<int> layers( 1 );
|
||||
|
||||
DS_DATA_ITEM* dataItem = GetPeer();
|
||||
|
||||
if( !dataItem ) // No peer: this item is like a DS_DRAW_ITEM_PAGE
|
||||
if( m_peer == nullptr )
|
||||
{
|
||||
aLayers[0] = LAYER_DRAWINGSHEET;
|
||||
return;
|
||||
layers[0] = LAYER_DRAWINGSHEET;
|
||||
return layers;
|
||||
}
|
||||
|
||||
if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||
aLayers[0] = LAYER_DRAWINGSHEET_PAGE1;
|
||||
else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
|
||||
aLayers[0] = LAYER_DRAWINGSHEET_PAGEn;
|
||||
if( m_peer->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||
layers[0] = LAYER_DRAWINGSHEET_PAGE1;
|
||||
else if( m_peer->GetPage1Option() == SUBSEQUENT_PAGES )
|
||||
layers[0] = LAYER_DRAWINGSHEET_PAGEn;
|
||||
else
|
||||
aLayers[0] = LAYER_DRAWINGSHEET;
|
||||
layers[0] = LAYER_DRAWINGSHEET;
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,10 +147,10 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void DS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> DS_PROXY_VIEW_ITEM::ViewGetLayers() const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = LAYER_DRAWINGSHEET;
|
||||
std::vector<int> layer{ LAYER_DRAWINGSHEET };
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
||||
|
@ -280,11 +280,11 @@ const BOX2I EDA_ITEM::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void EDA_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> EDA_ITEM::ViewGetLayers() const
|
||||
{
|
||||
// Basic fallback
|
||||
aCount = 1;
|
||||
aLayers[0] = 0;
|
||||
std::vector<int> layers{ 1 };
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,10 +51,9 @@ const BOX2I ANCHOR_DEBUG::ViewBBox() const
|
||||
return bbox;
|
||||
}
|
||||
|
||||
void ANCHOR_DEBUG::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> ANCHOR_DEBUG::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
aCount = 1;
|
||||
return { LAYER_GP_OVERLAY };
|
||||
}
|
||||
|
||||
void ANCHOR_DEBUG::ClearAnchors()
|
||||
|
@ -157,8 +157,8 @@ void CONSTRUCTION_GEOM::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
}
|
||||
}
|
||||
|
||||
void CONSTRUCTION_GEOM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> CONSTRUCTION_GEOM::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
aCount = 1;
|
||||
std::vector<int> layers{ LAYER_GP_OVERLAY };
|
||||
return layers;
|
||||
}
|
@ -292,11 +292,10 @@ const BOX2I RULER_ITEM::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void RULER_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> RULER_ITEM::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = LAYER_SELECT_OVERLAY;
|
||||
aLayers[1] = LAYER_GP_OVERLAY;
|
||||
aCount = 2;
|
||||
std::vector<int> layers{ LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY };
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,12 +48,10 @@ void SIMPLE_OVERLAY_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void SIMPLE_OVERLAY_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SIMPLE_OVERLAY_ITEM::ViewGetLayers() const
|
||||
{
|
||||
static const int SelectionLayer = LAYER_GP_OVERLAY;
|
||||
|
||||
aLayers[0] = SelectionLayer;
|
||||
aCount = 1;
|
||||
std::vector<int> aLayers{ LAYER_GP_OVERLAY };
|
||||
return aLayers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,22 +74,6 @@ public:
|
||||
private:
|
||||
friend class VIEW;
|
||||
|
||||
/**
|
||||
* Return layer numbers used by the item.
|
||||
*
|
||||
* @param aLayers[]: output layer index array
|
||||
* @param aCount: number of layer indices in aLayers[]
|
||||
*/
|
||||
void getLayers( int* aLayers, int& aCount ) const
|
||||
{
|
||||
int* layersPtr = aLayers;
|
||||
|
||||
for( int layer : m_layers )
|
||||
*layersPtr++ = layer;
|
||||
|
||||
aCount = m_layers.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of the group id for the given layer, or -1 in case it was not cached before.
|
||||
*
|
||||
@ -188,16 +172,15 @@ private:
|
||||
* @param aLayers is an array containing layer numbers to be saved.
|
||||
* @param aCount is the size of the array.
|
||||
*/
|
||||
void saveLayers( int* aLayers, int aCount )
|
||||
void saveLayers( const std::vector<int>& aLayers )
|
||||
{
|
||||
m_layers.clear();
|
||||
|
||||
for( int i = 0; i < aCount; ++i )
|
||||
for( int layer : aLayers )
|
||||
{
|
||||
// this fires on some eagle board after PCB_IO_EAGLE::Load()
|
||||
wxASSERT( unsigned( aLayers[i] ) <= unsigned( VIEW::VIEW_MAX_LAYERS ) );
|
||||
|
||||
m_layers.push_back( aLayers[i] );
|
||||
wxCHECK2_MSG( layer >= 0 && layer < VIEW::VIEW_MAX_LAYERS, continue,
|
||||
wxT( "Invalid layer number" ) );
|
||||
m_layers.push_back( layer );
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,8 +299,6 @@ VIEW::~VIEW()
|
||||
|
||||
void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
|
||||
{
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
|
||||
if( aDrawPriority < 0 )
|
||||
aDrawPriority = m_nextDrawPriority++;
|
||||
|
||||
@ -334,17 +315,17 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
|
||||
aItem->m_viewPrivData->m_bbox = bbox;
|
||||
aItem->m_viewPrivData->m_cachedIndex = m_allItems->size();
|
||||
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
aItem->viewPrivData()->saveLayers( layers, layers_count );
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
aItem->viewPrivData()->saveLayers( layers );
|
||||
|
||||
m_allItems->push_back( aItem );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : layers )
|
||||
{
|
||||
wxCHECK2_MSG( layers[i] >= 0 && static_cast<unsigned>( layers[i] ) < m_layers.size(),
|
||||
wxCHECK2_MSG( layer >= 0 && static_cast<unsigned>( layer ) < m_layers.size(),
|
||||
continue, wxS( "Invalid layer" ) );
|
||||
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Insert( aItem, bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
}
|
||||
@ -399,18 +380,16 @@ void VIEW::Remove( VIEW_ITEM* aItem )
|
||||
}
|
||||
}
|
||||
|
||||
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
|
||||
aItem->m_viewPrivData->getLayers( layers, layers_count );
|
||||
const BOX2I* bbox = &aItem->m_viewPrivData->m_bbox;
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : aItem->m_viewPrivData->m_layers )
|
||||
{
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Remove( aItem, bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
|
||||
// Clear the GAL cache
|
||||
int prevGroup = aItem->m_viewPrivData->getGroup( layers[i] );
|
||||
int prevGroup = aItem->m_viewPrivData->getGroup( layer );
|
||||
|
||||
if( prevGroup >= 0 )
|
||||
m_gal->DeleteGroup( prevGroup );
|
||||
@ -684,31 +663,13 @@ int VIEW::GetLayerOrder( int aLayer ) const
|
||||
}
|
||||
|
||||
|
||||
void VIEW::SortLayers( int aLayers[], int& aCount ) const
|
||||
void VIEW::SortLayers( std::vector<int> aLayers ) const
|
||||
{
|
||||
int maxLay, maxOrd, maxIdx;
|
||||
|
||||
for( int i = 0; i < aCount; ++i )
|
||||
{
|
||||
maxLay = aLayers[i];
|
||||
maxOrd = GetLayerOrder( maxLay );
|
||||
maxIdx = i;
|
||||
|
||||
// Look for the max element in the range (j..aCount)
|
||||
for( int j = i; j < aCount; ++j )
|
||||
{
|
||||
if( maxOrd < GetLayerOrder( aLayers[j] ) )
|
||||
{
|
||||
maxLay = aLayers[j];
|
||||
maxOrd = GetLayerOrder( maxLay );
|
||||
maxIdx = j;
|
||||
}
|
||||
}
|
||||
|
||||
// Swap elements
|
||||
aLayers[maxIdx] = aLayers[i];
|
||||
aLayers[i] = maxLay;
|
||||
}
|
||||
std::sort( aLayers.begin(), aLayers.end(),
|
||||
[this]( int a, int b )
|
||||
{
|
||||
return GetLayerOrder( a ) < GetLayerOrder( b );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@ -739,10 +700,8 @@ void VIEW::ReorderLayerData( std::unordered_map<int, int> aReorderMap )
|
||||
if( !viewData )
|
||||
continue;
|
||||
|
||||
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
|
||||
|
||||
item->ViewGetLayers( layers, layers_count );
|
||||
viewData->saveLayers( layers, layers_count );
|
||||
std::vector<int> layers = item->ViewGetLayers();
|
||||
viewData->saveLayers( layers );
|
||||
|
||||
viewData->reorderGroups( aReorderMap );
|
||||
|
||||
@ -817,13 +776,10 @@ void VIEW::UpdateAllLayersColor()
|
||||
if( !viewData )
|
||||
continue;
|
||||
|
||||
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
|
||||
viewData->getLayers( layers, layers_count );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : viewData->m_layers )
|
||||
{
|
||||
const COLOR4D color = m_painter->GetSettings()->GetColor( item, layers[i] );
|
||||
int group = viewData->getGroup( layers[i] );
|
||||
const COLOR4D color = m_painter->GetSettings()->GetColor( item, layer );
|
||||
int group = viewData->getGroup( layer );
|
||||
|
||||
if( group >= 0 )
|
||||
m_gal->ChangeGroupColor( group, color );
|
||||
@ -953,15 +909,12 @@ void VIEW::UpdateAllLayersOrder()
|
||||
if( !viewData )
|
||||
continue;
|
||||
|
||||
int layers[VIEW::VIEW_MAX_LAYERS], layers_count;
|
||||
viewData->getLayers( layers, layers_count );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : viewData->m_layers )
|
||||
{
|
||||
int group = viewData->getGroup( layers[i] );
|
||||
int group = viewData->getGroup( layer );
|
||||
|
||||
if( group >= 0 )
|
||||
m_gal->ChangeGroupDepth( group, m_layers[layers[i]].renderingOrder );
|
||||
m_gal->ChangeGroupDepth( group, m_layers[layer].renderingOrder );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1109,17 +1062,15 @@ void VIEW::draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate )
|
||||
|
||||
void VIEW::draw( VIEW_ITEM* aItem, bool aImmediate )
|
||||
{
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
|
||||
// Sorting is needed for drawing order dependent GALs (like Cairo)
|
||||
SortLayers( layers, layers_count );
|
||||
SortLayers( layers );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : layers )
|
||||
{
|
||||
m_gal->SetLayerDepth( m_layers.at( layers[i] ).renderingOrder );
|
||||
draw( aItem, layers[i], aImmediate );
|
||||
m_gal->SetLayerDepth( m_layers.at( layer ).renderingOrder );
|
||||
draw( aItem, layer, aImmediate );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,24 +1229,21 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
|
||||
updateBbox( aItem );
|
||||
}
|
||||
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
|
||||
// Iterate through layers used by the item and recache it immediately
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : layers )
|
||||
{
|
||||
int layerId = layers[i];
|
||||
|
||||
if( IsCached( layerId ) )
|
||||
if( IsCached( layer ) )
|
||||
{
|
||||
if( aUpdateFlags & ( GEOMETRY | LAYERS | REPAINT ) )
|
||||
updateItemGeometry( aItem, layerId );
|
||||
updateItemGeometry( aItem, layer );
|
||||
else if( aUpdateFlags & COLOR )
|
||||
updateItemColor( aItem, layerId );
|
||||
updateItemColor( aItem, layer );
|
||||
}
|
||||
|
||||
// Mark those layers as dirty, so the VIEW will be refreshed
|
||||
MarkTargetDirty( m_layers[layerId].target );
|
||||
MarkTargetDirty( m_layers[layer].target );
|
||||
}
|
||||
|
||||
aItem->viewPrivData()->clearUpdateFlags();
|
||||
@ -1368,18 +1316,17 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer )
|
||||
|
||||
void VIEW::updateBbox( VIEW_ITEM* aItem )
|
||||
{
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
wxASSERT( aItem->m_viewPrivData ); //must have a viewPrivData
|
||||
|
||||
const BOX2I new_bbox = aItem->ViewBBox();
|
||||
const BOX2I* old_bbox = &aItem->m_viewPrivData->m_bbox;
|
||||
aItem->m_viewPrivData->m_bbox = new_bbox;
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : layers )
|
||||
{
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Remove( aItem, old_bbox );
|
||||
l.items->Insert( aItem, new_bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
@ -1390,25 +1337,23 @@ void VIEW::updateBbox( VIEW_ITEM* aItem )
|
||||
void VIEW::updateLayers( VIEW_ITEM* aItem )
|
||||
{
|
||||
VIEW_ITEM_DATA* viewData = aItem->viewPrivData();
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
|
||||
if( !viewData )
|
||||
return;
|
||||
|
||||
// Remove the item from previous layer set
|
||||
viewData->getLayers( layers, layers_count );
|
||||
const BOX2I* old_bbox = &aItem->m_viewPrivData->m_bbox;
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : aItem->m_viewPrivData->m_layers )
|
||||
{
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Remove( aItem, old_bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
|
||||
if( IsCached( l.id ) )
|
||||
{
|
||||
// Redraw the item from scratch
|
||||
int prevGroup = viewData->getGroup( layers[i] );
|
||||
int prevGroup = viewData->getGroup( layer );
|
||||
|
||||
if( prevGroup >= 0 )
|
||||
{
|
||||
@ -1422,12 +1367,12 @@ void VIEW::updateLayers( VIEW_ITEM* aItem )
|
||||
aItem->m_viewPrivData->m_bbox = new_bbox;
|
||||
|
||||
// Add the item to new layer set
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
viewData->saveLayers( layers, layers_count );
|
||||
std::vector<int> layers = aItem->ViewGetLayers();
|
||||
viewData->saveLayers( layers );
|
||||
|
||||
for( int i = 0; i < layers_count; i++ )
|
||||
for( int layer : layers )
|
||||
{
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Insert( aItem, new_bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
}
|
||||
@ -1510,7 +1455,6 @@ void VIEW::UpdateItems()
|
||||
if( ratio > 0.3 )
|
||||
{
|
||||
auto allItems = *m_allItems;
|
||||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
|
||||
// kill all Rtrees
|
||||
for( VIEW_LAYER& layer : m_layers )
|
||||
@ -1525,14 +1469,14 @@ void VIEW::UpdateItems()
|
||||
const BOX2I bbox = item->ViewBBox();
|
||||
item->m_viewPrivData->m_bbox = bbox;
|
||||
|
||||
item->ViewGetLayers( layers, layers_count );
|
||||
item->viewPrivData()->saveLayers( layers, layers_count );
|
||||
std::vector<int> layers = item->ViewGetLayers();
|
||||
item->viewPrivData()->saveLayers( layers );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
for( int layer : layers )
|
||||
{
|
||||
wxCHECK2_MSG( layers[i] >= 0 && static_cast<unsigned>( layers[i] ) < m_layers.size(),
|
||||
wxCHECK2_MSG( layer >= 0 && static_cast<unsigned>( layer ) < m_layers.size(),
|
||||
continue, wxS( "Invalid layer" ) );
|
||||
VIEW_LAYER& l = m_layers[layers[i]];
|
||||
VIEW_LAYER& l = m_layers[layer];
|
||||
l.items->Insert( item, bbox );
|
||||
MarkTargetDirty( l.target );
|
||||
}
|
||||
|
@ -122,35 +122,32 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
if( aView->IsHiddenOnOverlay( item ) )
|
||||
continue;
|
||||
|
||||
int item_layers[VIEW::VIEW_MAX_LAYERS], item_layers_count;
|
||||
item->ViewGetLayers( item_layers, item_layers_count );
|
||||
std::vector<int> layers = item->ViewGetLayers();
|
||||
|
||||
for( int i = 0; i < item_layers_count; i++ )
|
||||
for( auto layer : layers )
|
||||
{
|
||||
wxCHECK2_MSG( item_layers[i] <= LAYER_ID_COUNT, continue, wxT( "Invalid item layer" ) );
|
||||
layer_item_map[ item_layers[i] ].push_back( item );
|
||||
wxCHECK2_MSG( layer <= LAYER_ID_COUNT, continue, wxT( "Invalid item layer" ) );
|
||||
layer_item_map[ layer ].push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
int layers[VIEW::VIEW_MAX_LAYERS] = { 0 };
|
||||
int layers_count = 0;
|
||||
|
||||
for( const std::pair<const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
|
||||
layers[ layers_count++ ] = entry.first;
|
||||
|
||||
if( layers_count == 0 )
|
||||
if( layer_item_map.empty() )
|
||||
return;
|
||||
|
||||
aView->SortLayers( layers, layers_count );
|
||||
std::vector<int> layers;
|
||||
layers.reserve( layer_item_map.size() );
|
||||
|
||||
for( const std::pair<const int, std::vector<VIEW_ITEM*>>& entry : layer_item_map )
|
||||
layers.push_back( entry.first );
|
||||
|
||||
aView->SortLayers( layers );
|
||||
|
||||
// Now draw the layers in sorted order
|
||||
|
||||
GAL_SCOPED_ATTRS scopedAttrs( *gal, GAL_SCOPED_ATTRS::LAYER_DEPTH );
|
||||
|
||||
for( int i = 0; i < layers_count; i++ )
|
||||
for( int layer : layers )
|
||||
{
|
||||
int layer = layers[i];
|
||||
|
||||
if( IsZoneFillLayer( layer ) )
|
||||
layer = layer - LAYER_ZONE_START;
|
||||
|
||||
@ -173,26 +170,25 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
{
|
||||
gal->AdvanceDepth();
|
||||
|
||||
for( VIEW_ITEM* item : layer_item_map[ layers[i] ] )
|
||||
for( VIEW_ITEM* item : layer_item_map[ layer ] )
|
||||
{
|
||||
// Ignore LOD scale for selected items, but don't ignore things explicitly
|
||||
// hidden.
|
||||
if( item->ViewGetLOD( layer, aView ) == HIDE )
|
||||
continue;
|
||||
|
||||
if( !painter->Draw( item, layers[i] ) )
|
||||
item->ViewDraw( layers[i], aView ); // Alternative drawing method
|
||||
if( !painter->Draw( item, layer ) )
|
||||
item->ViewDraw( layer, aView ); // Alternative drawing method
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void VIEW_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> VIEW_GROUP::ViewGetLayers() const
|
||||
{
|
||||
// Everything is displayed on a single layer
|
||||
aLayers[0] = m_layer;
|
||||
aCount = 1;
|
||||
return { m_layer };
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,10 +308,9 @@ void VIEW_OVERLAY::ViewDraw( int aLayer, VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void VIEW_OVERLAY::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> VIEW_OVERLAY::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
aCount = 1;
|
||||
return { LAYER_GP_OVERLAY };
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,11 +205,9 @@ void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
||||
}
|
||||
|
||||
|
||||
void SCH_BITMAP::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_BITMAP::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = LAYER_DRAW_BITMAPS;
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_DRAW_BITMAPS, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
|
@ -151,13 +151,12 @@ void SCH_BUS_ENTRY_BASE::SwapData( SCH_ITEM* aItem )
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_BUS_ENTRY_BASE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 4;
|
||||
aLayers[0] = LAYER_DANGLING;
|
||||
aLayers[1] = Type() == SCH_BUS_BUS_ENTRY_T ? LAYER_BUS : LAYER_WIRE;
|
||||
aLayers[2] = LAYER_NET_COLOR_HIGHLIGHT;
|
||||
aLayers[3] = LAYER_SELECTION_SHADOWS;
|
||||
if( Type() == SCH_BUS_BUS_ENTRY_T )
|
||||
return { LAYER_BUS, LAYER_NET_COLOR_HIGHLIGHT, LAYER_SELECTION_SHADOWS };
|
||||
|
||||
return { LAYER_WIRE, LAYER_NET_COLOR_HIGHLIGHT, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
@ -555,11 +555,9 @@ COLOR4D SCH_FIELD::GetFieldColor() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_FIELD::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = GetDefaultLayer();
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return { GetDefaultLayer(), LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
m_lastResolvedColor = aField->m_lastResolvedColor;
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
SCH_LAYER_ID GetDefaultLayer() const;
|
||||
|
||||
|
@ -199,13 +199,10 @@ SYMBOL* SCH_ITEM::GetParentSymbol()
|
||||
}
|
||||
|
||||
|
||||
void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_ITEM::ViewGetLayers() const
|
||||
{
|
||||
// Basic fallback
|
||||
aCount = 3;
|
||||
aLayers[0] = LAYER_DEVICE;
|
||||
aLayers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -284,7 +284,7 @@ public:
|
||||
/**
|
||||
* Return the layers the item is drawn on (which may be more than its "home" layer)
|
||||
*/
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/**
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
|
@ -72,11 +72,9 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
|
||||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_JUNCTION::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = m_layer;
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return { m_layer, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
@ -899,14 +899,10 @@ std::vector<VECTOR2I> SCH_LABEL_BASE::GetConnectionPoints() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_LABEL_BASE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 5;
|
||||
aLayers[0] = LAYER_DANGLING;
|
||||
aLayers[1] = LAYER_DEVICE;
|
||||
aLayers[2] = LAYER_NETCLASS_REFS;
|
||||
aLayers[3] = LAYER_FIELDS;
|
||||
aLayers[4] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_DANGLING, LAYER_DEVICE, LAYER_NETCLASS_REFS, LAYER_FIELDS,
|
||||
LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
@ -1920,15 +1916,10 @@ bool SCH_GLOBALLABEL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* tok
|
||||
}
|
||||
|
||||
|
||||
void SCH_GLOBALLABEL::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_GLOBALLABEL::ViewGetLayers() const
|
||||
{
|
||||
aCount = 6;
|
||||
aLayers[0] = LAYER_DANGLING;
|
||||
aLayers[1] = LAYER_DEVICE;
|
||||
aLayers[2] = LAYER_INTERSHEET_REFS;
|
||||
aLayers[3] = LAYER_NETCLASS_REFS;
|
||||
aLayers[4] = LAYER_FIELDS;
|
||||
aLayers[5] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_GLOBLABEL, LAYER_DEVICE, LAYER_INTERSHEET_REFS,
|
||||
LAYER_NETCLASS_REFS, LAYER_FIELDS, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,7 +324,7 @@ public:
|
||||
bool IsDangling() const override { return m_isDangling; }
|
||||
void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
@ -545,7 +545,7 @@ public:
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
|
||||
|
||||
|
@ -188,14 +188,10 @@ void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
|
||||
#endif
|
||||
|
||||
|
||||
void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_LINE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 5;
|
||||
aLayers[0] = LAYER_DANGLING;
|
||||
aLayers[1] = m_layer;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
aLayers[3] = LAYER_NET_COLOR_HIGHLIGHT;
|
||||
aLayers[4] = LAYER_OP_VOLTAGES;
|
||||
return { LAYER_DANGLING, m_layer, LAYER_SELECTION_SHADOWS, LAYER_NET_COLOR_HIGHLIGHT,
|
||||
LAYER_OP_VOLTAGES };
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,7 +200,7 @@ public:
|
||||
|| ( style_a == LINE_STYLE::SOLID && style_b == LINE_STYLE::DEFAULT );
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -270,9 +270,9 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
|
||||
#endif
|
||||
|
||||
|
||||
void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_MARKER::ViewGetLayers() const
|
||||
{
|
||||
wxCHECK_RET( Schematic(), "No SCHEMATIC set for SCH_MARKER!" );
|
||||
wxCHECK2_MSG( Schematic(), return {}, "No SCHEMATIC set for SCH_MARKER!" );
|
||||
|
||||
// Don't display sheet-specific markers when SCH_SHEET_PATHs do not match
|
||||
std::shared_ptr<ERC_ITEM> ercItem = std::static_pointer_cast<ERC_ITEM>( GetRCItem() );
|
||||
@ -280,27 +280,27 @@ void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
if( ercItem->IsSheetSpecific()
|
||||
&& ( ercItem->GetSpecificSheetPath() != Schematic()->CurrentSheet() ) )
|
||||
{
|
||||
aCount = 0;
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
aCount = 2;
|
||||
std::vector<int> layers( 2 );
|
||||
|
||||
if( IsExcluded() )
|
||||
{
|
||||
aLayers[0] = LAYER_ERC_EXCLUSION;
|
||||
layers[0] = LAYER_ERC_EXCLUSION;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( Schematic()->ErcSettings().GetSeverity( m_rcItem->GetErrorCode() ) )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_ERC_ERR; break;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: aLayers[0] = LAYER_ERC_WARN; break;
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: layers[0] = LAYER_ERC_ERR; break;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: layers[0] = LAYER_ERC_WARN; break;
|
||||
}
|
||||
}
|
||||
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
layers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
wxString SerializeToString() const;
|
||||
static SCH_MARKER* DeserializeFromString( const SCH_SHEET_LIST& aSheetList, const wxString& data );
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
SCH_LAYER_ID GetColorLayer() const;
|
||||
|
||||
|
@ -79,11 +79,9 @@ const BOX2I SCH_NO_CONNECT::GetBoundingBox() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_NO_CONNECT::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = LAYER_NOCONNECT;
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_NOCONNECT, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
|
||||
|
@ -726,16 +726,9 @@ void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields,
|
||||
auto childOnLayer =
|
||||
[]( const SCH_ITEM& item, int layer )
|
||||
{
|
||||
int layers[512], layers_count;
|
||||
item.ViewGetLayers( layers, layers_count );
|
||||
std::vector<int> layers = item.ViewGetLayers();
|
||||
|
||||
for( int ii = 0; ii < layers_count; ++ii )
|
||||
{
|
||||
if( layers[ii] == layer )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return std::find( layers.begin(), layers.end(), layer ) != layers.end();
|
||||
};
|
||||
|
||||
for( const SCH_ITEM& item : drawnSymbol->GetDrawItems() )
|
||||
@ -2312,19 +2305,9 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed )
|
||||
|
||||
// Must check layer as fields are sometimes drawn by their parent rather than directly
|
||||
// from the view.
|
||||
int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
|
||||
int layers_count;
|
||||
bool foundLayer = false;
|
||||
std::vector<int> layers = aField->ViewGetLayers();
|
||||
|
||||
aField->ViewGetLayers( layers, layers_count );
|
||||
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
{
|
||||
if( layers[i] == aLayer )
|
||||
foundLayer = true;
|
||||
}
|
||||
|
||||
if( !foundLayer )
|
||||
if( std::find( layers.begin(), layers.end(), aLayer ) == layers.end() )
|
||||
return;
|
||||
|
||||
aLayer = aField->GetLayer();
|
||||
|
@ -1712,15 +1712,10 @@ const BOX2I SCH_PIN::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_PIN::ViewGetLayers() const
|
||||
{
|
||||
aCount = 6;
|
||||
aLayers[0] = LAYER_DANGLING;
|
||||
aLayers[1] = LAYER_DEVICE;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
aLayers[3] = LAYER_OP_CURRENTS;
|
||||
aLayers[4] = LAYER_PINNAM;
|
||||
aLayers[5] = LAYER_PINNUM;
|
||||
return { LAYER_DANGLING, LAYER_DEVICE, LAYER_SELECTION_SHADOWS,
|
||||
LAYER_OP_CURRENTS, LAYER_PINNAM, LAYER_PINNUM };
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||
const BOX2I GetBoundingBox() const override
|
||||
|
@ -57,12 +57,9 @@ EDA_ITEM* SCH_RULE_AREA::Clone() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_RULE_AREA::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_RULE_AREA::ViewGetLayers() const
|
||||
{
|
||||
aCount = 3;
|
||||
aLayers[0] = LAYER_RULE_AREAS;
|
||||
aLayers[1] = LAYER_NOTES_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_RULE_AREAS, LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
bool IsFilledForHitTesting() const override
|
||||
{
|
||||
|
@ -557,19 +557,22 @@ BITMAPS SCH_SHAPE::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_SHAPE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 3;
|
||||
aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : m_layer;
|
||||
std::vector<int> layers( 3 );
|
||||
|
||||
layers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : m_layer;
|
||||
|
||||
if( m_layer == LAYER_PRIVATE_NOTES )
|
||||
aLayers[1] = LAYER_NOTES_BACKGROUND;
|
||||
layers[1] = LAYER_NOTES_BACKGROUND;
|
||||
else if( m_layer == LAYER_DEVICE )
|
||||
aLayers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
layers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
else
|
||||
aLayers[1] = LAYER_NOTES_BACKGROUND;
|
||||
layers[1] = LAYER_NOTES_BACKGROUND;
|
||||
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
layers[2] = LAYER_SELECTION_SHADOWS;
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double Similarity( const SCH_ITEM& aOther ) const override;
|
||||
|
||||
|
@ -706,18 +706,11 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool /* aManual */ )
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_SHEET::ViewGetLayers() const
|
||||
{
|
||||
aCount = 8;
|
||||
aLayers[0] = LAYER_DANGLING; // Sheet pins are drawn by their parent sheet, so the
|
||||
// parent needs to draw to LAYER_DANGLING
|
||||
aLayers[1] = LAYER_HIERLABEL;
|
||||
aLayers[2] = LAYER_SHEETNAME;
|
||||
aLayers[3] = LAYER_SHEETFILENAME;
|
||||
aLayers[4] = LAYER_SHEETFIELDS;
|
||||
aLayers[5] = LAYER_SHEET;
|
||||
aLayers[6] = LAYER_SHEET_BACKGROUND;
|
||||
aLayers[7] = LAYER_SELECTION_SHADOWS;
|
||||
// Sheet pins are drawn by their parent sheet, so the parent needs to draw to LAYER_DANGLING
|
||||
return { LAYER_DANGLING, LAYER_HIERLABEL, LAYER_SHEETNAME, LAYER_SHEETFILENAME,
|
||||
LAYER_SHEETFIELDS, LAYER_SHEET, LAYER_SHEET_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -395,7 +395,7 @@ public:
|
||||
|
||||
bool operator <( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
VECTOR2I GetPosition() const override { return m_pos; }
|
||||
void SetPosition( const VECTOR2I& aPosition ) override;
|
||||
|
@ -407,12 +407,9 @@ BITMAPS SCH_TABLE::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_TABLE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 3;
|
||||
aLayers[0] = LAYER_NOTES;
|
||||
aLayers[1] = LAYER_NOTES_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
return { LAYER_NOTES, LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
|
@ -501,11 +501,12 @@ void SCH_TEXT::CalcEdit( const VECTOR2I& aPosition )
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SCH_TEXT::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : m_layer;
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
if( IsPrivate() )
|
||||
return { LAYER_PRIVATE_NOTES, LAYER_SELECTION_SHADOWS };
|
||||
|
||||
return { m_layer, LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
|
||||
bool IsReplaceable() const override { return true; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
|
||||
|
||||
|
@ -24,29 +24,25 @@
|
||||
#include <symbol.h>
|
||||
|
||||
|
||||
void SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> SYMBOL::ViewGetLayers() const
|
||||
{
|
||||
aCount = 0;
|
||||
|
||||
// Pins are drawn by their parent symbol, so the parent must draw to LAYER_DANGLING
|
||||
// Pins and op point currents are drawn by their parent symbol,
|
||||
// so the parent must draw to LAYER_DANGLING and LAYER_OP_CURRENTS
|
||||
if( Type() == SCH_SYMBOL_T )
|
||||
aLayers[aCount++] = LAYER_DANGLING;
|
||||
|
||||
// Same for operating point currents
|
||||
if( Type() == SCH_SYMBOL_T )
|
||||
aLayers[aCount++] = LAYER_OP_CURRENTS;
|
||||
|
||||
aLayers[aCount++] = LAYER_DEVICE;
|
||||
aLayers[aCount++] = LAYER_REFERENCEPART;
|
||||
aLayers[aCount++] = LAYER_VALUEPART;
|
||||
aLayers[aCount++] = LAYER_FIELDS;
|
||||
return { LAYER_DANGLING, LAYER_OP_CURRENTS, LAYER_DEVICE,
|
||||
LAYER_REFERENCEPART, LAYER_VALUEPART, LAYER_FIELDS,
|
||||
LAYER_DEVICE_BACKGROUND, LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
|
||||
// Library symbols must include LAYER_PRIVATE_NOTES
|
||||
if( Type() == LIB_SYMBOL_T )
|
||||
aLayers[aCount++] = LAYER_PRIVATE_NOTES;
|
||||
return { LAYER_DEVICE, LAYER_REFERENCEPART, LAYER_VALUEPART,
|
||||
LAYER_FIELDS, LAYER_PRIVATE_NOTES, LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_NOTES_BACKGROUND, LAYER_SELECTION_SHADOWS };
|
||||
|
||||
aLayers[aCount++] = LAYER_DEVICE_BACKGROUND;
|
||||
aLayers[aCount++] = LAYER_NOTES_BACKGROUND;
|
||||
aLayers[aCount++] = LAYER_SELECTION_SHADOWS;
|
||||
// This should never happen but if it does, return a reasonable default
|
||||
return { LAYER_DEVICE, LAYER_REFERENCEPART, LAYER_VALUEPART,
|
||||
LAYER_FIELDS, LAYER_DEVICE_BACKGROUND, LAYER_NOTES_BACKGROUND,
|
||||
LAYER_SELECTION_SHADOWS };
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
bool GetDNP() const { return m_DNP; }
|
||||
void SetDNP( bool aDNP ) { m_DNP = aDNP; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
protected:
|
||||
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to
|
||||
|
@ -963,12 +963,13 @@ void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
|
||||
#endif
|
||||
|
||||
|
||||
void GERBER_DRAW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> GERBER_DRAW_ITEM::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
std::vector<int> layers( 2 );
|
||||
layers[0] = GERBER_DRAW_LAYER( GetLayer() );
|
||||
layers[1] = GERBER_DCODE_LAYER( layers[0] );
|
||||
|
||||
aLayers[0] = GERBER_DRAW_LAYER( GetLayer() );
|
||||
aLayers[1] = GERBER_DCODE_LAYER( aLayers[0] );
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
#endif
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewBBox()
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
@ -398,7 +398,7 @@ public:
|
||||
*/
|
||||
wxString GetLayerName() const;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/**
|
||||
* Convert the item shape to a closed polygon. Circles and arcs are approximated by segments.
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
DS_DATA_ITEM* GetPeer() const { return m_peer; }
|
||||
int GetIndexInPeer() const { return m_index; }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
virtual void SetEnd( const VECTOR2I& aPos ) { /* not all types will need this */ }
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
/// @copydoc EDA_ITEM::Show()
|
||||
|
@ -439,7 +439,7 @@ public:
|
||||
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
virtual EMBEDDED_FILES* GetEmbeddedFiles() { return nullptr; }
|
||||
|
||||
|
@ -151,6 +151,14 @@ public:
|
||||
{
|
||||
return Contains( m_start, m_stop, aTest_layer );
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
if( m_start == B_Cu )
|
||||
return m_layer_count;
|
||||
else
|
||||
return ( m_stop - m_start ) / 2 + 1;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // LAYER_RANGE_H
|
@ -59,10 +59,9 @@ public:
|
||||
|
||||
void ViewDraw( int aLayer, VIEW* aView ) const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
aCount = 1;
|
||||
return { LAYER_GP_OVERLAY };
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
#include <origin_viewitem.h>
|
||||
|
||||
@ -47,7 +48,7 @@ public:
|
||||
|
||||
ANCHOR_DEBUG* Clone() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
|
@ -44,11 +44,10 @@ namespace PREVIEW
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_SELECT_OVERLAY; // Assistant graphics
|
||||
aLayers[1] = LAYER_GP_OVERLAY; // Drop shadows
|
||||
aCount = 2;
|
||||
return { LAYER_SELECT_OVERLAY, // Assistant graphics
|
||||
LAYER_GP_OVERLAY }; // Drop shadows
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,11 +42,10 @@ namespace PREVIEW
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_SELECT_OVERLAY; // Assistant graphics
|
||||
aLayers[1] = LAYER_GP_OVERLAY; // Drop shadows
|
||||
aCount = 2;
|
||||
return { LAYER_SELECT_OVERLAY, // Assistant graphics
|
||||
LAYER_GP_OVERLAY }; // Drop shadows
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
void ViewDraw( int aLayer, VIEW* aView ) const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
|
||||
void SetPersistentColor( const COLOR4D& aColor ) { m_persistentColor = aColor; }
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::ViewGetLayers()
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::ViewDraw();
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
* Set the overlay layer only. You can override this if
|
||||
* you have more layers to draw on.
|
||||
*/
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/**
|
||||
* Draw the preview - this is done by calling the two functions:
|
||||
|
@ -55,11 +55,10 @@ public:
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_SELECT_OVERLAY; // Assistant graphics
|
||||
aLayers[1] = LAYER_GP_OVERLAY; // Drop shadows
|
||||
aCount = 2;
|
||||
return { LAYER_SELECT_OVERLAY, // Assistant graphics
|
||||
LAYER_GP_OVERLAY }; // Drop shadows
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -551,10 +551,9 @@ public:
|
||||
virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
virtual std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = LAYER_GP_OVERLAY ;
|
||||
return { LAYER_GP_OVERLAY };
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
@ -502,9 +502,8 @@ public:
|
||||
* the top).
|
||||
*
|
||||
* @param aLayers stores id of layers to be sorted.
|
||||
* @param aCount stores the number of layers.
|
||||
*/
|
||||
void SortLayers( int aLayers[], int& aCount ) const;
|
||||
void SortLayers( std::vector<int> aLayers ) const;
|
||||
|
||||
/**
|
||||
* Remap the data between layer ids without invalidating that data.
|
||||
|
@ -85,13 +85,8 @@ public:
|
||||
*/
|
||||
virtual void ViewDraw( int aLayer, VIEW* aView ) const override;
|
||||
|
||||
/**
|
||||
* Return all the layers used by the stored items.
|
||||
*
|
||||
* @param aLayers[] is the output layer index array.
|
||||
* @param aCount is the number of layer indices in aLayers[].
|
||||
*/
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
///@copydoc VIEW_ITEM::ViewGetLayers
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/**
|
||||
* Set layer used to draw the group.
|
||||
|
@ -125,11 +125,8 @@ public:
|
||||
* For instance, a #PAD spans zero or more copper layers and a few technical layers.
|
||||
* ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned
|
||||
* by ViewGetLayers(), depending on the rendering order.
|
||||
*
|
||||
* @param aLayers[] is the output layer index array.
|
||||
* @param aCount is the number of layer indices in aLayers[].
|
||||
*/
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0;
|
||||
virtual std::vector<int> ViewGetLayers() const = 0;
|
||||
|
||||
/**
|
||||
* Return the level of detail (LOD) of the item.
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
// Basic shape primitives
|
||||
void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
||||
|
@ -196,14 +196,13 @@ wxString BOARD_ITEM::layerMaskDescribe() const
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> BOARD_ITEM::ViewGetLayers() const
|
||||
{
|
||||
// Basic fallback
|
||||
aCount = 1;
|
||||
aLayers[0] = m_layer;
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[aCount++] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
return { m_layer, LAYER_LOCKED_ITEM_SHADOW };
|
||||
|
||||
return { m_layer };
|
||||
}
|
||||
|
||||
|
||||
|
@ -2098,10 +2098,12 @@ void FOOTPRINT::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFun
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> FOOTPRINT::ViewGetLayers() const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = LAYER_ANCHOR;
|
||||
std::vector<int> layers;
|
||||
|
||||
layers.reserve( 6 );
|
||||
layers.push_back( LAYER_ANCHOR );
|
||||
|
||||
switch( m_layer )
|
||||
{
|
||||
@ -2111,19 +2113,19 @@ void FOOTPRINT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case F_Cu:
|
||||
aLayers[1] = LAYER_FOOTPRINTS_FR;
|
||||
layers.push_back( LAYER_FOOTPRINTS_FR );
|
||||
break;
|
||||
|
||||
case B_Cu:
|
||||
aLayers[1] = LAYER_FOOTPRINTS_BK;
|
||||
layers.push_back( LAYER_FOOTPRINTS_BK );
|
||||
break;
|
||||
}
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
layers.push_back( LAYER_LOCKED_ITEM_SHADOW );
|
||||
|
||||
if( IsConflicting() )
|
||||
aLayers[ aCount++ ] = LAYER_CONFLICTS_SHADOW;
|
||||
layers.push_back( LAYER_CONFLICTS_SHADOW );
|
||||
|
||||
// If there are no pads, and only drawings on a silkscreen layer, then report the silkscreen
|
||||
// layer as well so that the component can be edited with the silkscreen layer
|
||||
@ -2142,11 +2144,13 @@ void FOOTPRINT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
if( ( f_silk || b_silk ) && !non_silk && m_pads.empty() )
|
||||
{
|
||||
if( f_silk )
|
||||
aLayers[ aCount++ ] = F_SilkS;
|
||||
layers.push_back( F_SilkS );
|
||||
|
||||
if( b_silk )
|
||||
aLayers[ aCount++ ] = B_SilkS;
|
||||
layers.push_back( B_SilkS );
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -889,7 +889,7 @@ public:
|
||||
void RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction,
|
||||
int aDepth = 0 ) const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -129,11 +129,9 @@ public:
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_UI_START;
|
||||
aLayers[1] = LAYER_UI_START + 1;
|
||||
aCount = 2;
|
||||
return { LAYER_UI_START, LAYER_UI_START + 1 };
|
||||
}
|
||||
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override
|
||||
@ -356,11 +354,9 @@ public:
|
||||
return getOutline().BBox();
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aCount = 0;
|
||||
aLayers[aCount++] = LAYER_ANCHOR;
|
||||
aLayers[aCount++] = GetLayer();
|
||||
return { LAYER_ANCHOR, GetLayer() };
|
||||
}
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
|
||||
|
@ -1609,19 +1609,20 @@ EDA_ITEM* PAD::Clone() const
|
||||
}
|
||||
|
||||
|
||||
void PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PAD::ViewGetLayers() const
|
||||
{
|
||||
aCount = 0;
|
||||
std::vector<int> layers;
|
||||
layers.reserve( 64 );
|
||||
|
||||
// These 2 types of pads contain a hole
|
||||
if( m_attribute == PAD_ATTRIB::PTH )
|
||||
{
|
||||
aLayers[aCount++] = LAYER_PAD_PLATEDHOLES;
|
||||
aLayers[aCount++] = LAYER_PAD_HOLEWALLS;
|
||||
layers.push_back( LAYER_PAD_PLATEDHOLES );
|
||||
layers.push_back( LAYER_PAD_HOLEWALLS );
|
||||
}
|
||||
|
||||
if( m_attribute == PAD_ATTRIB::NPTH )
|
||||
aLayers[aCount++] = LAYER_NON_PLATEDHOLES;
|
||||
layers.push_back( LAYER_NON_PLATEDHOLES );
|
||||
|
||||
LSET cuLayers = ( m_padStack.LayerSet() & LSET::AllCuMask() );
|
||||
|
||||
@ -1633,31 +1634,31 @@ void PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
// Multi layer pad
|
||||
for( PCB_LAYER_ID layer : cuLayers.Seq() )
|
||||
aLayers[aCount++] = layer;
|
||||
layers.push_back( layer );
|
||||
|
||||
aLayers[aCount++] = LAYER_PAD_NETNAMES;
|
||||
layers.push_back( LAYER_PAD_NETNAMES );
|
||||
}
|
||||
else if( IsOnLayer( F_Cu ) )
|
||||
{
|
||||
aLayers[aCount++] = F_Cu;
|
||||
layers.push_back( F_Cu );
|
||||
|
||||
// Is this a PTH pad that has only front copper? If so, we need to also display the
|
||||
// net name on the PTH netname layer so that it isn't blocked by the drill hole.
|
||||
if( m_attribute == PAD_ATTRIB::PTH )
|
||||
aLayers[aCount++] = LAYER_PAD_NETNAMES;
|
||||
layers.push_back( LAYER_PAD_NETNAMES );
|
||||
else
|
||||
aLayers[aCount++] = LAYER_PAD_FR_NETNAMES;
|
||||
layers.push_back( LAYER_PAD_FR_NETNAMES );
|
||||
}
|
||||
else if( IsOnLayer( B_Cu ) )
|
||||
{
|
||||
aLayers[aCount++] = B_Cu;
|
||||
layers.push_back( B_Cu );
|
||||
|
||||
// Is this a PTH pad that has only back copper? If so, we need to also display the
|
||||
// net name on the PTH netname layer so that it isn't blocked by the drill hole.
|
||||
if( m_attribute == PAD_ATTRIB::PTH )
|
||||
aLayers[aCount++] = LAYER_PAD_NETNAMES;
|
||||
layers.push_back( LAYER_PAD_NETNAMES );
|
||||
else
|
||||
aLayers[aCount++] = LAYER_PAD_BK_NETNAMES;
|
||||
layers.push_back( LAYER_PAD_BK_NETNAMES );
|
||||
}
|
||||
|
||||
// Check non-copper layers. This list should include all the layers that the
|
||||
@ -1668,8 +1669,10 @@ void PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
for( PCB_LAYER_ID each_layer : layers_mech )
|
||||
{
|
||||
if( IsOnLayer( each_layer ) )
|
||||
aLayers[aCount++] = each_layer;
|
||||
layers.push_back( each_layer );
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -870,7 +870,7 @@ public:
|
||||
void BuildEffectiveShapes() const;
|
||||
void BuildEffectivePolygon( ERROR_LOC aErrorLoc = ERROR_INSIDE ) const;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -329,10 +329,9 @@ bool PCB_GROUP::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
||||
}
|
||||
|
||||
|
||||
void PCB_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_GROUP::ViewGetLayers() const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = LAYER_ANCHOR;
|
||||
return { LAYER_ANCHOR };
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
const std::vector<KICAD_T>& aScanTypes ) override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
@ -299,27 +299,24 @@ SEVERITY PCB_MARKER::GetSeverity() const
|
||||
}
|
||||
|
||||
|
||||
void PCB_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_MARKER::ViewGetLayers() const
|
||||
{
|
||||
if( GetMarkerType() == MARKER_RATSNEST )
|
||||
{
|
||||
aCount = 0;
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
aCount = 4;
|
||||
|
||||
aLayers[1] = LAYER_MARKER_SHADOWS;
|
||||
aLayers[2] = LAYER_DRC_SHAPE1;
|
||||
aLayers[3] = LAYER_DRC_SHAPE2;
|
||||
std::vector<int> layers{ 0, LAYER_MARKER_SHADOWS, LAYER_DRC_SHAPE1, LAYER_DRC_SHAPE2 };
|
||||
|
||||
switch( GetSeverity() )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_DRC_ERROR; break;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: aLayers[0] = LAYER_DRC_WARNING; break;
|
||||
case SEVERITY::RPT_SEVERITY_EXCLUSION: aLayers[0] = LAYER_DRC_EXCLUSION; break;
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: layers[0] = LAYER_DRC_ERROR; break;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: layers[0] = LAYER_DRC_WARNING; break;
|
||||
case SEVERITY::RPT_SEVERITY_EXCLUSION: layers[0] = LAYER_DRC_EXCLUSION; break;
|
||||
}
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
SEVERITY GetSeverity() const override;
|
||||
|
||||
|
@ -219,10 +219,9 @@ void PCB_REFERENCE_IMAGE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
||||
}
|
||||
|
||||
|
||||
void PCB_REFERENCE_IMAGE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_REFERENCE_IMAGE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = BITMAP_LAYER_FOR( m_layer );
|
||||
return { BITMAP_LAYER_FOR( m_layer ) };
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
//void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
|
@ -760,30 +760,30 @@ double PCB_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void PCB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_SHAPE::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = GetLayer();
|
||||
std::vector<int> layers;
|
||||
layers.reserve( 4 );
|
||||
|
||||
layers.push_back( GetLayer() );
|
||||
|
||||
if( IsOnCopperLayer() )
|
||||
{
|
||||
aLayers[1] = GetNetnameLayer( aLayers[0] );
|
||||
aCount = 2;
|
||||
layers.push_back( GetNetnameLayer( GetLayer() ) );
|
||||
|
||||
if( m_hasSolderMask )
|
||||
{
|
||||
if( m_layer == F_Cu )
|
||||
aLayers[ aCount++ ] = F_Mask;
|
||||
layers.push_back( F_Mask );
|
||||
else if( m_layer == B_Cu )
|
||||
aLayers[ aCount++ ] = B_Mask;
|
||||
layers.push_back( B_Mask );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aCount = 1;
|
||||
}
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
layers.push_back( LAYER_LOCKED_ITEM_SHADOW );
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
@ -253,14 +253,12 @@ const BOX2I PCB_TEXT::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_TEXT::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = GetLayer();
|
||||
|
||||
aCount = 1;
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
return { GetLayer(), LAYER_LOCKED_ITEM_SHADOW };
|
||||
|
||||
return { GetLayer() };
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
@ -316,13 +316,12 @@ double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_TEXTBOX::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = GetLayer();
|
||||
aCount = 1;
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
return { GetLayer(), LAYER_LOCKED_ITEM_SHADOW };
|
||||
|
||||
return { GetLayer() };
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
@ -1318,23 +1318,25 @@ void PCB_VIA::GetOutermostConnectedLayers( PCB_LAYER_ID* aTopmost,
|
||||
}
|
||||
|
||||
|
||||
void PCB_TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_TRACK::ViewGetLayers() const
|
||||
{
|
||||
// Show the track and its netname on different layers
|
||||
aLayers[0] = GetLayer();
|
||||
aLayers[1] = GetNetnameLayer( aLayers[0] );
|
||||
aCount = 2;
|
||||
std::vector<int> layers { GetLayer(), GetNetnameLayer( GetLayer() ) };
|
||||
|
||||
layers.reserve( 5 );
|
||||
|
||||
if( m_hasSolderMask )
|
||||
{
|
||||
if( m_layer == F_Cu )
|
||||
aLayers[ aCount++ ] = F_Mask;
|
||||
layers.push_back( F_Mask );
|
||||
else if( m_layer == B_Cu )
|
||||
aLayers[ aCount++ ] = B_Mask;
|
||||
layers.push_back( B_Mask );
|
||||
}
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
layers.push_back( LAYER_LOCKED_ITEM_SHADOW );
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
@ -1412,8 +1414,12 @@ const BOX2I PCB_TRACK::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void PCB_VIA::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> PCB_VIA::ViewGetLayers() const
|
||||
{
|
||||
LAYER_RANGE layers( Padstack().Drill().start, Padstack().Drill().end, MAX_CU_LAYERS );
|
||||
std::vector<int> ret_layers{ LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_PAD_NETNAMES };
|
||||
ret_layers.reserve( MAX_CU_LAYERS + 6 );
|
||||
|
||||
// TODO(JE) Rendering order issue
|
||||
#if 0
|
||||
// Blind/buried vias (and microvias) use a different net name layer
|
||||
@ -1425,26 +1431,21 @@ void PCB_VIA::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
|| ( m_viaType == VIATYPE::MICROVIA && ( layerTop != F_Cu || layerBottom != B_Cu ) );
|
||||
#endif
|
||||
|
||||
aLayers[0] = LAYER_VIA_HOLES;
|
||||
aLayers[1] = LAYER_VIA_HOLEWALLS;
|
||||
aLayers[2] = LAYER_PAD_NETNAMES; // To avoid layer ordering issues
|
||||
aCount = 3;
|
||||
|
||||
LAYER_RANGE layers( Padstack().Drill().start, Padstack().Drill().end, MAX_CU_LAYERS );
|
||||
|
||||
for( PCB_LAYER_ID layer : layers )
|
||||
aLayers[aCount++] = layer;
|
||||
ret_layers.push_back( layer );
|
||||
|
||||
if( IsLocked() )
|
||||
aLayers[ aCount++ ] = LAYER_LOCKED_ITEM_SHADOW;
|
||||
ret_layers.push_back( LAYER_LOCKED_ITEM_SHADOW );
|
||||
|
||||
// Vias can also be on a solder mask layer. They are on these layers or not,
|
||||
// depending on the plot and solder mask options
|
||||
if( IsOnLayer( F_Mask ) )
|
||||
aLayers[ aCount++ ] = F_Mask;
|
||||
ret_layers.push_back( F_Mask );
|
||||
|
||||
if( IsOnLayer( B_Mask ) )
|
||||
aLayers[ aCount++ ] = B_Mask;
|
||||
ret_layers.push_back( B_Mask );
|
||||
|
||||
return ret_layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
|
||||
virtual EDA_ITEM* Clone() const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
@ -503,7 +503,7 @@ public:
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -286,9 +286,8 @@ void RATSNEST_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
}
|
||||
|
||||
|
||||
void RATSNEST_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> RATSNEST_VIEW_ITEM::ViewGetLayers() const
|
||||
{
|
||||
aCount = 1;
|
||||
aLayers[0] = LAYER_RATSNEST;
|
||||
return { LAYER_RATSNEST };
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const override
|
||||
{
|
||||
|
@ -108,10 +108,9 @@ public:
|
||||
|
||||
virtual void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
virtual std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = m_layer;
|
||||
aCount = 1;
|
||||
return { m_layer };
|
||||
}
|
||||
|
||||
void drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX::GAL* aGal ) const;
|
||||
|
@ -44,11 +44,9 @@ const BOX2I ROUTER_STATUS_VIEW_ITEM::ViewBBox() const
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void ROUTER_STATUS_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> ROUTER_STATUS_VIEW_ITEM::ViewGetLayers() const
|
||||
{
|
||||
aLayers[0] = LAYER_UI_START;
|
||||
aLayers[1] = LAYER_UI_START + 1;
|
||||
aCount = 2;
|
||||
return { LAYER_UI_START, LAYER_UI_START + 1 };
|
||||
}
|
||||
|
||||
void ROUTER_STATUS_VIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
}
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
protected:
|
||||
|
@ -329,19 +329,22 @@ void ZONE::SetLayerSet( const LSET& aLayerSet )
|
||||
}
|
||||
|
||||
|
||||
void ZONE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> ZONE::ViewGetLayers() const
|
||||
{
|
||||
aCount = 0;
|
||||
std::vector<int> layers;
|
||||
layers.reserve( 2 * m_layerSet.count() + 1 );
|
||||
|
||||
m_layerSet.RunOnLayers(
|
||||
[&]( PCB_LAYER_ID layer )
|
||||
{
|
||||
aLayers[ aCount++ ] = layer;
|
||||
aLayers[ aCount++ ] = layer + static_cast<int>( LAYER_ZONE_START );
|
||||
layers.push_back( layer );
|
||||
layers.push_back( layer + static_cast<int>( LAYER_ZONE_START ) );
|
||||
} );
|
||||
|
||||
if( IsConflicting() )
|
||||
aLayers[ aCount++ ] = LAYER_CONFLICTS_SHADOW;
|
||||
layers.push_back( LAYER_CONFLICTS_SHADOW );
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
|
||||
virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
virtual std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -38,9 +38,7 @@ const BOX2I BOARD_EDGES_BOUNDING_ITEM::ViewBBox() const
|
||||
}
|
||||
|
||||
|
||||
void BOARD_EDGES_BOUNDING_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
std::vector<int> BOARD_EDGES_BOUNDING_ITEM::ViewGetLayers() const
|
||||
{
|
||||
// Basic fallback
|
||||
aCount = 1;
|
||||
aLayers[0] = Edge_Cuts;
|
||||
return { Edge_Cuts };
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
private:
|
||||
BOX2I m_box;
|
||||
|
@ -182,10 +182,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||
virtual std::vector<int> ViewGetLayers() const override
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
aCount = 1;
|
||||
return { LAYER_GP_OVERLAY };
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user