Revert "pcbnew: Adding copy constructors to PNS items"

This reverts commit 41e4bc4d9f.

This commit requires additional testing before recommitting as it causes
issues with FindJoint().
This commit is contained in:
Seth Hillbrand 2018-10-09 14:50:20 -07:00
parent 779ef044b7
commit 13997f0050
8 changed files with 19 additions and 98 deletions

View File

@ -84,18 +84,6 @@ public:
SHAPE( SH_LINE_CHAIN ), m_points( aShape.m_points ), m_closed( aShape.m_closed ) 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 * Constructor
* Initializes a 2-point line chain (a single segment) * Initializes a 2-point line chain (a single segment)
@ -388,8 +376,14 @@ public:
*/ */
void Append( const VECTOR2I& aP, bool aAllowDuplication = false ) 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 ) if( m_points.size() == 0 || aAllowDuplication || CPoint( -1 ) != aP )
{
m_points.push_back( aP ); m_points.push_back( aP );
m_bbox.Merge( aP );
}
} }
/** /**
@ -407,12 +401,14 @@ public:
{ {
const VECTOR2I p = aOtherLine.CPoint( 0 ); const VECTOR2I p = aOtherLine.CPoint( 0 );
m_points.push_back( p ); m_points.push_back( p );
m_bbox.Merge( p );
} }
for( int i = 1; i < aOtherLine.PointCount(); i++ ) for( int i = 1; i < aOtherLine.PointCount(); i++ )
{ {
const VECTOR2I p = aOtherLine.CPoint( i ); const VECTOR2I p = aOtherLine.CPoint( i );
m_points.push_back( p ); m_points.push_back( p );
m_bbox.Merge( p );
} }
} }
@ -677,6 +673,9 @@ private:
/// is the line chain closed? /// is the line chain closed?
bool m_closed; bool m_closed;
/// cached bounding box
BOX2I m_bbox;
}; };
#endif // __SHAPE_LINE_CHAIN #endif // __SHAPE_LINE_CHAIN

View File

@ -40,18 +40,6 @@ public:
SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ): SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ):
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {}; 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_SEGMENT() {};
SHAPE* Clone() const override SHAPE* Clone() const override

View File

@ -92,24 +92,6 @@ public:
m_routable = aOther.m_routable; 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(); virtual ~ITEM();
/** /**

View File

@ -82,26 +82,14 @@ public:
JOINT( const JOINT& aB ) : JOINT( const JOINT& aB ) :
ITEM( JOINT_T ) ITEM( JOINT_T )
{ {
m_layers = aB.m_layers;
m_tag.pos = aB.m_tag.pos; m_tag.pos = aB.m_tag.pos;
m_tag.net = aB.m_tag.net; m_tag.net = aB.m_tag.net;
m_linkedItems = aB.m_linkedItems; m_linkedItems = aB.m_linkedItems;
m_layers = aB.m_layers;
m_locked = aB.m_locked; 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 ITEM* Clone( ) const override
{ {
assert( false ); assert( false );

View File

@ -57,15 +57,16 @@ LINE::~LINE()
LINE& LINE::operator=( const LINE& aOther ) LINE& LINE::operator=( const LINE& aOther )
{ {
if( this == &aOther )
return *this;
ITEM::operator =( aOther );
m_line = aOther.m_line; m_line = aOther.m_line;
m_width = aOther.m_width; 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_via = aOther.m_via;
m_hasVia = aOther.m_hasVia; m_hasVia = aOther.m_hasVia;
m_marker = aOther.m_marker;
m_rank = aOther.m_rank;
copyLinks( &aOther ); copyLinks( &aOther );
return *this; return *this;

View File

@ -58,16 +58,6 @@ public:
m_rank = aParentLine.Rank(); 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 ) static inline bool ClassOf( const ITEM* aItem )
{ {
return aItem && SEGMENT_T == aItem->Kind(); return aItem && SEGMENT_T == aItem->Kind();

View File

@ -52,18 +52,6 @@ public:
m_pos = aSolid.m_pos; 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 ) static inline bool ClassOf( const ITEM* aItem )
{ {
return aItem && SOLID_T == aItem->Kind(); return aItem && SOLID_T == aItem->Kind();

View File

@ -79,21 +79,6 @@ public:
m_viaType = aB.m_viaType; 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 ) static inline bool ClassOf( const ITEM* aItem )
{ {
return aItem && VIA_T == aItem->Kind(); return aItem && VIA_T == aItem->Kind();