Implement pad & via aprons for hatched zones.

Fixes https://gitlab.com/kicad/code/kicad/issues/2519
This commit is contained in:
Jeff Young 2020-08-07 15:04:34 +01:00
parent bf60482b5c
commit 00e77d1ba4
32 changed files with 3265 additions and 3227 deletions

View File

@ -124,6 +124,8 @@ hatch_gap
hatch_orientation
hatch_smoothing_level
hatch_smoothing_value
hatch_border_algorithm
hatch_min_hole_area
hide
hole_to_hole_min
island

View File

@ -1337,25 +1337,24 @@ void ALTIUM_PCB::ParsePolygons6Data(
elem.hatchstyle != ALTIUM_POLYGON_HATCHSTYLE::UNKNOWN )
{
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
zone->SetHatchFillTypeThickness( elem.trackwidth );
zone->SetHatchThickness( elem.trackwidth );
if( elem.hatchstyle == ALTIUM_POLYGON_HATCHSTYLE::NONE )
{
// use a small hack to get us only an outline (hopefully)
const EDA_RECT& bbox = zone->GetBoundingBox();
zone->SetHatchFillTypeGap( std::max( bbox.GetHeight(), bbox.GetWidth() ) );
zone->SetHatchGap( std::max( bbox.GetHeight(), bbox.GetWidth() ) );
}
else
{
zone->SetHatchFillTypeGap( elem.gridsize - elem.trackwidth );
zone->SetHatchGap( elem.gridsize - elem.trackwidth );
}
zone->SetHatchFillTypeOrientation(
elem.hatchstyle == ALTIUM_POLYGON_HATCHSTYLE::DEGREE_45 ? 45 : 0 );
zone->SetHatchOrientation( elem.hatchstyle == ALTIUM_POLYGON_HATCHSTYLE::DEGREE_45 ? 45 : 0 );
}
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
if( reader.GetRemainingBytes() != 0 )
@ -1457,8 +1456,8 @@ void ALTIUM_PCB::ParseShapeBasedRegions6Data(
zone->AppendCorner( vertice.position, -1 );
}
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else if( elem.kind == ALTIUM_REGION_KIND::COPPER )
{
@ -1621,11 +1620,10 @@ void ALTIUM_PCB::ParseArcs6Data(
zone->SetDoNotAllowCopperPour( true );
ds.TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, false );
zone->Outline()->Simplify(
SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); // the outline is not a single polygon!
zone->Outline()->Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); // the outline is not a single polygon!
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
continue;
}
@ -2177,8 +2175,8 @@ void ALTIUM_PCB::ParseTracks6Data(
ds.TransformShapeWithClearanceToPolygon( *zone->Outline(), 0, ARC_HIGH_DEF, false );
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
continue;
}
@ -2446,8 +2444,8 @@ void ALTIUM_PCB::ParseFills6Data(
zone->Rotate( center, elem.rotation * 10 );
}
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else
{

View File

@ -1670,7 +1670,7 @@ std::list<ZONE_CONTAINER*> BOARD::GetZoneList( bool aIncludeZonesInFootprints )
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
wxPoint aStartPointPosition, ZONE_HATCH_STYLE aHatch )
wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch )
{
ZONE_CONTAINER* new_area = InsertArea( aNetcode,
m_ZoneDescriptorList.size( ) - 1,
@ -1706,7 +1706,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
ZONE_CONTAINER* BOARD::InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX,
int aCornerY, ZONE_HATCH_STYLE aHatch )
int aCornerY, ZONE_BORDER_DISPLAY_STYLE aHatch )
{
ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
@ -1718,7 +1718,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLay
else
m_ZoneDescriptorList.push_back( new_area );
new_area->SetHatchStyle( (ZONE_HATCH_STYLE) aHatch );
new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
// Add the first corner to the new zone
new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 );
@ -1737,7 +1737,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
if( aCurrArea->Outline()->IsSelfIntersecting() )
{
aCurrArea->UnHatch();
aCurrArea->UnHatchBorder();
// Normalize copied area and store resulting number of polygons
int n_poly = aCurrArea->Outline()->NormalizeAreaOutlines();
@ -1759,7 +1759,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
// and replace it with a poly from NormalizeAreaOutlines
delete NewArea->Outline();
NewArea->SetOutline( new_p );
NewArea->Hatch();
NewArea->HatchBorder();
NewArea->SetLocalFlags( 1 );
}
@ -1769,7 +1769,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
}
}
aCurrArea->Hatch();
aCurrArea->HatchBorder();
return true;
}

View File

@ -950,7 +950,7 @@ public:
* @return a reference to the new area
*/
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer,
wxPoint aStartPointPosition, ZONE_HATCH_STYLE aHatch );
wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch );
/**
* Add a copper area to net, inserting after m_ZoneDescriptorList[aAreaIdx]
@ -963,7 +963,7 @@ public:
* @return pointer to the new area
*/
ZONE_CONTAINER* InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX,
int aCornerY, ZONE_HATCH_STYLE aHatch );
int aCornerY, ZONE_BORDER_DISPLAY_STYLE aHatch );
/**
* Function NormalizeAreaPolygon

View File

@ -43,15 +43,17 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule )
m_CornerSelection = nullptr; // no corner is selected
m_IsFilled = false; // fill status : true when the zone is filled
m_FillMode = ZONE_FILL_MODE::POLYGONS;
m_hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
m_hatchPitch = GetDefaultHatchPitch();
m_borderStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
m_borderHatchPitch = GetDefaultHatchPitch();
m_hv45 = false;
m_HatchFillTypeThickness = 0;
m_HatchFillTypeGap = 0;
m_HatchFillTypeOrientation = 0.0;
m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
// used only if m_HatchFillTypeSmoothingLevel > 0
m_hatchThickness = 0;
m_hatchGap = 0;
m_hatchOrientation = 0.0;
m_hatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_hatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
// used only if m_hatchSmoothingLevel > 0
m_hatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
m_priority = 0;
m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
SetIsKeepout( aInModule ? true : false ); // Zones living in modules have the keepout option.
@ -138,11 +140,13 @@ void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone )
m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge;
m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
m_HatchFillTypeThickness = aZone.m_HatchFillTypeThickness;
m_HatchFillTypeGap = aZone.m_HatchFillTypeGap;
m_HatchFillTypeOrientation = aZone.m_HatchFillTypeOrientation;
m_HatchFillTypeSmoothingLevel = aZone.m_HatchFillTypeSmoothingLevel;
m_HatchFillTypeSmoothingValue = aZone.m_HatchFillTypeSmoothingValue;
m_hatchThickness = aZone.m_hatchThickness;
m_hatchGap = aZone.m_hatchGap;
m_hatchOrientation = aZone.m_hatchOrientation;
m_hatchSmoothingLevel = aZone.m_hatchSmoothingLevel;
m_hatchSmoothingValue = aZone.m_hatchSmoothingValue;
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;
@ -157,9 +161,9 @@ void ZONE_CONTAINER::InitDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone )
m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
}
m_hatchStyle = aZone.m_hatchStyle;
m_hatchPitch = aZone.m_hatchPitch;
m_HatchLines = aZone.m_HatchLines;
m_borderStyle = aZone.m_borderStyle;
m_borderHatchPitch = aZone.m_borderHatchPitch;
m_borderHatchLines = aZone.m_borderHatchLines;
SetLocalFlags( aZone.GetLocalFlags() );
@ -682,8 +686,8 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
// Useful for statistics, especially when zones are complex the number of hatches
// and filled polygons can explain the display and DRC calculation time:
msg.Printf( wxT( "%d" ), (int) m_HatchLines.size() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg, BLUE ) );
PCB_LAYER_ID layer = m_Layer;
@ -710,7 +714,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
/* move outlines */
m_Poly->Move( offset );
Hatch();
HatchBorder();
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Move( offset );
@ -734,7 +738,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset, int aEdge )
{
m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
Hatch();
HatchBorder();
SetNeedRefill( true );
}
@ -748,7 +752,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
angle = -DECIDEG2RAD( angle );
m_Poly->Rotate( angle, VECTOR2I( centre ) );
Hatch();
HatchBorder();
/* rotate filled areas: */
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
@ -786,7 +790,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight )
// ZONE_CONTAINERs mirror about the x-axis (why?!?)
m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
Hatch();
HatchBorder();
for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
@ -916,48 +920,53 @@ wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS aUnits ) const
}
int ZONE_CONTAINER::GetHatchPitch() const
int ZONE_CONTAINER::GetBorderHatchPitch() const
{
return m_hatchPitch;
return m_borderHatchPitch;
}
void ZONE_CONTAINER::SetHatch( ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch )
void ZONE_CONTAINER::SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch,
bool aRebuildHatch )
{
SetHatchPitch( aHatchPitch );
m_hatchStyle = aHatchStyle;
m_borderStyle = aHatchStyle;
if( aRebuildHatch )
Hatch();
HatchBorder();
}
void ZONE_CONTAINER::SetHatchPitch( int aPitch )
{
m_hatchPitch = aPitch;
m_borderHatchPitch = aPitch;
}
void ZONE_CONTAINER::UnHatch()
void ZONE_CONTAINER::UnHatchBorder()
{
m_HatchLines.clear();
m_borderHatchLines.clear();
}
// Creates hatch lines inside the outline of the complex polygon
// sort function used in ::Hatch to sort points by descending wxPoint.x values
// sort function used in ::HatchBorder to sort points by descending wxPoint.x values
bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
{
return tst.x < ref.x;
}
void ZONE_CONTAINER::Hatch()
void ZONE_CONTAINER::HatchBorder()
{
UnHatch();
UnHatchBorder();
if( m_hatchStyle == ZONE_HATCH_STYLE::NO_HATCH || m_hatchPitch == 0 || m_Poly->IsEmpty() )
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::NO_HATCH
|| m_borderHatchPitch == 0
|| m_Poly->IsEmpty() )
{
return;
}
// define range for hatch lines
int min_x = m_Poly->CVertex( 0 ).x;
@ -983,13 +992,13 @@ void ZONE_CONTAINER::Hatch()
// Calculate spacing between 2 hatch lines
int spacing;
if( m_hatchStyle == ZONE_HATCH_STYLE::DIAGONAL_EDGE )
spacing = m_hatchPitch;
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE )
spacing = m_borderHatchPitch;
else
spacing = m_hatchPitch * 2;
spacing = m_borderHatchPitch * 2;
// set the "length" of hatch lines (the length on horizontal axis)
int hatch_line_len = m_hatchPitch;
int hatch_line_len = m_borderHatchPitch;
// To have a better look, give a slope depending on the layer
LAYER_NUM layer = GetLayer();
@ -1086,10 +1095,10 @@ void ZONE_CONTAINER::Hatch()
// Push only one line for diagonal hatch,
// or for small lines < twice the line length
// else push 2 small lines
if( m_hatchStyle == ZONE_HATCH_STYLE::DIAGONAL_FULL
|| std::abs( dx ) < 2 * hatch_line_len )
if( m_borderStyle == ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL
|| std::abs( dx ) < 2 * hatch_line_len )
{
m_HatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) );
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
}
else
{
@ -1106,9 +1115,9 @@ void ZONE_CONTAINER::Hatch()
int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
m_HatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
m_HatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
}
}
}

