Add an optional name property to zones

This commit is contained in:
Jon Evans 2020-06-23 21:09:15 -04:00
parent 67f46a0bb1
commit 0b34cea3d5
6 changed files with 26 additions and 3 deletions

View File

@ -150,6 +150,7 @@ mod_text_width
mode
model
module
name
net
net_class
net_name

View File

@ -639,11 +639,14 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
// Display priority level
msg.Printf( wxT( "%d" ), GetPriority() );
aList.emplace_back( _( "Priority" ), msg, BLUE );
aList.emplace_back( _( "Priority" ), msg, BLUE );
}
aList.emplace_back( _( "Layer" ), LayerMaskDescribe( GetBoard(), m_layerSet ), DARKGREEN );
if( !m_zoneName.empty() )
aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
switch( m_FillMode )
{
case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;

View File

@ -105,6 +105,10 @@ public:
virtual LSET GetLayerSet() const override;
wxString GetZoneName() const { return m_zoneName; }
void SetZoneName( const wxString& aName ) { m_zoneName = aName; }
/** Function GetBoundingBox (virtual)
* @return an EDA_RECT that is the bounding box of the zone outline
*/
@ -763,6 +767,9 @@ protected:
int m_cornerSmoothingType;
unsigned int m_cornerRadius;
/// An optional unique name for this zone, used for identifying it in DRC checking
wxString m_zoneName;
LSET m_layerSet;
/* Priority: when a zone outline is inside and other zone, if its priority is higher

View File

@ -1792,6 +1792,9 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aZone->m_Uuid.AsString() ) );
if( !aZone->GetZoneName().empty() )
m_out->Print( 0, " (name %s)", TO_UTF8( aZone->GetZoneName() ) );
// Save the outline aux info
std::string hatch;

View File

@ -69,7 +69,8 @@ class TEXTE_PCB;
//#define SEXPR_BOARD_FILE_VERSION 20200119 // arcs in tracks
//#define SEXPR_BOARD_FILE_VERSION 20200512 // page -> paper
//#define SEXPR_BOARD_FILE_VERSION 20200518 // save hole_to_hole_min
#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
//#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
#define SEXPR_BOARD_FILE_VERSION 20200623 // Add name property to zones
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)

View File

@ -4106,9 +4106,17 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
}
break;
case T_name:
{
NextTok();
zone->SetZoneName( FromUTF8() );
NeedRIGHT();
}
break;
default:
Expecting( "net, layer/layers, tstamp, hatch, priority, connect_pads, min_thickness, "
"fill, polygon, filled_polygon, or fill_segments" );
"fill, polygon, filled_polygon, fill_segments or name" );
}
}