/////////////////////////////////////////////////////////////////////////////// // 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 _EXVISUALIZEDEVICE_EXTENSIONS_H #define _EXVISUALIZEDEVICE_EXTENSIONS_H class OdGiDrawable; #include "TvEntity.h" #include "TvGsView.h" #include "TvBlock.h" #include "TvLayer.h" #include "TvMaterial.h" #include "TvRasterImage.h" #include "TvLinetype.h" #include "TvTextStyle.h" #include "TvModel.h" #include "TvGsDevice.h" #include "TvGeometryData.h" #include "TvVisualStyle.h" #include "TvGsViewBackground.h" #include "Gs/GsViewImpl.h" #include #include //Implement this inrefrace and give it to device using property "DeviceNotifier" //to catch device notifications class ExGsVisualizeDeviceNotifier { public: //entities virtual void entityVectorizationDone( const OdTvEntityId& entityId ) = 0; virtual void insertVectorizationDone( const OdTvEntityId& insertId ) = 0; virtual void lightVectorizationDone( const OdTvEntityId& lightId ) = 0; virtual void entityRemoved( const OdTvEntityId& entityId ) = 0; virtual void insertRemoved( const OdTvEntityId& insertId ) = 0; virtual void lightRemoved( const OdTvEntityId& insertId ) = 0; //view virtual void viewCreated( const OdTvGsViewId& viewId ) = 0; virtual void viewModified( const OdTvGsViewId& viewId ) = 0; //Table records virtual void layerCreated( const OdTvLayerId& layerId ) = 0; virtual void layerModified( const OdTvLayerId& layerId ) = 0; virtual void materialCreated( const OdTvMaterialId& materialId ) = 0; virtual void imageCreated( const OdTvRasterImageId& iamgeId ) = 0; virtual void blockCreated( const OdTvBlockId& blockId ) = 0; virtual void blockVectorizationBegin( const OdTvBlockId& blockId ) = 0; virtual void blockVectorizationDone( const OdTvBlockId& blockId ) = 0; virtual void linetypeCreated( const OdTvLinetypeId& linetypeId ) = 0; virtual void textStyleCreated( const OdTvTextStyleId& textStyleId ) = 0; //Models virtual void modelCreated( const OdTvModelId& modelId ) = 0; virtual void modelActivated( const OdTvModelId& modelId ) = 0; //update virtual void updateBegins() = 0; virtual void updateEnds() = 0; //Optional methods virtual void viewportEntityCreated( const OdTvEntityId&, const OdGiDrawable* ) {} virtual void tvDeviceCreated(const OdTvGsDeviceId&) {} virtual void entityVectorizationDoneEx(const OdTvEntityId& entityId, const OdGiDrawable* pDrawable) {}; virtual void drawableVectorizationBegins( const OdGiDrawable* pDrawable ) {} virtual void drawableVectorizationEnds( const OdGiDrawable* pDrawable ) {} }; //Implement this inrefrace and give it to the device using property "GeometryNotifier" //to catch device geometry notifications class ExGsVisualizeGeomertyNotifier { public: //Event types enum Event { kShellAdded = 1 << 0, //Shell was added kShellBackFaceCullingInherited = 1 << 1, //Shell's BackFaceCulling is set to kInherit kWireframeGeometryAdded = 1 << 2, //Geometry curves: lines, arcs, nurbs, etc. kTextAdded = 1 << 3, kImageAdded = 1 << 4, kPointCloudAdded = 1 << 5, //PointCloud or RCS Point Cloud kInfiniteGeometryAdded = 1 << 6, //Infinite line or ray kMeshAdded = 1 << 7, kBrepAdded = 1 << 8 }; //Destructor virtual ~ExGsVisualizeGeomertyNotifier() {} //Event handler virtual void onEvent( Event ev, OdTvEntityId topLevelEntityId, OdTvGeometryDataId geometryId ) {} virtual void onEvent( Event ev, OdTvEntityId topLevelEntityId, OdTvGeometryDataId geometryId, OdGsMarker /*marker*/ ) { onEvent( ev, topLevelEntityId, geometryId ); } //Accepted events maks: only events, specified in mask, will cause notifications virtual OdUInt32 acceptedEvents() const { return 0; } }; struct ExGsTextStyleCacheData { private: enum class Flag { kItalic = 1 << 0, kBold = 1 << 1, kVertical = 1 << 2 }; public: OdString m_name; OdString m_typeface; OdString m_fileName; int m_charset; int m_family; OdUInt8 m_flags; double m_dObliquingAngle; ExGsTextStyleCacheData() : m_name( L"" ), m_typeface( L"" ), m_fileName( L"" ), m_charset( 0 ), m_family( 0 ), m_flags( 0 ), m_dObliquingAngle( 0 ) { }; void setItalic( bool bSet ) { SETBIT( m_flags, static_cast( Flag::kItalic ), bSet); } void setBold( bool bSet ) { SETBIT( m_flags, static_cast< OdUInt8 >( Flag::kBold ), bSet ); } void setVertical( bool bSet ) { SETBIT( m_flags, static_cast< OdUInt8 >( Flag::kVertical ), bSet ); } bool operator< ( const ExGsTextStyleCacheData& data ) const { if( m_name < data.m_name ) return true; if( m_name > data.m_name ) return false; if( m_typeface < data.m_typeface ) return true; if( m_typeface > data.m_typeface ) return false; if( m_fileName < data.m_fileName ) return true; if( m_fileName > data.m_fileName ) return false; if( m_charset < data.m_charset ) return true; if( m_charset > data.m_charset ) return false; if( m_family < data.m_family ) return true; if( m_family > data.m_family ) return false; if( m_flags < data.m_flags ) return true; if( m_flags > data.m_flags ) return false; if( m_dObliquingAngle < data.m_dObliquingAngle ) return true; if( m_dObliquingAngle > data.m_dObliquingAngle ) return false; return false; } }; //This structure provides device cache sharing struct ExGsVisualizeDeviceCache { bool m_bApplyCacheData; // if false device will not replace its cache by this data and will use this structure only for writing std::map< OdDbStub*, OdTvLayerId > m_cachedLayers; std::map< OdDbStub*, OdTvLinetypeId > m_cachedLinetypes; std::map< OdDbStub*, OdTvMaterialId > m_cachedMaterials; std::map< OdString, OdTvRasterImageId > m_cachedImages; std::map< ExGsTextStyleCacheData, OdTvTextStyleId > m_cachedTextStyles; std::set< OdDbStub* > m_cachedVectorizedBlocks; std::map< OdDbStub*, OdTvVisualStyleId > m_cachedVisualStyles; std::map< OdDbStub*, OdTvGsViewBackgroundId > m_cachedBackgrounds; OdUInt32 m_uniqNumber; }; enum DeviceIgnoreFlags { kIgnoreViewInfoFlags = 1 << 0, kIgnoreFaceFillPattern = 1 << 1, kIgnoreViewBackClipping = 1 << 2, kIgnoreViewFrontClipping = 1 << 3, kIgnoreViewClippingRegion = 1 << 4, kIgnoreEdgesColors = 1 << 5, kIgnoreEdgesVisibilities = 1 << 6 }; /** \details This interface represents ExGsVisualizeDevice update modofier */ class ExGsVisualizeUpdateModifier { public: /** \details This method being called before View update. \param pView [in] View to be updated. */ virtual void preUpdateView( OdGsViewImpl* pView ) = 0; }; #endif //_EXVISUALIZEDEVICE_EXTENSIONS_H