View File

@ -212,20 +212,26 @@ public:
m_ZoneMinThickness = aMinThickness;
}
int GetHatchFillTypeThickness() const { return m_HatchFillTypeThickness; }
void SetHatchFillTypeThickness( int aThickness ) { m_HatchFillTypeThickness = aThickness; }
int GetHatchThickness() const { return m_hatchThickness; }
void SetHatchThickness( int aThickness ) { m_hatchThickness = aThickness; }
int GetHatchFillTypeGap() const { return m_HatchFillTypeGap; }
void SetHatchFillTypeGap( int aStep ) { m_HatchFillTypeGap = aStep; }
int GetHatchGap() const { return m_hatchGap; }
void SetHatchGap( int aStep ) { m_hatchGap = aStep; }
double GetHatchFillTypeOrientation() const { return m_HatchFillTypeOrientation; }
void SetHatchFillTypeOrientation( double aStep ) { m_HatchFillTypeOrientation = aStep; }
double GetHatchOrientation() const { return m_hatchOrientation; }
void SetHatchOrientation( double aStep ) { m_hatchOrientation = aStep; }
int GetHatchFillTypeSmoothingLevel() const { return m_HatchFillTypeSmoothingLevel; }
void SetHatchFillTypeSmoothingLevel( int aLevel ) { m_HatchFillTypeSmoothingLevel = aLevel; }
int GetHatchSmoothingLevel() const { return m_hatchSmoothingLevel; }
void SetHatchSmoothingLevel( int aLevel ) { m_hatchSmoothingLevel = aLevel; }
double GetHatchFillTypeSmoothingValue() const { return m_HatchFillTypeSmoothingValue; }
void SetHatchFillTypeSmoothingValue( double aValue ) { m_HatchFillTypeSmoothingValue = aValue; }
double GetHatchSmoothingValue() const { return m_hatchSmoothingValue; }
void SetHatchSmoothingValue( double aValue ) { m_hatchSmoothingValue = aValue; }
double GetHatchHoleMinArea() const { return m_hatchHoleMinArea; }
void SetHatchHoleMinArea( double aPct ) { m_hatchHoleMinArea = aPct; }
int GetHatchBorderAlgorithm() const { return m_hatchBorderAlgorithm; }
void SetHatchBorderAlgorithm( int aAlgo ) { m_hatchBorderAlgorithm = aAlgo; }
int GetSelectedCorner() const
{
@ -568,15 +574,8 @@ public:
*/
bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
ZONE_HATCH_STYLE GetHatchStyle() const
{
return m_hatchStyle;
}
void SetHatchStyle( ZONE_HATCH_STYLE aStyle )
{
m_hatchStyle = aStyle;
}
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle() const { return m_borderStyle; }
void SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE aStyle ) { m_borderStyle = aStyle; }
/**
* Function IsSame
@ -741,14 +740,14 @@ public:
void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
/**
* Hatch related methods
* HatchBorder related methods
*/
/**
* Function GetHatchPitch
* Function GetBorderHatchPitch
* @return int - the zone hatch pitch in iu.
*/
int GetHatchPitch() const;
int GetBorderHatchPitch() const;
/**
* Function GetDefaultHatchPitchMils
@ -757,7 +756,7 @@ public:
static int GetDefaultHatchPitch();
/**
* Function SetHatch
* Function SetBorderDisplayStyle
* sets all hatch parameters for the zone.
* @param aHatchStyle is the style of the hatch, specified as one of HATCH_STYLE possible
* values.
@ -765,7 +764,7 @@ public:
* @param aRebuildHatch is a flag to indicate whether to re-hatch after having set the
* previous parameters.
*/
void SetHatch( ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch );
void SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch );
/**
* Function SetHatchPitch
@ -775,19 +774,19 @@ public:
void SetHatchPitch( int aPitch );
/**
* Function UnHatch
* Function UnHatchBorder
* clears the zone's hatch.
*/
void UnHatch();
void UnHatchBorder();
/**
* Function Hatch
* Function HatchBorder
* computes the hatch lines depending on the hatch parameters and stores it in the zone's
* attribute m_HatchLines.
* attribute m_borderHatchLines.
*/
void Hatch();
void HatchBorder();
const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
const std::vector<SEG>& GetHatchLines() const { return m_borderHatchLines; }
bool GetHV45() const { return m_hv45; }
void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
@ -886,24 +885,18 @@ protected:
* ZONE_FILL_MODE::POLYGONS => use solid polygons
* ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape
*/
ZONE_FILL_MODE m_FillMode;
/// Grid style shape: thickness of lines (if 0 -> solid shape)
int m_HatchFillTypeThickness;
/// Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
int m_HatchFillTypeGap;
/// Grid style shape: orientation in degrees of the grid lines
double m_HatchFillTypeOrientation;
/// Grid pattern smoothing type, similar to corner smoothing type
///< 0 = no smoothing, 1 = fillet, >= 2 = arc
int m_HatchFillTypeSmoothingLevel;
/// Grid pattern smoothing value for smoothing shape size calculations
/// this is the ratio between the gap and the chamfer size
double m_HatchFillTypeSmoothingValue;
ZONE_FILL_MODE m_FillMode;
int m_hatchThickness; // thickness of lines (if 0 -> solid shape)
int m_hatchGap; // gap between lines (0 -> solid shape
double m_hatchOrientation; // orientation in degrees of grid lines
int m_hatchSmoothingLevel; // 0 = no smoothing
// 1 = fillet
// 2 = arc low def
// 3 = arc high def
double m_hatchSmoothingValue; // hole chamfer/fillet size (ratio of hole size)
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;
@ -930,9 +923,9 @@ protected:
/// A hash value used in zone filling calculations to see if the filled areas are up to date
std::map<PCB_LAYER_ID, MD5_HASH> m_filledPolysHash;
ZONE_HATCH_STYLE m_hatchStyle; // hatch style, see enum above
int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
std::vector<SEG> m_HatchLines; // hatch lines
ZONE_BORDER_DISPLAY_STYLE m_borderStyle; // border display style, see enum above
int m_borderHatchPitch; // for DIAGONAL_EDGE, distance between 2 lines
std::vector<SEG> m_borderHatchLines; // hatch lines
/// For each layer, a set of insulated islands that were not removed
std::map<PCB_LAYER_ID, std::set<int>> m_insulatedIslands;

View File

