]> SALOME platform Git repositories - modules/geom.git/blob - src/TransformationGUI/TransformationGUI.cxx
Salome HOME
Fix crash of BugRevolution.py import: apply the same patch, as on V2_2_0_maintainance
[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 using namespace std;
30 #include "TransformationGUI.h"
31 #include "GeometryGUI.h"
32
33 #include "SUIT_Session.h"
34 #include "SUIT_Desktop.h"
35
36 #include "TransformationGUI_MultiTranslationDlg.h"   // Method MULTI TRANSLATION
37 #include "TransformationGUI_MultiRotationDlg.h"      // Method MULTI ROTATION
38 #include "TransformationGUI_TranslationDlg.h"        // Method TRANSLATION
39 #include "TransformationGUI_RotationDlg.h"           // Method ROTATION
40 #include "TransformationGUI_MirrorDlg.h"             // Method MIRROR
41 #include "TransformationGUI_ScaleDlg.h"              // Method SCALE
42 #include "TransformationGUI_OffsetDlg.h"             // Method OFFSET
43 #include "TransformationGUI_PositionDlg.h"           // Method POSITION
44
45 TransformationGUI* TransformationGUI::myGUIObject = 0;
46
47 //=======================================================================
48 // function : GetTransformationGUI()
49 // purpose  : Get the only TransformationGUI object [ static ]
50 //=======================================================================
51 TransformationGUI* TransformationGUI::GetTransformationGUI( GeometryGUI* parent )
52 {
53   if ( myGUIObject == 0 ) {
54     // init TransformationGUI only once
55     myGUIObject = new TransformationGUI( parent );
56   }
57   return myGUIObject;
58 }
59
60 //=======================================================================
61 // function : TransformationGUI()
62 // purpose  : Constructor
63 //=======================================================================
64 TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent)
65 {
66 }
67
68
69 //=======================================================================
70 // function : ~TransformationGUI()
71 // purpose  : Destructor
72 //=======================================================================
73 TransformationGUI::~TransformationGUI()
74 {
75 }
76
77
78 //=======================================================================
79 // function : OnGUIEvent()
80 // purpose  : 
81 //=======================================================================
82 bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
83 {
84   getGeometryGUI()->EmitSignalDeactivateDialog();
85   QDialog* aDlg = NULL;
86
87   switch (theCommandID)
88     {
89     case 5021: // TRANSLATION
90       { 
91         aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" );
92         break;
93       }
94     case 5022: // ROTATION
95       { 
96         aDlg = new TransformationGUI_RotationDlg( parent, "" );
97         break;
98       }
99     case 5023: // POSITION
100       { 
101         aDlg = new TransformationGUI_PositionDlg( parent, "" );
102         break;
103       }
104     case 5024: // MIRROR
105       { 
106         aDlg = new TransformationGUI_MirrorDlg( parent, "" );
107         break;
108       }
109     case 5025: // SCALE
110       { 
111         aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" );
112         break;
113       }
114     case 5026: // OFFSET
115       { 
116         aDlg = new TransformationGUI_OffsetDlg( parent, "" );
117         break;
118       }  
119     case 5027: // MULTI TRANSLATION
120       { 
121         aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" );
122         break;
123       }
124     case 5028: // MULTI ROTATION
125       { 
126         aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" );
127         break;
128       }
129     default:
130       {
131         SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
132         break;
133       }
134     }
135
136   if ( aDlg != NULL )
137     aDlg->show();
138
139   return true;
140 }
141
142
143 //=====================================================================================
144 // EXPORTED METHODS
145 //=====================================================================================
146 extern "C"
147 {
148   GEOMGUI* GetLibGUI( GeometryGUI* parent )
149   {
150     return TransformationGUI::GetTransformationGUI( parent );
151   }
152 }