Split out FILL_T to its own header to avoid spreading eda_item everywhere

This commit is contained in:
Marek Roszko 2020-10-14 21:45:20 -04:00
parent 5a0281d4ab
commit 1538d737e7
50 changed files with 341 additions and 308 deletions

View File

@ -446,7 +446,7 @@ kbool:
================================================================================ ================================================================================
+eeschema +eeschema
Fixed a bug plotting pins with circles in them from eeschema. Fixed a bug plotting pins with circles in them from eeschema.
Added type FILL_T. Added type FILL_TYPE.
2008-Aug-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Aug-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -50,6 +50,7 @@
#include <eda_rect.h> #include <eda_rect.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <fill_type.h>
#include <page_layout/ws_draw_item.h> #include <page_layout/ws_draw_item.h>
#include <page_layout/ws_data_item.h> #include <page_layout/ws_data_item.h>
#include <page_layout/ws_data_model.h> #include <page_layout/ws_data_model.h>
@ -215,7 +216,7 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( RENDER_SETTINGS* aSettings, const w
outline.CPoint( ii ).y + aOffset.y ); outline.CPoint( ii ).y + aOffset.y );
} }
GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], FILLED_SHAPE, penWidth, GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], true, penWidth,
color, color ); color, color );
} }
} }

View File

@ -25,10 +25,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <config.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <eda_item.h> #include <fill_type.h>
#include <plotters_specific.h> #include <plotters_specific.h>
#include <macros.h> #include <macros.h>
#include <kicad_string.h> #include <kicad_string.h>
@ -424,7 +422,7 @@ void DXF_PLOTTER::SetColor( COLOR4D color )
/** /**
* DXF rectangle: fill not supported * DXF rectangle: fill not supported
*/ */
void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
MoveTo( p1 ); MoveTo( p1 );
@ -441,7 +439,7 @@ void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
* *
* I could use this trick to do other filled primitives * I could use this trick to do other filled primitives
*/ */
void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int width ) void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
double radius = userToDeviceSize( diameter / 2 ); double radius = userToDeviceSize( diameter / 2 );
@ -450,14 +448,14 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
{ {
wxString cname = getDXFColorName( m_currentColor ); wxString cname = getDXFColorName( m_currentColor );
if( !fill ) if( fill == FILL_TYPE::NO_FILL )
{ {
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n", fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
TO_UTF8( cname ), TO_UTF8( cname ),
centre_dev.x, centre_dev.y, radius ); centre_dev.x, centre_dev.y, radius );
} }
if( fill == FILLED_SHAPE ) if( fill == FILL_TYPE::FILLED_SHAPE )
{ {
double r = radius*0.5; double r = radius*0.5;
fprintf( outputFile, "0\nPOLYLINE\n"); fprintf( outputFile, "0\nPOLYLINE\n");
@ -482,7 +480,7 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
* are converted to inflated polygon by aWidth/2 * are converted to inflated polygon by aWidth/2
*/ */
void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;
@ -498,7 +496,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
LineTo( aCornerList[ii] ); LineTo( aCornerList[ii] );
// Close polygon if 'fill' requested // Close polygon if 'fill' requested
if( aFill ) if( aFill != FILL_TYPE::NO_FILL )
{ {
if( aCornerList[last] != aCornerList[0] ) if( aCornerList[last] != aCornerList[0] )
LineTo( aCornerList[0] ); LineTo( aCornerList[0] );
@ -512,7 +510,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
// if the polygon outline has thickness, and is not filled // if the polygon outline has thickness, and is not filled
// (i.e. is a polyline) plot outlines with thick segments // (i.e. is a polyline) plot outlines with thick segments
if( aWidth > 0 && !aFill ) if( aWidth > 0 && aFill == FILL_TYPE::NO_FILL )
{ {
MoveTo( aCornerList[0] ); MoveTo( aCornerList[0] );
@ -634,7 +632,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
if( cornerList[0] != cornerList[cornerList.size() - 1] ) if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, NO_FILL ); PlotPoly( cornerList, FILL_TYPE::NO_FILL );
} }
else else
{ {
@ -647,7 +645,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
* Filling is not supported * Filling is not supported
*/ */
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
@ -703,7 +701,7 @@ void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode, void* aData ) EDA_DRAW_MODE_T trace_mode, void* aData )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
Circle( pos, diametre, NO_FILL ); Circle( pos, diametre, FILL_TYPE::NO_FILL );
} }

View File

@ -23,9 +23,8 @@
* @brief specialized plotter for GERBER files format * @brief specialized plotter for GERBER files format
*/ */
#include <config.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <eda_item.h> #include <fill_type.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
@ -754,7 +753,7 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
} }
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
@ -772,14 +771,14 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, in
} }
void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill, int aWidth ) void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_TYPE aFill, int aWidth )
{ {
Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth ); Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
} }
void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, FILL_T aFill, int aWidth ) int aRadius, FILL_TYPE aFill, int aWidth )
{ {
SetCurrentLineWidth( aWidth ); SetCurrentLineWidth( aWidth );
@ -841,7 +840,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList
} }
} }
PlotPoly( aCornerList, FILLED_SHAPE, 0 , gbr_metadata ); PlotPoly( aCornerList, FILL_TYPE::FILLED_SHAPE, 0, gbr_metadata );
// Clear the TA attribute, to avoid the next item to inherit it: // Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction ) if( clearTA_AperFunction )
@ -858,7 +857,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList
} }
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;
@ -871,7 +870,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
if( gbr_metadata ) if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
if( aFill ) if( aFill != FILL_TYPE::NO_FILL )
{ {
fputs( "G36*\n", outputFile ); fputs( "G36*\n", outputFile );
@ -899,7 +898,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
// Ensure the thick outline is closed for filled polygons // Ensure the thick outline is closed for filled polygons
// (if not filled, could be only a polyline) // (if not filled, could be only a polyline)
if( aFill && ( aCornerList[aCornerList.size()-1] != aCornerList[0] ) ) if( aFill != FILL_TYPE::NO_FILL &&( aCornerList[aCornerList.size() - 1] != aCornerList[0] ) )
LineTo( aCornerList[0] ); LineTo( aCornerList[0] );
PenFinish(); PenFinish();
@ -938,15 +937,14 @@ void GERBER_PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double End
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
if( tracemode == FILLED ) if( tracemode == FILLED )
Arc( centre, StAngle, EndAngle, radius, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Arc( centre, StAngle, EndAngle, radius, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
else else
{ {
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Arc( centre, StAngle, EndAngle, Arc( centre, StAngle, EndAngle,
radius - ( width - currentPenWidth ) / 2, radius - ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
NO_FILL, DO_NOT_SET_LINE_WIDTH ); DO_NOT_SET_LINE_WIDTH );
Arc( centre, StAngle, EndAngle, Arc( centre, StAngle, EndAngle, radius + ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL,
radius + ( width - currentPenWidth ) / 2, NO_FILL,
DO_NOT_SET_LINE_WIDTH ); DO_NOT_SET_LINE_WIDTH );
} }
} }
@ -962,7 +960,7 @@ void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
if( tracemode == FILLED ) if( tracemode == FILLED )
Rect( p1, p2, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Rect( p1, p2, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
else else
{ {
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
@ -970,12 +968,12 @@ void GERBER_PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
p1.y - (width - currentPenWidth) / 2 ); p1.y - (width - currentPenWidth) / 2 );
wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2, wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
p2.y + (width - currentPenWidth) / 2 ); p2.y + (width - currentPenWidth) / 2 );
Rect( offsetp1, offsetp2, NO_FILL, -1 ); Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
offsetp1.x += (width - currentPenWidth); offsetp1.x += (width - currentPenWidth);
offsetp1.y += (width - currentPenWidth); offsetp1.y += (width - currentPenWidth);
offsetp2.x -= (width - currentPenWidth); offsetp2.x -= (width - currentPenWidth);
offsetp2.y -= (width - currentPenWidth); offsetp2.y -= (width - currentPenWidth);
Rect( offsetp1, offsetp2, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
} }
@ -990,14 +988,14 @@ void GERBER_PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
if( tracemode == FILLED ) if( tracemode == FILLED )
Circle( pos, diametre, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Circle( pos, diametre, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
else else
{ {
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata );
Circle( pos, diametre - (width - currentPenWidth), Circle( pos, diametre - (width - currentPenWidth),
NO_FILL, DO_NOT_SET_LINE_WIDTH ); FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
Circle( pos, diametre + (width - currentPenWidth), Circle( pos, diametre + (width - currentPenWidth),
NO_FILL, DO_NOT_SET_LINE_WIDTH ); FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
} }
@ -1017,12 +1015,12 @@ void GERBER_PLOTTER::FilledCircle( const wxPoint& pos, int diametre,
// Draw a circle of diameter = diametre/2 with a line thickness = radius, // Draw a circle of diameter = diametre/2 with a line thickness = radius,
// To create a filled circle // To create a filled circle
SetCurrentLineWidth( diametre/2, gbr_metadata ); SetCurrentLineWidth( diametre/2, gbr_metadata );
Circle( pos, diametre/2, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Circle( pos, diametre/2, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
else else
{ {
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata );
Circle( pos, diametre, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Circle( pos, diametre, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
} }
@ -1039,7 +1037,7 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
Circle( pos, diametre - currentPenWidth, NO_FILL, DO_NOT_SET_LINE_WIDTH ); Circle( pos, diametre - currentPenWidth, FILL_TYPE::NO_FILL, DO_NOT_SET_LINE_WIDTH );
} }
else else
{ {
@ -1163,7 +1161,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
pos.y - (size.y - GetCurrentLineWidth()) / 2 ), pos.y - (size.y - GetCurrentLineWidth()) / 2 ),
wxPoint( pos.x + (size.x - GetCurrentLineWidth()) / 2, wxPoint( pos.x + (size.x - GetCurrentLineWidth()) / 2,
pos.y + (size.y - GetCurrentLineWidth()) / 2 ), pos.y + (size.y - GetCurrentLineWidth()) / 2 ),
NO_FILL, GetCurrentLineWidth() ); FILL_TYPE::NO_FILL, GetCurrentLineWidth() );
} }
else else
{ {
@ -1246,7 +1244,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
// plot outlines // plot outlines
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), gbr_metadata ); PlotPoly( cornerList, FILL_TYPE::NO_FILL, GetCurrentLineWidth(), gbr_metadata );
} }
else else
{ {
@ -1460,7 +1458,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
if( aTraceMode == SKETCH ) if( aTraceMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata ); PlotPoly( cornerList, FILL_TYPE::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
else else
PlotGerberRegion( cornerList, &gbr_metadata ); PlotGerberRegion( cornerList, &gbr_metadata );
} }
@ -1505,7 +1503,7 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
if( aPlotMode == SKETCH ) if( aPlotMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata ); PlotPoly( cornerList, FILL_TYPE::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
else else
{ {
#ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT #ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
@ -1616,7 +1614,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
if( aTrace_Mode == SKETCH ) if( aTrace_Mode == SKETCH )
{ {
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &metadata ); PlotPoly( cornerList, FILL_TYPE::NO_FILL, GetCurrentLineWidth(), &metadata );
return; return;
} }
@ -1673,7 +1671,7 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos,
cornerList.push_back( cornerList[0] ); // Close the shape cornerList.push_back( cornerList[0] ); // Close the shape
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata ); PlotPoly( cornerList, FILL_TYPE::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
} }
else else
{ {

View File

@ -194,9 +194,8 @@
*/ */
#include <config.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <eda_item.h> #include <fill_type.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
@ -274,7 +273,7 @@ void HPGL_PLOTTER::SetPenDiameter( double diameter )
/** /**
* HPGL rectangle: fill not supported * HPGL rectangle: fill not supported
*/ */
void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
DPOINT p2dev = userToDeviceCoordinates( p2 ); DPOINT p2dev = userToDeviceCoordinates( p2 );
@ -285,14 +284,14 @@ void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int
// HPGL circle // HPGL circle
void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
int width ) int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
double radius = userToDeviceSize( diameter / 2 ); double radius = userToDeviceSize( diameter / 2 );
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
if( fill == FILLED_SHAPE ) if( fill == FILL_TYPE::FILLED_SHAPE )
{ {
// Draw the filled area // Draw the filled area
MoveTo( centre ); MoveTo( centre );
@ -315,7 +314,7 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill,
*/ */
void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;
@ -323,7 +322,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
SetCurrentLineWidth( aWidth ); SetCurrentLineWidth( aWidth );
MoveTo( aCornerList[0] ); MoveTo( aCornerList[0] );
if( aFill == FILLED_SHAPE ) if( aFill == FILL_TYPE::FILLED_SHAPE )
{ {
// Draw the filled area // Draw the filled area
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
@ -346,7 +345,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
LineTo( aCornerList[ii] ); LineTo( aCornerList[ii] );
// Always close polygon if filled. // Always close polygon if filled.
if( aFill ) if( aFill != FILL_TYPE::NO_FILL )
{ {
int ii = aCornerList.size() - 1; int ii = aCornerList.size() - 1;
@ -469,7 +468,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
* Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU; * Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU;
*/ */
void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
double angle; double angle;
@ -616,7 +615,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
corners[ii] += pos; corners[ii] += pos;
} }
PlotPoly( corners, trace_mode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( corners, trace_mode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
} }
@ -655,7 +654,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
if( cornerList.back() != cornerList.front() ) if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() ); cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
} }
void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
@ -677,7 +676,7 @@ void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
if( cornerList.back() != cornerList.front() ) if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() ); cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
} }
} }
@ -699,7 +698,7 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorne
// Close polygon // Close polygon
cornerList.push_back( cornerList.front() ); cornerList.push_back( cornerList.front() );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTraceMode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
} }

