Salome HOME
84c79078f87a6613027b6628fc923f36293d40e2
[modules/geom.git] / src / TransformationGUI / TransformationGUI.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : TransformationGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "TransformationGUI.h"
30 #include "GeometryGUI.h"
31
32 #include "SUIT_Session.h"
33 #include "SUIT_Desktop.h"
34
35 #include "TransformationGUI_MultiTranslationDlg.h"   // Method MULTI TRANSLATION
36 #include "TransformationGUI_MultiRotationDlg.h"      // Method MULTI ROTATION
37 #include "TransformationGUI_TranslationDlg.h"        // Method TRANSLATION
38 #include "TransformationGUI_RotationDlg.h"           // Method ROTATION
39 #include "TransformationGUI_MirrorDlg.h"             // Method MIRROR
40 #include "TransformationGUI_ScaleDlg.h"              // Method SCALE
41 #include "TransformationGUI_OffsetDlg.h"             // Method OFFSET
42 #include "TransformationGUI_PositionDlg.h"           // Method POSITION
43
44 using namespace std;
45
46 TransformationGUI* TransformationGUI::myGUIObject = 0;
47
48 //=======================================================================
49 // function : GetTransformationGUI()
50 // purpose  : Get the only TransformationGUI object [ static ]
51 //=======================================================================
52 TransformationGUI* TransformationGUI::GetTransformationGUI( GeometryGUI* parent )
53 {
54   if ( myGUIObject == 0 ) {
55     // init TransformationGUI only once
56     myGUIObject = new TransformationGUI( parent );
57   }
58   return myGUIObject;
59 }
60
61 //=======================================================================
62 // function : TransformationGUI()
63 // purpose  : Constructor
64 //=======================================================================
65 TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent)
66 {
67 }
68
69
70 //=======================================================================
71 // function : ~TransformationGUI()
72 // purpose  : Destructor
73 //=======================================================================
74 TransformationGUI::~TransformationGUI()
75 {
76 }
77
78
79 //=======================================================================
80 // function : OnGUIEvent()
81 // purpose  : 
82 //=======================================================================
83 bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
84 {
85   getGeometryGUI()->EmitSignalDeactivateDialog();
86   QDialog* aDlg = NULL;
87
88   switch (theCommandID)
89     {
90     case 5021: // TRANSLATION
91       { 
92         aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" );
93         break;
94       }
95     case 5022: // ROTATION
96       { 
97         aDlg = new TransformationGUI_RotationDlg( parent, "" );
98         break;
99       }
100     case 5023: // POSITION
101       { 
102         aDlg = new TransformationGUI_PositionDlg( parent, "" );
103         break;
104       }
105     case 5024: // MIRROR
106       { 
107         aDlg = new TransformationGUI_MirrorDlg( parent, "" );
108         break;
109       }
110     case 5025: // SCALE
111       { 
112         aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" );
113         break;
114       }
115     case 5026: // OFFSET
116       { 
117         aDlg = new TransformationGUI_OffsetDlg( parent, "" );
118         break;
119       }  
120     case 5027: // MULTI TRANSLATION
121       { 
122         aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" );
123         break;
124       }
125     case 5028: // MULTI ROTATION
126       { 
127         aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" );
128         break;
129       }
130     default:
131       {
132         SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
133         break;
134       }
135     }
136
137   if ( aDlg != NULL )
138     aDlg->show();
139
140   return true;
141 }
142
143
144 //=====================================================================================
145 // EXPORTED METHODS
146 //=====================================================================================
147 extern "C"
148 {
149 #ifdef WNT
150         __declspec( dllexport )
151 #endif
152   GEOMGUI* GetLibGUI( GeometryGUI* parent )
153   {
154     return TransformationGUI::GetTransformationGUI( parent );
155   }
156 }