/////////////////////////////////////////////////////////////////////////////// // 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 _BCF_2_1_SESSION_H #define _BCF_2_1_SESSION_H #include "BcfCommon.h" #include "OdGUID.h" #include "OdArray.h" #define STL_USING_MAP #define STL_USING_UTILITY #include "OdaSTL.h" class OdDbHostAppProgressMeter; /** \details Contains declarations related to working with data of the BCF format version 2.1. */ namespace OdBcf_2_1 { class OdBcfProjectExtensionData; class OdBcfProjectExtension; /** \details A data type that represents a smart pointer to the OdBcfProjectExtension object. */ typedef OdSmartPtr OdBcfProjectExtensionPtr; class OdBcfProjectData; class OdBcfProject; /** \details A data type that represents a smart pointer to the OdBcfProject object. */ typedef OdSmartPtr OdBcfProjectPtr; class OdBcfVersion; /** \details A data type that represents a smart pointer to the OdBcfVersion object. */ typedef OdSmartPtr OdBcfVersionPtr; class OdBcfTopicData; class OdBcfTopic; /** \details A data type that represents a smart pointer to the OdBcfTopic object. */ typedef OdSmartPtr OdBcfTopicPtr; class OdBcfMarkup; /** \details A data type that represents a smart pointer to the OdBcfMarkup object. */ typedef OdSmartPtr OdBcfMarkupPtr; class OdBcfViewPoint; /** \details A data type that represents a smart pointer to the OdBcfViewPoint object. */ typedef OdSmartPtr OdBcfViewPointPtr; /** \details A data type that represents an array of smart pointers to OdBcfViewPoint objects. */ typedef OdArray OdBcfViewPointArray; class OdBcfComponent; /** \details A data type that represents a smart pointer to the OdBcfComponent object. */ typedef OdSmartPtr OdBcfComponentPtr; /** \details A data type that represents an array of smart pointers to OdBcfComponent objects. */ typedef OdArray OdBcfComponentArray; class OdBcfViewSetupHints; /** \details A data type that represents a smart pointer to the OdBcfViewSetupHints object. */ typedef OdSmartPtr OdBcfViewSetupHintsPtr; class OdBcfComponentSelection; /** \details A data type that represents a smart pointer to the OdBcfComponentSelection object. */ typedef OdSmartPtr OdBcfComponentSelectionPtr; class OdBcfComponentVisibility; /** \details A data type that represents a smart pointer to the OdBcfComponentVisibility object. */ typedef OdSmartPtr OdBcfComponentVisibilityPtr; class OdBcfColor; /** \details A data type that represents a smart pointer to the OdBcfColor object. */ typedef OdSmartPtr OdBcfColorPtr; class OdBcfComponentColoring; /** \details A data type that represents a smart pointer to the OdBcfComponentColoring object. */ typedef OdSmartPtr OdBcfComponentColoringPtr; class OdBcfComponents; /** \details A data type that represents a smart pointer to the OdBcfComponents object. */ typedef OdSmartPtr OdBcfComponentsPtr; class OdBcfBitmapData; class OdBcfBitmap; /** \details A data type that represents a smart pointer to the OdBcfBitmap object. */ typedef OdSmartPtr OdBcfBitmapPtr; class OdBcfVisualizationInfoData; class OdBcfVisualizationInfo; /** \details A data type that represents a smart pointer to the OdBcfVisualizationInfo object. */ typedef OdSmartPtr OdBcfVisualizationInfoPtr; /** \details A data type that represents an array of smart pointers to OdBcfVisualizationInfo objects. */ typedef OdArray OdBcfVisualizationInfoArray; class OdBcfTopicFolder; /** \details A data type that represents a smart pointer to the OdBcfTopicFolder object. */ typedef OdSmartPtr OdBcfTopicFolderPtr; /** \details A data type that represents an array of smart pointers to OdBcfTopicFolder objects. */ typedef OdArray OdBcfTopicFolderArray; class OdBcfArchive; /** \details A data type that represents a smart pointer to the OdBcfArchive object. */ typedef OdSmartPtr OdBcfArchivePtr; /** \details A data type that represents a map of objects used for mapping project identifiers to the smart pointers to BFC archives. */ typedef std::map OdBcfArchiveMap; class OdBcfDataAccessor; /** \details A data type that represents a smart pointer to the OdBcfDataAccessor object. */ typedef OdSmartPtr OdBcfDataAccessorPtr; /** \details A class that provides functionality for managing a session for work with BCF data. */ class BCF_2_1_EXPORT OdBcfSession : public OdRxObject { public: //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdBcfSession); //DOM-IGNORE-END /** \details Creates a new session object. \param author [in] A string that contains the session author. \param authoringToolId [in] A string that contains the identifier of the authoring application used by the author. \param pDataAccessor [in] A smart pointer to a data accessor object. \param ignoreModified [in] A flag that determines whether the modified fields are managed by user (true) or by session instance (false). \returns A smart pointer to the created OdBcfSession instance. */ static OdSmartPtr createObject( const OdString &author, const OdString &authoringToolId, const OdBcfDataAccessorPtr &pDataAccessor = OdBcfDataAccessorPtr(), bool ignoreModified = false); //const OdBcfArchiveMap& loadProjects(OdResult *result = NULL); /** \details Sets a new session author. \param author [in] A string that contains the session author. */ void setAuthor(const OdString& author); /** \details Sets a progress meter. \param pMeter [in] A pointer to progress meter. \returns eOk if the progress meter was successfully set; otherwise, the method returns an appropriate error code. */ OdResult setProgressMeter(OdDbHostAppProgressMeter* pMeter); /** \details Sets the ingnoreModifed flag. \param ignoreModified [in] A flag that determines whether the modified fields are managed by user (true) or by session instance (false). */ void setIgnoreModified(bool ignoreModified); /** \details Saves the archive using a specified data accessor object. \param projectId [in] A string that contains the project Id. \param fileName [in] A string that contains the file name to use for the saving. \param pDataAccessor [in] A smart pointer to the data accessor object that should be used for the saving. \param result [out] A raw pointer to a value that contains the result of the operation. */ void saveProject( const OdString &projectId, const OdString &fileName = OdString(), OdBcfDataAccessorPtr pDataAccessor = OdBcfDataAccessorPtr(), OdResult *result = NULL); /** \details Loads an archive using a specified data accessor. \param fileName [in] A string that contains the full file name to load. \param pDataAccessor [in] A smart pointer to the data accessor to use for loading. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A string that contains the identifier of the loaded project. */ OdString loadProject( const OdString &fileName, OdBcfDataAccessorPtr pDataAccessor = OdBcfDataAccessorPtr(), OdResult *result = NULL); /** \details Adds an existing archive object to the session collection. \param pArchive [in] A smart pointer to the archive object. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A string that contains the project identifier of the archive object. */ OdString addArchive(const OdBcfArchivePtr &pArchive, OdResult *result = NULL); /** \details Retrieves an archive with the specified identifier. \param projectId [in] A string that contains the project identifier. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the archive. */ OdBcfArchivePtr getArchive(const OdString &projectId, OdResult *result = NULL); /** \details Validates the archive with a specified identifier. \param projectId [in] A string that contains the project Id. \param result [out] A raw pointer to a value that contains the result of the operation. \returns true if the specified archive contains all required data; otherwise the method returns false. */ bool validateArchive(const OdString &projectId, OdResult *result = NULL) const; /** \details Removes the archive with a specified identifier. \param projectId [in] A string that contains the project identifier. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the removed archive. */ OdBcfArchivePtr removeArchive(const OdString &projectId, OdResult *result = NULL); /** \details Enumerates supported sort orders within the session. */ enum eSortParameter { /**Sorting by the global unique identifier (GUID).*/ kSortParameter_Guid = 0, /**Sorting by the date of creation.*/ kSortParameter_CreationDate, /**Sorting by the date of the last modification.*/ kSortParameter_ModifiedDate, /**Sorting by the index.*/ kSortParameter_Index }; /** \details Retrieves the topic folders of a specified project. \param projectId [in] A string that contains the project identifier. \param sortParameter [in] A sort type for the output topic folders list. \param result [out] A raw pointer to a value that contains the result of the operation. \returns An array of smart pointers to topic folder objects. */ OdBcfTopicFolderArray getTopics(const OdString &projectId, eSortParameter sortParameter = kSortParameter_Guid, OdResult *result = NULL); /** \details Adds an existing topic folder object to a specified project. \param projectId [in] A string that contains the project identifier. \param pTopicFolder [in] A smart pointer to the topic folder object. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A GUID of the added topic folder object. */ OdGUID addTopicFolder(const OdString &projectId, const OdBcfTopicFolderPtr& pTopicFolder, OdResult *result = NULL); /** \details Returns an OdGUID of topic folder. \param pTopicFolder [in] A smart pointer to the topic folder object. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A GUID of the topic folder object. */ static OdGUID getTopicId(const OdBcfTopicFolderPtr& pTopicFolder, OdResult* result = NULL); /** \details Retrieves the topic folder object with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the topic folder object. */ OdBcfTopicFolderPtr getTopicFolder(const OdString &projectId, const OdGUID &topicId, OdResult *result = NULL); /** \details Removes a topic folder object with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param result [out] A raw pointer to a value that contains the result of the operation. */ void removeTopicFolder(const OdString &projectId, const OdGUID &topicId, OdResult *result = NULL); /** \details Adds comment to a topic with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param comment [in] A string that contains comment text. \param viewpointId [in] A global unique identifier (GUID) of the viewpoint connected to the comment. \param result [out] A raw pointer to a value that contains the result of the operation. \remarks If you want to get the result of adding the comment, pass a valid pointer to the OdResult value to the method and analyze it after the method call ends. */ void addComment(const OdString& projectId, const OdGUID& topicId, const OdString& comment, const OdGUID& viewpointId = OdGUID(), OdResult* result = NULL); /** \details Edit the comment from the topic with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param commentId [in] A GUID of the comment. \param comment [in] A string that contains the new comment text. \param result [out] A raw pointer to a value that contains the result of the operation. \remarks If you want to get the result of editing the comment, pass a valid pointer to the OdResult value to the method and analyze it after the method call ends. */ void editComment(const OdString& projectId, const OdGUID& topicId, const OdGUID& commentId, const OdString& comment, OdResult* result = NULL); /** \details Delete the comment from the topic with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param commentId [in] A GUID of the comment. \param result [out] A raw pointer to a value that contains the result of the operation. \remarks If you want to get the result of the comment deletion, pass a valid pointer to the OdResult value to the method and analyze it after the method call ends. */ void deleteComment(const OdString& projectId, const OdGUID& topicId, const OdGUID& commentId, OdResult* result = NULL); /** \details Adds a screenshot to a specified topic folder object. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param fileName [in] A string that contains the file name to use for the saving operation. \param data [in] A pointer to a data buffer that contains the file data. \param size [in] A length of the data buffer that contains the file data. \param result [out] A raw pointer to a value that contains the result of the operation. */ void addScreenshot( const OdString &projectId, const OdGUID &topicId, const OdString &fileName, const char *data, unsigned int size, OdResult *result = NULL); /** \details Constructs the path to the screenshot of a specified topic. \param projectId [in] A string containing project Id. \param topicId [in] A GUID of the topic folder. \param fileName [in] A string that contains the full file name of the screenshot. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A string that contains the path to the screenshot. \remarks If the file name of the screenshot is not provided (an empty string is passed) the method uses the default screenshot name. */ OdString getScreenshot(const OdString &projectId, const OdGUID &topicId, const OdString &fileName = OdString(), OdResult *result = NULL); /** \details Creates a new project instance. \param pProjectData [in] A aw pointer to an object that contains values for the instance initialization. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfProject instance. */ OdBcfProjectPtr createProject(const OdBcfProjectData *pProjectData, OdResult *result = NULL) const; /** \details Creates a new project extension instance. \param pProjectExtensionData [in] A raw pointer to an object that contains values for the instance initialization. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfProjectExtension instance. */ OdBcfProjectExtensionPtr createProjectExtension(const OdBcfProjectExtensionData *pProjectExtensionData, OdResult *result = NULL) const; /** \details Creates a new version instance. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfVersion instance. */ OdBcfVersionPtr createVersion(OdResult *result = NULL) const; /** \details Creates a new topic instance. \param pTopicData [in] A raw pointer to an object that contains values for the instance initialization. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfTopic instance. */ OdBcfTopicPtr createTopic(const OdBcfTopicData *pTopicData, OdResult *result = NULL) const; /** \details Creates a new view setup hints instance. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfProject instance. */ OdBcfViewSetupHintsPtr createViewSetupHints(OdResult *result = NULL) const; /** \details Creates a new component selection instance. \param ifcGuids [in] An array of strings that contains GUIDs for the instance initialization. \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfComponentSelection instance. */ OdBcfComponentSelectionPtr createComponentSelection(const OdArray &ifcGuids, OdResult *result = NULL) const; /** \details Creates a new component visibility instance. \param ifcGuids [in] An array of strings that contains GUIDs for the instance initialization. \param defaultVisibility [in] A flag that determines whether the components are visible by default (if it is equal to true) or hidden (if it is equal to false). \param result [out] A raw pointer to a value that contains the result of the operation. \returns A smart pointer to the created OdBcfComponentVisibility instance. */ OdBcfComponentVisibilityPtr createComponentVisibility(const OdArray &ifcGuids, bool defaultVisibility = false, OdResult *result = NULL) const; /** \details A data type that represents an STD pair containing an array of strings with component GUIDs and a string that represents a color value. */ typedef std::pair, OdString> ComponentColoring; /** \details A data type that represents an ODA array of ComponentColoring objects. */ typedef OdArray ComponentColoringArray; /** \details Creates a new component coloring instance. \param componentColoring [in] An array of ComponentColoring objects for instance initialization. \param result [out] A pointer to variable containing result of operation. \returns A smart pointer to the created ComponentColoring instance. */ OdBcfComponentColoringPtr createComponentColoring(const ComponentColoringArray &componentColoring, OdResult *result = NULL) const; /** \details Creates a new bitmap instance. \param pBitmapData [in] A pointer to a variable containing initial values for instance initialization. \param result [out] A pointer to variable containing result of operation. \returns A smart pointer to the created OdBcfBitmap instance. */ OdBcfBitmapPtr createBitmap(const OdBcfBitmapData *pBitmapData, OdResult *result = NULL) const; /** \details Creates a new visualization info instance. \param pVisualizationInfoData [in] A pointer to a variable containing initial values for instance initialization. \param visInfoFileName [in] A string containing visualization information file name. \param screenshotFileName [in] A string containing screenshot file name. \param pMarkup [in] A pointer to a existing markup data for visualization information initialization. \param viewPointIndex [in] A view point index. \param result [out] A pointer to variable containing result of operation. \returns A smart pointer to the created OdBcfVisualizationInfo instance. */ OdBcfVisualizationInfoPtr createVisualizationInfo( const OdBcfVisualizationInfoData *pVisualizationInfoData, const OdString &visInfoFileName, const OdString &screenshotFileName, OdBcfMarkupPtr pMarkup, OdInt32 viewPointIndex = OdBcf::Utils::getUnset(), OdResult *result = NULL) const; /** \details Delete the viewpoint from the topic with a specified GUID from a specified project. \param projectId [in] A string that contains the project identifier. \param topicId [in] A GUID of the topic folder object. \param viewpointId [in] A GUID of the viewpoint. \param result [out] A raw pointer to a value that contains the result of the operation. \remarks If you want to get the result of the viewpoint deletion, pass a valid pointer to the OdResult value to the method and analyze it after the method call ends. */ void deleteViewpoint(const OdString& projectId, const OdGUID& topicId, const OdGUID& viewpointId, OdResult* result = NULL); //DOM-IGNORE-BEGIN protected: OdString m_author; OdString m_authoringToolId; bool m_ignoreModified; OdBcfDataAccessorPtr m_pDataAccessor; OdBcfArchiveMap m_archives; OdDbHostAppProgressMeter *m_pMeter; const OdBcfComponentPtr createComponent(const OdString &ifcGuid) const; OdBcfComponentArray createComponents(const OdArray &ifcGuids) const; OdBcfColorPtr createColor(const OdArray &ifcGuids, const OdString &color) const; //DOM-IGNORE-END }; /** \details A data type that represents a smart pointer to an OdBcfSession object. */ typedef OdSmartPtr OdBcfSessionPtr; } //namespace OdBcf_2_1 #endif // _BCF_2_1_SESSION_H