Commit 75b3c3bf authored by charras's avatar charras

Switch to polygons in zones (old way no more supported)

areas can be now filled using solid polygons, or using segments to fill areas inside polygons.
parent 7de4bfe6
...@@ -5,6 +5,14 @@ Started 2007-June-11 ...@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Dec-03 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew
Switch to polygons in zones (old way no more supported)
areas can be now filled using solid polygons, or using segments to fill areas inside polygons.
results are same, but using segments can be better (faster redraw time) for polygons having a lot
of segments (more than 10000)
2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++build fixes ++build fixes
......
...@@ -866,7 +866,7 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points ) ...@@ -866,7 +866,7 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
/************************************************************************/ /************************************************************************/
/* Routine to draw a new polyline and fill it if Fill, in screen space. */ /* Routine to draw a new polyline and fill it if Fill, in screen space. */
/************************************************************************/ /************************************************************************/
void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
int width, int Color, int BgColor ) int width, int Color, int BgColor )
{ {
if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
...@@ -898,14 +898,14 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill, ...@@ -898,14 +898,14 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill,
/* Routine to draw a new closed polyline and fill it if Fill, in screen space */ /* Routine to draw a new closed polyline and fill it if Fill, in screen space */
/******************************************************************************/ /******************************************************************************/
void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
int Fill, int Color, int BgColor ) bool Fill, int Color, int BgColor )
{ {
GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor ); GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
} }
void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
int Fill, int width, int Color, int BgColor ) bool Fill, int width, int Color, int BgColor )
{ {
int startx, starty; int startx, starty;
...@@ -939,7 +939,7 @@ void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, ...@@ -939,7 +939,7 @@ void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
/* Routine to draw a new polyline and fill it if Fill, in drawing space. */ /* Routine to draw a new polyline and fill it if Fill, in drawing space. */
/************************************************************************/ /************************************************************************/
void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
int Fill, int width, int Color, int BgColor ) bool Fill, int width, int Color, int BgColor )
{ {
int ii, jj; int ii, jj;
...@@ -960,14 +960,14 @@ void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, ...@@ -960,14 +960,14 @@ void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
/* Routine to draw a closed polyline and fill it if Fill, in object space */ /* Routine to draw a closed polyline and fill it if Fill, in object space */
/**************************************************************************/ /**************************************************************************/
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
int Fill, int Color, int BgColor ) bool Fill, int Color, int BgColor )
{ {
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor ); GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
} }
void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, void GRClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
int Fill, int width, int Color, int BgColor ) bool Fill, int width, int Color, int BgColor )
{ {
int ii, jj; int ii, jj;
......
...@@ -96,15 +96,11 @@ void GRSMoveRel(int x, int y); ...@@ -96,15 +96,11 @@ void GRSMoveRel(int x, int y);
void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color); void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int width, int Color);
void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor); bool Fill, int width, int Color, int BgColor);
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int Color, int BgColor);
int Fill, int Color, int BgColor); void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
int Fill, int width, int Color, int BgColor); void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points, bool Fill, int width, int Color, int BgColor);
void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int width, int Color, int BgColor);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color); void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color); void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
......
...@@ -53,7 +53,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : ...@@ -53,7 +53,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Pads = NULL; // pointeur liste d'acces aux pads m_Pads = NULL; // pointeur liste d'acces aux pads
m_Ratsnest = NULL; // pointeur liste rats m_Ratsnest = NULL; // pointeur liste rats
m_LocalRatsnest = NULL; // pointeur liste rats local m_LocalRatsnest = NULL; // pointeur liste rats local
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour cuurently in progress m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour currently in progress
// de determination des contours de zone // de determination des contours de zone
for( int layer=0; layer<NB_COPPER_LAYERS; ++layer ) for( int layer=0; layer<NB_COPPER_LAYERS; ++layer )
...@@ -83,6 +83,13 @@ BOARD::~BOARD() ...@@ -83,6 +83,13 @@ BOARD::~BOARD()
m_Zone->DeleteStructList(); m_Zone->DeleteStructList();
m_Zone = 0; m_Zone = 0;
while ( m_ZoneDescriptorList.size() )
{
ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
Delete( area_to_remove );
}
MyFree( m_Pads ); MyFree( m_Pads );
m_Pads = 0; m_Pads = 0;
...@@ -264,7 +271,19 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) ...@@ -264,7 +271,19 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
} }
break; break;
case TYPEMODULE: case TYPEZONE:
{ // Add item to head of list (starting in m_Zone)
aBoardItem->SetParent( this );
aBoardItem->SetBack( this ); // item will be the first item: back chain to the board
BOARD_ITEM* next_item = m_Zone; // Remember old the first item
aBoardItem->SetNext( next_item ); // Chain the new one ton the old item
if( next_item ) // Back chain the old item to the new one
next_item->SetBack( aBoardItem );
m_Zone = (SEGZONE*) aBoardItem; // Add to head of list
}
break;
case TYPEMODULE:
// this is an insert, not an append which may also be needed. // this is an insert, not an append which may also be needed.
{ {
aBoardItem->SetBack( this ); aBoardItem->SetBack( this );
...@@ -278,7 +297,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) ...@@ -278,7 +297,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
// other types may use linked list // other types may use linked list
default: default:
wxFAIL_MSG( wxT("BOARD::Add() needs work") ); wxFAIL_MSG( wxT("BOARD::Add() needs work: BOARD_ITEM type not handled") );
} }
} }
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_ZoneClearance; // clearance value int m_ZoneClearance; // clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas int m_ZoneMinThickness; // Min thickness value in filled areas
int m_GridFillValue; // Grid used for filling, 0 = use polygonal areas to fill int m_FillMode; // How to fillingareas: 0 = use polygonal areas , != 0 fill with segments
int m_ArcToSegmentsCount; // number of segments to convert a cirlce to a polygon (uses 16 or 32) int m_ArcToSegmentsCount; // number of segments to convert a cirlce to a polygon (uses 16 or 32)
int m_PadOption; // int m_PadOption; //
int m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs int m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs
...@@ -255,6 +255,17 @@ public: ...@@ -255,6 +255,17 @@ public:
*/ */
int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE ); int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE );
/** Function Fill_Zone_Areas_With_Segments()
* Fill sub areas in a zone with segments with m_ZoneMinThickness width
* A scan is made line per line, on the whole filled areas, with a step of m_ZoneMinThickness.
* all intersecting points with the horizontal infinite line and polygons to fill are calculated
* a list of SEGZONE items is built, line per line
* @param aFrame = reference to the main frame
* @return number of segments created
*/
int Fill_Zone_Areas_With_Segments( WinEDA_PcbFrame* aFrame );
/* Geometric transformations: */ /* Geometric transformations: */
/** /**
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
ZONE_SETTING::ZONE_SETTING( void ) ZONE_SETTING::ZONE_SETTING( void )
{ {
m_GridFillValue = 250; // Grid value for filling zone by segments, 0 to used polygons to fill m_FillMode = 1; // Mode for filling zone : 1 use segments, 0 use polygons
m_ZoneClearance = 200; // Clearance value m_ZoneClearance = 200; // Clearance value
m_ZoneMinThickness = 0; // Min thickness value in filled areas m_ZoneMinThickness = 100; // Min thickness value in filled areas
m_NetcodeSelection = 0; // Net code selection for the current zone m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = 0; // Layer used to create the current zone m_CurrentZone_Layer = 0; // Layer used to create the current zone
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
...@@ -46,7 +46,7 @@ ZONE_SETTING::ZONE_SETTING( void ) ...@@ -46,7 +46,7 @@ ZONE_SETTING::ZONE_SETTING( void )
*/ */
void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource ) void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
{ {
m_GridFillValue = aSource.m_GridFillValue; m_FillMode = aSource.m_FillMode;
m_ZoneClearance = aSource.m_ZoneClearance; m_ZoneClearance = aSource.m_ZoneClearance;
m_ZoneMinThickness = aSource.m_ZoneMinThickness; m_ZoneMinThickness = aSource.m_ZoneMinThickness;
m_NetcodeSelection = aSource.GetNet(); m_NetcodeSelection = aSource.GetNet();
...@@ -63,20 +63,25 @@ void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource ) ...@@ -63,20 +63,25 @@ void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
/** function ExportSetting /** function ExportSetting
* copy settings to a given zone * copy settings to a given zone
* @param aTarget: the given zone * @param aTarget: the given zone
* Note: parameters NOT exported (because they cannot be safely exported): * @param aFullExport: if false: some parameters are NOT exported
* m_NetcodeSelection * because they must not be exported when export settings from a zone to others zones
* Currently:
* m_NetcodeSelection
*/ */
void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget ) void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport )
{ {
aTarget.m_GridFillValue = m_GridFillValue; aTarget.m_FillMode = m_FillMode;
aTarget.m_ZoneClearance = m_ZoneClearance; aTarget.m_ZoneClearance = m_ZoneClearance;
aTarget.m_ZoneMinThickness = m_ZoneMinThickness; aTarget.m_ZoneMinThickness = m_ZoneMinThickness;
aTarget.SetNet( m_NetcodeSelection );
aTarget.SetLayer( m_CurrentZone_Layer );
aTarget.m_Poly->SetHatch( m_Zone_HatchingStyle ); aTarget.m_Poly->SetHatch( m_Zone_HatchingStyle );
aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount; aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount;
aTarget.m_DrawOptions = m_FilledAreasShowMode; aTarget.m_DrawOptions = m_FilledAreasShowMode;
aTarget.m_ThermalReliefGapValue = m_ThermalReliefGapValue; aTarget.m_ThermalReliefGapValue = m_ThermalReliefGapValue;
aTarget.m_ThermalReliefCopperBridgeValue = m_ThermalReliefCopperBridgeValue; aTarget.m_ThermalReliefCopperBridgeValue = m_ThermalReliefCopperBridgeValue;
aTarget.m_PadOption = m_Zone_Pad_Options; aTarget.m_PadOption = m_Zone_Pad_Options;
if ( aFullExport )
{
aTarget.SetNet( m_NetcodeSelection );
aTarget.SetLayer( m_CurrentZone_Layer );
}
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class ZONE_SETTING class ZONE_SETTING
{ {
public: public:
int m_GridFillValue; // Grid value for filling zone by segments, 0 to used polygons to fill int m_FillMode; // Mode for filling zone : 1 use segments, 0 use polygons
int m_ZoneClearance; // Clearance value int m_ZoneClearance; // Clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas int m_ZoneMinThickness; // Min thickness value in filled areas
int m_NetcodeSelection; // Net code selection for the current zone int m_NetcodeSelection; // Net code selection for the current zone
...@@ -41,8 +41,12 @@ public: ...@@ -41,8 +41,12 @@ public:
/** function ExportSetting /** function ExportSetting
* copy settings to a given zone * copy settings to a given zone
* @param aTarget: the given zone * @param aTarget: the given zone
* @param aFullExport: if false: some parameters are NOT exported
* because they must not be exported when export settings from a zone to others zones
* Currently:
* m_NetcodeSelection
*/ */
void ExportSetting( ZONE_CONTAINER& aTarget ); void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true);
}; };
......
...@@ -66,31 +66,10 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) ...@@ -66,31 +66,10 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
wxString msg; wxString msg;
msg = m_GridCtrl->GetLabel() + ReturnUnitSymbol( g_UnitMetric );
m_GridCtrl->SetLabel( msg );
if( g_Zone_45_Only ) if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 ); m_OrientEdgesOpt->SetSelection( 1 );
static const int GridList[4] = { 25, 50, 100, 250 }; m_FillModeCtrl->SetSelection(m_Zone_Setting->m_FillMode ? 1 : 0);
int selection = 0;
int grid_routing = m_Zone_Setting->m_GridFillValue;
for( unsigned ii = 0; ii < 4; ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric,
GridList[ii],
m_Parent->m_InternalUnits );
m_GridCtrl->SetString( ii, msg );
if( grid_routing == GridList[ii] )
selection = ii;
}
if( grid_routing == 0 ) // No Grid: fill with polygons
selection = 4;
m_GridCtrl->SetSelection( selection );
AddUnitSymbol( *m_ClearanceValueTitle, g_UnitMetric ); AddUnitSymbol( *m_ClearanceValueTitle, g_UnitMetric );
msg = ReturnStringFromValue( g_UnitMetric, msg = ReturnStringFromValue( g_UnitMetric,
...@@ -294,29 +273,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -294,29 +273,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter ); m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter );
} }
switch( m_GridCtrl->GetSelection() ) m_Zone_Setting->m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
{
case 0:
m_Zone_Setting->m_GridFillValue = 25;
break;
case 1:
m_Zone_Setting->m_GridFillValue = 50;
break;
default:
case 2:
m_Zone_Setting->m_GridFillValue = 100;
break;
case 3:
m_Zone_Setting->m_GridFillValue = 250;
break;
case 4:
m_Zone_Setting->m_GridFillValue = 0;
break;
}
wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_Zone_Setting->m_ZoneClearance = m_Zone_Setting->m_ZoneClearance =
...@@ -325,6 +282,12 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab ...@@ -325,6 +282,12 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
txtvalue = m_ZoneMinThicknessCtrl->GetValue(); txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = m_Zone_Setting->m_ZoneMinThickness =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits ); ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits );
if ( m_Zone_Setting->m_ZoneMinThickness < 10 )
{
DisplayError( this,
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch or 0.00254 mm)" ) );
return false;
}
if( m_OrientEdgesOpt->GetSelection() == 0 ) if( m_OrientEdgesOpt->GetSelection() == 0 )
g_Zone_45_Only = FALSE; g_Zone_45_Only = FALSE;
...@@ -462,14 +425,12 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event ) ...@@ -462,14 +425,12 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event )
if( !AcceptOptions( true, true ) ) if( !AcceptOptions( true, true ) )
return; return;
// Export settings ( but layer ) to others zones: // Export settings ( but layer and netcode ) to others zones:
BOARD* pcb = m_Parent->m_Pcb; BOARD* pcb = m_Parent->m_Pcb;
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = pcb->GetArea( ii ); ZONE_CONTAINER* zone = pcb->GetArea( ii );
int zone_layer = zone->GetLayer(); m_Zone_Setting->ExportSetting( *zone, false ); // false = partiel export
m_Zone_Setting->ExportSetting( *zone );
zone->SetLayer( zone_layer );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
} }
} }
......
...@@ -37,24 +37,34 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -37,24 +37,34 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
wxStaticBoxSizer* m_FillOptionsBox; wxStaticBoxSizer* m_FillOptionsBox;
m_FillOptionsBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL ); m_FillOptionsBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL );
wxString m_GridCtrlChoices[] = { _("0.00000"), _("0.00000"), _("0.00000"), _("0.00000"), _("No grid (For tests only!)") }; wxString m_FillModeCtrlChoices[] = { _("Use polygons"), _("Use segments") };
int m_GridCtrlNChoices = sizeof( m_GridCtrlChoices ) / sizeof( wxString ); int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString );
m_GridCtrl = new wxRadioBox( this, ID_RADIOBOX_GRID_SELECTION, _("Grid Size for Filling"), wxDefaultPosition, wxDefaultSize, m_GridCtrlNChoices, m_GridCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FillModeCtrl = new wxRadioBox( this, ID_RADIOBOX_FILL_MODE_SELECTION, _("Filling Mode:"), wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_GridCtrl->SetSelection( 1 ); m_FillModeCtrl->SetSelection( 1 );
m_FillOptionsBox->Add( m_GridCtrl, 0, wxALL|wxEXPAND, 5 ); m_FillModeCtrl->SetToolTip( _("Filled areas can use solid polygons or segments.\nDepending on the complexity and the size of the zone,\nsometime polygons are better and sometime segments are better") );
m_FillOptionsBox->Add( m_FillModeCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_ArcApproximationOptChoices[] = { _("16 segments / 360 deg"), _("32 segments / 360 deg") };
int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString );
m_ArcApproximationOpt = new wxRadioBox( this, wxID_ARC_APPROX, _("Arcs Approximation:"), wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 1, wxRA_SPECIFY_COLS );
m_ArcApproximationOpt->SetSelection( 1 );
m_ArcApproximationOpt->SetToolTip( _("Number of segments to approximate a circle in filling calculations.\n16 segment is faster to calculate and when redraw screen.\n32 segment give a better quality") );
m_FillOptionsBox->Add( m_ArcApproximationOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_PadInZoneOptChoices[] = { _("Include pads"), _("Thermal relief"), _("Exclude pads") }; wxString m_PadInZoneOptChoices[] = { _("Include pads"), _("Thermal relief"), _("Exclude pads") };
int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString ); int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString );
m_PadInZoneOpt = new wxRadioBox( this, wxID_PADS_IN_ZONE_OPTIONS, _("Pad in Zone:"), wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 1, wxRA_SPECIFY_COLS ); m_PadInZoneOpt = new wxRadioBox( this, wxID_PADS_IN_ZONE_OPTIONS, _("Pad in Zone:"), wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 1, wxRA_SPECIFY_COLS );
m_PadInZoneOpt->SetSelection( 1 ); m_PadInZoneOpt->SetSelection( 0 );
m_FillOptionsBox->Add( m_PadInZoneOpt, 0, wxALL|wxEXPAND, 5 ); m_FillOptionsBox->Add( m_PadInZoneOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* m_ThermalShapesParamsSizer; wxStaticBoxSizer* m_ThermalShapesParamsSizer;
m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Thermal Reliefs Parameters") ), wxVERTICAL ); m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Thermal Reliefs:") ), wxVERTICAL );
m_AntipadSizeText = new wxStaticText( this, wxID_ANY, _("Antipad Size"), wxDefaultPosition, wxDefaultSize, 0 ); m_AntipadSizeText = new wxStaticText( this, wxID_ANY, _("Antipad Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_AntipadSizeText->Wrap( -1 ); m_AntipadSizeText->Wrap( -1 );
m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxRIGHT|wxLEFT, 5 );
m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_AntipadSizeValue->SetToolTip( _("Define the gap around the pad") ); m_AntipadSizeValue->SetToolTip( _("Define the gap around the pad") );
...@@ -63,7 +73,7 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -63,7 +73,7 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
m_CopperBridgeWidthText = new wxStaticText( this, wxID_ANY, _("Copper Width"), wxDefaultPosition, wxDefaultSize, 0 ); m_CopperBridgeWidthText = new wxStaticText( this, wxID_ANY, _("Copper Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_CopperBridgeWidthText->Wrap( -1 ); m_CopperBridgeWidthText->Wrap( -1 );
m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxRIGHT|wxLEFT, 5 );
m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_CopperWidthValue->SetToolTip( _("Define the tickness of copper in thermal reliefs") ); m_CopperWidthValue->SetToolTip( _("Define the tickness of copper in thermal reliefs") );
...@@ -97,19 +107,11 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -97,19 +107,11 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched outline"), _("Full hatched") }; wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched outline"), _("Full hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, ID_RADIOBOX_OUTLINES_OPTION, _("Outlines Appearance"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_OutlineAppearanceCtrl = new wxRadioBox( this, ID_RADIOBOX_OUTLINES_OPTION, _("Outlines Appearance"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
m_OutlineAppearanceCtrl->SetToolTip( _("Choose how a zone outline is displayed\n- Single line\n- Short hatching\n- Full zone area hatched") ); m_OutlineAppearanceCtrl->SetToolTip( _("Choose how a zone outline is displayed\n- Single line\n- Short hatching\n- Full zone area hatched") );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 ); m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 );
wxString m_ArcApproximationOptChoices[] = { _("16 segments / 360 deg"), _("32 segments / 360 deg") };
int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString );
m_ArcApproximationOpt = new wxRadioBox( this, wxID_ARC_APPROX, _("Arcs Approximation:"), wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 1, wxRA_SPECIFY_COLS );
m_ArcApproximationOpt->SetSelection( 1 );
m_ArcApproximationOpt->SetToolTip( _("Number of segments to approximate a circle in filling calculations.\n16 segment is faster to calculate and when redraw screen.\n32 segment give a better quality") );
m_OutilinesBoxOpt->Add( m_ArcApproximationOpt, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* m_OthersOptionsSizer; wxStaticBoxSizer* m_OthersOptionsSizer;
m_OthersOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others Options:") ), wxVERTICAL ); m_OthersOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others Options:") ), wxVERTICAL );
...@@ -139,11 +141,6 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -139,11 +141,6 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
m_MiddleBoxSizer->Add( m_OutilinesBoxOpt, 1, wxEXPAND, 5 ); m_MiddleBoxSizer->Add( m_OutilinesBoxOpt, 1, wxEXPAND, 5 );
m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export to others zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExportSetupButton->SetToolTip( _("Export this zone setup to all others copper zones") );
m_MiddleBoxSizer->Add( m_ExportSetupButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_MiddleBox->Add( m_MiddleBoxSizer, 0, 0, 5 ); m_MiddleBox->Add( m_MiddleBoxSizer, 0, 0, 5 );
m_ExportableSetupSizer->Add( m_MiddleBox, 1, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( m_MiddleBox, 1, wxEXPAND, 5 );
...@@ -156,12 +153,17 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -156,12 +153,17 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
wxBoxSizer* m_RightBoxSizer; wxBoxSizer* m_RightBoxSizer;
m_RightBoxSizer = new wxBoxSizer( wxVERTICAL ); m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Setup to others zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExportSetupButton->SetToolTip( _("Export this zone setup to all others copper zones") );
m_RightBoxSizer->Add( m_ExportSetupButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_OkButton = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 ); m_OkButton = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
m_OkButton->SetDefault(); m_OkButton->SetDefault();
m_RightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_RightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_RightBoxSizer->Add( m_ButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_RightBoxSizer->Add( m_ButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_RightBoxSizer->Add( 5, 20, 0, wxEXPAND, 5 ); m_RightBoxSizer->Add( 5, 20, 0, wxEXPAND, 5 );
...@@ -172,7 +174,7 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i ...@@ -172,7 +174,7 @@ dialog_copper_zone_base::dialog_copper_zone_base( wxWindow* parent, wxWindowID i
wxString m_NetSortingOptionChoices[] = { _("Alphabetic"), _("Advanced") }; wxString m_NetSortingOptionChoices[] = { _("Alphabetic"), _("Advanced") };
int m_NetSortingOptionNChoices = sizeof( m_NetSortingOptionChoices ) / sizeof( wxString ); int m_NetSortingOptionNChoices = sizeof( m_NetSortingOptionChoices ) / sizeof( wxString );
m_NetSortingOption = new wxRadioBox( this, ID_NET_SORTING_OPTION, _("Net sorting:"), wxDefaultPosition, wxDefaultSize, m_NetSortingOptionNChoices, m_NetSortingOptionChoices, 1, wxRA_SPECIFY_COLS ); m_NetSortingOption = new wxRadioBox( this, ID_NET_SORTING_OPTION, _("Net sorting:"), wxDefaultPosition, wxDefaultSize, m_NetSortingOptionNChoices, m_NetSortingOptionChoices, 1, wxRA_SPECIFY_COLS );
m_NetSortingOption->SetSelection( 1 ); m_NetSortingOption->SetSelection( 0 );
m_NetSortingOption->SetToolTip( _("Nets can be sorted:\nBy alphabetic order\nBy number of pads in the net (advanced)") ); m_NetSortingOption->SetToolTip( _("Nets can be sorted:\nBy alphabetic order\nBy number of pads in the net (advanced)") );
m_NetSortOptSizer->Add( m_NetSortingOption, 0, wxALL|wxEXPAND, 5 ); m_NetSortOptSizer->Add( m_NetSortingOption, 0, wxALL|wxEXPAND, 5 );
......
This diff is collapsed.
...@@ -47,12 +47,12 @@ class dialog_copper_zone_base : public wxDialog ...@@ -47,12 +47,12 @@ class dialog_copper_zone_base : public wxDialog
protected: protected:
enum enum
{ {
ID_RADIOBOX_GRID_SELECTION = 1000, ID_RADIOBOX_FILL_MODE_SELECTION = 1000,
wxID_ARC_APPROX,
wxID_PADS_IN_ZONE_OPTIONS, wxID_PADS_IN_ZONE_OPTIONS,
wxID_ANTIPAD_SIZE, wxID_ANTIPAD_SIZE,
wxID_COPPER_BRIDGE_VALUE, wxID_COPPER_BRIDGE_VALUE,
ID_RADIOBOX_OUTLINES_OPTION, ID_RADIOBOX_OUTLINES_OPTION,
wxID_ARC_APPROX,
wxID_BUTTON_EXPORT, wxID_BUTTON_EXPORT,
ID_NET_SORTING_OPTION, ID_NET_SORTING_OPTION,
ID_TEXTCTRL_NETNAMES_FILTER, ID_TEXTCTRL_NETNAMES_FILTER,
...@@ -60,7 +60,8 @@ class dialog_copper_zone_base : public wxDialog ...@@ -60,7 +60,8 @@ class dialog_copper_zone_base : public wxDialog
ID_LAYER_CHOICE, ID_LAYER_CHOICE,
}; };
wxRadioBox* m_GridCtrl; wxRadioBox* m_FillModeCtrl;
wxRadioBox* m_ArcApproximationOpt;
wxRadioBox* m_PadInZoneOpt; wxRadioBox* m_PadInZoneOpt;
wxStaticText* m_AntipadSizeText; wxStaticText* m_AntipadSizeText;
wxTextCtrl* m_AntipadSizeValue; wxTextCtrl* m_AntipadSizeValue;
...@@ -69,14 +70,13 @@ class dialog_copper_zone_base : public wxDialog ...@@ -69,14 +70,13 @@ class dialog_copper_zone_base : public wxDialog
wxRadioBox* m_OrientEdgesOpt; wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl; wxRadioBox* m_OutlineAppearanceCtrl;
wxRadioBox* m_ArcApproximationOpt;
wxCheckBox* m_ShowFilledAreasInSketchOpt; wxCheckBox* m_ShowFilledAreasInSketchOpt;
wxStaticText* m_ClearanceValueTitle; wxStaticText* m_ClearanceValueTitle;
wxTextCtrl* m_ZoneClearanceCtrl; wxTextCtrl* m_ZoneClearanceCtrl;
wxStaticText* m_MinThicknessValueTitle; wxStaticText* m_MinThicknessValueTitle;
wxTextCtrl* m_ZoneMinThicknessCtrl; wxTextCtrl* m_ZoneMinThicknessCtrl;
wxButton* m_ExportSetupButton;
wxButton* m_ExportSetupButton;
wxButton* m_OkButton; wxButton* m_OkButton;
wxButton* m_ButtonCancel; wxButton* m_ButtonCancel;
...@@ -98,7 +98,7 @@ class dialog_copper_zone_base : public wxDialog ...@@ -98,7 +98,7 @@ class dialog_copper_zone_base : public wxDialog
public: public:
dialog_copper_zone_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fill Zones Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 545,493 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); dialog_copper_zone_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fill Zones Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 566,582 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~dialog_copper_zone_base(); ~dialog_copper_zone_base();
}; };
......
...@@ -748,7 +748,8 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat ) ...@@ -748,7 +748,8 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
corners_count++; corners_count++;
if( corner->end_contour ) if( corner->end_contour )
{ // Plot the current filled area { // Plot the current filled area
PlotFilledPolygon( aFormat, corners_count, CornersBuffer ); if( aZone->m_FillMode == 0) // We are using solid polygons (if != 0: using segments in m_Zone)
PlotFilledPolygon( aFormat, corners_count, CornersBuffer );
if ( aZone->m_ZoneMinThickness > 0 ) if ( aZone->m_ZoneMinThickness > 0 )
PlotPolygon( aFormat, corners_count, CornersBuffer, aZone->m_ZoneMinThickness ); PlotPolygon( aFormat, corners_count, CornersBuffer, aZone->m_ZoneMinThickness );
corners_count = 0; corners_count = 0;
......
This diff is collapsed.
...@@ -907,17 +907,10 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v ...@@ -907,17 +907,10 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
int error_level = 0; int error_level = 0;
zone_container->m_FilledPolysList.clear(); zone_container->m_FilledPolysList.clear();
if( zone_container->m_GridFillValue == 0 ) Delete_Zone_Fill( NULL, NULL, zone_container->m_TimeStamp );
{ zone_container->BuildFilledPolysListData( m_Pcb );
zone_container->BuildFilledPolysListData( m_Pcb ); if ( DC )
if ( DC ) DrawPanel->Refresh();
DrawPanel->Refresh();
}
else
{
g_GridRoutingSize = zone_container->m_GridFillValue;
error_level = zone_container->Fill_Zone( this, DC, verbose );
}
GetScreen()->SetModify(); GetScreen()->SetModify();
......
...@@ -954,6 +954,8 @@ int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aB ...@@ -954,6 +954,8 @@ int ZONE_CONTAINER::CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aB
corner.x = (int) aBoolengine->GetPolygonXPoint(); corner.x = (int) aBoolengine->GetPolygonXPoint();
corner.y = (int) aBoolengine->GetPolygonYPoint(); corner.y = (int) aBoolengine->GetPolygonYPoint();
corner.end_contour = false; corner.end_contour = false;
// Flag this corner if starting a hole connection segment:
corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
m_FilledPolysList.push_back( corner ); m_FilledPolysList.push_back( corner );
count++; count++;
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment