diff --git a/include/geometry/shape_line_chain.h b/include/geometry/shape_line_chain.h index 98584a0dc4..250e0e797b 100644 --- a/include/geometry/shape_line_chain.h +++ b/include/geometry/shape_line_chain.h @@ -84,18 +84,6 @@ public: SHAPE( SH_LINE_CHAIN ), m_points( aShape.m_points ), m_closed( aShape.m_closed ) {} - SHAPE_LINE_CHAIN& operator=( const SHAPE_LINE_CHAIN& aShape ) - { - if( this == &aShape ) - return *this; - - m_type = SH_LINE_CHAIN; - m_points = aShape.m_points; - m_closed = aShape.m_closed; - - return *this; - } - /** * Constructor * Initializes a 2-point line chain (a single segment) @@ -388,8 +376,14 @@ public: */ void Append( const VECTOR2I& aP, bool aAllowDuplication = false ) { + if( m_points.size() == 0 ) + m_bbox = BOX2I( aP, VECTOR2I( 0, 0 ) ); + if( m_points.size() == 0 || aAllowDuplication || CPoint( -1 ) != aP ) + { m_points.push_back( aP ); + m_bbox.Merge( aP ); + } } /** @@ -407,12 +401,14 @@ public: { const VECTOR2I p = aOtherLine.CPoint( 0 ); m_points.push_back( p ); + m_bbox.Merge( p ); } for( int i = 1; i < aOtherLine.PointCount(); i++ ) { const VECTOR2I p = aOtherLine.CPoint( i ); m_points.push_back( p ); + m_bbox.Merge( p ); } } @@ -677,6 +673,9 @@ private: /// is the line chain closed? bool m_closed; + + /// cached bounding box + BOX2I m_bbox; }; #endif // __SHAPE_LINE_CHAIN diff --git a/include/geometry/shape_segment.h b/include/geometry/shape_segment.h index c62d4d1fae..50fa87cdc8 100644 --- a/include/geometry/shape_segment.h +++ b/include/geometry/shape_segment.h @@ -40,18 +40,6 @@ public: SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ): SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {}; - SHAPE_SEGMENT& operator=( const SHAPE_SEGMENT& aOther ) - { - if( this == &aOther ) - return *this; - - SHAPE::operator=( aOther ); - m_seg = aOther.m_seg; - m_width = aOther.m_width; - - return *this; - } - ~SHAPE_SEGMENT() {}; SHAPE* Clone() const override diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index f34353a1d4..a2d4975a6e 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -92,24 +92,6 @@ public: m_routable = aOther.m_routable; } - ITEM& operator=( const ITEM& aOther ) - { - if( this == &aOther ) - return *this; - - m_layers = aOther.m_layers; - m_net = aOther.m_net; - m_movable = aOther.m_movable; - m_kind = aOther.m_kind; - m_parent = aOther.m_parent; - m_owner = NULL; - m_marker = aOther.m_marker; - m_rank = aOther.m_rank; - m_routable = aOther.m_routable; - - return *this; - } - virtual ~ITEM(); /** diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index 419d089caf..2e68b43779 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -82,26 +82,14 @@ public: JOINT( const JOINT& aB ) : ITEM( JOINT_T ) { + m_layers = aB.m_layers; m_tag.pos = aB.m_tag.pos; m_tag.net = aB.m_tag.net; m_linkedItems = aB.m_linkedItems; + m_layers = aB.m_layers; m_locked = aB.m_locked; } - JOINT& operator=( const JOINT& aOther ) - { - if( this == &aOther ) - return *this; - - ITEM::operator =( aOther ); - m_tag.pos = aOther.m_tag.pos; - m_tag.net = aOther.m_tag.net; - m_linkedItems = aOther.m_linkedItems; - m_locked = aOther.m_locked; - - return *this; - } - ITEM* Clone( ) const override { assert( false ); diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 74ab1189a3..bd83594250 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -57,15 +57,16 @@ LINE::~LINE() LINE& LINE::operator=( const LINE& aOther ) { - if( this == &aOther ) - return *this; - - ITEM::operator =( aOther ); - m_line = aOther.m_line; m_width = aOther.m_width; + m_net = aOther.m_net; + m_movable = aOther.m_movable; + m_layers = aOther.m_layers; m_via = aOther.m_via; m_hasVia = aOther.m_hasVia; + m_marker = aOther.m_marker; + m_rank = aOther.m_rank; + copyLinks( &aOther ); return *this; diff --git a/pcbnew/router/pns_segment.h b/pcbnew/router/pns_segment.h index 1d2424bff7..d07229c8f5 100644 --- a/pcbnew/router/pns_segment.h +++ b/pcbnew/router/pns_segment.h @@ -58,16 +58,6 @@ public: m_rank = aParentLine.Rank(); } - SEGMENT& operator=( const SEGMENT& aOther ) - { - if( this == &aOther ) - return *this; - - ITEM::operator =( aOther ); - m_seg = aOther.m_seg; - return *this; - } - static inline bool ClassOf( const ITEM* aItem ) { return aItem && SEGMENT_T == aItem->Kind(); diff --git a/pcbnew/router/pns_solid.h b/pcbnew/router/pns_solid.h index fecb8ca1d4..a4d4a7d848 100644 --- a/pcbnew/router/pns_solid.h +++ b/pcbnew/router/pns_solid.h @@ -52,18 +52,6 @@ public: m_pos = aSolid.m_pos; } - SOLID& operator=( const SOLID& aOther ) - { - if( this == &aOther ) - return *this; - - ITEM::operator =( aOther ); - m_shape = aOther.m_shape->Clone(); - m_pos = aOther.m_pos; - - return *this; - } - static inline bool ClassOf( const ITEM* aItem ) { return aItem && SOLID_T == aItem->Kind(); diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index 9b9df762d2..8bb002837a 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -79,21 +79,6 @@ public: m_viaType = aB.m_viaType; } - VIA& operator=( const VIA& aOther ) - { - if( this == &aOther ) - return *this; - - ITEM::operator =( aOther ); - m_pos = aOther.m_pos; - m_diameter = aOther.m_diameter; - m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 ); - m_drill = aOther.m_drill; - m_viaType = aOther.m_viaType; - - return *this; - } - static inline bool ClassOf( const ITEM* aItem ) { return aItem && VIA_T == aItem->Kind();