Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:37

0001 // Copyright (c) 2026 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BRepGraph_SupplementEditor_HeaderFile
0015 #define _BRepGraph_SupplementEditor_HeaderFile
0016 
0017 #include <BRepGraph.hxx>
0018 #include <BRepGraph_LayerTopoSupplement.hxx>
0019 
0020 //! @brief Lightweight mutation facade for runtime supplement attachments.
0021 class BRepGraph_SupplementEditor
0022 {
0023 public:
0024   //! @brief Create an editor facade bound to one graph instance.
0025   //! @param[in] theGraph graph receiving supplement attachments
0026   explicit BRepGraph_SupplementEditor(BRepGraph& theGraph)
0027       : myGraph(theGraph)
0028   {
0029   }
0030 
0031   //! @brief Attach one supplemental shape to an arbitrary supported core owner.
0032   //! @param[in] theOwner active owner node
0033   //! @param[in] theKind semantic attachment kind
0034   //! @param[in] theShape supplemental shape to attach
0035   //! @return non-zero attachment uid on success, `0` on rejection
0036   [[nodiscard]] Standard_EXPORT uint64_t
0037     Attach(BRepGraph_NodeId                              theOwner,
0038            BRepGraph_LayerTopoSupplement::AttachmentKind theKind,
0039            const TopoDS_Shape&                           theShape);
0040 
0041   //! @brief Attach a supplemental shape to a vertex owner.
0042   //! @param[in] theVertex active vertex owner
0043   //! @param[in] theShape supplemental shape to attach
0044   //! @param[in] theKind semantic attachment kind
0045   //! @return non-zero attachment uid on success, `0` on rejection
0046   [[nodiscard]] Standard_EXPORT uint64_t
0047     AttachToVertex(BRepGraph_VertexId                            theVertex,
0048                    const TopoDS_Shape&                           theShape,
0049                    BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0050                      BRepGraph_LayerTopoSupplement::AttachmentKind::VertexSupplementShape);
0051 
0052   //! @brief Attach a supplemental shape to an edge owner.
0053   //! @param[in] theEdge active edge owner
0054   //! @param[in] theShape supplemental shape to attach
0055   //! @param[in] theKind semantic attachment kind
0056   //! @return non-zero attachment uid on success, `0` on rejection
0057   [[nodiscard]] Standard_EXPORT uint64_t
0058     AttachToEdge(BRepGraph_EdgeId                              theEdge,
0059                  const TopoDS_Shape&                           theShape,
0060                  BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0061                    BRepGraph_LayerTopoSupplement::AttachmentKind::EdgeInternalVertex);
0062 
0063   //! @brief Attach a supplemental shape to a face owner.
0064   //! @param[in] theFace active face owner
0065   //! @param[in] theShape supplemental shape to attach
0066   //! @param[in] theKind semantic attachment kind
0067   //! @return non-zero attachment uid on success, `0` on rejection
0068   [[nodiscard]] Standard_EXPORT uint64_t
0069     AttachToFace(BRepGraph_FaceId                              theFace,
0070                  const TopoDS_Shape&                           theShape,
0071                  BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0072                    BRepGraph_LayerTopoSupplement::AttachmentKind::FaceDirectVertex);
0073 
0074   //! @brief Attach a supplemental shape to a solid owner.
0075   //! @param[in] theSolid active solid owner
0076   //! @param[in] theShape supplemental shape to attach
0077   //! @param[in] theKind semantic attachment kind
0078   //! @return non-zero attachment uid on success, `0` on rejection
0079   [[nodiscard]] Standard_EXPORT uint64_t
0080     AttachToSolid(BRepGraph_SolidId                             theSolid,
0081                   const TopoDS_Shape&                           theShape,
0082                   BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0083                     BRepGraph_LayerTopoSupplement::AttachmentKind::SolidAuxShape);
0084 
0085   //! @brief Attach a supplemental shape to a compsolid owner.
0086   //! @param[in] theCompSolid active compsolid owner
0087   //! @param[in] theShape supplemental shape to attach
0088   //! @param[in] theKind semantic attachment kind
0089   //! @return non-zero attachment uid on success, `0` on rejection
0090   [[nodiscard]] Standard_EXPORT uint64_t
0091     AttachToCompSolid(BRepGraph_CompSolidId                         theCompSolid,
0092                       const TopoDS_Shape&                           theShape,
0093                       BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0094                         BRepGraph_LayerTopoSupplement::AttachmentKind::CompSolidAuxShape);
0095 
0096   //! @brief Attach a supplemental shape to a shell owner.
0097   //! @param[in] theShell active shell owner
0098   //! @param[in] theShape supplemental shape to attach
0099   //! @param[in] theKind semantic attachment kind
0100   //! @return non-zero attachment uid on success, `0` on rejection
0101   [[nodiscard]] Standard_EXPORT uint64_t
0102     AttachToShell(BRepGraph_ShellId                             theShell,
0103                   const TopoDS_Shape&                           theShape,
0104                   BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0105                     BRepGraph_LayerTopoSupplement::AttachmentKind::ShellAuxShape);
0106 
0107   //! @brief Attach a supplemental shape to a compound owner.
0108   //! @param[in] theCompound active compound owner
0109   //! @param[in] theShape supplemental shape to attach
0110   //! @param[in] theKind semantic attachment kind
0111   //! @return non-zero attachment uid on success, `0` on rejection
0112   [[nodiscard]] Standard_EXPORT uint64_t
0113     AttachToCompound(BRepGraph_CompoundId                          theCompound,
0114                      const TopoDS_Shape&                           theShape,
0115                      BRepGraph_LayerTopoSupplement::AttachmentKind theKind =
0116                        BRepGraph_LayerTopoSupplement::AttachmentKind::CompoundAuxShape);
0117 
0118   //! @brief Remove one attachment by uid.
0119   //! @param[in] theUid layer-local attachment uid
0120   //! @return `true` when the attachment existed and was removed
0121   Standard_EXPORT bool RemoveAttachment(uint64_t theUid);
0122 
0123 private:
0124   BRepGraph& myGraph;
0125 };
0126 
0127 #endif // _BRepGraph_SupplementEditor_HeaderFile