geom/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx

232 lines
11 KiB
C++
Raw Normal View History

2015-02-10 14:25:19 +05:00
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
2005-12-05 21:23:52 +05:00
//
2012-08-09 13:58:02 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2005-12-05 21:23:52 +05:00
//
2012-08-09 13:58:02 +06:00
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
2014-02-18 12:44:41 +06:00
// version 2.1 of the License, or (at your option) any later version.
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2013-04-01 18:25:01 +06:00
//
2012-08-09 13:58:02 +06:00
2004-12-01 15:39:14 +05:00
#ifndef _GEOMImpl_IMeasureOperations_HXX_
#define _GEOMImpl_IMeasureOperations_HXX_
#include "GEOM_IOperations.hxx"
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Status.hxx>
#include <TopoDS_Shape.hxx>
2004-12-01 15:39:14 +05:00
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <TColStd_HSequenceOfReal.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
2009-02-13 17:16:39 +05:00
#include <Geom_Surface.hxx>
2012-08-09 13:58:02 +06:00
#include <Precision.hxx>
2004-12-01 15:39:14 +05:00
class GEOM_Engine;
class Handle(GEOM_Object);
class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
public:
2005-08-11 10:43:57 +06:00
Standard_EXPORT GEOMImpl_IMeasureOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IMeasureOperations();
2004-12-01 15:39:14 +05:00
enum ShapeKind {
SK_NO_SHAPE,
// COMPOSITEs
SK_COMPOUND,
SK_COMPSOLID,
SK_SHELL,
SK_WIRE,
// SOLIDs
SK_SPHERE, // full sphere
SK_CYLINDER, // cylinder
SK_BOX, // box with faces, parallel to global coordinate planes
SK_ROTATED_BOX, // other box
SK_TORUS, // full torus
SK_CONE, // cone
SK_POLYHEDRON, // solid, bounded by polygons
SK_SOLID, // other solid
// FACEs
SK_SPHERE2D, // spherical face (closed)
SK_CYLINDER2D, // cylindrical face with defined height
SK_TORUS2D, // toroidal face (closed)
SK_CONE2D, // conical face with defined height
SK_DISK_CIRCLE, // planar, bounded by circle
SK_DISK_ELLIPSE, // planar, bounded by ellipse
SK_POLYGON, // planar, bounded by segments
SK_PLANE, // infinite planar
SK_PLANAR, // other planar
SK_FACE, // other face
// EDGEs
SK_CIRCLE, // full circle
SK_ARC_CIRCLE, // arc of circle
SK_ELLIPSE, // full ellipse
SK_ARC_ELLIPSE, // arc of ellipse
SK_LINE, // infinite segment
SK_SEGMENT, // segment
SK_EDGE, // other edge
// VERTEX
2012-08-09 13:58:02 +06:00
SK_VERTEX,
// ADVANCED shapes
SK_ADVANCED, // all advanced shapes (temporary implementation)
};
/**
* This enumeration represents the level of checking shape on
* self-interference. It defines which interferferences will be checked.
*/
enum SICheckLevel
{
SI_V_V = 0, // only V/V interferences
SI_V_E, // V/V and V/E interferences
SI_E_E, // V/V, V/E and E/E interferences
SI_V_F, // V/V, V/E, E/E and V/F interferences
SI_E_F, // V/V, V/E, E/E, V/F and E/F interferences
SI_ALL // all interferences
};
Standard_EXPORT ShapeKind KindOfShape (Handle(GEOM_Object) theShape,
Handle(TColStd_HSequenceOfInteger)& theIntegers,
Handle(TColStd_HSequenceOfReal)& theDoubles);
Standard_EXPORT void GetPosition (Handle(GEOM_Object) theShape,
Standard_Real& Ox, Standard_Real& Oy, Standard_Real& Oz,
Standard_Real& Zx, Standard_Real& Zy, Standard_Real& Zz,
Standard_Real& Xx, Standard_Real& Xy, Standard_Real& Xz);
2005-08-11 10:43:57 +06:00
Standard_EXPORT Handle(GEOM_Object) GetCentreOfMass (Handle(GEOM_Object) theShape);
2004-12-01 15:39:14 +05:00
2012-08-09 13:58:02 +06:00
Standard_EXPORT Handle(GEOM_Object) GetVertexByIndex (Handle(GEOM_Object) theShape,
Standard_Integer theIndex);
Standard_EXPORT Handle(GEOM_Object) GetNormal (Handle(GEOM_Object) theFace,
Handle(GEOM_Object) theOptionalPoint);
2005-08-11 10:43:57 +06:00
Standard_EXPORT void GetBasicProperties (Handle(GEOM_Object) theShape,
Standard_Real& theLength,
Standard_Real& theSurfArea,
Standard_Real& theVolume);
2004-12-01 15:39:14 +05:00
2005-08-11 10:43:57 +06:00
Standard_EXPORT void GetInertia (Handle(GEOM_Object) theShape,
Standard_Real& I11, Standard_Real& I12, Standard_Real& I13,
Standard_Real& I21, Standard_Real& I22, Standard_Real& I23,
Standard_Real& I31, Standard_Real& I32, Standard_Real& I33,
Standard_Real& Ix , Standard_Real& Iy , Standard_Real& Iz);
2004-12-01 15:39:14 +05:00
2005-08-11 10:43:57 +06:00
Standard_EXPORT void GetBoundingBox (Handle(GEOM_Object) theShape,
const Standard_Boolean precise,
Standard_Real& Xmin, Standard_Real& Xmax,
Standard_Real& Ymin, Standard_Real& Ymax,
Standard_Real& Zmin, Standard_Real& Zmax);
2004-12-01 15:39:14 +05:00
Standard_EXPORT Handle(GEOM_Object) GetBoundingBox (Handle(GEOM_Object) theShape,
const Standard_Boolean precise);
2013-02-12 17:35:16 +06:00
2005-08-11 10:43:57 +06:00
Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape,
Standard_Real& FaceMin, Standard_Real& FaceMax,
Standard_Real& EdgeMin, Standard_Real& EdgeMax,
Standard_Real& VertMin, Standard_Real& VertMax);
2004-12-01 15:39:14 +05:00
struct ShapeError {
BRepCheck_Status error;
std::list<int> incriminated;
};
Standard_EXPORT bool CheckShape (Handle(GEOM_Object) theShape,
const Standard_Boolean theIsCheckGeom,
std::list<ShapeError> &theErrors);
Standard_EXPORT TCollection_AsciiString PrintShapeErrors
(Handle(GEOM_Object) theShape,
const std::list<ShapeError> &theErrors);
2004-12-01 15:39:14 +05:00
2012-08-09 13:58:02 +06:00
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
const SICheckLevel theCheckLevel,
2012-08-09 13:58:02 +06:00
Handle(TColStd_HSequenceOfInteger)& theIntersections);
Standard_EXPORT bool FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
double tolerance, float deflection,
Handle(TColStd_HSequenceOfInteger)& theIntersections1,
Handle(TColStd_HSequenceOfInteger)& theIntersections2);
2012-08-09 13:58:02 +06:00
Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
2005-08-11 10:43:57 +06:00
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
2004-12-01 15:39:14 +05:00
2012-08-09 13:58:02 +06:00
Standard_EXPORT std::vector<bool> AreCoordsInside (Handle(GEOM_Object) theShape,
const std::vector<double>& coords,
double tolerance = Precision::Confusion());
Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
2013-02-12 17:35:16 +06:00
Standard_EXPORT Standard_Integer ClosestPoints (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
Handle(TColStd_HSequenceOfReal)& theDoubles);
Standard_EXPORT void PointCoordinates (Handle(GEOM_Object) theShape,
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
2012-08-09 13:58:02 +06:00
Standard_EXPORT Standard_Real GetAngleBtwVectors (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2);
2009-02-13 17:16:39 +05:00
// Methods for recieving radiuses of curvature of curves and surfaces
// in the given point
Standard_EXPORT Standard_Real CurveCurvatureByParam (Handle(GEOM_Object) theCurve,
Standard_Real& theParam);
Standard_EXPORT Standard_Real CurveCurvatureByPoint (Handle(GEOM_Object) theCurve,
Handle(GEOM_Object) thePoint);
Standard_EXPORT Standard_Real MaxSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
Standard_Real& theUParam,
Standard_Real& theVParam);
Standard_EXPORT Standard_Real MaxSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
Handle(GEOM_Object) thePoint);
Standard_EXPORT Standard_Real MinSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf,
Standard_Real& theUParam,
Standard_Real& theVParam);
Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
Handle(GEOM_Object) thePoint);
2004-12-01 15:39:14 +05:00
private:
void FillErrorsSub
(const BRepCheck_Analyzer &theAna,
const TopoDS_Shape &theShape,
const TopAbs_ShapeEnum theSubType,
TopTools_DataMapOfIntegerListOfShape &theMapErrors) const;
void FillErrors
(const BRepCheck_Analyzer &theAna,
const TopoDS_Shape &theShape,
TopTools_DataMapOfIntegerListOfShape &theMapErrors,
TopTools_MapOfShape &theMapShapes) const;
void FillErrors (const BRepCheck_Analyzer &theAna,
const TopoDS_Shape &theShape,
std::list<ShapeError> &theErrors) const;
2009-02-13 17:16:39 +05:00
Standard_Real getSurfaceCurvatures (const Handle(Geom_Surface)& aSurf,
Standard_Real theUParam,
Standard_Real theVParam,
Standard_Boolean theNeedMaxCurv);
2004-12-01 15:39:14 +05:00
};
#endif