View File

@ -219,7 +219,7 @@ void PDF_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
/** /**
* Rectangles in PDF. Supported by the native operator * Rectangles in PDF. Supported by the native operator
*/ */
void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
wxASSERT( workFile ); wxASSERT( workFile );
DPOINT p1_dev = userToDeviceCoordinates( p1 ); DPOINT p1_dev = userToDeviceCoordinates( p1 );
@ -227,15 +227,14 @@ void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
fprintf( workFile, "%g %g %g %g re %c\n", p1_dev.x, p1_dev.y, fprintf( workFile, "%g %g %g %g re %c\n", p1_dev.x, p1_dev.y,
p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, fill == FILL_TYPE::NO_FILL ? 'S' : 'B' );
fill == NO_FILL ? 'S' : 'B' );
} }
/** /**
* Circle drawing for PDF. They're approximated by curves, but fill is supported * Circle drawing for PDF. They're approximated by curves, but fill is supported
*/ */
void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int width ) void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE aFill, int width )
{ {
wxASSERT( workFile ); wxASSERT( workFile );
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
@ -250,9 +249,9 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
// If diameter is less than width, switch to filled mode // If diameter is less than width, switch to filled mode
if( aFill == NO_FILL && diametre < width ) if( aFill == FILL_TYPE::NO_FILL && diametre < width )
{ {
aFill = FILLED_SHAPE; aFill = FILL_TYPE::FILLED_SHAPE;
SetCurrentLineWidth( 0 ); SetCurrentLineWidth( 0 );
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) ); radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
@ -284,7 +283,7 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
pos_dev.x - radius, pos_dev.y - magic, pos_dev.x - radius, pos_dev.y - magic,
pos_dev.x - radius, pos_dev.y, pos_dev.x - radius, pos_dev.y,
aFill == NO_FILL ? 's' : 'b' ); aFill == FILL_TYPE::NO_FILL ? 's' : 'b' );
} }
@ -293,12 +292,12 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
* So no filled arcs (not a great loss... ) * So no filled arcs (not a great loss... )
*/ */
void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_TYPE fill, int width )
{ {
wxASSERT( workFile ); wxASSERT( workFile );
if( radius <= 0 ) if( radius <= 0 )
{ {
Circle( centre, width, FILLED_SHAPE, 0 ); Circle( centre, width, FILL_TYPE::FILLED_SHAPE, 0 );
return; return;
} }
@ -332,7 +331,7 @@ void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
// The arc is drawn... if not filled we stroke it, otherwise we finish // The arc is drawn... if not filled we stroke it, otherwise we finish
// closing the pie at the center // closing the pie at the center
if( fill == NO_FILL ) if( fill == FILL_TYPE::NO_FILL )
{ {
fputs( "S\n", workFile ); fputs( "S\n", workFile );
} }
@ -348,7 +347,7 @@ void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
* Polygon plotting for PDF. Everything is supported * Polygon plotting for PDF. Everything is supported
*/ */
void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
wxASSERT( workFile ); wxASSERT( workFile );
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
@ -366,7 +365,7 @@ void PDF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
} }
// Close path and stroke(/fill) // Close path and stroke(/fill)
fprintf( workFile, "%c\n", aFill == NO_FILL ? 'S' : 'b' ); fprintf( workFile, "%c\n", aFill == FILL_TYPE::NO_FILL ? 'S' : 'b' );
} }

View File

@ -27,9 +27,7 @@
* @brief Kicad: specialized plotter for PS files format * @brief Kicad: specialized plotter for PS files format
*/ */
#include <config.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <eda_item.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include <render_settings.h> #include <render_settings.h>
@ -110,7 +108,7 @@ void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
EDA_DRAW_MODE_T aTraceMode, void* aData ) EDA_DRAW_MODE_T aTraceMode, void* aData )
{ {
if( aTraceMode == FILLED ) if( aTraceMode == FILLED )
Circle( aPadPos, aDiameter, FILLED_SHAPE, 0 ); Circle( aPadPos, aDiameter, FILL_TYPE::FILLED_SHAPE, 0 );
else // Plot a ring: else // Plot a ring:
{ {
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
@ -120,7 +118,7 @@ void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
if( linewidth > aDiameter-2 ) if( linewidth > aDiameter-2 )
linewidth = aDiameter-2; linewidth = aDiameter-2;
Circle( aPadPos, aDiameter - linewidth, NO_FILL, linewidth ); Circle( aPadPos, aDiameter - linewidth, FILL_TYPE::NO_FILL, linewidth );
} }
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH ); SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
@ -172,7 +170,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL, PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
GetCurrentLineWidth() ); GetCurrentLineWidth() );
} }
@ -208,7 +206,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
// Close polygon // Close polygon
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL, PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
GetCurrentLineWidth() ); GetCurrentLineWidth() );
} }
@ -241,7 +239,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
// Close polygon // Close polygon
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL, PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
GetCurrentLineWidth() ); GetCurrentLineWidth() );
} }
} }
@ -287,7 +285,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCor
} }
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILLED_SHAPE : NO_FILL, PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
GetCurrentLineWidth() ); GetCurrentLineWidth() );
} }
@ -575,7 +573,7 @@ void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
} }
void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
DPOINT p1_dev = userToDeviceCoordinates( p1 ); DPOINT p1_dev = userToDeviceCoordinates( p1 );
DPOINT p2_dev = userToDeviceCoordinates( p2 ); DPOINT p2_dev = userToDeviceCoordinates( p2 );
@ -586,7 +584,7 @@ void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int wi
} }
void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width ) void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
@ -598,7 +596,7 @@ void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int widt
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, FILL_T fill, int width ) int radius, FILL_TYPE fill, int width )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
if( radius <= 0 ) if( radius <= 0 )
@ -634,7 +632,7 @@ void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;

View File