@ -155,17 +155,11 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
m_cornerRadius.SetValue( m_settings.GetCornerRadius() );
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
switch( m_settings.m_Zone_HatchingStyle )
switch( m_settings.m_ZoneBorderDisplayStyle )
{
case ZONE_HATCH_STYLE::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
}
m_clearance.SetValue( m_settings.m_ZoneClearance );
@ -174,18 +168,10 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
switch( m_settings.GetPadConnection() )
{
default:
case ZONE_CONNECTION::THERMAL:
m_PadInZoneOpt->SetSelection( 1 );
break;
case ZONE_CONNECTION::THT_THERMAL:
m_PadInZoneOpt->SetSelection( 2 );
break;
case ZONE_CONNECTION::NONE:
m_PadInZoneOpt->SetSelection( 3 );
break;
case ZONE_CONNECTION::FULL:
m_PadInZoneOpt->SetSelection( 0 );
break;
case ZONE_CONNECTION::THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break;
case ZONE_CONNECTION::THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break;
case ZONE_CONNECTION::NONE: m_PadInZoneOpt->SetSelection( 3 ); break;
case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
}
// Do not enable/disable antipad clearance and spoke width. They might be needed if
@ -235,7 +221,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
}
m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree
m_gridStyleRotation.SetValue( m_settings.m_HatchOrientation * 10 ); // IU is decidegree
// Gives a reasonable value to grid style parameters, if currently there are no defined
// parameters for grid pattern thickness and gap (if the value is 0)
@ -243,22 +229,22 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
// or 1mm
// the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
// or 1.5 mm
int bestvalue = m_settings.m_HatchFillTypeThickness;
int bestvalue = m_settings.m_HatchThickness;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeThickness
if( bestvalue <= 0 ) // No defined value for m_HatchThickness
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, Millimeter2iu( 1.0 ) );
m_gridStyleThickness.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
bestvalue = m_settings.m_HatchFillTypeGap;
bestvalue = m_settings.m_HatchGap;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeGap
if( bestvalue <= 0 ) // No defined value for m_HatchGap
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, Millimeter2iu( 1.5 ) );
m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchFillTypeSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchFillTypeSmoothingValue );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchSmoothingValue );
m_tcZoneName->SetValue( m_settings.m_Name );
@ -322,11 +308,11 @@ bool DIALOG_COPPER_ZONE::TransferDataFromWindow()
if( !AcceptOptions() )
return false;
m_settings.m_HatchFillTypeOrientation = m_gridStyleRotation.GetValue()/10.0; // value is returned in deci-degree
m_settings.m_HatchFillTypeThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchFillTypeGap = m_gridStyleGap.GetValue();
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
m_settings.m_HatchOrientation = m_gridStyleRotation.GetValue() / 10.0; // value is returned in deci-degree
m_settings.m_HatchThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchGap = m_gridStyleGap.GetValue();
m_settings.m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchSmoothingValue = m_spinCtrlSmoothValue->GetValue();
*m_ptr = m_settings;
return true;
@ -382,22 +368,16 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
break;
}
switch( m_OutlineAppearanceCtrl->GetSelection() )
switch( m_OutlineDisplayCtrl->GetSelection() )
{
case 0:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH;
break;
case 1:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
break;
case 2:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL;
break;
case 0: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
case 1: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
}
auto cfg = m_Parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_Zone_HatchingStyle );
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_ZoneBorderDisplayStyle );
cfg->m_Zones.net_filter = m_DoNotShowNetNameFilter->GetValue().ToStdString();
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();

View File

