Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:26

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