Salome HOME
Mantis issue 0020706: EDF 1263 GEOM: Suppress faces does notremove faces and adds...
[modules/geom.git] / src / MeasureGUI / MeasureGUI.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 // GEOM GEOMGUI : GUI for Geometry component
23 // File   : MeasureGUI.cxx
24 // Author : Damien COQUERET, Open CASCADE S.A.S.
25 //
26 #include "MeasureGUI.h"
27
28 #include <GeometryGUI.h>
29 #include "GeometryGUI_Operations.h"
30 #include <SUIT_Desktop.h>
31 #include <SalomeApp_Application.h>
32
33 #include "MeasureGUI_PropertiesDlg.h"    // Method PROPERTIES
34 #include "MeasureGUI_CenterMassDlg.h"    // Method CENTER MASS
35 #include "MeasureGUI_NormaleDlg.h"       // Method NORMALE
36 #include "MeasureGUI_InertiaDlg.h"       // Method INERTIA
37 #include "MeasureGUI_BndBoxDlg.h"        // Method BNDBOX
38 #include "MeasureGUI_DistanceDlg.h"      // Method DISTANCE
39 #include "MeasureGUI_AngleDlg.h"         // Method ANGLE
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 #include <QApplication>
47
48 //=======================================================================
49 // function : MeasureGUI()
50 // purpose  : Constructor
51 //=======================================================================
52 MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
53 {
54 }
55
56 //=======================================================================
57 // function : ~MeasureGUI()
58 // purpose  : Destructor
59 //=======================================================================
60 MeasureGUI::~MeasureGUI()
61 {
62 }
63
64
65 //=======================================================================
66 // function : OnGUIEvent()
67 // purpose  : 
68 //=======================================================================
69 bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
70 {
71   SalomeApp_Application* app = getGeometryGUI()->getApp();
72   if ( !app ) return false;
73
74   getGeometryGUI()->EmitSignalDeactivateDialog();
75
76   QDialog* dlg = 0;
77   switch ( theCommandID ) {
78   case GEOMOp::OpProperties:
79     dlg = new MeasureGUI_PropertiesDlg( getGeometryGUI(), parent );
80     break; // LENGTH, AREA AND VOLUME
81   case GEOMOp::OpCenterMass:
82     dlg = new MeasureGUI_CenterMassDlg( getGeometryGUI(), parent );
83     break; // CENTER MASS7
84   case GEOMOp::OpInertia:
85     dlg = new MeasureGUI_InertiaDlg( getGeometryGUI(), parent );
86     break; // INERTIA
87   case GEOMOp::OpNormale : 
88     dlg = new MeasureGUI_NormaleDlg( getGeometryGUI(), parent );
89     break; // NORMALE
90   case GEOMOp::OpBoundingBox:
91     dlg = new MeasureGUI_BndBoxDlg( getGeometryGUI(), parent );
92     break; // BOUNDING BOX
93   case GEOMOp::OpMinDistance:
94     dlg = new MeasureGUI_DistanceDlg( getGeometryGUI(), parent );
95     break; // MIN DISTANCE
96   case GEOMOp::OpAngle: 
97     dlg = new MeasureGUI_AngleDlg( getGeometryGUI(), parent );
98     break; // ANGLE
99   case GEOMOp::OpTolerance: 
100     dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent );
101     break; // MAXTOLERANCE
102   case GEOMOp::OpWhatIs:
103     dlg = new MeasureGUI_WhatisDlg( getGeometryGUI(), parent );
104     break; // WHATIS
105   case GEOMOp::OpCheckShape:
106     dlg = new MeasureGUI_CheckShapeDlg( getGeometryGUI(), parent );
107     break; // CHECKSHAPE
108   case GEOMOp::OpCheckCompound:
109     dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
110     break; // CHECKCOMPOUND
111   case GEOMOp::OpPointCoordinates:
112     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
113     break; // POINT COORDINATES
114   default: 
115     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
116     break;
117   }
118   if ( dlg ) {
119     dlg->updateGeometry();
120     dlg->resize( dlg->minimumSizeHint() );
121     dlg->show();
122   }
123   return true;
124 }
125
126
127 //=====================================================================================
128 // EXPORTED METHODS
129 //=====================================================================================
130 extern "C"
131 {
132 #ifdef WIN32
133   __declspec( dllexport )
134 #endif
135   GEOMGUI* GetLibGUI( GeometryGUI* parent )
136   {
137     return new MeasureGUI( parent );
138   }
139 }