Improve borderless items logic in schematic plotting.
This commit is contained in:
parent
d9c123b1ec
commit
b0f4adf052
|
@ -465,7 +465,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aF
|
|||
MoveTo( aCornerList[0] );
|
||||
startItem( userToDeviceCoordinates( aCornerList[0] ) );
|
||||
|
||||
if( aFill == FILL_T::FILLED_SHAPE )
|
||||
if( aFill == FILL_T::FILLED_SHAPE || aFill == FILL_T::FILLED_WITH_COLOR )
|
||||
{
|
||||
// Draw the filled area
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
|
|
|
@ -222,6 +222,9 @@ void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
|||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
VECTOR2I size = p2 - p1;
|
||||
|
@ -229,8 +232,6 @@ void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
|||
if( size.x == 0 && size.y == 0 )
|
||||
{
|
||||
// Can't draw zero-sized rectangles
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
MoveTo( VECTOR2I( p1.x, p1.y ) );
|
||||
FinishTo( VECTOR2I( p1.x, p1.y ) );
|
||||
|
||||
|
@ -256,14 +257,25 @@ void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
|||
VECTOR2D p1_dev = userToDeviceCoordinates( p1 );
|
||||
VECTOR2D p2_dev = userToDeviceCoordinates( p2 );
|
||||
|
||||
char paintOp;
|
||||
|
||||
if( fill == FILL_T::NO_FILL )
|
||||
paintOp = 'S';
|
||||
else
|
||||
paintOp = width > 0 ? 'B' : 'f';
|
||||
|
||||
fprintf( m_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, fill == FILL_T::NO_FILL ? 'S' : 'B' );
|
||||
p2_dev.y - p1_dev.y, paintOp );
|
||||
}
|
||||
|
||||
|
||||
void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int width )
|
||||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && width <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
double radius = userToDeviceSize( diametre / 2.0 );
|
||||
|
||||
|
|
|
@ -496,6 +496,9 @@ void PS_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
|
|||
|
||||
void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
|
||||
{
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D p1_dev = userToDeviceCoordinates( p1 );
|
||||
VECTOR2D p2_dev = userToDeviceCoordinates( p2 );
|
||||
|
||||
|
@ -507,6 +510,9 @@ void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
|||
|
||||
void PS_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
|
||||
{
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
return;
|
||||
|
||||
wxASSERT( m_outputFile );
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
double radius = userToDeviceSize( diametre / 2.0 );
|
||||
|
|
|
@ -220,27 +220,36 @@ void SVG_PLOTTER::setSVGPlotStyle( int aLineWidth, bool aIsGroup, const std::str
|
|||
if( aIsGroup )
|
||||
fputs( "</g>\n<g ", m_outputFile );
|
||||
|
||||
fputs( "style=\"", m_outputFile );
|
||||
|
||||
if( m_fillMode == FILL_T::NO_FILL )
|
||||
{
|
||||
fputs( "fill:none; ", m_outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
// output the background fill color
|
||||
fprintf( m_outputFile, "style=\"fill:#%6.6lX; ", m_brush_rgb_color );
|
||||
fprintf( m_outputFile, "fill:#%6.6lX; ", m_brush_rgb_color );
|
||||
|
||||
switch( m_fillMode )
|
||||
{
|
||||
case FILL_T::NO_FILL:
|
||||
fputs( "fill-opacity:0.0; ", m_outputFile );
|
||||
break;
|
||||
|
||||
case FILL_T::FILLED_SHAPE:
|
||||
case FILL_T::FILLED_WITH_BG_BODYCOLOR:
|
||||
case FILL_T::FILLED_WITH_COLOR:
|
||||
fprintf( m_outputFile, "fill-opacity:%.*f; ", m_precision, m_brush_alpha );
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
double pen_w = userToDeviceSize( aLineWidth );
|
||||
|
||||
if( pen_w < 0.0 ) // Ensure pen width validity
|
||||
pen_w = 0.0;
|
||||
|
||||
if( pen_w <= 0 )
|
||||
{
|
||||
fputs( "stroke:none;", m_outputFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fix a strange issue found in Inkscape: aWidth < 100 nm create issues on degrouping objects
|
||||
// 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
|
||||
|
@ -254,20 +263,19 @@ void SVG_PLOTTER::setSVGPlotStyle( int aLineWidth, bool aIsGroup, const std::str
|
|||
switch( m_dashed )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;",
|
||||
m_precision, GetDashMarkLenIU( aLineWidth ),
|
||||
m_precision, GetDashGapLenIU( aLineWidth ) );
|
||||
fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;", m_precision,
|
||||
GetDashMarkLenIU( aLineWidth ), m_precision, GetDashGapLenIU( aLineWidth ) );
|
||||
break;
|
||||
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;",
|
||||
GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f;", GetDotMarkLenIU( aLineWidth ),
|
||||
GetDashGapLenIU( aLineWidth ) );
|
||||
break;
|
||||
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;",
|
||||
GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
|
||||
GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
|
||||
fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;", GetDashMarkLenIU( aLineWidth ),
|
||||
GetDashGapLenIU( aLineWidth ), GetDotMarkLenIU( aLineWidth ),
|
||||
GetDashGapLenIU( aLineWidth ) );
|
||||
break;
|
||||
|
||||
case PLOT_DASH_TYPE::DASHDOTDOT:
|
||||
|
@ -283,6 +291,7 @@ void SVG_PLOTTER::setSVGPlotStyle( int aLineWidth, bool aIsGroup, const std::str
|
|||
//do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( aExtraStyle.length() )
|
||||
fputs( aExtraStyle.c_str(), m_outputFile );
|
||||
|
|
|
@ -113,7 +113,10 @@ void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
|||
|
||||
void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
int pen_size = GetPenWidth();
|
||||
|
||||
if( pen_size > 0 )
|
||||
pen_size = std::max( pen_size, aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
static std::vector<VECTOR2I> cornerList;
|
||||
|
||||
|
@ -185,15 +188,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
break;
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
{
|
||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||
|
||||
aPlotter->MoveTo( pts[0] );
|
||||
aPlotter->LineTo( pts[1] );
|
||||
aPlotter->LineTo( pts[2] );
|
||||
aPlotter->LineTo( pts[3] );
|
||||
aPlotter->FinishTo( pts[0] );
|
||||
}
|
||||
aPlotter->Rect( GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
|
|
Loading…
Reference in New Issue