@ -91,11 +91,9 @@
* The center of ellipse is automatically calculated. * The center of ellipse is automatically calculated.
*/ */
#include <config.h>
#include <base64.h> #include <base64.h>
#include <eda_base_frame.h> #include <eda_base_frame.h>
#include <eda_rect.h> #include <eda_rect.h>
#include <eda_item.h>
#include <common.h> #include <common.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <trigo.h> #include <trigo.h>
@ -168,7 +166,7 @@ SVG_PLOTTER::SVG_PLOTTER()
{ {
m_graphics_changed = true; m_graphics_changed = true;
SetTextMode( PLOT_TEXT_MODE::STROKE ); SetTextMode( PLOT_TEXT_MODE::STROKE );
m_fillMode = NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR m_fillMode = FILL_TYPE::NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
m_pen_rgb_color = 0; // current color value (black) m_pen_rgb_color = 0; // current color value (black)
m_brush_rgb_color = 0; // current color value (black) m_brush_rgb_color = 0; // current color value (black)
m_dashed = PLOT_DASH_TYPE::SOLID; m_dashed = PLOT_DASH_TYPE::SOLID;
@ -219,7 +217,7 @@ void SVG_PLOTTER::SetColor( COLOR4D color )
} }
void SVG_PLOTTER::setFillMode( FILL_T fill ) void SVG_PLOTTER::setFillMode( FILL_TYPE fill )
{ {
if( m_fillMode != fill ) if( m_fillMode != fill )
{ {
@ -239,19 +237,19 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
switch( m_fillMode ) switch( m_fillMode )
{ {
case NO_FILL: case FILL_TYPE::NO_FILL:
fputs( "fill-opacity:0.0; ", outputFile ); fputs( "fill-opacity:0.0; ", outputFile );
break; break;
case FILLED_SHAPE: case FILL_TYPE::FILLED_SHAPE:
fputs( "fill-opacity:1.0; ", outputFile ); fputs( "fill-opacity:1.0; ", outputFile );
break; break;
case FILLED_WITH_BG_BODYCOLOR: case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
fputs( "fill-opacity:0.6; ", outputFile ); fputs( "fill-opacity:0.6; ", outputFile );
break; break;
case FILLED_WITH_COLOR: case FILL_TYPE::FILLED_WITH_COLOR:
wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" ); wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" );
break; break;
} }
@ -383,7 +381,7 @@ void SVG_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
} }
void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ) void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
{ {
EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) ); EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) );
rect.Normalize(); rect.Normalize();
@ -418,7 +416,7 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int w
} }
void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width ) void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int width )
{ {
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
double radius = userToDeviceSize( diametre / 2.0 ); double radius = userToDeviceSize( diametre / 2.0 );
@ -427,9 +425,9 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
// If diameter is less than width, switch to filled mode // If diameter is less than width, switch to filled mode
if( fill == NO_FILL && diametre < width ) if( fill == FILL_TYPE::NO_FILL && diametre < width )
{ {
setFillMode( FILLED_SHAPE ); setFillMode( FILL_TYPE::FILLED_SHAPE );
SetCurrentLineWidth( 0 ); SetCurrentLineWidth( 0 );
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) ); radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
@ -442,7 +440,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_TYPE fill, int width )
{ {
/* Draws an arc of a circle, centred on (xc,yc), with starting point /* Draws an arc of a circle, centred on (xc,yc), with starting point
* (x1, y1) and ending at (x2, y2). The current pen is used for the outline * (x1, y1) and ending at (x2, y2). The current pen is used for the outline
@ -454,7 +452,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
if( radius <= 0 ) if( radius <= 0 )
{ {
Circle( centre, width, FILLED_SHAPE, 0 ); Circle( centre, width, FILL_TYPE::FILLED_SHAPE, 0 );
return; return;
} }
@ -521,7 +519,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
// flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg), // flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
// sweep arc ( 0 = CCW, 1 = CW), // sweep arc ( 0 = CCW, 1 = CW),
// end point // end point
if( fill != NO_FILL ) if( fill != FILL_TYPE::NO_FILL )
{ {
// Filled arcs (in eeschema) consist of the pie wedge and a stroke only on the arc // Filled arcs (in eeschema) consist of the pie wedge and a stroke only on the arc
// This needs to be drawn in two steps. // This needs to be drawn in two steps.
@ -534,7 +532,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
end.x, end.y, centre_dev.x, centre_dev.y ); end.x, end.y, centre_dev.x, centre_dev.y );
} }
setFillMode( NO_FILL ); setFillMode( FILL_TYPE::NO_FILL );
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
fprintf( outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n", fprintf( outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n",
start.x, start.y, radius_dev, radius_dev, start.x, start.y, radius_dev, radius_dev,
@ -548,7 +546,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
int aTolerance, int aLineThickness ) int aTolerance, int aLineThickness )
{ {
#if 1 #if 1
setFillMode( NO_FILL ); setFillMode( FILL_TYPE::NO_FILL );
SetCurrentLineWidth( aLineThickness ); SetCurrentLineWidth( aLineThickness );
DPOINT start = userToDeviceCoordinates( aStart ); DPOINT start = userToDeviceCoordinates( aStart );
@ -567,7 +565,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
FILL_T aFill, int aWidth, void * aData ) FILL_TYPE aFill, int aWidth, void * aData )
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;
@ -578,16 +576,16 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
switch( aFill ) switch( aFill )
{ {
case NO_FILL: case FILL_TYPE::NO_FILL:
setSVGPlotStyle( false, "fill:none" ); setSVGPlotStyle( false, "fill:none" );
break; break;
case FILLED_WITH_BG_BODYCOLOR: case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
case FILLED_SHAPE: case FILL_TYPE::FILLED_SHAPE:
setSVGPlotStyle( false, "fill-rule:evenodd;" ); setSVGPlotStyle( false, "fill-rule:evenodd;" );
break; break;
case FILLED_WITH_COLOR: case FILL_TYPE::FILLED_WITH_COLOR:
wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" ); wxFAIL_MSG( "FILLED_WITH_COLOR not implemented" );
break; break;
} }
@ -686,9 +684,9 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
// Ensure we do not use a fill mode when moving tne pen, // Ensure we do not use a fill mode when moving tne pen,
// in SVG mode (i;e. we are plotting only basic lines, not a filled area // in SVG mode (i;e. we are plotting only basic lines, not a filled area
if( m_fillMode != NO_FILL ) if( m_fillMode != FILL_TYPE::NO_FILL )
{ {
setFillMode( NO_FILL ); setFillMode( FILL_TYPE::NO_FILL );
setSVGPlotStyle(); setSVGPlotStyle();
} }
@ -791,7 +789,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
setFillMode( NO_FILL ); setFillMode( FILL_TYPE::NO_FILL );
SetColor( aColor ); SetColor( aColor );
SetCurrentLineWidth( aWidth ); SetCurrentLineWidth( aWidth );

View File

@ -104,7 +104,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
{ {
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item; WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth ); int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL, penWidth ); plotter->Rect( rect->GetStart(), rect->GetEnd(), FILL_TYPE::NO_FILL, penWidth );
} }
break; break;
@ -133,7 +133,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
for( int ii = 0; ii < outline.PointCount(); ii++ ) for( int ii = 0; ii < outline.PointCount(); ii++ )
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
plotter->PlotPoly( points, FILLED_SHAPE, penWidth ); plotter->PlotPoly( points, FILL_TYPE::FILLED_SHAPE, penWidth );
} }
} }
break; break;

View File

@ -37,6 +37,7 @@
* is not handled here. * is not handled here.
*/ */
#include <fill_type.h>
#include <vector> #include <vector>
#include <trigo.h> #include <trigo.h>
#include <eda_item.h> #include <eda_item.h>
@ -154,7 +155,7 @@ double PLOTTER::GetDashGapLenIU() const
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_TYPE fill, int width )
{ {
wxPoint start, end; wxPoint start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles const int delta = 50; // increment (in 0.1 degrees) to draw circles
@ -167,7 +168,7 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) ); start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) ); start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
if( fill != NO_FILL ) if( fill != FILL_TYPE::NO_FILL )
{ {
MoveTo( centre ); MoveTo( centre );
LineTo( start ); LineTo( start );
@ -187,7 +188,7 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) ); end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) ); end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
if( fill != NO_FILL ) if( fill != FILL_TYPE::NO_FILL )
{ {
LineTo( end ); LineTo( end );
FinishTo( centre ); FinishTo( centre );
@ -240,7 +241,7 @@ void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos, double aSca
end.x += size.x; end.x += size.x;
end.y += size.y; end.y += size.y;
Rect( start, end, NO_FILL ); Rect( start, end, FILL_TYPE::NO_FILL );
} }
@ -265,13 +266,13 @@ void PLOTTER::markerSquare( const wxPoint& position, int radius )
corner.y = position.y + r; corner.y = position.y + r;
corner_list.push_back( corner ); corner_list.push_back( corner );
PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() ); PlotPoly( corner_list, FILL_TYPE::NO_FILL, GetCurrentLineWidth() );
} }
void PLOTTER::markerCircle( const wxPoint& position, int radius ) void PLOTTER::markerCircle( const wxPoint& position, int radius )
{ {
Circle( position, radius * 2, NO_FILL, GetCurrentLineWidth() ); Circle( position, radius * 2, FILL_TYPE::NO_FILL, GetCurrentLineWidth() );
} }
@ -295,7 +296,7 @@ void PLOTTER::markerLozenge( const wxPoint& position, int radius )
corner.y = position.y + radius; corner.y = position.y + radius;
corner_list.push_back( corner ); corner_list.push_back( corner );
PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() ); PlotPoly( corner_list, FILL_TYPE::NO_FILL, GetCurrentLineWidth() );
} }
@ -492,13 +493,13 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient
RotatePoint( &cx, &cy, orient ); RotatePoint( &cx, &cy, orient );
Arc( wxPoint( cx + pos.x, cy + pos.y ), Arc( wxPoint( cx + pos.x, cy + pos.y ),
orient + 1800, orient + 3600, orient + 1800, orient + 3600,
radius, NO_FILL ); radius, FILL_TYPE::NO_FILL );
cx = 0; cx = 0;
cy = -deltaxy / 2; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient ); RotatePoint( &cx, &cy, orient );
Arc( wxPoint( cx + pos.x, cy + pos.y ), Arc( wxPoint( cx + pos.x, cy + pos.y ),
orient, orient + 1800, orient, orient + 1800,
radius, NO_FILL ); radius, FILL_TYPE::NO_FILL );
} }
@ -509,7 +510,7 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
{ {
if( start == end ) if( start == end )
{ {
Circle( start, width, FILLED_SHAPE, 0 ); Circle( start, width, FILL_TYPE::FILLED_SHAPE, 0 );
} }
else else
{ {
@ -530,14 +531,14 @@ void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, int width, EDA_DRAW_MODE_T tracemode, void* aData ) int radius, int width, EDA_DRAW_MODE_T tracemode, void* aData )
{ {
if( tracemode == FILLED ) if( tracemode == FILLED )
Arc( centre, StAngle, EndAngle, radius, NO_FILL, width ); Arc( centre, StAngle, EndAngle, radius, FILL_TYPE::NO_FILL, width );
else else
{ {
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
Arc( centre, StAngle, EndAngle, Arc( centre, StAngle, EndAngle,
radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 ); radius - ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
Arc( centre, StAngle, EndAngle, Arc( centre, StAngle, EndAngle,
radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 ); radius + ( width - currentPenWidth ) / 2, FILL_TYPE::NO_FILL, -1 );
} }
} }
@ -546,7 +547,7 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
EDA_DRAW_MODE_T tracemode, void* aData ) EDA_DRAW_MODE_T tracemode, void* aData )
{ {
if( tracemode == FILLED ) if( tracemode == FILLED )
Rect( p1, p2, NO_FILL, width ); Rect( p1, p2, FILL_TYPE::NO_FILL, width );
else else
{ {
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
@ -554,12 +555,12 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
p1.y - (width - currentPenWidth) / 2 ); p1.y - (width - currentPenWidth) / 2 );
wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2, wxPoint offsetp2( p2.x + (width - currentPenWidth) / 2,
p2.y + (width - currentPenWidth) / 2 ); p2.y + (width - currentPenWidth) / 2 );
Rect( offsetp1, offsetp2, NO_FILL, -1 ); Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
offsetp1.x += (width - currentPenWidth); offsetp1.x += (width - currentPenWidth);
offsetp1.y += (width - currentPenWidth); offsetp1.y += (width - currentPenWidth);
offsetp2.x -= (width - currentPenWidth); offsetp2.x -= (width - currentPenWidth);
offsetp2.y -= (width - currentPenWidth); offsetp2.y -= (width - currentPenWidth);
Rect( offsetp1, offsetp2, NO_FILL, -1 ); Rect( offsetp1, offsetp2, FILL_TYPE::NO_FILL, -1 );
} }
} }
@ -568,12 +569,12 @@ void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width,
EDA_DRAW_MODE_T tracemode, void* aData ) EDA_DRAW_MODE_T tracemode, void* aData )
{ {
if( tracemode == FILLED ) if( tracemode == FILLED )
Circle( pos, diametre, NO_FILL, width ); Circle( pos, diametre, FILL_TYPE::NO_FILL, width );
else else
{ {
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 ); Circle( pos, diametre - width + currentPenWidth, FILL_TYPE::NO_FILL, -1 );
Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 ); Circle( pos, diametre + width - currentPenWidth, FILL_TYPE::NO_FILL, -1 );
} }
} }
@ -582,16 +583,16 @@ void PLOTTER::FilledCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T tracemode, void* aData ) EDA_DRAW_MODE_T tracemode, void* aData )
{ {
if( tracemode == FILLED ) if( tracemode == FILLED )
Circle( pos, diametre, FILLED_SHAPE, 0 ); Circle( pos, diametre, FILL_TYPE::FILLED_SHAPE, 0 );
else else
{ {
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
Circle( pos, diametre, NO_FILL, -1 ); Circle( pos, diametre, FILL_TYPE::NO_FILL, -1 );
} }
} }
void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_TYPE aFill,
int aWidth, void * aData ) int aWidth, void * aData )
{ {
std::vector<wxPoint> cornerList; std::vector<wxPoint> cornerList;

View File

@ -27,7 +27,7 @@
#include <vector> #include <vector>
#include <math/box2.h> #include <math/box2.h>
#include <eda_item.h> // FILL_T #include <eda_item.h> // FILL_TYPE
#include <plotter.h> #include <plotter.h>
@ -76,16 +76,16 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override; FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) override;
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode, void* aData ) override; EDA_DRAW_MODE_T tracemode, void* aData ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override; virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void FlashPadCircle( const wxPoint& pos, int diametre, virtual void FlashPadCircle( const wxPoint& pos, int diametre,

View File

@ -28,7 +28,7 @@
#include <vector> #include <vector>
#include <math/box2.h> #include <math/box2.h>
#include <eda_item.h> // FILL_T #include <eda_item.h> // FILL_TYPE
#include <plotter.h> #include <plotter.h>
#include "gbr_plotter_apertures.h" #include "gbr_plotter_apertures.h"
@ -69,12 +69,12 @@ public:
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
// Basic plot primitives // Basic plot primitives
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override; int aRadius, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
// These functions plot an item and manage X2 gerber attributes // These functions plot an item and manage X2 gerber attributes
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
@ -94,7 +94,7 @@ public:
* appropriate G36/G37 sequence * appropriate G36/G37 sequence
*/ */
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
void* aData = nullptr ) override; void* aData = nullptr ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override; virtual void PenTo( const wxPoint& pos, char plume ) override;

View File

@ -27,7 +27,7 @@
#include <vector> #include <vector>
#include <math/box2.h> #include <math/box2.h>
#include <eda_item.h> // FILL_T #include <eda_item.h> // FILL_TYPE
#include <plotter.h> #include <plotter.h>
@ -74,18 +74,18 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
void * aData = NULL) override; void * aData = NULL) override;
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode, void* aData ) override; EDA_DRAW_MODE_T tracemode, void* aData ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override; virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter, virtual void FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
EDA_DRAW_MODE_T aTraceMode, void* aData ) override; EDA_DRAW_MODE_T aTraceMode, void* aData ) override;

