Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:16:29

0001 // Created on: 1995-10-26
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1995-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 _BRepAlgo_AsDes_HeaderFile
0018 #define _BRepAlgo_AsDes_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <TopoDS_Shape.hxx>
0023 #include <NCollection_List.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_DataMap.hxx>
0026 #include <Standard_Transient.hxx>
0027 class TopoDS_Shape;
0028 
0029 //! SD to store descendants and ascendants of Shapes.
0030 class BRepAlgo_AsDes : public Standard_Transient
0031 {
0032 
0033 public:
0034   //! Creates an empty AsDes.
0035   Standard_EXPORT BRepAlgo_AsDes();
0036 
0037   Standard_EXPORT void Clear();
0038 
0039   //! Stores <SS> as a futur subshape of <S>.
0040   Standard_EXPORT void Add(const TopoDS_Shape& S, const TopoDS_Shape& SS);
0041 
0042   //! Stores <SS> as futurs SubShapes of <S>.
0043   Standard_EXPORT void Add(const TopoDS_Shape& S, const NCollection_List<TopoDS_Shape>& SS);
0044 
0045   Standard_EXPORT bool HasAscendant(const TopoDS_Shape& S) const;
0046 
0047   Standard_EXPORT bool HasDescendant(const TopoDS_Shape& S) const;
0048 
0049   //! Returns the Shape containing <S>.
0050   Standard_EXPORT const NCollection_List<TopoDS_Shape>& Ascendant(const TopoDS_Shape& S) const;
0051 
0052   //! Returns futur subhapes of <S>.
0053   Standard_EXPORT const NCollection_List<TopoDS_Shape>& Descendant(const TopoDS_Shape& S) const;
0054 
0055   //! Returns futur subhapes of <S>.
0056   Standard_EXPORT NCollection_List<TopoDS_Shape>& ChangeDescendant(const TopoDS_Shape& S);
0057 
0058   //! Replace theOldS by theNewS.
0059   //! theOldS disappear from this.
0060   Standard_EXPORT void Replace(const TopoDS_Shape& theOldS, const TopoDS_Shape& theNewS);
0061 
0062   //! Remove theS from me.
0063   Standard_EXPORT void Remove(const TopoDS_Shape& theS);
0064 
0065   //! Returns True if (S1> and <S2> has common
0066   //! Descendants. Stores in <LC> the Commons Descendants.
0067   Standard_EXPORT bool HasCommonDescendant(const TopoDS_Shape&             S1,
0068                                            const TopoDS_Shape&             S2,
0069                                            NCollection_List<TopoDS_Shape>& LC) const;
0070 
0071   DEFINE_STANDARD_RTTIEXT(BRepAlgo_AsDes, Standard_Transient)
0072 
0073 private:
0074   //! Replace theOldS by theNewS.
0075   //! theOldS disappear from this.
0076   Standard_EXPORT void BackReplace(const TopoDS_Shape&                   theOldS,
0077                                    const TopoDS_Shape&                   theNewS,
0078                                    const NCollection_List<TopoDS_Shape>& theL,
0079                                    const bool                            theInUp);
0080 
0081 private:
0082   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher> up;
0083   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher> down;
0084 };
0085 
0086 #endif // _BRepAlgo_AsDes_HeaderFile