Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 09:15:39

0001 // Created on: 1993-06-23
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 _TopOpeBRepDS_DataStructure_HeaderFile
0018 #define _TopOpeBRepDS_DataStructure_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TopOpeBRepDS_SurfaceData.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <TopOpeBRepDS_CurveData.hxx>
0028 #include <TopOpeBRepDS_PointData.hxx>
0029 #include <TopoDS_Shape.hxx>
0030 #include <TopOpeBRepDS_ShapeData.hxx>
0031 #include <TopTools_ShapeMapHasher.hxx>
0032 #include <NCollection_IndexedDataMap.hxx>
0033 #include <NCollection_IndexedMap.hxx>
0034 #include <TopOpeBRepDS_Interference.hxx>
0035 #include <NCollection_List.hxx>
0036 #include <TopOpeBRepDS_Point.hxx>
0037 #include <TopOpeBRepDS_Surface.hxx>
0038 #include <TopOpeBRepDS_Curve.hxx>
0039 #include <Geom_Surface.hxx>
0040 #include <TopOpeBRepDS_ShapeWithState.hxx>
0041 #include <TopOpeBRepDS_Config.hxx>
0042 class Geom_Surface;
0043 class TopoDS_Edge;
0044 class TopOpeBRepDS_Interference;
0045 class TopOpeBRepDS_ShapeWithState;
0046 
0047 //! The DataStructure stores :
0048 //!
0049 //! New geometries : points, curves, and surfaces.
0050 //! Topological shapes : vertices, edges, faces.
0051 //! The new geometries and the topological shapes have interferences.
0052 class TopOpeBRepDS_DataStructure
0053 {
0054 public:
0055   DEFINE_STANDARD_ALLOC
0056 
0057   Standard_EXPORT TopOpeBRepDS_DataStructure();
0058 
0059   //! reset the data structure
0060   Standard_EXPORT void Init();
0061 
0062   //! Insert a new surface. Returns the index.
0063   Standard_EXPORT int AddSurface(const TopOpeBRepDS_Surface& S);
0064 
0065   Standard_EXPORT void RemoveSurface(const int I);
0066 
0067   Standard_EXPORT bool KeepSurface(const int I) const;
0068 
0069   Standard_EXPORT bool KeepSurface(TopOpeBRepDS_Surface& S) const;
0070 
0071   Standard_EXPORT void ChangeKeepSurface(const int I, const bool FindKeep);
0072 
0073   Standard_EXPORT void ChangeKeepSurface(TopOpeBRepDS_Surface& S, const bool FindKeep);
0074 
0075   //! Insert a new curve. Returns the index.
0076   Standard_EXPORT int AddCurve(const TopOpeBRepDS_Curve& S);
0077 
0078   Standard_EXPORT void RemoveCurve(const int I);
0079 
0080   Standard_EXPORT bool KeepCurve(const int I) const;
0081 
0082   Standard_EXPORT bool KeepCurve(const TopOpeBRepDS_Curve& C) const;
0083 
0084   Standard_EXPORT void ChangeKeepCurve(const int I, const bool FindKeep);
0085 
0086   Standard_EXPORT void ChangeKeepCurve(TopOpeBRepDS_Curve& C, const bool FindKeep);
0087 
0088   //! Insert a new point. Returns the index.
0089   Standard_EXPORT int AddPoint(const TopOpeBRepDS_Point& PDS);
0090 
0091   //! Insert a new point. Returns the index.
0092   Standard_EXPORT int AddPointSS(const TopOpeBRepDS_Point& PDS,
0093                                  const TopoDS_Shape&       S1,
0094                                  const TopoDS_Shape&       S2);
0095 
0096   Standard_EXPORT void RemovePoint(const int I);
0097 
0098   Standard_EXPORT bool KeepPoint(const int I) const;
0099 
0100   Standard_EXPORT bool KeepPoint(const TopOpeBRepDS_Point& P) const;
0101 
0102   Standard_EXPORT void ChangeKeepPoint(const int I, const bool FindKeep);
0103 
0104   Standard_EXPORT void ChangeKeepPoint(TopOpeBRepDS_Point& P, const bool FindKeep);
0105 
0106   //! Insert a shape S. Returns the index.
0107   Standard_EXPORT int AddShape(const TopoDS_Shape& S);
0108 
0109   //! Insert a shape S which ancestor is I = 1 or 2. Returns the index.
0110   Standard_EXPORT int AddShape(const TopoDS_Shape& S, const int I);
0111 
0112   Standard_EXPORT bool KeepShape(const int I, const bool FindKeep = true) const;
0113 
0114   Standard_EXPORT bool KeepShape(const TopoDS_Shape& S, const bool FindKeep = true) const;
0115 
0116   Standard_EXPORT void ChangeKeepShape(const int I, const bool FindKeep);
0117 
0118   Standard_EXPORT void ChangeKeepShape(const TopoDS_Shape& S, const bool FindKeep);
0119 
0120   Standard_EXPORT void InitSectionEdges();
0121 
0122   Standard_EXPORT int AddSectionEdge(const TopoDS_Edge& E);
0123 
0124   Standard_EXPORT const NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0125                         SurfaceInterferences(const int I) const;
0126 
0127   Standard_EXPORT NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0128                   ChangeSurfaceInterferences(const int I);
0129 
0130   Standard_EXPORT const NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0131                         CurveInterferences(const int I) const;
0132 
0133   Standard_EXPORT NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0134                   ChangeCurveInterferences(const int I);
0135 
0136   Standard_EXPORT const NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0137                         PointInterferences(const int I) const;
0138 
0139   Standard_EXPORT NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0140                   ChangePointInterferences(const int I);
0141 
0142   Standard_EXPORT const NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0143                         ShapeInterferences(const TopoDS_Shape& S, const bool FindKeep = true) const;
0144 
0145   Standard_EXPORT NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0146                   ChangeShapeInterferences(const TopoDS_Shape& S);
0147 
0148   Standard_EXPORT const NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0149                         ShapeInterferences(const int I, const bool FindKeep = true) const;
0150 
0151   Standard_EXPORT NCollection_List<occ::handle<TopOpeBRepDS_Interference>>&
0152                   ChangeShapeInterferences(const int I);
0153 
0154   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ShapeSameDomain(
0155     const TopoDS_Shape& S) const;
0156 
0157   Standard_EXPORT NCollection_List<TopoDS_Shape>& ChangeShapeSameDomain(const TopoDS_Shape& S);
0158 
0159   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ShapeSameDomain(const int I) const;
0160 
0161   Standard_EXPORT NCollection_List<TopoDS_Shape>& ChangeShapeSameDomain(const int I);
0162 
0163   Standard_EXPORT NCollection_IndexedDataMap<TopoDS_Shape,
0164                                              TopOpeBRepDS_ShapeData,
0165                                              TopTools_ShapeMapHasher>&
0166                   ChangeShapes();
0167 
0168   Standard_EXPORT void AddShapeSameDomain(const TopoDS_Shape& S, const TopoDS_Shape& SSD);
0169 
0170   Standard_EXPORT void RemoveShapeSameDomain(const TopoDS_Shape& S, const TopoDS_Shape& SSD);
0171 
0172   Standard_EXPORT int SameDomainRef(const int I) const;
0173 
0174   Standard_EXPORT int SameDomainRef(const TopoDS_Shape& S) const;
0175 
0176   Standard_EXPORT void SameDomainRef(const int I, const int Ref);
0177 
0178   Standard_EXPORT void SameDomainRef(const TopoDS_Shape& S, const int Ref);
0179 
0180   Standard_EXPORT TopOpeBRepDS_Config SameDomainOri(const int I) const;
0181 
0182   Standard_EXPORT TopOpeBRepDS_Config SameDomainOri(const TopoDS_Shape& S) const;
0183 
0184   Standard_EXPORT void SameDomainOri(const int I, const TopOpeBRepDS_Config Ori);
0185 
0186   Standard_EXPORT void SameDomainOri(const TopoDS_Shape& S, const TopOpeBRepDS_Config Ori);
0187 
0188   Standard_EXPORT int SameDomainInd(const int I) const;
0189 
0190   Standard_EXPORT int SameDomainInd(const TopoDS_Shape& S) const;
0191 
0192   Standard_EXPORT void SameDomainInd(const int I, const int Ind);
0193 
0194   Standard_EXPORT void SameDomainInd(const TopoDS_Shape& S, const int Ind);
0195 
0196   Standard_EXPORT int AncestorRank(const int I) const;
0197 
0198   Standard_EXPORT int AncestorRank(const TopoDS_Shape& S) const;
0199 
0200   Standard_EXPORT void AncestorRank(const int I, const int Ianc);
0201 
0202   Standard_EXPORT void AncestorRank(const TopoDS_Shape& S, const int Ianc);
0203 
0204   Standard_EXPORT void AddShapeInterference(const TopoDS_Shape&                           S,
0205                                             const occ::handle<TopOpeBRepDS_Interference>& I);
0206 
0207   Standard_EXPORT void RemoveShapeInterference(const TopoDS_Shape&                           S,
0208                                                const occ::handle<TopOpeBRepDS_Interference>& I);
0209 
0210   Standard_EXPORT void FillShapesSameDomain(const TopoDS_Shape& S1,
0211                                             const TopoDS_Shape& S2,
0212                                             const bool          refFirst = true);
0213 
0214   Standard_EXPORT void FillShapesSameDomain(const TopoDS_Shape&       S1,
0215                                             const TopoDS_Shape&       S2,
0216                                             const TopOpeBRepDS_Config c1,
0217                                             const TopOpeBRepDS_Config c2,
0218                                             const bool                refFirst = true);
0219 
0220   Standard_EXPORT void UnfillShapesSameDomain(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0221 
0222   Standard_EXPORT int NbSurfaces() const;
0223 
0224   Standard_EXPORT int NbCurves() const;
0225 
0226   Standard_EXPORT void ChangeNbCurves(const int N);
0227 
0228   Standard_EXPORT int NbPoints() const;
0229 
0230   Standard_EXPORT int NbShapes() const;
0231 
0232   Standard_EXPORT int NbSectionEdges() const;
0233 
0234   //! Returns the surface of index <I>.
0235   Standard_EXPORT const TopOpeBRepDS_Surface& Surface(const int I) const;
0236 
0237   //! Returns the surface of index <I>.
0238   Standard_EXPORT TopOpeBRepDS_Surface& ChangeSurface(const int I);
0239 
0240   //! Returns the Curve of index <I>.
0241   Standard_EXPORT const TopOpeBRepDS_Curve& Curve(const int I) const;
0242 
0243   //! Returns the Curve of index <I>.
0244   Standard_EXPORT TopOpeBRepDS_Curve& ChangeCurve(const int I);
0245 
0246   //! Returns the point of index <I>.
0247   Standard_EXPORT const TopOpeBRepDS_Point& Point(const int I) const;
0248 
0249   //! Returns the point of index <I>.
0250   Standard_EXPORT TopOpeBRepDS_Point& ChangePoint(const int I);
0251 
0252   //! returns the shape of index I stored in
0253   //! the map myShapes, accessing a list of interference.
0254   Standard_EXPORT const TopoDS_Shape& Shape(const int I, const bool FindKeep = true) const;
0255 
0256   //! returns the index of shape <S> stored in
0257   //! the map myShapes, accessing a list of interference.
0258   //! returns 0 if <S> is not in the map.
0259   Standard_EXPORT int Shape(const TopoDS_Shape& S, const bool FindKeep = true) const;
0260 
0261   Standard_EXPORT const TopoDS_Edge& SectionEdge(const int I, const bool FindKeep = true) const;
0262 
0263   Standard_EXPORT int SectionEdge(const TopoDS_Edge& E, const bool FindKeep = true) const;
0264 
0265   Standard_EXPORT bool IsSectionEdge(const TopoDS_Edge& E, const bool FindKeep = true) const;
0266 
0267   //! Returns True if <S> has new geometries, i.e :
0268   //! True si :
0269   //! HasShape(S) True
0270   //! S a une liste d'interferences non vide.
0271   //! S = SOLID, FACE, EDGE : true/false
0272   //! S = SHELL, WIRE, VERTEX : false.
0273   Standard_EXPORT bool HasGeometry(const TopoDS_Shape& S) const;
0274 
0275   //! Returns True if <S> est dans myShapes
0276   Standard_EXPORT bool HasShape(const TopoDS_Shape& S, const bool FindKeep = true) const;
0277 
0278   Standard_EXPORT void SetNewSurface(const TopoDS_Shape& F, const occ::handle<Geom_Surface>& S);
0279 
0280   Standard_EXPORT bool HasNewSurface(const TopoDS_Shape& F) const;
0281 
0282   Standard_EXPORT const occ::handle<Geom_Surface>& NewSurface(const TopoDS_Shape& F) const;
0283 
0284   Standard_EXPORT void Isfafa(const bool isfafa);
0285 
0286   Standard_EXPORT bool Isfafa() const;
0287 
0288   Standard_EXPORT NCollection_IndexedDataMap<TopoDS_Shape,
0289                                              TopOpeBRepDS_ShapeWithState,
0290                                              TopTools_ShapeMapHasher>&
0291                   ChangeMapOfShapeWithStateObj();
0292 
0293   Standard_EXPORT NCollection_IndexedDataMap<TopoDS_Shape,
0294                                              TopOpeBRepDS_ShapeWithState,
0295                                              TopTools_ShapeMapHasher>&
0296                   ChangeMapOfShapeWithStateTool();
0297 
0298   Standard_EXPORT NCollection_IndexedDataMap<TopoDS_Shape,
0299                                              TopOpeBRepDS_ShapeWithState,
0300                                              TopTools_ShapeMapHasher>&
0301                   ChangeMapOfShapeWithState(const TopoDS_Shape& aShape, bool& aFlag);
0302 
0303   Standard_EXPORT const TopOpeBRepDS_ShapeWithState& GetShapeWithState(
0304     const TopoDS_Shape& aShape) const;
0305 
0306   Standard_EXPORT NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>&
0307                   ChangeMapOfRejectedShapesObj();
0308 
0309   Standard_EXPORT NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>&
0310                   ChangeMapOfRejectedShapesTool();
0311 
0312   friend class TopOpeBRepDS_SurfaceExplorer;
0313   friend class TopOpeBRepDS_CurveExplorer;
0314   friend class TopOpeBRepDS_PointExplorer;
0315 
0316 private:
0317   Standard_EXPORT bool FindInterference(
0318     NCollection_List<occ::handle<TopOpeBRepDS_Interference>>::Iterator& IT,
0319     const occ::handle<TopOpeBRepDS_Interference>&                       I) const;
0320 
0321   int                                                myNbSurfaces;
0322   NCollection_DataMap<int, TopOpeBRepDS_SurfaceData> mySurfaces;
0323   int                                                myNbCurves;
0324   NCollection_DataMap<int, TopOpeBRepDS_CurveData>   myCurves;
0325   int                                                myNbPoints;
0326   NCollection_DataMap<int, TopOpeBRepDS_PointData>   myPoints;
0327   NCollection_IndexedDataMap<TopoDS_Shape, TopOpeBRepDS_ShapeData, TopTools_ShapeMapHasher>
0328                                                                 myShapes;
0329   NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> mySectionEdges;
0330   NCollection_List<occ::handle<TopOpeBRepDS_Interference>>      myEmptyListOfInterference;
0331   NCollection_List<TopoDS_Shape>                                myEmptyListOfShape;
0332   TopoDS_Shape                                                  myEmptyShape;
0333   TopOpeBRepDS_Point                                            myEmptyPoint;
0334   TopOpeBRepDS_Surface                                          myEmptySurface;
0335   TopOpeBRepDS_Curve                                            myEmptyCurve;
0336   occ::handle<Geom_Surface>                                     myEmptyGSurface;
0337   NCollection_DataMap<TopoDS_Shape, occ::handle<Geom_Surface>, TopTools_ShapeMapHasher>
0338        myNewSurface;
0339   bool myIsfafa;
0340   int  myI;
0341   NCollection_IndexedDataMap<TopoDS_Shape, TopOpeBRepDS_ShapeWithState, TopTools_ShapeMapHasher>
0342     myMapOfShapeWithStateObj;
0343   NCollection_IndexedDataMap<TopoDS_Shape, TopOpeBRepDS_ShapeWithState, TopTools_ShapeMapHasher>
0344                                                                 myMapOfShapeWithStateTool;
0345   NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapOfRejectedShapesObj;
0346   NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMapOfRejectedShapesTool;
0347 };
0348 
0349 #endif // _TopOpeBRepDS_DataStructure_HeaderFile