Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-02 09:14:18

0001 // Created on: 1990-12-20
0002 // Created by: Remi Lequette
0003 // Copyright (c) 1990-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 _TopExp_HeaderFile
0018 #define _TopExp_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_IndexedMap.hxx>
0026 #include <TopoDS_Shape.hxx>
0027 #include <NCollection_List.hxx>
0028 #include <NCollection_IndexedDataMap.hxx>
0029 #include <NCollection_Map.hxx>
0030 #include <TopoDS_Vertex.hxx>
0031 #include <Standard_Boolean.hxx>
0032 
0033 class TopoDS_Shape;
0034 class TopoDS_Edge;
0035 class TopoDS_Wire;
0036 
0037 //! This package provides basic tools to explore the
0038 //! topological data structures.
0039 //!
0040 //! * Explorer: A tool to find all sub-shapes of a given
0041 //! type. e.g. all faces of a solid.
0042 //!
0043 //! * Package methods to map sub-shapes of a shape.
0044 //!
0045 //! Level : Public
0046 //! All methods of all classes will be public.
0047 class TopExp
0048 {
0049 public:
0050   DEFINE_STANDARD_ALLOC
0051 
0052   //! Tool to explore a topological data structure.
0053   //! Stores in the map <M> all the sub-shapes of <S>
0054   //! of type <T>.
0055   //!
0056   //! Warning: The map is not cleared at first.
0057   Standard_EXPORT static void MapShapes(
0058     const TopoDS_Shape&                                            S,
0059     const TopAbs_ShapeEnum                                         T,
0060     NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& M);
0061 
0062   //! Stores in the map <M> all the sub-shapes of <S>.
0063   //! - If cumOri is true, the function composes all
0064   //! sub-shapes with the orientation of S.
0065   //! - If cumLoc is true, the function multiplies all
0066   //! sub-shapes by the location of S, i.e. it applies to
0067   //! each sub-shape the transformation that is associated with S.
0068   Standard_EXPORT static void MapShapes(
0069     const TopoDS_Shape&                                            S,
0070     NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& M,
0071     const bool                                                     cumOri = true,
0072     const bool                                                     cumLoc = true);
0073 
0074   //! Stores in the map <M> all the sub-shapes of <S>.
0075   //! - If cumOri is true, the function composes all
0076   //! sub-shapes with the orientation of S.
0077   //! - If cumLoc is true, the function multiplies all
0078   //! sub-shapes by the location of S, i.e. it applies to
0079   //! each sub-shape the transformation that is associated with S.
0080   Standard_EXPORT static void MapShapes(const TopoDS_Shape&                                     S,
0081                                         NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& M,
0082                                         const bool cumOri = true,
0083                                         const bool cumLoc = true);
0084 
0085   //! Stores in the map <M> all the subshape of <S> of
0086   //! type <TS> for each one append to the list all
0087   //! the ancestors of type <TA>. For example map all
0088   //! the edges and bind the list of faces.
0089   //! Warning: The map is not cleared at first.
0090   Standard_EXPORT static void MapShapesAndAncestors(
0091     const TopoDS_Shape&                                  S,
0092     const TopAbs_ShapeEnum                               TS,
0093     const TopAbs_ShapeEnum                               TA,
0094     NCollection_IndexedDataMap<TopoDS_Shape,
0095                                NCollection_List<TopoDS_Shape>,
0096                                TopTools_ShapeMapHasher>& M);
0097 
0098   //! Stores in the map <M> all the subshape of <S> of
0099   //! type <TS> for each one append to the list all
0100   //! unique ancestors of type <TA>. For example map all
0101   //! the edges and bind the list of faces.
0102   //! useOrientation = True : taking account the ancestor orientation
0103   //! Warning: The map is not cleared at first.
0104   Standard_EXPORT static void MapShapesAndUniqueAncestors(
0105     const TopoDS_Shape&                                  S,
0106     const TopAbs_ShapeEnum                               TS,
0107     const TopAbs_ShapeEnum                               TA,
0108     NCollection_IndexedDataMap<TopoDS_Shape,
0109                                NCollection_List<TopoDS_Shape>,
0110                                TopTools_ShapeMapHasher>& M,
0111     const bool                                           useOrientation = false);
0112 
0113   //! Returns the Vertex of orientation FORWARD in E. If
0114   //! there is none returns a Null Shape.
0115   //! CumOri = True : taking account the edge orientation
0116   Standard_EXPORT static TopoDS_Vertex FirstVertex(const TopoDS_Edge& E, const bool CumOri = false);
0117 
0118   //! Returns the Vertex of orientation REVERSED in E. If
0119   //! there is none returns a Null Shape.
0120   //! CumOri = True : taking account the edge orientation
0121   Standard_EXPORT static TopoDS_Vertex LastVertex(const TopoDS_Edge& E, const bool CumOri = false);
0122 
0123   //! Returns in Vfirst, Vlast the FORWARD and REVERSED
0124   //! vertices of the edge <E>. May be null shapes.
0125   //! CumOri = True : taking account the edge orientation
0126   Standard_EXPORT static void Vertices(const TopoDS_Edge& E,
0127                                        TopoDS_Vertex&     Vfirst,
0128                                        TopoDS_Vertex&     Vlast,
0129                                        const bool         CumOri = false);
0130 
0131   //! Returns in Vfirst, Vlast the first and last
0132   //! vertices of the open wire <W>. May be null shapes.
0133   //! if <W> is closed Vfirst and Vlast are a same
0134   //! vertex on <W>.
0135   //! if <W> is no manifold. VFirst and VLast are null
0136   //! shapes.
0137   Standard_EXPORT static void Vertices(const TopoDS_Wire& W,
0138                                        TopoDS_Vertex&     Vfirst,
0139                                        TopoDS_Vertex&     Vlast);
0140 
0141   //! Finds the vertex <V> common to the two edges
0142   //! <E1,E2>, returns True if this vertex exists.
0143   //!
0144   //! Warning: <V> has sense only if the value <True> is returned
0145   Standard_EXPORT static bool CommonVertex(const TopoDS_Edge& E1,
0146                                            const TopoDS_Edge& E2,
0147                                            TopoDS_Vertex&     V);
0148 };
0149 
0150 #endif // _TopExp_HeaderFile