Back to index

salome-geom  6.5.0
EntityGUI_3DSketcherDlg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // GEOM GEOMGUI : GUI for Geometry component
00021 // File   : EntityGUI_3DSketcherDlg.h
00022 // Author : DMV, OCN
00023 //
00024 #ifndef ENTITYGUI_3DSKETCHERDLG_H
00025 #define ENTITYGUI_3DSKETCHERDLG_H
00026 
00027 #include <GEOMBase_Skeleton.h>
00028 
00029 class QButtonGroup;
00030 class QDoubleSpinBox;
00031 class EntityGUI_3Spin;
00032 class DlgRef_3Radio;
00033 
00034 #ifndef COORD_MIN
00035 #  define COORD_MIN -1e+15
00036 #  define COORD_MAX +1e+15
00037 #  define MAX_NUMBER 100000
00038 #  define DBL_DIGITS_DISPLAY 16
00039 #endif // COORD_MIN
00040 
00041 //=================================================================================
00042 // class    : EntityGUI_Dlg
00043 // purpose  :
00044 //=================================================================================
00045 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
00046 { 
00047   Q_OBJECT
00048 
00049   struct XYZ
00050   {
00051     XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
00052     double  x,  y,  z;
00053     QString xt, yt, zt;
00054   };
00055   typedef QList<XYZ> XYZList;
00056 
00057 public:
00058   EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
00059   ~EntityGUI_3DSketcherDlg();
00060 
00061 protected:
00062  
00063   // redefined from GEOMBase_Helper
00064   virtual GEOM::GEOM_IOperations_ptr createOperation();
00065   virtual bool                       isValid( QString& );
00066   virtual bool                       execute( ObjectList& );
00067 
00068 private:
00069   void                               Init();
00070   void                               enterEvent( QEvent* );
00071 
00072   virtual void                       displayPreview( GEOM::GEOM_Object_ptr,
00073                                                      const bool = false,
00074                                                      const bool = false,
00075                                                      const bool = true,
00076                                                      const double = -1,
00077                                                      const int  = -1,
00078                                                      const int  = -1);
00079 
00080   bool                               createShapes( GEOM::GEOM_Object_ptr,
00081                                                    TopoDS_Shape&,
00082                                                    TopoDS_Shape& );
00083 
00084   XYZ                                getLastPoint() const;
00085   XYZ                                getCurrentPoint() const;
00086 
00087 private:
00088   XYZList                            myPointsList;
00089   XYZList                            myRedoList;
00090 
00091   EntityGUI_3Spin*                   Group3Spin;
00092   DlgRef_3Radio*                     GroupType;
00093   QButtonGroup*                      myTypeGroup;
00094 
00095   int                                myMode;
00096   bool                               myOK;
00097   double                             myLineWidth;
00098   GeometryGUI*                       myGeometryGUI;
00099 
00100 private slots:
00101   void                               ClickOnOk();
00102   void                               ClickOnAddPoint();
00103   bool                               ClickOnApply();
00104   //  bool                               isSameAsPrevious();
00105   void                               UpdateButtonsState();
00106 
00107   void                               ClickOnUndo();
00108   void                               ClickOnRedo();
00109 
00110   void                               SelectionIntoArgument();
00111   void                               DeactivateActiveDialog();
00112   void                               ActivateThisDialog();
00113   void                               TypeClicked( int );
00114   void                               ValueChangedInSpinBox( double );
00115   void                               SetDoubleSpinBoxStep( double );
00116 };
00117 
00118 #endif // ENTITYGUI_SKETCHERDLG_H