View File

@ -27,7 +27,7 @@
#include <vector> #include <vector>
#include <math/box2.h> #include <math/box2.h>
#include <eda_item.h> // FILL_T #include <eda_item.h> // FILL_TYPE
#include <plotter.h> #include <plotter.h>
@ -160,15 +160,15 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
void * aData = NULL ) override; void * aData = NULL ) override;
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos, virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
@ -234,15 +234,15 @@ public:
* with the outputFile open (but not inside a page stream!) */ * with the outputFile open (but not inside a page stream!) */
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
void * aData = NULL ) override; void * aData = NULL ) override;
virtual void PenTo( const wxPoint& pos, char plume ) override; virtual void PenTo( const wxPoint& pos, char plume ) override;
@ -308,12 +308,12 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override; double aScale, bool aMirror ) override;
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) override; int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH ) override;
virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1, virtual void BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
const wxPoint& aControl2, const wxPoint& aEnd, const wxPoint& aControl2, const wxPoint& aEnd,
@ -321,7 +321,7 @@ public:
int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override; int aLineThickness = USE_DEFAULT_LINE_WIDTH ) override;
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH, FILL_TYPE aFill, int aWidth = USE_DEFAULT_LINE_WIDTH,
void * aData = NULL ) override; void * aData = NULL ) override;
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos, virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
@ -370,7 +370,7 @@ public:
void* aData = NULL ) override; void* aData = NULL ) override;
protected: protected:
FILL_T m_fillMode; // true if the current contour FILL_TYPE m_fillMode; // true if the current contour
// rect, arc, circle, polygon must be filled // rect, arc, circle, polygon must be filled
long m_pen_rgb_color; // current rgb color value: each color has long m_pen_rgb_color; // current rgb color value: each color has
// a value 0 ... 255, and the 3 colors are // a value 0 ... 255, and the 3 colors are
@ -410,5 +410,5 @@ protected:
* function setFillMode() * function setFillMode()
* prepare parameters for setSVGPlotStyle() * prepare parameters for setSVGPlotStyle()
*/ */
void setFillMode( FILL_T fill ); void setFillMode( FILL_TYPE fill );
}; };

View File

@ -446,7 +446,7 @@ void LIB_PART::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aM
{ {
for( LIB_ITEM& drawItem : m_drawings ) for( LIB_ITEM& drawItem : m_drawings )
{ {
if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR ) if( drawItem.m_Fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
continue; continue;
// Do not draw items not attached to the current part // Do not draw items not attached to the current part
@ -495,7 +495,7 @@ void LIB_PART::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aM
} }
else else
{ {
bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR; bool forceNoFill = drawItem.m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
drawItem.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform ); drawItem.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
} }
} }
@ -525,7 +525,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) ) if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue; continue;
if( item.m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( item.m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
item.Plot( aPlotter, aOffset, fill, aTransform ); item.Plot( aPlotter, aOffset, fill, aTransform );
} }
@ -542,7 +542,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) ) if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue; continue;
item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILLED_WITH_BG_BODYCOLOR ), item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILL_TYPE::FILLED_WITH_BG_BODYCOLOR ),
aTransform ); aTransform );
} }
} }

View File

@ -69,7 +69,7 @@ bool DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow()
m_checkApplyToAllConversions->Enable( enblConvOptStyle ); m_checkApplyToAllConversions->Enable( enblConvOptStyle );
m_fillCtrl->SetSelection( m_item->GetFillMode() ); m_fillCtrl->SetSelection( static_cast<int>( m_item->GetFillMode() ) );
m_fillCtrl->Enable( m_item->IsFillable() ); m_fillCtrl->Enable( m_item->IsFillable() );
return true; return true;

View File

@ -341,7 +341,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
comp_body->SetUnit( 0 ); comp_body->SetUnit( 0 );
comp_body->SetConvert( 0 ); comp_body->SetConvert( 0 );
comp_body->SetWidth( Mils2iu( 10 ) ); comp_body->SetWidth( Mils2iu( 10 ) );
comp_body->SetFillMode( FILLED_WITH_BG_BODYCOLOR ); comp_body->SetFillMode( FILL_TYPE::FILLED_WITH_BG_BODYCOLOR );
comp_body->AddPoint( wxPoint( Mils2iu( p.x - 200 ), Mils2iu( p.y + 200 ) ) ); comp_body->AddPoint( wxPoint( Mils2iu( p.x - 200 ), Mils2iu( p.y + 200 ) ) );
comp_body->AddPoint( wxPoint( Mils2iu( p.x + 200 ), Mils2iu( p.y ) ) ); comp_body->AddPoint( wxPoint( Mils2iu( p.x + 200 ), Mils2iu( p.y ) ) );
comp_body->AddPoint( wxPoint( Mils2iu( p.x - 200 ), Mils2iu( p.y - 200 ) ) ); comp_body->AddPoint( wxPoint( Mils2iu( p.x - 200 ), Mils2iu( p.y - 200 ) ) );

View File

@ -50,7 +50,7 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
m_t1 = 0; m_t1 = 0;
m_t2 = 0; m_t2 = 0;
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = FILL_TYPE::NO_FILL;
m_isFillable = true; m_isFillable = true;
m_editState = 0; m_editState = 0;
} }
@ -261,13 +261,13 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
aTransform.MapAngles( &t1, &t2 ); aTransform.MapAngles( &t1, &t2 );
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_WITH_BG_BODYCOLOR, 0 ); aPlotter->Arc( pos, -t2, -t1, m_Radius, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
} }
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
int pen_size = GetPenWidth(); int pen_size = GetPenWidth();
if( !already_filled || pen_size > 0 ) if( !already_filled || pen_size > 0 )
@ -275,7 +275,8 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() ); pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, pen_size ); aPlotter->Arc(
pos, -t2, -t1, m_Radius, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
} }
} }
@ -283,7 +284,7 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_ARC::GetPenWidth() const int LIB_ARC::GetPenWidth() const
{ {
// Historically 0 meant "default width" and negative numbers meant "don't stroke". // Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( m_Width < 0 && GetFillMode() != NO_FILL ) if( m_Width < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
return 0; return 0;
else else
return std::max( m_Width, 1 ); return std::max( m_Width, 1 );
@ -296,7 +297,7 @@ void LIB_ARC::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
if( forceNoFill && m_Fill != NO_FILL && penWidth == 0 ) if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
return; return;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -316,7 +317,7 @@ void LIB_ARC::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
std::swap( pos1.y, pos2.y ); std::swap( pos1.y, pos2.y );
} }
if( forceNoFill || m_Fill == NO_FILL ) if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
{ {
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
@ -324,7 +325,7 @@ void LIB_ARC::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* a
} }
else else
{ {
if( m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND ); color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penWidth, color, color ); GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penWidth, color, color );

View File

