| 1 | // Created on: 1993-06-16 |
| 2 | // Created by: Jean Yves LEBEY |
| 3 | // Copyright (c) 1993-1999 Matra Datavision |
| 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 5 | // |
| 6 | // This file is part of Open CASCADE Technology software library. |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or modify it under |
| 9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 10 | // by the Free Software Foundation, with special exception defined in the file |
| 11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 12 | // distribution for complete text of the license and disclaimer of any warranty. |
| 13 | // |
| 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | // commercial license or contractual agreement. |
| 16 | |
| 17 | #ifndef _TopOpeBRepBuild_ShapeSet_HeaderFile |
| 18 | #define _TopOpeBRepBuild_ShapeSet_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_DefineAlloc.hxx> |
| 22 | #include <Standard_Handle.hxx> |
| 23 | |
| 24 | #include <TopAbs_ShapeEnum.hxx> |
| 25 | #include <TopOpeBRepTool_ShapeExplorer.hxx> |
| 26 | #include <TopTools_ListOfShape.hxx> |
| 27 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
| 28 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
| 29 | #include <TopoDS_Shape.hxx> |
| 30 | #include <Standard_Integer.hxx> |
| 31 | #include <TCollection_AsciiString.hxx> |
| 32 | #include <TopTools_IndexedMapOfOrientedShape.hxx> |
| 33 | #include <Standard_Boolean.hxx> |
| 34 | #include <Standard_OStream.hxx> |
| 35 | class TopoDS_Shape; |
| 36 | class TCollection_AsciiString; |
| 37 | |
| 38 | |
| 39 | |
| 40 | //! Auxiliary class providing an exploration of a set |
| 41 | //! of shapes to build faces or solids. |
| 42 | //! To build faces : shapes are wires, elements are edges. |
| 43 | //! To build solids : shapes are shells, elements are faces. |
| 44 | //! The ShapeSet stores a list of shapes, a list of elements |
| 45 | //! to start reconstructions, and a map to search neighbours. |
| 46 | //! The map stores the connection between elements through |
| 47 | //! subshapes of type <SubShapeType> given in constructor. |
| 48 | //! <SubShapeType> is : |
| 49 | //! - TopAbs_VERTEX to connect edges |
| 50 | //! - TopAbs_EDGE to connect faces |
| 51 | //! |
| 52 | //! Signature needed by the BlockBuilder : |
| 53 | //! InitStartElements(me : in out) |
| 54 | //! MoreStartElements(me) returns Boolean; |
| 55 | //! NextStartElement(me : in out); |
| 56 | //! StartElement(me) returns Shape; ---C++: return const & |
| 57 | //! InitNeighbours(me : in out; S : Shape); |
| 58 | //! MoreNeighbours(me) returns Boolean; |
| 59 | //! NextNeighbour(me : in out); |
| 60 | //! Neighbour(me) returns Shape; ---C++: return const & |
| 61 | class TopOpeBRepBuild_ShapeSet |
| 62 | { |
| 63 | public: |
| 64 | |
| 65 | DEFINE_STANDARD_ALLOC |
| 66 | |
| 67 | |
| 68 | //! Creates a ShapeSet in order to build shapes connected |
| 69 | //! by <SubShapeType> shapes. |
| 70 | //! <checkshape>:check (or not) the shapes, startelements, elements added. |
| 71 | Standard_EXPORT TopOpeBRepBuild_ShapeSet(const TopAbs_ShapeEnum SubShapeType, const Standard_Boolean checkshape = Standard_True); |
| 72 | |
| 73 | Standard_EXPORT virtual ~TopOpeBRepBuild_ShapeSet(); |
| 74 | |
| 75 | //! Adds <S> to the list of shapes. (wires or shells). |
| 76 | Standard_EXPORT virtual void AddShape (const TopoDS_Shape& S); |
| 77 | |
| 78 | //! (S is a face or edge) |
| 79 | //! Add S to the list of starting shapes used for reconstructions. |
| 80 | //! apply AddElement(S). |
| 81 | Standard_EXPORT virtual void AddStartElement (const TopoDS_Shape& S); |
| 82 | |
| 83 | //! for each subshape SE of S of type mySubShapeType |
| 84 | //! - Add subshapes of S to the map of subshapes (mySubShapeMap) |
| 85 | //! - Add S to the list of shape incident to subshapes of S. |
| 86 | Standard_EXPORT virtual void AddElement (const TopoDS_Shape& S); |
| 87 | |
| 88 | //! return a reference on myStartShapes |
| 89 | Standard_EXPORT const TopTools_ListOfShape& StartElements() const; |
| 90 | |
| 91 | Standard_EXPORT void InitShapes(); |
| 92 | |
| 93 | Standard_EXPORT Standard_Boolean MoreShapes() const; |
| 94 | |
| 95 | Standard_EXPORT void NextShape(); |
| 96 | |
| 97 | Standard_EXPORT const TopoDS_Shape& Shape() const; |
| 98 | |
| 99 | Standard_EXPORT void InitStartElements(); |
| 100 | |
| 101 | Standard_EXPORT Standard_Boolean MoreStartElements() const; |
| 102 | |
| 103 | Standard_EXPORT void NextStartElement(); |
| 104 | |
| 105 | Standard_EXPORT const TopoDS_Shape& StartElement() const; |
| 106 | |
| 107 | Standard_EXPORT virtual void InitNeighbours (const TopoDS_Shape& S); |
| 108 | |
| 109 | Standard_EXPORT Standard_Boolean MoreNeighbours(); |
| 110 | |
| 111 | Standard_EXPORT void NextNeighbour(); |
| 112 | |
| 113 | Standard_EXPORT const TopoDS_Shape& Neighbour() const; |
| 114 | |
| 115 | Standard_EXPORT TopTools_ListOfShape& ChangeStartShapes(); |
| 116 | |
| 117 | //! Build the list of neighbour shapes of myCurrentShape |
| 118 | //! (neighbour shapes and myCurrentShapes are of type t) |
| 119 | //! Initialize myIncidentShapesIter on neighbour shapes. |
| 120 | Standard_EXPORT virtual void FindNeighbours(); |
| 121 | |
| 122 | Standard_EXPORT virtual const TopTools_ListOfShape& MakeNeighboursList (const TopoDS_Shape& E, const TopoDS_Shape& V); |
| 123 | |
| 124 | Standard_EXPORT Standard_Integer MaxNumberSubShape (const TopoDS_Shape& Shape); |
| 125 | |
| 126 | Standard_EXPORT void CheckShape (const Standard_Boolean checkshape); |
| 127 | |
| 128 | Standard_EXPORT Standard_Boolean CheckShape() const; |
| 129 | |
| 130 | Standard_EXPORT Standard_Boolean CheckShape (const TopoDS_Shape& S, const Standard_Boolean checkgeom = Standard_False); |
| 131 | |
| 132 | Standard_EXPORT void DumpName (Standard_OStream& OS, const TCollection_AsciiString& str) const; |
| 133 | |
| 134 | Standard_EXPORT void DumpCheck (Standard_OStream& OS, const TCollection_AsciiString& str, const TopoDS_Shape& S, const Standard_Boolean chk) const; |
| 135 | |
| 136 | Standard_EXPORT virtual void DumpSS(); |
| 137 | |
| 138 | Standard_EXPORT virtual void DumpBB(); |
| 139 | |
| 140 | Standard_EXPORT void DEBName (const TCollection_AsciiString& N); |
| 141 | |
| 142 | Standard_EXPORT const TCollection_AsciiString& DEBName() const; |
| 143 | |
| 144 | Standard_EXPORT void DEBNumber (const Standard_Integer I); |
| 145 | |
| 146 | Standard_EXPORT Standard_Integer DEBNumber() const; |
| 147 | |
| 148 | Standard_EXPORT virtual TCollection_AsciiString SName (const TopoDS_Shape& S, const TCollection_AsciiString& sb = "", const TCollection_AsciiString& sa = "") const; |
| 149 | |
| 150 | Standard_EXPORT virtual TCollection_AsciiString SNameori (const TopoDS_Shape& S, const TCollection_AsciiString& sb = "", const TCollection_AsciiString& sa = "") const; |
| 151 | |
| 152 | Standard_EXPORT virtual TCollection_AsciiString SName (const TopTools_ListOfShape& S, const TCollection_AsciiString& sb = "", const TCollection_AsciiString& sa = "") const; |
| 153 | |
| 154 | Standard_EXPORT virtual TCollection_AsciiString SNameori (const TopTools_ListOfShape& S, const TCollection_AsciiString& sb = "", const TCollection_AsciiString& sa = "") const; |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | protected: |
| 160 | |
| 161 | |
| 162 | Standard_EXPORT void ProcessAddShape (const TopoDS_Shape& S); |
| 163 | |
| 164 | Standard_EXPORT void ProcessAddStartElement (const TopoDS_Shape& S); |
| 165 | |
| 166 | Standard_EXPORT void ProcessAddElement (const TopoDS_Shape& S); |
| 167 | |
| 168 | |
| 169 | TopAbs_ShapeEnum myShapeType; |
| 170 | TopAbs_ShapeEnum mySubShapeType; |
| 171 | TopOpeBRepTool_ShapeExplorer mySubShapeExplorer; |
| 172 | TopTools_ListOfShape myStartShapes; |
| 173 | TopTools_ListIteratorOfListOfShape myStartShapesIter; |
| 174 | TopTools_IndexedDataMapOfShapeListOfShape mySubShapeMap; |
| 175 | TopTools_ListIteratorOfListOfShape myIncidentShapesIter; |
| 176 | TopTools_ListOfShape myShapes; |
| 177 | TopTools_ListIteratorOfListOfShape myShapesIter; |
| 178 | TopoDS_Shape myCurrentShape; |
| 179 | TopTools_ListOfShape myCurrentShapeNeighbours; |
| 180 | Standard_Integer myDEBNumber; |
| 181 | TCollection_AsciiString myDEBName; |
| 182 | TopTools_IndexedMapOfOrientedShape myOMSS; |
| 183 | TopTools_IndexedMapOfOrientedShape myOMES; |
| 184 | TopTools_IndexedMapOfOrientedShape myOMSH; |
| 185 | Standard_Boolean myCheckShape; |
| 186 | |
| 187 | |
| 188 | private: |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | }; |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | #endif // _TopOpeBRepBuild_ShapeSet_HeaderFile |