/////////////////////////////////////////////////////////////////////////////// // 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 _ODPRCEXPORTCONTEXT_INCLUDED_ #define _ODPRCEXPORTCONTEXT_INCLUDED_ #include "PrcExportDef.h" #include "RxDynamicModule.h" #include "DbBaseDatabase.h" #include "PrcFile.h" #define STL_USING_MAP #include "OdaSTL.h" #include "CmColorBase.h" #include "PdfExportParams.h" /** \details The class implements storing color parameters for a drawing node. */ class OD_TOOLKIT_EXPORT DrawingColorNode { public: /** Current color used in materials when the kInherit flag is used.*/ OdCmEntityColor drawingColor; /** Current transparency setting.*/ OdCmTransparency transparency; /** \details Creates a new instance of a drawing color node with default parameters. */ DrawingColorNode(); /** \details The less-than operator for a drawing color node. \param colNode [in] Another drawing color node to compare with. \returns The true value if the drawing color node is less than the specified color node to compare with; otherwise, the method returns false. */ bool operator<(const DrawingColorNode& colNode) const; }; /** \details The class implements storing information about materials within a drawing node object. */ class OD_TOOLKIT_EXPORT DrawingMaterialNode : public DrawingColorNode { public: /** Current material represented with an OdDbStub object.*/ mutable OdDbStub * pMaterial; /** \details Creates a new instance of a drawing material node with default parameters. */ DrawingMaterialNode(); /** \details The less-than operator for a drawing material node. \param matNode [in] Another drawing material node to compare with. \returns The true value if the drawing material node is less than the specified drawing material node to compare with; otherwise, the method returns false. */ bool operator<(const DrawingMaterialNode& matNode) const; }; //DOM-IGNORE-BEGIN struct PrcExportVisualStyleParams; //DOM-IGNORE-END /** \details A class that stores and handles the information about PRC export context. */ class OD_TOOLKIT_EXPORT OdPrcExportContext : public OdRxObject { protected: std::map m_colormap; OdPrcFilePtr m_pFile; std::map m_materialmap; OdDbBaseDatabase* m_pDb; PrcExportVisualStyleParams* m_pExportVisualStyleParams; /** \details Creates an instance of export context. \remarks A PRC file is created and filled with common topology in a context constructor. */ OdPrcExportContext(); public: ODRX_DECLARE_MEMBERS(OdPrcExportContext); /** \details Destroys the instance of an export context. */ virtual ~OdPrcExportContext(); /** \details Retrieves the color cache map of the PRC export context object. \returns A reference to a color cache map that consists of a set of pairs " - object identifier". \remarks The method returns the color map via a reference; therefore, any modification of the returned color cache affects the PRC export context object. */ std::map & colorCache(void) { return m_colormap; } /** \details Retrieves the color cache map of the PRC export context object. \returns A constant reference to a color cache map that consists of a set of pairs: " - object identifier". \remarks Call this method when you want to restrict modifications of the color cache outside the PRC export context object. */ const std::map & colorCache(void) const { return m_colormap; } /** \details Assigns a database object with the context object. \param _pDb [in] A raw pointer to a database object to be set. */ void setDatabase(OdDbBaseDatabase *_pDb) { m_pDb = _pDb; } /** \details Retrieves the exported PRC file object assigned with the context object. \returns A reference to a smart pointer to an object that refers to a PRC file that contains the exported entity or mesh. \remarks The method returns the file object via a reference; therefore, the returned file object can be edited. */ OdPrcFilePtr& getFile (void) { return m_pFile; } /** \details Retrieves the exported PRC file object assigned with the context object. \returns A constant reference to a smart pointer to an object that refers to a PRC file that contains the exported entity or mesh. */ const OdPrcFilePtr& getFile (void) const { return m_pFile; } /** \details Retrieves the cache of materials assigned with the PRC context object. \returns A reference to a map that consists of a set of pairs: " - object" identifier. \remarks The method returns the map that represents the material cache via a reference; therefore, any modification of the returned map object affects the PRC export context object. */ std::map & materialCache (void) { return m_materialmap; } /** \details Retrieves the cache of materials assigned with the PRC context object. \returns A constant reference to a material cache map that consists of a set of pairs: " - object" identifier. \remarks Call this method when you want to restrict modifications of the material cache outside the PRC export context object. */ const std::map & materialCache (void) const { return m_materialmap; } /** \details Retrieves the database associated with the context object. \returns A raw pointer to the database. */ OdDbBaseDatabase* getDatabase(void) { return m_pDb; } /** \details Retrieves the identifier of a linestyle object for a specified . \param colorNode [in] A object. \param newStructure [out] A to write the linestyle to. \param createIfNotFound [in] A flag that determines whether a new linestyle should be created if it is not found in the specified (equals true) or not (equals false). \returns An identifier of the found or created linestyle object. */ OdPrcObjectId getLineStyleID(const DrawingColorNode & colorNode, OdPrcFileStructure &newStructure, bool createIfNotFound = true); /** \details Retrieves the identifier of a linestyle object for a specified . \param matNode [in] A DrawingMaterialNode, material node> object. \param fileStructure [out] A to write the linestyle to. \param createIfNotFound [in] A flag that determines whether a new linestyle should be created if it is not found in the specified (equals true) or not (equals false). \returns An identifier of the found or created linestyle object. */ OdPrcObjectId getLineStyleID(const DrawingMaterialNode & matNode, OdPrcFileStructure &fileStructure, bool createIfNotFound = true); /** \details Sets the type of behavior for exporting ambient color components to PRC for textures. \param value [in] A new value of the behavior type for exporting ambient color components. \sa PrcExportColorComponentBehavior documentation. */ void setAmbientColorBehavior(PDF3D_ENUMS::PrcExportColorComponentBehavior value); /** \details Retrieves the current type of behavior for exporting ambient color components. \returns The current value of the behavior type for exporting ambient color components. \sa PrcExportColorComponentBehavior documentation. */ PDF3D_ENUMS::PrcExportColorComponentBehavior getAmbientColorBehavior(); }; /** \details A data type that represents a smart pointer to a object. */ SMARTPTR(OdPrcExportContext); #endif //_ODPRCEXPORTCONTEXT_INCLUDED_