Commit ae05cd80 authored by jean-pierre charras's avatar jean-pierre charras

Remove arcs support in zone outlines: this is a legacy code from FreePCB,...

Remove arcs support in zone outlines: this is a legacy code from FreePCB, never used, never tested, never maintained.
parent f96d557e
......@@ -1041,7 +1041,7 @@ public:
* @param aLayer = the layer of area
* @param aStartPointPosition = position of the first point of the polygon outline of this area
* @param aHatch = hatch option
* @return pointer to the new area
* @return a reference to the new area
*/
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
int aLayer, wxPoint aStartPointPosition, int aHatch );
......@@ -1054,58 +1054,30 @@ public:
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
/**
* Function TestAreaPolygon
* Test an area for self-intersection.
*
* @param CurrArea = copper area to test
* @return :
* -1 if arcs intersect other sides
* 0 if no intersecting sides
* 1 if intersecting sides, but no intersecting arcs
* Also sets utility2 flag of area with return value
*/
int TestAreaPolygon( ZONE_CONTAINER* CurrArea );
/**
* Function ClipAreaPolygon
* Process an area that has been modified, by clipping its polygon against itself.
* Function NormalizeAreaPolygon
* Process an area that has been modified, by normalizing its polygon against itself.
* i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s)
* This may change the number and order of copper areas in the net.
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
* in undo commands) can be NULL
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers
* @param aCurrArea = the zone to process
* @param bMessageBoxInt == true, shows message when clipping occurs.
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
* @param bRetainArcs = true to handle arcs (not really used in KiCad)
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides
* @return true if changes are made
* Also sets areas->utility1 flags if areas are modified
*/
int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList,
ZONE_CONTAINER* aCurrArea,
bool bMessageBoxArc,
bool bMessageBoxInt,
bool bRetainArcs = true );
bool NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
ZONE_CONTAINER* aCurrArea );
/**
* Process an area that has been modified, by clipping its polygon against
* itself and the polygons for any other areas on the same net.
* Function OnAreaPolygonModified
* Process an area that has been modified, by normalizing its polygon
* and merging the intersecting polygons for any other areas on the same net.
* This may change the number and order of copper areas in the net.
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
* (useful in undo commands. Can be NULL
* (useful in undo commands can be NULL
* @param modified_area = area to test
* @param bMessageBoxInt : if true, shows message boxes when clipping occurs.
* @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs.
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides, polygon clipped
* @return true if some areas modified
*/
int AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
ZONE_CONTAINER* modified_area,
bool bMessageBoxArc,
bool bMessageBoxInt );
bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
ZONE_CONTAINER* modified_area );
/**
* Function CombineAllAreasInNet
......@@ -1113,15 +1085,13 @@ public:
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
* in undo commands can be NULL
* @param aNetCode = net to consider
* @param bMessageBox : if true display warning message box
* @param bUseUtility : if true, don't check areas if both utility flags are 0
* @param aUseUtility : if true, don't check areas if both utility flags are 0
* Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it
* @return true if some areas modified
*/
int CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
int aNetCode,
bool bMessageBox,
bool bUseUtility );
bool aUseUtility );
/**
* Function RemoveArea
......@@ -1154,17 +1124,15 @@ public:
/**
* Function CombineAreas
* If possible, combine 2 copper areas
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
* in undo commands can be NULL
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas
* (useful for undo).
* @param area_ref = the main area (zone)
* @param area_to_combine = the zone that can be merged with area_ref
* area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
* @return : true if area_to_combine is combined with area_ref (and therefore be deleted)
*/
int CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
bool CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
ZONE_CONTAINER* area_ref,
ZONE_CONTAINER* area_to_combine );
......
......@@ -65,7 +65,6 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
m_cornerRadius = 0;
utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines
aBoard->GetZoneSettings().ExportSetting( *this );
}
......@@ -102,7 +101,6 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
utility = aZone.utility;
utility2 = aZone.utility;
}
......
......@@ -573,7 +573,7 @@ public:
// thickness of the copper bridge in thermal reliefs
int m_ThermalReliefCopperBridge;
int utility, utility2; // flags used in polygon calculations
int utility; // flags used in polygon calculations
// true when a zone was filled, false after deleting the filled areas
bool m_IsFilled;
......
......@@ -44,8 +44,6 @@
#include <zones_functions_for_undo_redo.h>
#include <drc_stuff.h>
bool s_Verbose = false; // false if zone outline diags must not be shown
// Outline creation:
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
......@@ -141,7 +139,7 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
GetScreen()->SetCurItem( NULL ); // This outline may be deleted when merging outlines
// Combine zones if possible
GetBoard()->AreaPolygonModified( &_AuxiliaryList, newZone, true, s_Verbose );
GetBoard()->OnAreaPolygonModified( &_AuxiliaryList, newZone );
// Redraw zones
GetBoard()->RedrawAreasOutlines( m_canvas, aDC, GR_OR, newZone->GetLayer() );
......@@ -334,7 +332,7 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
// Combine zones if possible
wxBusyCursor dummy;
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
GetBoard()->OnAreaPolygonModified( &_AuxiliaryList, aZone );
m_canvas->Refresh();
......@@ -389,7 +387,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
aZone->m_Poly->DeleteCorner( aZone->m_CornerSelection );
// modify zones outlines according to the new aZone shape
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
GetBoard()->OnAreaPolygonModified( &_AuxiliaryList, aZone );
if( DC )
{
......@@ -768,7 +766,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
GetScreen()->SetCurItem( NULL ); // This outline can be deleted when merging outlines
// Combine zones if possible :
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone, true, s_Verbose );
GetBoard()->OnAreaPolygonModified( &_AuxiliaryList, zone );
// Redraw the real edge zone :
GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
......@@ -898,7 +896,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
aZone->SetNetName( net->GetNetname() );
// Combine zones if possible
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
GetBoard()->OnAreaPolygonModified( &_AuxiliaryList, aZone );
// Redraw the real new zone outlines
GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, -1 );
......
This diff is collapsed.
This diff is collapsed.
......@@ -110,15 +110,32 @@ public:
CPolyLine();
~CPolyLine();
// functions for modifying polyline
// functions for modifying the CPolyLine contours
/* initialize a contour
* set layer, hatch style, and starting point
*/
void Start( int layer, int x, int y, int hatch );
void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw = false );
void AppendCorner( int x, int y );
void InsertCorner( int ic, int x, int y );
void DeleteCorner( int ic, bool bDraw = false );
void DeleteCorner( int ic );
void MoveCorner( int ic, int x, int y );
void CloseLastContour();
void RemoveContour( int icont );
/**
* Function IsPolygonSelfIntersecting
* Test a CPolyLine for self-intersection of vertex (all contours).
*
* @return :
* false if no intersecting sides
* true if intersecting sides
* When a CPolyLine is self intersectic, it need to be normalized.
* (converted to non intersecting polygons)
*/
bool IsPolygonSelfIntersecting();
/**
* Function Chamfer
* returns a chamfered version of a polygon.
......@@ -206,10 +223,15 @@ public:
void SetHatchPitch( int pitch ) { m_hatchPitch = pitch; }
int RestoreArcs( std::vector<CArc>* arc_array, std::vector<CPolyLine*>* pa = NULL );
int NormalizeAreaOutlines( std::vector<CPolyLine*>* pa = NULL,
bool bRetainArcs = false );
/**
* Function NormalizeAreaOutlines
* Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s)
* @param aNewPolygonList = a std::vector<CPolyLine*> reference where to store new CPolyLine
* needed by the normalization
* @return the polygon count (always >= 1, becuse there is at lesat one polygon)
* There are new polygons only if the polygon count is > 1
*/
int NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList );
// KBOOL functions
......@@ -224,12 +246,9 @@ public:
/**
* Function MakeKboolPoly
* fill a kbool engine with a closed polyline contour
* approximates arcs with multiple straight-line segments
* combining intersecting contours if possible
* @param arc_array : return data on arcs in arc_array
* @return error: 0 if Ok, 1 if error
*/
int MakeKboolPoly( std::vector<CArc>* arc_array = NULL );
int MakeKboolPoly();
/**
* Function NormalizeWithKbool
......@@ -240,10 +259,10 @@ public:
* because copper areas have only one outside contour
* Therefore, if this results in new CPolyLines, return them as std::vector pa
* @param aExtraPolyList: pointer on a std::vector<CPolyLine*> to store extra CPolyLines
* @param bRetainArcs == false, try to retain arcs in polys
* @return number of external contours, or -1 if error
* (when after normalization, there is more than one polygon with holes)
* @return number of contours, or -1 if error
*/
int NormalizeWithKbool( std::vector<CPolyLine*>* aExtraPolyList, bool bRetainArcs );
int NormalizeWithKbool( std::vector<CPolyLine*>* aExtraPolyList );
// Bezier Support
void AppendBezier( int x1, int y1, int x2, int y2, int x3, int y3 );
......
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