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.
This commit is contained in:
parent
ea990230ca
commit
b2a76062c7
|
@ -30,15 +30,8 @@
|
|||
#ifndef _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 <wxBasePcbFrame.h> // for m_auimanager member.
|
||||
|
||||
#ifdef __WXMAC__
|
||||
# ifdef __DARWIN__
|
||||
|
@ -53,10 +46,6 @@
|
|||
#include <3d_struct.h>
|
||||
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
class TRACK;
|
||||
class TEXTE_PCB;
|
||||
class DRAWSEGMENT;
|
||||
class ZONE_CONTAINER;
|
||||
class EDA_3D_FRAME;
|
||||
class S3D_VERTEX;
|
||||
class SEGVIA;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/**
|
||||
* @file 3d_draw.cpp
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
|
@ -49,19 +49,19 @@
|
|||
#include <3d_draw_basic_functions.h>
|
||||
|
||||
// Imported function:
|
||||
extern void SetGLColor( EDA_COLOR_T color );
|
||||
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
|
||||
extern void CheckGLError();
|
||||
extern void SetGLColor( EDA_COLOR_T color );
|
||||
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
|
||||
extern void CheckGLError();
|
||||
|
||||
/* returns true if aLayer should be displayed, false otherwise
|
||||
*/
|
||||
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
|
||||
/* returns true if aLayer should be displayed, false otherwise
|
||||
*/
|
||||
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
|
||||
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
|
||||
* used to calculate the Z orientation parameter for glNormal3f
|
||||
*/
|
||||
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
|
||||
* Z orientation is 1.0 for all layers but "back" layers:
|
||||
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
|
||||
* used to calculate the Z orientation parameter for glNormal3f
|
||||
*/
|
||||
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
|
||||
|
||||
/* Helper function BuildPadShapeThickOutlineAsPolygon:
|
||||
|
@ -69,34 +69,35 @@ static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
|
|||
* with a line thickness = aWidth
|
||||
* Used only to draw pads outlines on silkscreen layers.
|
||||
*/
|
||||
static void BuildPadShapeThickOutlineAsPolygon( D_PAD * aPad,
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aWidth,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aWidth,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
{
|
||||
if( aPad->GetShape() == PAD_CIRCLE ) // Draw a ring
|
||||
{
|
||||
TransformRingToPolygon( aCornerBuffer, aPad->ReturnShapePos(),
|
||||
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
||||
aPad->GetSize().x / 2, aCircleToSegmentsCount, aWidth );
|
||||
return;
|
||||
}
|
||||
|
||||
// For other shapes, draw polygon outlines
|
||||
std::vector <CPolyPt> corners;
|
||||
CPOLYGONS_LIST corners;
|
||||
aPad->BuildPadShapePolygon( corners, wxSize( 0, 0 ),
|
||||
aCircleToSegmentsCount, aCorrectionFactor );
|
||||
aCircleToSegmentsCount, aCorrectionFactor );
|
||||
|
||||
// Add outlines as thick segments in polygon buffer
|
||||
for( unsigned ii = 0, jj = corners.size() - 1; ii < corners.size(); jj = ii, ii++ )
|
||||
{
|
||||
TransformRoundedEndsSegmentToPolygon( aCornerBuffer,
|
||||
wxPoint( corners[jj].x, corners[jj].y ),
|
||||
wxPoint( corners[ii].x, corners[ii].y ),
|
||||
aCircleToSegmentsCount, aWidth );
|
||||
wxPoint( corners[jj].x, corners[jj].y ),
|
||||
wxPoint( corners[ii].x, corners[ii].y ),
|
||||
aCircleToSegmentsCount, aWidth );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::Redraw( bool finish )
|
||||
{
|
||||
// SwapBuffer requires the window to be shown before calling
|
||||
|
@ -145,39 +146,41 @@ void EDA_3D_CANVAS::Redraw( bool finish )
|
|||
SwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_CANVAS::BuildBoard3DView()
|
||||
{
|
||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
|
||||
// Number of segments to draw a circle using segments
|
||||
const int segcountforcircle = 16;
|
||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle*2) );
|
||||
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||
// to reduce time calculations
|
||||
// for holes and items which do not need
|
||||
// a fine representation
|
||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality*2) );
|
||||
std::vector <CPolyPt> bufferPolys;
|
||||
bufferPolys.reserve( 200000 ); // Reserve for large board (tracks mainly)
|
||||
std::vector <CPolyPt> bufferZonesPolys;
|
||||
bufferPolys.reserve( 500000 ); // Reserve for large board ( copper zones mainly )
|
||||
std::vector <CPolyPt> currLayerHoles; // Contains holes for the current layer
|
||||
std::vector <CPolyPt> allLayerHoles; // Contains through holes, calculated only once
|
||||
const int segcountforcircle = 16;
|
||||
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
|
||||
const int segcountLowQuality = 12; // segments to draw a circle with low quality
|
||||
// to reduce time calculations
|
||||
// for holes and items which do not need
|
||||
// a fine representation
|
||||
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );
|
||||
CPOLYGONS_LIST bufferPolys;
|
||||
|
||||
bufferPolys.reserve( 200000 ); // Reserve for large board (tracks mainly)
|
||||
CPOLYGONS_LIST bufferZonesPolys;
|
||||
bufferPolys.reserve( 500000 ); // Reserve for large board ( copper zones mainly )
|
||||
CPOLYGONS_LIST currLayerHoles; // Contains holes for the current layer
|
||||
CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once
|
||||
allLayerHoles.reserve( 20000 );
|
||||
bool throughHolesListBuilt = false; // flag to build the through hole polygon list only once
|
||||
bool hightQualityMode = false;
|
||||
bool throughHolesListBuilt = false; // flag to build the through hole polygon list only once
|
||||
bool hightQualityMode = false;
|
||||
|
||||
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
|
||||
layer++ )
|
||||
{
|
||||
|
||||
if( layer != LAST_COPPER_LAYER &&
|
||||
layer >= g_Parm_3D_Visu.m_CopperLayersCount )
|
||||
if( layer != LAST_COPPER_LAYER
|
||||
&& layer >= g_Parm_3D_Visu.m_CopperLayersCount )
|
||||
continue;
|
||||
|
||||
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
||||
continue;
|
||||
|
||||
bufferPolys.clear();
|
||||
bufferZonesPolys.clear();
|
||||
currLayerHoles.clear();
|
||||
|
@ -185,25 +188,26 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
// Draw tracks:
|
||||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
{
|
||||
if( !track->IsOnLayer(layer) )
|
||||
if( !track->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
track->TransformShapeWithClearanceToPolygon( bufferPolys,
|
||||
0, segcountforcircle,
|
||||
correctionFactor );
|
||||
0, segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// Add via hole
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
{
|
||||
int shape = track->GetShape();
|
||||
int holediameter = track->GetDrillValue();
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
int holediameter = track->GetDrillValue();
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
int hole_outer_radius = (holediameter + thickness) / 2;
|
||||
|
||||
if( shape != VIA_THROUGH )
|
||||
TransformCircleToPolygon( currLayerHoles,
|
||||
track->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
else if( ! throughHolesListBuilt )
|
||||
else if( !throughHolesListBuilt )
|
||||
TransformCircleToPolygon( allLayerHoles,
|
||||
track->GetStart(), hole_outer_radius,
|
||||
segcountLowQuality );
|
||||
|
@ -214,16 +218,23 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
{
|
||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// Micro-wave modukes may have items on copper layers
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
// Add pad hole, if any
|
||||
if( ! throughHolesListBuilt )
|
||||
if( !throughHolesListBuilt )
|
||||
{
|
||||
D_PAD* pad = module->Pads();
|
||||
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
|
||||
segcountLowQuality );
|
||||
|
@ -235,34 +246,34 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
{
|
||||
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER * zone = pcb->GetArea( ii );
|
||||
LAYER_NUM zonelayer = zone->GetLayer();
|
||||
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
||||
LAYER_NUM zonelayer = zone->GetLayer();
|
||||
|
||||
if( zonelayer == layer )
|
||||
zone->TransformSolidAreasShapesToPolygonSet(
|
||||
hightQualityMode ? bufferPolys : bufferZonesPolys,
|
||||
segcountLowQuality, correctionFactorLQ );
|
||||
hightQualityMode ? bufferPolys : bufferZonesPolys,
|
||||
segcountLowQuality, correctionFactorLQ );
|
||||
}
|
||||
}
|
||||
|
||||
// draw graphic items
|
||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( ! item->IsOnLayer( layer ) )
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
((DRAWSEGMENT*) item)->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
((TEXTE_PCB*) item)->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -274,8 +285,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
if( bufferPolys.size() == 0 )
|
||||
continue;
|
||||
|
||||
KI_POLYGON_SET currLayerPolyset;
|
||||
KI_POLYGON_SET polysetHoles;
|
||||
KI_POLYGON_SET currLayerPolyset;
|
||||
KI_POLYGON_SET polysetHoles;
|
||||
|
||||
// Add polygons, without holes
|
||||
AddPolygonCornersToKiPolygonList( bufferPolys, currLayerPolyset );
|
||||
|
@ -283,6 +294,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
// Add holes in polygon list
|
||||
currLayerHoles.insert( currLayerHoles.begin(),
|
||||
allLayerHoles.begin(), allLayerHoles.end() );
|
||||
|
||||
if( currLayerHoles.size() > 0 )
|
||||
AddPolygonCornersToKiPolygonList( currLayerHoles, polysetHoles );
|
||||
|
||||
|
@ -290,8 +302,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
currLayerPolyset -= polysetHoles;
|
||||
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
|
||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||
|
||||
SetGLColor( color );
|
||||
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
|
||||
|
@ -301,6 +313,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
|
||||
thickness,
|
||||
g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||
|
||||
if( bufferZonesPolys.size() )
|
||||
Draw3D_SolidHorizontalPolyPolygons( bufferZonesPolys, zpos,
|
||||
thickness,
|
||||
|
@ -313,10 +326,11 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
Draw3DViaHole( (SEGVIA *) track );
|
||||
Draw3DViaHole( (SEGVIA*) track );
|
||||
}
|
||||
|
||||
// Draw pads holes (vertical cylinders)
|
||||
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
|
||||
Draw3DPadHole( pad );
|
||||
|
@ -326,30 +340,31 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
|
||||
layer++ )
|
||||
{
|
||||
if( ! Is3DLayerEnabled( layer ) )
|
||||
if( !Is3DLayerEnabled( layer ) )
|
||||
continue;
|
||||
|
||||
if( !g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) )
|
||||
continue;
|
||||
|
||||
bufferPolys.clear();
|
||||
|
||||
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( ! item->IsOnLayer( layer ) )
|
||||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
((DRAWSEGMENT*) item)->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
|
||||
bufferPolys, 0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
((TEXTE_PCB*) item)->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -361,24 +376,31 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
{
|
||||
if( layer == SILKSCREEN_N_FRONT || layer == SILKSCREEN_N_BACK )
|
||||
{
|
||||
D_PAD* pad = module->Pads();
|
||||
int linewidth = g_DrawDefaultLineThickness;
|
||||
D_PAD* pad = module->Pads();
|
||||
int linewidth = g_DrawDefaultLineThickness;
|
||||
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
if( !pad->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
BuildPadShapeThickOutlineAsPolygon( pad, bufferPolys,
|
||||
linewidth,
|
||||
segcountforcircle, correctionFactor );
|
||||
linewidth,
|
||||
segcountforcircle, correctionFactor );
|
||||
}
|
||||
}
|
||||
else
|
||||
module->TransformPadsShapesWithClearanceToPolygon( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
|
||||
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
|
||||
bufferPolys, 0, segcountforcircle, correctionFactor );
|
||||
bufferPolys,
|
||||
0,
|
||||
segcountforcircle,
|
||||
correctionFactor );
|
||||
}
|
||||
|
||||
// bufferPolys contains polygons to merge. Many overlaps .
|
||||
|
@ -386,15 +408,16 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
if( bufferPolys.size() == 0 )
|
||||
continue;
|
||||
|
||||
KI_POLYGON_SET currLayerPolyset;
|
||||
KI_POLYGON_SET polyset;
|
||||
KI_POLYGON_SET currLayerPolyset;
|
||||
KI_POLYGON_SET polyset;
|
||||
AddPolygonCornersToKiPolygonList( bufferPolys, polyset );
|
||||
// merge polys:
|
||||
currLayerPolyset += polyset;
|
||||
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer );
|
||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
|
||||
|
||||
if( layer == EDGE_N )
|
||||
{
|
||||
thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT )
|
||||
|
@ -417,12 +440,13 @@ void EDA_3D_CANVAS::BuildBoard3DView()
|
|||
module->ReadAndInsert3DComponentShape( this );
|
||||
}
|
||||
|
||||
|
||||
GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
||||
{
|
||||
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
BOARD* pcb = pcbframe->GetBoard();
|
||||
|
||||
wxBusyCursor dummy;
|
||||
wxBusyCursor dummy;
|
||||
|
||||
m_gllist = glGenLists( 1 );
|
||||
|
||||
|
@ -434,7 +458,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
// draw axis
|
||||
if (g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS])
|
||||
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_AXIS] )
|
||||
{
|
||||
glEnable( GL_COLOR_MATERIAL );
|
||||
SetGLColor( WHITE );
|
||||
|
@ -457,7 +481,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
|
||||
// Draw Board:
|
||||
// For testing purpose only display calculation time to generate 3D data
|
||||
//#define PRINT_CALCULATION_TIME
|
||||
// #define PRINT_CALCULATION_TIME
|
||||
|
||||
#ifdef PRINT_CALCULATION_TIME
|
||||
unsigned strtime = GetRunningMicroSecs();
|
||||
|
@ -467,7 +491,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
|
||||
// Draw grid
|
||||
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_GRID] )
|
||||
DrawGrid( g_Parm_3D_Visu.m_3D_Grid );
|
||||
DrawGrid( g_Parm_3D_Visu.m_3D_Grid );
|
||||
|
||||
glEndList();
|
||||
|
||||
|
@ -475,9 +499,9 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
CheckGLError();
|
||||
|
||||
#ifdef PRINT_CALCULATION_TIME
|
||||
unsigned endtime = GetRunningMicroSecs();
|
||||
wxString msg;
|
||||
msg.Printf( "Built data %.1f ms", (double)(endtime-strtime)/1000 );
|
||||
unsigned endtime = GetRunningMicroSecs();
|
||||
wxString msg;
|
||||
msg.Printf( "Built data %.1f ms", (double) (endtime - strtime) / 1000 );
|
||||
Parent()->SetStatusText( msg, 0 );
|
||||
#endif
|
||||
|
||||
|
@ -489,27 +513,27 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
// and a vertical grid (XZ plane and Y = 0)
|
||||
void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
||||
{
|
||||
double zpos = 0.0;
|
||||
double zpos = 0.0;
|
||||
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
|
||||
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
|
||||
double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
||||
double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
|
||||
|
||||
glNormal3f( 0.0, 0.0, 1.0 );
|
||||
|
||||
wxSize brd_size = g_Parm_3D_Visu.m_BoardSize;
|
||||
wxSize brd_size = g_Parm_3D_Visu.m_BoardSize;
|
||||
wxPoint brd_center_pos = g_Parm_3D_Visu.m_BoardPos;
|
||||
NEGATE( brd_center_pos.y );
|
||||
|
||||
int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) );
|
||||
int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) );
|
||||
int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) );
|
||||
int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) );
|
||||
|
||||
// Grid limits, in 3D units
|
||||
double xmin = (brd_center_pos.x - xsize/2) * scale;
|
||||
double xmax = (brd_center_pos.x + xsize/2) * scale;
|
||||
double ymin = (brd_center_pos.y - ysize/2) * scale;
|
||||
double ymax = (brd_center_pos.y + ysize/2) * scale;
|
||||
double zmin = Millimeter2iu( -50 ) * scale;
|
||||
double zmax = Millimeter2iu( 100 ) * scale;
|
||||
double xmin = (brd_center_pos.x - xsize / 2) * scale;
|
||||
double xmax = (brd_center_pos.x + xsize / 2) * scale;
|
||||
double ymin = (brd_center_pos.y - ysize / 2) * scale;
|
||||
double ymax = (brd_center_pos.y + ysize / 2) * scale;
|
||||
double zmin = Millimeter2iu( -50 ) * scale;
|
||||
double zmax = Millimeter2iu( 100 ) * scale;
|
||||
|
||||
// Draw horizontal grid centered on 3D origin (center of the board)
|
||||
for( int ii = 0; ; ii++ )
|
||||
|
@ -521,38 +545,39 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
|||
|
||||
int delta = KiROUND( ii * aGriSizeMM * IU_PER_MM );
|
||||
|
||||
if( delta <= xsize/2 ) // Draw grid lines parallel to X axis
|
||||
if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
if( delta <= ysize/2 ) // Draw grid lines parallel to Y axis
|
||||
if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
|
||||
glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
|
||||
glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
if( ( delta > ysize/2 ) && ( delta > xsize/2 ) )
|
||||
if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -569,20 +594,20 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
|||
|
||||
double delta = ii * aGriSizeMM * IU_PER_MM;
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -brd_center_pos.y * scale, zmin );
|
||||
glVertex3f( (brd_center_pos.x + delta) * scale, -brd_center_pos.y * scale, zmax );
|
||||
glEnd();
|
||||
|
||||
if( ii != 0 )
|
||||
{
|
||||
glBegin(GL_LINES);
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -brd_center_pos.y * scale, zmin );
|
||||
glVertex3f( (brd_center_pos.x - delta) * scale, -brd_center_pos.y * scale, zmax );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if( delta > xsize/2 )
|
||||
if( delta > xsize / 2 )
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -594,21 +619,23 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
|||
else
|
||||
SetGLColor( gridcolor_marker );
|
||||
|
||||
double delta = ii * aGriSizeMM * IU_PER_MM * scale;
|
||||
double delta = ii * aGriSizeMM * IU_PER_MM * scale;
|
||||
|
||||
if( delta <= zmax )
|
||||
{ // Draw grid lines on Z axis (positive Z axis coordinates)
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(xmin, -brd_center_pos.y * scale, delta);
|
||||
glVertex3f(xmax, -brd_center_pos.y * scale, delta);
|
||||
{
|
||||
// Draw grid lines on Z axis (positive Z axis coordinates)
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -brd_center_pos.y * scale, delta );
|
||||
glVertex3f( xmax, -brd_center_pos.y * scale, delta );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if( delta <= -zmin && ( ii != 0 ) )
|
||||
{ // Draw grid lines on Z axis (negative Z axis coordinates)
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(xmin, -brd_center_pos.y * scale, -delta);
|
||||
glVertex3f(xmax, -brd_center_pos.y * scale, -delta);
|
||||
{
|
||||
// Draw grid lines on Z axis (negative Z axis coordinates)
|
||||
glBegin( GL_LINES );
|
||||
glVertex3f( xmin, -brd_center_pos.y * scale, -delta );
|
||||
glVertex3f( xmax, -brd_center_pos.y * scale, -delta );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
@ -617,22 +644,23 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
|
|||
}
|
||||
}
|
||||
|
||||
void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA * aVia )
|
||||
|
||||
void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
|
||||
{
|
||||
LAYER_NUM top_layer, bottom_layer;
|
||||
int inner_radius = aVia->GetDrillValue() / 2;
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
LAYER_NUM top_layer, bottom_layer;
|
||||
int inner_radius = aVia->GetDrillValue() / 2;
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
|
||||
aVia->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
// Drawing via hole:
|
||||
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetShape() );
|
||||
SetGLColor( color );
|
||||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU(top_layer) -
|
||||
g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ) - thickness;
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(bottom_layer) + thickness/2;
|
||||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( top_layer ) -
|
||||
g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ) - thickness;
|
||||
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ) + thickness / 2;
|
||||
|
||||
Draw3D_ZaxisCylinder( aVia->GetStart(), inner_radius + thickness/2, height,
|
||||
Draw3D_ZaxisCylinder( aVia->GetStart(), inner_radius + thickness / 2, height,
|
||||
thickness, zpos, g_Parm_3D_Visu.m_BiuTo3Dunits );
|
||||
}
|
||||
|
||||
|
@ -640,7 +668,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA * aVia )
|
|||
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
|
||||
{
|
||||
// Draw module shape: 3D shape if exists (or module outlines if not exists)
|
||||
S3D_MASTER* struct3D = m_3D_Drawings;
|
||||
S3D_MASTER* struct3D = m_3D_Drawings;
|
||||
|
||||
if( g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] )
|
||||
{
|
||||
|
@ -678,24 +706,24 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
|
|||
|
||||
|
||||
// Draw 3D pads.
|
||||
void EDA_3D_CANVAS::Draw3DPadHole( D_PAD * aPad )
|
||||
void EDA_3D_CANVAS::Draw3DPadHole( D_PAD* aPad )
|
||||
{
|
||||
// Draw the pad hole
|
||||
wxSize drillsize = aPad->GetDrillSize();
|
||||
bool hasHole = drillsize.x && drillsize.y;
|
||||
wxSize drillsize = aPad->GetDrillSize();
|
||||
bool hasHole = drillsize.x && drillsize.y;
|
||||
|
||||
if( ! hasHole )
|
||||
if( !hasHole )
|
||||
return;
|
||||
|
||||
// Store here the points to approximate hole by segments
|
||||
std::vector <CPolyPt> holecornersBuffer;
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU(LAYER_N_FRONT) -
|
||||
g_Parm_3D_Visu.GetLayerZcoordBIU(LAYER_N_BACK);
|
||||
CPOLYGONS_LIST holecornersBuffer;
|
||||
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
|
||||
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT ) -
|
||||
g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
|
||||
|
||||
SetGLColor( DARKGRAY );
|
||||
int holeZpoz = g_Parm_3D_Visu.GetLayerZcoordBIU(LAYER_N_BACK) + thickness/2;
|
||||
int holeHeight = height - thickness;
|
||||
int holeZpoz = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK ) + thickness / 2;
|
||||
int holeHeight = height - thickness;
|
||||
|
||||
if( drillsize.x == drillsize.y ) // usual round hole
|
||||
{
|
||||
|
@ -706,7 +734,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( D_PAD * aPad )
|
|||
else // Oblong hole
|
||||
{
|
||||
wxPoint ends_offset;
|
||||
int width;
|
||||
int width;
|
||||
|
||||
if( drillsize.x > drillsize.y ) // Horizontal oval
|
||||
{
|
||||
|
@ -721,9 +749,9 @@ void EDA_3D_CANVAS::Draw3DPadHole( D_PAD * aPad )
|
|||
|
||||
RotatePoint( &ends_offset, aPad->GetOrientation() );
|
||||
|
||||
wxPoint start = aPad->GetPosition() + ends_offset;
|
||||
wxPoint end = aPad->GetPosition() - ends_offset;
|
||||
int hole_radius = ( width + thickness ) / 2;
|
||||
wxPoint start = aPad->GetPosition() + ends_offset;
|
||||
wxPoint end = aPad->GetPosition() - ends_offset;
|
||||
int hole_radius = ( width + thickness ) / 2;
|
||||
|
||||
// Draw the hole
|
||||
Draw3D_ZaxisOblongCylinder( start, end, hole_radius, holeHeight,
|
||||
|
@ -731,33 +759,34 @@ void EDA_3D_CANVAS::Draw3DPadHole( D_PAD * aPad )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Is3DLayerEnabled( LAYER_NUM aLayer )
|
||||
{
|
||||
int flg;
|
||||
|
||||
// see if layer needs to be shown
|
||||
// check the flags
|
||||
switch (aLayer)
|
||||
switch( aLayer )
|
||||
{
|
||||
case DRAW_N:
|
||||
flg = g_Parm_3D_Visu.FL_DRAWINGS;
|
||||
break;
|
||||
case DRAW_N:
|
||||
flg = g_Parm_3D_Visu.FL_DRAWINGS;
|
||||
break;
|
||||
|
||||
case COMMENT_N:
|
||||
flg = g_Parm_3D_Visu.FL_COMMENTS;
|
||||
break;
|
||||
case COMMENT_N:
|
||||
flg = g_Parm_3D_Visu.FL_COMMENTS;
|
||||
break;
|
||||
|
||||
case ECO1_N:
|
||||
flg = g_Parm_3D_Visu.FL_ECO1;
|
||||
break;
|
||||
case ECO1_N:
|
||||
flg = g_Parm_3D_Visu.FL_ECO1;
|
||||
break;
|
||||
|
||||
case ECO2_N:
|
||||
flg = g_Parm_3D_Visu.FL_ECO2;
|
||||
break;
|
||||
case ECO2_N:
|
||||
flg = g_Parm_3D_Visu.FL_ECO2;
|
||||
break;
|
||||
|
||||
default:
|
||||
// the layer was not a layer with a flag, so show it
|
||||
return true;
|
||||
default:
|
||||
// the layer was not a layer with a flag, so show it
|
||||
return true;
|
||||
}
|
||||
|
||||
// if the layer has a flag, return the flag
|
||||
|
@ -770,10 +799,10 @@ GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
|
|||
double nZ = 1.0;
|
||||
|
||||
if( ( aLayer == LAYER_N_BACK )
|
||||
|| ( aLayer == ADHESIVE_N_BACK )
|
||||
|| ( aLayer == SOLDERPASTE_N_BACK )
|
||||
|| ( aLayer == SILKSCREEN_N_BACK )
|
||||
|| ( aLayer == SOLDERMASK_N_BACK ) )
|
||||
|| ( aLayer == ADHESIVE_N_BACK )
|
||||
|| ( aLayer == SOLDERPASTE_N_BACK )
|
||||
|| ( aLayer == SILKSCREEN_N_BACK )
|
||||
|| ( aLayer == SOLDERMASK_N_BACK ) )
|
||||
nZ = -1.0;
|
||||
|
||||
return nZ;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* The top 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 );
|
||||
|
||||
/** draw the solid polygon found in aPolysList
|
||||
|
@ -55,7 +55,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector<CPolyPt>& aPolysLi
|
|||
* The top 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 );
|
||||
|
||||
/** draw a thick segment using 3D primitives, in a XY plane
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#define __3D_VIEWER_H__
|
||||
|
||||
#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
|
||||
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
|
||||
|
|
|
@ -36,24 +36,24 @@
|
|||
* We are using a lots polygons in calculations.
|
||||
* and we are using 2 descriptions,
|
||||
* 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
|
||||
* a std::vector<CPolyPt> polygon list
|
||||
* a CPOLYGONS_LIST polygon list
|
||||
* Therefore we need conversion functions between these 2 descriptions
|
||||
*/
|
||||
void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
|
||||
std::vector<CPolyPt>& aPolysList )
|
||||
void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
|
||||
CPOLYGONS_LIST& aPolysList )
|
||||
{
|
||||
for( unsigned ii = 0; ii < aKiPolyList.size(); ii++ )
|
||||
{
|
||||
KI_POLYGON& poly = aKiPolyList[ii];
|
||||
CPolyPt corner( 0, 0, false );
|
||||
CPolyPt corner( 0, 0, false );
|
||||
|
||||
for( unsigned jj = 0; jj < poly.size(); jj++ )
|
||||
{
|
||||
KI_POLY_POINT point = *(poly.begin() + jj);
|
||||
corner.x = point.x();
|
||||
corner.y = point.y();
|
||||
corner.x = point.x();
|
||||
corner.y = point.y();
|
||||
corner.end_contour = false;
|
||||
aPolysList.push_back( corner );
|
||||
}
|
||||
|
@ -64,21 +64,23 @@ void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function AddPolygonCornersToKiPolygonList
|
||||
* 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 aPolysList = destination (set of polygons)
|
||||
*/
|
||||
void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
|
||||
KI_POLYGON_SET& aKiPolyList )
|
||||
void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
|
||||
KI_POLYGON_SET& aKiPolyList )
|
||||
{
|
||||
std::vector<KI_POLY_POINT> cornerslist;
|
||||
unsigned corners_count = aCornersBuffer.size();
|
||||
unsigned corners_count = aCornersBuffer.size();
|
||||
|
||||
// Count the number of polygons in aCornersBuffer
|
||||
int polycount = 0;
|
||||
int polycount = 0;
|
||||
|
||||
for( unsigned ii = 0; ii < corners_count; ii++ )
|
||||
{
|
||||
if( aCornersBuffer[ii].end_contour )
|
||||
|
@ -89,10 +91,11 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
|
|||
|
||||
for( unsigned icnt = 0; icnt < corners_count; )
|
||||
{
|
||||
KI_POLYGON poly;
|
||||
KI_POLYGON poly;
|
||||
cornerslist.clear();
|
||||
|
||||
unsigned ii;
|
||||
unsigned ii;
|
||||
|
||||
for( ii = icnt; ii < aCornersBuffer.size(); ii++ )
|
||||
{
|
||||
cornerslist.push_back( KI_POLY_POINT( aCornersBuffer[ii].x, aCornersBuffer[ii].y ) );
|
||||
|
@ -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
|
||||
* outside the circle, you should give aRadius calculated with a corrrection factor
|
||||
*/
|
||||
void TransformCircleToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
wxPoint aCenter, int aRadius,
|
||||
int aCircleToSegmentsCount )
|
||||
void TransformCircleToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
wxPoint aCenter, int aRadius,
|
||||
int aCircleToSegmentsCount )
|
||||
{
|
||||
wxPoint corner_position;
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
int halfstep = 1800 / aCircleToSegmentsCount; // the starting value for rot angles
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
int halfstep = 1800 / aCircleToSegmentsCount; // the starting value for rot angles
|
||||
|
||||
for( int ii = 0; ii < aCircleToSegmentsCount; ii++ )
|
||||
{
|
||||
corner_position.x = aRadius;
|
||||
corner_position.y = 0;
|
||||
int angle = (ii * delta) + halfstep;
|
||||
corner_position.x = aRadius;
|
||||
corner_position.y = 0;
|
||||
int angle = (ii * delta) + halfstep;
|
||||
RotatePoint( &corner_position.x, &corner_position.y, angle );
|
||||
corner_position += aCenter;
|
||||
CPolyPt polypoint( corner_position.x, corner_position.y );
|
||||
|
@ -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
|
||||
* 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,
|
||||
int aCircleToSegmentsCount,
|
||||
int aWidth )
|
||||
{
|
||||
int radius = aWidth / 2;
|
||||
wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0)
|
||||
wxPoint startp = aStart;
|
||||
int radius = aWidth / 2;
|
||||
wxPoint endp = aEnd - aStart; // end point coordinate for the same segment starting at (0,0)
|
||||
wxPoint startp = aStart;
|
||||
wxPoint corner;
|
||||
CPolyPt polypoint;
|
||||
|
||||
// normalize the position in order to have endp.x >= 0;
|
||||
if( endp.x < 0 )
|
||||
{
|
||||
endp = aStart - aEnd;
|
||||
startp = aEnd;
|
||||
endp = aStart - aEnd;
|
||||
startp = aEnd;
|
||||
}
|
||||
|
||||
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
|
||||
// add right rounded end:
|
||||
|
@ -233,7 +236,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* @param aWidth = width (thickness) of the line
|
||||
*/
|
||||
void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
wxPoint aCentre, wxPoint aStart, int aArcAngle,
|
||||
int aCircleToSegmentsCount, int aWidth )
|
||||
{
|
||||
|
@ -254,8 +257,8 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
}
|
||||
|
||||
// Compute the ends of segments and creates poly
|
||||
wxPoint curr_end = arc_start;
|
||||
wxPoint curr_start = arc_start;
|
||||
wxPoint curr_end = arc_start;
|
||||
wxPoint curr_start = arc_start;
|
||||
|
||||
for( int ii = delta; ii < aArcAngle; ii += delta )
|
||||
{
|
||||
|
@ -272,6 +275,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
aCircleToSegmentsCount, aWidth );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function TransformRingToPolygon
|
||||
* Creates a polygon from a ring
|
||||
|
@ -282,50 +286,50 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* @param aWidth = width (thickness) of the ring
|
||||
*/
|
||||
void TransformRingToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
wxPoint aCentre, int aRadius,
|
||||
int aCircleToSegmentsCount, int aWidth )
|
||||
void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
wxPoint aCentre, int aRadius,
|
||||
int aCircleToSegmentsCount, int aWidth )
|
||||
{
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
|
||||
|
||||
// Compute the corners posituions and creates poly
|
||||
wxPoint curr_point;
|
||||
int inner_radius = aRadius - ( aWidth / 2 );
|
||||
int outer_radius = inner_radius + aWidth;
|
||||
int inner_radius = aRadius - ( aWidth / 2 );
|
||||
int outer_radius = inner_radius + aWidth;
|
||||
CPolyPt polycorner;
|
||||
|
||||
// Draw the inner circle of the ring
|
||||
for( int ii = 0; ii < 3600; ii += delta )
|
||||
{
|
||||
curr_point.x = inner_radius;
|
||||
curr_point.y = 0;
|
||||
curr_point.x = inner_radius;
|
||||
curr_point.y = 0;
|
||||
RotatePoint( &curr_point, ii );
|
||||
curr_point += aCentre;
|
||||
polycorner.x = curr_point.x;
|
||||
polycorner.y = curr_point.y;
|
||||
curr_point += aCentre;
|
||||
polycorner.x = curr_point.x;
|
||||
polycorner.y = curr_point.y;
|
||||
aCornerBuffer.push_back( polycorner );
|
||||
}
|
||||
|
||||
// Draw the last point of inner circle
|
||||
polycorner.x = aCentre.x + inner_radius;
|
||||
polycorner.y = aCentre.y;
|
||||
polycorner.x = aCentre.x + inner_radius;
|
||||
polycorner.y = aCentre.y;
|
||||
aCornerBuffer.push_back( polycorner );
|
||||
|
||||
// Draw the outer circle of the ring
|
||||
for( int ii = 0; ii < 3600; ii += delta )
|
||||
{
|
||||
curr_point.x = outer_radius;
|
||||
curr_point.y = 0;
|
||||
curr_point.x = outer_radius;
|
||||
curr_point.y = 0;
|
||||
RotatePoint( &curr_point, -ii );
|
||||
curr_point += aCentre;
|
||||
polycorner.x = curr_point.x;
|
||||
polycorner.y = curr_point.y;
|
||||
curr_point += aCentre;
|
||||
polycorner.x = curr_point.x;
|
||||
polycorner.y = curr_point.y;
|
||||
aCornerBuffer.push_back( polycorner );
|
||||
}
|
||||
|
||||
// Draw the last point of outer circle
|
||||
polycorner.x = aCentre.x + outer_radius;
|
||||
polycorner.y = aCentre.y;
|
||||
polycorner.x = aCentre.x + outer_radius;
|
||||
polycorner.y = aCentre.y;
|
||||
aCornerBuffer.push_back( polycorner );
|
||||
|
||||
// Close the polygon
|
||||
|
|
|
@ -40,26 +40,26 @@
|
|||
* We are using a lots polygons in calculations.
|
||||
* and we are using 2 descriptions,
|
||||
* 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
|
||||
* a std::vector<CPolyPt> polygon list
|
||||
* a CPOLYGONS_LIST corner polygon list
|
||||
* Therefore we need conversion functions between these 2 descriptions
|
||||
* This function converts a KI_POLYGON_SET description to a
|
||||
* std::vector<CPolyPt> description
|
||||
* CPOLYGONS_LIST description
|
||||
* @param aKiPolyList = source (set of polygons)
|
||||
* @param aPolysList = destination (set of polygons using CPolyPt corners descr)
|
||||
*/
|
||||
void CopyPolygonsFromKiPolygonListToPolysList( KI_POLYGON_SET& aKiPolyList,
|
||||
std::vector<CPolyPt>& aPolysList );
|
||||
CPOLYGONS_LIST& aPolysList );
|
||||
|
||||
/**
|
||||
* Helper function AddPolygonCornersToKiPolygonList
|
||||
* 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 aPolysList = destination (set of polygons)
|
||||
*/
|
||||
void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
|
||||
void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
|
||||
KI_POLYGON_SET& aKiPolyList );
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
* 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,
|
||||
int aCircleToSegmentsCount );
|
||||
|
||||
|
@ -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
|
||||
* 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,
|
||||
int aCircleToSegmentsCount,
|
||||
int aWidth );
|
||||
|
@ -105,7 +105,7 @@ void TransformRoundedEndsSegmentToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* @param aWidth = width (thickness) of the line
|
||||
*/
|
||||
void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
wxPoint aCentre, wxPoint aStart, int aArcAngle,
|
||||
int aCircleToSegmentsCount, int aWidth );
|
||||
|
||||
|
@ -119,7 +119,7 @@ void TransformArcToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
* @param aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* @param aWidth = width (thickness) of the ring
|
||||
*/
|
||||
void TransformRingToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
wxPoint aCentre, int aRadius,
|
||||
int aCircleToSegmentsCount, int aWidth );
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* initial radius * aCorrectionFactor
|
||||
*/
|
||||
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
|
@ -86,7 +86,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
|
|||
*/
|
||||
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
|
||||
LAYER_NUM aLayer,
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
|
@ -166,12 +166,12 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
|
|||
* keep arc radius when approximated by segments
|
||||
*/
|
||||
void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor )
|
||||
{
|
||||
unsigned cornerscount = GetFilledPolysList().size();
|
||||
std::vector <CPolyPt> polygonslist;
|
||||
CPOLYGONS_LIST polygonslist;
|
||||
|
||||
if( cornerscount == 0 )
|
||||
return;
|
||||
|
@ -217,7 +217,7 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
|
|||
* @param aClearanceValue = the clearance around the pad
|
||||
*/
|
||||
void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue ) const
|
||||
{
|
||||
if( GetText().Length() == 0 )
|
||||
|
@ -251,7 +251,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
|
|||
* Convert the text shape to a set of polygons (one by segment)
|
||||
* Used in filling zones calculations and 3D view
|
||||
* 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
|
||||
* aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* aCorrectionFactor = the correction to apply to circles radius to keep
|
||||
|
@ -263,7 +263,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
|
|||
// so we cannot send them as arguments.
|
||||
int s_textWidth;
|
||||
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:
|
||||
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(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const
|
||||
|
@ -334,7 +334,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
|
|||
* clearance when the circle is approxiamted by segment bigger or equal
|
||||
* 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 aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const
|
||||
|
@ -375,7 +375,7 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& a
|
|||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* 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 aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const
|
||||
|
@ -404,17 +404,17 @@ void TRACK:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
|||
* Convert the pad shape to a closed polygon
|
||||
* Used in filling zones calculations and 3D view generation
|
||||
* 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
|
||||
* aCircleToSegmentsCount = the number of segments to approximate a circle
|
||||
* aCorrectionFactor = the correction to apply to circles radius to keep
|
||||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const
|
||||
void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const
|
||||
{
|
||||
wxPoint corner_position;
|
||||
int angle;
|
||||
|
@ -547,7 +547,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( std:: vector < CPolyPt>& aCor
|
|||
* Note: for Round and oval pads this function is equivalent to
|
||||
* 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,
|
||||
double aCorrectionFactor ) const
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ void D_PAD::BuildPadShapePolygon( std::vector <CPolyPt>& aCornerBuffer,
|
|||
* depending on shape pad hole and orientation
|
||||
* 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
|
||||
{
|
||||
wxSize drillsize = GetDrillSize();
|
||||
|
@ -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
|
||||
* change the shape by creating stubs and destroy their properties.
|
||||
*/
|
||||
void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
D_PAD& aPad,
|
||||
int aThermalGap,
|
||||
int aCopperThickness,
|
||||
int aMinThicknessValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor,
|
||||
int aThermalRot )
|
||||
void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
D_PAD& aPad,
|
||||
int aThermalGap,
|
||||
int aCopperThickness,
|
||||
int aMinThicknessValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor,
|
||||
int aThermalRot )
|
||||
{
|
||||
wxPoint corner, corner_end;
|
||||
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
|
||||
|
|
|
@ -211,10 +211,10 @@ public:
|
|||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
|
||||
virtual wxString GetSelectMenuText() const;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <class_board_item.h>
|
||||
|
||||
#include <class_text_mod.h>
|
||||
#include <PolyLine.h>
|
||||
#include "zones.h"
|
||||
|
||||
class LINE_READER;
|
||||
|
@ -46,7 +47,6 @@ class EDA_DRAW_PANEL;
|
|||
class D_PAD;
|
||||
class BOARD;
|
||||
class MSG_PANEL_ITEM;
|
||||
class CPolyPt;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -268,10 +268,10 @@ public:
|
|||
* initial radius * aCorrectionFactor
|
||||
*/
|
||||
void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
|
||||
/**
|
||||
* function TransformGraphicShapesWithClearanceToPolygonSet
|
||||
|
@ -292,10 +292,10 @@ public:
|
|||
*/
|
||||
void TransformGraphicShapesWithClearanceToPolygonSet(
|
||||
LAYER_NUM aLayer,
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aInflateValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -186,16 +186,16 @@ public:
|
|||
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
|
||||
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
|
||||
|
||||
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
|
||||
LAYER_MSK GetLayerMask() const { return m_layerMask; }
|
||||
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
|
||||
LAYER_MSK GetLayerMask() const { return m_layerMask; }
|
||||
|
||||
void SetAttribute( PAD_ATTR_T aAttribute );
|
||||
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
|
||||
|
||||
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
|
||||
int GetPadToDieLength() const { return m_LengthPadToDie; }
|
||||
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
|
||||
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; }
|
||||
|
||||
int GetLocalClearance() const { return m_LocalClearance; }
|
||||
|
@ -220,7 +220,7 @@ public:
|
|||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;;
|
||||
|
@ -317,7 +317,7 @@ public:
|
|||
* @param aCorrectionFactor = the correction to apply to circles radius to keep
|
||||
* 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,
|
||||
double aCorrectionFactor ) const;
|
||||
|
||||
|
@ -332,7 +332,7 @@ public:
|
|||
* (used for round and oblong shapes only(16 to 32 is a good value)
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TransformBoundingBoxWithClearanceToPolygon(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue ) const;
|
||||
|
||||
/**
|
||||
|
@ -108,10 +108,10 @@ public:
|
|||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TransformShapeWithClearanceToPolygonSet( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
void TransformShapeWithClearanceToPolygonSet( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
|
||||
wxString GetSelectMenuText() const;
|
||||
|
||||
|
|
|
@ -175,10 +175,10 @@ public:
|
|||
* clearance when the circle is approximated by segment bigger or equal
|
||||
* to the real clearance value (usually near from 1.0)
|
||||
*/
|
||||
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor ) const;
|
||||
/**
|
||||
* Function SetDrill
|
||||
* sets the drill value for vias.
|
||||
|
|
|
@ -274,7 +274,7 @@ public:
|
|||
* @param aCorrectionFactor = the correction to apply to arcs radius to roughly
|
||||
* keep arc radius when approximated by segments
|
||||
*/
|
||||
void TransformSolidAreasShapesToPolygonSet( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformSolidAreasShapesToPolygonSet( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aCircleToSegmentsCount,
|
||||
double aCorrectionFactor );
|
||||
/**
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
* This function calls AddClearanceAreasPolygonsToPolysList()
|
||||
* 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
|
||||
|
@ -339,7 +339,7 @@ public:
|
|||
* @param aAddClearance = true to add a clearance area to the polygon
|
||||
* false to create the outline polygon.
|
||||
*/
|
||||
void TransformOutlinesShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
|
||||
void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue,
|
||||
bool aAddClearance );
|
||||
/**
|
||||
|
@ -506,7 +506,7 @@ public:
|
|||
* returns a 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;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ public:
|
|||
* Function AddFilledPolysList
|
||||
* sets the list of filled polygons.
|
||||
*/
|
||||
void AddFilledPolysList( std::vector<CPolyPt>& aPolysList )
|
||||
void AddFilledPolysList( CPOLYGONS_LIST& aPolysList )
|
||||
{
|
||||
m_FilledPolysList = aPolysList;
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ public:
|
|||
|
||||
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() );
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ private:
|
|||
* connecting "holes" with external main outline. In complex cases an outline
|
||||
* 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
|
|||
|
||||
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;
|
||||
|
||||
if( cv.size() )
|
||||
|
@ -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+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 )
|
||||
m_out->Print( aNestLevel+3, "(xy %s %s)",
|
||||
|
@ -1443,7 +1443,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
|
|||
}
|
||||
|
||||
// Save the PolysList
|
||||
const std::vector< CPolyPt >& fv = aZone->GetFilledPolysList();
|
||||
const CPOLYGONS_LIST& fv = aZone->GetFilledPolysList();
|
||||
newLine = 0;
|
||||
|
||||
if( fv.size() )
|
||||
|
@ -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+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 )
|
||||
m_out->Print( aNestLevel+3, "(xy %s %s)",
|
||||
|
|
|
@ -2346,7 +2346,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
|
|||
else if( TESTLINE( "$POLYSCORNERS" ) )
|
||||
{
|
||||
// Read the PolysList (polygons used for fill areas in the zone)
|
||||
std::vector<CPolyPt> polysList;
|
||||
CPOLYGONS_LIST polysList;
|
||||
|
||||
while( ( line = READLINE( m_reader ) ) != NULL )
|
||||
{
|
||||
|
@ -3690,12 +3690,10 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
|
|||
me->GetCornerSmoothingType(),
|
||||
fmtBIU( me->GetCornerRadius() ).c_str() );
|
||||
|
||||
typedef std::vector< CPolyPt > CPOLY_PTS;
|
||||
|
||||
// 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",
|
||||
fmtBIUPair( it->x, it->y ).c_str(),
|
||||
|
@ -3703,12 +3701,12 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
|
|||
}
|
||||
|
||||
// Save the PolysList
|
||||
const CPOLY_PTS& fv = me->GetFilledPolysList();
|
||||
const CPOLYGONS_LIST& fv = me->GetFilledPolysList();
|
||||
if( fv.size() )
|
||||
{
|
||||
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",
|
||||
fmtBIUPair( it->x, it->y ).c_str(),
|
||||
|
|
|
@ -2371,7 +2371,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
|
|||
T token;
|
||||
|
||||
// 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 ) );
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <pcbplot.h>
|
||||
|
||||
// Imported function
|
||||
extern void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
|
||||
extern void AddPolygonCornersToKiPolygonList( CPOLYGONS_LIST& aCornersBuffer,
|
||||
KI_POLYGON_SET& aKiPolyList );
|
||||
// Local
|
||||
/* Plot a solder mask layer.
|
||||
|
@ -506,8 +506,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
|||
// This extra margin is used to merge too close shapes
|
||||
// (distance < aMinThickness), and will be removed when creating
|
||||
// the actual shapes
|
||||
std::vector <CPolyPt> bufferPolys; // Contains shapes to plot
|
||||
std::vector <CPolyPt> initialPolys; // Contains exact shapes to plot
|
||||
CPOLYGONS_LIST bufferPolys; // Contains shapes to plot
|
||||
CPOLYGONS_LIST initialPolys; // Contains exact shapes to plot
|
||||
|
||||
/* calculates the coeff to compensate radius reduction of holes clearance
|
||||
* due to the segment approx ( 1 /cos( PI/circleToSegmentsCount )
|
||||
|
|
|
@ -506,7 +506,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
|
|||
*/
|
||||
void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
|
||||
{
|
||||
std::vector<CPolyPt> polysList = aZone->GetFilledPolysList();
|
||||
const CPOLYGONS_LIST& polysList = aZone->GetFilledPolysList();
|
||||
unsigned imax = polysList.size();
|
||||
|
||||
if( imax == 0 ) // Nothing to draw
|
||||
|
@ -526,10 +526,10 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
|
|||
*/
|
||||
for( unsigned ic = 0; ic < imax; ic++ )
|
||||
{
|
||||
CPolyPt* corner = &polysList[ic];
|
||||
cornerList.push_back( wxPoint( corner->x, corner->y) );
|
||||
const CPolyPt& corner = polysList[ic];
|
||||
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
|
||||
if( cornerList[0] != cornerList[cornerList.size() - 1] )
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
*/
|
||||
|
||||
bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb,
|
||||
std::vector <CPolyPt>* aCornerBuffer )
|
||||
CPOLYGONS_LIST* aCornerBuffer )
|
||||
{
|
||||
if( aCornerBuffer == NULL )
|
||||
m_FilledPolysList.clear();
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#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,
|
||||
double aArcCorrection,
|
||||
int aRoundPadThermalRotation);
|
||||
|
@ -72,7 +72,7 @@ extern void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCorn
|
|||
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
|
||||
ZONE_CONTAINER* aZone_container );
|
||||
|
||||
extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
||||
extern void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
|
||||
D_PAD& aPad,
|
||||
int aThermalGap,
|
||||
int aCopperThickness,
|
||||
|
@ -187,7 +187,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
int item_clearance;
|
||||
|
||||
// static to avoid unnecessary memory allocation when filling many zones.
|
||||
static std::vector <CPolyPt> cornerBufferPolysToSubstract;
|
||||
static CPOLYGONS_LIST cornerBufferPolysToSubstract;
|
||||
cornerBufferPolysToSubstract.clear();
|
||||
|
||||
/* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
* false to create the outline polygon.
|
||||
*/
|
||||
void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
|
||||
std::vector <CPolyPt>& aCornerBuffer,
|
||||
CPOLYGONS_LIST& aCornerBuffer,
|
||||
int aClearanceValue, bool aAddClearance )
|
||||
{
|
||||
// Creates the zone outlines polygon (with linked holes if any)
|
||||
std::vector <CPolyPt> zoneOutines;
|
||||
CPOLYGONS_LIST zoneOutines;
|
||||
BuildFilledSolidAreasPolygons( NULL, &zoneOutines );
|
||||
|
||||
// add clearance to outline
|
||||
|
@ -119,14 +119,14 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
|
|||
* Function BuildUnconnectedThermalStubsPolygonList
|
||||
* Creates a set of polygons corresponding to stubs created by thermal shapes on pads
|
||||
* 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 aZone = 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
|
||||
*/
|
||||
|
||||
void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffer,
|
||||
void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
|
||||
BOARD* aPcb,
|
||||
ZONE_CONTAINER* aZone,
|
||||
double aArcCorrection,
|
||||
|
|
|
@ -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
|
||||
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++ )
|
||||
{
|
||||
// end of a filled sub-area found
|
||||
|
|
|
@ -1204,7 +1204,7 @@ int CPolyLine::Distance( const wxPoint& aPoint )
|
|||
* @param aPolysList = the list of corners of contours
|
||||
* @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 )
|
||||
{
|
||||
unsigned corners_count = aPolysList.size();
|
||||
|
@ -1261,8 +1261,8 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList,
|
|||
* @param aPolysListWithHoles = the list of corners of contours (haing holes
|
||||
* @param aOnePolyList = a polygon with no holes
|
||||
*/
|
||||
void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysListWithHoles,
|
||||
std::vector<CPolyPt>& aOnePolyList )
|
||||
void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWithHoles,
|
||||
CPOLYGONS_LIST& aOnePolyList )
|
||||
{
|
||||
unsigned corners_count = aPolysListWithHoles.size();
|
||||
|
||||
|
@ -1338,9 +1338,7 @@ void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysL
|
|||
aOnePolyList.push_back( corner );
|
||||
}
|
||||
|
||||
corner.end_contour = true;
|
||||
aOnePolyList.pop_back();
|
||||
aOnePolyList.push_back( corner );
|
||||
aOnePolyList.back().end_contour = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,6 +76,14 @@ public:
|
|||
{ 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
|
||||
{
|
||||
|
@ -191,7 +199,7 @@ public:
|
|||
|
||||
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; };
|
||||
void SetUtility( int ic, int utility ) { m_CornersList[ic].m_utility = utility; };
|
||||
|
@ -262,7 +270,7 @@ private:
|
|||
int m_utility; // a flag used in some calculations
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
@ -273,8 +281,8 @@ public:
|
|||
* @param aPolysList = the list of corners of contours
|
||||
* @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate
|
||||
*/
|
||||
void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList,
|
||||
KI_POLYGON_WITH_HOLES& aPolygoneWithHole );
|
||||
void CopyPolysListToKiPolygonWithHole( const CPOLYGONS_LIST& aPolysList,
|
||||
KI_POLYGON_WITH_HOLES& aPolygoneWithHole );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -286,7 +294,7 @@ void CopyPolysListToKiPolygonWithHole( const std::vector<CPolyPt>& aPolysList,
|
|||
* @param aPolysListWithHoles = the list of corners of contours (haing holes
|
||||
* @param aOnePolyList = a polygon with no holes
|
||||
*/
|
||||
void ConvertPolysListWithHolesToOnePolygon( const std::vector<CPolyPt>& aPolysListWithHoles,
|
||||
std::vector<CPolyPt>& aOnePolyList );
|
||||
void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWithHoles,
|
||||
CPOLYGONS_LIST& aOnePolyList );
|
||||
|
||||
#endif // #ifndef POLYLINE_H
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#define OUTSIDE false
|
||||
#define INSIDE true
|
||||
|
||||
bool TestPointInsidePolygon( std::vector <CPolyPt> aPolysList,
|
||||
int aIdxstart,
|
||||
int aIdxend,
|
||||
int aRefx,
|
||||
int aRefy)
|
||||
bool TestPointInsidePolygon( CPOLYGONS_LIST aPolysList,
|
||||
int aIdxstart,
|
||||
int aIdxend,
|
||||
int aRefx,
|
||||
int aRefy)
|
||||
|
||||
/**
|
||||
* Function TestPointInsidePolygon
|
||||
|
|
Loading…
Reference in New Issue