Gerbview: enhancement: show attributes for polygons (Regions in Gerber dialect) that have no DCode

This change is needed to follow current specifications in Gerber X2
This commit is contained in:
jean-pierre charras 2019-10-06 17:34:35 +02:00
parent b234ff9234
commit ba2e34682e
3 changed files with 35 additions and 8 deletions

View File

@ -691,14 +691,27 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
msg = ShowGBRShape(); msg = ShowGBRShape();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
// Display D_Code value with its attributes:
msg.Printf( _( "D Code %d" ), m_DCode );
D_CODE* apertDescr = GetDcodeDescr();
if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() ) // Display D_Code value with its attributes for items using a DCode:
text = _( "No attribute" ); if( m_Shape == GBR_POLYGON ) // Has no DCode, but can have an attribute
{
msg = _( "Attribut" );
if( m_AperFunction.IsEmpty() )
text = _( "No attribute" );
else
text = m_AperFunction;
}
else else
text = apertDescr->m_AperFunction; {
msg.Printf( _( "D Code %d" ), m_DCode );
D_CODE* apertDescr = GetDcodeDescr();
if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() )
text = _( "No attribute" );
else
text = apertDescr->m_AperFunction;
}
aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) ); aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );

View File

@ -88,9 +88,14 @@ public:
// Lines : m_Size.x = m_Size.y = line width // Lines : m_Size.x = m_Size.y = line width
bool m_Flashed; // True for flashed items bool m_Flashed; // True for flashed items
int m_DCode; // DCode used to draw this item. int m_DCode; // DCode used to draw this item.
// 0 for items that do not use DCodes (polygons) // Allowed values are >= 10. 0 when unknown
// or when unknown and normal values are 10 to 999
// values 0 to 9 can be used for special purposes // values 0 to 9 can be used for special purposes
// Regions (polygons) doo not use DCode,
// so it is set to 0
wxString m_AperFunction; // the aperture function set by a %TA.AperFunction, xxx
// (stores thre xxx value).
// used for regions that do not have a attached DCode, but
// have a TA.AperFunction defined
GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item
* Note: some params stored in this class are common * Note: some params stored in this class are common
* to the whole gerber file (i.e) the whole graphic * to the whole gerber file (i.e) the whole graphic

View File

@ -619,6 +619,14 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
m_Drawings.Append( gbritem ); m_Drawings.Append( gbritem );
gbritem->m_Shape = GBR_POLYGON; gbritem->m_Shape = GBR_POLYGON;
gbritem->m_Flashed = false; gbritem->m_Flashed = false;
gbritem->m_DCode = 0; // No DCode for a Polygon (Region in Gerber dialect)
if( gbritem->m_GerberImageFile )
{
gbritem->SetNetAttributes( gbritem->m_GerberImageFile->m_NetAttributeDict );
gbritem->m_AperFunction = gbritem->m_GerberImageFile->m_AperFunction;
}
} }
switch( m_Iterpolation ) switch( m_Iterpolation )
@ -676,6 +684,7 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
m_Exposure = true; m_Exposure = true;
tool = GetDCODE( m_Current_Tool ); tool = GetDCODE( m_Current_Tool );
if( tool ) if( tool )
{ {
size = tool->m_Size; size = tool->m_Size;