Separate layers for each copper layer netnames.

This commit is contained in:
Maciej Suminski 2013-07-08 16:46:04 +02:00
parent b7447ff05e
commit 89637b89b8
4 changed files with 83 additions and 12 deletions

View File

@ -214,15 +214,35 @@ enum PCB_VISIBLE
MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles) MOD_REFERENCES_VISIBLE, ///< show modules references (when texts are visibles)
TRACKS_VISIBLE, TRACKS_VISIBLE,
TRACKS_NETNAMES_VISIBLE,
PADS_VISIBLE, PADS_VISIBLE,
PADS_NETNAMES_VISIBLE,
PADS_HOLES_VISIBLE, PADS_HOLES_VISIBLE,
VIAS_HOLES_VISIBLE, VIAS_HOLES_VISIBLE,
// Netname layers
LAYER_1_NETNAMES_VISIBLE, // Bottom layer
LAYER_2_NETNAMES_VISIBLE,
LAYER_3_NETNAMES_VISIBLE,
LAYER_4_NETNAMES_VISIBLE,
LAYER_5_NETNAMES_VISIBLE,
LAYER_6_NETNAMES_VISIBLE,
LAYER_7_NETNAMES_VISIBLE,
LAYER_8_NETNAMES_VISIBLE,
LAYER_9_NETNAMES_VISIBLE,
LAYER_10_NETNAMES_VISIBLE,
LAYER_11_NETNAMES_VISIBLE,
LAYER_12_NETNAMES_VISIBLE,
LAYER_13_NETNAMES_VISIBLE,
LAYER_14_NETNAMES_VISIBLE,
LAYER_15_NETNAMES_VISIBLE,
LAYER_16_NETNAMES_VISIBLE, // Top layer
PADS_NETNAMES_VISIBLE,
END_PCB_VISIBLE_LIST // sentinel END_PCB_VISIBLE_LIST // sentinel
}; };
#define FIRST_NETNAME_LAYER ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE )
#define LAST_NETNAME_LAYER ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE )
/// macro for obtaining layer number for specific item (eg. pad or text) /// macro for obtaining layer number for specific item (eg. pad or text)
#define ITEM_GAL_LAYER(layer) (NB_LAYERS + layer) #define ITEM_GAL_LAYER(layer) (NB_LAYERS + layer)
@ -338,4 +358,32 @@ LAYER_NUM ExtractLayer( LAYER_MSK aMask );
*/ */
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask ); wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask );
/**
* Returns a netname layer corresponding to the given layer.
*/
inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
{
if( IsCopperLayer( aLayer ) )
{
// Compute the offset in description layers
return FIRST_NETNAME_LAYER + ( aLayer - FIRST_COPPER_LAYER );
}
else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
return ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
// Fallback
return COMMENT_N;
}
/**
* Function IsCopperLayer
* tests whether a layer is a netname layer
* @param aLayer = Layer to test
* @return true if aLayer is a valid netname layer
*/
inline bool IsNetnameLayer( LAYER_NUM aLayer )
{
return aLayer >= FIRST_NETNAME_LAYER && aLayer <= LAST_NETNAME_LAYER;
}
#endif // _LAYERS_ID_AND_VISIBILITY_H_ #endif // _LAYERS_ID_AND_VISIBILITY_H_

View File

@ -98,10 +98,24 @@ const int m_galLayerOrder[] =
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
LAYER_N_FRONT, LAYER_N_15, LAYER_N_14, LAYER_N_13, ITEM_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
LAYER_N_12, LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8, LAYER_N_7, LAYER_N_6, ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
LAYER_N_5, LAYER_N_4, LAYER_N_3, LAYER_N_2, LAYER_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
ITEM_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
ITEM_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
ITEM_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
ITEM_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
ITEM_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
ITEM_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
ITEM_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
ITEM_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
ITEM_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
ITEM_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
ITEM_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
ITEM_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK, SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ) ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
@ -227,7 +241,10 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
// Netnames are drawn only when scale is sufficient (level of details) // Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them // so there is no point in caching them
view->SetLayerCached( ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ), false ); for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
view->SetLayerCached( GetNetnameLayer( layer ), false );
}
view->SetLayerCached( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), false ); view->SetLayerCached( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), false );
// Load layer & elements visibility settings // Load layer & elements visibility settings

View File

@ -754,7 +754,7 @@ void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
// Show the track and its netname on different layers // Show the track and its netname on different layers
aLayers[0] = GetLayer(); aLayers[0] = GetLayer();
aLayers[1] = ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ); aLayers[1] = GetNetnameLayer( aLayers[0] );
aCount = 2; aCount = 2;
} }
@ -770,7 +770,7 @@ void TRACK::ViewGetRequiredLayers( int aLayers[], int& aCount ) const
unsigned int TRACK::ViewGetLOD( int aLayer ) const unsigned int TRACK::ViewGetLOD( int aLayer ) const
{ {
// Netnames will be shown only if zoom is appropriate // Netnames will be shown only if zoom is appropriate
if( aLayer == ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE ) ) if( aLayer == GetNetnameLayer( GetLayer() ) )
{ {
return ( 20000000 / m_Width ); return ( 20000000 / m_Width );
} }

View File

@ -73,7 +73,13 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
m_itemColors[VIAS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 ); m_itemColors[VIAS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
m_itemColors[PADS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 ); m_itemColors[PADS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
m_itemColors[PADS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); m_itemColors[PADS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
m_itemColors[TRACKS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); // Netnames for copper layers
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
{
// Quick, dirty hack, netnames layers should be stored in usual layers
m_itemColors[GetNetnameLayer( layer ) - NB_LAYERS] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
}
Update(); Update();
} }
@ -261,7 +267,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->SetStrokeColor( color ); m_gal->SetStrokeColor( color );
if( aLayer == ITEM_GAL_LAYER( TRACKS_NETNAMES_VISIBLE) ) if( IsNetnameLayer( aLayer ) )
{ {
// If there is a net name - display it on the track // If there is a net name - display it on the track
if( netNumber != 0 ) if( netNumber != 0 )
@ -289,7 +295,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->StrokeText( netName, textPosition, textOrientation ); m_gal->StrokeText( netName, textPosition, textOrientation );
} }
} }
else else if( IsCopperLayer( aLayer ))
{ {
// Draw a regular track // Draw a regular track
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );