/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // XmlServer interface for GLES2 Xml device #ifndef ODTRXMLSERVER #define ODTRXMLSERVER #include "TD_PackPush.h" #include "Ge/GeMatrix3d.h" #include "RxObject.h" #include "TrVisIdMap.h" class OdDbStub; class OdTrVisUniqueID; class OdGsFiler; class OdTrXmlRendition; /** \details */ class OdTrXmlServer : public OdStaticRxObject { public: enum OutputState { /** Undefined state. */ kUndefState = 0, /** No actual data, GsUpdate initiated. */ kIntermediateState, /** Transient metafiles. */ kClientOnlyState, /** Viewports and surface settings. */ kClientDependentState, /** Metafiles and materials. */ kShareableState, /** Textures and shaders. */ kShareableClientState }; enum ProcessingMode { kSimpleMode = 0, kClientDependentSectionOnly, kShareableSectionOnly, kNormalMode }; enum IdType { kUnknownId = -1, kViewportId = 0, kMetafileId, kLightId, kTextureId, kMaterialId, kVertexShaderId, kFragmentShaderId, kProgramId, kStateBranchId, kVisualStyleId, kLayerId, kOverlayId, kGroupId, kExtensionId, kBlockId, kRefPlaneId, kDisplayId = kMetafileId }; enum IdSubType { kNoIdSubtype = 0, kViewportIdExtents = 1 }; struct IdMapping { IdType m_idType; OdUInt64 m_resId; OdTrVisUniqueID* m_pId; }; public: ODRX_HEAP_OPERATORS(); virtual void IncreaseNesting(const char* pLevelName) = 0; virtual void DecreaseNesting(const char* pLevelName) = 0; /** \details Writes data of boolean type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropBoolean(const char* pTagName, bool data) = 0; /** \details Writes data of boolean type with true value. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropBooleanOpt(const char* pTagName, bool data) { if (data) DropBoolean(pTagName, data); } virtual bool DropMetafileAdded(OdTrXmlRendition& /*rndn*/, OdTrVisMetafileId& /*metafileId*/, const OdTrVisMetafileDef &/*pDef*/) { return false; } /** \details Writes data of OdUInt8 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropUInt8(const char* pTagName, OdUInt8 data) = 0; /** \details Writes data of OdUInt16 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropUInt16(const char* pTagName, OdUInt16 data) { DropUInt32(pTagName, data); } /** \details Writes data of OdUInt32 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropUInt32(const char* pTagName, OdUInt32 data) = 0; /** \details Writes data of OdUInt64 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropUInt64(const char* pTagName, OdUInt64 data) = 0; /** \details Writes data of OdInt16 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropInt16(const char* pTagName, OdInt16 data) { DropInt32(pTagName, data); } /** \details Writes data of OdInt32 type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropInt32(const char* pTagName, OdInt32 data) = 0; /** \details Writes character data. \param pTagName [in] Tag name for the value. \param pStr [in] Data to write. */ virtual void DropChars(const char* pTagName, const char* pStr) = 0; /** \details Writes string data. \param pTagName [in] Tag name for the value. \param pStr [in] Data to write. */ virtual void DropString(const char* pTagName, const OdString &pStr); /** \details Writes data as array of values of OdUInt8 type. \param pTagName [in] Tag name for the value. \param nData [in] Number of values in the array. \param pData [in] Pointer to an array of values to write. */ virtual void DropUInt8s(const char* pTagName, OdUInt32 nData, const OdUInt8* pData) = 0; /** \details Writes data as array of values of OdUInt16 type. \param pTagName [in] Tag name for the value. \param nData [in] Number of values in the array. \param pData [in] Pointer to an array of values to write. */ virtual void DropUInt16s(const char* pTagName, OdUInt32 nData, const OdUInt16* pData) = 0; /** \details Writes data as array of values of OdUInt32 type. \param pTagName [in] Tag name for the value. \param nData [in] Number of values in the array. \param pData [in] Pointer to an array of values to write. */ virtual void DropUInt32s(const char* pTagName, OdUInt32 nData, const OdUInt32* pData) = 0; /** \details Writes data as array of values of float type. \param pTagName [in] Tag name for the value. \param nData [in] Number of values in the array. \param pData [in] Pointer to an array of values to write. */ virtual void DropFloats(const char* pTagName, OdUInt32 nData, const float* pData) = 0; /** \details Writes data as array of values of double type. \param pTagName [in] Tag name for the value. \param nData [in] Number of values in the array. \param pData [in] Pointer to an array of values to write. */ virtual void DropDoubles(const char* pTagName, OdUInt32 nData, const double* pData) = 0; /** \details Writes data of float type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropFloat(const char* pTagName, float data) = 0; /** \details Writes two values of float type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. */ virtual void DropFloat2(const char* pTagName, float data1, float data2) = 0; /** \details Writes three values of float type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. \param data3 [in] Data to write. */ virtual void DropFloat3(const char* pTagName, float data1, float data2, float data3) = 0; /** \details Writes four values of float type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. \param data3 [in] Data to write. \param data4 [in] Data to write. */ virtual void DropFloat4(const char* pTagName, float data1, float data2, float data3, float data4) = 0; /** \details Writes data of double type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropDouble(const char* pTagName, double data) { DropFloat(pTagName, (float)data); } /** \details Writes two values of double type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. */ virtual void DropDouble2(const char* pTagName, double data1, double data2) { DropFloat2(pTagName, (float)data1, (float)data2); } /** \details Writes three values of double type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. \param data3 [in] Data to write. */ virtual void DropDouble3(const char* pTagName, double data1, double data2, double data3) { DropFloat3(pTagName, (float)data1, (float)data2, (float)data3); } /** \details Writes four values of double type. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. \param data3 [in] Data to write. \param data4 [in] Data to write. */ virtual void DropDouble4(const char* pTagName, double data1, double data2, double data3, double data4) { DropFloat4(pTagName, (float)data1, (float)data2, (float)data3, (float)data4); } /** \details Writes four values of OdUInt8 type to represent red, green, blue and alpha color channels. \param pTagName [in] Tag name for the value. \param data1 [in] Data to write. \param data2 [in] Data to write. \param data3 [in] Data to write. \param data4 [in] Data to write. */ virtual void DropUInt8RGB(const char* pTagName, OdUInt8 data1, OdUInt8 data2, OdUInt8 data3, OdUInt8 data4) = 0; /** \details Writes data of OdGeMatrix3d type. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropMatrix(const char* pTagName, const OdGeMatrix3d& data) = 0; /** \details Writes binary stream data. \param pTagName [in] Tag name for the value. \param pData [in] Pointer to data to write. \param nData [in] Data length. */ virtual void DropBinaryStream(const char* pTagName, const OdUInt8* pData, OdUInt32 nData) = 0; /** \details Writes identifier data. \param pTagName [in] Tag name for the value. \param data [in] Data to write. */ virtual void DropId(const char* pTagName, OdUInt64 data, OdTrVisUniqueID* = NULL, OdInt32 = -1) { DropUInt64(pTagName, data); } /** \details Writes identifier of the owning database. \param pTagName [in] Tag name for the value. \param owningId [in] Data to write. */ virtual void DropDbOwning(const char* pTagName, OdTrVisOwning owningId) = 0; virtual void RegisterId(OdUInt64, OdTrVisUniqueID* = NULL, OdInt32 = -1) { } virtual void UnregisterId(OdUInt64, OdTrVisUniqueID* = NULL, OdInt32 = -1) { } /** \details Notification method that is called when output state is changed. \param newState [in] New output state. */ virtual void OnStateChanged(OutputState /*newState*/) { } virtual ProcessingMode ClientProcessingMode() const { return kNormalMode; } /** \details Saves current state of the server to a filer. \param pFiler [out] Pointer to a filer. */ virtual void saveState(OdGsFiler * /*pFiler*/) const { } /** \details Loads a state of the server from a filer. \param pFiler [in] Pointer to a filer. \param pIdMap [in] Pointer to an instance used for identifier mapping. */ virtual void loadState(OdGsFiler * /*pFiler*/, OdTrVisIdMap */*pIdMap*/) { } /** \details Sets the output stream buffer. \param buf [in] Pointer to a stream buffer. */ virtual void setOutput(class OdStreamBuf * /*buf*/) { } }; inline void OdTrXmlServer::DropString(const char *pTagName, const OdString &pStr) { OdAnsiCharArray utf8Str(pStr.getLength() * 4 + 1, 1); OdCharMapper::unicodeToUtf8(pStr.c_str(), pStr.getLength(), utf8Str); DropChars(pTagName, utf8Str.getPtr()); } //DOM-IGNORE-BEGIN /** \details */ class OdTrXmlServerStub : public OdTrXmlServer { public: void IncreaseNesting(const char* /*pLevelName*/) override { } void DecreaseNesting(const char* /*pLevelName*/) override { } void DropBoolean(const char* /*pTagName*/, bool /*data*/) override { } void DropUInt8(const char* /*pTagName*/, OdUInt8 /*data*/) override { } void DropUInt32(const char* /*pTagName*/, OdUInt32 /*data*/) override { } void DropUInt64(const char* /*pTagName*/, OdUInt64 /*data*/) override { } void DropInt32(const char* /*pTagName*/, OdInt32 /*data*/) override { } void DropChars(const char* /*pTagName*/, const char* /*pStr*/) override { } void DropUInt8s(const char* /*pTagName*/, OdUInt32 /*nData*/, const OdUInt8* /*pData*/) override { } void DropUInt16s(const char* /*pTagName*/, OdUInt32 /*nData*/, const OdUInt16* /*pData*/) override { } void DropUInt32s(const char* /*pTagName*/, OdUInt32 /*nData*/, const OdUInt32* /*pData*/) override { } void DropFloats(const char* /*pTagName*/, OdUInt32 /*nData*/, const float* /*pData*/) override { } void DropDoubles(const char* /*pTagName*/, OdUInt32 /*nData*/, const double* /*pData*/) override { } void DropFloat(const char* /*pTagName*/, float /*data*/) override { } void DropFloat2(const char* /*pTagName*/, float /*data1*/, float /*data2*/) override { } void DropFloat3(const char* /*pTagName*/, float /*data1*/, float /*data2*/, float /*data3*/) override { } void DropFloat4(const char* /*pTagName*/, float /*data1*/, float /*data2*/, float /*data3*/, float /*data4*/) override { } void DropUInt8RGB(const char* /*pTagName*/, OdUInt8 /*data1*/, OdUInt8 /*data2*/, OdUInt8 /*data3*/, OdUInt8 /*data4*/) override { } void DropMatrix(const char* /*pTagName*/, const OdGeMatrix3d& /*data*/) override { } void DropBinaryStream(const char* /*pTagName*/, const OdUInt8* /*pData*/, OdUInt32 /*nData*/) override { } void DropDbOwning(const char* /*pTagName*/, OdTrVisOwning /*owningId*/) override { } }; //DOM-IGNORE-END #include "TD_PackPop.h" #endif // ODTRXMLSERVER