@ -38,7 +38,7 @@
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) : LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
LIB_ITEM( LIB_BEZIER_T, aParent ) LIB_ITEM( LIB_BEZIER_T, aParent )
{ {
m_Fill = NO_FILL; m_Fill = FILL_TYPE::NO_FILL;
m_Width = 0; m_Width = 0;
m_isFillable = true; m_isFillable = true;
} }
@ -173,13 +173,13 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
cornerList.push_back( pos ); cornerList.push_back( pos );
} }
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 ); aPlotter->PlotPoly( cornerList, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
} }
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
int pen_size = GetPenWidth(); int pen_size = GetPenWidth();
if( !already_filled || pen_size > 0 ) if( !already_filled || pen_size > 0 )
@ -187,7 +187,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() ); pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size ); aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
} }
} }
@ -195,7 +195,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_BEZIER::GetPenWidth() const int LIB_BEZIER::GetPenWidth() const
{ {
// Historically 0 meant "default width" and negative numbers meant "don't stroke". // Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( m_Width < 0 && GetFillMode() != NO_FILL ) if( m_Width < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
return 0; return 0;
else else
return std::max( m_Width, 1 ); return std::max( m_Width, 1 );
@ -208,7 +208,7 @@ void LIB_BEZIER::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
if( forceNoFill && m_Fill != NO_FILL && penWidth == 0 ) if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
return; return;
std::vector<wxPoint> PolyPointsTraslated; std::vector<wxPoint> PolyPointsTraslated;
@ -223,7 +223,7 @@ void LIB_BEZIER::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void
for( wxPoint& point : m_PolyPoints ) for( wxPoint& point : m_PolyPoints )
PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset ); PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset );
if( forceNoFill || m_Fill == NO_FILL ) if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
{ {
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
@ -232,7 +232,7 @@ void LIB_BEZIER::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void
} }
else else
{ {
if( m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND ); color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth, GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,

View File

@ -40,7 +40,7 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
LIB_ITEM( LIB_CIRCLE_T, aParent ) LIB_ITEM( LIB_CIRCLE_T, aParent )
{ {
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = FILL_TYPE::NO_FILL;
m_isFillable = true; m_isFillable = true;
} }
@ -164,13 +164,13 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
{ {
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset; wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Circle( pos, GetRadius() * 2, FILLED_WITH_BG_BODYCOLOR, 0 ); aPlotter->Circle( pos, GetRadius() * 2, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
} }
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
int pen_size = GetPenWidth(); int pen_size = GetPenWidth();
if( !already_filled || pen_size > 0 ) if( !already_filled || pen_size > 0 )
@ -178,7 +178,8 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() ); pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Circle( pos, GetRadius() * 2, already_filled ? NO_FILL : m_Fill, pen_size ); aPlotter->Circle(
pos, GetRadius() * 2, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
} }
} }
@ -186,7 +187,7 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_CIRCLE::GetPenWidth() const int LIB_CIRCLE::GetPenWidth() const
{ {
// Historically 0 meant "default width" and negative numbers meant "don't stroke". // Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( m_Width < 0 && GetFillMode() != NO_FILL ) if( m_Width < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
return 0; return 0;
else else
return std::max( m_Width, 1 ); return std::max( m_Width, 1 );
@ -199,14 +200,14 @@ void LIB_CIRCLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
if( forceNoFill && m_Fill != NO_FILL && penWidth == 0 ) if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
return; return;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset; wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE ); COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
if( forceNoFill || m_Fill == NO_FILL ) if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
{ {
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
@ -214,7 +215,7 @@ void LIB_CIRCLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void
} }
else else
{ {
if( m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND ); color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), 0, color, color ); GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), 0, color, color );

View File

@ -29,14 +29,14 @@
#include <general.h> #include <general.h>
#include <lib_item.h> #include <lib_item.h>
const int fill_tab[3] = { 'N', 'F', 'f' }; const int FILL_TYPEab[3] = { 'N', 'F', 'f' };
LIB_ITEM::LIB_ITEM( KICAD_T aType, LIB_ITEM::LIB_ITEM( KICAD_T aType,
LIB_PART* aComponent, LIB_PART* aComponent,
int aUnit, int aUnit,
int aConvert, int aConvert,
FILL_T aFillType ) : FILL_TYPE aFillType ) :
EDA_ITEM( aType ) EDA_ITEM( aType )
{ {
m_Unit = aUnit; m_Unit = aUnit;
@ -84,7 +84,7 @@ int LIB_ITEM::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareF
return m_Convert - m_Convert; return m_Convert - m_Convert;
if( m_Fill != aOther.m_Fill ) if( m_Fill != aOther.m_Fill )
return m_Fill - aOther.m_Fill; return static_cast<int>( m_Fill ) - static_cast<int>( aOther.m_Fill );
return 0; return 0;
} }

View File

@ -28,6 +28,7 @@
#include <eda_item.h> #include <eda_item.h>
#include <eda_rect.h> #include <eda_rect.h>
#include <fill_type.h>
#include <transform.h> #include <transform.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <render_settings.h> #include <render_settings.h>
@ -41,7 +42,7 @@ class MSG_PANEL_ITEM;
using KIGFX::RENDER_SETTINGS; using KIGFX::RENDER_SETTINGS;
extern const int fill_tab[]; extern const int FILL_TYPEab[];
#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in internal units #define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in internal units
@ -88,15 +89,15 @@ protected:
/** /**
* The body fill type. This has meaning only for some items. For a list of fill types * The body fill type. This has meaning only for some items. For a list of fill types
* see #FILL_T. * see #FILL_TYPE.
*/ */
FILL_T m_Fill; FILL_TYPE m_Fill;
bool m_isFillable; bool m_isFillable;
public: public:
LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0, LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0,
FILL_T aFillType = NO_FILL ); FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -297,8 +298,8 @@ public:
void SetConvert( int aConvert ) { m_Convert = aConvert; } void SetConvert( int aConvert ) { m_Convert = aConvert; }
int GetConvert() const { return m_Convert; } int GetConvert() const { return m_Convert; }
void SetFillMode( FILL_T aFillMode ) { m_Fill = aFillMode; } void SetFillMode( FILL_TYPE aFillMode ) { m_Fill = aFillMode; }
FILL_T GetFillMode() const { return m_Fill; } FILL_TYPE GetFillMode() const { return m_Fill; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }

View File

@ -526,7 +526,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
{ {
const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this ); const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this );
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
NO_FILL, penWidth ); FILL_TYPE::NO_FILL, penWidth );
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) ); aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
aPlotter->FinishTo( aPosition ); aPlotter->FinishTo( aPosition );

View File

@ -39,7 +39,7 @@
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) : LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
LIB_ITEM( LIB_POLYLINE_T, aParent ) LIB_ITEM( LIB_POLYLINE_T, aParent )
{ {
m_Fill = NO_FILL; m_Fill = FILL_TYPE::NO_FILL;
m_Width = 0; m_Width = 0;
m_isFillable = true; m_isFillable = true;
} }
@ -132,13 +132,13 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
cornerList.push_back( pos ); cornerList.push_back( pos );
} }
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 ); aPlotter->PlotPoly( cornerList, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
} }
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
int pen_size = GetPenWidth(); int pen_size = GetPenWidth();
if( !already_filled || pen_size > 0 ) if( !already_filled || pen_size > 0 )
@ -146,7 +146,7 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetDefaultPenWidth() ); pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetDefaultPenWidth() );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size ); aPlotter->PlotPoly( cornerList, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
} }
} }
@ -186,7 +186,7 @@ void LIB_POLYLINE::RemoveCorner( int aIdx )
int LIB_POLYLINE::GetPenWidth() const int LIB_POLYLINE::GetPenWidth() const
{ {
// Historically 0 meant "default width" and negative numbers meant "don't stroke". // Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( m_Width < 0 && GetFillMode() != NO_FILL ) if( m_Width < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
return 0; return 0;
else else
return std::max( m_Width, 1 ); return std::max( m_Width, 1 );
@ -199,7 +199,7 @@ void LIB_POLYLINE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, vo
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
if( forceNoFill && m_Fill != NO_FILL && penWidth == 0 ) if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
return; return;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -209,7 +209,7 @@ void LIB_POLYLINE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, vo
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ ) for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset; buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
if( forceNoFill || m_Fill == NO_FILL ) if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
{ {
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
@ -217,7 +217,7 @@ void LIB_POLYLINE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, vo
} }
else else
{ {
if( m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND ); color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, color, color ); GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, color, color );
@ -235,7 +235,7 @@ bool LIB_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
for( wxPoint pt : m_PolyPoints ) for( wxPoint pt : m_PolyPoints )
shape.Append( DefaultTransform.TransformCoordinate( pt ) ); shape.Append( DefaultTransform.TransformCoordinate( pt ) );
if( m_Fill != NO_FILL && m_PolyPoints.size() > 2 ) if( m_Fill != FILL_TYPE::NO_FILL && m_PolyPoints.size() > 2 )
{ {
shape.SetClosed( true ); shape.SetClosed( true );
return shape.PointInside( aPosition, delta ); return shape.PointInside( aPosition, delta );
@ -266,7 +266,7 @@ bool LIB_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
sel.Inflate( ( GetPenWidth() / 2 ) + 1 ); sel.Inflate( ( GetPenWidth() / 2 ) + 1 );
// Only test closing segment if the polyline is filled // Only test closing segment if the polyline is filled
int count = m_Fill == NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size(); int count = m_Fill == FILL_TYPE::NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
for( int ii = 0; ii < count; ii++ ) for( int ii = 0; ii < count; ii++ )
{ {

View File

@ -39,7 +39,7 @@ LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
LIB_ITEM( LIB_RECTANGLE_T, aParent ) LIB_ITEM( LIB_RECTANGLE_T, aParent )
{ {
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = FILL_TYPE::NO_FILL;
m_isFillable = true; m_isFillable = true;
} }
@ -130,13 +130,13 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset; wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
wxPoint end = aTransform.TransformCoordinate( m_End ) + aOffset; wxPoint end = aTransform.TransformCoordinate( m_End ) + aOffset;
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( aFill && m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 ); aPlotter->Rect( pos, end, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
} }
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; bool already_filled = m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
int pen_size = GetPenWidth(); int pen_size = GetPenWidth();
if( !already_filled || pen_size > 0 ) if( !already_filled || pen_size > 0 )
@ -144,7 +144,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() ); pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, pen_size ); aPlotter->Rect( pos, end, already_filled ? FILL_TYPE::NO_FILL : m_Fill, pen_size );
} }
} }
@ -152,7 +152,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_RECTANGLE::GetPenWidth() const int LIB_RECTANGLE::GetPenWidth() const
{ {
// Historically 0 meant "default width" and negative numbers meant "don't stroke". // Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( m_Width < 0 && GetFillMode() != NO_FILL ) if( m_Width < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
return 0; return 0;
else else
return std::max( m_Width, 1 ); return std::max( m_Width, 1 );
@ -165,7 +165,7 @@ void LIB_RECTANGLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
if( forceNoFill && m_Fill != NO_FILL && penWidth == 0 ) if( forceNoFill && m_Fill != FILL_TYPE::NO_FILL && penWidth == 0 )
return; return;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -173,14 +173,14 @@ void LIB_RECTANGLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset; wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset; wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset;
if( forceNoFill || m_Fill == NO_FILL ) if( forceNoFill || m_Fill == FILL_TYPE::NO_FILL )
{ {
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color ); GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
} }
else else
{ {
if( m_Fill == FILLED_WITH_BG_BODYCOLOR ) if( m_Fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND ); color = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, color ); GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, color );

View File

@ -153,7 +153,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU(), wxPoint end( aPlotter->PageSettings().GetWidthIU(),
aPlotter->PageSettings().GetHeightIU() ); aPlotter->PageSettings().GetHeightIU() );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 ); aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
} }
if( aPlotFrameRef ) if( aPlotFrameRef )

