Regularize DNP printing & plotting with painting.
This commit is contained in:
parent
aca73b699c
commit
5e1a16e821
|
@ -42,6 +42,7 @@
|
|||
#include <sch_painter.h>
|
||||
#include <schematic.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wx/log.h>
|
||||
|
@ -1266,6 +1267,30 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
|
|||
// Plot the fields
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
field.Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
|
||||
|
||||
if( GetDNP() )
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBoundingBox();
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(),
|
||||
pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(),
|
||||
pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
int strokeWidth = 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) );
|
||||
|
||||
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr );
|
||||
|
||||
aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
|
||||
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
|
||||
strokeWidth, FILLED, nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1297,6 +1322,28 @@ void SCH_SHEET::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBod
|
|||
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
|
||||
if( GetDNP() )
|
||||
{
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBoundingBox();
|
||||
COLOR4D dnp_color = aSettings->GetLayerColor( LAYER_DNP_MARKER );
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin(), bbox.GetEnd(),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
|
||||
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -542,9 +542,16 @@ void SCH_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBo
|
|||
|
||||
if( m_DNP )
|
||||
{
|
||||
BOX2I bbox = GetBodyAndPinsBoundingBox();
|
||||
wxDC* DC = localRenderSettings.GetPrintDC();
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBodyAndPinsBoundingBox();
|
||||
COLOR4D dnp_color = localRenderSettings.GetLayerColor( LAYER_DNP_MARKER );
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(), pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin(), bbox.GetEnd(),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
|
@ -2547,9 +2554,18 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
|
|||
void SCH_SYMBOL::PlotDNP( PLOTTER* aPlotter ) const
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
BOX2I bbox = GetBodyAndPinsBoundingBox();
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBodyAndPinsBoundingBox();
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(),
|
||||
pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(),
|
||||
pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
int strokeWidth = 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) );
|
||||
|
||||
aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr );
|
||||
|
|
Loading…
Reference in New Issue