Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:27

0001 // Created on: 1994-02-01
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopOpeBRepTool_ShapeClassifier_HeaderFile
0018 #define _TopOpeBRepTool_ShapeClassifier_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <TopOpeBRepTool_Plos.hxx>
0025 #include <TopTools_IndexedMapOfShape.hxx>
0026 #include <TopAbs_State.hxx>
0027 #include <TopoDS_Edge.hxx>
0028 #include <TopoDS_Face.hxx>
0029 #include <gp_Pnt.hxx>
0030 #include <gp_Pnt2d.hxx>
0031 #include <TopOpeBRepTool_SolidClassifier.hxx>
0032 #include <TopTools_ListOfShape.hxx>
0033 
0034 
0035 
0036 class TopOpeBRepTool_ShapeClassifier 
0037 {
0038 public:
0039 
0040   DEFINE_STANDARD_ALLOC
0041 
0042   
0043   Standard_EXPORT TopOpeBRepTool_ShapeClassifier();
0044   
0045 
0046   //! SRef is the reference shape.
0047   //! StateShapeShape(S) calls will classify S with SRef.
0048   Standard_EXPORT TopOpeBRepTool_ShapeClassifier(const TopoDS_Shape& SRef);
0049   
0050   //! reset all internal data (SolidClassifier included)
0051   Standard_EXPORT void ClearAll();
0052   
0053   //! reset all internal data (except SolidClassified)
0054   Standard_EXPORT void ClearCurrent();
0055   
0056 
0057   //! Set SRef as reference shape
0058   //! the next StateShapeReference(S,AvoidS) calls will classify S with SRef.
0059   Standard_EXPORT void SetReference (const TopoDS_Shape& SRef);
0060   
0061 
0062   //! classify shape S compared with shape SRef.
0063   //! samedomain = 0 : S1,S2 are not same domain
0064   //! samedomain = 1 : S1,S2 are same domain
0065   Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopoDS_Shape& SRef, const Standard_Integer samedomain = 0);
0066   
0067   Standard_EXPORT Standard_Integer SameDomain() const;
0068   
0069 
0070   //! set mode for next StateShapeShape call
0071   //! samedomain = true --> S,Sref are same domain --> point
0072   //! on restriction (ON S) is used to classify S.
0073   //! samedomain = false --> S,Sref are not domain --> point
0074   //! not on restriction of S (IN S) is used to classify S.
0075   //! samedomain value is used only in next StateShapeShape call
0076   Standard_EXPORT void SameDomain (const Standard_Integer samedomain);
0077   
0078 
0079   //! classify shape S compared with shape SRef.
0080   //! AvoidS is not used in classification; AvoidS may be IsNull().
0081   //! (useful to avoid ON or UNKNOWN state in special cases)
0082   Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopoDS_Shape& AvoidS, const TopoDS_Shape& SRef);
0083   
0084 
0085   //! classify shape S compared with shape SRef.
0086   //! LAvoidS is list of S subshapes to avoid in classification
0087   //! AvoidS is not used in classification; AvoidS may be IsNull().
0088   //! (useful to avoid ON or UNKNOWN state in special cases)
0089   Standard_EXPORT TopAbs_State StateShapeShape (const TopoDS_Shape& S, const TopTools_ListOfShape& LAvoidS, const TopoDS_Shape& SRef);
0090   
0091 
0092   //! classify shape S compared with reference shape.
0093   //! AvoidS is not used in classification; AvoidS may be IsNull().
0094   //! (useful to avoid ON or UNKNOWN state in special cases)
0095   Standard_EXPORT TopAbs_State StateShapeReference (const TopoDS_Shape& S, const TopoDS_Shape& AvoidS);
0096   
0097 
0098   //! classify shape S compared with reference shape.
0099   //! LAvoidS is list of S subshapes to avoid in classification
0100   //! (useful to avoid ON or UNKNOWN state in special cases)
0101   Standard_EXPORT TopAbs_State StateShapeReference (const TopoDS_Shape& S, const TopTools_ListOfShape& LAvoidS);
0102   
0103   Standard_EXPORT TopOpeBRepTool_SolidClassifier& ChangeSolidClassifier();
0104   
0105   //! classify point P2D with myRef
0106   Standard_EXPORT void StateP2DReference (const gp_Pnt2d& P2D);
0107   
0108   //! classify point P3D with myRef
0109   Standard_EXPORT void StateP3DReference (const gp_Pnt& P3D);
0110   
0111   //! return field myState
0112   Standard_EXPORT TopAbs_State State() const;
0113   
0114   Standard_EXPORT const gp_Pnt2d& P2D() const;
0115   
0116   Standard_EXPORT const gp_Pnt& P3D() const;
0117 
0118 
0119 
0120 
0121 protected:
0122 
0123 
0124 
0125 
0126 
0127 private:
0128 
0129   
0130   Standard_EXPORT void MapRef();
0131   
0132   Standard_EXPORT void FindEdge();
0133   
0134   Standard_EXPORT void FindEdge (const TopoDS_Shape& S);
0135   
0136   Standard_EXPORT void FindFace (const TopoDS_Shape& S);
0137   
0138   Standard_EXPORT void Perform();
0139   
0140   //! classify myEdge with myRef
0141   Standard_EXPORT void StateEdgeReference();
0142   
0143   Standard_EXPORT Standard_Boolean HasAvLS() const;
0144 
0145 
0146   TopoDS_Shape myS;
0147   TopoDS_Shape myRef;
0148   TopoDS_Shape myAvS;
0149   TopOpeBRepTool_Plos myPAvLS;
0150   TopTools_IndexedMapOfShape myMapAvS;
0151   TopTools_IndexedMapOfShape mymre;
0152   Standard_Integer mymren;
0153   Standard_Boolean mymredone;
0154   TopAbs_State myState;
0155   TopoDS_Edge myEdge;
0156   TopoDS_Face myFace;
0157   Standard_Boolean myP3Ddef;
0158   gp_Pnt myP3D;
0159   Standard_Boolean myP2Ddef;
0160   gp_Pnt2d myP2D;
0161   TopOpeBRepTool_SolidClassifier mySolidClassifier;
0162   Standard_Integer mySameDomain;
0163 
0164 
0165 };
0166 
0167 
0168 
0169 
0170 
0171 
0172 
0173 #endif // _TopOpeBRepTool_ShapeClassifier_HeaderFile