Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:12

0001 // Created on: 1995-03-28
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 _BRepTools_Substitution_HeaderFile
0018 #define _BRepTools_Substitution_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <NCollection_List.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 class TopoDS_Shape;
0028 
0029 //! A tool to substitute subshapes by other shapes.
0030 //!
0031 //! The user use the method Substitute to define the
0032 //! modifications.
0033 //! A set of shapes is designated to replace a initial
0034 //! shape.
0035 //!
0036 //! The method Build reconstructs a new Shape with the
0037 //! modifications.The Shape and the new shape are
0038 //! registered.
0039 class BRepTools_Substitution
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   Standard_EXPORT BRepTools_Substitution();
0045 
0046   //! Reset all the fields.
0047   Standard_EXPORT void Clear();
0048 
0049   //! <Oldshape> will be replaced by <NewShapes>.
0050   //!
0051   //! <NewShapes> can be empty, in this case <OldShape>
0052   //! will disparate from its ancestors.
0053   //!
0054   //! if an item of <NewShapes> is oriented FORWARD.
0055   //! it will be oriented as <OldShape> in its ancestors.
0056   //! else it will be reversed.
0057   Standard_EXPORT void Substitute(const TopoDS_Shape&                   OldShape,
0058                                   const NCollection_List<TopoDS_Shape>& NewShapes);
0059 
0060   //! Build NewShape from <S> if its subshapes has modified.
0061   //!
0062   //! The methods <IsCopied> and <Copy> allows you to keep
0063   //! the resul of <Build>
0064   Standard_EXPORT void Build(const TopoDS_Shape& S);
0065 
0066   //! Returns True if <S> has been replaced.
0067   Standard_EXPORT bool IsCopied(const TopoDS_Shape& S) const;
0068 
0069   //! Returns the set of shapes substituted to <S>.
0070   Standard_EXPORT const NCollection_List<TopoDS_Shape>& Copy(const TopoDS_Shape& S) const;
0071 
0072 private:
0073   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher> myMap;
0074 };
0075 
0076 #endif // _BRepTools_Substitution_HeaderFile