Back to index

salome-smesh  6.5.0
SMESHGUI_Measurements.h
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 //  File   : SMESHGUI_Measurements.h
00023 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00024 
00025 #ifndef SMESHGUI_MEASUREMENTS_H
00026 #define SMESHGUI_MEASUREMENTS_H
00027 
00028 #include "SMESH_SMESHGUI.hxx"
00029 
00030 #include <QDialog>
00031 
00032 class QButtonGroup;
00033 class QLineEdit;
00034 class QTabWidget;
00035 class SUIT_SelectionFilter;
00036 class SALOME_Actor;
00037 class SMESH_Actor;
00038 class SMESHGUI_IdValidator;
00039 
00040 #include <SALOMEconfig.h>
00041 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00042 
00043 class SMESHGUI_EXPORT SMESHGUI_MinDistance : public QWidget
00044 {
00045   Q_OBJECT;
00046 
00047   enum { NoTgt, FirstTgt, SecondTgt };
00048   enum { OriginTgt, NodeTgt, ElementTgt, ObjectTgt };
00049 
00050 public:
00051   SMESHGUI_MinDistance( QWidget* = 0 );
00052   ~SMESHGUI_MinDistance();
00053 
00054   bool eventFilter( QObject*, QEvent* );
00055   void updateSelection();
00056   void deactivate();
00057 
00058 private: 
00059   void setTarget( int );
00060   void erasePreview();
00061   void displayPreview();
00062   void createPreview( double, double, double, double, double, double );
00063 
00064 private slots:
00065   void selectionChanged();
00066   void firstChanged();
00067   void secondChanged();
00068   void firstEdited();
00069   void secondEdited();
00070   void compute();
00071   void clear();
00072 
00073 private:
00074   QButtonGroup*             myFirst;
00075   QButtonGroup*             mySecond;
00076   QLineEdit*                myFirstTgt;
00077   QLineEdit*                mySecondTgt;
00078   QLineEdit*                myDX;
00079   QLineEdit*                myDY;
00080   QLineEdit*                myDZ;
00081   QLineEdit*                myDistance;
00082   int                       myCurrentTgt;
00083   SMESH::SMESH_IDSource_var myFirstSrc;
00084   SMESH::SMESH_IDSource_var mySecondSrc;
00085   SMESH_Actor*              myFirstActor;
00086   SMESH_Actor*              mySecondActor;
00087   SMESHGUI_IdValidator*     myValidator;
00088   SUIT_SelectionFilter*     myFilter;
00089   SALOME_Actor*             myPreview;
00090 };
00091 
00092 class SMESHGUI_EXPORT SMESHGUI_BoundingBox : public QWidget
00093 {
00094   Q_OBJECT;
00095 
00096   enum { ObjectsSrc, NodesSrc, ElementsSrc };
00097   
00098 public:
00099   SMESHGUI_BoundingBox( QWidget* = 0 );
00100   ~SMESHGUI_BoundingBox();
00101 
00102   void updateSelection();
00103   void deactivate();
00104 
00105 private:
00106   void erasePreview();
00107   void displayPreview();
00108   void createPreview( double, double, double, double, double, double );
00109 
00110 private slots:
00111   void selectionChanged();
00112   void sourceChanged();
00113   void sourceEdited();
00114   void compute();
00115   void clear();
00116 
00117 private:
00118   typedef QList<SMESH::SMESH_IDSource_var> SourceList;
00119   QButtonGroup*             mySourceMode;
00120   QLineEdit*                mySource;
00121   QLineEdit*                myXmin;
00122   QLineEdit*                myXmax;
00123   QLineEdit*                myDX;
00124   QLineEdit*                myYmin;
00125   QLineEdit*                myYmax;
00126   QLineEdit*                myDY;
00127   QLineEdit*                myZmin;
00128   QLineEdit*                myZmax;
00129   QLineEdit*                myDZ;
00130   SourceList                mySrc;
00131   SMESH_Actor*              myActor;
00132   SMESHGUI_IdValidator*     myValidator;
00133   QString                   myIDs;
00134   SUIT_SelectionFilter*     myFilter;
00135   SALOME_Actor*             myPreview;
00136 };
00137 
00138 class SMESHGUI_EXPORT SMESHGUI_MeasureDlg : public QDialog
00139 { 
00140   Q_OBJECT;
00141 
00142   enum { NodeMode, ElemMode };
00143 
00144 public:
00146   enum { 
00147     MinDistance,   
00148     BoundingBox    
00149   };
00150 
00151   SMESHGUI_MeasureDlg( QWidget* = 0, int = MinDistance );
00152   ~SMESHGUI_MeasureDlg();
00153 
00154   void reject();
00155 
00156 protected:
00157   void keyPressEvent( QKeyEvent* );
00158   void enterEvent( QEvent* );
00159 
00160 private slots:
00161   void help();
00162   void updateSelection();
00163   void activate();
00164   void deactivate();
00165 
00166 private:
00167   QTabWidget*           myTabWidget;
00168   SMESHGUI_MinDistance* myMinDist;   
00169   SMESHGUI_BoundingBox* myBndBox;
00170 };
00171 
00172 #endif // SMESHGUI_MEASUREMENTS_H