@ -96,6 +96,27 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbGeneral;
sbGeneral = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General") ), wxHORIZONTAL );
m_zoneNameLabel = new wxStaticText( sbGeneral->GetStaticBox(), wxID_ANY, _("Zone name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_zoneNameLabel->Wrap( -1 );
m_zoneNameLabel->SetToolTip( _("A unique name for this zone to identify it for DRC") );
sbGeneral->Add( m_zoneNameLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_tcZoneName = new wxTextCtrl( sbGeneral->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbGeneral->Add( m_tcZoneName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbGeneral->Add( 5, 0, 0, wxEXPAND, 5 );
bSizer7->Add( sbGeneral, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxStaticBoxSizer* m_ExportableSetupSizer;
m_ExportableSetupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Shape") ), wxHORIZONTAL );
@ -118,13 +139,13 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticTextStyle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle->Wrap( -1 );
gbSizer1->Add( m_staticTextStyle, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizer1->Add( m_staticTextStyle, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 );
m_OutlineAppearanceCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_OutlineDisplayCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineDisplayCtrlNChoices = sizeof( m_OutlineDisplayCtrlChoices ) / sizeof( wxString );
m_OutlineDisplayCtrl = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineDisplayCtrlNChoices, m_OutlineDisplayCtrlChoices, 0 );
m_OutlineDisplayCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineDisplayCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
gbSizer1->Add( m_staticline1, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
@ -151,12 +172,16 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
gbSizer1->Add( m_cornerRadiusUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
gbSizer1->AddGrowableCol( 0 );
gbSizer1->AddGrowableCol( 1 );
m_ExportableSetupSizer->Add( gbSizer1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_ExportableSetupSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerMiddle->Add( m_ExportableSetupSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bSizer7->Add( m_ExportableSetupSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bSizerMiddle->Add( bSizer7, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer5;
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Electrical Properties") ), wxVERTICAL );
@ -190,52 +215,52 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_minWidthUnits->Wrap( -1 );
gbSizerSettings->Add( m_minWidthUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticline2 = new wxStaticLine( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
gbSizerSettings->Add( m_staticline2, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline3 = new wxStaticLine( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
gbSizerSettings->Add( m_staticline3, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline4 = new wxStaticLine( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
gbSizerSettings->Add( m_staticline4, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_connectionLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Pad connections:"), wxDefaultPosition, wxDefaultSize, 0 );
m_connectionLabel->Wrap( -1 );
m_connectionLabel->SetToolTip( _("Default pad connection type to zone.\nThis setting can be overridden by local pad settings") );
gbSizerSettings->Add( m_connectionLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizerSettings->Add( m_connectionLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal reliefs"), _("Reliefs for PTH"), _("None") };
int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString );
m_PadInZoneOpt = new wxChoice( sbSizer5->GetStaticBox(), ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 );
m_PadInZoneOpt->SetSelection( 0 );
gbSizerSettings->Add( m_PadInZoneOpt, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
gbSizerSettings->Add( m_PadInZoneOpt, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
m_antipadLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Thermal clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_antipadLabel->Wrap( -1 );
gbSizerSettings->Add( m_antipadLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
gbSizerSettings->Add( m_antipadLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_antipadCtrl = new wxTextCtrl( sbSizer5->GetStaticBox(), wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_antipadCtrl->SetToolTip( _("Clearance between pads in the same net and filled areas.") );
gbSizerSettings->Add( m_antipadCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
gbSizerSettings->Add( m_antipadCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_antipadUnits = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_antipadUnits->Wrap( -1 );
gbSizerSettings->Add( m_antipadUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
gbSizerSettings->Add( m_antipadUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_spokeWidthLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Thermal spoke width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthLabel->Wrap( -1 );
gbSizerSettings->Add( m_spokeWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizerSettings->Add( m_spokeWidthLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_spokeWidthCtrl = new wxTextCtrl( sbSizer5->GetStaticBox(), wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthCtrl->SetToolTip( _("Width of copper in thermal reliefs.") );
gbSizerSettings->Add( m_spokeWidthCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
gbSizerSettings->Add( m_spokeWidthCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
m_spokeWidthUnits = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthUnits->Wrap( -1 );
gbSizerSettings->Add( m_spokeWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText39 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Zone name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText39->Wrap( -1 );
m_staticText39->SetToolTip( _("A unique name for this zone to identify it for DRC") );
gbSizerSettings->Add( m_staticText39, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_tcZoneName = new wxTextCtrl( sbSizer5->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizerSettings->Add( m_tcZoneName, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizerSettings->Add( m_spokeWidthUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizerSettings->AddGrowableCol( 1 );
@ -255,65 +280,65 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticTextGridFillType = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Fill type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridFillType->Wrap( -1 );
gbSizer3->Add( m_staticTextGridFillType, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextGridFillType, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_GridStyleCtrlChoices[] = { _("Solid shape"), _("Hatch pattern") };
int m_GridStyleCtrlNChoices = sizeof( m_GridStyleCtrlChoices ) / sizeof( wxString );
m_GridStyleCtrl = new wxChoice( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_GridStyleCtrlNChoices, m_GridStyleCtrlChoices, 0 );
m_GridStyleCtrl->SetSelection( 0 );
gbSizer3->Add( m_GridStyleCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
gbSizer3->Add( m_GridStyleCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextGrindOrient = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrindOrient->Wrap( -1 );
gbSizer3->Add( m_staticTextGrindOrient, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_tcGridStyleOrientation = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer3->Add( m_tcGridStyleOrientation, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizer3->Add( m_tcGridStyleOrientation, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticTextRotUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotUnits->Wrap( -1 );
gbSizer3->Add( m_staticTextRotUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextRotUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextStyleThickness = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Hatch width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyleThickness->Wrap( -1 );
gbSizer3->Add( m_staticTextStyleThickness, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextStyleThickness, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleThickness = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer3->Add( m_tcGridStyleThickness, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizer3->Add( m_tcGridStyleThickness, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_GridStyleThicknessUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleThicknessUnits->Wrap( -1 );
gbSizer3->Add( m_GridStyleThicknessUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_GridStyleThicknessUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridGap = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Hatch gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridGap->Wrap( -1 );
gbSizer3->Add( m_staticTextGridGap, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextGridGap, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleGap = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer3->Add( m_tcGridStyleGap, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizer3->Add( m_tcGridStyleGap, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_GridStyleGapUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleGapUnits->Wrap( -1 );
gbSizer3->Add( m_GridStyleGapUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_GridStyleGapUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridSmoothingLevel = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Smoothing effort:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmoothingLevel->Wrap( -1 );
m_staticTextGridSmoothingLevel->SetToolTip( _("Value of smoothing effort\n0 = no smoothing\n1 = chamfer\n2 = round corners\n3 = round corners (finer shape)") );
gbSizer3->Add( m_staticTextGridSmoothingLevel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextGridSmoothingLevel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothLevel = new wxSpinCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3, 0 );
gbSizer3->Add( m_spinCtrlSmoothLevel, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
gbSizer3->Add( m_spinCtrlSmoothLevel, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextGridSmootingVal = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Smooth value (0..1):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Smoothing amount:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal->Wrap( -1 );
m_staticTextGridSmootingVal->SetToolTip( _("Ratio between smoothed corners size and the gap between lines\n0 = no smoothing\n1.0 = max radius/chamfer size (half gap value)") );
gbSizer3->Add( m_staticTextGridSmootingVal, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_staticTextGridSmootingVal, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothValue = new wxSpinCtrlDouble( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1, 0.100000, 0.1 );
m_spinCtrlSmoothValue->SetDigits( 0 );
gbSizer3->Add( m_spinCtrlSmoothValue, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
gbSizer3->Add( m_spinCtrlSmoothValue, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText40 = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Remove islands:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText40->Wrap( -1 );
@ -325,25 +350,25 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
int m_cbRemoveIslandsNChoices = sizeof( m_cbRemoveIslandsChoices ) / sizeof( wxString );
m_cbRemoveIslands = new wxChoice( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbRemoveIslandsNChoices, m_cbRemoveIslandsChoices, 0 );
m_cbRemoveIslands->SetSelection( 0 );
gbSizer3->Add( m_cbRemoveIslands, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
gbSizer3->Add( m_cbRemoveIslands, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_islandThresholdLabel = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Minimum island size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_islandThresholdLabel->Wrap( -1 );
m_islandThresholdLabel->Enable( false );
m_islandThresholdLabel->SetToolTip( _("Isolated islands smaller than this will be removed") );
gbSizer3->Add( m_islandThresholdLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_islandThresholdLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_tcIslandThreshold = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_tcIslandThreshold->Enable( false );
gbSizer3->Add( m_tcIslandThreshold, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizer3->Add( m_tcIslandThreshold, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_islandThresholdUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_islandThresholdUnits->Wrap( -1 );
m_islandThresholdUnits->Enable( false );
gbSizer3->Add( m_islandThresholdUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer3->Add( m_islandThresholdUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
gbSizer3->AddGrowableCol( 1 );

File diff suppressed because it is too large Load Diff

View File

@ -73,11 +73,13 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxBoxSizer* m_bNoNetWarning;
wxStaticBitmap* m_bitmapNoNetWarning;
wxStaticText* m_staticText18;
wxStaticText* m_zoneNameLabel;
wxTextCtrl* m_tcZoneName;
wxCheckBox* m_constrainOutline;
wxStaticText* m_staticTextPriorityLevel;
wxSpinCtrl* m_PriorityLevelCtrl;
wxStaticText* m_staticTextStyle;
wxChoice* m_OutlineAppearanceCtrl;
wxChoice* m_OutlineDisplayCtrl;
wxStaticLine* m_staticline1;
wxStaticText* m_staticTextSmoothing;
wxChoice* m_cornerSmoothingChoice;
@ -90,6 +92,9 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxStaticText* m_minWidthLabel;
wxTextCtrl* m_minWidthCtrl;
wxStaticText* m_minWidthUnits;
wxStaticLine* m_staticline2;
wxStaticLine* m_staticline3;
wxStaticLine* m_staticline4;
wxStaticText* m_connectionLabel;
wxChoice* m_PadInZoneOpt;
wxStaticText* m_antipadLabel;
@ -98,8 +103,6 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxStaticText* m_spokeWidthLabel;
wxTextCtrl* m_spokeWidthCtrl;
wxStaticText* m_spokeWidthUnits;
wxStaticText* m_staticText39;
wxTextCtrl* m_tcZoneName;
wxStaticText* m_staticTextGridFillType;
wxChoice* m_GridStyleCtrl;
wxStaticText* m_staticTextGrindOrient;

View File

@ -99,20 +99,14 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow()
m_tcName->SetValue( m_zonesettings.m_Name );
switch( m_zonesettings.m_Zone_HatchingStyle )
switch( m_zonesettings.m_ZoneBorderDisplayStyle )
{
case ZONE_HATCH_STYLE::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
}
SetInitialFocus( m_OutlineAppearanceCtrl );
SetInitialFocus( m_OutlineDisplayCtrl );
return true;
}
@ -170,21 +164,15 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow()
return false;
}
switch( m_OutlineAppearanceCtrl->GetSelection() )
switch( m_OutlineDisplayCtrl->GetSelection() )
{
case 0:
m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH;
break;
case 1:
m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
break;
case 2:
m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL;
break;
case 0: m_zonesettings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
case 1: m_zonesettings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
case 2: m_zonesettings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
}
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_zonesettings.m_Zone_HatchingStyle );
cfg->m_Zones.hatching_style = static_cast<int>( m_zonesettings.m_ZoneBorderDisplayStyle );
m_zonesettings.m_Zone_45_Only = m_cbConstrainCtrl->GetValue();
m_zonesettings.m_ZonePriority = 0; // for a keepout, this param is not used.

View File

@ -69,11 +69,11 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind
m_staticTextStyle->Wrap( -1 );
bSizerLowerRight->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 );
m_OutlineAppearanceCtrl->SetSelection( 0 );
bSizerLowerRight->Add( m_OutlineAppearanceCtrl, 0, wxALL, 5 );
wxString m_OutlineDisplayCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineDisplayCtrlNChoices = sizeof( m_OutlineDisplayCtrlChoices ) / sizeof( wxString );
m_OutlineDisplayCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineDisplayCtrlNChoices, m_OutlineDisplayCtrlChoices, 0 );
m_OutlineDisplayCtrl->SetSelection( 0 );
bSizerLowerRight->Add( m_OutlineDisplayCtrl, 0, wxALL, 5 );
bSizerRight->Add( bSizerLowerRight, 0, wxEXPAND, 5 );

View File

@ -702,7 +702,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OutlineAppearanceCtrl</property>
<property name="name">m_OutlineDisplayCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -46,7 +46,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM
wxCheckBox* m_cbFootprintsCtrl;
wxCheckBox* m_cbConstrainCtrl;
wxStaticText* m_staticTextStyle;
wxChoice* m_OutlineAppearanceCtrl;
wxChoice* m_OutlineDisplayCtrl;
wxStaticText* m_staticText3;
wxTextCtrl* m_tcName;
wxStaticLine* m_staticline1;

View File

@ -120,31 +120,23 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow()
m_minWidth.SetValue( m_settings.m_ZoneMinThickness );
m_ConstrainOpt->SetValue( m_settings.m_Zone_45_Only );
switch( m_settings.m_Zone_HatchingStyle )
switch( m_settings.m_ZoneBorderDisplayStyle )
{
case ZONE_HATCH_STYLE::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case ZONE_HATCH_STYLE::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
}
SetInitialFocus( m_OutlineAppearanceCtrl );
SetInitialFocus( m_OutlineDisplayCtrl );
switch( m_settings.m_FillMode )
{
case ZONE_FILL_MODE::HATCH_PATTERN:
m_GridStyleCtrl->SetSelection( 1 ); break;
default:
m_GridStyleCtrl->SetSelection( 0 ); break;
case ZONE_FILL_MODE::HATCH_PATTERN: m_GridStyleCtrl->SetSelection( 1 ); break;
default: m_GridStyleCtrl->SetSelection( 0 ); break;
}
m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree
m_gridStyleRotation.SetValue( m_settings.m_HatchOrientation * 10 ); // IU is decidegree
// Gives a reasonable value to grid style parameters, if currently there are no defined
// parameters for grid pattern thickness and gap (if the value is 0)
@ -152,22 +144,22 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow()
// or 1mm
// the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
// or 1.5 mm
int bestvalue = m_settings.m_HatchFillTypeThickness;
int bestvalue = m_settings.m_HatchThickness;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeThickness
if( bestvalue <= 0 ) // No defined value for m_hatchThickness
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, Millimeter2iu( 1.0 ) );
m_gridStyleThickness.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
bestvalue = m_settings.m_HatchFillTypeGap;
bestvalue = m_settings.m_HatchGap;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeGap
if( bestvalue <= 0 ) // No defined value for m_hatchGap
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, Millimeter2iu( 1.5 ) );
m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchFillTypeSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchFillTypeSmoothingValue );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchSmoothingValue );
// Enable/Disable some widgets
wxCommandEvent event;
@ -214,17 +206,11 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
switch( m_OutlineAppearanceCtrl->GetSelection() )
switch( m_OutlineDisplayCtrl->GetSelection() )
{
case 0:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH;
break;
case 1:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
break;
case 2:
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL;
break;
case 0: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
case 1: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
}
if( m_GridStyleCtrl->GetSelection() > 0 )
@ -245,14 +231,14 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
}
m_settings.m_HatchFillTypeOrientation = m_gridStyleRotation.GetValue()/10.0; // value is returned in deci-degree
m_settings.m_HatchFillTypeThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchFillTypeGap = m_gridStyleGap.GetValue();
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
m_settings.m_HatchOrientation = m_gridStyleRotation.GetValue() / 10.0; // value is returned in deci-degree
m_settings.m_HatchThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchGap = m_gridStyleGap.GetValue();
m_settings.m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchSmoothingValue = m_spinCtrlSmoothValue->GetValue();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_Zone_HatchingStyle );
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_ZoneBorderDisplayStyle );
m_settings.m_Zone_45_Only = m_ConstrainOpt->GetValue();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -32,51 +32,77 @@ DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE(
bSizerLeft->Add( m_layers, 1, wxALL|wxEXPAND, 5 );
bSizerLeft->Add( 0, 5, 0, wxEXPAND, 5 );
m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbShape;
sbShape = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Shape") ), wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 0, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ConstrainOpt = new wxCheckBox( this, wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_ConstrainOpt = new wxCheckBox( sbShape->GetStaticBox(), wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_ConstrainOpt, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 );
m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle->Wrap( -1 );
gbSizer1->Add( m_staticTextStyle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 );
m_OutlineAppearanceCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
wxString m_OutlineDisplayCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineDisplayCtrlNChoices = sizeof( m_OutlineDisplayCtrlChoices ) / sizeof( wxString );
m_OutlineDisplayCtrl = new wxChoice( sbShape->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineDisplayCtrlNChoices, m_OutlineDisplayCtrlChoices, 0 );
m_OutlineDisplayCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineDisplayCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_MinWidthLabel = new wxStaticText( this, wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthLabel = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthLabel->Wrap( -1 );
gbSizer1->Add( m_MinWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer1->Add( m_MinWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_MinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_MinWidthCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_MinWidthCtrl = new wxTextCtrl( sbShape->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_MinWidthCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_MinWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthUnits = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthUnits->Wrap( -1 );
gbSizer1->Add( m_MinWidthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizer1->Add( m_MinWidthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticTextSmoothing = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("Outline smooth:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSmoothing->Wrap( -1 );
gbSizer1->Add( m_staticTextSmoothing, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") };
int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString );
m_cornerSmoothingChoice = new wxChoice( sbShape->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 );
m_cornerSmoothingChoice->SetSelection( 0 );
gbSizer1->Add( m_cornerSmoothingChoice, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_cornerRadiusLabel = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("Chamfer distance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusLabel->Wrap( -1 );
gbSizer1->Add( m_cornerRadiusLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_cornerRadiusCtrl = new wxTextCtrl( sbShape->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_cornerRadiusCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_cornerRadiusUnits = new wxStaticText( sbShape->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusUnits->Wrap( -1 );
gbSizer1->Add( m_cornerRadiusUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
bSizerMiddle->Add( gbSizer1, 0, wxEXPAND, 5 );
gbSizer1->AddGrowableCol( 1 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMiddle->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
sbShape->Add( gbSizer1, 0, wxEXPAND, 5 );
m_staticTextGridStyle = new wxStaticText( this, wxID_ANY, _("Grid Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridStyle->Wrap( -1 );
m_staticTextGridStyle->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerMiddle->Add( m_staticTextGridStyle, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerMiddle->Add( sbShape, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbFill;
sbFill = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
@ -84,124 +110,82 @@ DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE(
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGridFillType = new wxStaticText( this, wxID_ANY, _("Fill type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridFillType = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Fill type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridFillType->Wrap( -1 );
fgSizer1->Add( m_staticTextGridFillType, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_GridStyleCtrlChoices[] = { _("Solid shape"), _("Hatch pattern") };
wxString m_GridStyleCtrlChoices[] = { _("Solid shape"), _("HatchBorder pattern") };
int m_GridStyleCtrlNChoices = sizeof( m_GridStyleCtrlChoices ) / sizeof( wxString );
m_GridStyleCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_GridStyleCtrlNChoices, m_GridStyleCtrlChoices, 0 );
m_GridStyleCtrl = new wxChoice( sbFill->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_GridStyleCtrlNChoices, m_GridStyleCtrlChoices, 0 );
m_GridStyleCtrl->SetSelection( 0 );
fgSizer1->Add( m_GridStyleCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGrindOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrindOrient = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrindOrient->Wrap( -1 );
fgSizer1->Add( m_staticTextGrindOrient, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleOrientation = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_tcGridStyleOrientation = new wxTextCtrl( sbFill->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleOrientation, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextRotUnits = new wxStaticText( this, wxID_ANY, _("degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotUnits = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotUnits->Wrap( -1 );
fgSizer1->Add( m_staticTextRotUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextStyleThickness = new wxStaticText( this, wxID_ANY, _("Hatch width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyleThickness = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Hatch width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyleThickness->Wrap( -1 );
fgSizer1->Add( m_staticTextStyleThickness, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleThickness = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_tcGridStyleThickness = new wxTextCtrl( sbFill->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleThicknessUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleThicknessUnits = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleThicknessUnits->Wrap( -1 );
fgSizer1->Add( m_GridStyleThicknessUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridGap = new wxStaticText( this, wxID_ANY, _("Hatch gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridGap = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Hatch gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridGap->Wrap( -1 );
fgSizer1->Add( m_staticTextGridGap, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleGap = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_tcGridStyleGap = new wxTextCtrl( sbFill->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleGap, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleGapUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleGapUnits = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleGapUnits->Wrap( -1 );
fgSizer1->Add( m_GridStyleGapUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridSmoothingLevel = new wxStaticText( this, wxID_ANY, _("Smoothing effort:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmoothingLevel = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Smoothing effort:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmoothingLevel->Wrap( -1 );
m_staticTextGridSmoothingLevel->SetToolTip( _("Value of smoothing effort\n0 = no smoothing\n1 = chamfer\n2 = round corners\n3 = round corners (finer shape)") );
fgSizer1->Add( m_staticTextGridSmoothingLevel, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothLevel = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3, 0 );
m_spinCtrlSmoothLevel = new wxSpinCtrl( sbFill->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3, 0 );
fgSizer1->Add( m_spinCtrlSmoothLevel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGridSmootingVal = new wxStaticText( this, wxID_ANY, _("Smooth value (0..1):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal = new wxStaticText( sbFill->GetStaticBox(), wxID_ANY, _("Smooth amount:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal->Wrap( -1 );
m_staticTextGridSmootingVal->SetToolTip( _("Ratio between smoothed corners size and the gap between lines\n0 = no smoothing\n1.0 = max radius/chamfer size (half gap value)") );
fgSizer1->Add( m_staticTextGridSmootingVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothValue = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1, 0.1, 0.1 );
m_spinCtrlSmoothValue = new wxSpinCtrlDouble( sbFill->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1, 0.1, 0.1 );
m_spinCtrlSmoothValue->SetDigits( 2 );
fgSizer1->Add( m_spinCtrlSmoothValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMiddle->Add( fgSizer1, 0, wxEXPAND, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMiddle->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
m_staticTextOutlineSmooth = new wxStaticText( this, wxID_ANY, _("Zone Outline Smooth:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOutlineSmooth->Wrap( -1 );
m_staticTextOutlineSmooth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerMiddle->Add( m_staticTextOutlineSmooth, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
wxFlexGridSizer* fgSizerOutlineSettings;
fgSizerOutlineSettings = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerOutlineSettings->AddGrowableCol( 1 );
fgSizerOutlineSettings->SetFlexibleDirection( wxBOTH );
fgSizerOutlineSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextSmoothing = new wxStaticText( this, wxID_ANY, _("Outline smooth:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSmoothing->Wrap( -1 );
fgSizerOutlineSettings->Add( m_staticTextSmoothing, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") };
int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString );
m_cornerSmoothingChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 );
m_cornerSmoothingChoice->SetSelection( 0 );
fgSizerOutlineSettings->Add( m_cornerSmoothingChoice, 0, wxALL|wxEXPAND, 5 );
sbFill->Add( fgSizer1, 0, wxEXPAND, 5 );
fgSizerOutlineSettings->Add( 0, 0, 0, 0, 5 );
m_cornerRadiusLabel = new wxStaticText( this, wxID_ANY, _("Chamfer distance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusLabel->Wrap( -1 );
fgSizerOutlineSettings->Add( m_cornerRadiusLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_cornerRadiusCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerOutlineSettings->Add( m_cornerRadiusCtrl, 0, wxALL|wxEXPAND, 5 );
m_cornerRadiusUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusUnits->Wrap( -1 );
fgSizerOutlineSettings->Add( m_cornerRadiusUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bSizerMiddle->Add( sbFill, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 );
fgSizerOutlineSettings->Add( 0, 0, 0, 0, 5 );
bSizerMiddle->Add( fgSizerOutlineSettings, 0, wxEXPAND, 5 );
m_UpperSizer->Add( bSizerMiddle, 0, wxEXPAND|wxALL, 10 );
m_UpperSizer->Add( bSizerMiddle, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALL, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -23,8 +23,9 @@
#include <wx/choice.h>
#include <wx/textctrl.h>
#include <wx/gbsizer.h>
#include <wx/statline.h>
#include <wx/statbox.h>
#include <wx/spinctrl.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -42,12 +43,15 @@ class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM
wxDataViewListCtrl* m_layers;
wxCheckBox* m_ConstrainOpt;
wxStaticText* m_staticTextStyle;
wxChoice* m_OutlineAppearanceCtrl;
wxChoice* m_OutlineDisplayCtrl;
wxStaticText* m_MinWidthLabel;
wxTextCtrl* m_MinWidthCtrl;
wxStaticText* m_MinWidthUnits;
wxStaticLine* m_staticline2;
wxStaticText* m_staticTextGridStyle;
wxStaticText* m_staticTextSmoothing;
wxChoice* m_cornerSmoothingChoice;
wxStaticText* m_cornerRadiusLabel;
wxTextCtrl* m_cornerRadiusCtrl;
wxStaticText* m_cornerRadiusUnits;
wxStaticText* m_staticTextGridFillType;
wxChoice* m_GridStyleCtrl;
wxStaticText* m_staticTextGrindOrient;
@ -63,13 +67,6 @@ class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM
wxSpinCtrl* m_spinCtrlSmoothLevel;
wxStaticText* m_staticTextGridSmootingVal;
wxSpinCtrlDouble* m_spinCtrlSmoothValue;
wxStaticLine* m_staticline3;
wxStaticText* m_staticTextOutlineSmooth;
wxStaticText* m_staticTextSmoothing;
wxChoice* m_cornerSmoothingChoice;
wxStaticText* m_cornerRadiusLabel;
wxTextCtrl* m_cornerRadiusCtrl;
wxStaticText* m_cornerRadiusUnits;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;

View File

@ -769,8 +769,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
}
}
zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else
{
@ -815,7 +815,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
zone->SetLayer( layer );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
ZONE_HATCH_STYLE outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
const int outlineIdx = -1; // this is the id of the copper zone main outline
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
@ -824,11 +824,11 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
if( r.rot )
{
zone->Rotate( zone->GetPosition(), r.rot->degrees * 10 );
}
// this is not my fault:
zone->SetHatch( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
}
m_xpath->pop();
@ -1338,16 +1338,16 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
zone->SetDoNotAllowPads( false );
zone->SetDoNotAllowFootprints( false );
zone->SetDoNotAllowCopperPour( true );
zone->SetHatchStyle( ZONE_HATCH_STYLE::NO_HATCH );
zone->SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE::NO_HATCH );
}
else if( p.pour == EPOLYGON::HATCH )
{
int spacing = p.spacing ? p.spacing->ToPcbUnits() : 50 * IU_PER_MILS;
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
zone->SetHatchFillTypeThickness( p.width.ToPcbUnits() );
zone->SetHatchFillTypeGap( spacing - p.width.ToPcbUnits() );
zone->SetHatchFillTypeOrientation( 0 );
zone->SetHatchThickness( p.width.ToPcbUnits() );
zone->SetHatchGap( spacing - p.width.ToPcbUnits() );
zone->SetHatchOrientation( 0 );
}
// We divide the thickness by half because we are tracing _inside_ the zone outline
@ -1885,8 +1885,8 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
zone->Rotate( center, r.rot->degrees * 10 );
}
zone->SetHatch(
ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else
{
@ -1996,8 +1996,8 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
outline.SetClosed( true );
zone->Outline()->AddOutline( outline );
zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else
{
@ -2056,8 +2056,8 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
}
}
zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
ZONE_CONTAINER::GetDefaultHatchPitch(), true );
}
else
{

View File

@ -1639,19 +1639,13 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
switch( aZone->GetHatchStyle() )
{
default:
case ZONE_HATCH_STYLE::NO_HATCH:
hatch = "none";
break;
case ZONE_HATCH_STYLE::DIAGONAL_EDGE:
hatch = "edge";
break;
case ZONE_HATCH_STYLE::DIAGONAL_FULL:
hatch = "full";
break;
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: hatch = "none"; break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: hatch = "edge"; break;
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: hatch = "full"; break;
}
m_out->Print( 0, " (hatch %s %s)\n", hatch.c_str(),
FormatInternalUnits( aZone->GetHatchPitch() ).c_str() );
FormatInternalUnits( aZone->GetBorderHatchPitch() ).c_str() );
if( aZone->GetPriority() > 0 )
m_out->Print( aNestLevel+1, "(priority %d)\n", aZone->GetPriority() );
@ -1750,17 +1744,22 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
{
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+2, "(hatch_thickness %s) (hatch_gap %s) (hatch_orientation %s)",
FormatInternalUnits( aZone->GetHatchFillTypeThickness() ).c_str(),
FormatInternalUnits( aZone->GetHatchFillTypeGap() ).c_str(),
Double2Str( aZone->GetHatchFillTypeOrientation() ).c_str() );
FormatInternalUnits( aZone->GetHatchThickness() ).c_str(),
FormatInternalUnits( aZone->GetHatchGap() ).c_str(),
Double2Str( aZone->GetHatchOrientation() ).c_str() );
if( aZone->GetHatchFillTypeSmoothingLevel() > 0 )
if( aZone->GetHatchSmoothingLevel() > 0 )
{
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+2, "(hatch_smoothing_level %d) (hatch_smoothing_value %s)",
aZone->GetHatchFillTypeSmoothingLevel(),
Double2Str( aZone->GetHatchFillTypeSmoothingValue() ).c_str() );
aZone->GetHatchSmoothingLevel(),
Double2Str( aZone->GetHatchSmoothingValue() ).c_str() );
}
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+2, "(hatch_border_algorithm %s) (hatch_min_hole_area %s)",
aZone->GetHatchBorderAlgorithm() ? "hatch_thickness" : "min_thickness",
Double2Str( aZone->GetHatchHoleMinArea() ).c_str() );
}
m_out->Print( 0, ")\n" );

View File

@ -72,7 +72,8 @@ class TEXTE_PCB;
//#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
//#define SEXPR_BOARD_FILE_VERSION 20200625 // Multilayer zones, zone names, island controls
//#define SEXPR_BOARD_FILE_VERSION 20200628 // remove visibility settings
#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to module components
//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to module components
#define SEXPR_BOARD_FILE_VERSION 20200807 // Add zone hatch advanced settings
#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

@ -2438,7 +2438,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
{
unique_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) );
ZONE_HATCH_STYLE outline_hatch = ZONE_HATCH_STYLE::NO_HATCH;
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
bool endContour = false;
int holeIndex = -1; // -1 is the main outline; holeIndex >= 0 = hole index
char buf[1024];
@ -2508,9 +2508,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
switch( *hopt ) // upper case required
{
case 'N': outline_hatch = ZONE_HATCH_STYLE::NO_HATCH; break;
case 'E': outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_EDGE; break;
case 'F': outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_FULL; break;
case 'N': outline_hatch = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
case 'E': outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
case 'F': outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
default:
m_error.Printf( _( "Bad ZAux for CZONE_CONTAINER \"%s\"" ),
zc->GetNetname().GetData() );
@ -2712,10 +2712,10 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
zc->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
// Hatch here, after outlines corners are read
// HatchBorder here, after outlines corners are read
// Set hatch here, after outlines corners are read
zc->SetHatch( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
zc->SetBorderDisplayStyle( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
m_board->Add( zc.release() );
}

View File

@ -202,7 +202,8 @@ void PCB_POLYGON::AddToBoard()
zone->SetPriority( m_priority );
zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, zone->GetDefaultHatchPitch(), true );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
zone->GetDefaultHatchPitch(), true );
if ( m_objType == wxT( 'K' ) )
{

View File

@ -3779,7 +3779,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
wxT( " as ZONE_CONTAINER." ) );
ZONE_HATCH_STYLE hatchStyle = ZONE_HATCH_STYLE::NO_HATCH;
ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
int hatchPitch = ZONE_CONTAINER::GetDefaultHatchPitch();
wxPoint pt;
@ -3857,14 +3857,9 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
switch( token )
{
default:
case T_none:
hatchStyle = ZONE_HATCH_STYLE::NO_HATCH;
break;
case T_edge:
hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
break;
case T_full:
hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL;
case T_none: hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
case T_edge: hatchStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
case T_full: hatchStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
}
hatchPitch = parseBoardUnits( "hatch pitch" );
@ -3966,27 +3961,42 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
break;
case T_hatch_thickness:
zone->SetHatchFillTypeThickness( parseBoardUnits( T_hatch_thickness ) );
zone->SetHatchThickness( parseBoardUnits( T_hatch_thickness ) );
NeedRIGHT();
break;
case T_hatch_gap:
zone->SetHatchFillTypeGap( parseBoardUnits( T_hatch_gap ) );
zone->SetHatchGap( parseBoardUnits( T_hatch_gap ) );
NeedRIGHT();
break;
case T_hatch_orientation:
zone->SetHatchFillTypeOrientation( parseDouble( T_hatch_orientation ) );
zone->SetHatchOrientation( parseDouble( T_hatch_orientation ) );
NeedRIGHT();
break;
case T_hatch_smoothing_level:
zone->SetHatchFillTypeSmoothingLevel( parseDouble( T_hatch_smoothing_level ) );
zone->SetHatchSmoothingLevel( parseDouble( T_hatch_smoothing_level ) );
NeedRIGHT();
break;
case T_hatch_smoothing_value:
zone->SetHatchFillTypeSmoothingValue( parseDouble( T_hatch_smoothing_value ) );
zone->SetHatchSmoothingValue( parseDouble( T_hatch_smoothing_value ) );
NeedRIGHT();
break;
case T_hatch_border_algorithm:
token = NextTok();
if( token != T_hatch_thickness && token != T_min_thickness )
Expecting( "hatch_thickness or min_thickness" );
zone->SetHatchBorderAlgorithm( token == T_hatch_thickness ? 1 : 0 );
NeedRIGHT();
break;
case T_hatch_min_hole_area:
zone->SetHatchHoleMinArea( parseDouble( T_hatch_min_hole_area ) );
NeedRIGHT();
break;
@ -4056,7 +4066,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
default:
Expecting( "mode, arc_segments, thermal_gap, thermal_bridge_width, "
"hatch_thickness, hatch_gap, hatch_orientation, "
"hatch_smoothing_level, hatch_smoothing_value, smoothing, radius"
"hatch_smoothing_level, hatch_smoothing_value, "
"hatch_border_algorithm, hatch_min_hole_area, smoothing, radius, "
"island_removal_mode, or island_area_min" );
}
}
@ -4266,7 +4277,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
}
// Set hatch here, after outlines corners are read
zone->SetHatch( hatchStyle, hatchPitch, true );
zone->SetBorderDisplayStyle( hatchStyle, hatchPitch, true );
}
if( addedFilledPolygons )

View File

@ -1104,7 +1104,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
filler.Fill( toFill );
// Update the display
zone->Hatch();
zone->HatchBorder();
canvas()->Refresh();
// Restore the selection on the original zone

View File

@ -1013,7 +1013,7 @@ static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aO
aMergedZones.push_back( aOriginZones[0] );
aOriginZones[0]->SetLocalFlags( 1 );
aOriginZones[0]->Hatch();
aOriginZones[0]->HatchBorder();
aOriginZones[0]->CacheTriangulation();
return true;

View File

@ -743,7 +743,7 @@ void POINT_EDITOR::updateItem() const
}
validatePolygon( outline );
zone->Hatch();
zone->HatchBorder();
break;
}
@ -1298,7 +1298,7 @@ int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
// We re-hatch the filled zones but not polygons
if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
static_cast<ZONE_CONTAINER*>( item )->Hatch();
static_cast<ZONE_CONTAINER*>( item )->HatchBorder();
commit.Push( _( "Add a zone corner" ) );
@ -1414,7 +1414,7 @@ int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
// Refresh zone hatching
if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
static_cast<ZONE_CONTAINER*>( item )->Hatch();
static_cast<ZONE_CONTAINER*>( item )->HatchBorder();
updatePoints();
}

View File

@ -160,7 +160,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE
auto newZone = new ZONE_CONTAINER( aZone );
newZone->SetOutline( newZoneOutline );
newZone->SetLocalFlags( 1 );
newZone->Hatch();
newZone->HatchBorder();
newZones.push_back( newZone );
commit.Add( newZone );
}
@ -192,7 +192,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE_CONTAINER> aZone )
{
BOARD_COMMIT bCommit( &m_tool );
aZone->Hatch();
aZone->HatchBorder();
if( !m_params.m_keepout )
{

View File

@ -46,6 +46,7 @@
#include <confirm.h>
#include <convert_to_biu.h>
#include <math/util.h> // for KiROUND
#include <libs/kimath/include/convert_basic_shapes_to_polygon.h>
#include "zone_filler.h"
@ -630,9 +631,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
// Add non-connected pad clearances
//
for( auto module : m_board->Modules() )
for( MODULE* module : m_board->Modules() )
{
for( auto pad : module->Pads() )
for( D_PAD* pad : module->Pads() )
{
if( !pad->IsOnLayer( aLayer ) )
{
@ -665,7 +666,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
// Add non-connected track clearances
//
for( auto track : m_board->Tracks() )
for( TRACK* track : m_board->Tracks() )
{
if( !track->IsOnLayer( aLayer ) )
continue;
@ -700,16 +701,16 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
}
};
for( auto module : m_board->Modules() )
for( MODULE* module : m_board->Modules() )
{
doGraphicItem( &module->Reference() );
doGraphicItem( &module->Value() );
for( auto item : module->GraphicalItems() )
for( BOARD_ITEM* item : module->GraphicalItems() )
doGraphicItem( item );
}
for( auto item : m_board->Drawings() )
for( BOARD_ITEM* item : m_board->Drawings() )
doGraphicItem( item );
// Add zones outlines having an higher priority and keepout
@ -1135,28 +1136,26 @@ void ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER
// (Gbr file unit = 1 or 10 nm) due to some truncation in coordinates or calculations
// This margin also avoid problems due to rounding coordinates in next calculations
// that can create incorrect polygons
int thickness = std::max( aZone->GetHatchFillTypeThickness(),
aZone->GetMinThickness()+Millimeter2iu( 0.001 ) );
int thickness = std::max( aZone->GetHatchThickness(),
aZone->GetMinThickness() + Millimeter2iu( 0.001 ) );
int linethickness = thickness - aZone->GetMinThickness();
int gridsize = thickness + aZone->GetHatchFillTypeGap();
double orientation = aZone->GetHatchFillTypeOrientation();
int gridsize = thickness + aZone->GetHatchGap();
double orientation = aZone->GetHatchOrientation();
SHAPE_POLY_SET filledPolys = aRawPolys;
// Use a area that contains the rotated bbox by orientation,
// and after rotate the result by -orientation.
if( orientation != 0.0 )
{
filledPolys.Rotate( M_PI/180.0 * orientation, VECTOR2I( 0,0 ) );
}
BOX2I bbox = filledPolys.BBox( 0 );
// Build hole shape
// the hole size is aZone->GetHatchFillTypeGap(), but because the outline thickness
// the hole size is aZone->GetHatchGap(), but because the outline thickness
// is aZone->GetMinThickness(), the hole shape size must be larger
SHAPE_LINE_CHAIN hole_base;
int hole_size = aZone->GetHatchFillTypeGap() + aZone->GetMinThickness();
int hole_size = aZone->GetHatchGap() + aZone->GetMinThickness();
VECTOR2I corner( 0, 0 );;
hole_base.Append( corner );
corner.x += hole_size;
@ -1169,39 +1168,42 @@ void ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER
// Calculate minimal area of a grid hole.
// All holes smaller than a threshold will be removed
double minimal_hole_area = hole_base.Area() / 2;
double minimal_hole_area = hole_base.Area() * aZone->GetHatchHoleMinArea();
// Now convert this hole to a smoothed shape:
if( aZone->GetHatchFillTypeSmoothingLevel() > 0 )
if( aZone->GetHatchSmoothingLevel() > 0 )
{
// the actual size of chamfer, or rounded corner radius is the half size
// of the HatchFillTypeGap scaled by aZone->GetHatchFillTypeSmoothingValue()
// aZone->GetHatchFillTypeSmoothingValue() = 1.0 is the max value for the chamfer or the
// of the HatchFillTypeGap scaled by aZone->GetHatchSmoothingValue()
// aZone->GetHatchSmoothingValue() = 1.0 is the max value for the chamfer or the
// radius of corner (radius = half size of the hole)
int smooth_value = KiROUND( aZone->GetHatchFillTypeGap()
* aZone->GetHatchFillTypeSmoothingValue() / 2 );
int smooth_value = KiROUND( aZone->GetHatchGap()
* aZone->GetHatchSmoothingValue() / 2 );
// Minimal optimization:
// make smoothing only for reasonnable smooth values, to avoid a lot of useless segments
// and if the smooth value is small, use chamfer even if fillet is requested
#define SMOOTH_MIN_VAL_MM 0.02
#define SMOOTH_SMALL_VAL_MM 0.04
if( smooth_value > Millimeter2iu( SMOOTH_MIN_VAL_MM ) )
{
SHAPE_POLY_SET smooth_hole;
smooth_hole.AddOutline( hole_base );
int smooth_level = aZone->GetHatchFillTypeSmoothingLevel();
int smooth_level = aZone->GetHatchSmoothingLevel();
if( smooth_value < Millimeter2iu( SMOOTH_SMALL_VAL_MM ) && smooth_level > 1 )
smooth_level = 1;
// Use a larger smooth_value to compensate the outline tickness
// (chamfer is not visible is smooth value < outline thickess)
smooth_value += aZone->GetMinThickness()/2;
smooth_value += aZone->GetMinThickness() / 2;
// smooth_value cannot be bigger than the half size oh the hole:
smooth_value = std::min( smooth_value, aZone->GetHatchFillTypeGap()/2 );
smooth_value = std::min( smooth_value, aZone->GetHatchGap() / 2 );
// the error to approximate a circle by segments when smoothing corners by a arc
int error_max = std::max( Millimeter2iu( 0.01), smooth_value/20 );
int error_max = std::max( Millimeter2iu( 0.01 ), smooth_value / 20 );
switch( smooth_level )
{
@ -1212,8 +1214,9 @@ void ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER
break;
default:
if( aZone->GetHatchFillTypeSmoothingLevel() > 2 )
if( aZone->GetHatchSmoothingLevel() > 2 )
error_max /= 2; // Force better smoothing
hole_base = smooth_hole.Fillet( smooth_value, error_max ).Outline( 0 );
break;
@ -1249,15 +1252,78 @@ void ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, PCB_LAYER
holes.Move( bbox.GetPosition() );
// Clamp holes to the area of filled zones with a outline thickness
// > aZone->GetMinThickness() to be sure the thermal pads can be built
int outline_margin = std::max( (aZone->GetMinThickness()*10)/9, linethickness/2 );
filledPolys.Deflate( outline_margin, 16 );
// We must buffer holes by at least aZone->GetMinThickness() to guarantee that thermal
// reliefs can be built (and to give the zone a solid outline). However, it looks more
// visually consistent if the buffer width is the same as the hatch width.
int outline_margin = KiROUND( aZone->GetMinThickness() * 1.1 );
if( aZone->GetHatchBorderAlgorithm() )
outline_margin = std::max( outline_margin, aZone->GetHatchThickness() );
if( outline_margin > linethickness / 2 )
filledPolys.Deflate( outline_margin - linethickness / 2, 16 );
holes.BooleanIntersection( filledPolys, SHAPE_POLY_SET::PM_FAST );
if( orientation != 0.0 )
holes.Rotate( -M_PI/180.0 * orientation, VECTOR2I( 0,0 ) );
if( aZone->GetNetCode() != 0 )
{
// Vias and pads connected to the zone must not be allowed to become isolated inside
// one of the holes. Effectively this means their copper outline needs to be expanded
// to be at least as wide as the gap so that it is guaranteed to touch at least one
// edge.
EDA_RECT zone_boundingbox = aZone->GetBoundingBox();
SHAPE_POLY_SET aprons;
int min_apron_radius = ( aZone->GetHatchGap() * 10 ) / 19;
for( TRACK* track : m_board->Tracks() )
{
if( track->Type() == PCB_VIA_T )
{
VIA* via = static_cast<VIA*>( track );
if( via->GetNetCode() == aZone->GetNetCode()
&& via->IsOnLayer( aLayer )
&& via->GetBoundingBox().Intersects( zone_boundingbox ) )
{
int r = std::max( min_apron_radius,
via->GetDrillValue() / 2 + outline_margin );
TransformCircleToPolygon( aprons, via->GetPosition(), r, ARC_HIGH_DEF );
}
}
}
for( MODULE* module : m_board->Modules() )
{
for( D_PAD* pad : module->Pads() )
{
if( pad->GetNetCode() == aZone->GetNetCode()
&& pad->IsOnLayer( aLayer )
&& pad->GetBoundingBox().Intersects( zone_boundingbox ) )
{
// What we want is to bulk up the pad shape so that the narrowest bit of
// copper between the hole and the apron edge is at least outline_margin
// wide (and that the apron itself meets min_apron_radius. But that would
// take a lot of code and math, and the following approximation is close
// enough.
int pad_width = std::min( pad->GetSize().x, pad->GetSize().y );
int slot_width = std::min( pad->GetDrillSize().x, pad->GetDrillSize().y );
int min_annulus = ( pad_width - slot_width ) / 2;
int clearance = std::max( min_apron_radius - pad_width / 2,
outline_margin - min_annulus );
clearance = std::max( 0, clearance - linethickness / 2 );
pad->TransformShapeWithClearanceToPolygon( aprons, clearance, ARC_HIGH_DEF );
}
}
}
holes.BooleanSubtract( aprons, SHAPE_POLY_SET::PM_FAST );
}
// Now filter truncated holes to avoid small holes in pattern
// It happens for holes near the zone outline
for( int ii = 0; ii < holes.OutlineCount(); )

View File

@ -50,16 +50,17 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL );
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
m_HatchFillTypeThickness =
0; // good value of grid line thickness if m_FillMode = ZFM_GRID_PATTERN
m_HatchFillTypeGap = 0; // good value of grid line gap if m_FillMode = ZFM_GRID_PATTERN
m_HatchFillTypeOrientation = 0.0; // Grid style: orientation of grid lines in degrees
m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
m_NetcodeSelection = 0; // Net code selection for the current zone
m_Zone_HatchingStyle =
ZONE_HATCH_STYLE::DIAGONAL_EDGE; // Option to show the zone area (outlines only,
//short hatches or full hatches
m_HatchThickness = 0; // good value of grid line thickness if m_FillMode = ZFM_GRID_PATTERN
m_HatchGap = 0; // good value of grid line gap if m_FillMode = ZFM_GRID_PATTERN
m_HatchOrientation = 0.0; // Grid style: orientation of grid lines in degrees
m_HatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_HatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
m_HatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
m_HatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
m_NetcodeSelection = 0; // Net code selection for the current zone
m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; // Option to show the zone
// outlines only, short
// hatches or full hatches
m_Layers.reset().set( F_Cu );
m_Name = wxEmptyString;
@ -94,14 +95,16 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_FillMode = aSource.GetFillMode();
m_ZoneClearance = aSource.GetZoneClearance();
m_ZoneMinThickness = aSource.GetMinThickness();
m_HatchFillTypeThickness = aSource.GetHatchFillTypeThickness();
m_HatchFillTypeGap = aSource.GetHatchFillTypeGap();
m_HatchFillTypeOrientation = aSource.GetHatchFillTypeOrientation();
m_HatchFillTypeSmoothingLevel = aSource.GetHatchFillTypeSmoothingLevel();
m_HatchFillTypeSmoothingValue = aSource.GetHatchFillTypeSmoothingValue();
m_HatchThickness = aSource.GetHatchThickness();
m_HatchGap = aSource.GetHatchGap();
m_HatchOrientation = aSource.GetHatchOrientation();
m_HatchSmoothingLevel = aSource.GetHatchSmoothingLevel();
m_HatchSmoothingValue = aSource.GetHatchSmoothingValue();
m_HatchBorderAlgorithm = aSource.GetHatchBorderAlgorithm();
m_HatchHoleMinArea = aSource.GetHatchHoleMinArea();
m_NetcodeSelection = aSource.GetNetCode();
m_Name = aSource.GetZoneName();
m_Zone_HatchingStyle = aSource.GetHatchStyle();
m_ZoneBorderDisplayStyle = aSource.GetHatchStyle();
m_ThermalReliefGap = aSource.GetThermalReliefGap();
m_ThermalReliefCopperBridge = aSource.GetThermalReliefCopperBridge();
m_PadConnection = aSource.GetPadConnection();
@ -128,11 +131,13 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.SetFillMode( m_FillMode );
aTarget.SetZoneClearance( m_ZoneClearance );
aTarget.SetMinThickness( m_ZoneMinThickness );
aTarget.SetHatchFillTypeThickness( m_HatchFillTypeThickness );
aTarget.SetHatchFillTypeGap( m_HatchFillTypeGap );
aTarget.SetHatchFillTypeOrientation( m_HatchFillTypeOrientation );
aTarget.SetHatchFillTypeSmoothingLevel( m_HatchFillTypeSmoothingLevel );
aTarget.SetHatchFillTypeSmoothingValue( m_HatchFillTypeSmoothingValue );
aTarget.SetHatchThickness( m_HatchThickness );
aTarget.SetHatchGap( m_HatchGap );
aTarget.SetHatchOrientation( m_HatchOrientation );
aTarget.SetHatchSmoothingLevel( m_HatchSmoothingLevel );
aTarget.SetHatchSmoothingValue( m_HatchSmoothingValue );
aTarget.SetHatchBorderAlgorithm( m_HatchBorderAlgorithm );
aTarget.SetHatchHoleMinArea( m_HatchHoleMinArea );
aTarget.SetThermalReliefGap( m_ThermalReliefGap );
aTarget.SetThermalReliefCopperBridge( m_ThermalReliefCopperBridge );
aTarget.SetPadConnection( m_PadConnection );
@ -158,9 +163,10 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.SetNetCode( m_NetcodeSelection );
}
// call SetHatch last, because hatch lines will be rebuilt,
// call SetBorderDisplayStyle last, because hatch lines will be rebuilt,
// using new parameters values
aTarget.SetHatch( m_Zone_HatchingStyle, aTarget.GetDefaultHatchPitch(), true );
aTarget.SetBorderDisplayStyle( m_ZoneBorderDisplayStyle, aTarget.GetDefaultHatchPitch(),
true );
}

View File

@ -42,8 +42,8 @@ enum class ZONE_FILL_MODE
};
/// Zone hatch styles
enum class ZONE_HATCH_STYLE
/// Zone border styles
enum class ZONE_BORDER_DISPLAY_STYLE
{
NO_HATCH,
DIAGONAL_FULL,
@ -76,19 +76,19 @@ public:
SMOOTHING_LAST // sentinel
};
ZONE_FILL_MODE m_FillMode;
int m_ZonePriority; ///< Priority (0 ... N) of the zone
int m_ZoneClearance; ///< Minimal clearance value
int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_HatchFillTypeThickness; ///< Grid style shape: thickness of lines (if 0 -> solid shape)
int m_HatchFillTypeGap; ///< Grid style shape: clearance between lines (0 -> solid shape)
double m_HatchFillTypeOrientation; ///< Grid style shape: orientation of grid lines in degrees
int m_HatchFillTypeSmoothingLevel; ///< Grid pattern smoothing type, similar to corner smoothing type
///< 0 = no smoothing, 1 = fillet, >= 2 = arc
double m_HatchFillTypeSmoothingValue; ///< Grid pattern chamfer distance/fillet value
///< this is the ratio between the gap and the chamfer size
ZONE_FILL_MODE m_FillMode;
int m_ZoneClearance; // Minimal clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas
int m_HatchThickness; // HatchBorder thickness of lines (if 0 -> solid shape)
int m_HatchGap; // HatchBorder clearance between lines (0 -> solid shape)
double m_HatchOrientation; // HatchBorder orientation of grid lines in degrees
int m_HatchSmoothingLevel; // HatchBorder smoothing type, similar to corner smoothing type
// 0 = no smoothing, 1 = fillet, >= 2 = arc
double m_HatchSmoothingValue; // HatchBorder chamfer/fillet size as a ratio of hole size
double m_HatchHoleMinArea; // min size before holes are dropped (ratio)
int m_HatchBorderAlgorithm; // 0 = use min zone thickness
int m_NetcodeSelection; ///< Net code selection for the current zone
@ -97,7 +97,7 @@ public:
LSET m_Layers; ///< Layers that this zone exists on
/// Option to show the zone area (outlines only, short hatches or full hatches
ZONE_HATCH_STYLE m_Zone_HatchingStyle;
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle;
long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs
long m_ThermalReliefCopperBridge; ///< thickness of the copper bridge in thermal reliefs

View File

@ -324,7 +324,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_
RemoveArea( aDeletedList, area_to_combine );
area_ref->SetLocalFlags( 1 );
area_ref->Hatch();
area_ref->HatchBorder();
return true;
}