/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// #ifndef __COMMON_DEVICE_PROPERTIES__ #define __COMMON_DEVICE_PROPERTIES__ #include "TD_PackPush.h" #include "RxDispatchImpl.h" #include "RxVariantValue.h" #include "ExColorConverterCallback.h" class OdGiContext; // platform-independent properties that common for all devices /** \details This class contains the platform-independent methods and properties common for all Vectorizer devices. Library: Source code provided. \remarks For more information about device properties, see . */ class OdCommonDeviceProps : public OdRxDispatchImpl<> { public: /** \details Default constructor for the OdCommonDeviceProps class. */ OdCommonDeviceProps(); /** \details Destructor for the OdCommonDeviceProps class. */ ~OdCommonDeviceProps() override; ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(OdCommonDeviceProps); /** \details Controls the DoubleBuffer flag for this Vectorizer device. \param doubleBuffer [in] State of the flag. */ void setDoubleBufferEnabled(bool doubleBuffer) { m_bDoubleBufferEnabled = doubleBuffer; } /** \details Returns the DoubleBuffer flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. */ bool doubleBufferEnabled() const { return m_bDoubleBufferEnabled; } /** \details Returns the DrawSelection flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. \remarks This flag informs the vectorizer that selection drawing is in progress. Vectorizer can modify geometry behavior in this case. */ bool isDrawSelection() const { return m_bDrawSelection; } /** \details Controls the DrawSelection flag for this Vectorizer device. \param drawSelection [in] State of the flag. \remarks This flag informs the vectorizer that selection drawing is in progress. Vectorizer can modify geometry behavior in this case. */ void setDrawSelection(bool drawSelection) { m_bDrawSelection = drawSelection; } /** \details Returns the DrawDragging flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. \remarks This flag informs the vectorizer that dragging is in progress. Vectorizer can modify geometry behavior and optimize rendering in this case. */ bool isDrawDragging() const { return m_bDrawDragging; } /** \details Controls the DrawDragging flag for this Vectorizer device. \param drawDragging [in] State of the flag. \remarks This flag informs the vectorizer that dragging is in progress. Vectorizer can modify geometry behavior and optimize rendering in this case. */ void setDrawDragging(bool drawDragging) { m_bDrawDragging = drawDragging; } /** \details Controls the BlocksCache flag for this Vectorizer device. \param blocksCache [in] State of the flag. \remarks The property enables caching of a hierarchical blocks structure. If a drawing contains many block inserts with similar settings, it is possible to vectorize entities inside this block once and use a single metafile for each entity during rendering. In this case vectorization is faster and memory usage is lower, but it can cause some rendering performance slowdown since additional transformations are applied. This feature is also useful to enable the ability to highlight entities inside blocks. This property takes effect only if geometry cache is turned on. */ virtual void setBlocksCacheEnabled(bool blocksCache) { m_bBlocksCacheEnabled = blocksCache; } /** \details Returns the BlocksCache flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. \remarks The property enables caching of a hierarchical blocks structure. If a drawing contains many block inserts with similar settings, it is possible to vectorize entities inside this block once and use a single metafile for each entity during rendering. In this case vectorization is faster and memory usage is lower, but it can cause some rendering performance slowdown since additional transformations are applied. This feature is also useful to enable the ability to highlight entities inside blocks. This property takes effect only if geometry cache is turned on. */ virtual bool blocksCacheEnabled() const { return m_bBlocksCacheEnabled; } /** \details Controls the DynamicSubEntHlt flag for this Vectorizer device. \param dynamicSubEntHlt [in] State of the flag. \remarks The subentity highlighting mode enables the ability to cache geometry markers for entity geometry parts. These parts of the entity geometry can be highlighted independently from all other entity geometry. If it is turned on, a subentity marker is stored inside a metafile and the renderer is able to check whether the marked part of the geometry must be highlighted. This property takes effect only if geometry cache is turned on. */ virtual void setDynamicSubEntHltEnabled(bool dynamicSubEntHlt) { m_bDynamicSubEntHltEnabled = dynamicSubEntHlt; } /** \details Returns the DynamicSubEntHlt flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. \remarks The subentity highlighting mode provides the ability to cache geometry markers for entity geometry parts. These parts of the entity geometry can be highlighted independently from all other entity geometry. If it is turned on, a subentity marker is stored inside a metafile and the renderer is able to check whether the marked part of the geometry must be highlighted. This property takes effect only if geometry cache is turned on. */ virtual bool dynamicSubEntHltEnabled() const { return m_bDynamicSubEntHltEnabled; } /** \details Controls the EnableMultithread flag for this Vectorizer device. \param bMultithread [in] State of the flag. */ virtual void setGsMultithreadEnabled(bool bMultithread) { SETBIT(m_nGsMultithreadProps, 1, bMultithread); } /** \details Returns the EnableMultithread flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. */ virtual bool gsMultithreadEnabled() const { return GETBIT(m_nGsMultithreadProps, 1); } /** \details Controls the ForcePartialUpdate flag for this Vectorizer device. \param bForcePartial [in] State of the flag. \remarks Off-screen vectorization devices disable partial update mode. This property can be used to turn the partial update mode on in this case. Forcing partial update is useful for tests and if multithread vectorization is necessary for off-screen rendering. */ virtual void setForcePartialUpdateForMt(bool bForcePartial) { SETBIT(m_nGsMultithreadProps, 2, bForcePartial); } /** \details Returns the ForcePartialUpdate flag for this Vectorizer device. \returns true if this flag is enabled, false otherwise. \remarks Off-screen vectorization devices disable partial update mode. This property can be used to turn the partial update mode on in this case. Forcing partial update is useful for tests and if multithread vectorization is necessary for off-screen rendering. */ virtual bool forcePartialUpdateForMt() const { return GETBIT(m_nGsMultithreadProps, 2); } /** \details Controls the MaxRegenThreads flag for this Vectorizer device. \param nMaxThreads [in] Controls maximum limit of threads for multithread regeneration. */ virtual void setMaxMtRegenThreads(OdUInt16 nMaxThreads) { m_nMaxMtRegenThreads = nMaxThreads; } /** \details Returns the MaxRegenThreads flag for this Vectorizer device. \returns Number of threads for multithread vectorization. */ virtual OdUInt16 maxMtRegenThreads() const { return m_nMaxMtRegenThreads; } /** \details Checks whether MtRegen is enabled. \param pGiContext [in] Gi context of current vectorization. \returns true if multithread regen is enabled, false otherwise. */ virtual bool checkMtRegenEnabled(OdGiContext *pGiContext) const; /** \details Returns count of threads for MtRegen. \param pGiContext [in] Gi context of current vectorization. \returns Count of thread in multithread regen mode. */ virtual OdUInt16 getMtRegenThreadsCount(OdGiContext *pGiContext) const; /** \details Sets the color converter callback for this Vectorizer device. \param pCC [in] Pointer to the color converter callback. */ virtual void setColorConverter(const OdColorConverterCallback *pCC) { m_pColorConverter = pCC; } /** \details Returns the color converter callback for this Vectorizer device. \returns Pointer to the color converter callback. */ virtual OdColorConverterCallback *getColorConverter() const { return m_pColorConverter.get(); } /** \details Sets deviation factor multiplier for this Vectorizer device. \param dMult [in] Deviation factor multiplier. */ void setDeviationMultiplier(double dMult) { m_dDeviationMultiplier = dMult; } /** \details Returns deviation factor multiplier for this Vectorizer device. \returns Deviation multiplier value. */ double deviationMultiplier() const { return m_dDeviationMultiplier; } protected: bool m_bDoubleBufferEnabled; bool m_bDrawSelection; bool m_bDrawDragging; bool m_bBlocksCacheEnabled; bool m_bDynamicSubEntHltEnabled; OdUInt8 m_nGsMultithreadProps; OdUInt16 m_nMaxMtRegenThreads; mutable OdColorConverterCallbackPtr m_pColorConverter; double m_dDeviationMultiplier; }; #define OD_COMMONDEVPROP_BlocksCacheEnabled_DevRedirect() \ void setBlocksCacheEnabled(bool blocksCache) { OdCommonDeviceProps::setBlocksCacheEnabled(blocksCache); \ SETBIT(m_flags, kSupportBlocks, blocksCache); } \ bool blocksCacheEnabled() const { return GETBIT(m_flags, kSupportBlocks); } #define OD_COMMONDEVPROP_DynamicSubEntHltEnabled_DevRedirect() \ void setDynamicSubEntHltEnabled(bool dynamicSubEntHlt) { OdCommonDeviceProps::setDynamicSubEntHltEnabled(dynamicSubEntHlt); \ SETBIT(m_flags, kDynamicSubhighlight, dynamicSubEntHlt); } \ bool dynamicSubEntHltEnabled() const { return GETBIT(m_flags, kDynamicSubhighlight); } #include "TD_PackPop.h" #endif // __COMMON_DEVICE_PROPERTIES__