|
|
|||
File indexing completed on 2026-09-28 09:19:35
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_LayerParametric_HeaderFile 0015 #define _BRepGraph_LayerParametric_HeaderFile 0016 0017 #include <BRepGraph_Layer.hxx> 0018 0019 #include <cstdint> 0020 #include <limits> 0021 0022 class BRepGraph_LayerLock; 0023 0024 //! @brief Base layer for graph-owned parametric generators. 0025 //! 0026 //! The class defines the common instance identity, generation flags, mesh 0027 //! quality controls, and graph access helpers shared by higher-level parametric 0028 //! layers. 0029 //! Concrete layers such as BRepGraphPrim box, plane, or loft generators build 0030 //! their own parameter schema and manifest storage on top of this base. 0031 class BRepGraph_LayerParametric : public BRepGraph_Layer 0032 { 0033 public: 0034 //! Controls which graph artifacts should be created or refreshed. 0035 enum class GenerationFlag : uint32_t 0036 { 0037 Topology = 0x01, //!< Create or preserve topological nodes and references. 0038 Geometry = 0x02, //!< Bind analytic reps; absence keeps generated topology mesh-only. 0039 Mesh = 0x04 //!< Create or preserve triangulation representations. 0040 }; 0041 0042 //! High-level mesh quality hint shared by parametric generators. 0043 enum class MeshQuality : uint8_t 0044 { 0045 VeryCoarse, //!< Minimal preview-oriented detail. 0046 Coarse, //!< Low detail for fast authoring feedback. 0047 Medium, //!< Balanced default-quality detail. 0048 Fine, //!< High-quality detail for closer inspection. 0049 VeryFine //!< Maximum detail requested by the caller. 0050 }; 0051 0052 //! Result of adding a new parametric instance to a graph. 0053 struct AddResult 0054 { 0055 uint32_t Instance = THE_INVALID_INSTANCE; //!< Created instance identifier. 0056 BRepGraph_NodeId Root; //!< Root topology node of the created subtree. 0057 }; 0058 0059 //! Reserved sentinel used when an operation does not create an instance. 0060 static constexpr uint32_t THE_INVALID_INSTANCE = std::numeric_limits<uint32_t>::max(); 0061 0062 //! Default generation mode builds topology and analytic geometry only. 0063 static constexpr uint32_t THE_DEFAULT_GENERATION_FLAGS = 0064 static_cast<uint32_t>(GenerationFlag::Topology) 0065 | static_cast<uint32_t>(GenerationFlag::Geometry); 0066 0067 //! Convert one generation flag into its bit-mask value. 0068 //! @param[in] theFlag generation flag to convert 0069 //! @return bit-mask value for the requested generation flag 0070 [[nodiscard]] static constexpr uint32_t GenerationMask(const GenerationFlag theFlag) 0071 { 0072 return static_cast<uint32_t>(theFlag); 0073 } 0074 0075 //! Return true when the flag mask contains the requested generation flag. 0076 //! @param[in] theFlags generation mask built from GenerationFlag bits 0077 //! @param[in] theFlag generation flag to test 0078 //! @return true when the flag is present in the mask 0079 [[nodiscard]] static constexpr bool HasGenerationFlag(const uint32_t theFlags, 0080 const GenerationFlag theFlag) 0081 { 0082 return (theFlags & GenerationMask(theFlag)) != 0; 0083 } 0084 0085 //! Select one integer value from a mesh-quality ladder. 0086 //! @param[in] theQuality requested shared mesh quality 0087 //! @param[in] theVeryCoarse value for MeshQuality::VeryCoarse 0088 //! @param[in] theCoarse value for MeshQuality::Coarse 0089 //! @param[in] theMedium value for MeshQuality::Medium 0090 //! @param[in] theFine value for MeshQuality::Fine 0091 //! @param[in] theVeryFine value for MeshQuality::VeryFine 0092 //! @return selected value for the requested quality 0093 [[nodiscard]] static constexpr uint32_t MeshQualityValue(const MeshQuality theQuality, 0094 const uint32_t theVeryCoarse, 0095 const uint32_t theCoarse, 0096 const uint32_t theMedium, 0097 const uint32_t theFine, 0098 const uint32_t theVeryFine) 0099 { 0100 switch (theQuality) 0101 { 0102 case MeshQuality::VeryCoarse: 0103 return theVeryCoarse; 0104 case MeshQuality::Coarse: 0105 return theCoarse; 0106 case MeshQuality::Medium: 0107 return theMedium; 0108 case MeshQuality::Fine: 0109 return theFine; 0110 case MeshQuality::VeryFine: 0111 return theVeryFine; 0112 } 0113 return theMedium; 0114 } 0115 0116 protected: 0117 //! Return the attached graph and raise if the layer is detached. 0118 //! @return attached graph for mutation operations 0119 [[nodiscard]] Standard_EXPORT BRepGraph* graphForMutation() const; 0120 0121 //! Return the ownership layer used by parametric generators. 0122 //! @param[in] theGraph graph whose ownership layer should be returned 0123 //! @return ownership layer handle 0124 [[nodiscard]] Standard_EXPORT occ::handle<BRepGraph_LayerLock> lockLayer( 0125 BRepGraph& theGraph) const; 0126 0127 DEFINE_STANDARD_RTTIEXT(BRepGraph_LayerParametric, BRepGraph_Layer) 0128 }; 0129 0130 #endif // _BRepGraph_LayerParametric_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|