From 5d78a007cc6befad5fbfc9155beecb226c4266db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Wed, 18 Feb 2015 00:53:57 +0100 Subject: [PATCH] added ClassOf() for DRAWSEGMENTs, PADs and PCB_TEXTs --- pcbnew/class_drawsegment.h | 5 +++++ pcbnew/class_pad.h | 5 +++++ pcbnew/class_pcb_text.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 7316b4e554..3c5667ebd6 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -69,6 +69,11 @@ public: /// skip the linked list stuff, and parent const DRAWSEGMENT& operator = ( const DRAWSEGMENT& rhs ); + static inline bool ClassOf( const EDA_ITEM *aItem ) + { + return aItem && PCB_LINE_T == aItem->Type(); + } + void SetWidth( int aWidth ) { m_Width = aWidth; } int GetWidth() const { return m_Width; } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index c68596bd29..339b4dc65b 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -94,6 +94,11 @@ public: ///< used for edge board connectors static LSET UnplatedHoleMask(); ///< layer set for a mechanical unplated through hole pad + static inline bool ClassOf( const EDA_ITEM *aItem ) + { + return aItem && PCB_PAD_T == aItem->Type(); + } + void Copy( D_PAD* source ); D_PAD* Next() const { return static_cast( Pnext ); } diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 7a6d853704..9bdcd2a720 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -49,6 +49,11 @@ public: ~TEXTE_PCB(); + static inline bool ClassOf( const EDA_ITEM *aItem ) + { + return aItem && PCB_TEXT_T == aItem->Type(); + } + virtual const wxPoint& GetPosition() const { return m_Pos;