Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:15:51

0001 // Created on: 2002-11-13
0002 // Created by: Galina KULIKOVA
0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _ShapeUpgrade_RemoveLocations_HeaderFile
0017 #define _ShapeUpgrade_RemoveLocations_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TopAbs_ShapeEnum.hxx>
0023 #include <TopoDS_Shape.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_DataMap.hxx>
0026 #include <Standard_Transient.hxx>
0027 
0028 //! Removes all locations sub-shapes of specified shape
0029 class ShapeUpgrade_RemoveLocations : public Standard_Transient
0030 {
0031 
0032 public:
0033   //! Empty constructor
0034   Standard_EXPORT ShapeUpgrade_RemoveLocations();
0035 
0036   //! Removes all location correspondingly to RemoveLevel.
0037   Standard_EXPORT bool Remove(const TopoDS_Shape& theShape);
0038 
0039   //! Returns shape with removed locations.
0040   TopoDS_Shape GetResult() const;
0041 
0042   //! sets level starting with that location will be removed,
0043   //! by default TopAbs_SHAPE. In this case locations will be kept for specified shape
0044   //! and if specified shape is TopAbs_COMPOUND for sub-shapes of first level.
0045   void SetRemoveLevel(const TopAbs_ShapeEnum theLevel);
0046 
0047   //! sets level starting with that location will be removed.Value of level can be set to
0048   //! TopAbs_SHAPE,TopAbs_COMPOUND,TopAbs_SOLID,TopAbs_SHELL,TopAbs_FACE.By default TopAbs_SHAPE.
0049   //! In this case location will be removed for all shape types for exception of compound.
0050   TopAbs_ShapeEnum RemoveLevel() const;
0051 
0052   //! Returns modified shape obtained from initial shape.
0053   TopoDS_Shape ModifiedShape(const TopoDS_Shape& theInitShape) const;
0054 
0055   //! Returns map of modified shapes.
0056   const NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>&
0057     GetModifiedShapesMap() const
0058   {
0059     return myMapNewShapes;
0060   }
0061 
0062   DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_RemoveLocations, Standard_Transient)
0063 
0064 private:
0065   Standard_EXPORT bool MakeNewShape(const TopoDS_Shape& theShape,
0066                                     const TopoDS_Shape& theAncShape,
0067                                     TopoDS_Shape&       theNewShape,
0068                                     const bool          theRemoveLoc);
0069 
0070   TopAbs_ShapeEnum                                                         myLevelRemoving;
0071   TopoDS_Shape                                                             myShape;
0072   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myMapNewShapes;
0073 };
0074 
0075 #include <ShapeUpgrade_RemoveLocations.lxx>
0076 
0077 #endif // _ShapeUpgrade_RemoveLocations_HeaderFile