/////////////////////////////////////////////////////////////////////////////// // 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 OdTvNwdExporter_H #define OdTvNwdExporter_H #include "TD_PackPush.h" #define STL_USING_MAP #define STL_USING_FUNCTIONAL #include "OdaSTL.h" //nw #include "NwObject.h" //tv2nw #include "NwdExporterBranchState.h" #include "MaterialExporter.h" #include "GeometryFactory.h" #include "LightsExporter.h" #include "TvDatabase.h" //---------------------------------------------------------- // // OdTvNwdExporter // //---------------------------------------------------------- class OdTvLayerId; class OdTvBlockId; class OdNwBrepImport; typedef OdSmartPtr OdNwBrepImportPtr; class OdTvNwdExporter { public: OdTvNwdExporter(std::map&& layersIdMap, OdTvMaterialExporter&& tv2nwMatExporter, const OdTvLightsExporter& tv2nwLightsExporter, std::function viewIdForExportInit); ~OdTvNwdExporter() = default; //create model item nodes with data by pEntIter and append them as children to nwParentId //pEntIter [in] - tv iterator with entities for export to nwd //nwParentId [in] - nw object id of model item which must be parent for new nodes which created by data from tv entity iterator //trm [in] - transformation for entity data(most used for tv blocks entities from insert) //isModelLvl [in] - is tv entity data is first level child of tv models void exportByEntityIterator(OdTvEntitiesIteratorPtr pEntIter, const OdNwObjectId& nwParentId, bool isModelLvl); void processCDATree(OdTvDatabaseId tvDbId); void setExportCDAProperties(bool value); private: void createModelItemsByTvEntity(OdTvEntityPtr pTvEntity, const OdNwObjectId& nwParentId, bool geometryParent); void createModelItemsByTvInsert(OdTvInsertPtr pTvInsert, const OdNwObjectId& nwParentId); void createModelItemsByTvGroup(OdTvGroupPtr pTvGroup, const OdNwObjectId& nwParentId); OdResult addNwGeometryFragment(const OdNwObjectId& nwParentId, const OdTvMaterialDef& tvMatDef, const OdTvColorDef& tvClrDef, std::function addGeomFrag); void removeTvLayerFromHelperBranches(const OdTvLayerDef& tvLayerDef, bool isBlockBranch); OdNwObjectId getModelItemByTvLayerDef(const OdTvLayerDef& tvLayerDef, bool isBlockBranch); OdNwBrepImportPtr getNwBrepImporter(OdResult* pResult = nullptr); OdResult rasterBrep(OdNwBrepImportPtr pBrepModule, const OdBrBrep & brepObject, OdNwObjectId parentObjectId); void processGeometryInTvObject(const OdTvGeometryDataId& tvGeomDataId, const OdTvMaterialDef& tvMatDef, const OdTvColorDef& tvClrDef, const OdTvLayerDef& tvLrDef, const OdNwObjectId& nwParentId, bool geometryParent); void processEntityCDATreeNode(OdTvCDATreeNodePtr node); protected: //map for connection of tv layer id with nw object id with layer std::map m_mLayersId; //tv2nw material exporter with map, where tv material id is key and nw materials are values OdTvMaterialExporter m_tv2nwMatExporter; //tv2nw lights exporter OdTvLightsExporter m_tv2nwLightsExporter; //tv model can has tv dependence views, for this case there is such callback std::function m_clbkViewIdForExportInit; //map with link between tv block objects and model item's object ids std::map m_mBlocks; //current branch state while traversing tv database in deep OdNwdExporterBranchState m_tv2nwBranchState; std::map m_tvEntitiesNativeHandleMap; //geometry data factory TvGeomFty m_tv2nwGeomFty; OdNwBrepImportPtr m_pBrepImport; bool m_exportCDAProperties; }; #include "TD_PackPop.h" #endif // OdTvNwdExporter_H