]> Creatis software - cpPlugins.git/blob - lib/cpBaseQtApplication/Pipeline/Canvas.h
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpBaseQtApplication / Pipeline / Canvas.h
1 #ifndef __cpBaseQtApplication__Pipeline__Canvas__h__
2 #define __cpBaseQtApplication__Pipeline__Canvas__h__
3
4 #include <cpBaseQtApplication_Export.h>
5 #include <QtGui/QGraphicsView>
6 #include <cpPlugins/Interface/Workspace.h>
7
8 class QGraphicsScene;
9
10 namespace cpBaseQtApplication
11 {
12   namespace Pipeline
13   {
14     // Some other forward declarations
15     class EventFilter;
16     class Block;
17     class Connection;
18
19     /**
20      */
21     class cpBaseQtApplication_EXPORT Canvas
22       : public QGraphicsView
23     {
24       Q_OBJECT;
25
26     public:
27       typedef Canvas        Self;
28       typedef QGraphicsView Superclass;
29       typedef cpPlugins::Interface::Workspace TWorkspace;
30
31     public:
32       Canvas( QWidget* parent = 0 );
33       virtual ~Canvas( );
34
35       void clear( );
36
37       TWorkspace* workspace( );
38       const TWorkspace* workspace( ) const;
39       void setWorkspace( TWorkspace* ws );
40
41       std::string addFilter(
42         const std::string& cat, const std::string& fil,
43         const QPointF& pos = QPointF( 0, 0 )
44         );
45       bool connectOutputPortSlot( QObject* receiver, const char* slot );
46
47       void rename( QGraphicsItem* item );
48       void exposePort( QGraphicsItem* item );
49       void moveConnection( const QPointF& pnt );
50       void grab( const QPointF& pnt );
51       void release( const QPointF& pnt );
52
53     protected:
54       void keyPressEvent( QKeyEvent* event );
55       void wheelEvent( QWheelEvent* event );
56
57       void dragEnterEvent( QDragEnterEvent* event );
58       void dragLeaveEvent( QDragLeaveEvent* event );
59       void dragMoveEvent( QDragMoveEvent* event );
60       void dropEvent( QDropEvent* event );
61
62       void _scaleView( qreal scaleFactor );
63       void _redrawWorkspace( );
64
65     protected:
66       QGraphicsScene* m_Scene;
67       EventFilter* m_EventFilter;
68       TWorkspace*  m_Workspace;
69       std::map< std::string, Block* > m_Blocks;
70
71       Connection* m_ActualConnection;
72
73       QObject* m_OutputPortReceiver;
74       std::string m_OutputPortSlot;
75     };
76
77   } // ecapseman
78
79 } // ecapseman
80
81 #endif // __cpBaseQtApplication__Pipeline__Canvas__h__
82
83 // eof - $RCSfile$