SVG plotter rework: use mm as units in file. Remove useless inch option.
Use 4 digits in mantissa as default and when exporting SVG. Allow 0 as line width: this is the right value to draw filled shapes with no outline thickness.
This commit is contained in:
parent
901a9387e9
commit
5b8eb8f9ec
|
@ -99,6 +99,11 @@
|
||||||
|
|
||||||
#include <plotters/plotters_pslike.h>
|
#include <plotters/plotters_pslike.h>
|
||||||
|
|
||||||
|
// Note:
|
||||||
|
// During tests, we (JPC) found issues when the coordinates used 6 digits in mantissa
|
||||||
|
// especially for stroke-width using very small (but not null) values < 0.00001 mm
|
||||||
|
// So to avoid this king of issue, we are using 4 digits in mantissa
|
||||||
|
// The resolution (m_precision ) is 0.1 micron, that looks enougt for a SVG file
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates '<' to "<", '>' to ">" and so on, according to the spec:
|
* Translates '<' to "<", '>' to ">" and so on, according to the spec:
|
||||||
|
@ -161,11 +166,11 @@ SVG_PLOTTER::SVG_PLOTTER()
|
||||||
m_graphics_changed = true;
|
m_graphics_changed = true;
|
||||||
SetTextMode( PLOT_TEXT_MODE::STROKE );
|
SetTextMode( PLOT_TEXT_MODE::STROKE );
|
||||||
m_fillMode = FILL_T::NO_FILL; // or FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
|
m_fillMode = FILL_T::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;
|
||||||
m_useInch = true; // decimils is the default
|
m_useInch = false; // millimeters are always the svg unit
|
||||||
m_precision = 4; // because there where used before it was changeable
|
m_precision = 4; // default: 4 digits in mantissa.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,28 +183,24 @@ void SVG_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
|
||||||
m_plotScale = aScale;
|
m_plotScale = aScale;
|
||||||
m_IUsPerDecimil = aIusPerDecimil;
|
m_IUsPerDecimil = aIusPerDecimil;
|
||||||
|
|
||||||
/* Compute the paper size in IUs */
|
// Compute the paper size in IUs. for historical reasons the page size is in mils
|
||||||
m_paperSize = m_pageInfo.GetSizeMils();
|
m_paperSize = m_pageInfo.GetSizeMils();
|
||||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||||
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
||||||
|
|
||||||
// set iuPerDeviceUnit, in 0.1mils ( 2.54um )
|
// gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
|
||||||
// this was used before the format was changeable, so we set is as default
|
double iusPerMM = m_IUsPerDecimil / 2.54 * 1000;
|
||||||
SetSvgCoordinatesFormat( 4, true );
|
m_iuPerDeviceUnit = 1 / iusPerMM;
|
||||||
|
|
||||||
|
SetSvgCoordinatesFormat( 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SVG_PLOTTER::SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches )
|
void SVG_PLOTTER::SetSvgCoordinatesFormat( unsigned aPrecision )
|
||||||
{
|
{
|
||||||
m_useInch = aUseInches;
|
// Only number of digits in mantissa are adjustable.
|
||||||
m_precision = aResolution;
|
// SVG units are always mm
|
||||||
|
m_precision = aPrecision;
|
||||||
// gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
|
|
||||||
double iusPerMM = m_IUsPerDecimil / 2.54 * 1000;
|
|
||||||
m_iuPerDeviceUnit = pow( 10.0, m_precision ) / ( iusPerMM );
|
|
||||||
|
|
||||||
if( m_useInch )
|
|
||||||
m_iuPerDeviceUnit /= 25.4; // convert to inch
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,16 +244,21 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
|
||||||
if( pen_w < 0.0 ) // Ensure pen width validity
|
if( pen_w < 0.0 ) // Ensure pen width validity
|
||||||
pen_w = 0.0;
|
pen_w = 0.0;
|
||||||
|
|
||||||
fprintf( m_outputFile, "\nstroke:#%6.6lX; stroke-width:%f; stroke-opacity:1; \n",
|
// Fix a strange issue found in Inkscape: aWidth < 100 nm create issues on degrouping objects
|
||||||
m_pen_rgb_color, pen_w );
|
// So we use only 4 digits in mantissa for stroke-width.
|
||||||
|
// TODO: perhaps used only 3 or 4 digits in mantissa for all values in mm, because some
|
||||||
|
// issues were previouly reported reported when using nm as integer units
|
||||||
|
|
||||||
|
fprintf( m_outputFile, "\nstroke:#%6.6lX; stroke-width:%.*f; stroke-opacity:1; \n",
|
||||||
|
m_pen_rgb_color, m_precision, pen_w );
|
||||||
fputs( "stroke-linecap:round; stroke-linejoin:round;", m_outputFile );
|
fputs( "stroke-linecap:round; stroke-linejoin:round;", m_outputFile );
|
||||||
|
|
||||||
//set any extra attributes for non-solid lines
|
//set any extra attributes for non-solid lines
|
||||||
switch( m_dashed )
|
switch( m_dashed )
|
||||||
{
|
{
|
||||||
case PLOT_DASH_TYPE::DASH:
|
case PLOT_DASH_TYPE::DASH:
|
||||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;",
|
fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;",
|
||||||
GetDashMarkLenIU(), GetDashGapLenIU() );
|
m_precision, GetDashMarkLenIU(), m_precision, GetDashGapLenIU() );
|
||||||
break;
|
break;
|
||||||
case PLOT_DASH_TYPE::DOT:
|
case PLOT_DASH_TYPE::DOT:
|
||||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;",
|
fprintf( m_outputFile, "stroke-dasharray:%f,%f;",
|
||||||
|
@ -299,15 +305,15 @@ void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
return;
|
return;
|
||||||
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
||||||
aWidth = m_renderSettings->GetDefaultPenWidth();
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
||||||
else if( aWidth == 0 )
|
|
||||||
aWidth = 1;
|
|
||||||
|
|
||||||
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
// Note: aWidth == 0 is fine: used for filled shapes with no outline thickness
|
||||||
|
|
||||||
|
wxASSERT_MSG( aWidth >= 0, "Plotter called to set negative pen width" );
|
||||||
|
|
||||||
if( aWidth != m_currentPenWidth )
|
if( aWidth != m_currentPenWidth )
|
||||||
{
|
{
|
||||||
m_graphics_changed = true;
|
m_graphics_changed = true;
|
||||||
m_currentPenWidth = aWidth;
|
m_currentPenWidth = aWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_graphics_changed )
|
if( m_graphics_changed )
|
||||||
|
@ -371,9 +377,9 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
||||||
{
|
{
|
||||||
EDA_RECT rect( p1, VECTOR2I( p2.x - p1.x, p2.y - p1.y ) );
|
EDA_RECT rect( p1, VECTOR2I( p2.x - p1.x, p2.y - p1.y ) );
|
||||||
rect.Normalize();
|
rect.Normalize();
|
||||||
VECTOR2D org_dev = userToDeviceCoordinates( rect.GetOrigin() );
|
VECTOR2D org_dev = userToDeviceCoordinates( rect.GetOrigin() );
|
||||||
VECTOR2D end_dev = userToDeviceCoordinates( rect.GetEnd() );
|
VECTOR2D end_dev = userToDeviceCoordinates( rect.GetEnd() );
|
||||||
VECTOR2D size_dev = end_dev - org_dev;
|
VECTOR2D size_dev = end_dev - org_dev;
|
||||||
|
|
||||||
// Ensure size of rect in device coordinates is > 0
|
// Ensure size of rect in device coordinates is > 0
|
||||||
// I don't know if this is a SVG issue or a Inkscape issue, but
|
// I don't know if this is a SVG issue or a Inkscape issue, but
|
||||||
|
@ -389,9 +395,9 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
||||||
if( rect_dev.GetSize().x == 0.0 || rect_dev.GetSize().y == 0.0 ) // Draw a line
|
if( rect_dev.GetSize().x == 0.0 || rect_dev.GetSize().y == 0.0 ) // Draw a line
|
||||||
{
|
{
|
||||||
fprintf( m_outputFile,
|
fprintf( m_outputFile,
|
||||||
"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" />\n",
|
"<line x1=\"%.*f\" y1=\"%.*f\" x2=\"%.*f\" y2=\"%.*f\" />\n",
|
||||||
rect_dev.GetPosition().x, rect_dev.GetPosition().y,
|
m_precision, rect_dev.GetPosition().x, m_precision, rect_dev.GetPosition().y,
|
||||||
rect_dev.GetEnd().x, rect_dev.GetEnd().y );
|
m_precision, rect_dev.GetEnd().x, m_precision, rect_dev.GetEnd().y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -406,8 +412,8 @@ void SVG_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
||||||
|
|
||||||
void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
|
void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
|
||||||
{
|
{
|
||||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||||
double radius = userToDeviceSize( diametre / 2.0 );
|
double radius = userToDeviceSize( diametre / 2.0 );
|
||||||
|
|
||||||
setFillMode( fill );
|
setFillMode( fill );
|
||||||
SetCurrentLineWidth( width );
|
SetCurrentLineWidth( width );
|
||||||
|
@ -422,8 +428,8 @@ void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int wi
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_outputFile,
|
fprintf( m_outputFile,
|
||||||
"<circle cx=\"%f\" cy=\"%f\" r=\"%f\" /> \n",
|
"<circle cx=\"%.*f\" cy=\"%.*f\" r=\"%.*f\" /> \n",
|
||||||
pos_dev.x, pos_dev.y, radius );
|
m_precision, pos_dev.x, m_precision, pos_dev.y, m_precision, radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -450,8 +456,8 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
std::swap( startAngle, endAngle );
|
std::swap( startAngle, endAngle );
|
||||||
|
|
||||||
// Calculate start point.
|
// Calculate start point.
|
||||||
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
|
VECTOR2D centre_device = userToDeviceCoordinates( aCenter );
|
||||||
double radius_device = userToDeviceSize( aRadius );
|
double radius_device = userToDeviceSize( aRadius );
|
||||||
|
|
||||||
if( !m_yaxisReversed ) // Should be never the case
|
if( !m_yaxisReversed ) // Should be never the case
|
||||||
{
|
{
|
||||||
|
@ -516,18 +522,21 @@ void SVG_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||||
setFillMode( aFill );
|
setFillMode( aFill );
|
||||||
SetCurrentLineWidth( 0 );
|
SetCurrentLineWidth( 0 );
|
||||||
|
|
||||||
fprintf( m_outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f L %f %f Z\" />\n",
|
fprintf( m_outputFile, "<path d=\"M%.*f %.*f A%.*f %.*f 0.0 %d %d %.*f %.*f L %.*f %.*f Z\" />\n",
|
||||||
start.x, start.y, radius_device, radius_device,
|
m_precision, start.x, m_precision, start.y,
|
||||||
|
m_precision, radius_device, m_precision, radius_device,
|
||||||
flg_arc, flg_sweep,
|
flg_arc, flg_sweep,
|
||||||
end.x, end.y, centre_device.x, centre_device.y );
|
m_precision, end.x, m_precision, end.y,
|
||||||
|
m_precision, centre_device.x, m_precision, centre_device.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
setFillMode( FILL_T::NO_FILL );
|
setFillMode( FILL_T::NO_FILL );
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
fprintf( m_outputFile, "<path d=\"M%f %f A%f %f 0.0 %d %d %f %f\" />\n",
|
fprintf( m_outputFile, "<path d=\"M%.*f %.*f A%.*f %.*f 0.0 %d %d %.*f %.*f\" />\n",
|
||||||
start.x, start.y, radius_device, radius_device,
|
m_precision, start.x, m_precision, start.y,
|
||||||
|
m_precision, radius_device, m_precision, radius_device,
|
||||||
flg_arc, flg_sweep,
|
flg_arc, flg_sweep,
|
||||||
end.x, end.y );
|
m_precision, end.x, m_precision, end.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,15 +548,17 @@ void SVG_PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1
|
||||||
setFillMode( FILL_T::NO_FILL );
|
setFillMode( FILL_T::NO_FILL );
|
||||||
SetCurrentLineWidth( aLineThickness );
|
SetCurrentLineWidth( aLineThickness );
|
||||||
|
|
||||||
VECTOR2D start = userToDeviceCoordinates( aStart );
|
VECTOR2D start = userToDeviceCoordinates( aStart );
|
||||||
VECTOR2D ctrl1 = userToDeviceCoordinates( aControl1 );
|
VECTOR2D ctrl1 = userToDeviceCoordinates( aControl1 );
|
||||||
VECTOR2D ctrl2 = userToDeviceCoordinates( aControl2 );
|
VECTOR2D ctrl2 = userToDeviceCoordinates( aControl2 );
|
||||||
VECTOR2D end = userToDeviceCoordinates( aEnd );
|
VECTOR2D end = userToDeviceCoordinates( aEnd );
|
||||||
|
|
||||||
// Generate a cubic curve: start point and 3 other control points.
|
// Generate a cubic curve: start point and 3 other control points.
|
||||||
fprintf( m_outputFile, "<path d=\"M%f,%f C%f,%f %f,%f %f,%f\" />\n",
|
fprintf( m_outputFile, "<path d=\"M%.*f,%.*f C%.*f,%.*f %.*f,%.*f %.*f,%.*f\" />\n",
|
||||||
start.x, start.y, ctrl1.x, ctrl1.y,
|
m_precision, start.x, m_precision, start.y,
|
||||||
ctrl2.x, ctrl2.y, end.x, end.y );
|
m_precision, ctrl1.x, m_precision, ctrl1.y,
|
||||||
|
m_precision, ctrl2.x, m_precision, ctrl2.y,
|
||||||
|
m_precision, end.x, m_precision, end.y );
|
||||||
#else
|
#else
|
||||||
PLOTTER::BezierCurve( aStart, aControl1, aControl2, aEnd, aTolerance, aLineThickness );
|
PLOTTER::BezierCurve( aStart, aControl1, aControl2, aEnd, aTolerance, aLineThickness );
|
||||||
#endif
|
#endif
|
||||||
|
@ -578,12 +589,12 @@ void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
|
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
|
||||||
fprintf( m_outputFile, "d=\"M %f,%f\n", pos.x, pos.y );
|
fprintf( m_outputFile, "d=\"M %.*f,%.*f\n", m_precision, pos.x, m_precision, pos.y );
|
||||||
|
|
||||||
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
|
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
|
||||||
{
|
{
|
||||||
pos = userToDeviceCoordinates( aCornerList[ii] );
|
pos = userToDeviceCoordinates( aCornerList[ii] );
|
||||||
fprintf( m_outputFile, "%f,%f\n", pos.x, pos.y );
|
fprintf( m_outputFile, "%.*f,%.*f\n", m_precision, pos.x, m_precision, pos.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the corner list ends where it begins, then close the poly
|
// If the corner list ends where it begins, then close the poly
|
||||||
|
@ -594,7 +605,7 @@ void SVG_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = userToDeviceCoordinates( aCornerList.back() );
|
pos = userToDeviceCoordinates( aCornerList.back() );
|
||||||
fprintf( m_outputFile, "%f,%f\n\" /> \n", pos.x, pos.y );
|
fprintf( m_outputFile, "%.*f,%.*f\n\" /> \n", m_precision, pos.x, m_precision, pos.y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,8 +650,8 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
|
||||||
fprintf( m_outputFile, "\n" );
|
fprintf( m_outputFile, "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%f\" height=\"%f\" />",
|
fprintf( m_outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%.*f\" height=\"%.*f\" />",
|
||||||
userToDeviceSize( drawsize.x ), userToDeviceSize( drawsize.y ) );
|
m_precision, userToDeviceSize( drawsize.x ), m_precision, userToDeviceSize( drawsize.y ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,12 +683,12 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
|
||||||
setSVGPlotStyle();
|
setSVGPlotStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_outputFile, "<path d=\"M%d %d\n", (int) pos_dev.x, (int) pos_dev.y );
|
fprintf( m_outputFile, "<path d=\"M%.*f %.*f\n", m_precision, pos_dev.x, m_precision, pos_dev.y );
|
||||||
}
|
}
|
||||||
else if( m_penState != plume || pos != m_penLastpos )
|
else if( m_penState != plume || pos != m_penLastpos )
|
||||||
{
|
{
|
||||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||||
fprintf( m_outputFile, "L%d %d\n", (int) pos_dev.x, (int) pos_dev.y );
|
fprintf( m_outputFile, "L%.*f %.*f\n", m_precision, pos_dev.x, m_precision, pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_penState = plume;
|
m_penState = plume;
|
||||||
|
@ -710,12 +721,13 @@ bool SVG_PLOTTER::StartPlot()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write viewport pos and size
|
// Write viewport pos and size
|
||||||
VECTOR2I origin; // TODO set to actual value
|
VECTOR2D origin; // TODO set to actual value
|
||||||
fprintf( m_outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
|
fprintf( m_outputFile, " width=\"%.*fmm\" height=\"%.*fmm\" viewBox=\"%.*f %.*f %.*f %.*f\">\n",
|
||||||
(double) m_paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
|
m_precision, (double) m_paperSize.x / m_IUsPerDecimil * 2.54 / 1000,
|
||||||
(double) m_paperSize.y / m_IUsPerDecimil * 2.54 / 10000, origin.x, origin.y,
|
m_precision, (double) m_paperSize.y / m_IUsPerDecimil * 2.54 / 1000,
|
||||||
(int) ( m_paperSize.x * m_iuPerDeviceUnit ),
|
m_precision, origin.x, m_precision, origin.y,
|
||||||
(int) ( m_paperSize.y * m_iuPerDeviceUnit) );
|
m_precision, m_paperSize.x * m_iuPerDeviceUnit,
|
||||||
|
m_precision, m_paperSize.y * m_iuPerDeviceUnit);
|
||||||
|
|
||||||
// Write title
|
// Write title
|
||||||
char date_buf[250];
|
char date_buf[250];
|
||||||
|
@ -733,8 +745,8 @@ bool SVG_PLOTTER::StartPlot()
|
||||||
// output the pen and brush color (RVB values in hex) and opacity
|
// output the pen and brush color (RVB values in hex) and opacity
|
||||||
double opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
|
double opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
|
||||||
fprintf( m_outputFile,
|
fprintf( m_outputFile,
|
||||||
"<g style=\"fill:#%6.6lX; fill-opacity:%f;stroke:#%6.6lX; stroke-opacity:%f;\n",
|
"<g style=\"fill:#%6.6lX; fill-opacity:%.*f;stroke:#%6.6lX; stroke-opacity:%.*f;\n",
|
||||||
m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );
|
m_brush_rgb_color, m_precision, opacity, m_pen_rgb_color, m_precision, opacity );
|
||||||
|
|
||||||
// output the pen cap and line joint
|
// output the pen cap and line joint
|
||||||
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", m_outputFile );
|
fputs( "stroke-linecap:round; stroke-linejoin:round;\"\n", m_outputFile );
|
||||||
|
@ -801,20 +813,21 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
|
||||||
if( !aOrient.IsZero() )
|
if( !aOrient.IsZero() )
|
||||||
{
|
{
|
||||||
fprintf( m_outputFile,
|
fprintf( m_outputFile,
|
||||||
"<g transform=\"rotate(%f %f %f)\">\n",
|
"<g transform=\"rotate(%f %.*f %.*f)\">\n",
|
||||||
- aOrient.AsDegrees(), anchor_pos_dev.x, anchor_pos_dev.y );
|
- aOrient.AsDegrees(), m_precision, anchor_pos_dev.x, m_precision, anchor_pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_outputFile, "<text x=\"%f\" y=\"%f\"\n", text_pos_dev.x, text_pos_dev.y );
|
fprintf( m_outputFile, "<text x=\"%.*f\" y=\"%.*f\"\n",
|
||||||
|
m_precision, text_pos_dev.x, m_precision, text_pos_dev.y );
|
||||||
|
|
||||||
/// If the text is mirrored, we should also mirror the hidden text to match
|
/// If the text is mirrored, we should also mirror the hidden text to match
|
||||||
if( aSize.x < 0 )
|
if( aSize.x < 0 )
|
||||||
fprintf( m_outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
|
fprintf( m_outputFile, "transform=\"scale(-1 1) translate(%f 0)\"\n", -2 * text_pos_dev.x );
|
||||||
|
|
||||||
fprintf( m_outputFile,
|
fprintf( m_outputFile,
|
||||||
"textLength=\"%f\" font-size=\"%f\" lengthAdjust=\"spacingAndGlyphs\"\n"
|
"textLength=\"%.*f\" font-size=\"%.*f\" lengthAdjust=\"spacingAndGlyphs\"\n"
|
||||||
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
|
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
|
||||||
sz_dev.x, sz_dev.y, hjust, TO_UTF8( XmlEsc( aText ) ) );
|
m_precision, sz_dev.x, m_precision, sz_dev.y, hjust, TO_UTF8( XmlEsc( aText ) ) );
|
||||||
|
|
||||||
if( !aOrient.IsZero() )
|
if( !aOrient.IsZero() )
|
||||||
fputs( "</g>\n", m_outputFile );
|
fputs( "</g>\n", m_outputFile );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -461,7 +461,8 @@ public:
|
||||||
// NOP for most plotters. Only for Gerber plotter
|
// NOP for most plotters. Only for Gerber plotter
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches = false )
|
/// Set the number of digits for mantissa in coordinates in mm for SVG plotter
|
||||||
|
virtual void SetSvgCoordinatesFormat( unsigned aPrecision )
|
||||||
{
|
{
|
||||||
// NOP for most plotters. Only for SVG plotter
|
// NOP for most plotters. Only for SVG plotter
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -475,17 +475,16 @@ public:
|
||||||
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
|
virtual void PenTo( const VECTOR2I& pos, char plume ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select SVG step size (number of digits needed for 1 mm or 1 inch )
|
* Select SVG coordinate precision (number of digits needed for 1 mm )
|
||||||
*
|
* (SVG plotter uses always metric unit)
|
||||||
* Should be called only after SetViewport() is called
|
* Should be called only after SetViewport() is called
|
||||||
*
|
*
|
||||||
* @param aResolution = number of digits in mantissa of coordinate
|
* @param aPrecision = number of digits in mantissa of coordinate
|
||||||
* use a value from 3-6
|
* use a value from 3-6
|
||||||
* do not use value > 6 to avoid overflow in PCBNEW
|
* do not use value > 6 to avoid overflow in PCBNEW
|
||||||
* do not use value > 4 to avoid overflow for other parts
|
* do not use value > 4 to avoid overflow for other parts
|
||||||
* @param aUseInches = true to use inches, false to use mm (default)
|
|
||||||
*/
|
*/
|
||||||
virtual void SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches = false ) override;
|
virtual void SetSvgCoordinatesFormat( unsigned aPrecision ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling this function allows one to define the beginning of a group
|
* Calling this function allows one to define the beginning of a group
|
||||||
|
|
|
@ -328,6 +328,8 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
||||||
|
|
||||||
plot_opts.SetMirror( m_printMirror );
|
plot_opts.SetMirror( m_printMirror );
|
||||||
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
||||||
|
// coord format: 4 digits in mantissa (units always in mm). This is a good choice.
|
||||||
|
plot_opts.SetSvgPrecision( 4 );
|
||||||
|
|
||||||
PAGE_INFO savedPageInfo = m_board->GetPageSettings();
|
PAGE_INFO savedPageInfo = m_board->GetPageSettings();
|
||||||
VECTOR2I savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
|
VECTOR2I savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -163,7 +163,6 @@ void DIALOG_PLOT::init_Dialog()
|
||||||
|
|
||||||
// SVG precision and units for coordinates
|
// SVG precision and units for coordinates
|
||||||
m_svgPrecsision->SetValue( m_plotOpts.GetSvgPrecision() );
|
m_svgPrecsision->SetValue( m_plotOpts.GetSvgPrecision() );
|
||||||
m_svgUnits->SetSelection( m_plotOpts.GetSvgUseInch() );
|
|
||||||
|
|
||||||
// Option for excluding contents of "Edges Pcb" layer
|
// Option for excluding contents of "Edges Pcb" layer
|
||||||
m_includeEdgeLayerOpt->SetValue( !m_plotOpts.GetExcludeEdgeLayer() );
|
m_includeEdgeLayerOpt->SetValue( !m_plotOpts.GetExcludeEdgeLayer() );
|
||||||
|
@ -734,7 +733,7 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||||
tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() );
|
tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() );
|
||||||
|
|
||||||
tempOptions.SetGerberPrecision( m_coordFormatCtrl->GetSelection() == 0 ? 5 : 6 );
|
tempOptions.SetGerberPrecision( m_coordFormatCtrl->GetSelection() == 0 ? 5 : 6 );
|
||||||
tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue(), m_svgUnits->GetSelection() );
|
tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue() );
|
||||||
|
|
||||||
LSET selectedLayers;
|
LSET selectedLayers;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
|
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -371,27 +371,12 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
|
||||||
|
|
||||||
m_svgOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("SVG Options") ), wxHORIZONTAL );
|
m_svgOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("SVG Options") ), wxHORIZONTAL );
|
||||||
|
|
||||||
svgUnitLabel = new wxStaticText( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
svgUnitLabel->Wrap( -1 );
|
|
||||||
m_svgOptionsSizer->Add( svgUnitLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
wxString m_svgUnitsChoices[] = { _("Millimeter"), _("Inch") };
|
|
||||||
int m_svgUnitsNChoices = sizeof( m_svgUnitsChoices ) / sizeof( wxString );
|
|
||||||
m_svgUnits = new wxChoice( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_svgUnitsNChoices, m_svgUnitsChoices, 0 );
|
|
||||||
m_svgUnits->SetSelection( 0 );
|
|
||||||
m_svgUnits->SetToolTip( _("The units that are used for a SVG user units.\nChoose Millimeter when you are not sure.") );
|
|
||||||
|
|
||||||
m_svgOptionsSizer->Add( m_svgUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
m_svgOptionsSizer->Add( 30, 0, 0, 0, 5 );
|
|
||||||
|
|
||||||
svgPrecisionLabel = new wxStaticText( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
|
svgPrecisionLabel = new wxStaticText( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
svgPrecisionLabel->Wrap( -1 );
|
svgPrecisionLabel->Wrap( -1 );
|
||||||
m_svgOptionsSizer->Add( svgPrecisionLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
m_svgOptionsSizer->Add( svgPrecisionLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
m_svgPrecsision = new wxSpinCtrl( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 6, 6 );
|
m_svgPrecsision = new wxSpinCtrl( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 6, 4 );
|
||||||
m_svgPrecsision->SetToolTip( _("How big a SVG user unit is.\nThe number defines how many digits are exported that are below 1 mm or 1 inch.\nUser unit is 10^-<N> mm or 10^-<N> inch.\nChoose 6 if you are not sure.") );
|
m_svgPrecsision->SetToolTip( _("This number defines how many digits are exported that are below 1 mm.\nUser unit is 10^-<N> mm\nChoose 4 if you are not sure.") );
|
||||||
|
|
||||||
m_svgOptionsSizer->Add( m_svgPrecsision, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
m_svgOptionsSizer->Add( m_svgPrecsision, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
|
@ -3593,141 +3593,6 @@
|
||||||
<property name="orient">wxHORIZONTAL</property>
|
<property name="orient">wxHORIZONTAL</property>
|
||||||
<property name="parent">1</property>
|
<property name="parent">1</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxStaticText" expanded="0">
|
|
||||||
<property name="BottomDockable">1</property>
|
|
||||||
<property name="LeftDockable">1</property>
|
|
||||||
<property name="RightDockable">1</property>
|
|
||||||
<property name="TopDockable">1</property>
|
|
||||||
<property name="aui_layer"></property>
|
|
||||||
<property name="aui_name"></property>
|
|
||||||
<property name="aui_position"></property>
|
|
||||||
<property name="aui_row"></property>
|
|
||||||
<property name="best_size"></property>
|
|
||||||
<property name="bg"></property>
|
|
||||||
<property name="caption"></property>
|
|
||||||
<property name="caption_visible">1</property>
|
|
||||||
<property name="center_pane">0</property>
|
|
||||||
<property name="close_button">1</property>
|
|
||||||
<property name="context_help"></property>
|
|
||||||
<property name="context_menu">1</property>
|
|
||||||
<property name="default_pane">0</property>
|
|
||||||
<property name="dock">Dock</property>
|
|
||||||
<property name="dock_fixed">0</property>
|
|
||||||
<property name="docking">Left</property>
|
|
||||||
<property name="enabled">1</property>
|
|
||||||
<property name="fg"></property>
|
|
||||||
<property name="floatable">1</property>
|
|
||||||
<property name="font"></property>
|
|
||||||
<property name="gripper">0</property>
|
|
||||||
<property name="hidden">0</property>
|
|
||||||
<property name="id">wxID_ANY</property>
|
|
||||||
<property name="label">Units:</property>
|
|
||||||
<property name="markup">0</property>
|
|
||||||
<property name="max_size"></property>
|
|
||||||
<property name="maximize_button">0</property>
|
|
||||||
<property name="maximum_size"></property>
|
|
||||||
<property name="min_size"></property>
|
|
||||||
<property name="minimize_button">0</property>
|
|
||||||
<property name="minimum_size"></property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">svgUnitLabel</property>
|
|
||||||
<property name="pane_border">1</property>
|
|
||||||
<property name="pane_position"></property>
|
|
||||||
<property name="pane_size"></property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<property name="pin_button">1</property>
|
|
||||||
<property name="pos"></property>
|
|
||||||
<property name="resize">Resizable</property>
|
|
||||||
<property name="show">1</property>
|
|
||||||
<property name="size"></property>
|
|
||||||
<property name="style"></property>
|
|
||||||
<property name="subclass">; forward_declare</property>
|
|
||||||
<property name="toolbar_pane">0</property>
|
|
||||||
<property name="tooltip"></property>
|
|
||||||
<property name="window_extra_style"></property>
|
|
||||||
<property name="window_name"></property>
|
|
||||||
<property name="window_style"></property>
|
|
||||||
<property name="wrap">-1</property>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxChoice" expanded="0">
|
|
||||||
<property name="BottomDockable">1</property>
|
|
||||||
<property name="LeftDockable">1</property>
|
|
||||||
<property name="RightDockable">1</property>
|
|
||||||
<property name="TopDockable">1</property>
|
|
||||||
<property name="aui_layer"></property>
|
|
||||||
<property name="aui_name"></property>
|
|
||||||
<property name="aui_position"></property>
|
|
||||||
<property name="aui_row"></property>
|
|
||||||
<property name="best_size"></property>
|
|
||||||
<property name="bg"></property>
|
|
||||||
<property name="caption"></property>
|
|
||||||
<property name="caption_visible">1</property>
|
|
||||||
<property name="center_pane">0</property>
|
|
||||||
<property name="choices">"Millimeter" "Inch"</property>
|
|
||||||
<property name="close_button">1</property>
|
|
||||||
<property name="context_help"></property>
|
|
||||||
<property name="context_menu">1</property>
|
|
||||||
<property name="default_pane">0</property>
|
|
||||||
<property name="dock">Dock</property>
|
|
||||||
<property name="dock_fixed">0</property>
|
|
||||||
<property name="docking">Left</property>
|
|
||||||
<property name="enabled">1</property>
|
|
||||||
<property name="fg"></property>
|
|
||||||
<property name="floatable">1</property>
|
|
||||||
<property name="font"></property>
|
|
||||||
<property name="gripper">0</property>
|
|
||||||
<property name="hidden">0</property>
|
|
||||||
<property name="id">wxID_ANY</property>
|
|
||||||
<property name="max_size"></property>
|
|
||||||
<property name="maximize_button">0</property>
|
|
||||||
<property name="maximum_size"></property>
|
|
||||||
<property name="min_size"></property>
|
|
||||||
<property name="minimize_button">0</property>
|
|
||||||
<property name="minimum_size"></property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_svgUnits</property>
|
|
||||||
<property name="pane_border">1</property>
|
|
||||||
<property name="pane_position"></property>
|
|
||||||
<property name="pane_size"></property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<property name="pin_button">1</property>
|
|
||||||
<property name="pos"></property>
|
|
||||||
<property name="resize">Resizable</property>
|
|
||||||
<property name="selection">0</property>
|
|
||||||
<property name="show">1</property>
|
|
||||||
<property name="size"></property>
|
|
||||||
<property name="style"></property>
|
|
||||||
<property name="subclass">; ; forward_declare</property>
|
|
||||||
<property name="toolbar_pane">0</property>
|
|
||||||
<property name="tooltip">The units that are used for a SVG user units.
Choose Millimeter when you are not sure.</property>
|
|
||||||
<property name="validator_data_type"></property>
|
|
||||||
<property name="validator_style">wxFILTER_NONE</property>
|
|
||||||
<property name="validator_type">wxDefaultValidator</property>
|
|
||||||
<property name="validator_variable"></property>
|
|
||||||
<property name="window_extra_style"></property>
|
|
||||||
<property name="window_name"></property>
|
|
||||||
<property name="window_style"></property>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="1">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag"></property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="spacer" expanded="1">
|
|
||||||
<property name="height">0</property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<property name="width">30</property>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="0">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||||
|
@ -3821,7 +3686,7 @@
|
||||||
<property name="gripper">0</property>
|
<property name="gripper">0</property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="initial">6</property>
|
<property name="initial">4</property>
|
||||||
<property name="max">6</property>
|
<property name="max">6</property>
|
||||||
<property name="max_size"></property>
|
<property name="max_size"></property>
|
||||||
<property name="maximize_button">0</property>
|
<property name="maximize_button">0</property>
|
||||||
|
@ -3844,7 +3709,7 @@
|
||||||
<property name="style">wxSP_ARROW_KEYS</property>
|
<property name="style">wxSP_ARROW_KEYS</property>
|
||||||
<property name="subclass">; ; forward_declare</property>
|
<property name="subclass">; ; forward_declare</property>
|
||||||
<property name="toolbar_pane">0</property>
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="tooltip">How big a SVG user unit is.
The number defines how many digits are exported that are below 1 mm or 1 inch.
User unit is 10^-<N> mm or 10^-<N> inch.
Choose 6 if you are not sure.</property>
|
<property name="tooltip">This number defines how many digits are exported that are below 1 mm.
User unit is 10^-<N> mm
Choose 4 if you are not sure.</property>
|
||||||
<property name="value"></property>
|
<property name="value"></property>
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
|
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -15,6 +15,7 @@ class WX_HTML_REPORT_PANEL;
|
||||||
#include "dialog_shim.h"
|
#include "dialog_shim.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/gdicmn.h>
|
||||||
#include <wx/font.h>
|
#include <wx/font.h>
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
|
@ -118,8 +119,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
|
||||||
wxStaticText* DXF_exportUnitsLabel;
|
wxStaticText* DXF_exportUnitsLabel;
|
||||||
wxChoice* m_DXF_plotUnits;
|
wxChoice* m_DXF_plotUnits;
|
||||||
wxStaticBoxSizer* m_svgOptionsSizer;
|
wxStaticBoxSizer* m_svgOptionsSizer;
|
||||||
wxStaticText* svgUnitLabel;
|
|
||||||
wxChoice* m_svgUnits;
|
|
||||||
wxStaticText* svgPrecisionLabel;
|
wxStaticText* svgPrecisionLabel;
|
||||||
wxSpinCtrl* m_svgPrecsision;
|
wxSpinCtrl* m_svgPrecsision;
|
||||||
WX_HTML_REPORT_PANEL* m_messagesPanel;
|
WX_HTML_REPORT_PANEL* m_messagesPanel;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#define SVG_PRECISION_MIN 3U
|
#define SVG_PRECISION_MIN 3U
|
||||||
#define SVG_PRECISION_MAX 6U
|
#define SVG_PRECISION_MAX 6U
|
||||||
#define SVG_PRECISION_DEFAULT 6
|
#define SVG_PRECISION_DEFAULT 4
|
||||||
|
|
||||||
|
|
||||||
// default trailing digits in Gerber coordinates, when units are mm
|
// default trailing digits in Gerber coordinates, when units are mm
|
||||||
|
@ -101,7 +101,6 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
|
||||||
|
|
||||||
// we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
|
// we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
|
||||||
m_svgPrecision = SVG_PRECISION_DEFAULT;
|
m_svgPrecision = SVG_PRECISION_DEFAULT;
|
||||||
m_svgUseInch = false;
|
|
||||||
m_excludeEdgeLayer = true;
|
m_excludeEdgeLayer = true;
|
||||||
m_plotFrameRef = false;
|
m_plotFrameRef = false;
|
||||||
m_plotViaOnMaskLayer = false;
|
m_plotViaOnMaskLayer = false;
|
||||||
|
@ -158,9 +157,8 @@ void PCB_PLOT_PARAMS::SetGerberPrecision( int aPrecision )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision, bool aUseInch )
|
void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
|
||||||
{
|
{
|
||||||
m_svgUseInch = aUseInch;
|
|
||||||
m_svgPrecision = Clamp( SVG_PRECISION_MIN, aPrecision, SVG_PRECISION_MAX );
|
m_svgPrecision = Clamp( SVG_PRECISION_MIN, aPrecision, SVG_PRECISION_MAX );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +177,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
|
||||||
aFormatter->Print( aNestLevel+1, "(layerselection 0x%s)\n",
|
aFormatter->Print( aNestLevel+1, "(layerselection 0x%s)\n",
|
||||||
m_layerSelection.FmtHex().c_str() );
|
m_layerSelection.FmtHex().c_str() );
|
||||||
|
|
||||||
aFormatter->Print( aNestLevel+1, "(disableapertmacros %s)\n",
|
aFormatter->Print( aNestLevel+1, "(disableapertmacros %s)\n",
|
||||||
printBool( m_gerberDisableApertMacros ) );
|
printBool( m_gerberDisableApertMacros ) );
|
||||||
|
|
||||||
aFormatter->Print( aNestLevel+1, "(usegerberextensions %s)\n",
|
aFormatter->Print( aNestLevel+1, "(usegerberextensions %s)\n",
|
||||||
|
@ -203,7 +201,6 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
|
||||||
aFormatter->Print( aNestLevel+1, "(dashed_line_gap_ratio %f)\n", GetDashedLineGapRatio() );
|
aFormatter->Print( aNestLevel+1, "(dashed_line_gap_ratio %f)\n", GetDashedLineGapRatio() );
|
||||||
|
|
||||||
// SVG options
|
// SVG options
|
||||||
aFormatter->Print( aNestLevel+1, "(svguseinch %s)\n", printBool( m_svgUseInch ) );
|
|
||||||
aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision );
|
aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision );
|
||||||
|
|
||||||
aFormatter->Print( aNestLevel+1, "(excludeedgelayer %s)\n", printBool( m_excludeEdgeLayer ) );
|
aFormatter->Print( aNestLevel+1, "(excludeedgelayer %s)\n", printBool( m_excludeEdgeLayer ) );
|
||||||
|
@ -240,7 +237,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
|
||||||
aFormatter->Print( aNestLevel+1, "(mirror %s)\n", printBool( m_mirror ) );
|
aFormatter->Print( aNestLevel+1, "(mirror %s)\n", printBool( m_mirror ) );
|
||||||
aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", m_drillMarks );
|
aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", m_drillMarks );
|
||||||
aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection );
|
aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection );
|
||||||
aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")",
|
aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")",
|
||||||
(const char*) m_outputDirectory.utf8_str() );
|
(const char*) m_outputDirectory.utf8_str() );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
aFormatter->Print( aNestLevel, ")\n" );
|
aFormatter->Print( aNestLevel, ")\n" );
|
||||||
|
@ -303,9 +300,6 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||||
if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
|
if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( m_svgUseInch != aPcbPlotParams.m_svgUseInch )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
|
if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -484,7 +478,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_svguseinch:
|
case T_svguseinch:
|
||||||
aPcbPlotParams->m_svgUseInch = parseBool();
|
parseBool(); // Unused. For compatibility
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_psa4output:
|
case T_psa4output:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -149,9 +149,8 @@ public:
|
||||||
void SetGerberPrecision( int aPrecision );
|
void SetGerberPrecision( int aPrecision );
|
||||||
int GetGerberPrecision() const { return m_gerberPrecision; }
|
int GetGerberPrecision() const { return m_gerberPrecision; }
|
||||||
|
|
||||||
void SetSvgPrecision( unsigned aPrecision, bool aUseInch );
|
void SetSvgPrecision( unsigned aPrecision );
|
||||||
unsigned GetSvgPrecision() const { return m_svgPrecision; }
|
unsigned GetSvgPrecision() const { return m_svgPrecision; }
|
||||||
bool GetSvgUseInch() const { return m_svgUseInch; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default precision of coordinates in Gerber files.
|
* Default precision of coordinates in Gerber files.
|
||||||
|
@ -282,10 +281,6 @@ private:
|
||||||
/// 6 is the internal resolution of Pcbnew
|
/// 6 is the internal resolution of Pcbnew
|
||||||
unsigned m_svgPrecision;
|
unsigned m_svgPrecision;
|
||||||
|
|
||||||
/// units for SVG plot
|
|
||||||
/// false for metric, true for inch/mils
|
|
||||||
bool m_svgUseInch;
|
|
||||||
|
|
||||||
/// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates
|
/// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates
|
||||||
bool m_useAuxOrigin;
|
bool m_useAuxOrigin;
|
||||||
|
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
||||||
aPlotter->SetGerberCoordinatesFormat( aPlotOpts->GetGerberPrecision() );
|
aPlotter->SetGerberCoordinatesFormat( aPlotOpts->GetGerberPrecision() );
|
||||||
|
|
||||||
// Has meaning only for SVG plotter. Must be called only after SetViewport
|
// Has meaning only for SVG plotter. Must be called only after SetViewport
|
||||||
aPlotter->SetSvgCoordinatesFormat( aPlotOpts->GetSvgPrecision(), aPlotOpts->GetSvgUseInch() );
|
aPlotter->SetSvgCoordinatesFormat( aPlotOpts->GetSvgPrecision() );
|
||||||
|
|
||||||
aPlotter->SetCreator( wxT( "PCBNEW" ) );
|
aPlotter->SetCreator( wxT( "PCBNEW" ) );
|
||||||
aPlotter->SetColorMode( false ); // default is plot in Black and White.
|
aPlotter->SetColorMode( false ); // default is plot in Black and White.
|
||||||
|
|
Loading…
Reference in New Issue