Back to index

salome-geom  6.5.0
MeasureGUI.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // GEOM GEOMGUI : GUI for Geometry component
00024 // File   : MeasureGUI.cxx
00025 // Author : Damien COQUERET, Open CASCADE S.A.S.
00026 
00027 #include "MeasureGUI.h"
00028 
00029 #include <GeometryGUI.h>
00030 #include "GeometryGUI_Operations.h"
00031 #include <SUIT_Desktop.h>
00032 #include <SalomeApp_Application.h>
00033 
00034 #include "MeasureGUI_PropertiesDlg.h"    // Method PROPERTIES
00035 #include "MeasureGUI_CenterMassDlg.h"    // Method CENTER MASS
00036 #include "MeasureGUI_NormaleDlg.h"       // Method NORMALE
00037 #include "MeasureGUI_InertiaDlg.h"       // Method INERTIA
00038 #include "MeasureGUI_BndBoxDlg.h"        // Method BNDBOX
00039 #include "MeasureGUI_DistanceDlg.h"      // Method DISTANCE
00040 #include "MeasureGUI_AngleDlg.h"         // Method ANGLE
00041 #include "MeasureGUI_MaxToleranceDlg.h"  // Method MAXTOLERANCE
00042 #include "MeasureGUI_WhatisDlg.h"        // Method WHATIS
00043 #include "MeasureGUI_CheckShapeDlg.h"    // Method CHECKSHAPE
00044 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" // Method CHECKCOMPOUND
00045 #include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
00046 #include "MeasureGUI_PointDlg.h"         // Method POINTCOORDINATES
00047 
00048 #include <QApplication>
00049 
00050 //=======================================================================
00051 // function : MeasureGUI()
00052 // purpose  : Constructor
00053 //=======================================================================
00054 MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
00055 {
00056 }
00057 
00058 //=======================================================================
00059 // function : ~MeasureGUI()
00060 // purpose  : Destructor
00061 //=======================================================================
00062 MeasureGUI::~MeasureGUI()
00063 {
00064 }
00065 
00066 
00067 //=======================================================================
00068 // function : OnGUIEvent()
00069 // purpose  : 
00070 //=======================================================================
00071 bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
00072 {
00073   SalomeApp_Application* app = getGeometryGUI()->getApp();
00074   if ( !app ) return false;
00075 
00076   getGeometryGUI()->EmitSignalDeactivateDialog();
00077 
00078   QDialog* dlg = 0;
00079   switch ( theCommandID ) {
00080   case GEOMOp::OpProperties:
00081     dlg = new MeasureGUI_PropertiesDlg( getGeometryGUI(), parent );
00082     break; // LENGTH, AREA AND VOLUME
00083   case GEOMOp::OpCenterMass:
00084     dlg = new MeasureGUI_CenterMassDlg( getGeometryGUI(), parent );
00085     break; // CENTER MASS7
00086   case GEOMOp::OpInertia:
00087     dlg = new MeasureGUI_InertiaDlg( getGeometryGUI(), parent );
00088     break; // INERTIA
00089   case GEOMOp::OpNormale : 
00090     dlg = new MeasureGUI_NormaleDlg( getGeometryGUI(), parent );
00091     break; // NORMALE
00092   case GEOMOp::OpBoundingBox:
00093     dlg = new MeasureGUI_BndBoxDlg( getGeometryGUI(), parent );
00094     break; // BOUNDING BOX
00095   case GEOMOp::OpMinDistance:
00096     dlg = new MeasureGUI_DistanceDlg( getGeometryGUI(), parent );
00097     break; // MIN DISTANCE
00098   case GEOMOp::OpAngle: 
00099     dlg = new MeasureGUI_AngleDlg( getGeometryGUI(), parent );
00100     break; // ANGLE
00101   case GEOMOp::OpTolerance: 
00102     dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent );
00103     break; // MAXTOLERANCE
00104   case GEOMOp::OpWhatIs:
00105     dlg = new MeasureGUI_WhatisDlg( getGeometryGUI(), parent );
00106     break; // WHATIS
00107   case GEOMOp::OpCheckShape:
00108     dlg = new MeasureGUI_CheckShapeDlg( getGeometryGUI(), parent );
00109     break; // CHECKSHAPE
00110   case GEOMOp::OpCheckCompound:
00111     dlg = new MeasureGUI_CheckCompoundOfBlocksDlg( getGeometryGUI(), parent );
00112     break; // CHECKCOMPOUND
00113   case GEOMOp::OpCheckSelfInters:
00114     dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
00115     break; // CHECK SELF INTERSCTIONS
00116   case GEOMOp::OpPointCoordinates:
00117     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
00118     break; // POINT COORDINATES
00119   default: 
00120     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); 
00121     break;
00122   }
00123   if ( dlg ) {
00124     dlg->updateGeometry();
00125     dlg->resize( dlg->minimumSizeHint() );
00126     dlg->show();
00127   }
00128   return true;
00129 }
00130 
00131 
00132 //=====================================================================================
00133 // EXPORTED METHODS
00134 //=====================================================================================
00135 extern "C"
00136 {
00137 #ifdef WIN32
00138   __declspec( dllexport )
00139 #endif
00140   GEOMGUI* GetLibGUI( GeometryGUI* parent )
00141   {
00142     return new MeasureGUI( parent );
00143   }
00144 }