|
||||
File indexing completed on 2025-01-18 10:05:27
0001 // Created on: 1995-07-13 0002 // Created by: Jean Yves LEBEY 0003 // Copyright (c) 1995-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_ShapeExplorer_HeaderFile 0018 #define _TopOpeBRepTool_ShapeExplorer_HeaderFile 0019 0020 #include <TopExp_Explorer.hxx> 0021 #include <TopAbs.hxx> 0022 0023 //! Extends TopExp_Explorer by counting index of current item 0024 //! (for tracing and debug) 0025 0026 class TopOpeBRepTool_ShapeExplorer : public TopExp_Explorer 0027 { 0028 public: 0029 0030 //! Creates an empty explorer, becomes useful after Init. 0031 TopOpeBRepTool_ShapeExplorer() : myIndex(0) 0032 { 0033 } 0034 0035 //! Creates an Explorer on the Shape <S>. 0036 //! 0037 //! <ToFind> is the type of shapes to search. 0038 //! TopAbs_VERTEX, TopAbs_EDGE, ... 0039 //! 0040 //! <ToAvoid> is the type of shape to skip in the 0041 //! exploration. If <ToAvoid> is equal or less 0042 //! complex than <ToFind> or if <ToAVoid> is SHAPE it 0043 //! has no effect on the exploration. 0044 TopOpeBRepTool_ShapeExplorer(const TopoDS_Shape& S, const TopAbs_ShapeEnum ToFind, const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE) 0045 : TopExp_Explorer (S, ToFind, ToAvoid), myIndex(More() ? 1 : 0) 0046 { 0047 } 0048 0049 void Init (const TopoDS_Shape& S, const TopAbs_ShapeEnum ToFind, const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE) 0050 { 0051 TopExp_Explorer::Init(S,ToFind,ToAvoid); 0052 myIndex = (More() ? 1 : 0); 0053 } 0054 0055 //! Moves to the next Shape in the exploration. 0056 void Next() 0057 { 0058 if (More()) 0059 myIndex++; 0060 TopExp_Explorer::Next(); 0061 } 0062 0063 //! Index of current sub-shape 0064 Standard_Integer Index() const { return myIndex; } 0065 0066 //! Dump info on current shape to stream 0067 Standard_OStream& DumpCurrent (Standard_OStream& OS) const 0068 { 0069 if (More()) 0070 { 0071 TopAbs::Print (Current().ShapeType(), OS); 0072 OS << "(" << Index() << ","; 0073 TopAbs::Print (Current().Orientation(), OS); 0074 OS << ") "; 0075 } 0076 return OS; 0077 } 0078 0079 private: 0080 Standard_Integer myIndex; 0081 }; 0082 0083 #endif // _TopOpeBRepTool_ShapeExplorer_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |