1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MeasureGUI.cxx
25 // Author : Damien COQUERET
30 #include "MeasureGUI.h"
32 #include "SALOMEGUI_QtCatchCorbaException.hxx"
34 #include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES
35 #include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS
36 #include "MeasureGUI_InertiaDlg.h" // Method INERTIA
37 #include "MeasureGUI_BndBoxDlg.h" // Method BNDBOX
38 #include "MeasureGUI_DistanceDlg.h" // Method DISTANCE
39 #include "MeasureGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE
40 #include "MeasureGUI_WhatisDlg.h" // Method WHATIS
41 #include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
43 //=======================================================================
44 // function : MeasureGUI()
45 // purpose : Constructor
46 //=======================================================================
47 MeasureGUI::MeasureGUI() :
50 myGeomBase = new GEOMBase();
51 myGeomGUI = GEOMContext::GetGeomGUI();
52 myGeom = myGeomGUI->myComponentGeom;
56 //=======================================================================
57 // function : ~MeasureGUI()
58 // purpose : Destructor
59 //=======================================================================
60 MeasureGUI::~MeasureGUI()
65 //=======================================================================
66 // function : OnGUIEvent()
68 //=======================================================================
69 bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
71 MeasureGUI* myMeasureGUI = new MeasureGUI();
72 myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog();
73 SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
77 case 701: // PROPERTIES (Length, surface, volume)
79 MeasureGUI_PropertiesDlg *aDlg = new MeasureGUI_PropertiesDlg(parent, "", Sel);
82 case 702: // CDG : Center of mass
84 MeasureGUI_CenterMassDlg *aDlg = new MeasureGUI_CenterMassDlg(parent, "", myMeasureGUI, Sel);
89 MeasureGUI_InertiaDlg *aDlg = new MeasureGUI_InertiaDlg(parent, "", Sel);
92 case 7041: // BOUNDING BOX
94 MeasureGUI_BndBoxDlg *aDlg = new MeasureGUI_BndBoxDlg(parent, "", Sel);
97 case 7042: // MIN DISTANCE
99 MeasureGUI_DistanceDlg *aDlg = new MeasureGUI_DistanceDlg(parent, "", Sel);
102 case 705: // MAXTOLERANCE
104 MeasureGUI_MaxToleranceDlg *aDlg = new MeasureGUI_MaxToleranceDlg(parent, "", Sel);
109 MeasureGUI_WhatisDlg *aDlg = new MeasureGUI_WhatisDlg(parent, "", Sel);
112 case 707: // CHECKSHAPE
114 MeasureGUI_CheckShapeDlg *aDlg = new MeasureGUI_CheckShapeDlg(parent, "", Sel);
119 parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
127 //=====================================================================================
128 // function : MakeCDGAndDisplay()
130 //=====================================================================================
131 void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
134 GEOM::GEOM_Shape_var result = myGeom->MakeCDG(Shape);
135 if(result->_is_nil()) {
136 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
139 result->NameType(tr("GEOM_POINT"));
140 if(myGeomBase->Display(result))
141 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
143 catch(const SALOME::SALOME_Exception& S_ex) {
144 QtCatchCorbaException(S_ex);
150 //=====================================================================================
152 //=====================================================================================
155 bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
156 {return MeasureGUI::OnGUIEvent(theCommandID, parent);}