View File

@ -159,7 +159,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), wxPoint end( plotter->PageSettings().GetWidthIU(),
plotter->PageSettings().GetHeightIU() ); plotter->PageSettings().GetHeightIU() );
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 ); plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
} }
if( aPlotFrameRef ) if( aPlotFrameRef )

View File

@ -134,7 +134,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), wxPoint end( plotter->PageSettings().GetWidthIU(),
plotter->PageSettings().GetHeightIU() ); plotter->PageSettings().GetHeightIU() );
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 ); plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
} }
if( aPlotFrameRef ) if( aPlotFrameRef )

View File

@ -237,7 +237,7 @@ void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
if( m_diameter != 0 ) if( m_diameter != 0 )
diameter = m_diameter; diameter = m_diameter;
aPlotter->Circle( m_pos, diameter, FILLED_SHAPE ); aPlotter->Circle( m_pos, diameter, FILL_TYPE::FILLED_SHAPE );
} }

View File

@ -460,7 +460,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
return false; return false;
case LAYER_DEVICE_BACKGROUND: case LAYER_DEVICE_BACKGROUND:
if( aItem->GetFillMode() == FILLED_WITH_BG_BODYCOLOR ) if( aItem->GetFillMode() == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR )
{ {
COLOR4D fillColor = getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false ); COLOR4D fillColor = getRenderColor( aItem, LAYER_DEVICE_BACKGROUND, false );
@ -468,7 +468,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
if( aItem->IsMoving() || aItem->IsDragging() || aItem->IsResized() ) if( aItem->IsMoving() || aItem->IsDragging() || aItem->IsResized() )
fillColor = fillColor.WithAlpha( 0.75 ); fillColor = fillColor.WithAlpha( 0.75 );
m_gal->SetIsFill( aItem->GetFillMode() == FILLED_WITH_BG_BODYCOLOR ); m_gal->SetIsFill( aItem->GetFillMode() == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR );
m_gal->SetFillColor( fillColor ); m_gal->SetFillColor( fillColor );
m_gal->SetIsStroke( false ); m_gal->SetIsStroke( false );
return true; return true;
@ -477,10 +477,10 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
return false; return false;
case LAYER_DEVICE: case LAYER_DEVICE:
m_gal->SetIsFill( aItem->GetFillMode() == FILLED_SHAPE ); m_gal->SetIsFill( aItem->GetFillMode() == FILL_TYPE::FILLED_SHAPE );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) ); m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
if( aItem->GetPenWidth() > 0 || aItem->GetFillMode() == NO_FILL ) if( aItem->GetPenWidth() > 0 || aItem->GetFillMode() == FILL_TYPE::NO_FILL )
{ {
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aItem, false ) ); m_gal->SetLineWidth( getLineWidth( aItem, false ) );

View File

@ -505,15 +505,15 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
rect->SetWidth( elem.lineWidth ); rect->SetWidth( elem.lineWidth );
if( elem.isTransparent ) if( elem.isTransparent )
{ {
rect->SetFillMode( NO_FILL ); rect->SetFillMode( FILL_TYPE::NO_FILL );
} }
else if( elem.isSolid ) else if( elem.isSolid )
{ {
rect->SetFillMode( FILLED_SHAPE ); rect->SetFillMode( FILL_TYPE::FILLED_SHAPE );
} }
else else
{ {
rect->SetFillMode( FILLED_WITH_BG_BODYCOLOR ); rect->SetFillMode( FILL_TYPE::FILLED_WITH_BG_BODYCOLOR );
} }
} }

View File

@ -1571,7 +1571,7 @@ LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle(
rectangle->SetUnit( aGateNumber ); rectangle->SetUnit( aGateNumber );
// Eagle rectangles are filled by definition. // Eagle rectangles are filled by definition.
rectangle->SetFillMode( FILLED_SHAPE ); rectangle->SetFillMode( FILL_TYPE::FILLED_SHAPE );
return rectangle.release(); return rectangle.release();
} }
@ -1622,7 +1622,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
* 2; * 2;
arc->SetWidth( 1 ); arc->SetWidth( 1 );
arc->SetFillMode( FILLED_SHAPE ); arc->SetFillMode( FILL_TYPE::FILLED_SHAPE );
} }
else else
{ {
@ -1685,7 +1685,7 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
vertex = vertex->GetNext(); vertex = vertex->GetNext();
} }
polyLine->SetFillMode( FILLED_SHAPE ); polyLine->SetFillMode( FILL_TYPE::FILLED_SHAPE );
polyLine->SetUnit( aGateNumber ); polyLine->SetUnit( aGateNumber );
return polyLine.release(); return polyLine.release();

View File

@ -493,7 +493,7 @@ void SCH_SEXPR_PARSER::parseFill( FILL_PARAMS& aFill )
wxCHECK_RET( CurTok() == T_fill, wxCHECK_RET( CurTok() == T_fill,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as fill." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as fill." ) );
aFill.m_FillType = NO_FILL; aFill.m_FillType = FILL_TYPE::NO_FILL;
aFill.m_Color = COLOR4D::UNSPECIFIED; aFill.m_Color = COLOR4D::UNSPECIFIED;
T token; T token;
@ -513,9 +513,15 @@ void SCH_SEXPR_PARSER::parseFill( FILL_PARAMS& aFill )
switch( token ) switch( token )
{ {
case T_none: aFill.m_FillType = NO_FILL; break; case T_none:
case T_outline: aFill.m_FillType = FILLED_SHAPE; break; aFill.m_FillType = FILL_TYPE::NO_FILL;
case T_background: aFill.m_FillType = FILLED_WITH_BG_BODYCOLOR; break; break;
case T_outline:
aFill.m_FillType = FILL_TYPE::FILLED_SHAPE;
break;
case T_background:
aFill.m_FillType = FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
break;
default: default:
Expecting( "none, outline, or background" ); Expecting( "none, outline, or background" );
} }

View File

@ -68,7 +68,7 @@ class TITLE_BLOCK;
class FILL_PARAMS class FILL_PARAMS
{ {
public: public:
FILL_T m_FillType; FILL_TYPE m_FillType;
COLOR4D m_Color; COLOR4D m_Color;
}; };

View File

@ -82,9 +82,13 @@ static void formatFill( const LIB_ITEM* aItem, OUTPUTFORMATTER& aFormatter, int
switch( aItem->GetFillMode() ) switch( aItem->GetFillMode() )
{ {
case FILLED_SHAPE: fillType = "outline"; break; case FILL_TYPE::FILLED_SHAPE:
case FILLED_WITH_BG_BODYCOLOR: fillType = "background"; break; fillType = "outline";
case NO_FILL: break;
case FILL_TYPE::FILLED_WITH_BG_BODYCOLOR:
fillType = "background";
break;
case FILL_TYPE::NO_FILL:
KI_FALLTHROUGH; KI_FALLTHROUGH;
default: default:
fillType = "none"; fillType = "none";
@ -299,7 +303,7 @@ class SCH_SEXPR_PLUGIN_CACHE
int m_versionMinor; int m_versionMinor;
SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library. SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library.
static FILL_T parseFillMode( LINE_READER& aReader, const char* aLine, static FILL_TYPE parseFillMode( LINE_READER& aReader, const char* aLine,
const char** aOutput ); const char** aOutput );
LIB_PART* removeSymbol( LIB_PART* aAlias ); LIB_PART* removeSymbol( LIB_PART* aAlias );

View File

@ -505,7 +505,7 @@ class SCH_LEGACY_PLUGIN_CACHE
static LIB_POLYLINE* loadPolyLine( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader ); static LIB_POLYLINE* loadPolyLine( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
static LIB_BEZIER* loadBezier( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader ); static LIB_BEZIER* loadBezier( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
static FILL_T parseFillMode( LINE_READER& aReader, const char* aLine, static FILL_TYPE parseFillMode( LINE_READER& aReader, const char* aLine,
const char** aOutput ); const char** aOutput );
LIB_PART* removeSymbol( LIB_PART* aAlias ); LIB_PART* removeSymbol( LIB_PART* aAlias );
@ -3202,23 +3202,23 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries( std::unique_ptr<LIB_PART>& aPart,
} }
FILL_T SCH_LEGACY_PLUGIN_CACHE::parseFillMode( LINE_READER& aReader, const char* aLine, FILL_TYPE SCH_LEGACY_PLUGIN_CACHE::parseFillMode( LINE_READER& aReader, const char* aLine,
const char** aOutput ) const char** aOutput )
{ {
switch ( parseChar( aReader, aLine, aOutput ) ) switch ( parseChar( aReader, aLine, aOutput ) )
{ {
case 'F': case 'F':
return FILLED_SHAPE; return FILL_TYPE::FILLED_SHAPE;
case 'f': case 'f':
return FILLED_WITH_BG_BODYCOLOR; return FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
case 'N': case 'N':
return NO_FILL; return FILL_TYPE::NO_FILL;
default: default:
SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine ); SCH_PARSE_ERROR( "invalid fill type, expected f, F, or N", aReader, aLine );
} }
// This will never be reached but quiets the compiler warnings // This will never be reached but quiets the compiler warnings
return NO_FILL; return FILL_TYPE::NO_FILL;
} }
@ -3944,7 +3944,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveArc( LIB_ARC* aArc,
aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n", aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
Iu2Mils( aArc->GetPosition().x ), Iu2Mils( aArc->GetPosition().y ), Iu2Mils( aArc->GetPosition().x ), Iu2Mils( aArc->GetPosition().y ),
Iu2Mils( aArc->GetRadius() ), x1, x2, aArc->GetUnit(), aArc->GetConvert(), Iu2Mils( aArc->GetRadius() ), x1, x2, aArc->GetUnit(), aArc->GetConvert(),
Iu2Mils( aArc->GetWidth() ), fill_tab[aArc->GetFillMode()], Iu2Mils( aArc->GetWidth() ), FILL_TYPEab[ static_cast<int>( aArc->GetFillMode() ) ],
Iu2Mils( aArc->GetStart().x ), Iu2Mils( aArc->GetStart().y ), Iu2Mils( aArc->GetStart().x ), Iu2Mils( aArc->GetStart().y ),
Iu2Mils( aArc->GetEnd().x ), Iu2Mils( aArc->GetEnd().y ) ); Iu2Mils( aArc->GetEnd().x ), Iu2Mils( aArc->GetEnd().y ) );
} }
@ -3961,7 +3961,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_BEZIER* aBezier,
for( const auto& pt : aBezier->GetPoints() ) for( const auto& pt : aBezier->GetPoints() )
aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) );
aFormatter.Print( 0, " %c\n", fill_tab[aBezier->GetFillMode()] ); aFormatter.Print( 0, " %c\n", FILL_TYPEab[static_cast<int>( aBezier->GetFillMode() )] );
} }
@ -3973,7 +3973,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle,
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n",
Iu2Mils( aCircle->GetPosition().x ), Iu2Mils( aCircle->GetPosition().y ), Iu2Mils( aCircle->GetPosition().x ), Iu2Mils( aCircle->GetPosition().y ),
Iu2Mils( aCircle->GetRadius() ), aCircle->GetUnit(), aCircle->GetConvert(), Iu2Mils( aCircle->GetRadius() ), aCircle->GetUnit(), aCircle->GetConvert(),
Iu2Mils( aCircle->GetWidth() ), fill_tab[aCircle->GetFillMode()] ); Iu2Mils( aCircle->GetWidth() ), FILL_TYPEab[static_cast<int>( aCircle->GetFillMode() )] );
} }
@ -4160,7 +4160,7 @@ void SCH_LEGACY_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine,
aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) );
} }
aFormatter.Print( 0, " %c\n", fill_tab[aPolyLine->GetFillMode()] ); aFormatter.Print( 0, " %c\n", FILL_TYPEab[static_cast<int>( aPolyLine->GetFillMode() )] );
} }
@ -4175,7 +4175,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle,
Iu2Mils( aRectangle->GetPosition().y ), Iu2Mils( aRectangle->GetPosition().y ),
Iu2Mils( aRectangle->GetEnd().x ), Iu2Mils( aRectangle->GetEnd().y ), Iu2Mils( aRectangle->GetEnd().x ), Iu2Mils( aRectangle->GetEnd().y ),
aRectangle->GetUnit(), aRectangle->GetConvert(), aRectangle->GetUnit(), aRectangle->GetConvert(),
Iu2Mils( aRectangle->GetWidth() ), fill_tab[aRectangle->GetFillMode()] ); Iu2Mils( aRectangle->GetWidth() ), FILL_TYPEab[static_cast<int>( aRectangle->GetFillMode() )] );
} }

