|
|
|||
File indexing completed on 2026-09-09 09:17:16
0001 // Created on: 1993-01-14 0002 // Created by: Remi LEQUETTE 0003 // Copyright (c) 1993-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_Explorer_HeaderFile 0018 #define _TopExp_Explorer_HeaderFile 0019 0020 #include <TopExp_Stack.hxx> 0021 #include <TopoDS_Iterator.hxx> 0022 #include <TopoDS_Shape.hxx> 0023 0024 //! An Explorer is a Tool to visit a Topological Data 0025 //! Structure form the TopoDS package. 0026 //! 0027 //! An Explorer is built with : 0028 //! 0029 //! * The Shape to explore. 0030 //! 0031 //! * The type of Shapes to find : e.g VERTEX, EDGE. 0032 //! This type cannot be SHAPE. 0033 //! 0034 //! * The type of Shapes to avoid. e.g SHELL, EDGE. 0035 //! By default this type is SHAPE which means no 0036 //! restriction on the exploration. 0037 //! 0038 //! The Explorer visits all the structure to find 0039 //! shapes of the requested type which are not 0040 //! contained in the type to avoid. 0041 //! 0042 //! Example to find all the Faces in the Shape S : 0043 //! 0044 //! TopExp_Explorer Ex; 0045 //! for (Ex.Init(S,TopAbs_FACE); Ex.More(); Ex.Next()) { 0046 //! ProcessFace(Ex.Current()); 0047 //! } 0048 //! 0049 //! // an other way 0050 //! TopExp_Explorer Ex(S,TopAbs_FACE); 0051 //! while (Ex.More()) { 0052 //! ProcessFace(Ex.Current()); 0053 //! Ex.Next(); 0054 //! } 0055 //! 0056 //! To find all the vertices which are not in an edge : 0057 //! 0058 //! for (Ex.Init(S,TopAbs_VERTEX,TopAbs_EDGE); ...) 0059 //! 0060 //! To find all the faces in a SHELL, then all the 0061 //! faces not in a SHELL : 0062 //! 0063 //! TopExp_Explorer Ex1, Ex2; 0064 //! 0065 //! for (Ex1.Init(S,TopAbs_SHELL),...) { 0066 //! // visit all shells 0067 //! for (Ex2.Init(Ex1.Current(),TopAbs_FACE),...) { 0068 //! // visit all the faces of the current shell 0069 //! } 0070 //! } 0071 //! 0072 //! for (Ex1.Init(S,TopAbs_FACE,TopAbs_SHELL),...) { 0073 //! // visit all faces not in a shell 0074 //! } 0075 //! 0076 //! If the type to avoid is the same or is less 0077 //! complex than the type to find it has no effect. 0078 //! 0079 //! For example searching edges not in a vertex does 0080 //! not make a difference. 0081 class TopExp_Explorer 0082 { 0083 public: 0084 DEFINE_STANDARD_ALLOC 0085 0086 //! Creates an empty explorer, becomes useful after Init. 0087 Standard_EXPORT TopExp_Explorer(); 0088 0089 //! Creates an Explorer on the Shape <S>. 0090 //! 0091 //! <ToFind> is the type of shapes to search. 0092 //! TopAbs_VERTEX, TopAbs_EDGE, ... 0093 //! 0094 //! <ToAvoid> is the type of shape to skip in the 0095 //! exploration. If <ToAvoid> is equal or less 0096 //! complex than <ToFind> or if <ToAVoid> is SHAPE it 0097 //! has no effect on the exploration. 0098 Standard_EXPORT TopExp_Explorer(const TopoDS_Shape& S, 0099 const TopAbs_ShapeEnum ToFind, 0100 const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE); 0101 0102 //! Resets this explorer on the shape S. It is initialized to 0103 //! search the shape S, for shapes of type ToFind, that 0104 //! are not part of a shape ToAvoid. 0105 //! If the shape ToAvoid is equal to TopAbs_SHAPE, or 0106 //! if it is the same as, or less complex than, the shape 0107 //! ToFind it has no effect on the search. 0108 Standard_EXPORT void Init(const TopoDS_Shape& S, 0109 const TopAbs_ShapeEnum ToFind, 0110 const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE); 0111 0112 //! Returns True if there are more shapes in the exploration. 0113 Standard_Boolean More() const { return hasMore; } 0114 0115 //! Moves to the next Shape in the exploration. 0116 //! Exceptions 0117 //! Standard_NoMoreObject if there are no more shapes to explore. 0118 Standard_EXPORT void Next(); 0119 0120 //! Returns the current shape in the exploration. 0121 //! Exceptions 0122 //! Standard_NoSuchObject if this explorer has no more shapes to explore. 0123 const TopoDS_Shape& Value() const { return Current(); } 0124 0125 //! Returns the current shape in the exploration. 0126 //! Exceptions 0127 //! Standard_NoSuchObject if this explorer has no more shapes to explore. 0128 Standard_EXPORT const TopoDS_Shape& Current() const; 0129 0130 //! Reinitialize the exploration with the original arguments. 0131 Standard_EXPORT void ReInit(); 0132 0133 //! Return explored shape. 0134 const TopoDS_Shape& ExploredShape() const { return myShape; } 0135 0136 //! Returns the current depth of the exploration. 0 is 0137 //! the shape to explore itself. 0138 Standard_Integer Depth() const { return myTop; } 0139 0140 //! Clears the content of the explorer. It will return 0141 //! False on More(). 0142 Standard_EXPORT void Clear(); 0143 0144 //! Destructor. 0145 Standard_EXPORT ~TopExp_Explorer(); 0146 0147 private: 0148 TopExp_Stack myStack; 0149 TopoDS_Shape myShape; 0150 Standard_Integer myTop; 0151 Standard_Integer mySizeOfStack; 0152 TopAbs_ShapeEnum toFind; 0153 TopAbs_ShapeEnum toAvoid; 0154 Standard_Boolean hasMore; 0155 }; 0156 0157 #endif // _TopExp_Explorer_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|