Version: 9.16.0
SMESH_ControlsClassifier.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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, or (at your option) any later version.
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 _SMESH_CONTROLSCLASSIFIER_HXX_
24#define _SMESH_CONTROLSCLASSIFIER_HXX_
25
26#include "SMESH_Controls.hxx"
27
28#include <TopoDS_Shape.hxx>
29#include <Bnd_B3d.hxx>
30
31class BRepClass3d_SolidClassifier;
32class GeomAPI_ProjectPointOnSurf;
33class GeomAPI_ProjectPointOnCurve;
34
35namespace SMESH
36{
37 namespace Controls
38 {
40 {
41 Classifier(): mySolidClfr(0), myProjFace(0), myProjEdge(0), myFlags(0) { myU = myV = 1e100; }
43 void Init(const TopoDS_Shape& s, double tol, const Bnd_B3d* box = 0 );
44 bool IsOut(const gp_Pnt& p) { return SetChecked( true ), (this->*myIsOutFun)( p ); }
45 TopAbs_ShapeEnum ShapeType() const { return myShape.ShapeType(); }
46 const TopoDS_Shape& Shape() const { return myShape; }
47 const Bnd_B3d* GetBndBox() const { return & myBox; }
48 double Tolerance() const { return myTol; }
49 bool IsChecked() { return myFlags & theIsCheckedFlag; }
50 bool IsSetFlag( int flag ) const { return myFlags & flag; }
51 void SetChecked( bool is ) { is ? SetFlag( theIsCheckedFlag ) : UnsetFlag( theIsCheckedFlag ); }
52 void SetFlag ( int flag ) { myFlags |= flag; }
53 void UnsetFlag( int flag ) { myFlags &= ~flag; }
54 void GetParams( double & u, double & v ) const { u = myU; v = myV; }
55
56 private:
57 bool isOutOfSolid (const gp_Pnt& p);
58 bool isOutOfBox (const gp_Pnt& p);
59 bool isOutOfFace (const gp_Pnt& p);
60 bool isOutOfEdge (const gp_Pnt& p);
61 bool isOutOfVertex(const gp_Pnt& p);
62 bool isOutOfNone (const gp_Pnt& /*p*/) { return true; }
63 bool isBox (const TopoDS_Shape& s);
64
65 TopoDS_Shape prepareSolid( const TopoDS_Shape& theSolid );
66
67 bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
68 BRepClass3d_SolidClassifier* mySolidClfr;
69 Bnd_B3d myBox;
70 GeomAPI_ProjectPointOnSurf* myProjFace;
71 GeomAPI_ProjectPointOnCurve* myProjEdge;
73 TopoDS_Shape myShape;
74 double myTol;
75 double myU, myV; // result of isOutOfFace() and isOutOfEdge()
77
78 static const int theIsCheckedFlag = 0x0000100;
79 };
80 }
81}
82
83#endif
#define SMESHCONTROLS_EXPORT
Definition: SMESH_Controls.hxx:41
Definition: SMESH_ControlsClassifier.cxx:39
Definition: SMESH_ControlsClassifier.hxx:40
bool IsSetFlag(int flag) const
Definition: SMESH_ControlsClassifier.hxx:50
void SetChecked(bool is)
Definition: SMESH_ControlsClassifier.hxx:51
const TopoDS_Shape & Shape() const
Definition: SMESH_ControlsClassifier.hxx:46
GeomAPI_ProjectPointOnCurve * myProjEdge
Definition: SMESH_ControlsClassifier.hxx:71
void SetFlag(int flag)
Definition: SMESH_ControlsClassifier.hxx:52
bool isOutOfNone(const gp_Pnt &)
Definition: SMESH_ControlsClassifier.hxx:62
void UnsetFlag(int flag)
Definition: SMESH_ControlsClassifier.hxx:53
gp_Pnt myVertexXYZ
Definition: SMESH_ControlsClassifier.hxx:72
BRepClass3d_SolidClassifier * mySolidClfr
Definition: SMESH_ControlsClassifier.hxx:68
Classifier()
Definition: SMESH_ControlsClassifier.hxx:41
double myTol
Definition: SMESH_ControlsClassifier.hxx:74
TopAbs_ShapeEnum ShapeType() const
Definition: SMESH_ControlsClassifier.hxx:45
int myFlags
Definition: SMESH_ControlsClassifier.hxx:76
TopoDS_Shape myShape
Definition: SMESH_ControlsClassifier.hxx:73
bool IsOut(const gp_Pnt &p)
Definition: SMESH_ControlsClassifier.hxx:44
const Bnd_B3d * GetBndBox() const
Definition: SMESH_ControlsClassifier.hxx:47
double Tolerance() const
Definition: SMESH_ControlsClassifier.hxx:48
bool IsChecked()
Definition: SMESH_ControlsClassifier.hxx:49
void GetParams(double &u, double &v) const
Definition: SMESH_ControlsClassifier.hxx:54
GeomAPI_ProjectPointOnSurf * myProjFace
Definition: SMESH_ControlsClassifier.hxx:70
Bnd_B3d myBox
Definition: SMESH_ControlsClassifier.hxx:69
double myU
Definition: SMESH_ControlsClassifier.hxx:75