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

All: use CPOLYGONS_LIST, a typedef of std::vector<CPolyPt> to handle a Corners Polygons List.

This is a starting point of some code enhancements relative to polygons in Pcbew and 3D viewer.
parent ea990230
...@@ -30,15 +30,8 @@ ...@@ -30,15 +30,8 @@
#ifndef _3D_CANVAS_H_ #ifndef _3D_CANVAS_H_
#define _3D_CANVAS_H_ #define _3D_CANVAS_H_
#include <wxBasePcbFrame.h> // for m_auimanager member.
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <PolyLine.h> // for CPolyPt
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
#include <wxBasePcbFrame.h> // for m_auimanager member.
#ifdef __WXMAC__ #ifdef __WXMAC__
# ifdef __DARWIN__ # ifdef __DARWIN__
...@@ -53,10 +46,6 @@ ...@@ -53,10 +46,6 @@
#include <3d_struct.h> #include <3d_struct.h>
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
class TRACK;
class TEXTE_PCB;
class DRAWSEGMENT;
class ZONE_CONTAINER;
class EDA_3D_FRAME; class EDA_3D_FRAME;
class S3D_VERTEX; class S3D_VERTEX;
class SEGVIA; class SEGVIA;
......
This diff is collapsed.
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* The top side is located at aZpos + aThickness / 2 * The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2 * The bottom side is located at aZpos - aThickness / 2
*/ */
void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysList, void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
int aZpos, int aThickness, double aBiuTo3DUnits ); int aZpos, int aThickness, double aBiuTo3DUnits );
/** draw the solid polygon found in aPolysList /** draw the solid polygon found in aPolysList
...@@ -55,7 +55,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysLi ...@@ -55,7 +55,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysLi
* The top side is located at aZpos + aThickness / 2 * The top side is located at aZpos + aThickness / 2
* The bottom side is located at aZpos - aThickness / 2 * The bottom side is located at aZpos - aThickness / 2
*/ */
void Draw3D_SolidHorizontalPolygonWithHoles( const std::vector<CPolyPt>& aPolysList, void Draw3D_SolidHorizontalPolygonWithHoles( const CPOLYGONS_LIST& aPolysList,
int aZpos, int aThickness, double aBiuTo3DUnits ); int aZpos, int aThickness, double aBiuTo3DUnits );
/** draw a thick segment using 3D primitives, in a XY plane /** draw a thick segment using 3D primitives, in a XY plane
......
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#define __3D_VIEWER_H__ #define __3D_VIEWER_H__
#include <wxBasePcbFrame.h> // for m_auimanager member. #include <wxBasePcbFrame.h> // for m_auimanager member.
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <PolyLine.h> // fot CPolyPt
#if !wxUSE_GLCANVAS #if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h. #error Please set wxUSE_GLCANVAS to 1 in setup.h.
......
...@@ -36,24 +36,24 @@ ...@@ -36,24 +36,24 @@
* We are using a lots polygons in calculations. * We are using a lots polygons in calculations.
* and we are using 2 descriptions, * and we are using 2 descriptions,
* one easy to use with boost::polygon (KI_POLYGON_SET) * one easy to use with boost::polygon (KI_POLYGON_SET)
* one easy to use in zones and in draw functions (std::vector<CPolyPt>) * one easy to use in zones and in draw functions (CPOLYGONS_LIST)
* Copy polygons from a KI_POLYGON_SET set of polygons to * Copy polygons from a KI_POLYGON_SET set of polygons to
* a std::vector<CPolyPt> polygon list * a CPOLYGONS_LIST polygon list
* Therefore we need conversion functions between these 2 descriptions * Therefore we need conversion functions between these 2 descriptions
*/ */
void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList, void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
std::vector<CPolyPt>& aPolysList ) CPOLYGONS_LIST& aPolysList )
{ {
for( unsigned ii = 0; ii < aKiPolyList.size(); ii++ ) for( unsigned ii = 0; ii < aKiPolyList.size(); ii++ )
{ {
KI_POLYGON& poly = aKiPolyList[ii]; KI_POLYGON& poly = aKiPolyList[ii];
CPolyPt corner( 0, 0, false ); CPolyPt corner( 0, 0, false );
for( unsigned jj = 0; jj < poly.size(); jj++ ) for( unsigned jj = 0; jj < poly.size(); jj++ )
{ {
KI_POLY_POINT point = *(poly.begin() + jj); KI_POLY_POINT point = *(poly.begin() + jj);
corner.x = point.x(); corner.x = point.x();
corner.y = point.y(); corner.y = point.y();
corner.end_contour = false; corner.end_contour = false;
aPolysList.push_back( corner ); aPolysList.push_back( corner );
} }
...@@ -64,21 +64,23 @@ void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList, ...@@ -64,21 +64,23 @@ void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
} }
} }
/** /**
* Helper function AddPolygonCornersToKiPolygonList * Helper function AddPolygonCornersToKiPolygonList
* This function adds a KI_POLYGON_SET description to a * This function adds a KI_POLYGON_SET description to a
* std::vector<CPolyPt> description * CPOLYGONS_LIST description
* @param aCornersBuffer = source (set of polygons using CPolyPt corners descr) * @param aCornersBuffer = source (set of polygons using CPolyPt corners descr)
* @param aPolysList = destination (set of polygons) * @param aPolysList = destination (set of polygons)
*/ */
void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
KI_POLYGON_SET& aKiPolyList ) KI_POLYGON_SET& aKiPolyList )
{ {
std::vector<KI_POLY_POINT> cornerslist; std::vector<KI_POLY_POINT> cornerslist;
unsigned corners_count = aCornersBuffer.size(); unsigned corners_count = aCornersBuffer.size();
// Count the number of polygons in aCornersBuffer // Count the number of polygons in aCornersBuffer
int polycount = 0; int polycount = 0;
for( unsigned ii = 0; ii < corners_count; ii++ ) for( unsigned ii = 0; ii < corners_count; ii++ )
{ {
if( aCornersBuffer[ii].end_contour ) if( aCornersBuffer[ii].end_contour )
...@@ -89,10 +91,11 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, ...@@ -89,10 +91,11 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
for( unsigned icnt = 0; icnt < corners_count; ) for( unsigned icnt = 0; icnt < corners_count; )
{ {
KI_POLYGON poly; KI_POLYGON poly;
cornerslist.clear(); cornerslist.clear();
unsigned ii; unsigned ii;
for( ii = icnt; ii < aCornersBuffer.size(); ii++ ) for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
{ {
cornerslist.push_back( KI_POLY_POINT( aCornersBuffer[ii].x, aCornersBuffer[ii].y ) ); cornerslist.push_back( KI_POLY_POINT( aCornersBuffer[ii].x, aCornersBuffer[ii].y ) );
...@@ -118,19 +121,19 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, ...@@ -118,19 +121,19 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
* Note: the polygon is inside the circle, so if you want to have the polygon * Note: the polygon is inside the circle, so if you want to have the polygon
* outside the circle, you should give aRadius calculated with a corrrection factor * outside the circle, you should give aRadius calculated with a corrrection factor
*/ */
void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformCircleToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCenter, int aRadius, wxPoint aCenter, int aRadius,
int aCircleToSegmentsCount ) int aCircleToSegmentsCount )
{ {
wxPoint corner_position; wxPoint corner_position;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
int halfstep = 1800 / aCircleToSegmentsCount; // the starting value for rot angles int halfstep = 1800 / aCircleToSegmentsCount; // the starting value for rot angles
for( int ii = 0; ii < aCircleToSegmentsCount; ii++ ) for( int ii = 0; ii < aCircleToSegmentsCount; ii++ )
{ {
corner_position.x = aRadius; corner_position.x = aRadius;
corner_position.y = 0; corner_position.y = 0;
int angle = (ii * delta) + halfstep; int angle = (ii * delta) + halfstep;
RotatePoint( &corner_position.x, &corner_position.y, angle ); RotatePoint( &corner_position.x, &corner_position.y, angle );
corner_position += aCenter; corner_position += aCenter;
CPolyPt polypoint( corner_position.x, corner_position.y ); CPolyPt polypoint( corner_position.x, corner_position.y );
...@@ -153,28 +156,28 @@ void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -153,28 +156,28 @@ void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* Note: the polygon is inside the arc ends, so if you want to have the polygon * Note: the polygon is inside the arc ends, so if you want to have the polygon
* outside the circle, you should give aStart and aEnd calculated with a correction factor * outside the circle, you should give aStart and aEnd calculated with a correction factor
*/ */
void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aStart, wxPoint aEnd, wxPoint aStart, wxPoint aEnd,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
int aWidth ) int aWidth )
{ {
int radius = aWidth / 2; int radius = aWidth / 2;
wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0) wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0)
wxPoint startp = aStart; wxPoint startp = aStart;
wxPoint corner; wxPoint corner;
CPolyPt polypoint; CPolyPt polypoint;
// normalize the position in order to have endp.x >= 0; // normalize the position in order to have endp.x >= 0;
if( endp.x < 0 ) if( endp.x < 0 )
{ {
endp = aStart - aEnd; endp = aStart - aEnd;
startp = aEnd; startp = aEnd;
} }
int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees
int seg_len = KiROUND( EuclideanNorm( endp ) ); int seg_len = KiROUND( EuclideanNorm( endp ) );
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
// Compute the outlines of the segment, and creates a polygon // Compute the outlines of the segment, and creates a polygon
// add right rounded end: // add right rounded end:
...@@ -233,7 +236,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -233,7 +236,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aWidth = width (thickness) of the line * @param aWidth = width (thickness) of the line
*/ */
void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, wxPoint aStart, int aArcAngle, wxPoint aCentre, wxPoint aStart, int aArcAngle,
int aCircleToSegmentsCount, int aWidth ) int aCircleToSegmentsCount, int aWidth )
{ {
...@@ -254,8 +257,8 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -254,8 +257,8 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
} }
// Compute the ends of segments and creates poly // Compute the ends of segments and creates poly
wxPoint curr_end = arc_start; wxPoint curr_end = arc_start;
wxPoint curr_start = arc_start; wxPoint curr_start = arc_start;
for( int ii = delta; ii < aArcAngle; ii += delta ) for( int ii = delta; ii < aArcAngle; ii += delta )
{ {
...@@ -272,6 +275,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -272,6 +275,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
aCircleToSegmentsCount, aWidth ); aCircleToSegmentsCount, aWidth );
} }
/** /**
* Function TransformRingToPolygon * Function TransformRingToPolygon
* Creates a polygon from a ring * Creates a polygon from a ring
...@@ -282,50 +286,50 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -282,50 +286,50 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aWidth = width (thickness) of the ring * @param aWidth = width (thickness) of the ring
*/ */
void TransformRingToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, int aRadius, wxPoint aCentre, int aRadius,
int aCircleToSegmentsCount, int aWidth ) int aCircleToSegmentsCount, int aWidth )
{ {
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
// Compute the corners posituions and creates poly // Compute the corners posituions and creates poly
wxPoint curr_point; wxPoint curr_point;
int inner_radius = aRadius - ( aWidth / 2 ); int inner_radius = aRadius - ( aWidth / 2 );
int outer_radius = inner_radius + aWidth; int outer_radius = inner_radius + aWidth;
CPolyPt polycorner; CPolyPt polycorner;
// Draw the inner circle of the ring // Draw the inner circle of the ring
for( int ii = 0; ii < 3600; ii += delta ) for( int ii = 0; ii < 3600; ii += delta )
{ {
curr_point.x = inner_radius; curr_point.x = inner_radius;
curr_point.y = 0; curr_point.y = 0;
RotatePoint( &curr_point, ii ); RotatePoint( &curr_point, ii );
curr_point += aCentre; curr_point += aCentre;
polycorner.x = curr_point.x; polycorner.x = curr_point.x;
polycorner.y = curr_point.y; polycorner.y = curr_point.y;
aCornerBuffer.push_back( polycorner ); aCornerBuffer.push_back( polycorner );
} }
// Draw the last point of inner circle // Draw the last point of inner circle
polycorner.x = aCentre.x + inner_radius; polycorner.x = aCentre.x + inner_radius;
polycorner.y = aCentre.y; polycorner.y = aCentre.y;
aCornerBuffer.push_back( polycorner ); aCornerBuffer.push_back( polycorner );
// Draw the outer circle of the ring // Draw the outer circle of the ring
for( int ii = 0; ii < 3600; ii += delta ) for( int ii = 0; ii < 3600; ii += delta )
{ {
curr_point.x = outer_radius; curr_point.x = outer_radius;
curr_point.y = 0; curr_point.y = 0;
RotatePoint( &curr_point, -ii ); RotatePoint( &curr_point, -ii );
curr_point += aCentre; curr_point += aCentre;
polycorner.x = curr_point.x; polycorner.x = curr_point.x;
polycorner.y = curr_point.y; polycorner.y = curr_point.y;
aCornerBuffer.push_back( polycorner ); aCornerBuffer.push_back( polycorner );
} }
// Draw the last point of outer circle // Draw the last point of outer circle
polycorner.x = aCentre.x + outer_radius; polycorner.x = aCentre.x + outer_radius;
polycorner.y = aCentre.y; polycorner.y = aCentre.y;
aCornerBuffer.push_back( polycorner ); aCornerBuffer.push_back( polycorner );
// Close the polygon // Close the polygon
......
...@@ -40,26 +40,26 @@ ...@@ -40,26 +40,26 @@
* We are using a lots polygons in calculations. * We are using a lots polygons in calculations.
* and we are using 2 descriptions, * and we are using 2 descriptions,
* one easy to use with boost::polygon (KI_POLYGON_SET) * one easy to use with boost::polygon (KI_POLYGON_SET)
* one easy to use in zones and in draw functions (std::vector<CPolyPt>) * one easy to use in zones and in draw functions (CPOLYGONS_LIST)
* Copy polygons from a KI_POLYGON_SET set of polygons to * Copy polygons from a KI_POLYGON_SET set of polygons to
* a std::vector<CPolyPt> polygon list * a CPOLYGONS_LIST corner polygon list
* Therefore we need conversion functions between these 2 descriptions * Therefore we need conversion functions between these 2 descriptions
* This function converts a KI_POLYGON_SET description to a * This function converts a KI_POLYGON_SET description to a
* std::vector<CPolyPt> description * CPOLYGONS_LIST description
* @param aKiPolyList = source (set of polygons) * @param aKiPolyList = source (set of polygons)
* @param aPolysList = destination (set of polygons using CPolyPt corners descr) * @param aPolysList = destination (set of polygons using CPolyPt corners descr)
*/ */
void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList, void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
std::vector<CPolyPt>& aPolysList ); CPOLYGONS_LIST& aPolysList );
/** /**
* Helper function AddPolygonCornersToKiPolygonList * Helper function AddPolygonCornersToKiPolygonList
* This function adds a KI_POLYGON_SET description to a * This function adds a KI_POLYGON_SET description to a
* std::vector<CPolyPt> description * CPOLYGONS_LIST description
* @param aCornersBuffer = source (set of polygons using CPolyPt corners descr) * @param aCornersBuffer = source (set of polygons using CPolyPt corners descr)
* @param aPolysList = destination (set of polygons) * @param aPolysList = destination (set of polygons)
*/ */
void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
KI_POLYGON_SET& aKiPolyList ); KI_POLYGON_SET& aKiPolyList );
/** /**
...@@ -72,7 +72,7 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, ...@@ -72,7 +72,7 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
* Note: the polygon is inside the circle, so if you want to have the polygon * Note: the polygon is inside the circle, so if you want to have the polygon
* outside the circle, you should give aRadius calculated with a correction factor * outside the circle, you should give aRadius calculated with a correction factor
*/ */
void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformCircleToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCenter, int aRadius, wxPoint aCenter, int aRadius,
int aCircleToSegmentsCount ); int aCircleToSegmentsCount );
...@@ -88,7 +88,7 @@ void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -88,7 +88,7 @@ void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* Note: the polygon is inside the arc ends, so if you want to have the polygon * Note: the polygon is inside the arc ends, so if you want to have the polygon
* outside the circle, you should give aStart and aEnd calculated with a correction factor * outside the circle, you should give aStart and aEnd calculated with a correction factor
*/ */
void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aStart, wxPoint aEnd, wxPoint aStart, wxPoint aEnd,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
int aWidth ); int aWidth );
...@@ -105,7 +105,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -105,7 +105,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aWidth = width (thickness) of the line * @param aWidth = width (thickness) of the line
*/ */
void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, wxPoint aStart, int aArcAngle, wxPoint aCentre, wxPoint aStart, int aArcAngle,
int aCircleToSegmentsCount, int aWidth ); int aCircleToSegmentsCount, int aWidth );
...@@ -119,7 +119,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -119,7 +119,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aWidth = width (thickness) of the ring * @param aWidth = width (thickness) of the ring
*/ */
void TransformRingToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, int aRadius, wxPoint aCentre, int aRadius,
int aCircleToSegmentsCount, int aWidth ); int aCircleToSegmentsCount, int aWidth );
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) double aCorrectionFactor )
...@@ -86,7 +86,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, ...@@ -86,7 +86,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
*/ */
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer, LAYER_NUM aLayer,
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) double aCorrectionFactor )
...@@ -166,12 +166,12 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( ...@@ -166,12 +166,12 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
* keep arc radius when approximated by segments * keep arc radius when approximated by segments
*/ */
void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet( void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) double aCorrectionFactor )
{ {
unsigned cornerscount = GetFilledPolysList().size(); unsigned cornerscount = GetFilledPolysList().size();
std::vector <CPolyPt> polygonslist; CPOLYGONS_LIST polygonslist;
if( cornerscount == 0 ) if( cornerscount == 0 )
return; return;
...@@ -217,7 +217,7 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet( ...@@ -217,7 +217,7 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue = the clearance around the pad
*/ */
void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon( void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue ) const int aClearanceValue ) const
{ {
if( GetText().Length() == 0 ) if( GetText().Length() == 0 )
...@@ -251,7 +251,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon( ...@@ -251,7 +251,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
* Convert the text shape to a set of polygons (one by segment) * Convert the text shape to a set of polygons (one by segment)
* Used in filling zones calculations and 3D view * Used in filling zones calculations and 3D view
* Circles and arcs are approximated by segments * Circles and arcs are approximated by segments
* aCornerBuffer = vector <CPolyPt> to store the polygon corners * aCornerBuffer = CPOLYGONS_LIST to store the polygon corners
* aClearanceValue = the clearance around the text * aClearanceValue = the clearance around the text
* aCircleToSegmentsCount = the number of segments to approximate a circle * aCircleToSegmentsCount = the number of segments to approximate a circle
* aCorrectionFactor = the correction to apply to circles radius to keep * aCorrectionFactor = the correction to apply to circles radius to keep
...@@ -263,7 +263,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon( ...@@ -263,7 +263,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
// so we cannot send them as arguments. // so we cannot send them as arguments.
int s_textWidth; int s_textWidth;
int s_textCircle2SegmentCount; int s_textCircle2SegmentCount;
std::vector <CPolyPt>* s_cornerBuffer; CPOLYGONS_LIST* s_cornerBuffer;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape: // This is a call back function, used by DrawGraphicText to draw the 3D text shape:
static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
...@@ -274,7 +274,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) ...@@ -274,7 +274,7 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
} }
void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const double aCorrectionFactor ) const
...@@ -334,7 +334,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( ...@@ -334,7 +334,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
* clearance when the circle is approxiamted by segment bigger or equal * clearance when the circle is approxiamted by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const double aCorrectionFactor ) const
...@@ -375,7 +375,7 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& a ...@@ -375,7 +375,7 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& a
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCornerBuffer, void TRACK:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const double aCorrectionFactor ) const
...@@ -404,17 +404,17 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor ...@@ -404,17 +404,17 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
* Convert the pad shape to a closed polygon * Convert the pad shape to a closed polygon
* Used in filling zones calculations and 3D view generation * Used in filling zones calculations and 3D view generation
* Circles and arcs are approximated by segments * Circles and arcs are approximated by segments
* aCornerBuffer = a vector < CPolyPt> to store the polygon corners * aCornerBuffer = a CPOLYGONS_LIST to store the polygon corners
* aClearanceValue = the clearance around the pad * aClearanceValue = the clearance around the pad
* aCircleToSegmentsCount = the number of segments to approximate a circle * aCircleToSegmentsCount = the number of segments to approximate a circle
* aCorrectionFactor = the correction to apply to circles radius to keep * aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCornerBuffer, void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const double aCorrectionFactor ) const
{ {
wxPoint corner_position; wxPoint corner_position;
int angle; int angle;
...@@ -547,7 +547,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor ...@@ -547,7 +547,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
* Note: for Round and oval pads this function is equivalent to * Note: for Round and oval pads this function is equivalent to
* TransformShapeWithClearanceToPolygon, but not for other shapes * TransformShapeWithClearanceToPolygon, but not for other shapes
*/ */
void D_PAD::BuildPadShapePolygon( std::vector <CPolyPt>& aCornerBuffer, void D_PAD::BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
wxSize aInflateValue, int aSegmentsPerCircle, wxSize aInflateValue, int aSegmentsPerCircle,
double aCorrectionFactor ) const double aCorrectionFactor ) const
{ {
...@@ -584,7 +584,7 @@ void D_PAD::BuildPadShapePolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -584,7 +584,7 @@ void D_PAD::BuildPadShapePolygon( std::vector <CPolyPt>& aCornerBuffer,
* depending on shape pad hole and orientation * depending on shape pad hole and orientation
* return false if the pad has no hole, true otherwise * return false if the pad has no hole, true otherwise
*/ */
bool D_PAD::BuildPadDrillShapePolygon( std::vector <CPolyPt>& aCornerBuffer, bool D_PAD::BuildPadDrillShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aSegmentsPerCircle ) const int aInflateValue, int aSegmentsPerCircle ) const
{ {
wxSize drillsize = GetDrillSize(); wxSize drillsize = GetDrillSize();
...@@ -658,14 +658,14 @@ bool D_PAD::BuildPadDrillShapePolygon( std::vector <CPolyPt>& aCornerBuffer, ...@@ -658,14 +658,14 @@ bool D_PAD::BuildPadDrillShapePolygon( std::vector <CPolyPt>& aCornerBuffer,
* and are used in microwave applications and they *DO NOT* have a thermal relief that * and are used in microwave applications and they *DO NOT* have a thermal relief that
* change the shape by creating stubs and destroy their properties. * change the shape by creating stubs and destroy their properties.
*/ */
void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
D_PAD& aPad, D_PAD& aPad,
int aThermalGap, int aThermalGap,
int aCopperThickness, int aCopperThickness,
int aMinThicknessValue, int aMinThicknessValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor, double aCorrectionFactor,
int aThermalRot ) int aThermalRot )
{ {
wxPoint corner, corner_end; wxPoint corner, corner_end;
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
......
...@@ -211,10 +211,10 @@ public: ...@@ -211,10 +211,10 @@ public:
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const; double aCorrectionFactor ) const;
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <class_board_item.h> #include <class_board_item.h>
#include <class_text_mod.h> #include <class_text_mod.h>
#include <PolyLine.h>
#include "zones.h" #include "zones.h"
class LINE_READER; class LINE_READER;
...@@ -46,7 +47,6 @@ class EDA_DRAW_PANEL; ...@@ -46,7 +47,6 @@ class EDA_DRAW_PANEL;
class D_PAD; class D_PAD;
class BOARD; class BOARD;
class MSG_PANEL_ITEM; class MSG_PANEL_ITEM;
class CPolyPt;
/** /**
...@@ -268,10 +268,10 @@ public: ...@@ -268,10 +268,10 @@ public:
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
/** /**
* function TransformGraphicShapesWithClearanceToPolygonSet * function TransformGraphicShapesWithClearanceToPolygonSet
...@@ -292,10 +292,10 @@ public: ...@@ -292,10 +292,10 @@ public:
*/ */
void TransformGraphicShapesWithClearanceToPolygonSet( void TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer, LAYER_NUM aLayer,
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
/** /**
......
...@@ -186,16 +186,16 @@ public: ...@@ -186,16 +186,16 @@ public:
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; } void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; } PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; } void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; } LAYER_MSK GetLayerMask() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute ); void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; } PAD_ATTR_T GetAttribute() const { return m_Attribute; }
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; } void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
int GetPadToDieLength() const { return m_LengthPadToDie; } int GetPadToDieLength() const { return m_LengthPadToDie; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; } int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; } void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; } int GetLocalClearance() const { return m_LocalClearance; }
...@@ -220,7 +220,7 @@ public: ...@@ -220,7 +220,7 @@ public:
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const;; double aCorrectionFactor ) const;;
...@@ -317,7 +317,7 @@ public: ...@@ -317,7 +317,7 @@ public:
* @param aCorrectionFactor = the correction to apply to circles radius to keep * @param aCorrectionFactor = the correction to apply to circles radius to keep
* the pad size when the circle is approximated by segments * the pad size when the circle is approximated by segments
*/ */
void BuildPadShapePolygon( std::vector <CPolyPt>& aCornerBuffer, void BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
wxSize aInflateValue, int aSegmentsPerCircle, wxSize aInflateValue, int aSegmentsPerCircle,
double aCorrectionFactor ) const; double aCorrectionFactor ) const;
...@@ -332,7 +332,7 @@ public: ...@@ -332,7 +332,7 @@ public:
* (used for round and oblong shapes only(16 to 32 is a good value) * (used for round and oblong shapes only(16 to 32 is a good value)
* @return false if the pad has no hole, true otherwise * @return false if the pad has no hole, true otherwise
*/ */
bool BuildPadDrillShapePolygon( std::vector <CPolyPt>& aCornerBuffer, bool BuildPadDrillShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aSegmentsPerCircle ) const; int aInflateValue, int aSegmentsPerCircle ) const;
/** /**
......
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformBoundingBoxWithClearanceToPolygon( void TransformBoundingBoxWithClearanceToPolygon(
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue ) const; int aClearanceValue ) const;
/** /**
...@@ -108,10 +108,10 @@ public: ...@@ -108,10 +108,10 @@ public:
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygonSet( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygonSet( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const; double aCorrectionFactor ) const;
wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
......
...@@ -175,10 +175,10 @@ public: ...@@ -175,10 +175,10 @@ public:
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const; double aCorrectionFactor ) const;
/** /**
* Function SetDrill * Function SetDrill
* sets the drill value for vias. * sets the drill value for vias.
......
...@@ -274,7 +274,7 @@ public: ...@@ -274,7 +274,7 @@ public:
* @param aCorrectionFactor = the correction to apply to arcs radius to roughly * @param aCorrectionFactor = the correction to apply to arcs radius to roughly
* keep arc radius when approximated by segments * keep arc radius when approximated by segments
*/ */
void TransformSolidAreasShapesToPolygonSet( std::vector <CPolyPt>& aCornerBuffer, void TransformSolidAreasShapesToPolygonSet( CPOLYGONS_LIST& aCornerBuffer,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
/** /**
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
* This function calls AddClearanceAreasPolygonsToPolysList() * This function calls AddClearanceAreasPolygonsToPolysList()
* to add holes for pads and tracks and other items not in net. * to add holes for pads and tracks and other items not in net.
*/ */
bool BuildFilledSolidAreasPolygons( BOARD* aPcb, std::vector <CPolyPt>* aCornerBuffer = NULL ); bool BuildFilledSolidAreasPolygons( BOARD* aPcb, CPOLYGONS_LIST* aCornerBuffer = NULL );
/** /**
* Function CopyPolygonsFromKiPolygonListToFilledPolysList * Function CopyPolygonsFromKiPolygonListToFilledPolysList
...@@ -339,7 +339,7 @@ public: ...@@ -339,7 +339,7 @@ public:
* @param aAddClearance = true to add a clearance area to the polygon * @param aAddClearance = true to add a clearance area to the polygon
* false to create the outline polygon. * false to create the outline polygon.
*/ */
void TransformOutlinesShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
bool aAddClearance ); bool aAddClearance );
/** /**
...@@ -506,7 +506,7 @@ public: ...@@ -506,7 +506,7 @@ public:
* returns a reference to the list of filled polygons. * returns a reference to the list of filled polygons.
* @return Reference to the list of filled polygons. * @return Reference to the list of filled polygons.
*/ */
const std::vector<CPolyPt>& GetFilledPolysList() const const CPOLYGONS_LIST& GetFilledPolysList() const
{ {
return m_FilledPolysList; return m_FilledPolysList;
} }
...@@ -515,7 +515,7 @@ public: ...@@ -515,7 +515,7 @@ public:
* Function AddFilledPolysList * Function AddFilledPolysList
* sets the list of filled polygons. * sets the list of filled polygons.
*/ */
void AddFilledPolysList( std::vector<CPolyPt>& aPolysList ) void AddFilledPolysList( CPOLYGONS_LIST& aPolysList )
{ {
m_FilledPolysList = aPolysList; m_FilledPolysList = aPolysList;
} }
...@@ -549,7 +549,7 @@ public: ...@@ -549,7 +549,7 @@ public:
void AddPolygon( std::vector< wxPoint >& aPolygon ); void AddPolygon( std::vector< wxPoint >& aPolygon );
void AddFilledPolygon( std::vector< CPolyPt >& aPolygon ) void AddFilledPolygon( CPOLYGONS_LIST& aPolygon )
{ {
m_FilledPolysList.insert( m_FilledPolysList.end(), aPolygon.begin(), aPolygon.end() ); m_FilledPolysList.insert( m_FilledPolysList.end(), aPolygon.begin(), aPolygon.end() );
} }
...@@ -652,7 +652,7 @@ private: ...@@ -652,7 +652,7 @@ private:
* connecting "holes" with external main outline. In complex cases an outline * connecting "holes" with external main outline. In complex cases an outline
* described by m_Poly can have many filled areas * described by m_Poly can have many filled areas
*/ */
std::vector <CPolyPt> m_FilledPolysList; CPOLYGONS_LIST m_FilledPolysList;
}; };
......
...@@ -1395,7 +1395,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1395,7 +1395,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
const std::vector< CPolyPt >& cv = aZone->Outline()->m_CornersList; const CPOLYGONS_LIST& cv = aZone->Outline()->m_CornersList;
int newLine = 0; int newLine = 0;
if( cv.size() ) if( cv.size() )
...@@ -1403,7 +1403,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1403,7 +1403,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(polygon\n"); m_out->Print( aNestLevel+1, "(polygon\n");
m_out->Print( aNestLevel+2, "(pts\n" ); m_out->Print( aNestLevel+2, "(pts\n" );
for( std::vector< CPolyPt >::const_iterator it = cv.begin(); it != cv.end(); ++it ) for( CPOLYGONS_LIST::const_iterator it = cv.begin(); it != cv.end(); ++it )
{ {
if( newLine == 0 ) if( newLine == 0 )
m_out->Print( aNestLevel+3, "(xy %s %s)", m_out->Print( aNestLevel+3, "(xy %s %s)",
...@@ -1443,7 +1443,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1443,7 +1443,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
} }
// Save the PolysList // Save the PolysList
const std::vector< CPolyPt >& fv = aZone->GetFilledPolysList(); const CPOLYGONS_LIST& fv = aZone->GetFilledPolysList();
newLine = 0; newLine = 0;
if( fv.size() ) if( fv.size() )
...@@ -1451,7 +1451,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1451,7 +1451,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(filled_polygon\n" ); m_out->Print( aNestLevel+1, "(filled_polygon\n" );
m_out->Print( aNestLevel+2, "(pts\n" ); m_out->Print( aNestLevel+2, "(pts\n" );
for( std::vector< CPolyPt >::const_iterator it = fv.begin(); it != fv.end(); ++it ) for( CPOLYGONS_LIST::const_iterator it = fv.begin(); it != fv.end(); ++it )
{ {
if( newLine == 0 ) if( newLine == 0 )
m_out->Print( aNestLevel+3, "(xy %s %s)", m_out->Print( aNestLevel+3, "(xy %s %s)",
......
...@@ -2346,7 +2346,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2346,7 +2346,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
else if( TESTLINE( "$POLYSCORNERS" ) ) else if( TESTLINE( "$POLYSCORNERS" ) )
{ {
// Read the PolysList (polygons used for fill areas in the zone) // Read the PolysList (polygons used for fill areas in the zone)
std::vector<CPolyPt> polysList; CPOLYGONS_LIST polysList;
while( ( line = READLINE( m_reader ) ) != NULL ) while( ( line = READLINE( m_reader ) ) != NULL )
{ {
...@@ -3690,12 +3690,10 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3690,12 +3690,10 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
me->GetCornerSmoothingType(), me->GetCornerSmoothingType(),
fmtBIU( me->GetCornerRadius() ).c_str() ); fmtBIU( me->GetCornerRadius() ).c_str() );
typedef std::vector< CPolyPt > CPOLY_PTS;
// Save the corner list // Save the corner list
const CPOLY_PTS& cv = me->Outline()->m_CornersList; const CPOLYGONS_LIST& cv = me->Outline()->m_CornersList;
for( CPOLY_PTS::const_iterator it = cv.begin(); it != cv.end(); ++it ) for( CPOLYGONS_LIST::const_iterator it = cv.begin(); it != cv.end(); ++it )
{ {
fprintf( m_fp, "ZCorner %s %d\n", fprintf( m_fp, "ZCorner %s %d\n",
fmtBIUPair( it->x, it->y ).c_str(), fmtBIUPair( it->x, it->y ).c_str(),
...@@ -3703,12 +3701,12 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3703,12 +3701,12 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
} }
// Save the PolysList // Save the PolysList
const CPOLY_PTS& fv = me->GetFilledPolysList(); const CPOLYGONS_LIST& fv = me->GetFilledPolysList();
if( fv.size() ) if( fv.size() )
{ {
fprintf( m_fp, "$POLYSCORNERS\n" ); fprintf( m_fp, "$POLYSCORNERS\n" );
for( CPOLY_PTS::const_iterator it = fv.begin(); it != fv.end(); ++it ) for( CPOLYGONS_LIST::const_iterator it = fv.begin(); it != fv.end(); ++it )
{ {
fprintf( m_fp, "%s %d %d\n", fprintf( m_fp, "%s %d %d\n",
fmtBIUPair( it->x, it->y ).c_str(), fmtBIUPair( it->x, it->y ).c_str(),
......
...@@ -2371,7 +2371,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2371,7 +2371,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
T token; T token;
// bigger scope since each filled_polygon is concatenated in here // bigger scope since each filled_polygon is concatenated in here
std::vector< CPolyPt > pts; CPOLYGONS_LIST pts;
auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) );
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include <pcbplot.h> #include <pcbplot.h>
// Imported function // Imported function
extern void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer, extern void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
KI_POLYGON_SET& aKiPolyList ); KI_POLYGON_SET& aKiPolyList );
// Local // Local
/* Plot a solder mask layer. /* Plot a solder mask layer.
...@@ -506,8 +506,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -506,8 +506,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
// This extra margin is used to merge too close shapes // This extra margin is used to merge too close shapes
// (distance < aMinThickness), and will be removed when creating // (distance < aMinThickness), and will be removed when creating
// the actual shapes // the actual shapes
std::vector <CPolyPt> bufferPolys; // Contains shapes to plot CPOLYGONS_LIST bufferPolys; // Contains shapes to plot
std::vector <CPolyPt> initialPolys; // Contains exact shapes to plot CPOLYGONS_LIST initialPolys; // Contains exact shapes to plot
/* calculates the coeff to compensate radius reduction of holes clearance /* calculates the coeff to compensate radius reduction of holes clearance
* due to the segment approx ( 1 /cos( PI/circleToSegmentsCount ) * due to the segment approx ( 1 /cos( PI/circleToSegmentsCount )
......
...@@ -506,7 +506,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) ...@@ -506,7 +506,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
*/ */
void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
{ {
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList(); const CPOLYGONS_LIST& polysList = aZone->GetFilledPolysList();
unsigned imax = polysList.size(); unsigned imax = polysList.size();
if( imax == 0 ) // Nothing to draw if( imax == 0 ) // Nothing to draw
...@@ -526,10 +526,10 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) ...@@ -526,10 +526,10 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
*/ */
for( unsigned ic = 0; ic < imax; ic++ ) for( unsigned ic = 0; ic < imax; ic++ )
{ {
CPolyPt* corner = &polysList[ic]; const CPolyPt& corner = polysList[ic];
cornerList.push_back( wxPoint( corner->x, corner->y) ); cornerList.push_back( wxPoint( corner.x, corner.y) );
if( corner->end_contour ) // Plot the current filled area outline if( corner.end_contour ) // Plot the current filled area outline
{ {
// First, close the outline // First, close the outline
if( cornerList[0] != cornerList[cornerList.size() - 1] ) if( cornerList[0] != cornerList[cornerList.size() - 1] )
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
*/ */
bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb,
std::vector <CPolyPt>* aCornerBuffer ) CPOLYGONS_LIST* aCornerBuffer )
{ {
if( aCornerBuffer == NULL ) if( aCornerBuffer == NULL )
m_FilledPolysList.clear(); m_FilledPolysList.clear();
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffer, extern void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
BOARD* aPcb, ZONE_CONTAINER* aZone, BOARD* aPcb, ZONE_CONTAINER* aZone,
double aArcCorrection, double aArcCorrection,
int aRoundPadThermalRotation); int aRoundPadThermalRotation);
...@@ -72,7 +72,7 @@ extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCorn ...@@ -72,7 +72,7 @@ extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCorn
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb, extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
ZONE_CONTAINER* aZone_container ); ZONE_CONTAINER* aZone_container );
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer, extern void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
D_PAD& aPad, D_PAD& aPad,
int aThermalGap, int aThermalGap,
int aCopperThickness, int aCopperThickness,
...@@ -187,7 +187,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -187,7 +187,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
int item_clearance; int item_clearance;
// static to avoid unnecessary memory allocation when filling many zones. // static to avoid unnecessary memory allocation when filling many zones.
static std::vector <CPolyPt> cornerBufferPolysToSubstract; static CPOLYGONS_LIST cornerBufferPolysToSubstract;
cornerBufferPolysToSubstract.clear(); cornerBufferPolysToSubstract.clear();
/* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers /* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers
......
...@@ -48,11 +48,11 @@ ...@@ -48,11 +48,11 @@
* false to create the outline polygon. * false to create the outline polygon.
*/ */
void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
std::vector <CPolyPt>& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, bool aAddClearance ) int aClearanceValue, bool aAddClearance )
{ {
// Creates the zone outlines polygon (with linked holes if any) // Creates the zone outlines polygon (with linked holes if any)
std::vector <CPolyPt> zoneOutines; CPOLYGONS_LIST zoneOutines;
BuildFilledSolidAreasPolygons( NULL, &zoneOutines ); BuildFilledSolidAreasPolygons( NULL, &zoneOutines );
// add clearance to outline // add clearance to outline
...@@ -119,14 +119,14 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( ...@@ -119,14 +119,14 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
* Function BuildUnconnectedThermalStubsPolygonList * Function BuildUnconnectedThermalStubsPolygonList
* Creates a set of polygons corresponding to stubs created by thermal shapes on pads * Creates a set of polygons corresponding to stubs created by thermal shapes on pads
* which are not connected to a zone (dangling bridges) * which are not connected to a zone (dangling bridges)
* @param aCornerBuffer = a std::vector<CPolyPt> where to store polygons * @param aCornerBuffer = a CPOLYGONS_LIST where to store polygons
* @param aPcb = the board. * @param aPcb = the board.
* @param aZone = a pointer to the ZONE_CONTAINER to examine. * @param aZone = a pointer to the ZONE_CONTAINER to examine.
* @param aArcCorrection = a pointer to the ZONE_CONTAINER to examine. * @param aArcCorrection = a pointer to the ZONE_CONTAINER to examine.
* @param aRoundPadThermalRotation = the rotation in 1.0 degree for thermal stubs in round pads * @param aRoundPadThermalRotation = the rotation in 1.0 degree for thermal stubs in round pads
*/ */
void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffer, void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
BOARD* aPcb, BOARD* aPcb,
ZONE_CONTAINER* aZone, ZONE_CONTAINER* aZone,
double aArcCorrection, double aArcCorrection,
......
...@@ -143,7 +143,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) ...@@ -143,7 +143,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
// test if a candidate is inside a filled area of this zone // test if a candidate is inside a filled area of this zone
unsigned indexstart = 0, indexend; unsigned indexstart = 0, indexend;
std::vector<CPolyPt> polysList = curr_zone->GetFilledPolysList(); const CPOLYGONS_LIST& polysList = curr_zone->GetFilledPolysList();
for( indexend = 0; indexend < polysList.size(); indexend++ ) for( indexend = 0; indexend < polysList.size(); indexend++ )
{ {
// end of a filled sub-area found // end of a filled sub-area found
......
...@@ -1204,7 +1204,7 @@ int CPolyLine::Distance( const wxPoint& aPoint ) ...@@ -1204,7 +1204,7 @@ int CPolyLine::Distance( const wxPoint& aPoint )
* @param aPolysList = the list of corners of contours * @param aPolysList = the list of corners of contours
* @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate * @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate
*/ */
void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList, void CopyPolysListToKiPolygonWithHole( const CPOLYGONS_LIST& aPolysList,
KI_POLYGON_WITH_HOLES& aPolygoneWithHole ) KI_POLYGON_WITH_HOLES& aPolygoneWithHole )
{ {
unsigned corners_count = aPolysList.size(); unsigned corners_count = aPolysList.size();
...@@ -1261,8 +1261,8 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList, ...@@ -1261,8 +1261,8 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList,
* @param aPolysListWithHoles = the list of corners of contours (haing holes * @param aPolysListWithHoles = the list of corners of contours (haing holes
* @param aOnePolyList = a polygon with no holes * @param aOnePolyList = a polygon with no holes
*/ */
void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysListWithHoles, void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWithHoles,
std::vector<CPolyPt>& aOnePolyList ) CPOLYGONS_LIST& aOnePolyList )
{ {
unsigned corners_count = aPolysListWithHoles.size(); unsigned corners_count = aPolysListWithHoles.size();
...@@ -1338,9 +1338,7 @@ void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysL ...@@ -1338,9 +1338,7 @@ void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysL
aOnePolyList.push_back( corner ); aOnePolyList.push_back( corner );
} }
corner.end_contour = true; aOnePolyList.back().end_contour = true;
aOnePolyList.pop_back();
aOnePolyList.push_back( corner );
} }
/** /**
......
...@@ -76,6 +76,14 @@ public: ...@@ -76,6 +76,14 @@ public:
{ return (x != cpt2.x) || (y != cpt2.y) || (end_contour != cpt2.end_contour); } { return (x != cpt2.x) || (y != cpt2.y) || (end_contour != cpt2.end_contour); }
}; };
/**
* CPOLYGONS_LIST handle a list of contours.
* Each contour is a polygon, i.e. a list of corners.
* Each corner is a CPolyPt item.
* The last cornet of each contour has its end_contour member = true
*/
typedef std::vector<CPolyPt> CPOLYGONS_LIST;
class CPolyLine class CPolyLine
{ {
...@@ -191,7 +199,7 @@ public: ...@@ -191,7 +199,7 @@ public:
const wxPoint& GetPos( int ic ) const { return m_CornersList[ic]; } const wxPoint& GetPos( int ic ) const { return m_CornersList[ic]; }
int GetEndContour( int ic ); int GetEndContour( int ic );
int GetUtility( int ic ) const { return m_CornersList[ic].m_utility; }; int GetUtility( int ic ) const { return m_CornersList[ic].m_utility; };
void SetUtility( int ic, int utility ) { m_CornersList[ic].m_utility = utility; }; void SetUtility( int ic, int utility ) { m_CornersList[ic].m_utility = utility; };
...@@ -262,7 +270,7 @@ private: ...@@ -262,7 +270,7 @@ private:
int m_utility; // a flag used in some calculations int m_utility; // a flag used in some calculations
public: public:
std::vector <CPolyPt> m_CornersList; // array of points for corners CPOLYGONS_LIST m_CornersList; // array of points for corners
std::vector <CSegment> m_HatchLines; // hatch lines showing the polygon area std::vector <CSegment> m_HatchLines; // hatch lines showing the polygon area
}; };
...@@ -273,8 +281,8 @@ public: ...@@ -273,8 +281,8 @@ public:
* @param aPolysList = the list of corners of contours * @param aPolysList = the list of corners of contours
* @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate * @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate
*/ */
void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList, void CopyPolysListToKiPolygonWithHole( const CPOLYGONS_LIST& aPolysList,
KI_POLYGON_WITH_HOLES& aPolygoneWithHole ); KI_POLYGON_WITH_HOLES& aPolygoneWithHole );
/** /**
...@@ -286,7 +294,7 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList, ...@@ -286,7 +294,7 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList,
* @param aPolysListWithHoles = the list of corners of contours (haing holes * @param aPolysListWithHoles = the list of corners of contours (haing holes
* @param aOnePolyList = a polygon with no holes * @param aOnePolyList = a polygon with no holes
*/ */
void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysListWithHoles, void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWithHoles,
std::vector<CPolyPt>& aOnePolyList ); CPOLYGONS_LIST& aOnePolyList );
#endif // #ifndef POLYLINE_H #endif // #ifndef POLYLINE_H
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
#define OUTSIDE false #define OUTSIDE false
#define INSIDE true #define INSIDE true
bool TestPointInsidePolygon( std::vector <CPolyPt> aPolysList, bool TestPointInsidePolygon( CPOLYGONS_LIST aPolysList,
int aIdxstart, int aIdxstart,
int aIdxend, int aIdxend,
int aRefx, int aRefx,
int aRefy) int aRefy)
/** /**
* Function TestPointInsidePolygon * Function TestPointInsidePolygon
......
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