]> Creatis software - cpPlugins.git/blob - appli/PipelineEditor/PipelineEditor.cxx
...
[cpPlugins.git] / appli / PipelineEditor / PipelineEditor.cxx
1 #include "PipelineEditor.h"
2 #include "ui_PipelineEditor.h"
3
4 #include <cstdlib>
5
6 #include <QFileInfo>
7 #include <QMessageBox>
8
9 #include <cpPlugins/Image.h>
10 #include <cpPipelineEditor/Editor.h>
11
12 #include <vtkImageData.h>
13 #include <vtkPolyData.h>
14 #include <vtkRenderWindowInteractor.h>
15
16 // -------------------------------------------------------------------------
17 PipelineEditor::
18 PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent )
19   : Superclass( argc, argv, app, parent ),
20     m_UI( new Ui::PipelineEditor )
21 {
22   // Load environment configuration
23   char* p = std::getenv( cpPlugins_PATHS );
24   std::string sp = "";
25   if( p != NULL )
26     sp = std::string( p ) + std::string( cpPlugins_SEPARATOR );
27   QFileInfo info( argv[ 0 ] );
28   if( info.exists( ) )
29     sp += info.canonicalPath( ).toStdString( );
30   setenv( cpPlugins_PATHS, sp.c_str( ), 0 );
31
32   // Basic configuration
33   this->m_UI->setupUi( this );
34   this->_Configure(
35     this->m_UI->LoadedPlugins,
36     this->m_UI->Viewer,
37     this->m_UI->Canvas->editor( )
38     );
39
40   // Connect actions to slots
41   this->connect(
42     this->m_UI->ActionBackgroundMPR, SIGNAL( triggered( ) ),
43     this, SLOT( _ActionBackgroundMPR( ) )
44     );
45   this->connect(
46     this->m_UI->ActionBackground3D, SIGNAL( triggered( ) ),
47     this, SLOT( _ActionBackground3D( ) )
48     );
49   this->connect(
50     this->m_UI->ButtonLoadPluginsFile, SIGNAL( clicked( ) ),
51     this, SLOT( _InteractiveLoadPlugins( ) )
52     );
53   this->connect(
54     this->m_UI->ButtonLoadPluginsPath, SIGNAL( clicked( ) ),
55     this, SLOT( _InteractiveLoadPluginsFromPath( ) )
56     );
57   this->connect(
58     this->m_UI->ActionOpenWorkspace, SIGNAL( triggered( ) ),
59     this, SLOT( _InteractiveLoadWorkspace( ) )
60     );
61   this->connect(
62     this->m_UI->ActionSaveWorkspace, SIGNAL( triggered( ) ),
63     this, SLOT( _InteractiveSaveWorkspace( ) )
64     );
65   this->connect(
66     this->m_UI->Canvas->editor( ),
67     SIGNAL( execFilter( const std::string& ) ),
68     this,
69     SLOT( _ExecFilter( const std::string& ) )
70     );
71   this->connect(
72     this->m_UI->Canvas->editor( ),
73     SIGNAL( showFilterOutput( const std::string&, const std::string& ) ),
74     this,
75     SLOT( _ShowFilterOutput( const std::string&, const std::string& ) )
76     );
77   this->connect(
78     this->m_UI->Canvas->editor( ),
79     SIGNAL( hideFilterOutput( const std::string&, const std::string& ) ),
80     this,
81     SLOT( _HideFilterOutput( const std::string&, const std::string& ) )
82     );
83   this->connect(
84     this->m_UI->Canvas->editor( ),
85     SIGNAL( visualPropertiesFilterOutput( const std::string&, const std::string& ) ),
86     this,
87     SLOT( _PropertiesFilterOutput( const std::string&, const std::string& ) )
88     );
89 }
90
91 // -------------------------------------------------------------------------
92 PipelineEditor::
93 ~PipelineEditor( )
94 {
95   delete this->m_UI;
96 }
97
98 // -------------------------------------------------------------------------
99 void PipelineEditor::
100 _ActionBackgroundMPR( )
101 {
102   this->_BackgroundProperties( 4 );
103 }
104
105 // -------------------------------------------------------------------------
106 void PipelineEditor::
107 _ActionBackground3D( )
108 {
109   this->_BackgroundProperties( 3 );
110 }
111
112 // -------------------------------------------------------------------------
113 void PipelineEditor::
114 _ShowFilterOutput(
115   const std::string& filter_name, const std::string& output_name
116   )
117 {
118   this->_ExecFilter( filter_name );
119   this->_ShowData( filter_name, output_name );
120 }
121
122 // -------------------------------------------------------------------------
123 void PipelineEditor::
124 _HideFilterOutput(
125   const std::string& filter_name, const std::string& output_name
126   )
127 {
128   this->_HideData( filter_name, output_name );
129 }
130
131 // -------------------------------------------------------------------------
132 void PipelineEditor::
133 _PropertiesFilterOutput(
134   const std::string& filter_name, const std::string& output_name
135   )
136 {
137   this->_DataProperties( filter_name, output_name );
138 }
139
140 // eof - $RCSfile$