Salome HOME
Bug IPAL19097 NPAL16768 is not implemented for "Normal to a face"
[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_NormaleDlg.h"       // Method NORMALE
35 #include "MeasureGUI_InertiaDlg.h"       // Method INERTIA
36 #include "MeasureGUI_BndBoxDlg.h"        // Method BNDBOX
37 #include "MeasureGUI_DistanceDlg.h"      // Method DISTANCE
38 #include "MeasureGUI_AngleDlg.h"         // Method ANGLE
39 #include "MeasureGUI_MaxToleranceDlg.h"  // Method MAXTOLERANCE
40 #include "MeasureGUI_WhatisDlg.h"        // Method WHATIS
41 #include "MeasureGUI_CheckShapeDlg.h"    // Method CHECKSHAPE
42 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
43 #include "MeasureGUI_PointDlg.h"         // Method POINTCOORDINATES
44
45 #include <QApplication>
46
47 //=======================================================================
48 // function : MeasureGUI()
49 // purpose  : Constructor
50 //=======================================================================
51 MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
52 {
53 }
54
55 //=======================================================================
56 // function : ~MeasureGUI()
57 // purpose  : Destructor
58 //=======================================================================
59 MeasureGUI::~MeasureGUI()
60 {
61 }
62
63
64 //=======================================================================
65 // function : OnGUIEvent()
66 // purpose  : 
67 //=======================================================================
68 bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
69 {
70   SalomeApp_Application* app = getGeometryGUI()->getApp();
71   if ( !app ) return false;
72
73   getGeometryGUI()->EmitSignalDeactivateDialog();
74
75   QDialog* dlg = 0;
76   switch ( theCommandID ) {
77   case 701:
78     dlg = new MeasureGUI_PropertiesDlg( getGeometryGUI(), parent );
79     break; // LENGTH, AREA AND VOLUME
80   case 702:
81     dlg = new MeasureGUI_CenterMassDlg( getGeometryGUI(), parent );
82     break; // CENTER MASS
83   case 703:
84     dlg = new MeasureGUI_InertiaDlg( getGeometryGUI(), parent );
85     break; // INERTIA
86   case 704 : 
87     dlg = new MeasureGUI_NormaleDlg( getGeometryGUI(), parent );
88     break; // NORMALE
89   case 7041:
90     dlg = new MeasureGUI_BndBoxDlg( getGeometryGUI(), parent );
91     break; // BOUNDING BOX
92   case 7042:
93     dlg = new MeasureGUI_DistanceDlg( getGeometryGUI(), parent );
94     break; // MIN DISTANCE
95   case 7043: 
96     dlg = new MeasureGUI_AngleDlg( getGeometryGUI(), parent );
97     break; // ANGLE
98   case 705: 
99     dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent );
100     break; // MAXTOLERANCE
101   case 706:
102     dlg = new MeasureGUI_WhatisDlg( getGeometryGUI(), parent );
103     break; // WHATIS
104   case 707:
105     dlg = new MeasureGUI_CheckShapeDlg( getGeometryGUI(), parent );
106     break; // CHECKSHAPE
107   case 7072:
108     dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
109     break; // CHECKCOMPOUND
110   case 708:
111     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
112     break; // POINT COORDINATES
113   default: 
114     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
115     break;
116   }
117   if ( dlg ) {
118     dlg->updateGeometry();
119     dlg->resize( dlg->minimumSize() );
120     dlg->show();
121   }
122   return true;
123 }
124
125
126 //=====================================================================================
127 // EXPORTED METHODS
128 //=====================================================================================
129 extern "C"
130 {
131 #ifdef WIN32
132   __declspec( dllexport )
133 #endif
134   GEOMGUI* GetLibGUI( GeometryGUI* parent )
135   {
136     return new MeasureGUI( parent );
137   }
138 }