Salome HOME
0021031: EDF 1646 GEOM: Modify Location leads to Position driver failed
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IMeasureOperations.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef _GEOMImpl_IMeasureOperations_HXX_
24 #define _GEOMImpl_IMeasureOperations_HXX_
25
26 #include "GEOM_IOperations.hxx"
27
28 #include <BRepCheck_Analyzer.hxx>
29 #include <TopoDS_Shape.hxx>
30 #include <TopTools_HSequenceOfShape.hxx>
31 #include <TopTools_DataMapOfShapeListOfShape.hxx>
32 #include <TCollection_AsciiString.hxx>
33 #include <TColStd_HSequenceOfInteger.hxx>
34 #include <TColStd_HSequenceOfReal.hxx>
35 #include <gp_Ax3.hxx>
36 #include <Geom_Surface.hxx>
37
38 class GEOM_Engine;
39 class Handle(GEOM_Object);
40
41 class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
42  public:
43   Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID);
44   Standard_EXPORT ~GEOMImpl_IMeasureOperations();
45
46   enum ShapeKind {
47     SK_NO_SHAPE,
48     // COMPOSITEs
49     SK_COMPOUND,
50     SK_COMPSOLID,
51     SK_SHELL,
52     SK_WIRE,
53     // SOLIDs
54     SK_SPHERE,       // full sphere
55     SK_CYLINDER,     // cylinder
56     SK_BOX,          // box with faces, parallel to global coordinate planes
57     SK_ROTATED_BOX,  // other box
58     SK_TORUS,        // full torus
59     SK_CONE,         // cone
60     SK_POLYHEDRON,   // solid, bounded by polygons
61     SK_SOLID,        // other solid
62     // FACEs
63     SK_SPHERE2D,     // spherical face (closed)
64     SK_CYLINDER2D,   // cylindrical face with defined height
65     SK_TORUS2D,      // toroidal face (closed)
66     SK_CONE2D,       // conical face with defined height
67     SK_DISK_CIRCLE,  // planar, bounded by circle
68     SK_DISK_ELLIPSE, // planar, bounded by ellipse
69     SK_POLYGON,      // planar, bounded by segments
70     SK_PLANE,        // infinite planar
71     SK_PLANAR,       // other planar
72     SK_FACE,         // other face
73     // EDGEs
74     SK_CIRCLE,       // full circle
75     SK_ARC_CIRCLE,   // arc of circle
76     SK_ELLIPSE,      // full ellipse
77     SK_ARC_ELLIPSE,  // arc of ellipse
78     SK_LINE,         // infinite segment
79     SK_SEGMENT,      // segment
80     SK_EDGE,         // other edge
81     // VERTEX
82     SK_VERTEX,
83     // ADVANCED shapes
84     SK_ADVANCED,     // all advanced shapes (temporary implementation)
85   };
86
87   Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
88                                          Handle(TColStd_HSequenceOfInteger)& theIntegers,
89                                          Handle(TColStd_HSequenceOfReal)&    theDoubles);
90
91   Standard_EXPORT void GetPosition (Handle(GEOM_Object) theShape,
92                                     Standard_Real& Ox, Standard_Real& Oy, Standard_Real& Oz,
93                                     Standard_Real& Zx, Standard_Real& Zy, Standard_Real& Zz,
94                                     Standard_Real& Xx, Standard_Real& Xy, Standard_Real& Xz);
95
96   Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
97
98   Standard_EXPORT Handle(GEOM_Object) GetVertexByIndex (Handle(GEOM_Object) theShape,
99                                                         Standard_Integer theIndex);
100
101   Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace,
102                                                  Handle(GEOM_Object) theOptionalPoint);
103
104   Standard_EXPORT void GetBasicProperties (Handle(GEOM_Object) theShape,
105                                            Standard_Real& theLength,
106                                            Standard_Real& theSurfArea,
107                                            Standard_Real& theVolume);
108
109   Standard_EXPORT void GetInertia (Handle(GEOM_Object) theShape,
110                                    Standard_Real& I11, Standard_Real& I12, Standard_Real& I13,
111                                    Standard_Real& I21, Standard_Real& I22, Standard_Real& I23,
112                                    Standard_Real& I31, Standard_Real& I32, Standard_Real& I33,
113                                    Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz);
114
115   Standard_EXPORT void GetBoundingBox (Handle(GEOM_Object) theShape,
116                                        Standard_Real& Xmin, Standard_Real& Xmax,
117                                        Standard_Real& Ymin, Standard_Real& Ymax,
118                                        Standard_Real& Zmin, Standard_Real& Zmax);
119
120   Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape,
121                                      Standard_Real& FaceMin, Standard_Real& FaceMax,
122                                      Standard_Real& EdgeMin, Standard_Real& EdgeMax,
123                                      Standard_Real& VertMin, Standard_Real& VertMax);
124
125   Standard_EXPORT bool CheckShape (Handle(GEOM_Object)      theShape,
126                                    const Standard_Boolean   theIsCheckGeom,
127                                    TCollection_AsciiString& theDump);
128
129   Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
130
131   Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
132                                                 Handle(GEOM_Object) theShape2,
133                                                 Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
134                                                 Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
135
136   Standard_EXPORT void PointCoordinates (Handle(GEOM_Object) theShape,
137                                          Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
138
139   Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
140
141
142   // Methods for recieving radiuses of curvature of curves and surfaces
143   // in the given point
144   Standard_EXPORT Standard_Real CurveCurvatureByParam (Handle(GEOM_Object) theCurve,
145                                                        Standard_Real& theParam);
146   Standard_EXPORT Standard_Real CurveCurvatureByPoint (Handle(GEOM_Object) theCurve,
147                                                        Handle(GEOM_Object) thePoint);
148   Standard_EXPORT Standard_Real MaxSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
149                                                             Standard_Real& theUParam,
150                                                             Standard_Real& theVParam);
151   Standard_EXPORT Standard_Real MaxSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
152                                                             Handle(GEOM_Object) thePoint);
153   Standard_EXPORT Standard_Real MinSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
154                                                             Standard_Real& theUParam,
155                                                             Standard_Real& theVParam);
156   Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
157                                                             Handle(GEOM_Object) thePoint);
158
159  public:
160   Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape);
161
162  private:
163   void StructuralDump (const BRepCheck_Analyzer& theAna,
164                        const TopoDS_Shape&       theShape,
165                        TCollection_AsciiString&  theDump);
166
167   void GetProblemShapes (const BRepCheck_Analyzer&           theAna,
168                          const TopoDS_Shape&                 theShape,
169                          Handle(TopTools_HSequenceOfShape)&  sl,
170                          Handle(TColStd_HArray1OfInteger)&   NbProblems,
171                          TopTools_DataMapOfShapeListOfShape& theMap);
172
173   void GetProblemSub (const BRepCheck_Analyzer&           theAna,
174                       const TopoDS_Shape&                 theShape,
175                       Handle(TopTools_HSequenceOfShape)&  sl,
176                       Handle(TColStd_HArray1OfInteger)&   NbProblems,
177                       const TopAbs_ShapeEnum              Subtype,
178                       TopTools_DataMapOfShapeListOfShape& theMap);
179
180   Standard_Real getSurfaceCurvatures (const Handle(Geom_Surface)& aSurf,
181                                       Standard_Real theUParam,
182                                       Standard_Real theVParam,
183                                       Standard_Boolean theNeedMaxCurv);
184 };
185
186 #endif