Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 08:29:49

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 class TopOpeBRepTool_ShapeClassifier
0035 {
0036 public:
0037   DEFINE_STANDARD_ALLOC
0038 
0039   Standard_EXPORT TopOpeBRepTool_ShapeClassifier();
0040 
0041   //! SRef is the reference shape.
0042   //! StateShapeShape(S) calls will classify S with SRef.
0043   Standard_EXPORT TopOpeBRepTool_ShapeClassifier(const TopoDS_Shape& SRef);
0044 
0045   //! reset all internal data (SolidClassifier included)
0046   Standard_EXPORT void ClearAll();
0047 
0048   //! reset all internal data (except SolidClassified)
0049   Standard_EXPORT void ClearCurrent();
0050 
0051   //! Set SRef as reference shape
0052   //! the next StateShapeReference(S,AvoidS) calls will classify S with SRef.
0053   Standard_EXPORT void SetReference(const TopoDS_Shape& SRef);
0054 
0055   //! classify shape S compared with shape SRef.
0056   //! samedomain = 0 : S1,S2 are not same domain
0057   //! samedomain = 1 : S1,S2 are same domain
0058   Standard_EXPORT TopAbs_State StateShapeShape(const TopoDS_Shape&    S,
0059                                                const TopoDS_Shape&    SRef,
0060                                                const Standard_Integer samedomain = 0);
0061 
0062   Standard_EXPORT Standard_Integer SameDomain() const;
0063 
0064   //! set mode for next StateShapeShape call
0065   //! samedomain = true --> S,Sref are same domain --> point
0066   //! on restriction (ON S) is used to classify S.
0067   //! samedomain = false --> S,Sref are not domain --> point
0068   //! not on restriction of S (IN S) is used to classify S.
0069   //! samedomain value is used only in next StateShapeShape call
0070   Standard_EXPORT void SameDomain(const Standard_Integer samedomain);
0071 
0072   //! classify shape S compared with shape SRef.
0073   //! AvoidS is not used in classification; AvoidS may be IsNull().
0074   //! (useful to avoid ON or UNKNOWN state in special cases)
0075   Standard_EXPORT TopAbs_State StateShapeShape(const TopoDS_Shape& S,
0076                                                const TopoDS_Shape& AvoidS,
0077                                                const TopoDS_Shape& SRef);
0078 
0079   //! classify shape S compared with shape SRef.
0080   //! LAvoidS is list of S subshapes to avoid in classification
0081   //! AvoidS is not used in classification; AvoidS may be IsNull().
0082   //! (useful to avoid ON or UNKNOWN state in special cases)
0083   Standard_EXPORT TopAbs_State StateShapeShape(const TopoDS_Shape&         S,
0084                                                const TopTools_ListOfShape& LAvoidS,
0085                                                const TopoDS_Shape&         SRef);
0086 
0087   //! classify shape S compared with reference shape.
0088   //! AvoidS is not used in classification; AvoidS may be IsNull().
0089   //! (useful to avoid ON or UNKNOWN state in special cases)
0090   Standard_EXPORT TopAbs_State StateShapeReference(const TopoDS_Shape& S,
0091                                                    const TopoDS_Shape& AvoidS);
0092 
0093   //! classify shape S compared with reference shape.
0094   //! LAvoidS is list of S subshapes to avoid in classification
0095   //! (useful to avoid ON or UNKNOWN state in special cases)
0096   Standard_EXPORT TopAbs_State StateShapeReference(const TopoDS_Shape&         S,
0097                                                    const TopTools_ListOfShape& LAvoidS);
0098 
0099   Standard_EXPORT TopOpeBRepTool_SolidClassifier& ChangeSolidClassifier();
0100 
0101   //! classify point P2D with myRef
0102   Standard_EXPORT void StateP2DReference(const gp_Pnt2d& P2D);
0103 
0104   //! classify point P3D with myRef
0105   Standard_EXPORT void StateP3DReference(const gp_Pnt& P3D);
0106 
0107   //! return field myState
0108   Standard_EXPORT TopAbs_State State() const;
0109 
0110   Standard_EXPORT const gp_Pnt2d& P2D() const;
0111 
0112   Standard_EXPORT const gp_Pnt& P3D() const;
0113 
0114 protected:
0115 private:
0116   Standard_EXPORT void MapRef();
0117 
0118   Standard_EXPORT void FindEdge();
0119 
0120   Standard_EXPORT void FindEdge(const TopoDS_Shape& S);
0121 
0122   Standard_EXPORT void FindFace(const TopoDS_Shape& S);
0123 
0124   Standard_EXPORT void Perform();
0125 
0126   //! classify myEdge with myRef
0127   Standard_EXPORT void StateEdgeReference();
0128 
0129   Standard_EXPORT Standard_Boolean HasAvLS() const;
0130 
0131   TopoDS_Shape                   myS;
0132   TopoDS_Shape                   myRef;
0133   TopoDS_Shape                   myAvS;
0134   TopOpeBRepTool_Plos            myPAvLS;
0135   TopTools_IndexedMapOfShape     myMapAvS;
0136   TopTools_IndexedMapOfShape     mymre;
0137   Standard_Integer               mymren;
0138   Standard_Boolean               mymredone;
0139   TopAbs_State                   myState;
0140   TopoDS_Edge                    myEdge;
0141   TopoDS_Face                    myFace;
0142   Standard_Boolean               myP3Ddef;
0143   gp_Pnt                         myP3D;
0144   Standard_Boolean               myP2Ddef;
0145   gp_Pnt2d                       myP2D;
0146   TopOpeBRepTool_SolidClassifier mySolidClassifier;
0147   Standard_Integer               mySameDomain;
0148 };
0149 
0150 #endif // _TopOpeBRepTool_ShapeClassifier_HeaderFile