1 // Created on: 1994-02-01 2 // Created by: Jean Yves LEBEY 3 // Copyright (c) 1994-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _TopOpeBRepTool_ShapeClassifier_HeaderFile 18 #define _TopOpeBRepTool_ShapeClassifier_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <TopoDS_Shape.hxx> 25 #include <TopOpeBRepTool_Plos.hxx> 26 #include <TopTools_IndexedMapOfShape.hxx> 27 #include <Standard_Integer.hxx> 28 #include <Standard_Boolean.hxx> 29 #include <TopAbs_State.hxx> 30 #include <TopoDS_Edge.hxx> 31 #include <TopoDS_Face.hxx> 32 #include <gp_Pnt.hxx> 33 #include <gp_Pnt2d.hxx> 34 #include <TopOpeBRepTool_SolidClassifier.hxx> 35 #include <TopTools_ListOfShape.hxx> 36 class TopoDS_Shape; 37 class TopOpeBRepTool_SolidClassifier; 38 class gp_Pnt2d; 39 class gp_Pnt; 40 41 42 43 class TopOpeBRepTool_ShapeClassifier 44 { 45 public: 46 47 DEFINE_STANDARD_ALLOC 48 49 50 Standard_EXPORT TopOpeBRepTool_ShapeClassifier(); 51 52 53 //! SRef is the reference shape. 54 //! StateShapeShape(S) calls will classify S with SRef. 55 Standard_EXPORT TopOpeBRepTool_ShapeClassifier(const TopoDS_Shape& SRef); 56 57 //! reset all internal data (SolidClassifier included) 58 Standard_EXPORT void ClearAll(); 59 60 //! reset all internal data (except SolidClassified) 61 Standard_EXPORT void ClearCurrent(); 62 63 64 //! Set SRef as reference shape 65 //! the next StateShapeReference(S,AvoidS) calls will classify S with SRef. 66 Standard_EXPORT void SetReference (const TopoDS_Shape& SRef); 67 68 69 //! classify shape S compared with shape SRef. 70 //! samedomain = 0 : S1,S2 are not same domain 71 //! samedomain = 1 : S1,S2 are same domain 72 Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopoDS_Shape& SRef, const Standard_Integer samedomain = 0); 73 74 Standard_EXPORT Standard_Integer SameDomain() const; 75 76 77 //! set mode for next StateShapeShape call 78 //! samedomain = true --> S,Sref are same domain --> point 79 //! on restriction (ON S) is used to classify S. 80 //! samedomain = false --> S,Sref are not domain --> point 81 //! not on restriction of S (IN S) is used to classify S. 82 //! samedomain value is used only in next StateShapeShape call 83 Standard_EXPORT void SameDomain (const Standard_Integer samedomain); 84 85 86 //! classify shape S compared with shape SRef. 87 //! AvoidS is not used in classification; AvoidS may be IsNull(). 88 //! (useful to avoid ON or UNKNOWN state in special cases) 89 Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopoDS_Shape& AvoidS, const TopoDS_Shape& SRef); 90 91 92 //! classify shape S compared with shape SRef. 93 //! LAvoidS is list of S subshapes to avoid in classification 94 //! AvoidS is not used in classification; AvoidS may be IsNull(). 95 //! (useful to avoid ON or UNKNOWN state in special cases) 96 Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopTools_ListOfShape& LAvoidS, const TopoDS_Shape& SRef); 97 98 99 //! classify shape S compared with reference shape. 100 //! AvoidS is not used in classification; AvoidS may be IsNull(). 101 //! (useful to avoid ON or UNKNOWN state in special cases) 102 Standard_EXPORT TopAbs_State StateShapeReference (const TopoDS_Shape& S, const TopoDS_Shape& AvoidS); 103 104 105 //! classify shape S compared with reference shape. 106 //! LAvoidS is list of S subshapes to avoid in classification 107 //! (useful to avoid ON or UNKNOWN state in special cases) 108 Standard_EXPORT TopAbs_State StateShapeReference (const TopoDS_Shape& S, const TopTools_ListOfShape& LAvoidS); 109 110 Standard_EXPORT TopOpeBRepTool_SolidClassifier& ChangeSolidClassifier(); 111 112 //! classify point P2D with myRef 113 Standard_EXPORT void StateP2DReference (const gp_Pnt2d& P2D); 114 115 //! classify point P3D with myRef 116 Standard_EXPORT void StateP3DReference (const gp_Pnt& P3D); 117 118 //! return field myState 119 Standard_EXPORT TopAbs_State State() const; 120 121 Standard_EXPORT const gp_Pnt2d& P2D() const; 122 123 Standard_EXPORT const gp_Pnt& P3D() const; 124 125 126 127 128 protected: 129 130 131 132 133 134 private: 135 136 137 Standard_EXPORT void MapRef(); 138 139 Standard_EXPORT void FindEdge(); 140 141 Standard_EXPORT void FindEdge (const TopoDS_Shape& S); 142 143 Standard_EXPORT void FindFace (const TopoDS_Shape& S); 144 145 Standard_EXPORT void Perform(); 146 147 //! classify myEdge with myRef 148 Standard_EXPORT void StateEdgeReference(); 149 150 Standard_EXPORT Standard_Boolean HasAvLS() const; 151 152 153 TopoDS_Shape myS; 154 TopoDS_Shape myRef; 155 TopoDS_Shape myAvS; 156 TopOpeBRepTool_Plos myPAvLS; 157 TopTools_IndexedMapOfShape myMapAvS; 158 TopTools_IndexedMapOfShape mymre; 159 Standard_Integer mymren; 160 Standard_Boolean mymredone; 161 TopAbs_State myState; 162 TopoDS_Edge myEdge; 163 TopoDS_Face myFace; 164 Standard_Boolean myP3Ddef; 165 gp_Pnt myP3D; 166 Standard_Boolean myP2Ddef; 167 gp_Pnt2d myP2D; 168 TopOpeBRepTool_SolidClassifier mySolidClassifier; 169 Standard_Integer mySameDomain; 170 171 172 }; 173 174 175 176 177 178 179 180 #endif // _TopOpeBRepTool_ShapeClassifier_HeaderFile 181