Commit ef39c5f3 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

PolyLine and math_for_graphics code cleanup: remove arc support in CPolyLine class:

This is an obscure legacy code from FreePCB, never used, never tested, never maintained.
parents 474128a4 90a6daa7
Loading
Loading
Loading
Loading
+26 −58
Original line number Original line Diff line number Diff line
@@ -1041,7 +1041,7 @@ public:
     * @param aLayer = the layer of area
     * @param aLayer = the layer of area
     * @param aStartPointPosition = position of the first point of the polygon outline of this area
     * @param aStartPointPosition = position of the first point of the polygon outline of this area
     * @param aHatch = hatch option
     * @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,
    ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
                             int aLayer, wxPoint aStartPointPosition, int aHatch );
                             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 );
    ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );


    /**
    /**
     * Function TestAreaPolygon
     * Function NormalizeAreaPolygon
     * Test an area for self-intersection.
     * 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)
     * @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.
     * This may change the number and order of copper areas in the net.
     * 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
     * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers
     *                        in undo commands) can be NULL
     * @param aCurrArea = the zone to process
     * @param aCurrArea = the zone to process
     * @param bMessageBoxInt == true, shows message when clipping occurs.
     * @return true if changes are made
     * @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
     * Also sets areas->utility1 flags if areas are modified
     * Also sets areas->utility1 flags if areas are modified
     */
     */
    int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList,
    bool NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
                         ZONE_CONTAINER*    aCurrArea,
                               ZONE_CONTAINER* aCurrArea );
                         bool               bMessageBoxArc,
                         bool               bMessageBoxInt,
                         bool               bRetainArcs = true );


    /**
    /**
     * Process an area that has been modified, by clipping its polygon against
     * Function OnAreaPolygonModified
     * itself and the polygons for any other areas on the same net.
     * 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.
     * 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
     * @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 modified_area = area to test
     * @param bMessageBoxInt : if true, shows message boxes when clipping occurs.
     * @return true if some areas modified
     * @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
    */
    */
    int AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
    bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
                             ZONE_CONTAINER*    modified_area,
                                ZONE_CONTAINER*    modified_area );
                             bool               bMessageBoxArc,
                             bool               bMessageBoxInt );


    /**
    /**
     * Function CombineAllAreasInNet
     * Function CombineAllAreasInNet
@@ -1113,15 +1085,13 @@ public:
     * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
     * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
     *                       in undo commands can be NULL
     *                       in undo commands can be NULL
     * @param aNetCode = net to consider
     * @param aNetCode = net to consider
     * @param bMessageBox : if true display warning message box
     * @param aUseUtility : if true, don't check areas if both utility flags are 0
     * @param bUseUtility : if true, don't check areas if both utility flags are 0
     * Sets utility flag = 1 for any areas modified
     * 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,
                              int                aNetCode,
                              bool               bMessageBox,
                              bool               aUseUtility );
                              bool               bUseUtility );


    /**
    /**
     * Function RemoveArea
     * Function RemoveArea
@@ -1154,17 +1124,15 @@ public:
    /**
    /**
     * Function CombineAreas
     * Function CombineAreas
     * If possible, combine 2 copper areas
     * If possible, combine 2 copper areas
     * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
     * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas
     *                       in undo commands can be NULL
     *                      (useful for undo).
     * @param area_ref = the main area (zone)
     * @param area_ref = the main area (zone)
     * @param area_to_combine = the zone that can be merged with area_ref
     * @param area_to_combine = the zone that can be merged with area_ref
     * area_ref must be BEFORE area_to_combine
     * area_ref must be BEFORE area_to_combine
     * area_to_combine will be deleted, if areas are combined
     * area_to_combine will be deleted, if areas are combined
     * @return : 0 if no intersection
     * @return : true if area_to_combine is combined with area_ref (and therefore be deleted)
     *         1 if intersection
     *         2 if arcs intersect
     */
     */
    int CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
    bool CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
                       ZONE_CONTAINER*    area_ref,
                       ZONE_CONTAINER*    area_ref,
                       ZONE_CONTAINER*    area_to_combine );
                       ZONE_CONTAINER*    area_to_combine );


+1 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@


#include <class_board.h>
#include <class_board.h>
#include <class_module.h>
#include <class_module.h>
#include <polygon_test_point_inside.h>




int D_PAD::m_PadSketchModePenSize = 0;      // Pen size used to draw pads in sketch mode
int D_PAD::m_PadSketchModePenSize = 0;      // Pen size used to draw pads in sketch mode
+1 −2
Original line number Original line Diff line number Diff line
@@ -47,6 +47,7 @@
#include <pcbnew.h>
#include <pcbnew.h>
#include <zones.h>
#include <zones.h>
#include <math_for_graphics.h>
#include <math_for_graphics.h>
#include <polygon_test_point_inside.h>




ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
@@ -65,7 +66,6 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
    SetDoNotAllowTracks( true );                // has meaning only if m_isKeepout == true
    SetDoNotAllowTracks( true );                // has meaning only if m_isKeepout == true
    m_cornerRadius = 0;
    m_cornerRadius = 0;
    utility    = 0;                             // flags used in polygon calculations
    utility    = 0;                             // flags used in polygon calculations
    utility2   = 0;                             // flags used in polygon calculations
    m_Poly     = new CPolyLine();               // Outlines
    m_Poly     = new CPolyLine();               // Outlines
    aBoard->GetZoneSettings().ExportSetting( *this );
    aBoard->GetZoneSettings().ExportSetting( *this );
}
}
@@ -102,7 +102,6 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :




    utility    = aZone.utility;
    utility    = aZone.utility;
    utility2   = aZone.utility;
}
}




+1 −1
Original line number Original line Diff line number Diff line
@@ -573,7 +573,7 @@ public:


    // thickness of the copper bridge in thermal reliefs
    // thickness of the copper bridge in thermal reliefs
    int                   m_ThermalReliefCopperBridge;
    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
    // true when a zone was filled, false after deleting the filled areas
    bool                  m_IsFilled;
    bool                  m_IsFilled;
+1 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@
#include <class_zone.h>
#include <class_zone.h>
#include <class_marker_pcb.h>
#include <class_marker_pcb.h>
#include <math_for_graphics.h>
#include <math_for_graphics.h>
#include <polygon_test_point_inside.h>




/* compare 2 trapezoids (can be rectangle) and return true if distance > aDist
/* compare 2 trapezoids (can be rectangle) and return true if distance > aDist
Loading