Version: 9.16.0
EntityGUI_3DSketcherDlg.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
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, or (at your option) any later version.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// GEOM GEOMGUI : GUI for Geometry component
21// File : EntityGUI_3DSketcherDlg.h
22// Author : DMV, OCN
23
24#ifndef ENTITYGUI_3DSKETCHERDLG_H
25#define ENTITYGUI_3DSKETCHERDLG_H
26
27#include <GEOMBase_Skeleton.h>
28
29class QButtonGroup;
30class QDoubleSpinBox;
31class EntityGUI_3Spin;
32class EntityGUI_Type;
35class SOCC_Prs;
36class gp_Dir;
37
38#include <AIS_ListOfInteractive.hxx>
39#include <AIS_AngleDimension.hxx>
40#include <AIS_LengthDimension.hxx>
41
42#ifndef COORD_MIN
43# define COORD_MIN -1e+15
44# define COORD_MAX +1e+15
45# define MAX_NUMBER 100000
46# define DBL_DIGITS_DISPLAY 16
47#endif // COORD_MIN
48
49// For convenience
50bool isSame (double d1, double d2);
51
52//=================================================================================
53// class : EntityGUI_Dlg
54// purpose :
55//=================================================================================
57{
58 Q_OBJECT
59
60 struct XYZ
61 {
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
65 QString command;
66 QString params;
67 };
68
69 struct prsType
70 {
71 prsType(){L=A=T=0;}
72 int L;
73 int A;
74 int T;
75 };
76
77 typedef QList<XYZ> XYZList;
78
79public:
80 EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
82
83protected:
84
85 // redefined from GEOMBase_Helper
86 virtual GEOM::GEOM_IOperations_ptr createOperation();
87 virtual bool isValid( QString& );
88 virtual bool execute( ObjectList& );
89
90private:
91 void Init();
92 void enterEvent( QEvent* );
93
94 virtual void displayPreview( GEOM::GEOM_Object_ptr,
95 const bool = false,
96 const bool = false,
97 const bool = true,
98 const double = -1,
99 const int = -1,
100 const int = -1);
101
102 Handle(AIS_LengthDimension) createAISLengthDimension(double theLength,
103 gp_Pnt P1,
104 gp_Pnt P2,
105 gp_Dir theNormal);
106
107 Handle(AIS_AngleDimension) createAISAngleDimension(double theAngle,
108 gp_Pnt P0,
109 gp_Pnt P1,
110 gp_Pnt P2);
111
112 void displayAngle(double theAngle,
113 gp_Pnt P0,
114 gp_Pnt P1,
115 gp_Pnt P2,
116 bool store = false);
117
118 void displayLength(gp_Pnt P1,
119 gp_Pnt P2,
120 gp_Dir theNormal,
121 bool store = false);
122
123 void displayText(std::string theText,
124 gp_Pnt P,
125 bool store = false);
126
127 void displayTrihedron( int );
128
129 void displayDimensions(bool store = false);
130
131 bool createShapes( GEOM::GEOM_Object_ptr,
132 TopoDS_Shape&,
133 TopoDS_Shape& );
134
135 XYZ getLastPoint() const;
136 XYZ getPenultimatePoint() const;
137 XYZ getCurrentPoint() const;
138
139 gp_Dir getPresentationPlane() const;
140
141 std::string doubleToString( double );
142
143 gp_Trsf toReferenceSystem(gp_Pnt origin) const;
144 gp_Trsf toCurrentSystem(gp_Pnt origin) const;
145
146 void removeLastIOFromPrs();
147 void restoreLastIOToPrs();
148
149 double radius(gp_Pnt) const;
150 double height(gp_Pnt) const;
151 double longitude(gp_Pnt) const;
152 double latitude(gp_Pnt) const;
153
154private:
157 AIS_ListOfInteractive myLengthIORedoList;
158 AIS_ListOfInteractive myAngleIORedoList;
159 AIS_ListOfInteractive myTextIORedoList;
161
166 QButtonGroup* myTypeGroup1;
167 QButtonGroup* myTypeGroup2;
168
172 bool myOK;
175
178 SOCC_Prs* myAnglePrs;
179 SOCC_Prs* myLengthPrs;
180 SOCC_Prs* myTextPrs;
183
184private slots:
185 void ClickOnOk();
186 void ClickOnAddPoint();
187 bool ClickOnApply();
188 // bool isSameAsPrevious();
189 void UpdateButtonsState();
191
192 void ClickOnUndo();
193 void ClickOnRedo();
194
197 void ActivateThisDialog();
198 void TypeClicked( int );
199 void ValueChangedInSpinBox( double );
200 void ButtonClicked( bool );
201 void BoxChecked ( bool );
202 void SetDoubleSpinBoxStep( double );
203};
204
205#endif // ENTITYGUI_SKETCHERDLG_H
bool isSame(double d1, double d2)
Definition: EntityGUI_3DSketcherDlg.cxx:197
std::list< GEOM::GEOM_Object_ptr > ObjectList
Definition: GEOMBase_Helper.h:46
Definition: EntityGUI_3DSketcherDlg.h:57
bool myIsUndoRedo
Definition: EntityGUI_3DSketcherDlg.h:181
XYZ getLastPoint() const
Definition: EntityGUI_3DSketcherDlg.cxx:1069
void displayDimensions(bool store=false)
Definition: EntityGUI_3DSketcherDlg.cxx:1420
Handle(AIS_AngleDimension) createAISAngleDimension(double theAngle
void displayText(std::string theText, gp_Pnt P, bool store=false)
Definition: EntityGUI_3DSketcherDlg.cxx:1625
AIS_ListOfInteractive myAngleIORedoList
Definition: EntityGUI_3DSketcherDlg.h:158
XYZList myPointsList
Definition: EntityGUI_3DSketcherDlg.h:155
std::string doubleToString(double)
Definition: EntityGUI_3DSketcherDlg.cxx:1816
void displayAngle(double theAngle, gp_Pnt P0, gp_Pnt P1, gp_Pnt P2, bool store=false)
Definition: EntityGUI_3DSketcherDlg.cxx:1533
void ClickOnOk()
Definition: EntityGUI_3DSketcherDlg.cxx:1031
bool createShapes(GEOM::GEOM_Object_ptr, TopoDS_Shape &, TopoDS_Shape &)
Definition: EntityGUI_3DSketcherDlg.cxx:1739
void ClickOnUndo()
Definition: EntityGUI_3DSketcherDlg.cxx:610
void SelectionIntoArgument()
Definition: EntityGUI_3DSketcherDlg.cxx:744
void ActivateThisDialog()
Definition: EntityGUI_3DSketcherDlg.cxx:817
gp_Pnt P1
Definition: EntityGUI_3DSketcherDlg.h:103
bool ClickOnApply()
Definition: EntityGUI_3DSketcherDlg.cxx:1045
void restoreLastIOToPrs()
Definition: EntityGUI_3DSketcherDlg.cxx:719
void UpdatePointCoordinates()
Definition: EntityGUI_3DSketcherDlg.cxx:572
bool isLengthVisible
Definition: EntityGUI_3DSketcherDlg.h:173
void removeLastIOFromPrs()
Definition: EntityGUI_3DSketcherDlg.cxx:690
virtual bool isValid(QString &)
Definition: EntityGUI_3DSketcherDlg.cxx:955
EntityGUI_3Spin * Group3Spin
Definition: EntityGUI_3DSketcherDlg.h:162
void BoxChecked(bool)
Definition: EntityGUI_3DSketcherDlg.cxx:843
SOCC_Prs * myTextPrs
Definition: EntityGUI_3DSketcherDlg.h:180
gp_Dir getPresentationPlane() const
Definition: EntityGUI_3DSketcherDlg.cxx:1239
double longitude(gp_Pnt) const
int myOrientation
Definition: EntityGUI_3DSketcherDlg.h:171
void ClickOnRedo()
Definition: EntityGUI_3DSketcherDlg.cxx:650
XYZ myWorkPoint
Definition: EntityGUI_3DSketcherDlg.h:182
AIS_ListOfInteractive myTextIORedoList
Definition: EntityGUI_3DSketcherDlg.h:159
void ClickOnAddPoint()
Definition: EntityGUI_3DSketcherDlg.cxx:510
void enterEvent(QEvent *)
Definition: EntityGUI_3DSketcherDlg.cxx:936
EntityGUI_Angles * GroupAngles
Definition: EntityGUI_3DSketcherDlg.h:163
bool myOK
Definition: EntityGUI_3DSketcherDlg.h:172
void ButtonClicked(bool)
Definition: EntityGUI_3DSketcherDlg.cxx:920
QButtonGroup * myTypeGroup1
Definition: EntityGUI_3DSketcherDlg.h:166
int myCoordType
Definition: EntityGUI_3DSketcherDlg.h:170
gp_Trsf toCurrentSystem(gp_Pnt origin) const
Definition: EntityGUI_3DSketcherDlg.cxx:1859
void SetDoubleSpinBoxStep(double)
Definition: EntityGUI_3DSketcherDlg.cxx:1016
XYZ getCurrentPoint() const
Definition: EntityGUI_3DSketcherDlg.cxx:1088
void ValueChangedInSpinBox(double)
Definition: EntityGUI_3DSketcherDlg.cxx:834
AIS_ListOfInteractive myLengthIORedoList
Definition: EntityGUI_3DSketcherDlg.h:157
QList< XYZ > XYZList
Definition: EntityGUI_3DSketcherDlg.h:77
double radius(gp_Pnt) const
Definition: EntityGUI_3DSketcherDlg.cxx:1868
virtual GEOM::GEOM_IOperations_ptr createOperation()
Definition: EntityGUI_3DSketcherDlg.cxx:946
EntityGUI_3DSketcherDlg(GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0, const double=2.)
Definition: EntityGUI_3DSketcherDlg.cxx:209
gp_Pnt P0
Definition: EntityGUI_3DSketcherDlg.h:108
XYZ getPenultimatePoint() const
Definition: EntityGUI_3DSketcherDlg.cxx:1078
~EntityGUI_3DSketcherDlg()
Definition: EntityGUI_3DSketcherDlg.cxx:310
int myMode
Definition: EntityGUI_3DSketcherDlg.h:169
Handle(AIS_LengthDimension) createAISLengthDimension(double theLength
void UpdateButtonsState()
Definition: EntityGUI_3DSketcherDlg.cxx:552
void DeactivateActiveDialog()
Definition: EntityGUI_3DSketcherDlg.cxx:805
virtual bool execute(ObjectList &)
Definition: EntityGUI_3DSketcherDlg.cxx:968
XYZList myRedoList
Definition: EntityGUI_3DSketcherDlg.h:156
double height(gp_Pnt) const
Definition: EntityGUI_3DSketcherDlg.cxx:1882
SOCC_Prs * myLengthPrs
Definition: EntityGUI_3DSketcherDlg.h:179
void Init()
Definition: EntityGUI_3DSketcherDlg.cxx:319
SOCC_Prs * myAnglePrs
Definition: EntityGUI_3DSketcherDlg.h:178
GeometryGUI * myGeometryGUI
Definition: EntityGUI_3DSketcherDlg.h:177
double latitude(gp_Pnt) const
prsType myPrsType
Definition: EntityGUI_3DSketcherDlg.h:160
void displayTrihedron(int)
Definition: EntityGUI_3DSketcherDlg.cxx:1389
EntityGUI_Type * GroupType
Definition: EntityGUI_3DSketcherDlg.h:165
void TypeClicked(int)
Definition: EntityGUI_3DSketcherDlg.cxx:426
void displayLength(gp_Pnt P1, gp_Pnt P2, gp_Dir theNormal, bool store=false)
Definition: EntityGUI_3DSketcherDlg.cxx:1581
gp_Pnt gp_Pnt P2
Definition: EntityGUI_3DSketcherDlg.h:104
QButtonGroup * myTypeGroup2
Definition: EntityGUI_3DSketcherDlg.h:167
gp_Trsf toReferenceSystem(gp_Pnt origin) const
Definition: EntityGUI_3DSketcherDlg.cxx:1829
gp_Pnt gp_Pnt gp_Dir theNormal
Definition: EntityGUI_3DSketcherDlg.h:105
virtual void displayPreview(GEOM::GEOM_Object_ptr, const bool=false, const bool=false, const bool=true, const double=-1, const int=-1, const int=-1)
Definition: EntityGUI_3DSketcherDlg.cxx:1324
EntityGUI_Controls * GroupControls
Definition: EntityGUI_3DSketcherDlg.h:164
bool isAngleVisible
Definition: EntityGUI_3DSketcherDlg.h:174
double myLineWidth
Definition: EntityGUI_3DSketcherDlg.h:176
Definition: EntityGUI_Widgets.h:115
Definition: EntityGUI_Widgets.h:249
Definition: EntityGUI_Widgets.h:265
Definition: EntityGUI_Widgets.h:233
Definition: GEOMBase_Skeleton.h:53
Definition: GeometryGUI.h:74
Definition: EntityGUI_3DSketcherDlg.h:61
double z
Definition: EntityGUI_3DSketcherDlg.h:63
int L
Definition: EntityGUI_3DSketcherDlg.h:64
QString params
Definition: EntityGUI_3DSketcherDlg.h:66
int A
Definition: EntityGUI_3DSketcherDlg.h:64
XYZ()
Definition: EntityGUI_3DSketcherDlg.h:62
double y
Definition: EntityGUI_3DSketcherDlg.h:63
int T
Definition: EntityGUI_3DSketcherDlg.h:64
QString command
Definition: EntityGUI_3DSketcherDlg.h:65
double x
Definition: EntityGUI_3DSketcherDlg.h:63
Definition: EntityGUI_3DSketcherDlg.h:70
prsType()
Definition: EntityGUI_3DSketcherDlg.h:71
int L
Definition: EntityGUI_3DSketcherDlg.h:72
int A
Definition: EntityGUI_3DSketcherDlg.h:73
int T
Definition: EntityGUI_3DSketcherDlg.h:74