Hack around the mess that we've made of line styles. :(

Fixes https://gitlab.com/kicad/code/kicad/issues/5960
This commit is contained in:
Jeff Young 2020-10-21 17:23:19 +01:00
parent 36f68dd39f
commit 339fa5e0e3
2 changed files with 21 additions and 1 deletions

View File

@ -243,9 +243,11 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
continue; continue;
if( !secondLine->IsParallel( firstLine ) if( !secondLine->IsParallel( firstLine )
|| secondLine->GetStroke() != firstLine->GetStroke() || secondLine->IsStrokeEquivalent( firstLine )
|| secondLine->GetLayer() != firstLine->GetLayer() ) || secondLine->GetLayer() != firstLine->GetLayer() )
{
continue; continue;
}
// Remove identical lines // Remove identical lines
if( firstLine->IsEndPoint( secondLine->GetStartPoint() ) if( firstLine->IsEndPoint( secondLine->GetStartPoint() )
@ -300,7 +302,9 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
{ {
if( !IsPointOnSegment( aSegment->GetStartPoint(), aSegment->GetEndPoint(), aPoint ) if( !IsPointOnSegment( aSegment->GetStartPoint(), aSegment->GetEndPoint(), aPoint )
|| aSegment->IsEndPoint( aPoint ) ) || aSegment->IsEndPoint( aPoint ) )
{
return false; return false;
}
if( aScreen == nullptr ) if( aScreen == nullptr )
aScreen = GetScreen(); aScreen = GetScreen();

View File

@ -128,6 +128,22 @@ public:
virtual STROKE_PARAMS GetStroke() const override { return m_stroke; } virtual STROKE_PARAMS GetStroke() const override { return m_stroke; }
virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; } virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
bool IsStrokeEquivalent( const SCH_LINE* aLine )
{
if( m_stroke.GetWidth() != aLine->GetStroke().GetWidth() )
return false;
if( m_stroke.GetColor() != aLine->GetStroke().GetColor() )
return false;
PLOT_DASH_TYPE style_a = m_stroke.GetPlotStyle();
PLOT_DASH_TYPE style_b = aLine->GetStroke().GetPlotStyle();
return style_a == style_b
|| ( style_a == PLOT_DASH_TYPE::DEFAULT && style_b == PLOT_DASH_TYPE::SOLID )
|| ( style_a == PLOT_DASH_TYPE::SOLID && style_b == PLOT_DASH_TYPE::DEFAULT );
}
/** /**
* Test if the #SCH_LINE object uses the default stroke settings. * Test if the #SCH_LINE object uses the default stroke settings.
* *