Commit 7c5feb61 authored by charras's avatar charras

pcbnew: insulated islands in copper pour removed

parent 2ffa0897
...@@ -5,6 +5,18 @@ Started 2007-June-11 ...@@ -5,6 +5,18 @@ 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-oct-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
More about copper zones filled without grid (by polygons)
Currently for tests only (work in progress).
now working
thermal reliefs.
texts on copper zones.
Removing insulated copper islands.
currently : not implemented:
trapezoidal pads
2008-oct-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-oct-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
......
...@@ -570,7 +570,7 @@ enum main_id { ...@@ -570,7 +570,7 @@ enum main_id {
ID_POPUP_PCB_PLACE_ZONE_OUTLINES, ID_POPUP_PCB_PLACE_ZONE_OUTLINES,
ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT,
ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
ID_POPUP_ZONE_UNUSED3, ID_POPUP_PCB_REMOVE_FILLED_AREAS,
ID_POPUP_ZONE_UNUSED4, ID_POPUP_ZONE_UNUSED4,
ID_POPUP_PCB_DELETE_MARKER, ID_POPUP_PCB_DELETE_MARKER,
......
...@@ -143,6 +143,7 @@ set(PCBNEW_SRCS ...@@ -143,6 +143,7 @@ set(PCBNEW_SRCS
zones_by_polygon.cpp zones_by_polygon.cpp
zones_convert_brd_items_to_polygons.cpp zones_convert_brd_items_to_polygons.cpp
zone_filling_algorithm.cpp zone_filling_algorithm.cpp
zones_polygons_insulated_copper_islands.cpp
zones_test_and_combine_areas.cpp zones_test_and_combine_areas.cpp
) )
......
...@@ -101,6 +101,12 @@ public: ...@@ -101,6 +101,12 @@ public:
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
/**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands
* Remove insulated copper islands found in m_FilledPolysList.
* @param aPcb = the board to analyse
*/
void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb );
/** /**
* Function DrawWhileCreateOutline * Function DrawWhileCreateOutline
...@@ -157,7 +163,7 @@ public: ...@@ -157,7 +163,7 @@ public:
* used in BuildFilledPolysListData when calculating filled areas in a zone * used in BuildFilledPolysListData when calculating filled areas in a zone
* Non copper areas are pads and track and their clearance area * Non copper areas are pads and track and their clearance area
* The filled copper area must be computed before * The filled copper area must be computed before
* BuildFilledPolysListData() call this function just after creating the * BuildFilledPolysListData() call this function just after creating the
* filled copper area polygon (without clearence areas * filled copper area polygon (without clearence areas
* @param aPcb: the current board * @param aPcb: the current board
*/ */
......
...@@ -68,6 +68,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -68,6 +68,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
case ID_POPUP_PCB_FILL_ALL_ZONES: case ID_POPUP_PCB_FILL_ALL_ZONES:
case ID_POPUP_PCB_REMOVE_FILLED_AREAS:
case ID_POPUP_PCB_PLACE_ZONE_CORNER: case ID_POPUP_PCB_PLACE_ZONE_CORNER:
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_EDIT_ZONE_PARAMS: case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
...@@ -542,6 +543,22 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -542,6 +543,22 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Fill_All_Zones( &dc ); Fill_All_Zones( &dc );
break; break;
case ID_POPUP_PCB_REMOVE_FILLED_AREAS: // Remove all zones :
if( m_Pcb->m_Zone )
{
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii );
zone_container->m_FilledPolysList.clear();;
}
GetScreen()->SetModify();
DrawPanel->Refresh();
break;
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
......
...@@ -13,7 +13,8 @@ LIBVIEWER3D = ../3d-viewer/3d-viewer.a ...@@ -13,7 +13,8 @@ LIBVIEWER3D = ../3d-viewer/3d-viewer.a
ZONE_FILES = zones_by_polygon.o zones_test_and_combine_areas.o\ ZONE_FILES = zones_by_polygon.o zones_test_and_combine_areas.o\
zone_filling_algorithm.o\ zone_filling_algorithm.o\
zones_convert_brd_items_to_polygons.o zones_convert_brd_items_to_polygons.o\
zones_polygons_insulated_copper_islands.o
SPECCTRA_TOOLS = specctra.o specctra_export.o dsn.o specctra_import.o SPECCTRA_TOOLS = specctra.o specctra_export.o dsn.o specctra_import.o
......
...@@ -338,8 +338,11 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -338,8 +338,11 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
if( m_Pcb->m_ZoneDescriptorList.size() > 0 ) if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{ {
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
_( "Fill or Refill All Zones" ), fill_zone_xpm ); _( "Fill or Refill All Zones" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS,
_( "Remove Filled Areas" ), fill_zone_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
// Licence: GPL License // Licence: GPL License
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#pragma implementation "dialog_zones_by_polygon.h"
#endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
......
...@@ -13,6 +13,9 @@ using namespace std; ...@@ -13,6 +13,9 @@ using namespace std;
#include "PolyLine.h" #include "PolyLine.h"
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb, ZONE_CONTAINER* aZone_container );
// Local Functions: // Local Functions:
void AddTrackWithClearancePolygon( Bool_Engine* aBooleng, void AddTrackWithClearancePolygon( Bool_Engine* aBooleng,
TRACK& aTrack, int aClearanceValue ); TRACK& aTrack, int aClearanceValue );
...@@ -181,6 +184,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -181,6 +184,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
} }
delete booleng; delete booleng;
// Remove insulated islands:
if ( GetNet() > 0 )
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
} }
...@@ -310,12 +317,12 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng, ...@@ -310,12 +317,12 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
} }
corners_buffer.push_back( corner_end.x ); corners_buffer.push_back( corner_end.x );
corners_buffer.push_back( corner_end.y ); corners_buffer.push_back( corner_end.y );
/* add the radius lines */ /* add the radius lines */
corner.x = corner.y = aThermalGap / 2; corner.x = corner.y = aThermalGap / 2;
corners_buffer.push_back( corner.x ); corners_buffer.push_back( corner.x );
corners_buffer.push_back( corner.y ); corners_buffer.push_back( corner.y );
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg // Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
angle = 450; // TODO: problems with kbool if angle = 0 (bad filled polygon on some pads, but not alls) angle = 450; // TODO: problems with kbool if angle = 0 (bad filled polygon on some pads, but not alls)
......
set(POLYGON_SRCS set(POLYGON_SRCS
math_for_graphics.cpp math_for_graphics.cpp
PolyLine.cpp) PolyLine.cpp
polygon_test_point_inside.cpp
)
add_library(polygon ${POLYGON_SRCS}) add_library(polygon ${POLYGON_SRCS})
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
class CPolyPt class CPolyPt
{ {
public: public:
CPolyPt( int qx = 0, int qy = 0, bool qf = FALSE ) CPolyPt( int qx = 0, int qy = 0, bool qf = false )
{ x = qx; y = qy; end_contour = qf; utility = 0; }; { x = qx; y = qy; end_contour = qf; utility = 0; };
int x; int x;
int y; int y;
...@@ -104,6 +104,8 @@ public: ...@@ -104,6 +104,8 @@ public:
int utility; int utility;
}; };
#include "polygon_test_point_inside.h"
class CPolyLine class CPolyLine
{ {
public: public:
...@@ -116,11 +118,11 @@ public: ...@@ -116,11 +118,11 @@ public:
// functions for modifying polyline // functions for modifying polyline
void Start( int layer, int x, int y, int hatch ); void Start( int layer, int x, int y, int hatch );
void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw = TRUE ); void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw = false );
void InsertCorner( int ic, int x, int y ); void InsertCorner( int ic, int x, int y );
void DeleteCorner( int ic, bool bDraw = TRUE ); void DeleteCorner( int ic, bool bDraw = false );
void MoveCorner( int ic, int x, int y ); void MoveCorner( int ic, int x, int y );
void Close( int style = STRAIGHT, bool bDraw = TRUE ); void Close( int style = STRAIGHT, bool bDraw = false );
void RemoveContour( int icont ); void RemoveContour( int icont );
void RemoveAllContours( void ); void RemoveAllContours( void );
...@@ -170,7 +172,7 @@ public: ...@@ -170,7 +172,7 @@ public:
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa = NULL ); int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa = NULL );
int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa = NULL, int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa = NULL,
bool bRetainArcs = FALSE ); bool bRetainArcs = false );
// KBOOL functions // KBOOL functions
...@@ -214,7 +216,7 @@ public: ...@@ -214,7 +216,7 @@ public:
* because copper areas have only one outside contour * because copper areas have only one outside contour
* Therefore, if this results in new CPolyLines, return them as std::vector pa * Therefore, if this results in new CPolyLines, return them as std::vector pa
* @param aExtraPolys: pointer on a std::vector<CPolyLine*> to store extra CPolyLines * @param aExtraPolys: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
* @param bRetainArcs == TRUE, try to retain arcs in polys * @param bRetainArcs == false, try to retain arcs in polys
* @return number of external contours, or -1 if error * @return number of external contours, or -1 if error
*/ */
int NormalizeWithKbool( std::vector<CPolyLine*> * aExtraPolyList, bool bRetainArcs ); int NormalizeWithKbool( std::vector<CPolyLine*> * aExtraPolyList, bool bRetainArcs );
......
...@@ -6,7 +6,9 @@ COMMON = ...@@ -6,7 +6,9 @@ COMMON =
OBJECTS= \ OBJECTS= \
PolyLine.o\ PolyLine.o\
math_for_graphics.o math_for_graphics.o\
polygon_test_point_inside.o
PolyLine.o: PolyLine.cpp PolyLine.h PolyLine.o: PolyLine.cpp PolyLine.h
......
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