/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// // IfcModelContext.h: interface for the OdIfcModelContext class. // ////////////////////////////////////////////////////////////////////// #ifndef _IFC_MODEL_CONTEXT_H #define _IFC_MODEL_CONTEXT_H #include "IfcBuildOptions.h" #include "IfcEntityTypes.h" #include "daiDeviationParams.h" #include "daiStepModelContext.h" #include "TD_PackPush.h" /** \details A class that implements working with an IFC model context. */ class IFCCORE_EXPORT OdIfcModelContext final : public OdStepModelContext { public: /** \details Creates a new model context object with specified deviation parameters and color. \param params [in] Deviation parameters. \param color [in] Default model color value. */ OdIfcModelContext(OdDeviationParams params = OdDeviationParams(), OdCmEntityColor color = OdCmEntityColor::kNone); /** \details Retrieves an array of types which instances should participate in geometry compose process. \returns an array of IFC entity types for geometry compose. \remarks Types should be derived from IfcProduct. */ OdArray& getGeometryComposeTypes(); /** \details Sets an array of types which instances should participate in geometry compose process to this IFC model context. \param geometryComposeTypes [in] an array of IFC entity types for geometry compose. \remarks Types should be derived from IfcProduct. */ void setGeometryComposeTypes(const OdArray &geometryComposeTypes); /** \details Sets a value that determines if draw IfcOpenings elements needed or not. \param val [in] a new value for draw IfcOpenings elements. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setDrawOpenings(bool val); /** \details Retrieves a value that determines if draw IfcOpenings elements needed or not. \returns true if draw IfcOpenings elements is needed, otherwise returns false. \remarks Turned off by default. */ bool getDrawOpenings(); /** \details Sets a value that determines transparency value for openings that should be draw. \param val [in] a new value for transparency. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setDrawOpeningsTransparency(float val); /** \details Retrieves a value that determines transparency value for openings. \returns Float value that determines currwnt transparency for openings that should be draw. \remarks Set to 0.05 by default. */ float getDrawOpeningsTransparency(); /** \details Retrieves a value that determines if compose of IfcElement instances which out of IFC model Spatial Structure needed or not. \returns true if compose of out of spatial structure IfcElements is needed, otherwise returns false. \remarks Turned on by default. */ bool getComposeOutOfSpatialStructure() const; /** \details Sets a value that determines if compose of IfcElement instances which out of IFC model spatial structure needed or not. \param val [in] a new value for compose IfcElement instance which are out of spatial structure. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setComposeOutOfSpatialStructure(bool val); /** \details Describes a value that determines visual type of IfcCartesianPoint elements representation. */ enum PointRepresentation { kPoint, kTrianglePyramid, kRectPyramid, kSphere, kCube, kCone }; /** \details Sets a value that determines visual type of IfcCartesianPoint elements. \param val [in] a PointRepresentation value for draw IfcRepresentationItem elements. \remarks kPoint by default. Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setPointRepresentation(PointRepresentation val); /** \details Retrieves a value that determines visual type of IfcCartesianPoint elements. \returns PointRepresentation value that is selected for IfcCartesianPoint elements. */ PointRepresentation getPointRepresentation(); /** \details Sets a value that determines if draw IfcRepresentationItem based on IfcCartesianPoint elements needed or not. \param val [in] a new value for draw IfcRepresentationItem elements. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setDrawPoints(bool val); /** \details Retrieves a value that determines if draw IfcRepresentationItem based on IfcCartesianPoint elements needed or not. \returns true if draw IfcCartesianPoint elements is needed, otherwise returns false. \remarks Turned on by default. */ bool getDrawPoints(); /** \details Sets a value that determines transparency value for IfcSpaces that should be draw. \param val [in] a new value for transparency. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setDrawSpacesTransparency(float val); /** \details Retrieves a value that determines transparency value for IfcSpace elements. \returns Float value that determines current transparency for IfcSpace items that should be draw. \remarks Set to 0.85 by default. */ float getDrawSpacesTransparency(); /** \details Sets a value that determines if draw IfcSpace elements visualization needed or not. \param val [in] a new value for draw IfcSpace elements. \remarks Value should be set before OdIfcFile::composeEntities() call to be applied. */ void setDrawSpaces(bool val); /** \details Retrieves a value that determines if draw IfcSpace elements needed or not. \returns true if draw IfcSpace elements is needed, otherwise returns false. \remarks Turned off by default. */ bool getDrawSpaces(); /** \details Target CRS map units of IfcMapConversion application scenario. */ enum TargetCRCScale { kScaleOnly = 0, // Only IfcMapConversion.Scale is applied, if exists; default value. kScaleOrTargetCRSConversionFactor = 1, // IfcMapConversion.TargetCRS.MapUnit factor is applied, if exists, otherwise IfcMapConversion.Scale is applied if exists. }; /** \details Sets a Target CRS map units of IfcMapConversion application scenario. \remarks Experimental feature. */ void setTargetCRSScale(TargetCRCScale targetCRSScale) { m_targetCRSScale = targetCRSScale; }; /** \details Retrieves a Target CRS map units of IfcMapConversion application scenario. \returns type of Target CRS map units application scenario. \remarks kScaleOnly is value by default. Experimental feature. */ TargetCRCScale getTargetCRSScale() const { return m_targetCRSScale; }; /** \details Defines compose multithreading modes. */ enum class ComposeMode { /** The compose should run in one thread. */ SingleThread, /** The compose should run in multithread with using ODA threadpool functionality. */ MultiThreadPool, #if (__cplusplus > 199711L) || (_MSC_VER >= 1700) /** The compose should run in multithread based on std::thread. */ MultiThreadStd, #endif }; /** \details Sets multithread usage of entities compose process. \remarks Experimental feature. */ void setComposeMode(ComposeMode mode) { m_composeMode = mode; }; /** \details Retrieves compose multithread mode. \returns type of multithread compose mode \remarks ComposeMode::SingleThread is value by default. Experimental feature. */ ComposeMode getComposeMode() const { return m_composeMode; }; /** \details Describes a value that determines visual type of IfcReinforcingBar objects representation. */ enum ReinforcingBarsRepresentation { /** Direct visualization of optimized solution with low-poly approach on curved parts without Facet Modeler body creation */ kOptimizedDirect, /** Visualization based on modeler body creation that provides high-poly geometry on curved parts and high memory consumption */ kPreciseBody, /** 3d line based vectorizing based on visualization only Directrix attribute of IfcSweptDiskSolid */ kCurve, }; /** \details Sets the way of reinforcing bars visualization. \param reprType [in] a new value for way of IfcReinforcingBar objects visualization. */ void setReinforcingBarsRepresentationType(ReinforcingBarsRepresentation reprType) { m_reinforcingBarsRepresentation = reprType; }; /** \details Retrieves the way of reinforcing bars visualization. returns kOriginal if IfcReinforceBar visualization should be as defined within IFC file; kCurve for simplified visualization as curve geometrical objects; kOptimizedDirect for high performance and low memory usage with minor visual changes. \remarks ReinforcingBarsRepresentation::kOptimizedDirect is default value. */ ReinforcingBarsRepresentation getReinforcingBarsRepresentationType() const { return m_reinforcingBarsRepresentation; }; //DOM-IGNORE-BEGIN private: OdArray m_composeTypes; bool m_bComposeOutOfSpatialStructure; bool m_drawOpenings; float m_drawOpeningsTransparency; bool m_drawPoints; PointRepresentation m_pointRepresentation; bool m_drawSpaces; float m_drawSpacesTransparency; TargetCRCScale m_targetCRSScale; ComposeMode m_composeMode; ReinforcingBarsRepresentation m_reinforcingBarsRepresentation; //DOM-IGNORE-END }; /** \details A data type that represents a smart pointer to an OdIfcModelContext object. */ typedef OdSharedPtr OdIfcModelContextPtr; #include "TD_PackPop.h" #endif // _IFC_MODEL_CONTEXT_H