Commit 738d00ba authored by CHARRAS's avatar CHARRAS

more about new zone handling: fill zones now exists

parent cbea44a6
......@@ -554,7 +554,7 @@ enum main_id {
ID_POPUP_PCB_DELETE_ZONE_CORNER,
ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE,
ID_POPUP_PCB_DELETE_EDGE_ZONE,
ID_POPUP_PCB_DELETE_ZONE_LIMIT,
ID_POPUP_PCB_FILL_ALL_ZONES,
ID_POPUP_PCB_FILL_ZONE,
ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
ID_POPUP_PCB_PLACE_ZONE_CORNER,
......
......@@ -748,7 +748,15 @@ public:
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling
void Delete_Zone( wxDC* DC, SEGZONE* Track );
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
void Delete_Zone( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
/**
* Function Begin_Zone
......@@ -760,14 +768,31 @@ public:
/**
* Function End_Zone
* terminates the zone edge creation process
* @param DC = current Device Context
*/
void End_Zone( wxDC* DC );
/**
* Function Fill_Zone
* Fills an outline.
*/
void Fill_Zone( wxDC* DC, ZONE_CONTAINER * zone_container );
/** Function Fill_Zone()
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param DC = current Device Context
* @param zone_container = zone to fill
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( wxDC* DC, ZONE_CONTAINER * zone_container, bool verbose = TRUE );
/** Function Fill_All_Zones()
* Fill all zones on the board
* The old fillings are removed
* @param frame = reference to the main frame
* @param DC = current Device Context
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_All_Zones( wxDC* DC, bool verbose = TRUE );
/**
* Function Edit_Zone_Params
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,22 +12,38 @@ KICAD_BIN = /f/kicad/winexe
# DLL use wxWin STATIC 0 0 1
#
# turn on/OFF debugging for all executables, only tested without KICAD_PYTHON
DEBUG = 0
#comment this for static wxWidgets link
#WXUSINGDLL = 1
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
ifeq ($(DEBUG), 1)
WXWIN=f:/wxMSW-2.8.7-debug
else
WXWIN=f:/wxMSW-2.8.7
endif
endif
LIBVERSION = 2.8
# You must comment or uncomment this line to disable/enable python support
#KICAD_PYTHON = 1
ifeq ($(DEBUG), 1)
CPPFLAGS = -Wall -g3 -ggdb3 -DDEBUG ${WXXFLAGS} -fno-strict-aliasing
ALL_LDFLAGS = -g3 -ggdb3 #-v
else
CPPFLAGS = -Wall -O2 ${WXXFLAGS} -fno-strict-aliasing
ALL_LDFLAGS = -s #-v
FINAL = 1
endif
ALL_CPPFLAGS = `$(WXWIN)/wx-config --cppflags`
ALL_CPPFLAGS = `$(WXWIN)/wx-config --cppflags` $(CPPFLAGS)
EDACPPFLAGS = $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS)
EDALIBS = $(EXTRALIBS)
......
......@@ -73,7 +73,6 @@ SET(PCBNEW_SRCS
edtxtmod.cpp
export_gencad.cpp
files.cpp
filling_zone_algorithm.cpp
find.cpp
gendrill.cpp
gen_modules_placefile.cpp
......@@ -135,6 +134,7 @@ SET(PCBNEW_SRCS
work.cpp
xchgmod.cpp
zones_by_polygon.cpp
zone_filling_algorithm.cpp
# zones.cpp
)
......
......@@ -19,8 +19,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
, CPolyLine( NULL )
{
m_NetCode = -1; // Net number for fast comparisons
m_NetCode = -1; // Net number for fast comparisons
m_CornerSelection = -1;
m_ZoneClearance = 200; // a reasonnable clerance value
m_GridFillValue = 50; // a reasonnable grid used for filling
m_PadOption = THERMAL_PAD;
}
......
......@@ -18,11 +18,19 @@
class ZONE_CONTAINER : public BOARD_ITEM, public CPolyLine
{
public:
wxString m_Netname; /* Net Name */
enum m_PadInZone { // How pads are covered by copper in zone
PAD_NOT_IN_ZONE, // Pads are not covered
THERMAL_PAD, // Use thermal relief for pads
PAD_IN_ZONE // pads are covered by copper
};
wxString m_Netname; // Net Name
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_ZoneClearance; // clearance value
int m_GridFillValue; // Grid used for filling
m_PadInZone m_PadOption; // see m_PadInZone
private:
int m_NetCode; // Net number for fast comparisons
int m_NetCode; // Net number for fast comparisons
public:
ZONE_CONTAINER(BOARD * parent);
......@@ -70,6 +78,19 @@ public:
* @param refPos : A wxPoint to test
*/
int HitTestForEdge( const wxPoint& refPos );
/** Function Fill_Zone()
* Calculate the zone filling
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param frame = reference to the main frame
* @param DC = current Device Context
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE);
};
/*******************/
......
......@@ -267,14 +267,21 @@ void WinEDA_ZoneFrame::CreateControls()
m_GridCtrl->SetSelection( selection );
if( Zone_Exclude_Pads )
switch( s_Zone_Pad_Options )
{
if( s_Zone_Create_Thermal_Relief )
m_FillOpt->SetSelection( 1 );
else
case ZONE_CONTAINER::PAD_NOT_IN_ZONE: // Pads are not covered
m_FillOpt->SetSelection( 2 );
}
break;
case ZONE_CONTAINER::THERMAL_PAD: // Use thermal relief for pads
m_FillOpt->SetSelection( 1 );
break;
case ZONE_CONTAINER::PAD_IN_ZONE: // pads are covered by copper
m_FillOpt->SetSelection( 0 );
break;
}
if ( m_Zone_Container )
s_Zone_Hatching = m_Zone_Container->GetHatch();
switch( s_Zone_Hatching )
{
case CPolyLine::NO_HATCH:
......@@ -296,7 +303,7 @@ void WinEDA_ZoneFrame::CreateControls()
for( int ii = 0; ii < g_DesignSettings.m_CopperLayerCount; ii++ )
{
wxString msg;
int layer_number;
int layer_number = COPPER_LAYER_N;
if( layer_cnt == 0 || ii < layer_cnt - 1 )
layer_number = ii;
else if( ii == layer_cnt - 1 )
......@@ -396,19 +403,16 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
{
switch( m_FillOpt->GetSelection() )
{
case 0:
Zone_Exclude_Pads = FALSE;
s_Zone_Create_Thermal_Relief = FALSE;
case 2:
s_Zone_Pad_Options = ZONE_CONTAINER::PAD_NOT_IN_ZONE; // Pads are not covered
break;
case 1:
Zone_Exclude_Pads = TRUE;
s_Zone_Create_Thermal_Relief = TRUE;
s_Zone_Pad_Options = ZONE_CONTAINER::THERMAL_PAD; // Use thermal relief for pads
break;
case 2:
Zone_Exclude_Pads = TRUE;
s_Zone_Create_Thermal_Relief = FALSE;
case 0:
s_Zone_Pad_Options = ZONE_CONTAINER::PAD_IN_ZONE; // pads are covered by copper
break;
}
......
......@@ -66,7 +66,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_ZONE_LIMIT:
case ID_POPUP_PCB_FILL_ALL_ZONES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
case ID_POPUP_PCB_DELETE_ZONE:
......@@ -450,19 +450,31 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
{
DrawPanel->MouseToCursorSchema();
((ZONE_CONTAINER*)GetCurItem())->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
m_Pcb->Delete( GetCurItem() );
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
zone_cont->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
Delete_Zone( &dc, NULL, zone_cont->m_TimeStamp );
m_Pcb->Delete( zone_cont );
SetCurItem( NULL );
break;
}
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
{
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
zone_cont->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
zone_cont->DeleteCorner(zone_cont->m_CornerSelection);
zone_cont->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
if ( zone_cont->GetNumCorners() <= 3 )
{
Delete_Zone( &dc, NULL, zone_cont->m_TimeStamp );
m_Pcb->Delete( zone_cont );
}
else
{
zone_cont->DeleteCorner(zone_cont->m_CornerSelection);
zone_cont->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
}
SetCurItem( NULL );
break;
}
......@@ -500,9 +512,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
}
case ID_POPUP_PCB_DELETE_ZONE_LIMIT:
case ID_POPUP_PCB_FILL_ALL_ZONES:
DrawPanel->MouseToCursorSchema();
DelLimitesZone( &dc, TRUE );
Fill_All_Zones( &dc );
break;
case ID_POPUP_PCB_FILL_ZONE:
......
......@@ -12,7 +12,7 @@ ZONE_FILES = zones_by_polygon.o
OBJECTS= $(TARGET).o classpcb.o\
$(ZONE_FILES)\
filling_zone_algorithm.o\
zone_filling_algorithm.o\
lay2plot.o\
modedit_undo_redo.o\
block_module_editor.o\
......
......@@ -302,6 +302,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
_( "Create Corner" ), move_xpm );
}
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill zone" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
......@@ -387,17 +390,13 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
case ID_PCB_ZONES_BUTT:
{
bool add_separator = FALSE;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill zone" ), fill_zone_xpm );
if( m_Pcb->m_CurrentLimitZone )
{
add_separator = TRUE;
aPopMenu->Append( ID_POPUP_PCB_DELETE_ZONE_LIMIT, _( "Delete Zone Limit" ) );
}
if( add_separator )
if ( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
_( "Fill or Refill All Zones" ), fill_zone_xpm );
aPopMenu->AppendSeparator();
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm );
aPopMenu->AppendSeparator();
......
This diff is collapsed.
......@@ -993,7 +993,7 @@ void CPolyLine::StartDraggingToMoveCorner( CDC * pDC, int ic, int x, int y )
// get indexes for preceding and following corners
int pre_c, post_c;
int poly_side_style1, poly_side_style2;
int style1, style2;
int style1 = DSS_STRAIGHT, style2 = DSS_STRAIGHT;
if( ic == istart )
{
pre_c = iend;
......@@ -1057,7 +1057,7 @@ void CPolyLine::HighlightSide( int is )
if( !GetClosed() && is >= (int)(corner.size()-1) )
return;
int style;
int style = DL_LINE;
if( side_style[is] == CPolyLine::STRAIGHT )
style = DL_LINE;
else if( side_style[is] == CPolyLine::ARC_CW )
......@@ -1319,7 +1319,7 @@ void CPolyLine::Hatch()
min_a = (int)(min_y - slope*min_x);
}
min_a = (min_a/spacing)*spacing;
int offset;
int offset = 0;
if( layer < (LAY_TOP_COPPER+2) )
offset = 0;
else if( layer < (LAY_TOP_COPPER+4) )
......@@ -1400,7 +1400,7 @@ void CPolyLine::Hatch()
for( int istart=0; istart<(npts-1); istart++ )
{
int max_x = INT_MIN;
int imax;
int imax = INT_MIN;
for( int i=istart; i<npts; i++ )
{
if( xx[i] > max_x )
......
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