Back to index

salome-geom  6.5.0
GEOMImpl_IMeasureOperations.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef _GEOMImpl_IMeasureOperations_HXX_
00024 #define _GEOMImpl_IMeasureOperations_HXX_
00025 
00026 #include "GEOM_IOperations.hxx"
00027 
00028 #include <BRepCheck_Analyzer.hxx>
00029 #include <TopoDS_Shape.hxx>
00030 #include <TopTools_HSequenceOfShape.hxx>
00031 #include <TopTools_DataMapOfShapeListOfShape.hxx>
00032 #include <TCollection_AsciiString.hxx>
00033 #include <TColStd_HSequenceOfInteger.hxx>
00034 #include <TColStd_HSequenceOfReal.hxx>
00035 #include <gp_Ax3.hxx>
00036 #include <Geom_Surface.hxx>
00037 #include <Precision.hxx>
00038 
00039 class GEOM_Engine;
00040 class Handle(GEOM_Object);
00041 
00042 class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
00043  public:
00044   Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID);
00045   Standard_EXPORT ~GEOMImpl_IMeasureOperations();
00046 
00047   enum ShapeKind {
00048     SK_NO_SHAPE,
00049     // COMPOSITEs
00050     SK_COMPOUND,
00051     SK_COMPSOLID,
00052     SK_SHELL,
00053     SK_WIRE,
00054     // SOLIDs
00055     SK_SPHERE,       // full sphere
00056     SK_CYLINDER,     // cylinder
00057     SK_BOX,          // box with faces, parallel to global coordinate planes
00058     SK_ROTATED_BOX,  // other box
00059     SK_TORUS,        // full torus
00060     SK_CONE,         // cone
00061     SK_POLYHEDRON,   // solid, bounded by polygons
00062     SK_SOLID,        // other solid
00063     // FACEs
00064     SK_SPHERE2D,     // spherical face (closed)
00065     SK_CYLINDER2D,   // cylindrical face with defined height
00066     SK_TORUS2D,      // toroidal face (closed)
00067     SK_CONE2D,       // conical face with defined height
00068     SK_DISK_CIRCLE,  // planar, bounded by circle
00069     SK_DISK_ELLIPSE, // planar, bounded by ellipse
00070     SK_POLYGON,      // planar, bounded by segments
00071     SK_PLANE,        // infinite planar
00072     SK_PLANAR,       // other planar
00073     SK_FACE,         // other face
00074     // EDGEs
00075     SK_CIRCLE,       // full circle
00076     SK_ARC_CIRCLE,   // arc of circle
00077     SK_ELLIPSE,      // full ellipse
00078     SK_ARC_ELLIPSE,  // arc of ellipse
00079     SK_LINE,         // infinite segment
00080     SK_SEGMENT,      // segment
00081     SK_EDGE,         // other edge
00082     // VERTEX
00083     SK_VERTEX,
00084     // ADVANCED shapes
00085     SK_ADVANCED,     // all advanced shapes (temporary implementation)
00086   };
00087 
00088   Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
00089                                          Handle(TColStd_HSequenceOfInteger)& theIntegers,
00090                                          Handle(TColStd_HSequenceOfReal)&    theDoubles);
00091 
00092   Standard_EXPORT void GetPosition (Handle(GEOM_Object) theShape,
00093                                     Standard_Real& Ox, Standard_Real& Oy, Standard_Real& Oz,
00094                                     Standard_Real& Zx, Standard_Real& Zy, Standard_Real& Zz,
00095                                     Standard_Real& Xx, Standard_Real& Xy, Standard_Real& Xz);
00096 
00097   Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
00098 
00099   Standard_EXPORT Handle(GEOM_Object) GetVertexByIndex (Handle(GEOM_Object) theShape,
00100                                                         Standard_Integer theIndex);
00101 
00102   Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace,
00103                                                  Handle(GEOM_Object) theOptionalPoint);
00104 
00105   Standard_EXPORT void GetBasicProperties (Handle(GEOM_Object) theShape,
00106                                            Standard_Real& theLength,
00107                                            Standard_Real& theSurfArea,
00108                                            Standard_Real& theVolume);
00109 
00110   Standard_EXPORT void GetInertia (Handle(GEOM_Object) theShape,
00111                                    Standard_Real& I11, Standard_Real& I12, Standard_Real& I13,
00112                                    Standard_Real& I21, Standard_Real& I22, Standard_Real& I23,
00113                                    Standard_Real& I31, Standard_Real& I32, Standard_Real& I33,
00114                                    Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz);
00115 
00116   Standard_EXPORT void GetBoundingBox (Handle(GEOM_Object) theShape,
00117                                        Standard_Real& Xmin, Standard_Real& Xmax,
00118                                        Standard_Real& Ymin, Standard_Real& Ymax,
00119                                        Standard_Real& Zmin, Standard_Real& Zmax);
00120 
00121   Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape,
00122                                      Standard_Real& FaceMin, Standard_Real& FaceMax,
00123                                      Standard_Real& EdgeMin, Standard_Real& EdgeMax,
00124                                      Standard_Real& VertMin, Standard_Real& VertMax);
00125 
00126   Standard_EXPORT bool CheckShape (Handle(GEOM_Object)      theShape,
00127                                    const Standard_Boolean   theIsCheckGeom,
00128                                    TCollection_AsciiString& theDump);
00129 
00130   Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
00131                                                Handle(TColStd_HSequenceOfInteger)& theIntersections);
00132 
00133   Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
00134 
00135   Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
00136 
00137   Standard_EXPORT std::vector<bool> AreCoordsInside (Handle(GEOM_Object) theShape,
00138                                                      const std::vector<double>& coords,
00139                                                      double tolerance = Precision::Confusion());
00140 
00141   Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
00142                                                 Handle(GEOM_Object) theShape2,
00143                                                 Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
00144                                                 Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
00145 
00146   Standard_EXPORT void PointCoordinates (Handle(GEOM_Object) theShape,
00147                                          Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
00148 
00149   Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
00150 
00151   Standard_EXPORT Standard_Real GetAngleBtwVectors (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2);
00152 
00153 
00154   // Methods for recieving radiuses of curvature of curves and surfaces
00155   // in the given point
00156   Standard_EXPORT Standard_Real CurveCurvatureByParam (Handle(GEOM_Object) theCurve,
00157                                                        Standard_Real& theParam);
00158   Standard_EXPORT Standard_Real CurveCurvatureByPoint (Handle(GEOM_Object) theCurve,
00159                                                        Handle(GEOM_Object) thePoint);
00160   Standard_EXPORT Standard_Real MaxSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
00161                                                             Standard_Real& theUParam,
00162                                                             Standard_Real& theVParam);
00163   Standard_EXPORT Standard_Real MaxSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
00164                                                             Handle(GEOM_Object) thePoint);
00165   Standard_EXPORT Standard_Real MinSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
00166                                                             Standard_Real& theUParam,
00167                                                             Standard_Real& theVParam);
00168   Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
00169                                                             Handle(GEOM_Object) thePoint);
00170 
00171  public:
00172   Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape);
00173 
00174  private:
00175   void StructuralDump (const BRepCheck_Analyzer& theAna,
00176                        const TopoDS_Shape&       theShape,
00177                        TCollection_AsciiString&  theDump);
00178 
00179   void GetProblemShapes (const BRepCheck_Analyzer&           theAna,
00180                          const TopoDS_Shape&                 theShape,
00181                          Handle(TopTools_HSequenceOfShape)&  sl,
00182                          Handle(TColStd_HArray1OfInteger)&   NbProblems,
00183                          TopTools_DataMapOfShapeListOfShape& theMap);
00184 
00185   void GetProblemSub (const BRepCheck_Analyzer&           theAna,
00186                       const TopoDS_Shape&                 theShape,
00187                       Handle(TopTools_HSequenceOfShape)&  sl,
00188                       Handle(TColStd_HArray1OfInteger)&   NbProblems,
00189                       const TopAbs_ShapeEnum              Subtype,
00190                       TopTools_DataMapOfShapeListOfShape& theMap);
00191 
00192   Standard_Real getSurfaceCurvatures (const Handle(Geom_Surface)& aSurf,
00193                                       Standard_Real theUParam,
00194                                       Standard_Real theVParam,
00195                                       Standard_Boolean theNeedMaxCurv);
00196 };
00197 
00198 #endif