diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index a6681972bb..4b1ed509b3 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1391,8 +1391,7 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool void PNS_KICAD_IFACE::DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor ) { - ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( nullptr, m_view ); - pitem->Line( aRatline, 10000, aColor ); + ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aRatline, m_view ); m_previewItems->Add( pitem ); m_view->Update( m_previewItems ); } diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index 33dca43b46..db5f17511a 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -62,6 +62,28 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a } +ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView ) : + EDA_ITEM( NOT_USED ) +{ + m_view = aView; + + m_shape = aShape.Clone(); + m_hole = nullptr; + + m_clearance = -1; + m_originLayer = m_layer = LAYER_SELECT_OVERLAY ; + + m_showClearance = false; + + // initialize variables, overwritten by Update( aItem ), if aItem != NULL + m_router = nullptr; + m_type = PR_SHAPE; + m_style = 0; + m_width = 0; + m_depth = 0; +} + + ROUTER_PREVIEW_ITEM::~ROUTER_PREVIEW_ITEM() { delete m_shape; @@ -442,32 +464,6 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const } -void ROUTER_PREVIEW_ITEM::Line( const SHAPE_LINE_CHAIN& aLine, int aWidth, int aStyle ) -{ - m_width = aWidth; - - if( aStyle >= 0 ) - m_color = assignColor( aStyle ); - - m_type = PR_SHAPE; - m_depth = -1024; // TODO gal->GetMinDepth() - - SHAPE_LINE_CHAIN *lc = static_cast( aLine.Clone() ); - lc->SetWidth( aWidth ); - m_shape = lc; -} - - -void ROUTER_PREVIEW_ITEM::Point( const VECTOR2I& aPos, int aStyle ) -{ -} - - -void ROUTER_PREVIEW_ITEM::Box( const BOX2I& aBox, int aStyle ) -{ -} - - const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer ) const { auto settings = static_cast( m_view->GetPainter()->GetSettings() ); diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 3054b34a83..79f2a6a73e 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.h @@ -55,15 +55,12 @@ public: PR_SHAPE }; + ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr); ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr); ~ROUTER_PREVIEW_ITEM(); void Update( const PNS::ITEM* aItem ); - void Line( const SHAPE_LINE_CHAIN& aLine, int aWidth = 0, int aStyle = -1 ); - void Box( const BOX2I& aBox, int aStyle = 0 ); - void Point ( const VECTOR2I& aPos, int aStyle = 0); - void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor;