/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // Xml server rendition #ifndef ODTRXMLRENDITION #define ODTRXMLRENDITION #include "TD_PackPush.h" #include "TrVisRenditionRecorder.h" #include "TrRndLocalModuleRendition.h" #include "TrXmlIdRegistratorImpl.h" #include "XmlServer.h" #include "TrXmlExports.h" #define OD_TRXML_ENABLEPROGRAMDECISION class OdTrXmlRenditionRedir; /** \details */ class ODTRXML_EXPORT OdTrXmlRendition : public OdTrRndLocalModuleRendition, protected OdTrXmlRegistratorImpl::Traverser { protected: // Settings ClientSettings m_clientSettings; // Id registrator mutable OdTrXmlRegistratorImpl m_idReg; // Output OdSmartPtr m_pXml; // Current mode enum ProcMode { kIntermediate = 0, kGsUpdate } m_mode; // Redirection controller OdTrXmlRenditionRedir *m_pRedir; // Current output state OdTrXmlServer::OutputState m_outputState; // Current processing device OdTrVisRenderClient *m_pProcDevice; // Intermediate floats conversion array OdFloatArray m_imedFloats; // Set of dropped TtfCache metafiles std::set m_ttfMfsDropped; // Set of TtfCache metafiles expects dropping std::set m_ttfMfsExpect; public: /** \details Default constructor for the OdTrXmlRendition class. */ OdTrXmlRendition(); /** \details Destructor for the OdTrXmlRendition class. */ ~OdTrXmlRendition() override; // XmlRendition methods /** \details Returns client settings. \remarks For more information, see . */ OdIntPtr getClientSettings() const; /** \details Sets client settings. \param pClSet [in] Client settings to set. \remarks For more information, see . */ void setClientSettings(OdIntPtr pClSet); /** \details Returns xml server associated with this object. \returns OdIntPtr representing xml server. */ OdIntPtr getXmlServer() const; /** \details Sets xml server associated with this object. \param pXmlServer [in] Xml server to set. */ void setXmlServer(OdIntPtr pXmlServer); /** \details Returns xml server associated with this object. \returns Pointer to OdTrXmlServer associated with this object. */ OdTrXmlServer *xml(); /** \details Returns xml server associated with this object. \returns Pointer to OdTrXmlServer associated with this object. */ const OdTrXmlServer *xml() const; /** \details Sets xml redirection controller. \param pRedir [in] Pointer to the xml redirection controller. */ void setRedirectionController(OdTrXmlRenditionRedir *pRedir) { m_pRedir = pRedir; } void setIntermediateMode(); void setGsUpdateMode(); bool isIntermediateMode() const { return (m_mode == kIntermediate); } bool isGsUpdateMode() const { return (m_mode == kGsUpdate); } void DropMetadata(const OdTrVisFlatMetafileContainer *pMetafile); // High-level callbacks /** \details Notification method that is called on starting vectorizer update. \param pDevice [in] Pointer to the client device to process. */ void onDeviceUpdateBegin(OdTrVisRenderClient *pDevice) override; /** \details Notification method that is called on ending vectorizer update. \param pDevice [in] Pointer to the client device to process. \param bRender [in] Reserved for future use. */ void onDeviceUpdateEnd(OdTrVisRenderClient *pDevice, bool bRender = true) override; /** \details Checks whether the vectorizer update has started. \returns true if the vectorizer is within update, false otherwise. */ bool isWithinDeviceUpdate() const override { return m_pProcDevice != NULL; } /** \details Notification method that is called by underlying application to store frame changing information. \param nInterval [in] Interval. */ void onFrameSwitchInfo(OdUInt32 nInterval) override; /** \details Returns a set of bit flags that indicate rendition capabilities/settings. \param requestFor [in] A set of flags for which to request setting relevant values that dependend on client processing mode of xml server. \returns A set of bit flags from the enumeration. */ OdUInt32 queryRenditionCaps(OdUInt32 requestFor = 0xFFFFFFFF) const override; /** \details Allocates new resources for sharing provider compatible with rendition. \returns Smart pointer to the sharing provider. */ OdTrVisSharingProviderClientPtr createSharingProvider() override; // Extract local rendition-specific host service. OdTrRndLocalRenditionHost *localRenditionHost() override; /** \details Multithreaded processing of core rendition data flags. \param type [in] Core rendition data type. \returns Multithreaded handling type. */ MtHandlerType mtDataTypeProcessing(DataType &type) const override; /** \details Returns identifier of an associated registrator. \returns Returns identifier of a registrator, or NULL if no registration supported. */ IdRegistrator *idRegistrator() const override; // GsFiler support /** \details Saves current rendition state to the specified filer. \param pFiler [out] Pointer to a filer to which to save the rendition. \returns true if saved successfully, false otherwise. */ bool saveRenditionState(OdGsFiler *pFiler) const override; /** \details Loads rendition state from the specified filer. \param pFiler [in] Pointer to a filer from which to load the rendition state. \param pIdMap [in] Pointer to an instance used for identifier mapping. \returns true if loaded successfully, false otherwise. */ bool loadRenditionState(OdGsFiler *pFiler, OdTrVisIdMap *pIdMap) override; // Mid-level callbacks // Client information /** \details Returns rendering client settings. \param clientSets [out] Receives rendering client settings. */ void obtainClientSettings(ClientSettings &clientSets) override; // Surface /** \details Notification method that is called when output render surface parameters are changed. \param pDef [in] Surface definition. */ void onSurfaceChanged(const OdTrVisSurfaceDef &pDef) override; /** \details Notification method that is called when rendering surface should be completely invalidated. */ void onSurfaceInvalidated() override; // Overlays /** \details Notification method that is called when a new overlay is added to device. \param overlayId [in] Graphics overlay identifier. \param pDef [in] Graphics overlay definition. \remarks Default main scene overlay (kTrVisMainOverlayId with value 0) is always present in graphics scene, so for it the onOverlayAdded method is not be called. */ void onOverlayAdded(OdTrVisOverlayId overlayId, const OdTrVisOverlayDef &pDef) override; /** \details Notification method that is called when existing overlay is removed from device. \param overlayId [in] Graphics overlay identifier. */ void onOverlayDeleted(OdTrVisOverlayId overlayId) override; /** \details Notification method that is called when overlay visibility is changed. \param overlayId [in] Graphics overlay identifier. \param bVisibility [in] Visibility status. */ void onOverlayVisibilityChanged(OdTrVisOverlayId overlayId, bool bVisibility) override; /** \details Notification method that is called when overlay rendering order is changed. \param overlayId [in] Graphics overlay identifier. \param nRenderOrder [in] New relative rendering order of overlay buffer in overlay buffers list. */ void onOverlayRenderOrderChanged(OdTrVisOverlayId overlayId, OdInt16 nRenderOrder) override; // Viewports /** \details Notification method that is called when new viewport is added to device. \param overlayId [in] Viewport identifier. \param pDef [in] Viewport definition. */ void onViewportAdded(OdTrVisViewportId viewportId, const OdTrVisViewportDef &pDef) override; /** \details Notification method that is called when viewport is inserted into list at the specified index. \param viewportId [in] Viewport identifier. \param nIndex [in] Index in the list. \param pDef [in] Viewport definition. */ void onViewportInserted(OdTrVisViewportId viewportId, int nIndex, const OdTrVisViewportDef &pDef) override; /** \details Notification method that is called when viewport is removed from device. \param viewportId [in] Viewport identifier. */ void onViewportDeleted(OdTrVisViewportId viewportId) override; /** \details Notification method that is called when viewport visibiily is changed. \param viewportId [in] Viewport identifier. \param bVisibility [in] Visibility status. */ void onViewportVisibilityChanged(OdTrVisViewportId viewportId, bool bVisibility) override; // Primary viewports configuration /** \details Notification method that is called when viewport view parameters are modified. \param viewportId [in] Viewport identifier. \param pDef [in] Viewport view parameters definition. */ void onViewportViewParamsModified(OdTrVisViewportId viewportId, const OdTrVisViewParamsDef &pDef) override; /** \details Notification method that is called when viewport linestyle settings are modified. \param viewportId [in] Viewport identifier. \param pDef [in] Viewport linestyle definition. */ void onViewportLineStylesModified(OdTrVisViewportId viewportId, const OdTrVisViewportLineStyleDef &pDef) override; /** \details Notification method that is ?alled when viewport fading settings are modified \param viewportId [in] Viewport identifier. \param pDef [in] Viewport fading definition. */ void onViewportFadingModified(OdTrVisViewportId viewportId, const OdTrVisViewportFadingDef &pDef) override; /** \details Notification method that is called when viewport lineweight settings are modified. \param viewportId [in] Viewport identifier. \param pDef [in] Viewport lineweight definition. */ void onViewportLineweightsModified(OdTrVisViewportId viewportId, const OdTrVisViewportLineweightsDef &pDef) override; /** \details Notification method that is called when viewport rendering mode is modified. \param viewportId [in] Viewport identifier. \param pDef [in] Viewport definition. */ void onViewportShadingModified(OdTrVisViewportId viewportId, const OdTrVisViewportShadingDef &pDef) override; /** \details Notification method that is called when viewport clipping region is modified. \param viewportId [in] Viewport identifier. \param pDef [in] Viewport definition. \param bNrcClipModified [in] Flag that specifies whether non-rectangular viewport clipping contour is modified. \param bBorderModified [in] Flag that specifies whether viewport border is modified. */ void onViewportClipModified(OdTrVisViewportId viewportId, const OdTrVisViewportClipDef &pDef, bool bNrcClipModified = true, bool bBorderModified = true) override; // Extended viewports configuration /** \details Notification method that is called when background stream in viewport is changed. \param viewportId [in] Viewport identifier. \param pStream [in] Background graphics that is represented as graphics stream. \param baseProgramId [in] Base shading program identifier. */ void onViewportBackgroundChanged(OdTrVisViewportId viewportId, const OdTrVisBackgroundDef &pDef) override; /** \details Notification method that is called when viewport fog is changed. \param viewportId [in] Viewport identifier. \param pDef [in] Fog definition. */ void onViewportFogChanged(OdTrVisViewportId viewportId, const OdTrVisFogDef &pDef) override; /** \details Notification method that is called when viewport render settings is modified. \param viewportId [in] Viewport identifier. \param pDef [in] Render settings definition. */ void onViewportRenderSettingsChanged(OdTrVisViewportId viewportId, const OdTrVisRenderSettingsDef &pDef) override; /** \details Notification method that is called when viewport sectioning is modified. \param viewportId [in] Viewport identifier. \param pDef [in] Section definition. */ void onViewportSectioningChanged(OdTrVisViewportId viewportId, const OdTrVisSectionDef &pDef) override; /** \details Notification method that is called when viewport anti-aliasing setting is changed. \param viewportId [in] Viewport identifier. \param nAntiAliasing [in] New anti-aliasing state. */ void onViewportAntiAliasingChanged(OdTrVisViewportId viewportId, OdUInt32 nAntiAliasing) override; /** \details Notification method that is called when viewport ssao setting is changed. \param viewportId [in] Viewport identifier. \param bEnabled [in] New SSAO state. */ void onViewportSSAOChanged(OdTrVisViewportId viewportId, bool bEnabled) ODRX_OVERRIDE; // Viewport default lights configuration /** \details Notification method that is called when viewport ambient light setting is modified. \param viewportId [in] Viewport identifier. \param ambientLight [in] Ambient color in RGBA format in [0.0 - 1.0] range for each channel. */ void onViewportAmbientLightChanged(OdTrVisViewportId viewportId, const OdTrVisMaterialColor &ambientLight) override; /** \details Notification method that is called when viewport default light setting modified. \param viewportId [in] Viewport identifier. \param bDefaultLightsOn [in] Flag that specifies whether default light sources must be taken into account during visualization. \param pLightsList [in] Pointer to an array of light definitions. \param nLightsListEntries [in] Number of light definition entries. */ void onViewportDefaultLightsChanged(OdTrVisViewportId viewportId, bool bDefaultLightsOn, const OdTrVisLightDef *pLightsList = NULL, OdUInt32 nLightsListEntries = 0) override; // Viewport lights management /** \details Notification method that is called when light source is added to viewport light sources list. \param viewportId [in] Viewport identifier. \param lightId [in] Identifier of a light source. \param nOverrides [in] Set of bit flags that specify which parts of light data should be overridden for the viewport. \param pOverrides [in] Light definition. */ void onViewportLightAttached(OdTrVisViewportId viewportId, OdTrVisLightId lightId, OdUInt32 nOverrides = 0, const OdTrVisLightDef &pOverrides = OdTrVisLightDef()) override; /** \details Notification method that is called when light source is removed from viewport light sources list. \param viewportId [in] Viewport identifier. \param lightId [in] Identifier of a light source. */ void onViewportLightDetached(OdTrVisViewportId viewportId, OdTrVisLightId lightId) override; // Per-overlay viewport overrides /** \details Notification method that is called when viewport needs to override view parameters for specific overlay. \param viewportId [in] Viewport identifier. \param overlayId [in] Identifier of overlay buffer that contains viewport to override view orientation and transformation settings. \param bOverride [in] Flag that specifies whether view parameters should be overridden. \param pDef [in] Block with view orientation and transformation parameters. */ void onOverlayViewParamsOverride(OdTrVisViewportId viewportId, OdTrVisOverlayId overlayId, bool bOverride, const OdTrVisViewParamsDef &pDef = OdTrVisViewParamsDef()) override; /** \details Notification method that is called when viewport extents are changed. \param viewportId [in] Viewport identifier. \param overlayId [in] Identifier of overlay buffer that contains viewport to override view orientation and transformation settings. \param pDef [in] Block with view orientation and transformation parameters. */ void onOverlayExtentsOverride(OdTrVisViewportId viewportId, OdTrVisOverlayId overlayId, const OdTrVisExtentsDef &pDef) override; // Viewports ordering lists /** \details Notification method that is called when order of metafiles in viewport is changed (for obtain modified part of list by renderer). \param viewportId [in] Viewport identifier. \param overlayId [in] Identifier of overlay buffer that contains viewport to modify metafiles list. \param nInvalidFrom [in] Index of first invalid entry in a list to be updated. \param nInvalidLen [in] Number of invalid entries in a list to be removed (could be 0 in case if list doesn’t contain invalid entries to be removed). \param pValidFrom [in] Pointer to an array of valid entries to add to the list. \param nValidLen [in] Number of valid entries to add to the list. */ void onMetafileOrderChanged(OdTrVisViewportId viewportId, OdTrVisOverlayId overlayId, OdUInt32 nInvalidFrom, OdUInt32 nInvalidLen, const OdTrVisDisplayId *pValidFrom, OdUInt32 nValidLen) override; /** \details Notification method that is called when metafiles rendering list may be shared between different viewports instead of creating rendering lists for each viewport. \param viewportId1 [in] Viewport identifier. \param overlayId1 [in] Identifier of overlay buffer that contains viewport that can use foreign rendering list and viewport whose rendering list can be used as foreign. \param viewportId2 [in] Identifier of viewport whose rendering list can be used as foreign. */ void onMetafileOrderInheritance( OdTrVisViewportId viewportId1, OdTrVisOverlayId overlayId1, OdTrVisViewportId viewportId2 ) override; // Metafiles /** \details Notification method that is called when a new metafile added. \param metafileId [in] Metafile identifier. \param pDef [in] Metafile definition. \returns Visual display Id that is equal to metafileId by default. */ OdTrVisDisplayId onMetafileAdded(OdTrVisMetafileId metafileId, const OdTrVisMetafileDef &pDef) override; /** \details Notification method that is called when existing metafile is deleted. \param metafileId [in] Metafile identifier. */ void onMetafileDeleted(OdTrVisMetafileId metafileId) override; // Called when exist metafile changed. //virtual void onMetafileModified(OdTrVisMetafileId metafileId, const OdTrVisMetafileDef &pDef); // Called when exist metafile extents updated (affected by transformation state branches). /** \details Notification method that is called when extents of an existing metafile are updated (affected by transformation state branches). \param metafileId [in] Metafile identifier. \param extents [in] New extents. */ void onMetafileExtentsUpdated(OdTrVisMetafileId metafileId, const OdGeExtents3d &extents) override; /** \details Notification method that is called when visibility status of existing metafile is changed. \param metafileId [in] Metafile identifier. \param bVisibility [in] Visibility state. */ void onMetafileVisibilityChanged(OdTrVisMetafileId metafileId, bool bVisibility) override; /** \details Notification method that is called when highlighting status of existing metafile is changed. \param metafileId [in] Metafile identifier. \param bHighlight [in] Highlight state. */ void onMetafileHighlightingChanged(OdTrVisMetafileId metafileId, bool bHighlight) override; /** \details Notification method that is called when fading status of existing metafile is changed. \param metafileId [in] Metafile identifier. \param bFade [in] Fade state. */ void onMetafileFadingChanged(OdTrVisMetafileId metafileId, bool bFade) override; // Lights /** \details Notification method that is called when new light source is added. \param lightId [in] Light source identifier. \param pDef [in] Light definition. */ void onLightAdded(OdTrVisLightId lightId, const OdTrVisLightDef &pDef) override; /** \details Notification method that is called when existing light source is modified. \param lightId [in] Light source identifier. \param nKindOfMod [in] List of possible changes. \param pDef [in] Light definition. */ void onLightModified(OdTrVisLightId lightId, OdUInt32 nKindOfMod, const OdTrVisLightDef &pDef) override; /** \details Notification method that is called when existing light source is deleted. \param lightId [in] Light source identifier. */ void onLightDeleted(OdTrVisLightId lightId) override; // State branches (highlighting, hide, transform) /** \details Notification method that is called when new state branch added. \param stateBranchId [in] Identifier of state branch to add to graphics scene. \param pDef [in] State branch definition. \remarks State branch consists of: * List of child state branches to traverse through state branches tree during rendering process; * List of state markers to process (highlight or hide) sub elements of graphic metafiles. */ void onStateBranchAdded(OdTrVisStateBranchId stateBranchId, const OdTrVisStateBranchDef &pDef) override; /** \details Notification method that is called when existing state branch is modified. \param stateBranchId [in] Identifier of state branch to modify. \param pDef [in] State branch definition. \param bChildsModified [in] Flag that specifies whether child state branches list is modified. \param bMarkersModified [in] Flag that specifies whether state markers list is modified. \remarks State branch consists of: * List of child state branches to traverse through state branches tree during rendering process; * List of state markers to process (highlight or hide) sub elements of graphic metafiles. */ void onStateBranchModified(OdTrVisStateBranchId stateBranchId, const OdTrVisStateBranchDef &pDef, bool bChildsModified, bool bMarkersModified) override; /** \details Notification method that is called when new state branch added. \param stateBranchId [in] Identifier of state branch to delete. */ void onStateBranchDeleted(OdTrVisStateBranchId stateBranchId) override; // Called to attach additional data to range of state branch markers. void onStateBranchMarkersRangeDataAdded(OdTrVisStateBranchId stateBranchId, const OdTrVisStateBranchMarkersRange &range, const OdTrVisPropertyDef &propDef) override; // Called to detach additional data from state branch markers range. void onStateBranchMarkersRangeDataRemoved(OdTrVisStateBranchId stateBranchId, const OdTrVisStateBranchMarkersRange &range) override; // Textures /** \details Notification method that is called when new texture is added. \param textureId [in] Identifier of texture to add. \param pDef [in] Texture definition. */ void onTextureAdded(OdTrVisTextureId textureId, const OdTrVisTextureDef &pDef) override; /** \details Notification method that is called when existing texture is deleted. \param textureId [in] Identifier of texture to delete. */ void onTextureDeleted(OdTrVisTextureId textureId) override; // Called when texture flags modified. void onTextureFlagsModified(OdTrVisTextureId textureId, OdUInt32 newFlags) override; // Materials /** \details Notification method that is called when new material is added. \param materialId [in] Identifier of material to add. \param pDef [in] Material definition. */ void onMaterialAdded(OdTrVisMaterialId materialId, const OdTrVisMaterialDef &pDef) override; /** \details Notification method that is called when existing material is deleted. \param materialId [in] Identifier of material to delete. */ void onMaterialDeleted(OdTrVisMaterialId materialId) override; // Called when new material reflection plane added. void onMaterialRefPlaneAdded(OdTrVisRefPlaneId refPlaneId, const OdTrVisRefPlaneDef &pDef) override; // Called when exist material reflection plane deleted. void onMaterialRefPlaneDeleted(OdTrVisRefPlaneId refPlaneId) override; // Visual Styles /** \details Notification method that is called when new visual style is added. \param visualStyleId [in] Identifier of visual style to add. \param pDef [in] Visual style definition. */ void onVisualStyleAdded(OdTrVisVisualStyleId visualStyleId, const OdTrVisVisualStyle &pDef) override; /** \details Notification method that is called when existing visual style is modified. \param visualStyleId [in] Identifier of visual style to modify. \param pDef [in] Visual style definition. */ void onVisualStyleModified(OdTrVisVisualStyleId visualStyleId, const OdTrVisVisualStyle &pDef) override; /** \details Notification method that is called when existing visual style is deleted. \param visualStyleId [in] Identifier of visual style to delete. */ void onVisualStyleDeleted(OdTrVisVisualStyleId visualStyleId) override; // Layers /** \details Notification method that is called when new layer is added. \param visualStyleId [in] Identifier of layer to add. \param pDef [in] Layer definition. */ void onLayerAdded(OdTrVisLayerId layerId, const OdTrVisLayerDef &pDef) override; // Called when exist layer modified. //virtual void onLayerModified(OdTrVisLayerId layerId, const OdTrVisLayerDef &pDef); /** \details Notification method that is called when existing layer is deleted. \param layerId [in] Identifier of layer to delete. */ void onLayerDeleted(OdTrVisLayerId layerId) override; /** \details Notification method that is called when existing layer visibility state is changed. \param layerId [in] Identifier of layer. \param bVisibility [in] Visibility status. */ void onLayerVisibilityChanged(OdTrVisLayerId layerId, bool bVisibility) override; /** \details Notification method that is called when existing layer fading state is changed. \param layerId [in] Identifier of layer. \param bFade [in] Fade status. */ void onLayerFadingChanged(OdTrVisLayerId layerId, bool bFade) override; /** \details Notification method that is called when layer viewport-dependent properties are changed. \param layerId [in] Identifier of layer. \param viewportId [in] Viewport ID with which layer contains specific properties. \param bOverride [in] Flag that specifies whether layer properties should be overridden for specified viewport. \param pProps [in] Contains layer-specific overridden properties. */ void onLayerVpDepPropsOverride(OdTrVisLayerId layerId, OdTrVisViewportId viewportId, bool bOverride, const OdTrVisLayerProps &pProps = OdTrVisLayerProps()) override; // Extension objects /** \details Notification method that is called when new extension object is added. \param extId [in] Identifier of extension object to add. \param pObj [in] Pointer to an extension object. */ void onExtensionObjectAdded(OdTrVisExtensionId extId, const OdTrVisExtensionObject *pObj) override; /** \details Notification method that is called when existing extension object is deleted. \param extId [in] Identifier of extension object to delete. */ void onExtensionObjectDeleted(OdTrVisExtensionId extId) override; /** \details Notification method that is called to send special extension object specific data. \param extId [in] Identifier of extension object to delete. \param nDataId [in] Internal data entry identifier. \param propDef [in] Property definition. */ void onExtensionObjectSpecificData(OdTrVisExtensionId extId, OdUInt32 nDataId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called to change visibility state of extension object. \param extId [in] Identifier of extension object. \param bVisibility [in] Visibility status. */ void onExtensionObjectVisibilityChanged(OdTrVisExtensionId extId, bool bVisibility) override; // Blocks // Called when new block added. void onBlockAdded(OdTrVisBlockId blockId, const OdTrVisDisplayId *pList, OdUInt32 nEntries) override; // Called when block display list changed. void onBlockModified(OdTrVisBlockId blockId, OdUInt32 nInvalidFrom, OdUInt32 nInvalidLen, const OdTrVisDisplayId *pValidFrom, OdUInt32 nValidLen) override; // Called when exist block deleted. void onBlockDeleted(OdTrVisBlockId blockId) override; // Groups /** \details Notification method that is called when new group is added. \param groupId [in] Identifier of group to add. */ void onGroupAdded(OdTrVisGroupId groupId) override; /** \details Notification method that is called when new group is deleted. \param groupId [in] Identifier of group to delete. */ void onGroupDeleted(OdTrVisGroupId groupId) override; /** \details Notification method that is called when metafiles are attached to group. \param groupId [in] Identifier of group. \param pMetafilesList [in] Pointer to an array of metafiles to attach. \param nMetafiles [in] Number of metafiles to attach. */ void onGroupMetafilesAttached(OdTrVisGroupId groupId, const OdTrVisMetafileId *pMetafilesList, OdUInt32 nMetafiles) override; /** \details Notification method that is called when metafiles are detached from group. \param groupId [in] Identifier of group. \param pMetafilesList [in] Pointer to an array of metafiles to detach. \param nMetafiles [in] Number of metafiles to detach. \remarks If metafiles are not specified, clear entire list of groupped metafiles. */ void onGroupMetafilesDetached(OdTrVisGroupId groupId, const OdTrVisMetafileId *pMetafilesList, OdUInt32 nMetafiles) override; // Called to delete all groupped metafiles from graphics scene. //virtual void onGroupMetafilesDeleted(OdTrVisGroupId groupId); /** \details Notification method that is called when visibility state of groupped metafiles is changed. \param groupId [in] Identifier of group. \param bVisibility [in] Visibility status. */ void onGroupMetafilesVisibilityChanged(OdTrVisGroupId groupId, bool bVisibility) override; /** \details Notification method that is called when highlight state of groupped metafiles is changed. \param groupId [in] Identifier of group. \param bHighlight [in] Highlight status. */ void onGroupMetafilesHighlightingChanged(OdTrVisGroupId groupId, bool bHighlight) override; /** \details Notification method that is called when fade state of groupped metafiles is changed. \param groupId [in] Identifier of group. \param bFade [in] Fade status. */ void onGroupMetafilesFadingChanged(OdTrVisGroupId groupId, bool bFade) override; // Properties // Metafile-related properties. /** \details Notification method that is called when property is attached to a metafile. \param metafileId [in] Identifier of metafile object to attach additional data. \param propDef [in] Property definition. */ void onMetafilePropertyAttached(OdTrVisMetafileId metafileId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a metafile. \param metafileId [in] Identifier of metafile object to detach data. \param propType [in] Property type. */ void onMetafilePropertyDetached(OdTrVisMetafileId metafileId, OdTrVisPropertyDef::PropertyType propType) override; // Group-related properties. /** \details Notification method that is called when property is attached to a group. \param groupId [in] Identifier of group object to attach additional data. \param propDef [in] Property definition. */ void onGroupPropertyAttached(OdTrVisGroupId groupId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a group. \param groupId [in] Identifier of group object to detach data. \param propType [in] Property type. */ void onGroupPropertyDetached(OdTrVisGroupId groupId, OdTrVisPropertyDef::PropertyType propType) override; // Layer-related properties. /** \details Notification method that is called when property is attached to a layer. \param layerId [in] Identifier of layer to attach additional data. \param propDef [in] Property definition. */ void onLayerPropertyAttached(OdTrVisLayerId layerId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a layer. \param layerId [in] Identifier of layer to detach data. \param propType [in] Property type. */ void onLayerPropertyDetached(OdTrVisLayerId layerId, OdTrVisPropertyDef::PropertyType propType) override; // VisualStyle-related properties. /** \details Notification method that is called when property is attached to a visual style. \param visualStyleId [in] Identifier of visual style to attach additional data. \param propDef [in] Property definition. */ void onVisualStylePropertyAttached(OdTrVisVisualStyleId visualStyleId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a visual style. \param visualStyleId [in] Identifier of visual style to detach data. \param propType [in] Property type. */ void onVisualStylePropertyDetached(OdTrVisVisualStyleId visualStyleId, OdTrVisPropertyDef::PropertyType propType) override; // Material-related properties. /** \details Notification method that is called when property is attached to a material. \param materialId [in] Identifier of material to attach additional data. \param propDef [in] Property definition. */ void onMaterialPropertyAttached(OdTrVisMaterialId materialId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a material. \param visualStyleId [in] Identifier of material to detach data. \param propType [in] Property type. */ void onMaterialPropertyDetached(OdTrVisMaterialId materialId, OdTrVisPropertyDef::PropertyType propType) override; // Texture-related properties. /** \details Notification method that is called when property is attached to a texture. \param textureId [in] Identifier of texture to attach additional data. \param propDef [in] Property definition. */ void onTexturePropertyAttached(OdTrVisTextureId textureId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a texture. \param textureId [in] Identifier of material to detach data. \param propType [in] Property type. */ void onTexturePropertyDetached(OdTrVisTextureId textureId, OdTrVisPropertyDef::PropertyType propType) override; // Light-related properties. /** \details Notification method that is called when property is attached to a light source. \param lightId [in] Identifier of light source to attach additional data. \param propDef [in] Property definition. */ void onLightPropertyAttached(OdTrVisLightId lightId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a light source. \param lightId [in] Identifier of light source to detach data. \param propType [in] Property type. */ void onLightPropertyDetached(OdTrVisLightId lightId, OdTrVisPropertyDef::PropertyType propType) override; // StateBranch-related properties. /** \details Notification method that is called when property is attached to a state branch. \param stateBranchId [in] Identifier of state branch to attach additional data. \param propDef [in] Property definition. */ void onStateBranchPropertyAttached(OdTrVisStateBranchId stateBranchId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a state branch. \param stateBranchId [in] Identifier of light source to detach data. \param propType [in] Property type. */ void onStateBranchPropertyDetached(OdTrVisStateBranchId stateBranchId, OdTrVisPropertyDef::PropertyType propType) override; // Viewport-related properties. /** \details Notification method that is called when property is attached to a viewport. \param viewportId [in] Identifier of viewport to attach additional data. \param propDef [in] Property definition. */ void onViewportPropertyAttached(OdTrVisViewportId viewportId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from a viewport. \param viewportId [in] Identifier of viewport to detach data. \param propType [in] Property type. */ void onViewportPropertyDetached(OdTrVisViewportId viewportId, OdTrVisPropertyDef::PropertyType propType) override; // Overlay-related properties. /** \details Notification method that is called when property is attached to an overlay. \param overlayId [in] Identifier of overlay to attach additional data. \param propDef [in] Property definition. */ void onOverlayPropertyAttached(OdTrVisOverlayId overlayId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from an overlay. \param overlayId [in] Identifier of overlay to detach data. \param propType [in] Property type. */ void onOverlayPropertyDetached(OdTrVisOverlayId overlayId, OdTrVisPropertyDef::PropertyType propType) override; // ExtensionObject-related properties. /** \details Notification method that is called when property is attached to an extension object. \param extId [in] Identifier of extension object to attach additional data. \param propDef [in] Property definition. */ void onExtensionObjectPropertyAttached(OdTrVisExtensionId extId, const OdTrVisPropertyDef &propDef) override; /** \details Notification method that is called when property is detached from an extension object. \param overlayId [in] Identifier of extension object to detach data. \param propType [in] Property type. */ void onExtensionObjectPropertyDetached(OdTrVisExtensionId extId, OdTrVisPropertyDef::PropertyType propType) override; // Block-related properties. // Called to attach property to block. void onBlockPropertyAttached(OdTrVisBlockId blockId, const OdTrVisPropertyDef &propDef) override; // Called to detach property from viewport. void onBlockPropertyDetached(OdTrVisBlockId blockId, OdTrVisPropertyDef::PropertyType propType) override; protected: void beginDeviceProcessing(OdTrVisRenderClient *pDevice); void endDeviceProcessing(OdTrVisRenderClient *pDevice); OdTrVisRenderClient *processingDevice() const; bool isSupportCompositeMetafiles() const; bool isSupportVisualStyles() const; bool isSupportOverlayBuffers() const; bool idRegTraverseCallback(OdTrVisRendition::DataType type, OdTrVisId id, OdTrVisUniqueID *pRegId) override; void finalizeXmlServerUsage(); bool checkAwaitingCacheMetafie(OdTrVisMetafileId mfId, bool bRegister = true); bool checkDroppedCacheMetafile(OdTrVisMetafileId mfId) const; void dropExpectingCacheMetafiles(); struct DDL2ndPassInfo { bool m_bScan; OdUInt32 m_nTransFirst, m_nTransLast; DDL2ndPassInfo() : m_bScan(false), m_nTransFirst(0xFFFFFFFF), m_nTransLast(0xFFFFFFFF) { } }; bool DropDisplayList(const OdTrVisDisplayId *pDispList, OdUInt32 nListLen, DDL2ndPassInfo *p2ndPass = NULL); void DropDisplayList2ndPass(OdTrVisViewportId viewportId, OdTrVisOverlayId overlayId, OdUInt32 nInvalidFrom, const OdTrVisDisplayId *pDispList, OdUInt32 nListLen, DDL2ndPassInfo &p2ndPass); void onMetafileOrderChangedImpl(OdTrVisViewportId viewportId, OdTrVisOverlayId overlayId, OdUInt32 nInvalidFrom, OdUInt32 nInvalidLen, const OdTrVisDisplayId *pValidFrom, OdUInt32 nValidLen, bool bFirstPass = true); void onMetafileOrderInheritanceImpl( OdTrVisViewportId viewportId1, OdTrVisOverlayId overlayId1, OdTrVisViewportId viewportId2 ); void DropPropertyData(const OdTrVisPropertyDef &propDef); void DropMaterialChannel(const OdTrVisMaterialChannelDef &pChannel); void DropMaterialChannelComponent(const OdTrVisMaterialChannelComponent &pComponent); void DropSectionPlane(const OdTrVisSectionPlane &pSecPlane); void DropLightData(const OdTrVisLightDef &pLight, OdUInt32 nKindOf = 0xFFFFFFFF); void DropStateBranch(const OdTrVisStateBranchDef &pStateBranch, bool bDropChilds, bool bDropMarkers); void DropVisualStyleData(const OdTrVisVisualStyle &pVStyle, bool bDropNonModified = true); void DropLayerProps(const OdTrVisLayerProps &pLayerProps); void ParseMetafileStream(const OdTrVisFlatMetafileContainer *pMetafile); void OutputState(OdTrXmlServer::OutputState newState, bool bForce = false); static void DropViewParams(OdTrXmlServer *pXml, const OdTrVisViewParamsDef &pDef); void DropViewportData(const OdTrVisViewportDef &pDef, bool bDropOverallVpId = true); public: /** \details Parses metafile stream content. \param pXml [in] Pointer to Xml server. \param pMetafile [in] Pointer to metafile to parse. */ static void ParseMetafileStream(OdTrXmlServer *pXml, const OdTrVisFlatMetafileContainer *pMetafile) { OdSmartPtr res = OdRxObjectImpl::createObject(); res->setXmlServer((OdIntPtr)pXml); res->ParseMetafileStream(pMetafile); res->DropMetadata(pMetafile); } }; /** \details */ class OdTrXmlRenditionRedir : public OdTrVisRenditionRedir, protected OdTrVisRenditionRedir::IdRegistratorRedir { protected: OdStaticRxObject m_xmlRendition; OdStaticRxObject m_recorder; public: /** \details Default constructor for the OdTrXmlRenditionRedir class. */ OdTrXmlRenditionRedir() : OdTrVisRenditionRedir() { setRedirection(&m_recorder); setInformationalRedirection(&m_xmlRendition); setIdRegRedirection(m_recorder.idRegistrator()); m_xmlRendition.setRedirectionController(this); } void setupClientContext(OdTrRndLocalRenditionClient *pClient, OdTrRndRenderModule *pModule) { m_xmlRendition.setupClientContext(pClient, pModule); } void setForRecord() { setRedirection(&m_recorder); } bool isSetForRecord() const { return (getRedirection() == &m_recorder); } void setForPlay() { setRedirection(&m_xmlRendition); } bool isSetForPlay() const { return (getRedirection() == &m_xmlRendition); } void dropRecords() { m_recorder.playRecords(&m_xmlRendition, true); } OdTrXmlRendition &xmlRendition() { return m_xmlRendition; } const OdTrXmlRendition &xmlRendition() const { return m_xmlRendition; } // Returns Id registrator, or NULL if no registration supported OdTrVisRendition::IdRegistrator *idRegistrator() const override { if (isSetForRecord() && getInformationalRedirection()->idRegistrator()) return (OdTrVisRendition::IdRegistrator*)this; return getInformationalRedirection()->idRegistrator(); } protected: // IdRegistrator override OdTrVisUniqueID *get(DataType type, OdTrVisId id, bool bKill = false) const override { OdTrVisRenditionRedir::IdRegistratorRedir::get(type, id, bKill); return getInformationalRedirection()->idRegistrator()->get(type, id); } }; #include "TD_PackPop.h" #endif // ODTRXMLRENDITION