/////////////////////////////////////////////////////////////////////////////// // 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 _TV_PRC2VISUALIZEEX_H_ #define _TV_PRC2VISUALIZEEX_H_ #include "TD_PackPush.h" #include "PrcCommon.h" #include "PrcFile.h" #define STL_USING_MAP #include "OdaSTL.h" #include "TvEntity.h" #include "Prc2VisualizeGeomCollector.h" #define OD_TV_RELATED_ANIM_CONTAINER_DATA_NAME OD_T("OdTvRleatedToViewAnimContainerData") /** \details Types for special maps */ typedef std::map< OdDbHandle, unsigned int > prcHandleToPOAndPartDefRepeatMap; typedef std::map< OdDbHandle, prcHandleToPOAndPartDefRepeatMap > prcFileStructureHandleToPOAndPartDefRepeatMap; typedef std::map< OdDbHandle, OdTvBlockId > prcPOAndPartDefTvBlockMap; typedef std::map< OdDbHandle, prcPOAndPartDefTvBlockMap > prcFileStructureToPOAndPartDefTvBlockMap; typedef std::map< OdPrcObjectId, OdPrcObjectId > prcViewsLinkedItemsMap; typedef std::map< OdPrcObjectId, prcViewsLinkedItemsMap > prcViewToLinkedItemsMap; typedef std::map< OdInt32, OdTvGsViewId> prcViewNodeToTvViewMap; typedef std::map< OdPrcObjectId, OdUInt32> prcViewIdToViewNodeMap; typedef std::map TvViewAnimContainerMap; /** \details Enum for the traits inheritance rules */ enum OdTvVisualizePrcBehaviorBitField { kUseSon = 0, kUseFather }; /** \details This stucture contains context information for tv database filling through the taverse of the PRC database */ struct OdTvVisualizePrcTraverseFilerContext { enum ParentForAdd { kModel = 1, kBlock = 2, kGroup = 3, }; OdPrcFilePtr m_pDb; ParentForAdd m_parentType; OdTvDatabaseId m_dbId; OdTvModelId m_modelId; OdTvBlockId m_blockId; OdTvEntityId m_groupId; OdTvEntityId m_pmiGroupId; OdPrcObjectId m_curAnnotationViewId; //currently imported annotation view OdTvGsViewId m_curAnnotationTvViewId; //tv view for the currently imported annotation view (or for new default view) OdString m_strDefaultName; OdTvMatrix m_transForInsert; //transformation for the insert when insted of group->insert we will make only one insert OdString m_strNameForInsert; //name for the insert when insted of group->insert we will make only one insert prcFileStructureHandleToPOAndPartDefRepeatMap* m_pRepeatMap; prcFileStructureToPOAndPartDefTvBlockMap* m_pPOAndPartDefBlockMap; prcViewNodeToTvViewMap* m_pViewsMap; prcViewIdToViewNodeMap* m_pViewsNodeMap; prcViewToLinkedItemsMap* m_ViewToLinkedItemsMap; unsigned int m_nRepetitions; OdTvVisualize2PrcGeomCollector* m_pGeometryCollector; //vectorizer, worldDraw for representation geometry catch bool m_bDefaultViewWasCreated; bool m_bAllowParentGroupNameChangeFromPrototype; TvViewAnimContainerMap m_viewAnimContainerMap; /** \details Default constructor for the class. */ OdTvVisualizePrcTraverseFilerContext() : m_parentType(kModel), m_pRepeatMap(nullptr), m_pPOAndPartDefBlockMap(nullptr), m_pViewsMap(nullptr), m_pViewsNodeMap(nullptr), m_ViewToLinkedItemsMap(nullptr), m_nRepetitions(1), m_pGeometryCollector(nullptr), m_bDefaultViewWasCreated(false), m_bAllowParentGroupNameChangeFromPrototype(false) { } /** \details Constructor with parameters for the class. */ OdTvVisualizePrcTraverseFilerContext(OdTvVisualize2PrcGeomCollector* pGeometryCollector, prcFileStructureHandleToPOAndPartDefRepeatMap* pMap, prcFileStructureToPOAndPartDefTvBlockMap* pPOBlockMap, prcViewNodeToTvViewMap* pViewsMap, prcViewIdToViewNodeMap* pViewsNodeMap); /** \details Sets that all further entites should be added to the block */ void setParentBlock(OdTvBlockId id); /** \details Sets that all further entites should be added to the group */ void setParentGroup(OdTvEntityId id); }; /** \details This object performs traits assign to the Visualize object */ class OdTvVisualizePrcTraitsAssign { OdTvVisualizePrcTraitsAssign(); public: /** \details Constructor */ OdTvVisualizePrcTraitsAssign(const OdPrcBaseWithGraphics* pBaseWithGraphics, OdTvVisualizePrcTraverseFilerContext& ctx); /** \details Destructor */ ~OdTvVisualizePrcTraitsAssign(); /** \details Methods */ bool getRemovedBit() const; OdPrcObjectId getCoordinateSystemId() const; void play(OdGiWorldDraw* m_pDraw) const; void play(OdTvEntityId entId, OdTvVisualizePrcTraverseFilerContext& ctx) const; void setDefaultColor(OdTvVisualizePrcTraverseFilerContext& ctx); private: OdGiContextForPrcDatabasePtr m_pCtx; OdPrcGraphicsValuesStorage m_fatherGraphicsStorage; OdPrcGraphicsValuesStorage m_curGraphicsStorage; double m_curTransparency; OdCmEntityColor m_color; //used only for support default color OdPrcObjectId m_coordinateSystemId; bool m_bCurrentShowBit; }; /** \details Perform direct (object-to-object) import from PRC to Visualize \param pDb [in] source PRC file for import \param tvDbId [in] target Visualize database for import \param bNeedClearEmpty [in] flag which indicates that it is need to perform cleaning of the empty objects \param facetResForBrep [in] resultion for the brep triangulation \param bImportBrepAsBrep [in] flag which indicates that it is need to import Breps as Breps \param outModels [out] array of models which were created during import \param outViews [out] map of views which were created during import \param tvTime [out] time in the seconds that was used by Visualize API calls \remarks If the operation was successfully performed, the method returns tvOk; otherwise it returns an appropriate error code. */ OdTvResult performDirectImport(OdPrcFilePtr pDb, OdTvDatabaseId& tvDbId, bool bNeedClearEmpty, double facetResForBrep, bool bImportBrepAsBrep, OdArray& outModels, prcViewNodeToTvViewMap& outViews, double& tvTime); #include "TD_PackPop.h" #endif