diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index ca7c13d87a..f672f50636 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -243,9 +243,11 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen ) continue; if( !secondLine->IsParallel( firstLine ) - || secondLine->GetStroke() != firstLine->GetStroke() + || secondLine->IsStrokeEquivalent( firstLine ) || secondLine->GetLayer() != firstLine->GetLayer() ) + { continue; + } // Remove identical lines 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 ) || aSegment->IsEndPoint( aPoint ) ) + { return false; + } if( aScreen == nullptr ) aScreen = GetScreen(); diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 5827bf8106..f54f114c3b 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -128,6 +128,22 @@ public: virtual STROKE_PARAMS GetStroke() const override { return m_stroke; } 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. *