mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Code cleanup.
A placement-area is a rule-area sub-type. We don't need to say rule-area-placement each time. Also removes some dead code, and simplifies some damage-propagation logic.
This commit is contained in:
parent
bccb3534f4
commit
d81e9e6cd1
@ -386,43 +386,43 @@ ZONE_BORDER_DISPLAY_STYLE FromProtoEnum( types::ZoneBorderStyle aValue )
|
||||
|
||||
|
||||
template<>
|
||||
types::PlacementRuleSourceType ToProtoEnum( RULE_AREA_PLACEMENT_SOURCE_TYPE aValue )
|
||||
types::PlacementRuleSourceType ToProtoEnum( PLACEMENT_SOURCE_T aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME:
|
||||
case PLACEMENT_SOURCE_T::SHEETNAME:
|
||||
return types::PlacementRuleSourceType::PRST_SHEET_NAME;
|
||||
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS:
|
||||
case PLACEMENT_SOURCE_T::COMPONENT_CLASS:
|
||||
return types::PlacementRuleSourceType::PRST_COMPONENT_CLASS;
|
||||
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT:
|
||||
case PLACEMENT_SOURCE_T::GROUP_PLACEMENT:
|
||||
return types::PlacementRuleSourceType::PRST_GROUP;
|
||||
|
||||
default:
|
||||
wxCHECK_MSG( false, types::PlacementRuleSourceType::PRST_UNKNOWN,
|
||||
"Unhandled case in ToProtoEnum<RULE_AREA_PLACEMENT_SOURCE_TYPE>");
|
||||
"Unhandled case in ToProtoEnum<PLACEMENT_SOURCE_T>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE FromProtoEnum( types::PlacementRuleSourceType aValue )
|
||||
PLACEMENT_SOURCE_T FromProtoEnum( types::PlacementRuleSourceType aValue )
|
||||
{
|
||||
switch( aValue )
|
||||
{
|
||||
case types::PlacementRuleSourceType::PRST_UNKNOWN:
|
||||
case types::PlacementRuleSourceType::PRST_SHEET_NAME:
|
||||
return RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
return PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
|
||||
case types::PlacementRuleSourceType::PRST_COMPONENT_CLASS:
|
||||
return RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
|
||||
return PLACEMENT_SOURCE_T::COMPONENT_CLASS;
|
||||
|
||||
case types::PlacementRuleSourceType::PRST_GROUP:
|
||||
return RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT;
|
||||
return PLACEMENT_SOURCE_T::GROUP_PLACEMENT;
|
||||
|
||||
default:
|
||||
wxCHECK_MSG( false, RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME,
|
||||
wxCHECK_MSG( false, PLACEMENT_SOURCE_T::SHEETNAME,
|
||||
"Unhandled case in FromProtoEnum<types::PlacementRuleSourceType>" );
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||
char* text;
|
||||
int netcode = -1;
|
||||
bool multiHighlight = false;
|
||||
PAD* pad = nullptr;
|
||||
BOARD* pcb = GetBoard();
|
||||
|
||||
CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
|
||||
|
@ -122,11 +122,11 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
|
||||
|
||||
for( RULE_AREA& ruleArea : raData->m_areas )
|
||||
{
|
||||
if( ruleArea.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
if( ruleArea.m_sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
sheetRowIdx++;
|
||||
else if( ruleArea.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
else if( ruleArea.m_sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
componentClassRowIdx++;
|
||||
else if( ruleArea.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT )
|
||||
else if( ruleArea.m_sourceType == PLACEMENT_SOURCE_T::GROUP_PLACEMENT )
|
||||
groupIdx++;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
|
||||
|
||||
for( RULE_AREA& ruleArea : raData->m_areas )
|
||||
{
|
||||
if( ruleArea.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
if( ruleArea.m_sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
m_sheetGrid->SetCellValue( sheetRowIdx, 1, ruleArea.m_sheetPath );
|
||||
m_sheetGrid->SetCellValue( sheetRowIdx, 2, ruleArea.m_sheetName );
|
||||
@ -155,7 +155,7 @@ DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS
|
||||
ruleArea.m_generateEnabled ? wxT( "1" ) : wxT( "" ) );
|
||||
sheetRowIdx++;
|
||||
}
|
||||
else if( ruleArea.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
else if( ruleArea.m_sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
{
|
||||
m_componentClassGrid->SetCellValue( componentClassRowIdx, 1,
|
||||
ruleArea.m_componentClass );
|
||||
@ -219,12 +219,12 @@ bool DIALOG_MULTICHANNEL_GENERATE_RULE_AREAS::TransferDataFromWindow()
|
||||
{
|
||||
wxString enabled;
|
||||
|
||||
if( raData->m_areas[i].m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
if( raData->m_areas[i].m_sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
enabled = m_sheetGrid->GetCellValue( sheetRowIdx, 0 );
|
||||
sheetRowIdx++;
|
||||
}
|
||||
else if( raData->m_areas[i].m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
else if( raData->m_areas[i].m_sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
{
|
||||
enabled = m_componentClassGrid->GetCellValue( componentClassRowIdx, 0 );
|
||||
componentClassRowIdx++;
|
||||
|
@ -63,28 +63,28 @@ private:
|
||||
void OnGroupClicked( wxCommandEvent& event );
|
||||
|
||||
private:
|
||||
BOARD* m_board;
|
||||
UNIT_BINDER m_outlineHatchPitch;
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
ZONE_SETTINGS m_zonesettings; ///< the working copy of zone settings
|
||||
ZONE_SETTINGS* m_ptr; ///< the pointer to the zone settings of the zone to edit
|
||||
bool m_isFpEditor;
|
||||
BOARD* m_board;
|
||||
UNIT_BINDER m_outlineHatchPitch;
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
ZONE_SETTINGS m_zonesettings; ///< the working copy of zone settings
|
||||
ZONE_SETTINGS* m_ptr; ///< the pointer to the zone settings of the zone to edit
|
||||
bool m_isFpEditor;
|
||||
|
||||
CONVERT_SETTINGS* m_convertSettings;
|
||||
wxRadioButton* m_rbCenterline;
|
||||
wxRadioButton* m_rbBoundingHull;
|
||||
wxStaticText* m_gapLabel;
|
||||
wxTextCtrl* m_gapCtrl;
|
||||
wxStaticText* m_gapUnits;
|
||||
UNIT_BINDER* m_gap;
|
||||
wxCheckBox* m_cbDeleteOriginals;
|
||||
CONVERT_SETTINGS* m_convertSettings;
|
||||
wxRadioButton* m_rbCenterline;
|
||||
wxRadioButton* m_rbBoundingHull;
|
||||
wxStaticText* m_gapLabel;
|
||||
wxTextCtrl* m_gapCtrl;
|
||||
wxStaticText* m_gapUnits;
|
||||
UNIT_BINDER* m_gap;
|
||||
wxCheckBox* m_cbDeleteOriginals;
|
||||
|
||||
// The name of a rule area source that is not now found on the board (e.g. after a netlist
|
||||
// update). This is used to re-populate the zone settings if the selection is not changed.
|
||||
bool m_notFoundPlacementSource;
|
||||
wxString m_notFoundPlacementSourceName;
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE m_originalPlacementSourceType;
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE m_lastPlacementSourceType;
|
||||
bool m_notFoundPlacementSource;
|
||||
wxString m_notFoundPlacementSourceName;
|
||||
PLACEMENT_SOURCE_T m_originalPlacementSourceType;
|
||||
PLACEMENT_SOURCE_T m_lastPlacementSourceType;
|
||||
|
||||
PANEL_RULE_AREA_PROPERTIES_KEEPOUT_BASE* m_keepoutProperties;
|
||||
PANEL_RULE_AREA_PROPERTIES_PLACEMENT_BASE* m_placementProperties;
|
||||
@ -116,8 +116,8 @@ DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES( PCB_BASE_FRAME* aPar
|
||||
m_gap( nullptr ),
|
||||
m_cbDeleteOriginals( nullptr ),
|
||||
m_notFoundPlacementSource( false ),
|
||||
m_originalPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME ),
|
||||
m_lastPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
m_originalPlacementSourceType( PLACEMENT_SOURCE_T::SHEETNAME ),
|
||||
m_lastPlacementSourceType( PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
m_parent = aParent;
|
||||
|
||||
@ -215,19 +215,19 @@ DIALOG_RULE_AREA_PROPERTIES::~DIALOG_RULE_AREA_PROPERTIES()
|
||||
|
||||
void DIALOG_RULE_AREA_PROPERTIES::OnSheetNameClicked( wxCommandEvent& event )
|
||||
{
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RULE_AREA_PROPERTIES::OnComponentClassClicked( wxCommandEvent& event )
|
||||
{
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::COMPONENT_CLASS;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RULE_AREA_PROPERTIES::OnGroupClicked( wxCommandEvent& event )
|
||||
{
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::GROUP_PLACEMENT;
|
||||
}
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ bool DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow()
|
||||
m_placementProperties->m_GroupRb->SetValue( false );
|
||||
m_placementProperties->m_groupCombo->Clear();
|
||||
|
||||
wxString curSourceName = m_zonesettings.GetRuleAreaPlacementSource();
|
||||
wxString curSourceName = m_zonesettings.GetPlacementAreaSource();
|
||||
|
||||
// Load schematic sheet and component class lists
|
||||
if( m_board )
|
||||
@ -318,43 +318,39 @@ bool DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow()
|
||||
}
|
||||
};
|
||||
|
||||
if( m_zonesettings.GetRuleAreaPlacementSourceType()
|
||||
== RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
if( m_zonesettings.GetPlacementAreaSourceType() == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
|
||||
if( m_zonesettings.GetPlacementAreaEnabled() )
|
||||
m_placementProperties->m_SheetRb->SetValue( true );
|
||||
|
||||
setupCurrentSourceSelection( m_placementProperties->m_sheetCombo );
|
||||
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
m_originalPlacementSourceType = PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
}
|
||||
else if( m_zonesettings.GetRuleAreaPlacementSourceType()
|
||||
== RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
else if( m_zonesettings.GetPlacementAreaSourceType() == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
{
|
||||
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
|
||||
if( m_zonesettings.GetPlacementAreaEnabled() )
|
||||
m_placementProperties->m_ComponentsRb->SetValue( true );
|
||||
|
||||
setupCurrentSourceSelection( m_placementProperties->m_componentClassCombo );
|
||||
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
|
||||
m_originalPlacementSourceType = PLACEMENT_SOURCE_T::COMPONENT_CLASS;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::COMPONENT_CLASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
|
||||
if( m_zonesettings.GetPlacementAreaEnabled() )
|
||||
m_placementProperties->m_GroupRb->SetValue( true );
|
||||
|
||||
setupCurrentSourceSelection( m_placementProperties->m_groupCombo );
|
||||
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT;
|
||||
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT;
|
||||
m_originalPlacementSourceType = PLACEMENT_SOURCE_T::GROUP_PLACEMENT;
|
||||
m_lastPlacementSourceType = PLACEMENT_SOURCE_T::GROUP_PLACEMENT;
|
||||
}
|
||||
|
||||
// Handle most-useful notebook page selection
|
||||
m_areaPropertiesNb->SetSelection( 0 );
|
||||
|
||||
if( !m_zonesettings.HasKeepoutParametersSet() && m_zonesettings.GetRuleAreaPlacementEnabled() )
|
||||
{
|
||||
if( !m_zonesettings.HasKeepoutParametersSet() && m_zonesettings.GetPlacementAreaEnabled() )
|
||||
m_areaPropertiesNb->SetSelection( 1 );
|
||||
}
|
||||
|
||||
|
||||
m_cbLocked->SetValue( m_zonesettings.m_Locked );
|
||||
@ -430,52 +426,53 @@ bool DIALOG_RULE_AREA_PROPERTIES::TransferDataFromWindow()
|
||||
m_zonesettings.SetDoNotAllowFootprints( m_keepoutProperties->m_cbFootprintsCtrl->GetValue() );
|
||||
|
||||
// Set placement parameters
|
||||
m_zonesettings.SetRuleAreaPlacementEnabled( false );
|
||||
m_zonesettings.SetRuleAreaPlacementSource( wxEmptyString );
|
||||
m_zonesettings.SetPlacementAreaEnabled( false );
|
||||
m_zonesettings.SetPlacementAreaSource( wxEmptyString );
|
||||
|
||||
auto setPlacementSource = [this]( RULE_AREA_PLACEMENT_SOURCE_TYPE sourceType )
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementSourceType( sourceType );
|
||||
|
||||
wxComboBox* cb;
|
||||
|
||||
if( sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
cb = m_placementProperties->m_sheetCombo;
|
||||
else if( sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
cb = m_placementProperties->m_componentClassCombo;
|
||||
else
|
||||
cb = m_placementProperties->m_groupCombo;
|
||||
|
||||
int selectedSourceIdx = cb->GetSelection();
|
||||
|
||||
if( selectedSourceIdx != wxNOT_FOUND )
|
||||
{
|
||||
if( selectedSourceIdx == 0 && m_notFoundPlacementSource
|
||||
&& m_originalPlacementSourceType == sourceType )
|
||||
auto setPlacementSource =
|
||||
[this]( PLACEMENT_SOURCE_T sourceType )
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementSource( m_notFoundPlacementSourceName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementSource( cb->GetString( selectedSourceIdx ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
m_zonesettings.SetPlacementAreaSourceType( sourceType );
|
||||
|
||||
wxComboBox* cb;
|
||||
|
||||
if( sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
cb = m_placementProperties->m_sheetCombo;
|
||||
else if( sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
cb = m_placementProperties->m_componentClassCombo;
|
||||
else
|
||||
cb = m_placementProperties->m_groupCombo;
|
||||
|
||||
int selectedSourceIdx = cb->GetSelection();
|
||||
|
||||
if( selectedSourceIdx != wxNOT_FOUND )
|
||||
{
|
||||
if( selectedSourceIdx == 0 && m_notFoundPlacementSource
|
||||
&& m_originalPlacementSourceType == sourceType )
|
||||
{
|
||||
m_zonesettings.SetPlacementAreaSource( m_notFoundPlacementSourceName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_zonesettings.SetPlacementAreaSource( cb->GetString( selectedSourceIdx ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if( m_placementProperties->m_SheetRb->GetValue() )
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementEnabled( true );
|
||||
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
||||
m_zonesettings.SetPlacementAreaEnabled( true );
|
||||
setPlacementSource( PLACEMENT_SOURCE_T::SHEETNAME );
|
||||
}
|
||||
else if( m_placementProperties->m_ComponentsRb->GetValue() )
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementEnabled( true );
|
||||
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS );
|
||||
m_zonesettings.SetPlacementAreaEnabled( true );
|
||||
setPlacementSource( PLACEMENT_SOURCE_T::COMPONENT_CLASS );
|
||||
}
|
||||
else if( m_placementProperties->m_GroupRb->GetValue() )
|
||||
{
|
||||
m_zonesettings.SetRuleAreaPlacementEnabled( true );
|
||||
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT );
|
||||
m_zonesettings.SetPlacementAreaEnabled( true );
|
||||
setPlacementSource( PLACEMENT_SOURCE_T::GROUP_PLACEMENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2632,21 +2632,18 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
|
||||
|
||||
// Multichannel settings
|
||||
m_out->Print( "(placement" );
|
||||
KICAD_FORMAT::FormatBool( m_out, "enabled", aZone->GetRuleAreaPlacementEnabled() );
|
||||
KICAD_FORMAT::FormatBool( m_out, "enabled", aZone->GetPlacementAreaEnabled() );
|
||||
|
||||
switch( aZone->GetRuleAreaPlacementSourceType() )
|
||||
switch( aZone->GetPlacementAreaSourceType() )
|
||||
{
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME:
|
||||
m_out->Print( "(sheetname %s)",
|
||||
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
|
||||
case PLACEMENT_SOURCE_T::SHEETNAME:
|
||||
m_out->Print( "(sheetname %s)", m_out->Quotew( aZone->GetPlacementAreaSource() ).c_str() );
|
||||
break;
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS:
|
||||
m_out->Print( "(component_class %s)",
|
||||
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
|
||||
case PLACEMENT_SOURCE_T::COMPONENT_CLASS:
|
||||
m_out->Print( "(component_class %s)", m_out->Quotew( aZone->GetPlacementAreaSource() ).c_str() );
|
||||
break;
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT:
|
||||
m_out->Print( "(group %s)",
|
||||
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
|
||||
case PLACEMENT_SOURCE_T::GROUP_PLACEMENT:
|
||||
m_out->Print( "(group %s)", m_out->Quotew( aZone->GetPlacementAreaSource() ).c_str() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7230,25 +7230,23 @@ ZONE* PCB_IO_KICAD_SEXPR_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
|
||||
{
|
||||
case T_sheetname:
|
||||
{
|
||||
zone->SetRuleAreaPlacementSourceType(
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
||||
zone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::SHEETNAME );
|
||||
NeedSYMBOL();
|
||||
zone->SetRuleAreaPlacementSource( FromUTF8() );
|
||||
zone->SetPlacementAreaSource( FromUTF8() );
|
||||
break;
|
||||
}
|
||||
case T_component_class:
|
||||
{
|
||||
zone->SetRuleAreaPlacementSourceType(
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS );
|
||||
zone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::COMPONENT_CLASS );
|
||||
NeedSYMBOL();
|
||||
zone->SetRuleAreaPlacementSource( FromUTF8() );
|
||||
zone->SetPlacementAreaSource( FromUTF8() );
|
||||
break;
|
||||
}
|
||||
case T_group:
|
||||
{
|
||||
zone->SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT );
|
||||
zone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::GROUP_PLACEMENT );
|
||||
NeedSYMBOL();
|
||||
zone->SetRuleAreaPlacementSource( FromUTF8() );
|
||||
zone->SetPlacementAreaSource( FromUTF8() );
|
||||
break;
|
||||
}
|
||||
case T_enabled:
|
||||
@ -7256,9 +7254,9 @@ ZONE* PCB_IO_KICAD_SEXPR_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_yes )
|
||||
zone->SetRuleAreaPlacementEnabled( true );
|
||||
zone->SetPlacementAreaEnabled( true );
|
||||
else if( token == T_no )
|
||||
zone->SetRuleAreaPlacementEnabled( false );
|
||||
zone->SetPlacementAreaEnabled( false );
|
||||
else
|
||||
Expecting( "yes or no" );
|
||||
|
||||
|
@ -95,20 +95,16 @@ bool MULTICHANNEL_TOOL::identifyComponentsInRuleArea( ZONE* aRul
|
||||
|
||||
wxString ruleText;
|
||||
|
||||
switch( aRuleArea->GetRuleAreaPlacementSourceType() )
|
||||
switch( aRuleArea->GetPlacementAreaSourceType() )
|
||||
{
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME:
|
||||
{
|
||||
ruleText = wxT( "A.memberOfSheetOrChildren('" ) + aRuleArea->GetRuleAreaPlacementSource()
|
||||
+ wxT( "')" );
|
||||
case PLACEMENT_SOURCE_T::SHEETNAME:
|
||||
ruleText = wxT( "A.memberOfSheetOrChildren('" ) + aRuleArea->GetPlacementAreaSource() + wxT( "')" );
|
||||
break;
|
||||
}
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS:
|
||||
ruleText = wxT( "A.hasComponentClass('" ) + aRuleArea->GetRuleAreaPlacementSource()
|
||||
+ wxT( "')" );
|
||||
case PLACEMENT_SOURCE_T::COMPONENT_CLASS:
|
||||
ruleText = wxT( "A.hasComponentClass('" ) + aRuleArea->GetPlacementAreaSource() + wxT( "')" );
|
||||
break;
|
||||
case RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT:
|
||||
ruleText = wxT( "A.memberOfGroup('" ) + aRuleArea->GetRuleAreaPlacementSource() + wxT( "')" );
|
||||
case PLACEMENT_SOURCE_T::GROUP_PLACEMENT:
|
||||
ruleText = wxT( "A.memberOfGroup('" ) + aRuleArea->GetPlacementAreaSource() + wxT( "')" );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -328,7 +324,7 @@ void MULTICHANNEL_TOOL::QuerySheetsAndComponentClasses()
|
||||
{
|
||||
RULE_AREA ent;
|
||||
|
||||
ent.m_sourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
ent.m_sourceType = PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
ent.m_generateEnabled = false;
|
||||
ent.m_sheetPath = sheet.first;
|
||||
ent.m_sheetName = sheet.second;
|
||||
@ -343,7 +339,7 @@ void MULTICHANNEL_TOOL::QuerySheetsAndComponentClasses()
|
||||
{
|
||||
RULE_AREA ent;
|
||||
|
||||
ent.m_sourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
|
||||
ent.m_sourceType = PLACEMENT_SOURCE_T::COMPONENT_CLASS;
|
||||
ent.m_generateEnabled = false;
|
||||
ent.m_componentClass = compClass;
|
||||
ent.m_components = queryComponentsInComponentClass( ent.m_componentClass );
|
||||
@ -357,7 +353,7 @@ void MULTICHANNEL_TOOL::QuerySheetsAndComponentClasses()
|
||||
{
|
||||
RULE_AREA ent;
|
||||
|
||||
ent.m_sourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT;
|
||||
ent.m_sourceType = PLACEMENT_SOURCE_T::GROUP_PLACEMENT;
|
||||
ent.m_generateEnabled = false;
|
||||
ent.m_groupName = groupName;
|
||||
ent.m_components = queryComponentsInGroup( ent.m_groupName );
|
||||
@ -377,7 +373,7 @@ void MULTICHANNEL_TOOL::FindExistingRuleAreas()
|
||||
{
|
||||
if( !zone->GetIsRuleArea() )
|
||||
continue;
|
||||
if( !zone->GetRuleAreaPlacementEnabled() )
|
||||
if( !zone->GetPlacementAreaEnabled() )
|
||||
continue;
|
||||
|
||||
RULE_AREA area;
|
||||
@ -430,7 +426,7 @@ int MULTICHANNEL_TOOL::repeatLayout( const TOOL_EVENT& aEvent )
|
||||
if( !zone->GetIsRuleArea() )
|
||||
return nullptr;
|
||||
|
||||
if( !zone->GetRuleAreaPlacementEnabled() )
|
||||
if( !zone->GetPlacementAreaEnabled() )
|
||||
return nullptr;
|
||||
|
||||
return zone;
|
||||
@ -1107,7 +1103,7 @@ int MULTICHANNEL_TOOL::AutogenerateRuleAreas( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( !zone->GetIsRuleArea() )
|
||||
continue;
|
||||
if( !zone->GetRuleAreaPlacementEnabled() )
|
||||
if( !zone->GetPlacementAreaEnabled() )
|
||||
continue;
|
||||
|
||||
std::set<FOOTPRINT*> components;
|
||||
@ -1120,27 +1116,22 @@ int MULTICHANNEL_TOOL::AutogenerateRuleAreas( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( components == ra.m_components )
|
||||
{
|
||||
if( zone->GetRuleAreaPlacementSourceType()
|
||||
== RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
{
|
||||
wxLogTrace(
|
||||
traceMultichannelTool,
|
||||
wxT( "Placement rule area for sheet '%s' already exists as '%s'\n" ),
|
||||
ra.m_sheetPath, zone->GetZoneName() );
|
||||
}
|
||||
else if( zone->GetRuleAreaPlacementSourceType()
|
||||
== RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
if( zone->GetPlacementAreaSourceType() == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
wxLogTrace( traceMultichannelTool,
|
||||
wxT( "Placement rule area for component class '%s' already exists "
|
||||
"as '%s'\n" ),
|
||||
wxT( "Placement rule area for sheet '%s' already exists as '%s'\n" ),
|
||||
ra.m_sheetPath, zone->GetZoneName() );
|
||||
}
|
||||
else if( zone->GetPlacementAreaSourceType() == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
{
|
||||
wxLogTrace( traceMultichannelTool,
|
||||
wxT( "Placement rule area for component class '%s' already exists as '%s'\n" ),
|
||||
ra.m_componentClass, zone->GetZoneName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceMultichannelTool,
|
||||
wxT( "Placement rule area for group '%s' already exists "
|
||||
"as '%s'\n" ),
|
||||
wxT( "Placement rule area for group '%s' already exists as '%s'\n" ),
|
||||
ra.m_groupName, zone->GetZoneName() );
|
||||
}
|
||||
|
||||
@ -1150,8 +1141,7 @@ int MULTICHANNEL_TOOL::AutogenerateRuleAreas( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceMultichannelTool,
|
||||
wxT( "%d placement areas found\n" ), (int) m_areas.m_areas.size() );
|
||||
wxLogTrace( traceMultichannelTool, wxT( "%d placement areas found\n" ), (int) m_areas.m_areas.size() );
|
||||
|
||||
BOARD_COMMIT commit( GetManager(), true );
|
||||
|
||||
@ -1170,48 +1160,39 @@ int MULTICHANNEL_TOOL::AutogenerateRuleAreas( const TOOL_EVENT& aEvent )
|
||||
|
||||
std::unique_ptr<ZONE> newZone( new ZONE( board() ) );
|
||||
|
||||
if( ra.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
{
|
||||
newZone->SetZoneName(
|
||||
wxString::Format( wxT( "auto-placement-area-%s" ), ra.m_sheetPath ) );
|
||||
}
|
||||
else if( ra.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
{
|
||||
newZone->SetZoneName(
|
||||
wxString::Format( wxT( "auto-placement-area-%s" ), ra.m_componentClass ) );
|
||||
}
|
||||
if( ra.m_sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
newZone->SetZoneName( wxString::Format( wxT( "auto-placement-area-%s" ), ra.m_sheetPath ) );
|
||||
else if( ra.m_sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
newZone->SetZoneName( wxString::Format( wxT( "auto-placement-area-%s" ), ra.m_componentClass ) );
|
||||
else
|
||||
{
|
||||
newZone->SetZoneName( wxString::Format( wxT( "auto-placement-area-%s" ), ra.m_groupName ) );
|
||||
}
|
||||
|
||||
wxLogTrace( traceMultichannelTool, wxT( "Generated rule area '%s' (%d components)\n" ),
|
||||
newZone->GetZoneName(), (int) ra.m_components.size() );
|
||||
|
||||
newZone->SetIsRuleArea( true );
|
||||
newZone->SetLayerSet( LSET::AllCuMask() );
|
||||
newZone->SetRuleAreaPlacementEnabled( true );
|
||||
newZone->SetPlacementAreaEnabled( true );
|
||||
newZone->SetDoNotAllowZoneFills( false );
|
||||
newZone->SetDoNotAllowVias( false );
|
||||
newZone->SetDoNotAllowTracks( false );
|
||||
newZone->SetDoNotAllowPads( false );
|
||||
newZone->SetDoNotAllowFootprints( false );
|
||||
|
||||
if( ra.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
|
||||
if( ra.m_sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
|
||||
{
|
||||
newZone->SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
||||
newZone->SetRuleAreaPlacementSource( ra.m_sheetPath );
|
||||
newZone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::SHEETNAME );
|
||||
newZone->SetPlacementAreaSource( ra.m_sheetPath );
|
||||
}
|
||||
else if( ra.m_sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS )
|
||||
else if( ra.m_sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
|
||||
{
|
||||
newZone->SetRuleAreaPlacementSourceType(
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS );
|
||||
newZone->SetRuleAreaPlacementSource( ra.m_componentClass );
|
||||
newZone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::COMPONENT_CLASS );
|
||||
newZone->SetPlacementAreaSource( ra.m_componentClass );
|
||||
}
|
||||
else
|
||||
{
|
||||
newZone->SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT );
|
||||
newZone->SetRuleAreaPlacementSource( ra.m_groupName );
|
||||
newZone->SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::GROUP_PLACEMENT );
|
||||
newZone->SetPlacementAreaSource( ra.m_groupName );
|
||||
}
|
||||
|
||||
newZone->AddPolygon( raOutline );
|
||||
|
@ -74,20 +74,20 @@ struct RULE_AREA_COMPAT_DATA
|
||||
|
||||
struct RULE_AREA
|
||||
{
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE m_sourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
|
||||
ZONE* m_oldArea = nullptr;
|
||||
ZONE* m_area = nullptr;
|
||||
std::set<FOOTPRINT*> m_raFootprints;
|
||||
std::set<FOOTPRINT*> m_components;
|
||||
bool m_existsAlready = false;
|
||||
bool m_generateEnabled = false;
|
||||
wxString m_sheetPath;
|
||||
wxString m_sheetName;
|
||||
wxString m_ruleName;
|
||||
wxString m_componentClass;
|
||||
KIID m_group;
|
||||
wxString m_groupName;
|
||||
VECTOR2I m_center;
|
||||
PLACEMENT_SOURCE_T m_sourceType = PLACEMENT_SOURCE_T::SHEETNAME;
|
||||
ZONE* m_oldArea = nullptr;
|
||||
ZONE* m_area = nullptr;
|
||||
std::set<FOOTPRINT*> m_raFootprints;
|
||||
std::set<FOOTPRINT*> m_components;
|
||||
bool m_existsAlready = false;
|
||||
bool m_generateEnabled = false;
|
||||
wxString m_sheetPath;
|
||||
wxString m_sheetName;
|
||||
wxString m_ruleName;
|
||||
wxString m_componentClass;
|
||||
KIID m_group;
|
||||
wxString m_groupName;
|
||||
VECTOR2I m_center;
|
||||
};
|
||||
|
||||
|
||||
|
215
pcbnew/zone.cpp
215
pcbnew/zone.cpp
@ -57,8 +57,8 @@ ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent ) :
|
||||
m_cornerRadius( 0 ),
|
||||
m_priority( 0 ),
|
||||
m_isRuleArea( false ),
|
||||
m_ruleAreaPlacementEnabled( false ),
|
||||
m_ruleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME ),
|
||||
m_placementAreaEnabled( false ),
|
||||
m_placementAreaSourceType( PLACEMENT_SOURCE_T::SHEETNAME ),
|
||||
m_teardropType( TEARDROP_TYPE::TD_NONE ),
|
||||
m_PadConnection( ZONE_CONNECTION::NONE ),
|
||||
m_ZoneClearance( 0 ),
|
||||
@ -73,7 +73,6 @@ ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent ) :
|
||||
m_hatchOrientation( ANGLE_0 ),
|
||||
m_hatchSmoothingLevel( 0 ),
|
||||
m_hatchHoleMinArea( 0 ),
|
||||
m_CornerSelection( nullptr ),
|
||||
m_area( 0.0 ),
|
||||
m_outlinearea( 0.0 )
|
||||
{
|
||||
@ -96,8 +95,7 @@ ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent ) :
|
||||
|
||||
ZONE::ZONE( const ZONE& aZone ) :
|
||||
BOARD_CONNECTED_ITEM( aZone ),
|
||||
m_Poly( nullptr ),
|
||||
m_CornerSelection( nullptr )
|
||||
m_Poly( nullptr )
|
||||
{
|
||||
InitDataFromSrcInCopyCtor( aZone );
|
||||
}
|
||||
@ -123,7 +121,6 @@ void ZONE::CopyFrom( const BOARD_ITEM* aOther )
|
||||
ZONE::~ZONE()
|
||||
{
|
||||
delete m_Poly;
|
||||
delete m_CornerSelection;
|
||||
|
||||
if( BOARD* board = GetBoard() )
|
||||
board->IncrementTimeStamp();
|
||||
@ -148,9 +145,9 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone )
|
||||
m_zoneName = aZone.m_zoneName;
|
||||
m_priority = aZone.m_priority;
|
||||
m_isRuleArea = aZone.m_isRuleArea;
|
||||
m_ruleAreaPlacementEnabled = aZone.m_ruleAreaPlacementEnabled;
|
||||
m_ruleAreaPlacementSourceType = aZone.m_ruleAreaPlacementSourceType;
|
||||
m_ruleAreaPlacementSource = aZone.m_ruleAreaPlacementSource;
|
||||
m_placementAreaEnabled = aZone.m_placementAreaEnabled;
|
||||
m_placementAreaSourceType = aZone.m_placementAreaSourceType;
|
||||
m_placementAreaSource = aZone.m_placementAreaSource;
|
||||
SetLayerSet( aZone.GetLayerSet() );
|
||||
|
||||
m_doNotAllowZoneFills = aZone.m_doNotAllowZoneFills;
|
||||
@ -182,10 +179,6 @@ void ZONE::InitDataFromSrcInCopyCtor( const ZONE& aZone )
|
||||
m_hatchBorderAlgorithm = aZone.m_hatchBorderAlgorithm;
|
||||
m_hatchHoleMinArea = aZone.m_hatchHoleMinArea;
|
||||
|
||||
// For corner moving, corner index to drag, or nullptr if no selection
|
||||
delete m_CornerSelection;
|
||||
m_CornerSelection = nullptr;
|
||||
|
||||
aZone.GetLayerSet().RunOnLayers(
|
||||
[&]( PCB_LAYER_ID layer )
|
||||
{
|
||||
@ -256,11 +249,10 @@ void ZONE::Serialize( google::protobuf::Any& aContainer ) const
|
||||
ra->set_keepout_tracks( m_doNotAllowTracks );
|
||||
ra->set_keepout_vias( m_doNotAllowVias );
|
||||
|
||||
ra->set_placement_enabled( m_ruleAreaPlacementEnabled );
|
||||
ra->set_placement_source( m_ruleAreaPlacementSource.ToUTF8() );
|
||||
ra->set_placement_source_type(
|
||||
ToProtoEnum<RULE_AREA_PLACEMENT_SOURCE_TYPE, types::PlacementRuleSourceType>(
|
||||
m_ruleAreaPlacementSourceType ) );
|
||||
ra->set_placement_enabled( m_placementAreaEnabled );
|
||||
ra->set_placement_source( m_placementAreaSource.ToUTF8() );
|
||||
ra->set_placement_source_type( ToProtoEnum<PLACEMENT_SOURCE_T,
|
||||
types::PlacementRuleSourceType>( m_placementAreaSourceType ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -360,10 +352,9 @@ bool ZONE::Deserialize( const google::protobuf::Any& aContainer )
|
||||
m_doNotAllowTracks = ra.keepout_tracks();
|
||||
m_doNotAllowVias = ra.keepout_vias();
|
||||
|
||||
m_ruleAreaPlacementEnabled = ra.placement_enabled();
|
||||
m_ruleAreaPlacementSource = wxString::FromUTF8( ra.placement_source() );
|
||||
m_ruleAreaPlacementSourceType =
|
||||
FromProtoEnum<RULE_AREA_PLACEMENT_SOURCE_TYPE>( ra.placement_source_type() );
|
||||
m_placementAreaEnabled = ra.placement_enabled();
|
||||
m_placementAreaSource = wxString::FromUTF8( ra.placement_source() );
|
||||
m_placementAreaSourceType = FromProtoEnum<PLACEMENT_SOURCE_T>( ra.placement_source_type() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -433,11 +424,8 @@ bool ZONE::HigherPriority( const ZONE* aOther ) const
|
||||
{
|
||||
// Teardrops are always higher priority than regular zones, so if one zone is a teardrop
|
||||
// and the other is not, then return higher priority as the teardrop
|
||||
if( ( m_teardropType == TEARDROP_TYPE::TD_NONE )
|
||||
^ ( aOther->m_teardropType == TEARDROP_TYPE::TD_NONE ) )
|
||||
{
|
||||
if( ( m_teardropType == TEARDROP_TYPE::TD_NONE ) ^ ( aOther->m_teardropType == TEARDROP_TYPE::TD_NONE ) )
|
||||
return static_cast<int>( m_teardropType ) > static_cast<int>( aOther->m_teardropType );
|
||||
}
|
||||
|
||||
if( m_priority != aOther->m_priority )
|
||||
return m_priority > aOther->m_priority;
|
||||
@ -485,9 +473,8 @@ VECTOR2I ZONE::GetPosition() const
|
||||
PCB_LAYER_ID ZONE::GetLayer() const
|
||||
{
|
||||
if( m_layerSet.count() == 1 )
|
||||
{
|
||||
return GetFirstLayer();
|
||||
}
|
||||
|
||||
return UNDEFINED_LAYER;
|
||||
}
|
||||
|
||||
@ -495,18 +482,14 @@ PCB_LAYER_ID ZONE::GetLayer() const
|
||||
PCB_LAYER_ID ZONE::GetFirstLayer() const
|
||||
{
|
||||
if( m_layerSet.count() == 0 )
|
||||
{
|
||||
return UNDEFINED_LAYER;
|
||||
}
|
||||
|
||||
const LSEQ uiLayers = m_layerSet.UIOrder();
|
||||
|
||||
// This can't use m_layerSet.count() because it's possible to have a zone on
|
||||
// a rescue layer that is not in the UI order.
|
||||
if( uiLayers.size() )
|
||||
{
|
||||
return uiLayers[0];
|
||||
}
|
||||
|
||||
// If it's not in the UI set at all, just return the first layer in the set.
|
||||
// (we know the count > 0)
|
||||
@ -563,10 +546,8 @@ void ZONE::SetLayerSet( const LSET& aLayerSet )
|
||||
const ZONE_LAYER_PROPERTIES& ZONE::LayerProperties( PCB_LAYER_ID aLayer ) const
|
||||
{
|
||||
wxCHECK_MSG( m_layerProperties.contains( aLayer ), m_layerProperties.at( GetFirstLayer() ),
|
||||
"Attempt to retrieve properties for layer "
|
||||
+ std::string( magic_enum::enum_name( aLayer ) )
|
||||
+ " from a "
|
||||
"zone that does not contain it" );
|
||||
"Zone has no layer " + std::string( magic_enum::enum_name( aLayer ) ) );
|
||||
|
||||
return m_layerProperties.at( aLayer );
|
||||
}
|
||||
|
||||
@ -581,12 +562,9 @@ void ZONE::SetLayerProperties( const std::map<PCB_LAYER_ID, ZONE_LAYER_PROPERTIE
|
||||
|
||||
const std::optional<VECTOR2I>& ZONE::HatchingOffset( PCB_LAYER_ID aLayer ) const
|
||||
{
|
||||
wxCHECK_MSG( m_layerProperties.contains( aLayer ),
|
||||
m_layerProperties.at( GetFirstLayer() ).hatching_offset,
|
||||
"Attempt to retrieve properties for layer "
|
||||
+ std::string( magic_enum::enum_name( aLayer ) )
|
||||
+ " from a "
|
||||
"zone that does not contain it" );
|
||||
wxCHECK_MSG( m_layerProperties.contains( aLayer ), m_layerProperties.at( GetFirstLayer() ).hatching_offset,
|
||||
"Zone has no layer " + std::string( magic_enum::enum_name( aLayer ) ) );
|
||||
|
||||
return m_layerProperties.at( aLayer ).hatching_offset;
|
||||
}
|
||||
|
||||
@ -837,11 +815,6 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
||||
{
|
||||
wxString msg = GetFriendlyName();
|
||||
|
||||
// Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
|
||||
// Check whether the selected corner is in a hole; i.e., in any contour but the first one.
|
||||
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
|
||||
msg << wxT( " " ) << _( "Cutout" );
|
||||
|
||||
aList.emplace_back( _( "Type" ), msg );
|
||||
|
||||
if( GetIsRuleArea() )
|
||||
@ -866,11 +839,8 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
||||
if( !msg.IsEmpty() )
|
||||
aList.emplace_back( _( "Restrictions" ), msg );
|
||||
|
||||
if( GetRuleAreaPlacementEnabled() )
|
||||
{
|
||||
aList.emplace_back( _( "Placement source" ),
|
||||
UnescapeString( GetRuleAreaPlacementSource() ) );
|
||||
}
|
||||
if( GetPlacementAreaEnabled() )
|
||||
aList.emplace_back( _( "Placement source" ), UnescapeString( GetPlacementAreaSource() ) );
|
||||
}
|
||||
else if( IsOnCopperLayer() )
|
||||
{
|
||||
@ -883,8 +853,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
||||
}
|
||||
|
||||
// Display priority level
|
||||
aList.emplace_back( _( "Priority" ),
|
||||
wxString::Format( wxT( "%d" ), GetAssignedPriority() ) );
|
||||
aList.emplace_back( _( "Priority" ), wxString::Format( wxT( "%d" ), GetAssignedPriority() ) );
|
||||
}
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
|
||||
@ -943,10 +912,8 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
||||
|
||||
if( !source.IsEmpty() )
|
||||
{
|
||||
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
|
||||
aFrame->MessageTextFromValue( clearance ) ),
|
||||
wxString::Format( _( "(from %s)" ),
|
||||
source ) );
|
||||
aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ), aFrame->MessageTextFromValue( clearance ) ),
|
||||
wxString::Format( _( "(from %s)" ), source ) );
|
||||
}
|
||||
|
||||
if( !m_FilledPolysList.empty() )
|
||||
@ -1034,9 +1001,7 @@ void ZONE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
|
||||
std::map<PCB_LAYER_ID, SHAPE_POLY_SET> fillsCopy;
|
||||
|
||||
for( auto& [oldLayer, shapePtr] : m_FilledPolysList )
|
||||
{
|
||||
fillsCopy[oldLayer] = *shapePtr;
|
||||
}
|
||||
|
||||
std::map<PCB_LAYER_ID, ZONE_LAYER_PROPERTIES> layerPropertiesCopy;
|
||||
|
||||
@ -1171,61 +1136,44 @@ wxString ZONE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull )
|
||||
layers.size() - 2 );
|
||||
}
|
||||
|
||||
// Check whether the selected contour is a hole (contour index > 0)
|
||||
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
|
||||
if( GetIsRuleArea() )
|
||||
{
|
||||
if( GetIsRuleArea() )
|
||||
return wxString::Format( _( "Rule Area Cutout %s" ), layerDesc );
|
||||
else
|
||||
return wxString::Format( _( "Zone Cutout %s" ), layerDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetIsRuleArea() )
|
||||
if( GetZoneName().IsEmpty() )
|
||||
{
|
||||
if( GetZoneName().IsEmpty() )
|
||||
{
|
||||
return wxString::Format( _( "Rule Area %s" ),
|
||||
layerDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "Rule Area '%s' %s" ),
|
||||
GetZoneName(),
|
||||
layerDesc );
|
||||
}
|
||||
}
|
||||
else if( IsTeardropArea() )
|
||||
{
|
||||
return wxString::Format( _( "Teardrop %s %s" ),
|
||||
GetNetnameMsg(),
|
||||
return wxString::Format( _( "Rule Area %s" ),
|
||||
layerDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetZoneName().IsEmpty() )
|
||||
{
|
||||
return wxString::Format( _( "Zone %s %s, priority %d" ),
|
||||
GetNetnameMsg(),
|
||||
layerDesc,
|
||||
GetAssignedPriority() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "Zone '%s' %s %s, priority %d" ),
|
||||
GetZoneName(),
|
||||
GetNetnameMsg(),
|
||||
layerDesc,
|
||||
GetAssignedPriority() );
|
||||
}
|
||||
return wxString::Format( _( "Rule Area '%s' %s" ),
|
||||
GetZoneName(),
|
||||
layerDesc );
|
||||
}
|
||||
}
|
||||
else if( IsTeardropArea() )
|
||||
{
|
||||
return wxString::Format( _( "Teardrop %s %s" ),
|
||||
GetNetnameMsg(),
|
||||
layerDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetZoneName().IsEmpty() )
|
||||
{
|
||||
return wxString::Format( _( "Zone %s %s, priority %d" ),
|
||||
GetNetnameMsg(),
|
||||
layerDesc,
|
||||
GetAssignedPriority() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "Zone '%s' %s %s, priority %d" ),
|
||||
GetZoneName(),
|
||||
GetNetnameMsg(),
|
||||
layerDesc,
|
||||
GetAssignedPriority() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ZONE::GetBorderHatchPitch() const
|
||||
{
|
||||
return m_borderHatchPitch;
|
||||
}
|
||||
|
||||
|
||||
@ -1242,12 +1190,6 @@ void ZONE::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle,
|
||||
}
|
||||
|
||||
|
||||
void ZONE::SetBorderHatchPitch( int aPitch )
|
||||
{
|
||||
m_borderHatchPitch = aPitch;
|
||||
}
|
||||
|
||||
|
||||
void ZONE::UnHatchBorder()
|
||||
{
|
||||
m_borderHatchLines.clear();
|
||||
@ -1689,13 +1631,13 @@ bool ZONE::operator==( const ZONE& aOther ) const
|
||||
if( GetDoNotAllowPads() != other.GetDoNotAllowPads() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementEnabled() != other.GetRuleAreaPlacementEnabled() )
|
||||
if( GetPlacementAreaEnabled() != other.GetPlacementAreaEnabled() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementSourceType() != other.GetRuleAreaPlacementSourceType() )
|
||||
if( GetPlacementAreaSourceType() != other.GetPlacementAreaSourceType() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementSource() != other.GetRuleAreaPlacementSource() )
|
||||
if( GetPlacementAreaSource() != other.GetPlacementAreaSource() )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -1848,15 +1790,14 @@ static struct ZONE_DESC
|
||||
.Map( ISLAND_REMOVAL_MODE::AREA, _HKI( "Below area limit" ) );
|
||||
}
|
||||
|
||||
ENUM_MAP<RULE_AREA_PLACEMENT_SOURCE_TYPE>& rapstMap =
|
||||
ENUM_MAP<RULE_AREA_PLACEMENT_SOURCE_TYPE>::Instance();
|
||||
ENUM_MAP<PLACEMENT_SOURCE_T>& rapstMap = ENUM_MAP<PLACEMENT_SOURCE_T>::Instance();
|
||||
|
||||
if( rapstMap.Choices().GetCount() == 0 )
|
||||
{
|
||||
rapstMap.Undefined( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
||||
rapstMap.Map( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME, _HKI( "Sheet Name" ) )
|
||||
.Map( RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS, _HKI( "Component Class" ) )
|
||||
.Map( RULE_AREA_PLACEMENT_SOURCE_TYPE::GROUP_PLACEMENT, _HKI( "Group" ) );
|
||||
rapstMap.Undefined( PLACEMENT_SOURCE_T::SHEETNAME );
|
||||
rapstMap.Map( PLACEMENT_SOURCE_T::SHEETNAME, _HKI( "Sheet Name" ) )
|
||||
.Map( PLACEMENT_SOURCE_T::COMPONENT_CLASS, _HKI( "Component Class" ) )
|
||||
.Map( PLACEMENT_SOURCE_T::GROUP_PLACEMENT, _HKI( "Group" ) );
|
||||
}
|
||||
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
@ -1971,20 +1912,20 @@ static struct ZONE_DESC
|
||||
const wxString groupPlacement = _HKI( "Placement" );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<ZONE, bool>( _HKI( "Enable" ),
|
||||
&ZONE::SetRuleAreaPlacementEnabled,
|
||||
&ZONE::GetRuleAreaPlacementEnabled ),
|
||||
&ZONE::SetPlacementAreaEnabled,
|
||||
&ZONE::GetPlacementAreaEnabled ),
|
||||
groupPlacement )
|
||||
.SetAvailableFunc( isRuleArea );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, RULE_AREA_PLACEMENT_SOURCE_TYPE>(
|
||||
_HKI( "Source Type" ), &ZONE::SetRuleAreaPlacementSourceType,
|
||||
&ZONE::GetRuleAreaPlacementSourceType ),
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, PLACEMENT_SOURCE_T>( _HKI( "Source Type" ),
|
||||
&ZONE::SetPlacementAreaSourceType,
|
||||
&ZONE::GetPlacementAreaSourceType ),
|
||||
groupPlacement )
|
||||
.SetAvailableFunc( isRuleArea );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Source Name" ),
|
||||
&ZONE::SetRuleAreaPlacementSource,
|
||||
&ZONE::GetRuleAreaPlacementSource ),
|
||||
&ZONE::SetPlacementAreaSource,
|
||||
&ZONE::GetPlacementAreaSource ),
|
||||
groupPlacement )
|
||||
.SetAvailableFunc( isRuleArea );
|
||||
|
||||
@ -2003,7 +1944,6 @@ static struct ZONE_DESC
|
||||
.SetAvailableFunc( isCopperZone )
|
||||
.SetWriteableFunc( isHatchedFill );
|
||||
|
||||
// TODO: Switch to translated
|
||||
auto atLeastMinWidthValidator =
|
||||
[]( const wxAny&& aValue, EDA_ITEM* aZone ) -> VALIDATOR_RESULT
|
||||
{
|
||||
@ -2012,10 +1952,7 @@ static struct ZONE_DESC
|
||||
wxCHECK( zone, std::nullopt );
|
||||
|
||||
if( val < zone->GetMinThickness() )
|
||||
{
|
||||
return std::make_unique<VALIDATION_ERROR_MSG>(
|
||||
_( "Cannot be less than zone minimum width" ) );
|
||||
}
|
||||
return std::make_unique<VALIDATION_ERROR_MSG>( _( "Cannot be less than zone minimum width" ) );
|
||||
|
||||
return std::nullopt;
|
||||
};
|
||||
@ -2067,12 +2004,12 @@ static struct ZONE_DESC
|
||||
|
||||
const wxString groupElectrical = _HKI( "Electrical" );
|
||||
|
||||
auto clearanceOverride = new PROPERTY<ZONE, std::optional<int>>( _HKI( "Clearance" ),
|
||||
auto clearance = new PROPERTY<ZONE, std::optional<int>>( _HKI( "Clearance" ),
|
||||
&ZONE::SetLocalClearance, &ZONE::GetLocalClearance,
|
||||
PROPERTY_DISPLAY::PT_SIZE );
|
||||
clearanceOverride->SetAvailableFunc( isCopperZone );
|
||||
clearance->SetAvailableFunc( isCopperZone );
|
||||
constexpr int maxClearance = pcbIUScale.mmToIU( ZONE_CLEARANCE_MAX_VALUE_MM );
|
||||
clearanceOverride->SetValidator( PROPERTY_VALIDATORS::RangeIntValidator<0, maxClearance> );
|
||||
clearance->SetValidator( PROPERTY_VALIDATORS::RangeIntValidator<0, maxClearance> );
|
||||
|
||||
auto minWidth = new PROPERTY<ZONE, int>( _HKI( "Minimum Width" ),
|
||||
&ZONE::SetMinThickness, &ZONE::GetMinThickness,
|
||||
@ -2097,7 +2034,7 @@ static struct ZONE_DESC
|
||||
thermalSpokeWidth->SetAvailableFunc( isCopperZone );
|
||||
thermalSpokeWidth->SetValidator( atLeastMinWidthValidator );
|
||||
|
||||
propMgr.AddProperty( clearanceOverride, groupElectrical );
|
||||
propMgr.AddProperty( clearance, groupElectrical );
|
||||
propMgr.AddProperty( minWidth, groupElectrical );
|
||||
propMgr.AddProperty( padConnections, groupElectrical );
|
||||
propMgr.AddProperty( thermalGap, groupElectrical );
|
||||
@ -2105,7 +2042,7 @@ static struct ZONE_DESC
|
||||
}
|
||||
} _ZONE_DESC;
|
||||
|
||||
IMPLEMENT_ENUM_TO_WXANY( RULE_AREA_PLACEMENT_SOURCE_TYPE )
|
||||
IMPLEMENT_ENUM_TO_WXANY( PLACEMENT_SOURCE_T )
|
||||
IMPLEMENT_ENUM_TO_WXANY( ZONE_CONNECTION )
|
||||
IMPLEMENT_ENUM_TO_WXANY( ZONE_FILL_MODE )
|
||||
IMPLEMENT_ENUM_TO_WXANY( ISLAND_REMOVAL_MODE )
|
||||
|
129
pcbnew/zone.h
129
pcbnew/zone.h
@ -183,19 +183,7 @@ public:
|
||||
* @return the zone's clearance in internal units.
|
||||
*/
|
||||
std::optional<int> GetLocalClearance() const override;
|
||||
|
||||
/**
|
||||
* Set the local clearance for this zone.
|
||||
*
|
||||
* @param aClearance is the clearance in internal units, or std::nullopt to clear it.
|
||||
*/
|
||||
void SetLocalClearance( std::optional<int> aClearance )
|
||||
{
|
||||
if( aClearance )
|
||||
m_ZoneClearance = aClearance.value();
|
||||
else
|
||||
m_ZoneClearance = 0;
|
||||
}
|
||||
void SetLocalClearance( std::optional<int> aClearance ) { m_ZoneClearance = aClearance.value_or( 0 ); };
|
||||
|
||||
/**
|
||||
* Return any local clearances set in the "classic" (ie: pre-rule) system.
|
||||
@ -313,16 +301,10 @@ public:
|
||||
int GetMinThickness() const { return m_ZoneMinThickness; }
|
||||
void SetMinThickness( int aMinThickness )
|
||||
{
|
||||
if( m_ZoneMinThickness != aMinThickness
|
||||
|| ( m_fillMode == ZONE_FILL_MODE::HATCH_PATTERN
|
||||
&& ( m_hatchThickness < aMinThickness || m_hatchGap < aMinThickness ) ) )
|
||||
{
|
||||
SetNeedRefill( true );
|
||||
}
|
||||
|
||||
m_ZoneMinThickness = aMinThickness;
|
||||
m_hatchThickness = std::max( m_hatchThickness, aMinThickness );
|
||||
m_hatchGap = std::max( m_hatchGap, aMinThickness );
|
||||
SetNeedRefill( true );
|
||||
}
|
||||
|
||||
int GetHatchThickness() const { return m_hatchThickness; }
|
||||
@ -346,33 +328,6 @@ public:
|
||||
int GetHatchBorderAlgorithm() const { return m_hatchBorderAlgorithm; }
|
||||
void SetHatchBorderAlgorithm( int aAlgo ) { m_hatchBorderAlgorithm = aAlgo; }
|
||||
|
||||
int GetSelectedCorner() const
|
||||
{
|
||||
// Transform relative indices to global index
|
||||
int globalIndex = -1;
|
||||
|
||||
if( m_CornerSelection )
|
||||
m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
|
||||
|
||||
return globalIndex;
|
||||
}
|
||||
|
||||
void SetSelectedCorner( int aCorner )
|
||||
{
|
||||
SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
|
||||
|
||||
// If the global index of the corner is correct, assign it to m_CornerSelection
|
||||
if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
|
||||
{
|
||||
if( m_CornerSelection == nullptr )
|
||||
m_CornerSelection = new SHAPE_POLY_SET::VERTEX_INDEX;
|
||||
|
||||
*m_CornerSelection = selectedCorner;
|
||||
}
|
||||
else
|
||||
throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
|
||||
}
|
||||
|
||||
///
|
||||
int GetLocalFlags() const { return m_localFlgs; }
|
||||
void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
|
||||
@ -385,7 +340,7 @@ public:
|
||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||
virtual std::shared_ptr<SHAPE>
|
||||
GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
||||
/**
|
||||
* Test if a point is near an outline edge or a corner of this zone.
|
||||
@ -607,26 +562,6 @@ public:
|
||||
return m_Poly->CVertex( index );
|
||||
}
|
||||
|
||||
void SetCornerPosition( int aCornerIndex, const VECTOR2I& new_pos )
|
||||
{
|
||||
SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
|
||||
|
||||
// Convert global to relative indices
|
||||
if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
|
||||
{
|
||||
if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
|
||||
|| m_Poly->CVertex( relativeIndices ).y != new_pos.y )
|
||||
{
|
||||
SetNeedRefill( true );
|
||||
m_Poly->SetVertex( relativeIndices, new_pos );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new hole on the zone; i.e., a new contour on the zone's outline.
|
||||
*/
|
||||
@ -763,18 +698,17 @@ public:
|
||||
*/
|
||||
bool GetIsRuleArea() const { return m_isRuleArea; }
|
||||
void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
|
||||
bool GetRuleAreaPlacementEnabled() const { return m_ruleAreaPlacementEnabled ; }
|
||||
void SetRuleAreaPlacementEnabled( bool aEnabled ) { m_ruleAreaPlacementEnabled = aEnabled; }
|
||||
bool GetPlacementAreaEnabled() const { return m_placementAreaEnabled; }
|
||||
void SetPlacementAreaEnabled( bool aEnabled ) { m_placementAreaEnabled = aEnabled; }
|
||||
|
||||
wxString GetRuleAreaPlacementSource() const { return m_ruleAreaPlacementSource; }
|
||||
void SetRuleAreaPlacementSource( const wxString& aSource ) { m_ruleAreaPlacementSource = aSource; }
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE GetRuleAreaPlacementSourceType() const
|
||||
wxString GetPlacementAreaSource() const { return m_placementAreaSource; }
|
||||
void SetPlacementAreaSource( const wxString& aSource ) { m_placementAreaSource = aSource; }
|
||||
PLACEMENT_SOURCE_T GetPlacementAreaSourceType() const
|
||||
{
|
||||
return m_ruleAreaPlacementSourceType;
|
||||
return m_placementAreaSourceType;
|
||||
}
|
||||
void SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE aType )
|
||||
{
|
||||
m_ruleAreaPlacementSourceType = aType;
|
||||
void SetPlacementAreaSourceType( PLACEMENT_SOURCE_T aType )
|
||||
{ m_placementAreaSourceType = aType;
|
||||
}
|
||||
|
||||
bool GetDoNotAllowZoneFills() const { return m_doNotAllowZoneFills; }
|
||||
@ -802,7 +736,8 @@ public:
|
||||
/**
|
||||
* @return the zone hatch pitch in iu.
|
||||
*/
|
||||
int GetBorderHatchPitch() const;
|
||||
int GetBorderHatchPitch() const { return m_borderHatchPitch; }
|
||||
void SetBorderHatchPitch( int aPitch ) { m_borderHatchPitch = aPitch; }
|
||||
|
||||
/**
|
||||
* @return the default hatch pitch in internal units.
|
||||
@ -821,13 +756,6 @@ public:
|
||||
void SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch,
|
||||
bool aRebuilBorderdHatch );
|
||||
|
||||
/**
|
||||
* Set the hatch pitch parameter for the zone.
|
||||
*
|
||||
* @param aPitch is the hatch pitch in iu.
|
||||
*/
|
||||
void SetBorderHatchPitch( int aPitch );
|
||||
|
||||
/**
|
||||
* Clear the zone's hatch.
|
||||
*/
|
||||
@ -837,7 +765,7 @@ public:
|
||||
* Compute the hatch lines depending on the hatch parameters and stores it in the zone's
|
||||
* attribute m_borderHatchLines.
|
||||
*/
|
||||
void HatchBorder();
|
||||
void HatchBorder();
|
||||
|
||||
const std::vector<SEG>& GetHatchLines() const { return m_borderHatchLines; }
|
||||
|
||||
@ -897,15 +825,15 @@ protected:
|
||||
/**
|
||||
* Placement rule area data
|
||||
*/
|
||||
bool m_ruleAreaPlacementEnabled;
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE m_ruleAreaPlacementSourceType;
|
||||
wxString m_ruleAreaPlacementSource;
|
||||
bool m_placementAreaEnabled;
|
||||
PLACEMENT_SOURCE_T m_placementAreaSourceType;
|
||||
wxString m_placementAreaSource;
|
||||
|
||||
/* A zone outline can be a teardrop zone with different rules for priority
|
||||
* (always bigger priority than copper zones) and never removed from a
|
||||
* copper zone having the same netcode
|
||||
*/
|
||||
TEARDROP_TYPE m_teardropType;
|
||||
TEARDROP_TYPE m_teardropType;
|
||||
|
||||
/* For keepout zones only:
|
||||
* what is not allowed inside the keepout ( pads, tracks and vias )
|
||||
@ -927,10 +855,10 @@ protected:
|
||||
* When island removal mode is set to AREA, islands below this area will be removed.
|
||||
* If this value is negative, all islands will be removed.
|
||||
*/
|
||||
long long int m_minIslandArea;
|
||||
long long int m_minIslandArea;
|
||||
|
||||
/** True when a zone was filled, false after deleting the filled areas. */
|
||||
bool m_isFilled;
|
||||
bool m_isFilled;
|
||||
|
||||
/**
|
||||
* False when a zone was refilled, true after changes in zone params.
|
||||
@ -942,14 +870,7 @@ protected:
|
||||
int m_thermalReliefGap; // Width of the gap in thermal reliefs.
|
||||
int m_thermalReliefSpokeWidth; // Width of the copper bridge in thermal reliefs.
|
||||
|
||||
|
||||
/**
|
||||
* How to fill areas:
|
||||
*
|
||||
* ZONE_FILL_MODE::POLYGONS => use solid polygons
|
||||
* ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape
|
||||
*/
|
||||
ZONE_FILL_MODE m_fillMode;
|
||||
ZONE_FILL_MODE m_fillMode; // fill with POLYGONS vs HATCH_PATTERN
|
||||
int m_hatchThickness; // thickness of lines (if 0 -> solid shape)
|
||||
int m_hatchGap; // gap between lines (0 -> solid shape
|
||||
EDA_ANGLE m_hatchOrientation; // orientation of grid lines
|
||||
@ -961,10 +882,6 @@ protected:
|
||||
double m_hatchHoleMinArea; // min size before holes are dropped (ratio)
|
||||
int m_hatchBorderAlgorithm; // 0 = use min zone thickness
|
||||
// 1 = use hatch thickness
|
||||
|
||||
/// The index of the corner being moved or nullptr if no corner is selected.
|
||||
SHAPE_POLY_SET::VERTEX_INDEX* m_CornerSelection;
|
||||
|
||||
int m_localFlgs; // Variable used in polygon calculations.
|
||||
|
||||
/* set of filled polygons used to draw a zone as a filled area.
|
||||
@ -994,7 +911,7 @@ protected:
|
||||
double m_outlinearea; // The outline zone area
|
||||
|
||||
/// Lock used for multi-threaded filling on multi-layer zones
|
||||
std::mutex m_lock;
|
||||
std::mutex m_lock;
|
||||
};
|
||||
|
||||
|
||||
@ -1002,7 +919,7 @@ protected:
|
||||
DECLARE_ENUM_TO_WXANY( ZONE_CONNECTION )
|
||||
DECLARE_ENUM_TO_WXANY( ZONE_FILL_MODE )
|
||||
DECLARE_ENUM_TO_WXANY( ISLAND_REMOVAL_MODE )
|
||||
DECLARE_ENUM_TO_WXANY( RULE_AREA_PLACEMENT_SOURCE_TYPE )
|
||||
DECLARE_ENUM_TO_WXANY( PLACEMENT_SOURCE_T )
|
||||
#endif
|
||||
|
||||
#endif // ZONE_H
|
||||
|
@ -81,7 +81,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
|
||||
m_minIslandArea = 10 * pcbIUScale.IU_PER_MM * pcbIUScale.IU_PER_MM;
|
||||
|
||||
SetIsRuleArea( false );
|
||||
SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
|
||||
SetPlacementAreaSourceType( PLACEMENT_SOURCE_T::SHEETNAME );
|
||||
SetDoNotAllowZoneFills( false );
|
||||
SetDoNotAllowVias( true );
|
||||
SetDoNotAllowTracks( true );
|
||||
@ -89,7 +89,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
|
||||
SetDoNotAllowFootprints( false );
|
||||
|
||||
m_TeardropType = TEARDROP_TYPE::TD_NONE;
|
||||
m_ruleAreaPlacementEnabled = false;
|
||||
m_placementAreaEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
@ -116,9 +116,9 @@ bool ZONE_SETTINGS::operator==( const ZONE_SETTINGS& aOther ) const
|
||||
if( m_cornerSmoothingType != aOther.m_cornerSmoothingType ) return false;
|
||||
if( m_cornerRadius != aOther.m_cornerRadius ) return false;
|
||||
if( m_isRuleArea != aOther.m_isRuleArea ) return false;
|
||||
if( m_ruleAreaPlacementEnabled != aOther.m_ruleAreaPlacementEnabled ) return false;
|
||||
if( m_ruleAreaPlacementSourceType != aOther.m_ruleAreaPlacementSourceType ) return false;
|
||||
if( m_ruleAreaPlacementSource != aOther.m_ruleAreaPlacementSource ) return false;
|
||||
if( m_placementAreaEnabled != aOther.m_placementAreaEnabled ) return false;
|
||||
if( m_placementAreaSourceType != aOther.m_placementAreaSourceType ) return false;
|
||||
if( m_placementAreaSource != aOther.m_placementAreaSource ) return false;
|
||||
if( m_keepoutDoNotAllowZoneFills != aOther.m_keepoutDoNotAllowZoneFills ) return false;
|
||||
if( m_keepoutDoNotAllowVias != aOther.m_keepoutDoNotAllowVias ) return false;
|
||||
if( m_keepoutDoNotAllowTracks != aOther.m_keepoutDoNotAllowTracks ) return false;
|
||||
@ -166,9 +166,9 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource )
|
||||
m_cornerSmoothingType = aSource.GetCornerSmoothingType();
|
||||
m_cornerRadius = aSource.GetCornerRadius();
|
||||
m_isRuleArea = aSource.GetIsRuleArea();
|
||||
m_ruleAreaPlacementEnabled = aSource.GetRuleAreaPlacementEnabled();
|
||||
m_ruleAreaPlacementSourceType = aSource.GetRuleAreaPlacementSourceType();
|
||||
m_ruleAreaPlacementSource = aSource.GetRuleAreaPlacementSource();
|
||||
m_placementAreaEnabled = aSource.GetPlacementAreaEnabled();
|
||||
m_placementAreaSourceType = aSource.GetPlacementAreaSourceType();
|
||||
m_placementAreaSource = aSource.GetPlacementAreaSource();
|
||||
m_keepoutDoNotAllowZoneFills = aSource.GetDoNotAllowZoneFills();
|
||||
m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
|
||||
m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
|
||||
@ -212,9 +212,9 @@ void ZONE_SETTINGS::ExportSetting( ZONE& aTarget, bool aFullExport ) const
|
||||
aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
|
||||
aTarget.SetCornerRadius( m_cornerRadius );
|
||||
aTarget.SetIsRuleArea( GetIsRuleArea() );
|
||||
aTarget.SetRuleAreaPlacementEnabled( GetRuleAreaPlacementEnabled() );
|
||||
aTarget.SetRuleAreaPlacementSourceType( GetRuleAreaPlacementSourceType() );
|
||||
aTarget.SetRuleAreaPlacementSource( GetRuleAreaPlacementSource() );
|
||||
aTarget.SetPlacementAreaEnabled( GetPlacementAreaEnabled() );
|
||||
aTarget.SetPlacementAreaSourceType( GetPlacementAreaSourceType() );
|
||||
aTarget.SetPlacementAreaSource( GetPlacementAreaSource() );
|
||||
aTarget.SetDoNotAllowZoneFills( GetDoNotAllowZoneFills() );
|
||||
aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
|
||||
aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
|
||||
@ -273,9 +273,9 @@ void ZONE_SETTINGS::CopyFrom( const ZONE_SETTINGS& aOther, bool aCopyFull )
|
||||
m_cornerSmoothingType = aOther.m_cornerSmoothingType;
|
||||
m_cornerRadius = aOther.m_cornerRadius;
|
||||
m_isRuleArea = aOther.m_isRuleArea;
|
||||
m_ruleAreaPlacementEnabled = aOther.m_ruleAreaPlacementEnabled;
|
||||
m_ruleAreaPlacementSourceType = aOther.m_ruleAreaPlacementSourceType;
|
||||
m_ruleAreaPlacementSource = aOther.m_ruleAreaPlacementSource;
|
||||
m_placementAreaEnabled = aOther.m_placementAreaEnabled;
|
||||
m_placementAreaSourceType = aOther.m_placementAreaSourceType;
|
||||
m_placementAreaSource = aOther.m_placementAreaSource;
|
||||
m_keepoutDoNotAllowZoneFills = aOther.m_keepoutDoNotAllowZoneFills;
|
||||
m_keepoutDoNotAllowVias = aOther.m_keepoutDoNotAllowVias;
|
||||
m_keepoutDoNotAllowTracks = aOther.m_keepoutDoNotAllowTracks;
|
||||
|
@ -71,7 +71,7 @@ enum class ISLAND_REMOVAL_MODE
|
||||
AREA
|
||||
};
|
||||
|
||||
enum class RULE_AREA_PLACEMENT_SOURCE_TYPE
|
||||
enum class PLACEMENT_SOURCE_T
|
||||
{
|
||||
SHEETNAME = 0,
|
||||
COMPONENT_CLASS,
|
||||
@ -146,9 +146,9 @@ private:
|
||||
/**
|
||||
* Placement rule area data
|
||||
*/
|
||||
bool m_ruleAreaPlacementEnabled;
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE m_ruleAreaPlacementSourceType;
|
||||
wxString m_ruleAreaPlacementSource;
|
||||
bool m_placementAreaEnabled;
|
||||
PLACEMENT_SOURCE_T m_placementAreaSourceType;
|
||||
wxString m_placementAreaSource;
|
||||
|
||||
bool m_keepoutDoNotAllowZoneFills;
|
||||
bool m_keepoutDoNotAllowVias;
|
||||
@ -233,39 +233,30 @@ public:
|
||||
/**
|
||||
* Accessors to parameters used in Rule Area zones:
|
||||
*/
|
||||
bool GetIsRuleArea() const { return m_isRuleArea; }
|
||||
bool GetRuleAreaPlacementEnabled() const { return m_ruleAreaPlacementEnabled; }
|
||||
RULE_AREA_PLACEMENT_SOURCE_TYPE GetRuleAreaPlacementSourceType() const
|
||||
{
|
||||
return m_ruleAreaPlacementSourceType;
|
||||
}
|
||||
wxString GetRuleAreaPlacementSource() const { return m_ruleAreaPlacementSource; }
|
||||
bool GetPlacementAreaEnabled() const { return m_placementAreaEnabled; }
|
||||
PLACEMENT_SOURCE_T GetPlacementAreaSourceType() const { return m_placementAreaSourceType; }
|
||||
wxString GetPlacementAreaSource() const { return m_placementAreaSource; }
|
||||
bool GetIsRuleArea() const { return m_isRuleArea; }
|
||||
bool GetDoNotAllowZoneFills() const { return m_keepoutDoNotAllowZoneFills; }
|
||||
bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
|
||||
bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
|
||||
bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
|
||||
bool GetDoNotAllowFootprints() const { return m_keepoutDoNotAllowFootprints; }
|
||||
|
||||
void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
|
||||
void SetRuleAreaPlacementEnabled( bool aEnabled ) { m_ruleAreaPlacementEnabled = aEnabled; }
|
||||
void SetRuleAreaPlacementSourceType( RULE_AREA_PLACEMENT_SOURCE_TYPE aType )
|
||||
{
|
||||
m_ruleAreaPlacementSourceType = aType;
|
||||
}
|
||||
void SetRuleAreaPlacementSource( const wxString& aSource )
|
||||
{
|
||||
m_ruleAreaPlacementSource = aSource;
|
||||
}
|
||||
void SetPlacementAreaEnabled( bool aEnabled ) { m_placementAreaEnabled = aEnabled; }
|
||||
void SetPlacementAreaSourceType( PLACEMENT_SOURCE_T aType ) { m_placementAreaSourceType = aType; }
|
||||
void SetPlacementAreaSource( const wxString& aSource ) { m_placementAreaSource = aSource; }
|
||||
void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
|
||||
void SetDoNotAllowZoneFills( bool aEnable ) { m_keepoutDoNotAllowZoneFills = aEnable; }
|
||||
void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
|
||||
void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
|
||||
void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
|
||||
void SetDoNotAllowFootprints( bool aEnable ) { m_keepoutDoNotAllowFootprints = aEnable; }
|
||||
|
||||
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const { return m_removeIslands; }
|
||||
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const { return m_removeIslands; }
|
||||
void SetIslandRemovalMode( ISLAND_REMOVAL_MODE aRemove ) { m_removeIslands = aRemove; }
|
||||
|
||||
long long int GetMinIslandArea() const { return m_minIslandArea; }
|
||||
long long int GetMinIslandArea() const { return m_minIslandArea; }
|
||||
void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
|
||||
};
|
||||
|
||||
|
@ -82,13 +82,13 @@ bool ZONE::IsSame( const ZONE& aZoneToCompare )
|
||||
if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementEnabled() != aZoneToCompare.GetRuleAreaPlacementEnabled() )
|
||||
if( GetPlacementAreaEnabled() != aZoneToCompare.GetPlacementAreaEnabled() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementSourceType() != aZoneToCompare.GetRuleAreaPlacementSourceType() )
|
||||
if( GetPlacementAreaSourceType() != aZoneToCompare.GetPlacementAreaSourceType() )
|
||||
return false;
|
||||
|
||||
if( GetRuleAreaPlacementSource() != aZoneToCompare.GetRuleAreaPlacementSource() )
|
||||
if( GetPlacementAreaSource() != aZoneToCompare.GetPlacementAreaSource() )
|
||||
return false;
|
||||
|
||||
if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
|
||||
|
@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE( ZoneBorderStyle )
|
||||
|
||||
BOOST_AUTO_TEST_CASE( PlacementRuleSourceType )
|
||||
{
|
||||
testEnums<RULE_AREA_PLACEMENT_SOURCE_TYPE, kiapi::board::types::PlacementRuleSourceType>();
|
||||
testEnums<PLACEMENT_SOURCE_T, kiapi::board::types::PlacementRuleSourceType>();
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( TeardropType )
|
||||
|
Loading…
x
Reference in New Issue
Block a user