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