pcbnew: Adding some missing TypeOf() functions

Missing types were handled by the superclass (in the case of zones)
PCB_CONNECTED_ITEM, which incorrectly returned "true" when testing lines
against zones.

Fixes: lp:1789195
* https://bugs.launchpad.net/kicad/+bug/1789195
This commit is contained in:
Seth Hillbrand 2018-08-28 13:14:47 -07:00
parent c6d1433523
commit e160eb0677
4 changed files with 21 additions and 1 deletions

View File

@ -84,6 +84,11 @@ public:
~DIMENSION(); ~DIMENSION();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_DIMENSION_T == aItem->Type();
}
void SetValue( int aValue ) { m_Value = aValue; } void SetValue( int aValue ) { m_Value = aValue; }
int GetValue() const { return m_Value; } int GetValue() const { return m_Value; }

View File

@ -73,11 +73,15 @@ public:
~MARKER_PCB(); ~MARKER_PCB();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_MARKER_T == aItem->Type();
}
/** A scaling factor to create the marker symbol /** A scaling factor to create the marker symbol
*/ */
static int MarkerScale() {return Millimeter2iu( 0.1 ); } static int MarkerScale() {return Millimeter2iu( 0.1 ); }
void Move(const wxPoint& aMoveVector) override void Move(const wxPoint& aMoveVector) override
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;

View File

@ -58,6 +58,11 @@ public:
~PCB_TARGET(); ~PCB_TARGET();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_TARGET_T == aItem->Type();
}
void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; } void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
const wxPoint GetPosition() const override { return m_Pos; } const wxPoint GetPosition() const override { return m_Pos; }

View File

@ -73,6 +73,12 @@ public:
~ZONE_CONTAINER(); ~ZONE_CONTAINER();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) ||
( PCB_ZONE_T == aItem->Type() ) );
}
/** /**
* Function GetPosition * Function GetPosition
* *