Salome HOME
*** empty log message ***
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : MeasureGUI.cxx
23 // Author : Damien COQUERET, Open CASCADE S.A.S.
24 //
25
26 #include "MeasureGUI.h"
27
28 #include <GeometryGUI.h>
29 #include <SUIT_Desktop.h>
30 #include <SalomeApp_Application.h>
31
32 #include "MeasureGUI_PropertiesDlg.h"    // Method PROPERTIES
33 #include "MeasureGUI_CenterMassDlg.h"    // Method CENTER MASS
34 #include "MeasureGUI_InertiaDlg.h"       // Method INERTIA
35 #include "MeasureGUI_BndBoxDlg.h"        // Method BNDBOX
36 #include "MeasureGUI_DistanceDlg.h"      // Method DISTANCE
37 #include "MeasureGUI_MaxToleranceDlg.h"  // Method MAXTOLERANCE
38 #include "MeasureGUI_WhatisDlg.h"        // Method WHATIS
39 #include "MeasureGUI_CheckShapeDlg.h"    // Method CHECKSHAPE
40 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
41 #include "MeasureGUI_PointDlg.h"         // Method POINTCOORDINATES
42
43 #include <QApplication>
44
45 //=======================================================================
46 // function : MeasureGUI()
47 // purpose  : Constructor
48 //=======================================================================
49 MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
50 {
51 }
52
53 //=======================================================================
54 // function : ~MeasureGUI()
55 // purpose  : Destructor
56 //=======================================================================
57 MeasureGUI::~MeasureGUI()
58 {
59 }
60
61
62 //=======================================================================
63 // function : OnGUIEvent()
64 // purpose  : 
65 //=======================================================================
66 bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
67 {
68   SalomeApp_Application* app = getGeometryGUI()->getApp();
69   if ( !app ) return false;
70
71   getGeometryGUI()->EmitSignalDeactivateDialog();
72
73   QDialog* dlg = 0;
74   switch ( theCommandID ) {
75   case 701:
76     dlg = new MeasureGUI_PropertiesDlg( getGeometryGUI(), parent );
77     break; // LENGTH, AREA AND VOLUME
78   case 702:
79     dlg = new MeasureGUI_CenterMassDlg( getGeometryGUI(), parent );
80     break; // CENTER MASS
81   case 703:
82     dlg = new MeasureGUI_InertiaDlg( getGeometryGUI(), parent );
83     break; // INERTIA
84   case 7041:
85     dlg = new MeasureGUI_BndBoxDlg( getGeometryGUI(), parent );
86     break; // BOUNDING BOX
87   case 7042:
88     dlg = new MeasureGUI_DistanceDlg( getGeometryGUI(), parent );
89     break; // MIN DISTANCE
90   case 705: 
91     dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent );
92     break; // MAXTOLERANCE
93   case 706:
94     dlg = new MeasureGUI_WhatisDlg( getGeometryGUI(), parent );
95     break; // WHATIS
96   case 707:
97     dlg = new MeasureGUI_CheckShapeDlg( getGeometryGUI(), parent );
98     break; // CHECKSHAPE
99   case 7072:
100     dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
101     break; // CHECKCOMPOUND
102   case 708:
103     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
104     break; // POINT COORDINATES
105   default: 
106     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
107     break;
108   }
109   if ( dlg ) {
110     dlg->updateGeometry();
111     dlg->resize( dlg->minimumSize() );
112     dlg->show();
113   }
114   return true;
115 }
116
117
118 //=====================================================================================
119 // EXPORTED METHODS
120 //=====================================================================================
121 extern "C"
122 {
123 #ifdef WIN32
124   __declspec( dllexport )
125 #endif
126   GEOMGUI* GetLibGUI( GeometryGUI* parent )
127   {
128     return new MeasureGUI( parent );
129   }
130 }