/////////////////////////////////////////////////////////////////////////////// // 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 _ODTV_SHELLDATAPROCESSOR_H_INCLUDED_ #define _ODTV_SHELLDATAPROCESSOR_H_INCLUDED_ #include "TvToolsExport.h" // Visualize SDK #include "TvEntity.h" #include "TvModel.h" #define STL_USING_SET #include "OdaSTL.h" /** \details This class implements shell data processing for section filling. */ class ODTVTOOLS_EXPORT OdTvShellDataSectionFillingProcessor { public: /** \details This class provides interface for shell data processing reactor. */ class ODTVTOOLS_EXPORT Reactor { public: /** \details Callback that called when entity become processed. \param nCurrent [in] Number of processing entities. */ virtual void onEntityProcessed(OdUInt32 nCurrent) const = 0; }; /** \details A structure that contains and handles statistics of checking model results. */ struct ODTVTOOLS_EXPORT ModelCheckStatistic { OdUInt32 m_nSharpEdges; //A number of sharp edges. OdUInt32 m_nInvalidFaceOrientation; // A number of faces with invalid orientation. OdUInt32 m_nUncertainShellQuality; // A number of uncertain shell quality elements. /** \details Creates a new instance of model check results structure with default parameters. */ ModelCheckStatistic() { m_nSharpEdges = 0; m_nInvalidFaceOrientation = 0; m_nUncertainShellQuality = 0; } /** \details An operator that implements "+= " operation for a model check statistics. \param stat [in] Another ModelCheckStatistic instance that acts as a right-hand operand of the "+=" operation. \returns A reference to the ModelCheckStatistic structure instance modified with the "+=" operation. */ ModelCheckStatistic& operator +=(const ModelCheckStatistic& stat) { m_nSharpEdges += stat.m_nSharpEdges; m_nInvalidFaceOrientation += stat.m_nInvalidFaceOrientation; m_nUncertainShellQuality += stat.m_nUncertainShellQuality; return *this; } }; /** \details Constructs the OdTvShellDataSectionFillingProcessor object. */ OdTvShellDataSectionFillingProcessor(); /** \details Destroys the OdTvShellDataSectionFillingProcessor object. */ ~OdTvShellDataSectionFillingProcessor(); /** \details Retrives a number of threads used for processing. \returns Number of threads used for processing. */ OdUInt32 numThreads() const; /** \details Specifies a number of threads used for processing. \param nThreads [in] Number of threads used for processing. */ void setNumThreads( OdUInt32 nThreads ); /** \details Retrieves a number of entities which can be processed. \param modelId [in] Model to be checked. \param bGetAll [in] If true - returns entities number in model. If false - returns only entities marked as need processing. \returns Number of entities which can be processed. */ OdUInt32 numProcessEntities(OdTvModelId modelId, bool bGetAll = true); /** \details Processes single entity in single-thread mode. \param entityId [in] Entity to be processed. \param pResult [in] A pointer to a value of type that contains the result of the operation. \returns The type of fix that was made. Returns OdTvEntity::FillingCheckResult::kPassed if no fix was made. */ OdTvEntity::FillingCheckResult processEntity( OdTvEntityId entityId, OdTvResult* pResult = nullptr ); /** \details Processes all entities of specified model. \param modelId [in] Model to be processed. \param bProcessAll [in] If true - proccess all entities. If false - process only entities marked as need processing. \returns The structure with quantites of entites by 'FillingCheckResult' \remarks If numThreads() < 2 then single-threaded mode is used; otherwise multi-threaded mode is used. */ ModelCheckStatistic processModel( OdTvModelId modelId, bool bProcessAll = true ); /** \details Specify shell data processing reactor. \param pReactor [in] Shell data processing reactor. \returns The previous reactor. */ Reactor* setProcessingReactor(Reactor* pReactor); //DOM-IGNORE-BEGIN protected: OdUInt32 m_nThreads; template OdUInt32 numProcessEntities(TContainerId containerId, bool bCheckAll, std::set& blocks); template ModelCheckStatistic process(TContainerId containerId, bool bCheckAll, std::set& blocks); Reactor* m_pReactor; //DOM-IGNORE-END }; #endif //_ODTV_SHELLDATAPROCESSOR_H_INCLUDED_