]> SALOME platform Git repositories - modules/geom.git/blob - src/MeasureGUI/MeasureGUI.cxx
Salome HOME
SMH: Merged GEOM (NEWGUI, HEAD, POLYWORK)
[modules/geom.git] / src / MeasureGUI / MeasureGUI.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   : MeasureGUI.cxx
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #include "MeasureGUI.h"
30 #include "SUIT_Desktop.h"
31 #include "SUIT_Session.h"
32
33 #include "SalomeApp_Tools.h"
34
35 #include "MeasureGUI_PropertiesDlg.h"    // Method PROPERTIES
36 #include "MeasureGUI_CenterMassDlg.h"    // Method CENTER MASS
37 #include "MeasureGUI_InertiaDlg.h"       // Method INERTIA
38 #include "MeasureGUI_BndBoxDlg.h"        // Method BNDBOX
39 #include "MeasureGUI_DistanceDlg.h"      // Method DISTANCE
40 #include "MeasureGUI_MaxToleranceDlg.h"  // Method MAXTOLERANCE
41 #include "MeasureGUI_WhatisDlg.h"        // Method WHATIS
42 #include "MeasureGUI_CheckShapeDlg.h"    // Method CHECKSHAPE
43 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
44 #include "MeasureGUI_PointDlg.h"         // Method POINTCOORDINATES
45
46 MeasureGUI* MeasureGUI::myGUIObject = 0;
47
48 //=======================================================================
49 // function : GetMeasureGUI()
50 // purpose  : Get the only MeasureGUI object [ static ]
51 //=======================================================================
52 MeasureGUI* MeasureGUI::GetMeasureGUI( GeometryGUI* parent )
53 {
54   if ( myGUIObject == 0 ) {
55     // init MeasureGUI only once
56     myGUIObject = new MeasureGUI( parent );
57   }
58   return myGUIObject;
59 }
60
61 //=======================================================================
62 // function : MeasureGUI()
63 // purpose  : Constructor
64 //=======================================================================
65 MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
66 {
67 }
68
69
70 //=======================================================================
71 // function : ~MeasureGUI()
72 // purpose  : Destructor
73 //=======================================================================
74 MeasureGUI::~MeasureGUI()
75 {
76 }
77
78
79 //=======================================================================
80 // function : OnGUIEvent()
81 // purpose  : 
82 //=======================================================================
83 bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
84 {
85   MeasureGUI* myMeasureGUI = GetMeasureGUI( getGeometryGUI() );
86   getGeometryGUI()->EmitSignalDeactivateDialog();
87
88   switch ( theCommandID )
89   {
90     case 701   : new MeasureGUI_PropertiesDlg  ( getGeometryGUI(), parent ); break;  // LENGTH, AREA AND VOLUME
91     case 702   : new MeasureGUI_CenterMassDlg  ( parent ); break;  // CENTER MASS
92     case 703   : new MeasureGUI_InertiaDlg     ( getGeometryGUI(), parent ); break;  // INERTIA
93     case 7041  : new MeasureGUI_BndBoxDlg      ( getGeometryGUI(), parent ); break;  // BOUNDING BOX
94     case 7042  : new MeasureGUI_DistanceDlg    ( getGeometryGUI(), parent ); break;  // MIN DISTANCE
95     case 705   : new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent ); break;  // MAXTOLERANCE
96     case 706   : new MeasureGUI_WhatisDlg      ( getGeometryGUI(), parent ); break;  // WHATIS
97     case 707   : new MeasureGUI_CheckShapeDlg  ( getGeometryGUI(), parent ); break;  // CHECKSHAPE
98     case 7072  : new MeasureGUI_CheckCompoundOfBlocksDlg  ( getGeometryGUI(), parent ); break;  // CHECKCOMPOUND
99     case 708   : new MeasureGUI_PointDlg       ( getGeometryGUI(), parent ); break;  // POINT COORDINATES
100     
101     default: 
102       SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
103       break;
104   }
105   return true;
106 }
107
108
109 //=====================================================================================
110 // function : MakeCDGAndDisplay()
111 // purpose  :
112 //=====================================================================================
113 /*void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
114 {
115   QAD_Application::getDesktop()->putInfo("MakeCDGAndDisplay method from MeasureGUI should be reimplemented ...");
116   
117   try {
118     GEOM::GEOM_Shape_var result = myGeom->MakeCDG(Shape);
119     if(result->_is_nil()) {
120       QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
121       return;
122     }
123     result->NameType(tr("GEOM_POINT"));
124     if(myGeomBase->Display(result))
125       QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
126   }  
127   catch(const SALOME::SALOME_Exception& S_ex) {
128     SalomeApp_Tools::QtCatchCorbaException(S_ex);
129     }
130   
131   return;
132 }
133 */
134
135
136 //=====================================================================================
137 // EXPORTED METHODS
138 //=====================================================================================
139 extern "C"
140 {
141   GEOMGUI* GetLibGUI( GeometryGUI* parent )
142   {
143     return MeasureGUI::GetMeasureGUI( parent );
144   }
145 }