Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:22:28

0001 // Created on: 1993-06-16
0002 // Created by: Jean Yves LEBEY
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 _TopOpeBRepBuild_ShapeSet_HeaderFile
0018 #define _TopOpeBRepBuild_ShapeSet_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopAbs_ShapeEnum.hxx>
0024 #include <TopOpeBRepTool_ShapeExplorer.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <NCollection_List.hxx>
0027 #include <TopTools_ShapeMapHasher.hxx>
0028 #include <NCollection_IndexedDataMap.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <TCollection_AsciiString.hxx>
0031 #include <NCollection_IndexedMap.hxx>
0032 #include <Standard_OStream.hxx>
0033 
0034 //! Auxiliary class providing an exploration of a set
0035 //! of shapes to build faces or solids.
0036 //! To build faces  : shapes are wires, elements are edges.
0037 //! To build solids : shapes are shells, elements are faces.
0038 //! The ShapeSet stores a list of shapes, a list of elements
0039 //! to start reconstructions, and a map to search neighbours.
0040 //! The map stores the connection between elements through
0041 //! subshapes of type <SubShapeType> given in constructor.
0042 //! <SubShapeType> is:
0043 //! - TopAbs_VERTEX to connect edges
0044 //! - TopAbs_EDGE to connect faces
0045 //!
0046 //! Signature needed by the BlockBuilder:
0047 //! InitStartElements(me : in out)
0048 //! MoreStartElements(me) returns Boolean;
0049 //! NextStartElement(me : in out);
0050 //! StartElement(me) returns Shape; ---C++: return const &
0051 //! InitNeighbours(me : in out; S : Shape);
0052 //! MoreNeighbours(me) returns Boolean;
0053 //! NextNeighbour(me : in out);
0054 //! Neighbour(me) returns Shape; ---C++: return const &
0055 class TopOpeBRepBuild_ShapeSet
0056 {
0057 public:
0058   DEFINE_STANDARD_ALLOC
0059 
0060   //! Creates a ShapeSet in order to build shapes connected
0061   //! by <SubShapeType> shapes.
0062   //! <checkshape>:check (or not) the shapes, startelements, elements added.
0063   Standard_EXPORT TopOpeBRepBuild_ShapeSet(const TopAbs_ShapeEnum SubShapeType,
0064                                            const bool             checkshape = true);
0065 
0066   Standard_EXPORT virtual ~TopOpeBRepBuild_ShapeSet();
0067 
0068   //! Adds <S> to the list of shapes. (wires or shells).
0069   Standard_EXPORT virtual void AddShape(const TopoDS_Shape& S);
0070 
0071   //! (S is a face or edge)
0072   //! Add S to the list of starting shapes used for reconstructions.
0073   //! apply AddElement(S).
0074   Standard_EXPORT virtual void AddStartElement(const TopoDS_Shape& S);
0075 
0076   //! for each subshape SE of S of type mySubShapeType
0077   //! - Add subshapes of S to the map of subshapes (mySubShapeMap)
0078   //! - Add S to the list of shape incident to subshapes of S.
0079   Standard_EXPORT virtual void AddElement(const TopoDS_Shape& S);
0080 
0081   //! return a reference on myStartShapes
0082   Standard_EXPORT const NCollection_List<TopoDS_Shape>& StartElements() const;
0083 
0084   Standard_EXPORT void InitShapes();
0085 
0086   Standard_EXPORT bool MoreShapes() const;
0087 
0088   Standard_EXPORT void NextShape();
0089 
0090   Standard_EXPORT const TopoDS_Shape& Shape() const;
0091 
0092   Standard_EXPORT void InitStartElements();
0093 
0094   Standard_EXPORT bool MoreStartElements() const;
0095 
0096   Standard_EXPORT void NextStartElement();
0097 
0098   Standard_EXPORT const TopoDS_Shape& StartElement() const;
0099 
0100   Standard_EXPORT virtual void InitNeighbours(const TopoDS_Shape& S);
0101 
0102   Standard_EXPORT bool MoreNeighbours();
0103 
0104   Standard_EXPORT void NextNeighbour();
0105 
0106   Standard_EXPORT const TopoDS_Shape& Neighbour() const;
0107 
0108   Standard_EXPORT NCollection_List<TopoDS_Shape>& ChangeStartShapes();
0109 
0110   //! Build the list of neighbour shapes of myCurrentShape
0111   //! (neighbour shapes and myCurrentShapes are of type t)
0112   //! Initialize myIncidentShapesIter on neighbour shapes.
0113   Standard_EXPORT virtual void FindNeighbours();
0114 
0115   Standard_EXPORT virtual const NCollection_List<TopoDS_Shape>& MakeNeighboursList(
0116     const TopoDS_Shape& E,
0117     const TopoDS_Shape& V);
0118 
0119   Standard_EXPORT int MaxNumberSubShape(const TopoDS_Shape& Shape);
0120 
0121   Standard_EXPORT void CheckShape(const bool checkshape);
0122 
0123   Standard_EXPORT bool CheckShape() const;
0124 
0125   Standard_EXPORT bool CheckShape(const TopoDS_Shape& S, const bool checkgeom = false);
0126 
0127   Standard_EXPORT void DumpName(Standard_OStream& OS, const TCollection_AsciiString& str) const;
0128 
0129   Standard_EXPORT void DumpCheck(Standard_OStream&              OS,
0130                                  const TCollection_AsciiString& str,
0131                                  const TopoDS_Shape&            S,
0132                                  const bool                     chk) const;
0133 
0134   Standard_EXPORT virtual void DumpSS();
0135 
0136   Standard_EXPORT virtual void DumpBB();
0137 
0138   Standard_EXPORT void DEBName(const TCollection_AsciiString& N);
0139 
0140   Standard_EXPORT const TCollection_AsciiString& DEBName() const;
0141 
0142   Standard_EXPORT void DEBNumber(const int I);
0143 
0144   Standard_EXPORT int DEBNumber() const;
0145 
0146   Standard_EXPORT virtual TCollection_AsciiString SName(
0147     const TopoDS_Shape&            S,
0148     const TCollection_AsciiString& sb = "",
0149     const TCollection_AsciiString& sa = "") const;
0150 
0151   Standard_EXPORT virtual TCollection_AsciiString SNameori(
0152     const TopoDS_Shape&            S,
0153     const TCollection_AsciiString& sb = "",
0154     const TCollection_AsciiString& sa = "") const;
0155 
0156   Standard_EXPORT virtual TCollection_AsciiString SName(
0157     const NCollection_List<TopoDS_Shape>& S,
0158     const TCollection_AsciiString&        sb = "",
0159     const TCollection_AsciiString&        sa = "") const;
0160 
0161   Standard_EXPORT virtual TCollection_AsciiString SNameori(
0162     const NCollection_List<TopoDS_Shape>& S,
0163     const TCollection_AsciiString&        sb = "",
0164     const TCollection_AsciiString&        sa = "") const;
0165 
0166 protected:
0167   Standard_EXPORT void ProcessAddShape(const TopoDS_Shape& S);
0168 
0169   Standard_EXPORT void ProcessAddStartElement(const TopoDS_Shape& S);
0170 
0171   Standard_EXPORT void ProcessAddElement(const TopoDS_Shape& S);
0172 
0173   TopAbs_ShapeEnum                         myShapeType;
0174   TopAbs_ShapeEnum                         mySubShapeType;
0175   TopOpeBRepTool_ShapeExplorer             mySubShapeExplorer;
0176   NCollection_List<TopoDS_Shape>           myStartShapes;
0177   NCollection_List<TopoDS_Shape>::Iterator myStartShapesIter;
0178   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0179                                            mySubShapeMap;
0180   NCollection_List<TopoDS_Shape>::Iterator myIncidentShapesIter;
0181   NCollection_List<TopoDS_Shape>           myShapes;
0182   NCollection_List<TopoDS_Shape>::Iterator myShapesIter;
0183   TopoDS_Shape                             myCurrentShape;
0184   NCollection_List<TopoDS_Shape>           myCurrentShapeNeighbours;
0185   int                                      myDEBNumber;
0186   TCollection_AsciiString                  myDEBName;
0187   NCollection_IndexedMap<TopoDS_Shape>     myOMSS;
0188   NCollection_IndexedMap<TopoDS_Shape>     myOMES;
0189   NCollection_IndexedMap<TopoDS_Shape>     myOMSH;
0190   bool                                     myCheckShape;
0191 };
0192 
0193 #endif // _TopOpeBRepBuild_ShapeSet_HeaderFile