View File

@ -962,7 +962,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
aPlotter->SetColor( backgroundColor ); aPlotter->SetColor( backgroundColor );
// Do not fill shape in B&W mode, otherwise texts are unreadable // Do not fill shape in B&W mode, otherwise texts are unreadable
bool fill = aPlotter->GetColorMode(); bool fill = aPlotter->GetColorMode();
aPlotter->Rect( m_pos, m_pos + m_size, fill ? FILLED_SHAPE : NO_FILL, 1.0 ); aPlotter->Rect( m_pos, m_pos + m_size, fill ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL, 1.0 );
aPlotter->SetColor( borderColor ); aPlotter->SetColor( borderColor );

View File

@ -615,7 +615,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
CreateGraphicShape( aPlotter->RenderSettings(), Poly, GetTextPos() ); CreateGraphicShape( aPlotter->RenderSettings(), Poly, GetTextPos() );
if( Poly.size() ) if( Poly.size() )
aPlotter->PlotPoly( Poly, NO_FILL, penWidth ); aPlotter->PlotPoly( Poly, FILL_TYPE::NO_FILL, penWidth );
} }

View File

@ -48,7 +48,7 @@ static void* g_lastPinWeakPtr;
LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() : LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() :
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolDrawing" ), EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
m_lastTextAngle( 0.0 ), m_lastTextAngle( 0.0 ),
m_lastFillStyle( NO_FILL ), m_lastFillStyle( FILL_TYPE::NO_FILL ),
m_drawSpecificConvert( true ), m_drawSpecificConvert( true ),
m_drawSpecificUnit( false ) m_drawSpecificUnit( false )
{ {

View File

@ -69,7 +69,7 @@ private:
private: private:
double m_lastTextAngle; double m_lastTextAngle;
FILL_T m_lastFillStyle; FILL_TYPE m_lastFillStyle;
bool m_drawSpecificConvert; bool m_drawSpecificConvert;
bool m_drawSpecificUnit; bool m_drawSpecificUnit;
}; };

View File

@ -439,7 +439,7 @@ void LIB_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
return; return;
if( aItem->IsFillable() ) if( aItem->IsFillable() )
aItem->SetFillMode( (FILL_T) dialog.GetFillStyle() ); aItem->SetFillMode( (FILL_TYPE) dialog.GetFillStyle() );
aItem->SetWidth( dialog.GetWidth() ); aItem->SetWidth( dialog.GetWidth() );

View File

@ -34,17 +34,6 @@
#include <bitmap_types.h> #include <bitmap_types.h>
#include <view/view_item.h> #include <view/view_item.h>
/**
* Enum FILL_T
* is the set of fill types used in plotting or drawing enclosed areas.
*/
enum FILL_T {
NO_FILL,
FILLED_SHAPE, // Fill with object color ("Solid shape")
FILLED_WITH_BG_BODYCOLOR, // Fill with background body color
// (not filled in B&W mode when plotting or printing)
FILLED_WITH_COLOR // Fill with a user-defined color (currently sheets only)
};
enum class SEARCH_RESULT enum class SEARCH_RESULT

38
include/fill_type.h Normal file
View File

@ -0,0 +1,38 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILL_TYPE_H
#define FILL_TYPE_H
/**
* Enum class FILL_TYPE
* is the set of fill types used in plotting or drawing enclosed areas.
*
* Warning: Do not renumber this enum, the legacy schematic plugin demands on these values
*/
enum class FILL_TYPE : int
{
NO_FILL = 0,
FILLED_SHAPE = 1, // Fill with object color ("Solid shape")
FILLED_WITH_BG_BODYCOLOR = 2, // Fill with background body color
// (not filled in B&W mode when plotting or printing)
FILLED_WITH_COLOR =3 // Fill with a user-defined color (currently sheets only)
};
#endif

View File

