Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 09:18:08

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