1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // GEOM GEOMGUI : GUI for Geometry component
21 // File : EntityGUI_3DSketcherDlg.h
24 #ifndef ENTITYGUI_3DSKETCHERDLG_H
25 #define ENTITYGUI_3DSKETCHERDLG_H
27 #include <GEOMBase_Skeleton.h>
31 class EntityGUI_3Spin;
33 class EntityGUI_Angles;
34 class EntityGUI_Controls;
38 #include <AIS_ListOfInteractive.hxx>
39 #include <AIS_AngleDimension.hxx>
40 #include <AIS_LengthDimension.hxx>
43 # define COORD_MIN -1e+15
44 # define COORD_MAX +1e+15
45 # define MAX_NUMBER 100000
46 # define DBL_DIGITS_DISPLAY 16
50 bool isSame (double d1, double d2);
52 //=================================================================================
53 // class : EntityGUI_Dlg
55 //=================================================================================
56 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
62 XYZ() { x = y = z = 0.0; command = params = ""; L=A=T=0; }
63 double x, y, z; // for preview only
64 int L, A, T; // for preview only
77 typedef QList<XYZ> XYZList;
80 EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
81 ~EntityGUI_3DSketcherDlg();
85 // redefined from GEOMBase_Helper
86 virtual GEOM::GEOM_IOperations_ptr createOperation();
87 virtual bool isValid( QString& );
88 virtual bool execute( ObjectList& );
92 void enterEvent( QEvent* );
94 virtual void displayPreview( GEOM::GEOM_Object_ptr,
102 Handle(AIS_LengthDimension) createAISLengthDimension(double theLength,
107 Handle(AIS_AngleDimension) createAISAngleDimension(double theAngle,
112 void displayAngle(double theAngle,
118 void displayLength(gp_Pnt P1,
123 void displayText(std::string theText,
127 void displayTrihedron( int );
129 void displayDimensions(bool store = false);
131 bool createShapes( GEOM::GEOM_Object_ptr,
135 XYZ getLastPoint() const;
136 XYZ getPenultimatePoint() const;
137 XYZ getCurrentPoint() const;
139 gp_Dir getPresentationPlane() const;
141 std::string doubleToString( double );
143 gp_Trsf toReferenceSystem(gp_Pnt origin) const;
144 gp_Trsf toCurrentSystem(gp_Pnt origin) const;
146 void removeLastIOFromPrs();
147 void restoreLastIOToPrs();
149 double radius(gp_Pnt) const;
150 double height(gp_Pnt) const;
151 double longitude(gp_Pnt) const;
152 double latitude(gp_Pnt) const;
155 XYZList myPointsList;
157 AIS_ListOfInteractive myLengthIORedoList;
158 AIS_ListOfInteractive myAngleIORedoList;
159 AIS_ListOfInteractive myTextIORedoList;
162 EntityGUI_3Spin* Group3Spin;
163 EntityGUI_Angles* GroupAngles;
164 EntityGUI_Controls* GroupControls;
165 EntityGUI_Type* GroupType;
166 QButtonGroup* myTypeGroup1;
167 QButtonGroup* myTypeGroup2;
173 bool isLengthVisible;
177 GeometryGUI* myGeometryGUI;
178 SOCC_Prs* myAnglePrs;
179 SOCC_Prs* myLengthPrs;
184 void ClickOnAddPoint();
186 // bool isSameAsPrevious();
187 void UpdateButtonsState();
188 void UpdatePointCoordinates();
193 void SelectionIntoArgument();
194 void DeactivateActiveDialog();
195 void ActivateThisDialog();
196 void TypeClicked( int );
197 void ValueChangedInSpinBox( double );
198 void ButtonClicked( bool );
199 void BoxChecked ( bool );
200 void SetDoubleSpinBoxStep( double );
203 #endif // ENTITYGUI_SKETCHERDLG_H