Plot code cleaning.
This commit is contained in:
parent
9ae9301b46
commit
8f30404e42
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file HPGL_plotter.cpp
|
* @file HPGL_plotter.cpp
|
||||||
* @brief Kicad: specialized plotter for HPGL files format
|
* @brief KiCad plotter for HPGL file format.
|
||||||
* Since this plot engine is mostly intended for import in external programs,
|
* Since this plot engine is mostly intended for import in external programs,
|
||||||
* sadly HPGL/2 isn't supported a lot... some of the primitives use overlapped
|
* sadly HPGL/2 isn't supported a lot... some of the primitives use overlapped
|
||||||
* strokes to fill the shape
|
* strokes to fill the shape.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Some HPGL commands:
|
/* Some HPGL commands:
|
||||||
|
@ -195,7 +195,6 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include <eda_base_frame.h>
|
|
||||||
#include <fill_type.h>
|
#include <fill_type.h>
|
||||||
#include <string_utils.h>
|
#include <string_utils.h>
|
||||||
#include <convert_basic_shapes_to_polygon.h>
|
#include <convert_basic_shapes_to_polygon.h>
|
||||||
|
@ -206,7 +205,7 @@
|
||||||
|
|
||||||
|
|
||||||
/// Compute the distance between two DPOINT points.
|
/// Compute the distance between two DPOINT points.
|
||||||
static double dpoint_dist( DPOINT a, DPOINT b );
|
static double dpoint_dist( const DPOINT& a, const DPOINT& b );
|
||||||
|
|
||||||
|
|
||||||
// The hpgl command to close a polygon def, fill it and plot outline:
|
// The hpgl command to close a polygon def, fill it and plot outline:
|
||||||
|
@ -215,10 +214,12 @@ static double dpoint_dist( DPOINT a, DPOINT b );
|
||||||
// EP; draws the polygon outline. It usually gives a better look to the filled polygon
|
// EP; draws the polygon outline. It usually gives a better look to the filled polygon
|
||||||
static const char hpgl_end_polygon_cmd[] = "PM 2; FP; EP;\n";
|
static const char hpgl_end_polygon_cmd[] = "PM 2; FP; EP;\n";
|
||||||
|
|
||||||
|
|
||||||
// HPGL scale factor (1 Plotter Logical Unit = 1/40mm = 25 micrometers)
|
// HPGL scale factor (1 Plotter Logical Unit = 1/40mm = 25 micrometers)
|
||||||
// PLUsPERDECIMIL = (25.4 / 10000) / 0.025
|
// PLUsPERDECIMIL = (25.4 / 10000) / 0.025
|
||||||
static const double PLUsPERDECIMIL = 0.1016;
|
static const double PLUsPERDECIMIL = 0.1016;
|
||||||
|
|
||||||
|
|
||||||
HPGL_PLOTTER::HPGL_PLOTTER()
|
HPGL_PLOTTER::HPGL_PLOTTER()
|
||||||
: arcTargetChordLength( 0 ),
|
: arcTargetChordLength( 0 ),
|
||||||
arcMinChordDegrees( 5.0 ),
|
arcMinChordDegrees( 5.0 ),
|
||||||
|
@ -232,6 +233,7 @@ HPGL_PLOTTER::HPGL_PLOTTER()
|
||||||
SetPenDiameter( 0.0 );
|
SetPenDiameter( 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
double aScale, bool aMirror )
|
double aScale, bool aMirror )
|
||||||
{
|
{
|
||||||
|
@ -240,7 +242,7 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
m_IUsPerDecimil = aIusPerDecimil;
|
m_IUsPerDecimil = aIusPerDecimil;
|
||||||
m_iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
|
m_iuPerDeviceUnit = PLUsPERDECIMIL / aIusPerDecimil;
|
||||||
|
|
||||||
/* Compute the paper size in IUs */
|
// Compute the paper size in IUs.
|
||||||
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;
|
||||||
|
@ -331,6 +333,7 @@ bool HPGL_PLOTTER::EndPlot()
|
||||||
fputs( "PU;", m_outputFile );
|
fputs( "PU;", m_outputFile );
|
||||||
pen_up = true;
|
pen_up = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_outputFile, "SP%d;", item.pen );
|
fprintf( m_outputFile, "SP%d;", item.pen );
|
||||||
current_pen = item.pen;
|
current_pen = item.pen;
|
||||||
}
|
}
|
||||||
|
@ -428,11 +431,11 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
||||||
// Draw the filled area
|
// Draw the filled area
|
||||||
MoveTo( centre );
|
MoveTo( centre );
|
||||||
startOrAppendItem( center_dev, wxString::Format( "PM 0;CI %g,%g;%s", radius, chord_degrees,
|
startOrAppendItem( center_dev, wxString::Format( "PM 0;CI %g,%g;%s", radius, chord_degrees,
|
||||||
hpgl_end_polygon_cmd ) );
|
hpgl_end_polygon_cmd ) );
|
||||||
m_current_item->lift_before = true;
|
m_current_item->lift_before = true;
|
||||||
m_current_item->pen_returns = true;
|
m_current_item->pen_returns = true;
|
||||||
m_current_item->bbox.Merge(
|
m_current_item->bbox.Merge( BOX2D( center_dev - radius,
|
||||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) ) );
|
VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||||
PenFinish();
|
PenFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,8 +445,8 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_TYPE fill,
|
||||||
startOrAppendItem( center_dev, wxString::Format( "CI %g,%g;", radius, chord_degrees ) );
|
startOrAppendItem( center_dev, wxString::Format( "CI %g,%g;", radius, chord_degrees ) );
|
||||||
m_current_item->lift_before = true;
|
m_current_item->lift_before = true;
|
||||||
m_current_item->pen_returns = true;
|
m_current_item->pen_returns = true;
|
||||||
m_current_item->bbox.Merge(
|
m_current_item->bbox.Merge( BOX2D( center_dev - radius,
|
||||||
BOX2D( center_dev - radius, VECTOR2D( 2 * radius, 2 * radius ) ) );
|
VECTOR2D( 2 * radius, 2 * radius ) ) );
|
||||||
PenFinish();
|
PenFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,14 +529,7 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||||
else if( plume == 'D' )
|
else if( plume == 'D' )
|
||||||
{
|
{
|
||||||
m_penState = 'D';
|
m_penState = 'D';
|
||||||
startOrAppendItem(
|
startOrAppendItem( lastpos_dev, wxString::Format( "PA %.0f,%.0f;", pos_dev.x, pos_dev.y ) );
|
||||||
lastpos_dev,
|
|
||||||
wxString::Format(
|
|
||||||
"PA %.0f,%.0f;",
|
|
||||||
pos_dev.x,
|
|
||||||
pos_dev.y
|
|
||||||
)
|
|
||||||
);
|
|
||||||
m_current_item->loc_end = pos_dev;
|
m_current_item->loc_end = pos_dev;
|
||||||
m_current_item->bbox.Merge( pos_dev );
|
m_current_item->bbox.Merge( pos_dev );
|
||||||
}
|
}
|
||||||
|
@ -607,11 +603,11 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
||||||
DPOINT cmap_dev = userToDeviceCoordinates( cmap );
|
DPOINT cmap_dev = userToDeviceCoordinates( cmap );
|
||||||
|
|
||||||
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%.0f,%g", centre_dev.x,
|
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%.0f,%g", centre_dev.x,
|
||||||
centre_dev.y, angle, chord_degrees ) );
|
centre_dev.y, angle, chord_degrees ) );
|
||||||
|
|
||||||
// TODO We could compute the final position and full bounding box instead...
|
// TODO We could compute the final position and full bounding box instead...
|
||||||
m_current_item->bbox.Merge(
|
m_current_item->bbox.Merge( BOX2D( centre_dev - radius_dev,
|
||||||
BOX2D( centre_dev - radius_dev, VECTOR2D( radius_dev * 2, radius_dev * 2 ) ) );
|
VECTOR2D( radius_dev * 2, radius_dev * 2 ) ) );
|
||||||
m_current_item->lift_after = true;
|
m_current_item->lift_after = true;
|
||||||
flushItem();
|
flushItem();
|
||||||
}
|
}
|
||||||
|
@ -676,10 +672,11 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
||||||
// A filled polygon uses always the current point to start the polygon.
|
// A filled polygon uses always the current point to start the polygon.
|
||||||
// Gives a correct current starting point for the circle
|
// Gives a correct current starting point for the circle
|
||||||
MoveTo( wxPoint( pos.x+radius, pos.y ) );
|
MoveTo( wxPoint( pos.x+radius, pos.y ) );
|
||||||
|
|
||||||
// Plot filled area and its outline
|
// Plot filled area and its outline
|
||||||
startOrAppendItem( userToDeviceCoordinates( wxPoint( pos.x + radius, pos.y ) ),
|
startOrAppendItem( userToDeviceCoordinates( wxPoint( pos.x + radius, pos.y ) ),
|
||||||
wxString::Format( "PM 0; PA %.0f,%.0f;CI %.0f;%s", pos_dev.x, pos_dev.y, rsize,
|
wxString::Format( "PM 0; PA %.0f,%.0f;CI %.0f;%s",
|
||||||
hpgl_end_polygon_cmd ) );
|
pos_dev.x, pos_dev.y, rsize, hpgl_end_polygon_cmd ) );
|
||||||
m_current_item->lift_before = true;
|
m_current_item->lift_before = true;
|
||||||
m_current_item->pen_returns = true;
|
m_current_item->pen_returns = true;
|
||||||
}
|
}
|
||||||
|
@ -719,6 +716,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
|
||||||
corners.emplace_back( - dx, + dy );
|
corners.emplace_back( - dx, + dy );
|
||||||
corners.emplace_back( + dx, + dy );
|
corners.emplace_back( + dx, + dy );
|
||||||
corners.emplace_back( + dx, - dy );
|
corners.emplace_back( + dx, - dy );
|
||||||
|
|
||||||
// Close polygon
|
// Close polygon
|
||||||
corners.emplace_back( - dx, - dy );
|
corners.emplace_back( - dx, - dy );
|
||||||
|
|
||||||
|
@ -742,8 +740,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
|
||||||
|
|
||||||
if( aTraceMode == FILLED )
|
if( aTraceMode == FILLED )
|
||||||
{
|
{
|
||||||
// in filled mode, the pen diameter is removed from size
|
// In filled mode, the pen diameter is removed from size to keep the pad size.
|
||||||
// to keep the pad size
|
|
||||||
size.x -= KiROUND( penDiameter ) / 2;
|
size.x -= KiROUND( penDiameter ) / 2;
|
||||||
size.x = std::max( size.x, 0);
|
size.x = std::max( size.x, 0);
|
||||||
size.y -= KiROUND( penDiameter ) / 2;
|
size.y -= KiROUND( penDiameter ) / 2;
|
||||||
|
@ -770,9 +767,9 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
|
||||||
PlotPoly( cornerList, aTraceMode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
|
PlotPoly( cornerList, aTraceMode == FILLED ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
|
||||||
double aOrient, SHAPE_POLY_SET* aPolygons,
|
void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize, double aOrient,
|
||||||
OUTLINE_MODE aTraceMode, void* aData )
|
SHAPE_POLY_SET* aPolygons, OUTLINE_MODE aTraceMode, void* aData )
|
||||||
{
|
{
|
||||||
std::vector< wxPoint > cornerList;
|
std::vector< wxPoint > cornerList;
|
||||||
|
|
||||||
|
@ -823,7 +820,7 @@ void HPGL_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aRadius, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HPGL_PLOTTER::startItem( DPOINT location )
|
bool HPGL_PLOTTER::startItem( const DPOINT& location )
|
||||||
{
|
{
|
||||||
return startOrAppendItem( location, wxEmptyString );
|
return startOrAppendItem( location, wxEmptyString );
|
||||||
}
|
}
|
||||||
|
@ -835,7 +832,7 @@ void HPGL_PLOTTER::flushItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HPGL_PLOTTER::startOrAppendItem( DPOINT location, wxString const& content )
|
bool HPGL_PLOTTER::startOrAppendItem( const DPOINT& location, wxString const& content )
|
||||||
{
|
{
|
||||||
if( m_current_item == nullptr )
|
if( m_current_item == nullptr )
|
||||||
{
|
{
|
||||||
|
@ -874,7 +871,7 @@ void HPGL_PLOTTER::sortItems( std::list<HPGL_ITEM>& items )
|
||||||
// 2) Within the items for one pen, avoid bouncing back and forth around
|
// 2) Within the items for one pen, avoid bouncing back and forth around
|
||||||
// the page; items should be sequenced with nearby items.
|
// the page; items should be sequenced with nearby items.
|
||||||
//
|
//
|
||||||
// This is essentially a variant of the Travelling Salesman Problem where
|
// This is essentially a variant of the Traveling Salesman Problem where
|
||||||
// the cities are themselves edges that must be traversed. This is of course
|
// the cities are themselves edges that must be traversed. This is of course
|
||||||
// a famously NP-Hard problem and this particular variant has a monstrous
|
// a famously NP-Hard problem and this particular variant has a monstrous
|
||||||
// number of "cities". For now, we're using a naive nearest-neighbor search,
|
// number of "cities". For now, we're using a naive nearest-neighbor search,
|
||||||
|
@ -897,8 +894,7 @@ void HPGL_PLOTTER::sortItems( std::list<HPGL_ITEM>& items )
|
||||||
|
|
||||||
for( auto search_it = best_it; search_it != items.end(); search_it++ )
|
for( auto search_it = best_it; search_it != items.end(); search_it++ )
|
||||||
{
|
{
|
||||||
// Immediately forget an item as "best" if another one is a better
|
// Immediately forget an item as "best" if another one is a better pen match
|
||||||
// pen match
|
|
||||||
if( best_it->pen != last_item.pen && search_it->pen == last_item.pen )
|
if( best_it->pen != last_item.pen && search_it->pen == last_item.pen )
|
||||||
{
|
{
|
||||||
best_it = search_it;
|
best_it = search_it;
|
||||||
|
@ -944,7 +940,7 @@ const char* HPGL_PLOTTER::lineTypeCommand( PLOT_DASH_TYPE linetype )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static double dpoint_dist( DPOINT a, DPOINT b )
|
static double dpoint_dist( const DPOINT& a, const DPOINT& b )
|
||||||
{
|
{
|
||||||
DPOINT diff = a - b;
|
DPOINT diff = a - b;
|
||||||
return sqrt( diff.x * diff.x + diff.y * diff.y );
|
return sqrt( diff.x * diff.x + diff.y * diff.y );
|
||||||
|
|
|
@ -363,7 +363,7 @@ void PDF_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PDF_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, double aScaleFactor )
|
void PDF_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
|
||||||
{
|
{
|
||||||
wxASSERT( workFile );
|
wxASSERT( workFile );
|
||||||
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
|
wxSize pix_size( aImage.GetWidth(), aImage.GetHeight() );
|
||||||
|
@ -663,8 +663,7 @@ bool PDF_PLOTTER::StartPlot()
|
||||||
that they must have the bit 7 set) */
|
that they must have the bit 7 set) */
|
||||||
fputs( "%PDF-1.5\n%\200\201\202\203\n", m_outputFile );
|
fputs( "%PDF-1.5\n%\200\201\202\203\n", m_outputFile );
|
||||||
|
|
||||||
/* Allocate an entry for the page tree root, it will go in every page
|
/* Allocate an entry for the page tree root, it will go in every page parent entry */
|
||||||
parent entry */
|
|
||||||
pageTreeHandle = allocPdfObject();
|
pageTreeHandle = allocPdfObject();
|
||||||
|
|
||||||
/* In the same way, the font resource dictionary is used by every page
|
/* In the same way, the font resource dictionary is used by every page
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file PS_plotter.cpp
|
* @file PS_plotter.cpp
|
||||||
* @brief Kicad: specialized plotter for PS files format
|
* @brief KiCad: specialized plotter for PS files format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <eda_base_frame.h>
|
#include <eda_base_frame.h>
|
||||||
|
@ -77,8 +77,10 @@ void PSLIKE_PLOTTER::SetColor( const COLOR4D& color )
|
||||||
* holes in white on pads in black
|
* holes in white on pads in black
|
||||||
*/
|
*/
|
||||||
double k = 1; // White
|
double k = 1; // White
|
||||||
|
|
||||||
if( color != COLOR4D::WHITE )
|
if( color != COLOR4D::WHITE )
|
||||||
k = 0;
|
k = 0;
|
||||||
|
|
||||||
if( m_negativeMode )
|
if( m_negativeMode )
|
||||||
emitSetRGBColor( 1 - k, 1 - k, 1 - k );
|
emitSetRGBColor( 1 - k, 1 - k, 1 - k );
|
||||||
else
|
else
|
||||||
|
@ -189,6 +191,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
|
||||||
GetCurrentLineWidth() );
|
GetCurrentLineWidth() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
|
void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
|
||||||
int aCornerRadius, double aOrient,
|
int aCornerRadius, double aOrient,
|
||||||
OUTLINE_MODE aTraceMode, void* aData )
|
OUTLINE_MODE aTraceMode, void* aData )
|
||||||
|
@ -204,7 +207,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
size.x -= GetCurrentLineWidth();
|
size.x -= GetCurrentLineWidth();
|
||||||
size.y -= GetCurrentLineWidth();
|
size.y -= GetCurrentLineWidth();
|
||||||
aCornerRadius -= GetCurrentLineWidth()/2;
|
aCornerRadius -= GetCurrentLineWidth() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,6 +216,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
||||||
0.0, 0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
0.0, 0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
||||||
|
|
||||||
std::vector< wxPoint > cornerList;
|
std::vector< wxPoint > cornerList;
|
||||||
|
|
||||||
// TransformRoundRectToPolygon creates only one convex polygon
|
// TransformRoundRectToPolygon creates only one convex polygon
|
||||||
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
||||||
cornerList.reserve( poly.PointCount() );
|
cornerList.reserve( poly.PointCount() );
|
||||||
|
@ -227,6 +231,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
|
||||||
GetCurrentLineWidth() );
|
GetCurrentLineWidth() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
||||||
double aOrient, SHAPE_POLY_SET* aPolygons,
|
double aOrient, SHAPE_POLY_SET* aPolygons,
|
||||||
OUTLINE_MODE aTraceMode, void* aData )
|
OUTLINE_MODE aTraceMode, void* aData )
|
||||||
|
@ -263,6 +268,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
|
void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
|
||||||
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
||||||
{
|
{
|
||||||
|
@ -280,6 +286,7 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCor
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
int w = GetCurrentLineWidth();
|
int w = GetCurrentLineWidth();
|
||||||
|
|
||||||
// offset polygon by w
|
// offset polygon by w
|
||||||
// coord[0] is assumed the lower left
|
// coord[0] is assumed the lower left
|
||||||
// coord[1] is assumed the upper left
|
// coord[1] is assumed the upper left
|
||||||
|
@ -333,10 +340,11 @@ std::string PSLIKE_PLOTTER::encodeStringForPlotter( const wxString& aUnicode )
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
// The ~ shouldn't reach the outside
|
// The ~ shouldn't reach the outside
|
||||||
case '~':
|
case '~':
|
||||||
break;
|
break;
|
||||||
// These characters must be escaped
|
|
||||||
|
// These characters must be escaped
|
||||||
case '(':
|
case '(':
|
||||||
case ')':
|
case ')':
|
||||||
case '\\':
|
case '\\':
|
||||||
|
@ -366,15 +374,15 @@ int PSLIKE_PLOTTER::returnPostscriptTextWidth( const wxString& aText, int aXSize
|
||||||
for( unsigned i = 0; i < aText.length(); i++ )
|
for( unsigned i = 0; i < aText.length(); i++ )
|
||||||
{
|
{
|
||||||
wchar_t AsciiCode = aText[i];
|
wchar_t AsciiCode = aText[i];
|
||||||
// Skip the negation marks and untabled points
|
|
||||||
|
// Skip the negation marks and untabled points.
|
||||||
if( AsciiCode != '~' && AsciiCode < 256 )
|
if( AsciiCode != '~' && AsciiCode < 256 )
|
||||||
{
|
{
|
||||||
tally += width_table[AsciiCode];
|
tally += width_table[AsciiCode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widths are proportional to height, but height is enlarged by a
|
// Widths are proportional to height, but height is enlarged by a scaling factor.
|
||||||
// scaling factor
|
|
||||||
return KiROUND( aXSize * tally / postscriptTextAscent );
|
return KiROUND( aXSize * tally / postscriptTextAscent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,6 +400,7 @@ void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXS
|
||||||
for( unsigned i = 0; i < aText.length(); i++ )
|
for( unsigned i = 0; i < aText.length(); i++ )
|
||||||
{
|
{
|
||||||
wchar_t AsciiCode = aText[i];
|
wchar_t AsciiCode = aText[i];
|
||||||
|
|
||||||
// Skip the negation marks and untabled points
|
// Skip the negation marks and untabled points
|
||||||
if( AsciiCode != '~' && AsciiCode < 256 )
|
if( AsciiCode != '~' && AsciiCode < 256 )
|
||||||
{
|
{
|
||||||
|
@ -419,6 +428,7 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
m_plotScale = aScale;
|
m_plotScale = aScale;
|
||||||
m_IUsPerDecimil = aIusPerDecimil;
|
m_IUsPerDecimil = aIusPerDecimil;
|
||||||
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||||
|
|
||||||
/* Compute the paper size in IUs */
|
/* Compute the paper size in IUs */
|
||||||
m_paperSize = m_pageInfo.GetSizeMils();
|
m_paperSize = m_pageInfo.GetSizeMils();
|
||||||
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
||||||
|
@ -674,6 +684,7 @@ void PS_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double a
|
||||||
// Locate lower-left corner of image
|
// Locate lower-left corner of image
|
||||||
DPOINT start_dev = userToDeviceCoordinates( start );
|
DPOINT start_dev = userToDeviceCoordinates( start );
|
||||||
fprintf( m_outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
|
fprintf( m_outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
|
||||||
|
|
||||||
// Map image size to device
|
// Map image size to device
|
||||||
DPOINT end_dev = userToDeviceCoordinates( end );
|
DPOINT end_dev = userToDeviceCoordinates( end );
|
||||||
fprintf( m_outputFile, "%g %g scale\n",
|
fprintf( m_outputFile, "%g %g scale\n",
|
||||||
|
@ -681,8 +692,10 @@ void PS_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos, double a
|
||||||
|
|
||||||
// Dimensions of source image (in pixels
|
// Dimensions of source image (in pixels
|
||||||
fprintf( m_outputFile, "%d %d 8", pix_size.x, pix_size.y );
|
fprintf( m_outputFile, "%d %d 8", pix_size.x, pix_size.y );
|
||||||
|
|
||||||
// Map unit square to source
|
// Map unit square to source
|
||||||
fprintf( m_outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
|
fprintf( m_outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
|
||||||
|
|
||||||
// include image data in ps file
|
// include image data in ps file
|
||||||
fprintf( m_outputFile, "{currentfile pix readhexstring pop}\n" );
|
fprintf( m_outputFile, "{currentfile pix readhexstring pop}\n" );
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file SVG_plotter.cpp
|
* @file SVG_plotter.cpp
|
||||||
* @brief Kicad: specialized plotter for SVG files format
|
* @brief KiCad: specialized plotter for SVG files format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -193,6 +193,7 @@ void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
SetSvgCoordinatesFormat( 4, true );
|
SetSvgCoordinatesFormat( 4, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SVG_PLOTTER::SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches )
|
void SVG_PLOTTER::SetSvgCoordinatesFormat( unsigned aResolution, bool aUseInches )
|
||||||
{
|
{
|
||||||
m_useInch = aUseInches;
|
m_useInch = aUseInches;
|
||||||
|
@ -355,8 +356,7 @@ void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b )
|
||||||
m_graphics_changed = true;
|
m_graphics_changed = true;
|
||||||
m_pen_rgb_color = rgb_color;
|
m_pen_rgb_color = rgb_color;
|
||||||
|
|
||||||
// Currently, use the same color for brush and pen
|
// Currently, use the same color for brush and pen (i.e. to draw and fill a contour).
|
||||||
// (i.e. to draw and fill a contour)
|
|
||||||
m_brush_rgb_color = rgb_color;
|
m_brush_rgb_color = rgb_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,6 +382,7 @@ void SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, in
|
||||||
DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() );
|
DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() );
|
||||||
DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() );
|
DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() );
|
||||||
DSIZE size_dev = end_dev - org_dev;
|
DSIZE 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
|
||||||
// Inkscape has problems with negative or null values for width and/or height, so avoid them
|
// Inkscape has problems with negative or null values for width and/or height, so avoid them
|
||||||
|
@ -554,7 +555,7 @@ void SVG_PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
|
||||||
start.x, start.y, ctrl1.x, ctrl1.y,
|
start.x, start.y, ctrl1.x, ctrl1.y,
|
||||||
ctrl2.x, ctrl2.y, end.x, end.y );
|
ctrl2.x, ctrl2.y, end.x, end.y );
|
||||||
#else
|
#else
|
||||||
PLOTTER::BezierCurve( aStart, aControl1,aControl2, aEnd,aTolerance, aLineThickness );
|
PLOTTER::BezierCurve( aStart, aControl1, aControl2, aEnd, aTolerance, aLineThickness );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,6 +812,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize text_size;
|
wxSize text_size;
|
||||||
|
|
||||||
// aSize.x or aSize.y is < 0 for mirrored texts.
|
// aSize.x or aSize.y is < 0 for mirrored texts.
|
||||||
// The actual text size value is the absolute value
|
// The actual text size value is the absolute value
|
||||||
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, aWidth ) );
|
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, aWidth ) );
|
||||||
|
|
|
@ -94,63 +94,63 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case WSG_LINE_T:
|
case WSG_LINE_T:
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_LINE* line = (DS_DRAW_ITEM_LINE*) item;
|
DS_DRAW_ITEM_LINE* line = (DS_DRAW_ITEM_LINE*) item;
|
||||||
plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
|
plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
|
||||||
plotter->MoveTo( line->GetStart() );
|
plotter->MoveTo( line->GetStart() );
|
||||||
plotter->FinishTo( line->GetEnd() );
|
plotter->FinishTo( line->GetEnd() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_RECT_T:
|
case WSG_RECT_T:
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_RECT* rect = (DS_DRAW_ITEM_RECT*) item;
|
DS_DRAW_ITEM_RECT* rect = (DS_DRAW_ITEM_RECT*) item;
|
||||||
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
|
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
|
||||||
plotter->Rect( rect->GetStart(), rect->GetEnd(), FILL_TYPE::NO_FILL, penWidth );
|
plotter->Rect( rect->GetStart(), rect->GetEnd(), FILL_TYPE::NO_FILL, penWidth );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_TEXT_T:
|
case WSG_TEXT_T:
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_TEXT* text = (DS_DRAW_ITEM_TEXT*) item;
|
DS_DRAW_ITEM_TEXT* text = (DS_DRAW_ITEM_TEXT*) item;
|
||||||
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
|
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
|
||||||
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
||||||
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||||
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||||
text->IsMultilineAllowed() );
|
text->IsMultilineAllowed() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_POLY_T:
|
case WSG_POLY_T:
|
||||||
|
{
|
||||||
|
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
|
||||||
|
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
||||||
|
std::vector<wxPoint> points;
|
||||||
|
|
||||||
|
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
|
points.clear();
|
||||||
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
SHAPE_LINE_CHAIN& outline = poly->GetPolygons().Outline( idx );
|
||||||
std::vector<wxPoint> points;
|
|
||||||
|
|
||||||
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
||||||
{
|
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
|
||||||
points.clear();
|
|
||||||
SHAPE_LINE_CHAIN& outline = poly->GetPolygons().Outline( idx );
|
|
||||||
|
|
||||||
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
plotter->PlotPoly( points, FILL_TYPE::FILLED_SHAPE, penWidth );
|
||||||
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
|
|
||||||
|
|
||||||
plotter->PlotPoly( points, FILL_TYPE::FILLED_SHAPE, penWidth );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_BITMAP_T:
|
case WSG_BITMAP_T:
|
||||||
{
|
{
|
||||||
DS_DRAW_ITEM_BITMAP* drawItem = (DS_DRAW_ITEM_BITMAP*) item;
|
DS_DRAW_ITEM_BITMAP* drawItem = (DS_DRAW_ITEM_BITMAP*) item;
|
||||||
DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
|
DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
|
||||||
|
|
||||||
if( bitmap->m_ImageBitmap == nullptr )
|
if( bitmap->m_ImageBitmap == nullptr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
|
bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
|
||||||
PLOTTER::USE_DEFAULT_LINE_WIDTH );
|
PLOTTER::USE_DEFAULT_LINE_WIDTH );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <bezier_curves.h>
|
#include <bezier_curves.h>
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
|
|
||||||
|
|
||||||
PLOTTER::PLOTTER( )
|
PLOTTER::PLOTTER( )
|
||||||
{
|
{
|
||||||
m_plotScale = 1;
|
m_plotScale = 1;
|
||||||
|
@ -58,16 +59,17 @@ PLOTTER::PLOTTER( )
|
||||||
m_outputFile = nullptr;
|
m_outputFile = nullptr;
|
||||||
m_colorMode = false; // Starts as a BW plot
|
m_colorMode = false; // Starts as a BW plot
|
||||||
m_negativeMode = false;
|
m_negativeMode = false;
|
||||||
|
|
||||||
// Temporary init to avoid not initialized vars, will be set later
|
// Temporary init to avoid not initialized vars, will be set later
|
||||||
m_IUsPerDecimil = 1; // will be set later to the actual value
|
m_IUsPerDecimil = 1; // will be set later to the actual value
|
||||||
m_iuPerDeviceUnit = 1; // will be set later to the actual value
|
m_iuPerDeviceUnit = 1; // will be set later to the actual value
|
||||||
m_renderSettings = nullptr;
|
m_renderSettings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PLOTTER::~PLOTTER()
|
PLOTTER::~PLOTTER()
|
||||||
{
|
{
|
||||||
// Emergency cleanup, but closing the file is
|
// Emergency cleanup, but closing the file is usually made in EndPlot().
|
||||||
// usually made in EndPlot().
|
|
||||||
if( m_outputFile )
|
if( m_outputFile )
|
||||||
fclose( m_outputFile );
|
fclose( m_outputFile );
|
||||||
}
|
}
|
||||||
|
@ -79,8 +81,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
|
||||||
|
|
||||||
wxASSERT( !m_outputFile );
|
wxASSERT( !m_outputFile );
|
||||||
|
|
||||||
// Open the file in text mode (not suitable for all plotters
|
// Open the file in text mode (not suitable for all plotters but only for most of them.
|
||||||
// but only for most of them
|
|
||||||
m_outputFile = wxFopen( m_filename, wxT( "wt" ) );
|
m_outputFile = wxFopen( m_filename, wxT( "wt" ) );
|
||||||
|
|
||||||
if( m_outputFile == nullptr )
|
if( m_outputFile == nullptr )
|
||||||
|
@ -172,6 +173,7 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
|
||||||
std::swap( StAngle, EndAngle );
|
std::swap( StAngle, EndAngle );
|
||||||
|
|
||||||
SetCurrentLineWidth( width );
|
SetCurrentLineWidth( width );
|
||||||
|
|
||||||
/* Please NOTE the different sign due to Y-axis flip */
|
/* Please NOTE the different sign due to Y-axis flip */
|
||||||
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 ) );
|
||||||
|
@ -236,7 +238,7 @@ void PLOTTER::BezierCurve( const wxPoint& aStart, const wxPoint& aControl1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos, double aScaleFactor )
|
void PLOTTER::PlotImage(const wxImage& aImage, const wxPoint& aPos, double aScaleFactor )
|
||||||
{
|
{
|
||||||
wxSize size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
|
wxSize size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
|
||||||
|
|
||||||
|
@ -356,6 +358,7 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
|
||||||
0014, // +
|
0014, // +
|
||||||
0040, // Sq
|
0040, // Sq
|
||||||
0020, // Lz
|
0020, // Lz
|
||||||
|
|
||||||
// Two simple shapes
|
// Two simple shapes
|
||||||
0103, // X O
|
0103, // X O
|
||||||
0017, // X +
|
0017, // X +
|
||||||
|
@ -367,6 +370,7 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
|
||||||
0054, // + Sq
|
0054, // + Sq
|
||||||
0034, // + Lz
|
0034, // + Lz
|
||||||
0060, // Sq Lz
|
0060, // Sq Lz
|
||||||
|
|
||||||
// Three simple shapes
|
// Three simple shapes
|
||||||
0117, // X O +
|
0117, // X O +
|
||||||
0143, // X O Sq
|
0143, // X O Sq
|
||||||
|
@ -377,14 +381,17 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
|
||||||
0154, // O + Sq
|
0154, // O + Sq
|
||||||
0134, // O + Lz
|
0134, // O + Lz
|
||||||
0074, // + Sq Lz
|
0074, // + Sq Lz
|
||||||
|
|
||||||
// Four simple shapes
|
// Four simple shapes
|
||||||
0174, // O Sq Lz +
|
0174, // O Sq Lz +
|
||||||
0163, // X O Sq Lz
|
0163, // X O Sq Lz
|
||||||
0157, // X O Sq +
|
0157, // X O Sq +
|
||||||
0137, // X O Lz +
|
0137, // X O Lz +
|
||||||
0077, // X Sq Lz +
|
0077, // X Sq Lz +
|
||||||
|
|
||||||
// This draws *everything *
|
// This draws *everything *
|
||||||
0177, // X O Sq Lz +
|
0177, // X O Sq Lz +
|
||||||
|
|
||||||
// Here we use the single bars... so the cross is forbidden
|
// Here we use the single bars... so the cross is forbidden
|
||||||
0110, // O -
|
0110, // O -
|
||||||
0104, // O |
|
0104, // O |
|
||||||
|
@ -407,6 +414,7 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
|
||||||
0170, // O Sq Lz -
|
0170, // O Sq Lz -
|
||||||
0164, // O Sq Lz |
|
0164, // O Sq Lz |
|
||||||
0161, // O Sq Lz /
|
0161, // O Sq Lz /
|
||||||
|
|
||||||
// Last resort: the backlash component (easy to confound)
|
// Last resort: the backlash component (easy to confound)
|
||||||
0102, // \ O
|
0102, // \ O
|
||||||
0042, // \ Sq
|
0042, // \ Sq
|
||||||
|
@ -416,6 +424,7 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
|
||||||
0062, // \ Sq Lz
|
0062, // \ Sq Lz
|
||||||
0162 // \ O Sq Lz
|
0162 // \ O Sq Lz
|
||||||
};
|
};
|
||||||
|
|
||||||
if( aShapeId >= MARKER_COUNT )
|
if( aShapeId >= MARKER_COUNT )
|
||||||
{
|
{
|
||||||
// Fallback shape
|
// Fallback shape
|
||||||
|
|
|
@ -47,10 +47,11 @@ public:
|
||||||
return wxString( wxT( "plt" ) );
|
return wxString( wxT( "plt" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the target length of chords used to draw approximated circles and
|
/**
|
||||||
/// arcs.
|
* Set the target length of chords used to draw approximated circles and arcs.
|
||||||
///
|
*
|
||||||
/// @param chord_len - chord length in IUs
|
* @param chord_len the chord length in IUs.
|
||||||
|
*/
|
||||||
void SetTargetChordLength( double chord_len );
|
void SetTargetChordLength( double chord_len );
|
||||||
|
|
||||||
/// Switch to the user coordinate system
|
/// Switch to the user coordinate system
|
||||||
|
@ -143,24 +144,26 @@ public:
|
||||||
void* aData ) override;
|
void* aData ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Start a new HPGL_ITEM if necessary, keeping the current one if it exists.
|
/**
|
||||||
///
|
* Start a new HPGL_ITEM if necessary, keeping the current one if it exists.
|
||||||
/// @param location is the location of the item.
|
*
|
||||||
///
|
* @param location is the location of the item.
|
||||||
/// @return whether a new item was made.
|
* @return whether a new item was made.
|
||||||
bool startItem( DPOINT location );
|
*/
|
||||||
|
bool startItem( const DPOINT& location );
|
||||||
|
|
||||||
/// Flush the current HPGL_ITEM and clear out the current item pointer.
|
/// Flush the current HPGL_ITEM and clear out the current item pointer.
|
||||||
void flushItem();
|
void flushItem();
|
||||||
|
|
||||||
/// Start a new HPGL_ITEM with the given string if necessary, or append the
|
/**
|
||||||
/// string to the current item.
|
* Start a new HPGL_ITEM with the given string if necessary, or append the
|
||||||
///
|
* string to the current item.
|
||||||
/// @param location is the location of the item, if a new one is made.
|
*
|
||||||
/// @param content is the content substring.
|
* @param location is the location of the item, if a new one is made.
|
||||||
///
|
* @param content is the content substring.
|
||||||
/// @return whether a new item was made
|
* @return whether a new item was made.
|
||||||
bool startOrAppendItem( DPOINT location, const wxString& content );
|
*/
|
||||||
|
bool startOrAppendItem( const DPOINT& location, const wxString& content );
|
||||||
|
|
||||||
int penSpeed;
|
int penSpeed;
|
||||||
int penNumber;
|
int penNumber;
|
||||||
|
|
|
@ -443,7 +443,7 @@ public:
|
||||||
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
|
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
|
||||||
|
|
||||||
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_TYPE 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_TYPE fill,
|
virtual void Circle( const wxPoint& pos, int diametre, FILL_TYPE fill,
|
||||||
|
|
Loading…
Reference in New Issue