Module anchors are visible in GAL canvas.

This commit is contained in:
Maciej Suminski 2014-07-09 15:02:56 +02:00
parent 6f772c90d9
commit 5f297726ca
5 changed files with 49 additions and 3 deletions

View File

@ -830,6 +830,21 @@ void MODULE::ViewUpdate( int aUpdateFlags )
}
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = ITEM_GAL_LAYER( ANCHOR_VISIBLE );
}
unsigned int MODULE::ViewGetLOD( int aLayer ) const
{
// Currently there is only one layer, so there is nothing to check
// if( aLayer == ITEM_GAL_LAYER( ANCHOR_VISIBLE ) )
return 30;
}
/* Test for validity of the name in a library of the footprint
* ( no spaces, dir separators ... )
* return true if the given name is valid

View File

@ -483,6 +483,12 @@ public:
/// @copydoc VIEW_ITEM::ViewUpdate()
void ViewUpdate( int aUpdateFlags = KIGFX::VIEW_ITEM::ALL );
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const;
/// @copydoc VIEW_ITEM::ViewGetLOD()
virtual unsigned int ViewGetLOD( int aLayer ) const;
/**
* Function CopyNetlistSettings
* copies the netlist settings to \a aModule.

View File

@ -47,7 +47,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
ITEM_GAL_LAYER( RATSNEST_VISIBLE ), ITEM_GAL_LAYER( ANCHOR_VISIBLE ),
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
@ -141,6 +141,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
}
}
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
// Some more required layers settings
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );

View File

@ -79,6 +79,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
m_layerColors[NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )] = COLOR4D( 1.0, 1.0, 1.0, 0.9 );
m_layerColors[ITEM_GAL_LAYER( ANCHOR_VISIBLE )] = COLOR4D( 0.3, 0.3, 1.0, 0.9 );
m_layerColors[ITEM_GAL_LAYER( RATSNEST_VISIBLE )] = COLOR4D( 0.4, 0.4, 0.4, 0.8 );
m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 0.8 );
m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )] = COLOR4D( 1.0, 0.0, 0.0, 0.8 );
@ -233,6 +234,10 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
draw( (TEXTE_MODULE*) item, aLayer );
break;
case PCB_MODULE_T:
draw( (MODULE*) item );
break;
case PCB_ZONE_AREA_T:
draw( (ZONE_CONTAINER*) item );
break;
@ -284,7 +289,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
// Set a proper color for the label
const COLOR4D& color = m_pcbSettings.GetColor( aTrack, aTrack->GetLayer() );
COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
if( color.GetBrightness() > 0.5 )
m_gal->SetStrokeColor( labelColor.Inverted() );
@ -421,7 +426,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Set a proper color for the label
const COLOR4D& color = m_pcbSettings.GetColor( aPad, aPad->GetLayer() );
COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
const COLOR4D labelColor = m_pcbSettings.GetColor( NULL, aLayer );
if( color.GetBrightness() > 0.5 )
m_gal->SetStrokeColor( labelColor.Inverted() );
@ -726,6 +731,23 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
}
void PCB_PAINTER::draw( const MODULE* aModule )
{
const COLOR4D color = m_pcbSettings.GetColor( aModule, ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
// Draw anchor
m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( 1.0 );
// Keep the size constant, not related to the scale
double anchorSize = 5.0 / m_gal->GetWorldScale();
VECTOR2D center = aModule->GetPosition();
m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
}
void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
{
const COLOR4D& color = m_pcbSettings.GetColor( aZone, aZone->GetLayer() );

View File

@ -213,6 +213,7 @@ protected:
void draw( const DRAWSEGMENT* aSegment );
void draw( const TEXTE_PCB* aText, int aLayer );
void draw( const TEXTE_MODULE* aText, int aLayer );
void draw( const MODULE* aModule );
void draw( const ZONE_CONTAINER* aZone );
void draw( const DIMENSION* aDimension, int aLayer );
void draw( const PCB_TARGET* aTarget );