X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpBaseQtApplication%2FPipeline%2FConnection.cxx;fp=lib%2FcpBaseQtApplication%2FPipeline%2FConnection.cxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=28bd39c7b7dc62ba9151aeacea3a457ad5f23ca1;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpBaseQtApplication/Pipeline/Connection.cxx b/lib/cpBaseQtApplication/Pipeline/Connection.cxx deleted file mode 100644 index 28bd39c..0000000 --- a/lib/cpBaseQtApplication/Pipeline/Connection.cxx +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include - -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -cpBaseQtApplication::Pipeline::Connection:: -Connection( QGraphicsItem* parent, QGraphicsScene* scene ) - : Superclass( parent, scene ) -{ - this->setPen( QPen( Qt::black, 2 ) ); - this->setBrush( Qt::NoBrush ); - this->setZValue( -1 ); - this->m_Port1 = NULL; - this->m_Port2 = NULL; - this->setFlag( QGraphicsItem::ItemIsSelectable ); -} - -// ------------------------------------------------------------------------- -cpBaseQtApplication::Pipeline::Connection:: -~Connection( ) -{ - if( this->m_Port1 != NULL ) - this->m_Port1->removeConnection( this ); - if( this->m_Port2 != NULL ) - this->m_Port2->removeConnection( this ); -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -setPos1( const QPointF& p ) -{ - this->m_Pos1 = p; -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -setPos2( const QPointF& p ) -{ - this->m_Pos2 = p; -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -setPort1( OutputPort* p ) -{ - if( p != NULL ) - { - p->connections( ).push_back( this ); - this->m_Port1 = p; - - } // fi -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -setPort2( InputPort* p ) -{ - if( p != NULL ) - { - p->setConnection( this ); - this->m_Port2 = p; - - } // fi -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -updatePosFromPorts( ) -{ - if( this->m_Port1 != NULL ) - this->m_Pos1 = - this->m_Port1->scenePos( ) + - QPointF( this->m_Port1->radius( ), this->m_Port1->radius( ) ); - if( this->m_Port2 != NULL ) - this->m_Pos2 = - this->m_Port2->scenePos( ) + - QPointF( this->m_Port2->radius( ), this->m_Port2->radius( ) ); -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -updatePath( ) -{ - QPainterPath p; - p.moveTo( this->m_Pos1 ); - - qreal dx = this->m_Pos2.x( ) - this->m_Pos1.x( ); - qreal dy = this->m_Pos2.y( ) - this->m_Pos1.y( ); - QPointF c1( this->m_Pos1.x( ) + dx * 0.25, this->m_Pos1.y( ) + dy * 0.1 ); - QPointF c2( this->m_Pos1.x( ) + dx * 0.75, this->m_Pos1.y( ) + dy * 0.9 ); - p.cubicTo( c1, c2, this->m_Pos2 ); - - this->setPath( p ); -} - -// ------------------------------------------------------------------------- -cpBaseQtApplication::Pipeline::OutputPort* -cpBaseQtApplication::Pipeline::Connection:: -port1( ) const -{ - return( this->m_Port1 ); -} - -// ------------------------------------------------------------------------- -cpBaseQtApplication::Pipeline::InputPort* -cpBaseQtApplication::Pipeline::Connection:: -port2( ) const -{ - return( this->m_Port2 ); -} - -// ------------------------------------------------------------------------- -void cpBaseQtApplication::Pipeline::Connection:: -paint( - QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget* widget - ) -{ - Q_UNUSED( option ); - Q_UNUSED( widget ); - - if( this->isSelected( ) ) - painter->setPen( QPen( Qt::red, 5 ) ); - else - painter->setPen( QPen( Qt::black, 2 ) ); - this->setBrush( Qt::NoBrush ); - painter->drawPath( this->path( ) ); -} - -// eof - $RCSfile$