X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FcpPipelineEditor%2FQNEPort.h;h=383167b9bfcc39d977b4024b612afa43fafaafda;hb=f4aeff15ebb41183d4b89f41b29ec26043848722;hp=1f445d003c0aa1587eba25044172284451741246;hpb=9c75dcecf566cc567583caf4687ce523a2af586d;p=cpPlugins.git diff --git a/appli/cpPipelineEditor/QNEPort.h b/appli/cpPipelineEditor/QNEPort.h index 1f445d0..383167b 100644 --- a/appli/cpPipelineEditor/QNEPort.h +++ b/appli/cpPipelineEditor/QNEPort.h @@ -44,45 +44,151 @@ namespace PipelineEditor typedef QGraphicsPathItem Superclass; enum { Type = QGraphicsItem::UserType + 1 }; - enum { NamePort = 1, TypePort = 2 }; public: - QNEPort( QGraphicsItem* parent = 0, QGraphicsScene* scene = NULL ); + QNEPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); virtual ~QNEPort( ); - void setNEBlock( QNEBlock* b ); - void setName( const QString& n ); - void setIsOutput( bool o ); - int radius( ); - bool isOutput( ); - QVector< QNEConnection* >& connections( ); - void setPortFlags( int f ); + void setBlock( QNEBlock* b ); + inline QNEBlock* block( ) const + { return( this->m_Block ); } + + virtual void setName( const QString& n ); + inline const QString& name( ) const + { return( this->m_Name ); } - QNEBlock* block( ) const; - quint64 ptr( ); void setPtr( quint64 p ); - bool isConnected( QNEPort* other ); + inline quint64 ptr( ) + { return( this->m_Ptr ); } - inline const QString& portName( ) const - { return( this->m_Name ); } - inline int portFlags( ) const - { return( this->m_PortFlags ); } - int type( ) const + inline int radius( ) const + { return( this->m_Radius ); } + + virtual bool isConnected( QNEPort* other ) = 0; + inline int type( ) const { return( this->Type ); } protected: - QVariant itemChange( GraphicsItemChange change, const QVariant& value ); - - private: QNEBlock* m_Block; - QString m_Name; - bool m_IsOutput; + + QString m_Name; QGraphicsTextItem* m_Label; - int m_Radius; - int m_Margin; + int m_Radius; + int m_Margin; + quint64 m_Ptr; + }; + + /** + */ + class QNENamePort + : public QNEPort + { + public: + typedef QNENamePort Self; + typedef QNEPort Superclass; + + enum { Type = Superclass::Type + 1 }; + + public: + QNENamePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + virtual ~QNENamePort( ); + + virtual void setName( const QString& n ); + + virtual bool isConnected( QNEPort* other ); + inline int type( ) const + { return( this->Type ); } + }; + + /** + */ + class QNETypePort + : public QNEPort + { + public: + typedef QNETypePort Self; + typedef QNEPort Superclass; + + enum { Type = Superclass::Type + 2 }; + + public: + QNETypePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + virtual ~QNETypePort( ); + + virtual void setName( const QString& n ); + + virtual bool isConnected( QNEPort* other ); + inline int type( ) const + { return( this->Type ); } + }; + + /** + */ + class QNEInputPort + : public QNEPort + { + public: + typedef QNEInputPort Self; + typedef QNEPort Superclass; + + enum { Type = Superclass::Type + 3 }; + + public: + QNEInputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + virtual ~QNEInputPort( ); + + virtual void setName( const QString& n ); + + virtual bool isConnected( QNEPort* other ); + inline int type( ) const + { return( this->Type ); } + + void setConnection( QNEConnection* c ); + inline QNEConnection* connection( ) + { return( this->m_Connection ); } + inline const QNEConnection* connection( ) const + { return( this->m_Connection ); } + inline bool hasConnection( ) const + { return( this->m_Connection != NULL ); } + + protected: + QVariant itemChange( GraphicsItemChange change, const QVariant& value ); + + protected: + QNEConnection* m_Connection; + }; + + /** + */ + class QNEOutputPort + : public QNEPort + { + public: + typedef QNEOutputPort Self; + typedef QNEPort Superclass; + + enum { Type = Superclass::Type + 4 }; + + public: + QNEOutputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); + virtual ~QNEOutputPort( ); + + virtual void setName( const QString& n ); + + virtual bool isConnected( QNEPort* other ); + inline int type( ) const + { return( this->Type ); } + + inline QVector< QNEConnection* >& connections( ) + { return( this->m_Connections ); } + inline const QVector< QNEConnection* >& connections( ) const + { return( this->m_Connections ); } + + protected: + QVariant itemChange( GraphicsItemChange change, const QVariant& value ); + + protected: QVector< QNEConnection* > m_Connections; - int m_PortFlags; - quint64 m_Ptr; }; } // ecapseman