@ -32,12 +32,13 @@
#ifndef PLOT_COMMON_H_ #ifndef PLOT_COMMON_H_
#define PLOT_COMMON_H_ #define PLOT_COMMON_H_
#include <fill_type.h>
#include <vector> #include <vector>
#include <math/box2.h> #include <math/box2.h>
#include <gr_text.h> #include <gr_text.h>
#include <page_info.h> #include <page_info.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <eda_item.h> // FILL_T #include <eda_item.h> // FILL_TYPE
#include <render_settings.h> #include <render_settings.h>
class COLOR_SETTINGS; class COLOR_SETTINGS;
@ -227,16 +228,16 @@ public:
int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; } int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
// Low level primitives // Low level primitives
virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) = 0; int width = USE_DEFAULT_LINE_WIDTH ) = 0;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
int width = USE_DEFAULT_LINE_WIDTH ) = 0; int width = USE_DEFAULT_LINE_WIDTH ) = 0;
/** /**
* Generic fallback: arc rendered as a polyline * Generic fallback: arc rendered as a polyline
*/ */
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ); int rayon, FILL_TYPE fill, int width = USE_DEFAULT_LINE_WIDTH );
/** /**
* Generic fallback: Cubic Bezier curve rendered as a polyline * Generic fallback: Cubic Bezier curve rendered as a polyline
@ -288,7 +289,7 @@ public:
* @param aWidth = line width * @param aWidth = line width
* @param aData an auxiliary info (mainly for gerber format) * @param aData an auxiliary info (mainly for gerber format)
*/ */
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_TYPE aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0; int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ) = 0;
/** /**
@ -300,7 +301,7 @@ public:
* @param aWidth = line width * @param aWidth = line width
* @param aData an auxiliary info (mainly for gerber format) * @param aData an auxiliary info (mainly for gerber format)
*/ */
virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, virtual void PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_TYPE aFill,
int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL ); int aWidth = USE_DEFAULT_LINE_WIDTH, void * aData = NULL );
/** /**

View File

@ -192,7 +192,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
continue; continue;
useFpPadsBbox = false; useFpPadsBbox = false;
plotter.PLOTTER::PlotPoly( poly, NO_FILL, line_thickness, &gbr_metadata ); plotter.PLOTTER::PlotPoly( poly, FILL_TYPE::NO_FILL, line_thickness, &gbr_metadata );
} }
} }
@ -216,7 +216,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
poly.Rotate( -footprint->GetOrientationRadians(), VECTOR2I( 0, 0 ) ); poly.Rotate( -footprint->GetOrientationRadians(), VECTOR2I( 0, 0 ) );
poly.Move( footprint->GetPosition() ); poly.Move( footprint->GetPosition() );
plotter.PLOTTER::PlotPoly( poly, NO_FILL, line_thickness, &gbr_metadata ); plotter.PLOTTER::PlotPoly( poly, FILL_TYPE::NO_FILL, line_thickness, &gbr_metadata );
} }
std::vector<D_PAD*>pad_key_list; std::vector<D_PAD*>pad_key_list;

View File

@ -622,7 +622,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( cornerList[0] != cornerList[cornerList.size() - 1] ) if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
aPlotter->PlotPoly( cornerList, NO_FILL ); aPlotter->PlotPoly( cornerList, FILL_TYPE::NO_FILL );
} }
} }
@ -644,7 +644,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( hole.x == hole.y ) if( hole.x == hole.y )
{ {
hole.x = std::min( smallDrill, hole.x ); hole.x = std::min( smallDrill, hole.x );
aPlotter->Circle( pad->GetPosition(), hole.x, NO_FILL ); aPlotter->Circle( pad->GetPosition(), hole.x, FILL_TYPE::NO_FILL );
} }
else else
{ {
@ -665,7 +665,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( via && via->IsOnLayer( layer ) ) // via holes can be not through holes if( via && via->IsOnLayer( layer ) ) // via holes can be not through holes
{ {
aPlotter->Circle( via->GetPosition(), via->GetDrillValue(), NO_FILL ); aPlotter->Circle( via->GetPosition(), via->GetDrillValue(), FILL_TYPE::NO_FILL );
} }
} }
} }
@ -889,7 +889,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( cornerList[0] != cornerList[cornerList.size() - 1] ) if( cornerList[0] != cornerList[cornerList.size() - 1] )
cornerList.push_back( cornerList[0] ); cornerList.push_back( cornerList[0] );
aPlotter->PlotPoly( cornerList, FILLED_SHAPE ); aPlotter->PlotPoly( cornerList, FILL_TYPE::FILLED_SHAPE );
} }
#endif #endif
} }
@ -992,7 +992,7 @@ static void FillNegativeKnockout( PLOTTER *aPlotter, const EDA_RECT &aBbbox )
aPlotter->SetColor( WHITE ); // Which will be plotted as black aPlotter->SetColor( WHITE ); // Which will be plotted as black
EDA_RECT area = aBbbox; EDA_RECT area = aBbbox;
area.Inflate( margin ); area.Inflate( margin );
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILLED_SHAPE ); aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_TYPE::FILLED_SHAPE );
aPlotter->SetColor( BLACK ); aPlotter->SetColor( BLACK );
} }

View File

@ -581,7 +581,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
for( const wxPoint& pt : pts ) for( const wxPoint& pt : pts )
poly.Append( pt ); poly.Append( pt );
m_plotter->PlotPoly( poly, FILLED_SHAPE, -1, &gbr_metadata ); m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, -1, &gbr_metadata );
} }
} }
break; break;
@ -661,7 +661,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
{ {
SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj ); SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj );
m_plotter->PlotPoly( poly, FILLED_SHAPE, thickness, &gbr_metadata ); m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, thickness, &gbr_metadata );
} }
} }
} }
@ -807,14 +807,14 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& p
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER ) if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
{ {
if( outline_thickness > 0 ) if( outline_thickness > 0 )
m_plotter->PlotPoly( cornerList, NO_FILL, m_plotter->PlotPoly( cornerList, FILL_TYPE::NO_FILL,
outline_thickness, &gbr_metadata ); outline_thickness, &gbr_metadata );
static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion(
cornerList, &gbr_metadata ); cornerList, &gbr_metadata );
} }
else else
m_plotter->PlotPoly( cornerList, FILLED_SHAPE, m_plotter->PlotPoly( cornerList, FILL_TYPE::FILLED_SHAPE,
outline_thickness, &gbr_metadata ); outline_thickness, &gbr_metadata );
} }
else else
@ -922,7 +922,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( PCB_SHAPE* aShape )
for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
{ {
SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj ); SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
m_plotter->PlotPoly( poly, FILLED_SHAPE, thickness, &gbr_metadata ); m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, thickness, &gbr_metadata );
} }
} }
} }
@ -946,7 +946,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( PCB_SHAPE* aShape )
for( const wxPoint& pt : pts ) for( const wxPoint& pt : pts )
poly.Append( pt ); poly.Append( pt );
m_plotter->PlotPoly( poly, FILLED_SHAPE, -1, &gbr_metadata ); m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, -1, &gbr_metadata );
} }
} }
break; break;

View File

@ -1193,7 +1193,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates()
zone->SetLocalClearance( getKiCadLength( csTemplate.Pouring.AdditionalIsolation ) ); zone->SetLocalClearance( getKiCadLength( csTemplate.Pouring.AdditionalIsolation ) );
if( csTemplate.Pouring.FillType == TEMPLATE::POURING::COPPER_FILL_TYPE::HATCHED ) if( csTemplate.Pouring.FillType == TEMPLATE::POURING::COPPER_FILL_TYPEYPE::HATCHED )
{ {
zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN ); zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN );
zone->SetHatchGap( getKiCadHatchCodeGap( csTemplate.Pouring.HatchCodeID ) ); zone->SetHatchGap( getKiCadHatchCodeGap( csTemplate.Pouring.HatchCodeID ) );

View File

@ -2143,11 +2143,11 @@ void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse( XNODE* aNode )
} }
else if( cNodeName == wxT( "FILLED" ) ) else if( cNodeName == wxT( "FILLED" ) )
{ {
FillType = COPPER_FILL_TYPE::FILLED; FillType = COPPER_FILL_TYPEYPE::FILLED;
} }
else if( cNodeName == wxT( "HATCHCODEREF" ) ) else if( cNodeName == wxT( "HATCHCODEREF" ) )
{ {
FillType = COPPER_FILL_TYPE::HATCHED; FillType = COPPER_FILL_TYPEYPE::HATCHED;
HatchCodeID = GetXmlAttributeIDString( cNode, 0 ); HatchCodeID = GetXmlAttributeIDString( cNode, 0 );
} }
else else

View File

@ -238,7 +238,7 @@ public:
* - V_S = Via to SMD Pad (Optional Rule) * - V_S = Via to SMD Pad (Optional Rule)
* - V_V = Via to Via * - V_V = Via to Via
* *
* Other design rules are in: * Other design rules are in:
* TECHNOLOGY->MAXMITER = Maximum Mitre (This parameter is not actually checked in Cadstar) * TECHNOLOGY->MAXMITER = Maximum Mitre (This parameter is not actually checked in Cadstar)
* TECHNOLOGY->MINMITER = Minimum Mitre (This parameter is not actually checked in Cadstar) * TECHNOLOGY->MINMITER = Minimum Mitre (This parameter is not actually checked in Cadstar)
* TECHNOLOGY->MINUNNECKED = Minimum Thicker Track Length * TECHNOLOGY->MINUNNECKED = Minimum Thicker Track Length
@ -446,7 +446,7 @@ public:
/** /**
* @brief From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain * @brief From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain
* operations are carried out (e.g. Placement.); and for creating 'keep out' areas, within which * operations are carried out (e.g. Placement.); and for creating 'keep out' areas, within which
* no operations are carried out and where no items are placed by operations such as Placement * no operations are carried out and where no items are placed by operations such as Placement
* and Routing." * and Routing."
*/ */
struct COMPONENT_AREA struct COMPONENT_AREA
@ -470,7 +470,7 @@ public:
}; };
/** /**
* @brief From CADSTAR Help: "This parameter indicates the physical layers on which the selected * @brief From CADSTAR Help: "This parameter indicates the physical layers on which the selected
* pad is placed. Note: When you change the Side parameter in PCB Design, the Side assigned to the * pad is placed. Note: When you change the Side parameter in PCB Design, the Side assigned to the
* pad in the library is not overwritten." * pad in the library is not overwritten."
*/ */
@ -488,15 +488,15 @@ public:
/** /**
* @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit the * @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit the
* pad. There are eight pre-defined directions to choose from, North, South, East, West, * pad. There are eight pre-defined directions to choose from, North, South, East, West,
* North-East, North-West, South-East and South-West, plus "Free Angle" which allows routes to exit * North-East, North-West, South-East and South-West, plus "Free Angle" which allows routes to exit
* in any direction. * in any direction.
* *
* If none of the direction boxes are checked, the system uses the default which is all directions * If none of the direction boxes are checked, the system uses the default which is all directions
* (as shown above) for all pad shapes, except the long (drawn) Routes exit from the short sides of * (as shown above) for all pad shapes, except the long (drawn) Routes exit from the short sides of
* long pads - in other words in line with the long axis. * long pads - in other words in line with the long axis.
* *
* Note: These Exit Directions are applied to the PCB component. If the PCB component is rotated * Note: These Exit Directions are applied to the PCB component. If the PCB component is rotated
* when it is used on a PCB Design, the Exit Directions will rotate with it." * when it is used on a PCB Design, the Exit Directions will rotate with it."
* *
* The main thing to note is that the exit angle is not relative to the pad (even if the pad is * The main thing to note is that the exit angle is not relative to the pad (even if the pad is
@ -605,7 +605,7 @@ public:
/** /**
* @brief Contains formatting specific for a CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION object. * @brief Contains formatting specific for a CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION object.
* Note that none of the parameters has any effect on the position of the dimension text - * Note that none of the parameters has any effect on the position of the dimension text -
* it is more of an "intention" of where it should be placed. The user can manually * it is more of an "intention" of where it should be placed. The user can manually
* drag the location of the dimension text. Therefore, the actual position of the dimension * drag the location of the dimension text. Therefore, the actual position of the dimension
* text is as defined in the `Text` object within CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION. * text is as defined in the `Text` object within CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION.
@ -615,7 +615,7 @@ public:
* on top of the dimension line, if the dimension line is STYLE::INTERNAL). * on top of the dimension line, if the dimension line is STYLE::INTERNAL).
* *
* Note: the token is "DIMTEXT" in the CADSTAR format, but this has been renamed to * Note: the token is "DIMTEXT" in the CADSTAR format, but this has been renamed to
* TEXTFORMAT in the cadstar2kicadplugin for ease of understanding. * TEXTFORMAT in the cadstar2kicadplugin for ease of understanding.
*/ */
struct TEXTFORMAT struct TEXTFORMAT
{ {
@ -809,7 +809,7 @@ public:
/** /**
* @brief From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain * @brief From CADSTAR Help: "Area is for creating areas within which, and nowhere else, certain
* operations are carried out (e.g. Placement.); and for creating 'keep out' areas, within which * operations are carried out (e.g. Placement.); and for creating 'keep out' areas, within which
* no operations are carried out and where no items are placed by operations such as Placement * no operations are carried out and where no items are placed by operations such as Placement
* and Routing. [...] * and Routing. [...]
* More than one function can be assigned to an area." * More than one function can be assigned to an area."
*/ */
@ -1005,14 +1005,14 @@ public:
{ {
struct POURING struct POURING
{ {
enum class COPPER_FILL_TYPE enum class COPPER_FILL_TYPEYPE
{ {
FILLED, FILLED,
HATCHED ///< This is a user defined HATCHCODE_ID HATCHED ///< This is a user defined HATCHCODE_ID
}; };
/** /**
* @brief From CADSTAR Help: "With this parameter you can select one of two ways in * @brief From CADSTAR Help: "With this parameter you can select one of two ways in
* which to generate thermal reliefs." * which to generate thermal reliefs."
* Note: there doesn't appear to be any noticeable difference between the options. * Note: there doesn't appear to be any noticeable difference between the options.
*/ */
@ -1062,7 +1062,7 @@ public:
bool TargetForAutorouting = false; ///< true when subnode "AUTOROUTETARGET" is present bool TargetForAutorouting = false; ///< true when subnode "AUTOROUTETARGET" is present
RELIEF_TYPE ReliefType = RELIEF_TYPE::CROSS; ///< See RELIEF_TYPE RELIEF_TYPE ReliefType = RELIEF_TYPE::CROSS; ///< See RELIEF_TYPE
COPPER_FILL_TYPE FillType = COPPER_FILL_TYPE::FILLED; ///< Assume solid fill COPPER_FILL_TYPEYPE FillType = COPPER_FILL_TYPEYPE::FILLED; ///< Assume solid fill
HATCHCODE_ID HatchCodeID = wxEmptyString; ///< Only for FillType = HATCHED HATCHCODE_ID HatchCodeID = wxEmptyString; ///< Only for FillType = HATCHED
void Parse( XNODE* aNode ); void Parse( XNODE* aNode );