1 // Copyright (C) 2007-2012 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
19 // GEOM GEOMGUI : GUI for Geometry component
20 // File : EntityGUI_3DSketcherDlg.h
23 #ifndef ENTITYGUI_3DSKETCHERDLG_H
24 #define ENTITYGUI_3DSKETCHERDLG_H
26 #include <GEOMBase_Skeleton.h>
30 class EntityGUI_3Spin;
32 class EntityGUI_Angles;
33 class EntityGUI_Controls;
37 #include <AIS_ListOfInteractive.hxx>
38 #include <AIS_AngleDimension.hxx>
39 #include <AIS_LengthDimension.hxx>
42 # define COORD_MIN -1e+15
43 # define COORD_MAX +1e+15
44 # define MAX_NUMBER 100000
45 # define DBL_DIGITS_DISPLAY 16
49 bool isSame (double d1, double d2);
51 //=================================================================================
52 // class : EntityGUI_Dlg
54 //=================================================================================
55 class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
61 XYZ() { x = y = z = 0.0; command = params = ""; L=A=0; }
62 double x, y, z; // for preview only
63 int L, A; // for preview only
75 typedef QList<XYZ> XYZList;
78 EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
79 ~EntityGUI_3DSketcherDlg();
83 // redefined from GEOMBase_Helper
84 virtual GEOM::GEOM_IOperations_ptr createOperation();
85 virtual bool isValid( QString& );
86 virtual bool execute( ObjectList& );
90 void enterEvent( QEvent* );
92 virtual void displayPreview( GEOM::GEOM_Object_ptr,
100 Handle(AIS_LengthDimension) createAISLengthDimension(double theLength,
105 Handle(AIS_AngleDimension) createAISAngleDimension(double theAngle,
110 void displayAngle(double theAngle,
116 void displayLength(gp_Pnt P1,
121 void displayText(std::string theText,
125 void displayTrihedron( int );
127 void displayDimensions(bool store = false);
129 bool createShapes( GEOM::GEOM_Object_ptr,
133 XYZ getLastPoint() const;
134 XYZ getPenultimatePoint() const;
135 XYZ getCurrentPoint() const;
137 gp_Dir getPresentationPlane() const;
139 std::string doubleToString( double );
141 gp_Trsf toReferenceSystem(gp_Pnt origin) const;
142 gp_Trsf toCurrentSystem(gp_Pnt origin) const;
144 void removeLastIOFromPrs();
145 void restoreLastIOToPrs();
147 double radius(gp_Pnt) const;
148 double height(gp_Pnt) const;
149 double longitude(gp_Pnt) const;
150 double latitude(gp_Pnt) const;
153 XYZList myPointsList;
155 AIS_ListOfInteractive myLengthIORedoList;
156 AIS_ListOfInteractive myAngleIORedoList;
159 EntityGUI_3Spin* Group3Spin;
160 EntityGUI_Angles* GroupAngles;
161 EntityGUI_Controls* GroupControls;
162 EntityGUI_Type* GroupType;
163 QButtonGroup* myTypeGroup1;
164 QButtonGroup* myTypeGroup2;
170 bool isLengthVisible;
174 GeometryGUI* myGeometryGUI;
175 SOCC_Prs* myAnglePrs;
176 SOCC_Prs* myLengthPrs;
181 void ClickOnAddPoint();
183 // bool isSameAsPrevious();
184 void UpdateButtonsState();
185 void UpdatePointCoordinates();
190 void SelectionIntoArgument();
191 void DeactivateActiveDialog();
192 void ActivateThisDialog();
193 void TypeClicked( int );
194 void ValueChangedInSpinBox( double );
195 void ButtonClicked( bool );
196 void BoxChecked ( bool );
197 void SetDoubleSpinBoxStep( double );
200 #endif // ENTITYGUI_SKETCHERDLG_H