diff --git a/ACT/LibMCEnv.xml b/ACT/LibMCEnv.xml index b3765a6b..267adfaf 100644 --- a/ACT/LibMCEnv.xml +++ b/ACT/LibMCEnv.xml @@ -997,7 +997,42 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1045,9 +1080,11 @@ + + + - - + diff --git a/Artifacts/clientdist/_githash_client.txt b/Artifacts/clientdist/_githash_client.txt index b121001f..c6172930 100644 --- a/Artifacts/clientdist/_githash_client.txt +++ b/Artifacts/clientdist/_githash_client.txt @@ -1 +1 @@ -3de30d7f59cc739433600475d8cef345fb174622 +544c5d51a9570433ce94e752dc4634fe0fa03e73 diff --git a/Artifacts/clientdist/clientpackage.zip b/Artifacts/clientdist/clientpackage.zip index 65d8f8fb..28e589af 100644 Binary files a/Artifacts/clientdist/clientpackage.zip and b/Artifacts/clientdist/clientpackage.zip differ diff --git a/Artifacts/clientdist/clientsourcepackage.zip b/Artifacts/clientdist/clientsourcepackage.zip index 50c9a5e6..b9d2a160 100644 Binary files a/Artifacts/clientdist/clientsourcepackage.zip and b/Artifacts/clientdist/clientsourcepackage.zip differ diff --git a/Client/src/common/AMCImplementation_LayerView.js b/Client/src/common/AMCImplementation_LayerView.js index b4de0441..8653ef5e 100644 --- a/Client/src/common/AMCImplementation_LayerView.js +++ b/Client/src/common/AMCImplementation_LayerView.js @@ -325,6 +325,31 @@ class LayerViewImpl { } } + + makeLaserOnColors () + { + this.laserOnPointsColorArray = null; + + if (this.laser && this.laser.laseron && this.layerPointsArray) { + + let pointCount = this.layerPointsArray.length / 2; + let colors = []; + + for (let pointIndex = 0; pointIndex < pointCount; pointIndex++) { + + let laseron = this.laser.laseron[pointIndex]; + + // laseron = 0 => Blue + // laseron = 1 => Red + const hue = laseron * 240 / 360; + + colors.push (this.hslToRgb (hue, 1.0, 0.5)); + } + + this.layerPointsColorArray = colors; + } + + } hslToRgb(h, s, l) { // Ensure h, s, l are in the range [0, 1] @@ -393,8 +418,17 @@ class LayerViewImpl { this.layerPointsMinVelocity = LAYERVIEW_MINVELOCITYRANGE; this.computeVelocities (); - this.updateColors (); - this.updateLayerPoints (); + } + + loadPointsChannelData(pointsChannelName, pointsColumnName, pointsChannelDataArray) { + + // Ensure the channel-level object exists + if (!Object.prototype.hasOwnProperty.call(this, pointsChannelName)) { + this[pointsChannelName] = {}; + } + + // Assign the data array to the corresponding column + this[pointsChannelName][pointsColumnName] = pointsChannelDataArray; } clearPoints () @@ -410,6 +444,16 @@ class LayerViewImpl { this.updateLayerPoints (); } + clearPointsChannelData (pointsChannelName) + { + // Ensure the channel-level object exists + if (Object.prototype.hasOwnProperty.call(this, pointsChannelName)) { + this[pointsChannelName] = {}; + } + + this.layerPointsColorArray = null; + } + updateColors () { this.layerPointsColorArray = null; @@ -422,6 +466,9 @@ class LayerViewImpl { this.makeVelocityColors (); } + if (this.layerPointsMode == "laseron") { + this.makeLaserOnColors (); + } } setColorMode (newColorMode) { diff --git a/Client/src/modules/AMCModule_LayerView.vue b/Client/src/modules/AMCModule_LayerView.vue index 84880195..7ebdc34f 100644 --- a/Client/src/modules/AMCModule_LayerView.vue +++ b/Client/src/modules/AMCModule_LayerView.vue @@ -154,11 +154,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. this.LayerViewerInstance.setColorMode ("velocity"); } else if (this.LayerViewerInstance.layerPointsMode == "velocity") { - this.LayerViewerInstance.setColorMode ("uniform"); + this.LayerViewerInstance.setColorMode ("laseron"); + } + else if (this.LayerViewerInstance.layerPointsMode == "laseron") { + this.LayerViewerInstance.setColorMode ("uniform"); } else { this.LayerViewerInstance.setColorMode ("time"); - } - + } }, onToggleToolpathClick: function () { @@ -233,6 +235,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (this.LayerViewerInstance.layerPointsMode == "velocity") { return "Color: Velocity"; } + + if (this.LayerViewerInstance.layerPointsMode == "laseron") { + return "Color: LaserOn"; + } return "Color: Uniform"; }, @@ -297,6 +303,86 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } } }, + + queryPoints: function (scatterplotuuid) + { + this.LayerViewerInstance.clearPoints (); + + return this.Application.axiosGetArrayBufferRequest("/ui/pointcloud/" + scatterplotuuid) + .then(responseData => { + let pointcoordinates = new Float32Array(responseData.data); + + if (this.LayerViewerInstance) { + this.LayerViewerInstance.loadPoints (pointcoordinates); + } + }) + .catch(err => { + if (err.response) { + console.log (err.response); + } else { + console.log ("fatal error while retrieving point cloud "); + } + if (this.LayerViewerInstance) { + this.LayerViewerInstance.RenderScene (true); + } + }); + }, + + queryPointsChannelData: function (scatterplotuuid, pointsChannelName) + { + this.LayerViewerInstance.clearPointsChannelData (pointsChannelName); + + return this.Application.axiosGetArrayBufferRequest("/ui/pointchanneldata/" + scatterplotuuid + "/" + pointsChannelName) + .then(responseData => { + + const contentType = responseData.headers['content-type']; + + if (contentType && contentType.includes("application/json")) { + + try { + const jsonText = new TextDecoder().decode(responseData.data); + + const parsed = JSON.parse(jsonText); + + if (parsed && typeof parsed === 'object') { + + for (const [key, value] of Object.entries(parsed)) { + + if (Array.isArray(value)) { + const floatArray = new Float32Array(value); + console.log(`Key "${key}" contains Float32Array with length: ${floatArray.length}`); + if (key.toLowerCase() === 'laseron') { + if (this.LayerViewerInstance) { + this.LayerViewerInstance.loadPointsChannelData ("laser", key.toLowerCase(), floatArray); + } else { + console.log(`${key}: ${floatArray.length}`); + } + } + } else { + console.warn(`Key "${key}" is not an array and will be ignored.`); + } + } + } else { + console.warn("Parsed JSON is not an object."); + } + } catch (e) { + console.error("Error while parsing JSON response:", e); + } + } else { + console.error("Error while parsing response: not a JSON"); + } + }) + .catch(err => { + if (err.response) { + console.log (err.response); + } else { + console.log ("fatal error while retrieving point cloud "); + } + if (this.LayerViewerInstance) { + this.LayerViewerInstance.RenderScene (true); + } + }); + }, onLayerChanged: function (sender) { @@ -333,45 +419,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // }); - if (platform.scatterplotuuid != "00000000-0000-0000-0000-000000000000") { - this.loadingScatterplot = true; - this.LayerViewerInstance.glInstance.removeElement("layerdata_points"); - this.LayerViewerInstance.clearPoints (); - - this.Application.axiosGetArrayBufferRequest("/ui/pointcloud/" + platform.scatterplotuuid) - .then(responseData => { - let pointcoordinates = new Float32Array(responseData.data); - - if (this.LayerViewerInstance) { - this.LayerViewerInstance.loadPoints (pointcoordinates); - } - - this.loadingScatterplot = false; - - }) - .catch(err => { - if (err.response) { - console.log (err.response); - } else { - console.log ("fatal error while retrieving point cloud "); - } - if (this.LayerViewerInstance) { - this.LayerViewerInstance.RenderScene (true); - } - - this.loadingScatterplot = false; - }); + this.loadingScatterplot = true; + this.LayerViewerInstance.glInstance.removeElement("layerdata_points"); + + Promise.all([ + this.queryPoints(platform.scatterplotuuid), + this.queryPointsChannelData(platform.scatterplotuuid, "laser") + ]).then(() => { + if (this.LayerViewerInstance && this.LayerViewerInstance.updateLayerPoints) { + this.LayerViewerInstance.updateColors (); + this.LayerViewerInstance.updateLayerPoints(); + } + }); + + this.loadingScatterplot = false; + } else { this.loadingScatterplot = false; this.LayerViewerInstance.glInstance.removeElement("layerdata_points"); + this.LayerViewerInstance.clearPoints (); - - - } - + this.LayerViewerInstance.clearPointsChannelData ("laser") + + } } } } diff --git a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp index 3ece391e..d2f5efac 100644 --- a/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp +++ b/Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp @@ -674,7 +674,7 @@ void CSMCJobInstance::ReadSimulationFile(LibMCEnv::PDataTable pDataTable) } } else if (version.m_nMajor == 1) { - if (version.m_nMinor == 0) + if (version.m_nMinor == 0 || version.m_nMinor == 1) { if (m_bSendToHardware) ReadLogRecordFile(pDataTable); diff --git a/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.h b/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.h index 89f2c2e0..f2b22490 100644 --- a/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.h +++ b/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.h @@ -964,6 +964,98 @@ typedef LibMCEnvResult (*PLibMCEnvDataTableCSVWriteOptions_GetSeparatorPtr) (Lib */ typedef LibMCEnvResult (*PLibMCEnvDataTableCSVWriteOptions_SetSeparatorPtr) (LibMCEnv_DataTableCSVWriteOptions pDataTableCSVWriteOptions, const char * pSeparator); +/************************************************************************************************************************* + Class definition for ScatterPlotDataColumn +**************************************************************************************************************************/ + +/** +* Returns the Column Identifier. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[in] nColumnIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pColumnIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pColumnIdentifierBuffer - buffer of Identifier of the column to use. Must be alphanumeric and not empty., may be NULL +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataColumn_GetColumnIdentifierPtr) (LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, const LibMCEnv_uint32 nColumnIdentifierBufferSize, LibMCEnv_uint32* pColumnIdentifierNeededChars, char * pColumnIdentifierBuffer); + +/** +* Returns Scale Factor to use. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[out] pScaleFactor - Scale factor to use. The channel value will be computed as raw value times scale factor plus offset factor. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataColumn_GetScaleFactorPtr) (LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pScaleFactor); + +/** +* Returns Offset Factor to use. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[out] pOffsetFactor - Offset factor to use. The channel value will be computed as raw value times scale factor plus offset factor. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataColumn_GetOffsetFactorPtr) (LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pOffsetFactor); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataColumnIterator +**************************************************************************************************************************/ + +/** +* Returns the Current Channel Column the iterator points at. +* +* @param[in] pScatterPlotDataColumnIterator - ScatterPlotDataColumnIterator instance. +* @param[out] pScatterPlotDataColumnInstance - returns the DataChannel instance. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumnPtr) (LibMCEnv_ScatterPlotDataColumnIterator pScatterPlotDataColumnIterator, LibMCEnv_ScatterPlotDataColumn * pScatterPlotDataColumnInstance); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataChannel +**************************************************************************************************************************/ + +/** +* Returns the Scatter Plot Data Channel Identifier. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[in] nChannelIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pChannelIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pChannelIdentifierBuffer - buffer of Identifier of the channel. Must be alphanumeric and not empty., may be NULL +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataChannel_GetChannelIdentifierPtr) (LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, const LibMCEnv_uint32 nChannelIdentifierBufferSize, LibMCEnv_uint32* pChannelIdentifierNeededChars, char * pChannelIdentifierBuffer); + +/** +* Adds a new Columns to the Data Channel. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[in] pColumnInstance - Column Instance +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataChannel_AddScatterPlotDataColumnPtr) (LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumn pColumnInstance); + +/** +* Lists all Columns of the Data Channel. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[out] pIteratorInstance - Iterator instance. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataChannel_ListScatterPlotDataColumnsPtr) (LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumnIterator * pIteratorInstance); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataChannelIterator +**************************************************************************************************************************/ + +/** +* Returns the Current Scatter Plot Data Channel the iterator points at. +* +* @param[in] pScatterPlotDataChannelIterator - ScatterPlotDataChannelIterator instance. +* @param[out] pScatterPlotDataChannelInstance - returns the ScatterPlotDataChannel instance. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannelPtr) (LibMCEnv_ScatterPlotDataChannelIterator pScatterPlotDataChannelIterator, LibMCEnv_ScatterPlotDataChannel * pScatterPlotDataChannelInstance); + /************************************************************************************************************************* Class definition for DataTableScatterPlotOptions **************************************************************************************************************************/ @@ -1061,6 +1153,15 @@ typedef LibMCEnvResult (*PLibMCEnvDataTableScatterPlotOptions_GetYAxisOffsetPtr) */ typedef LibMCEnvResult (*PLibMCEnvDataTableScatterPlotOptions_AddDataChannelPtr) (LibMCEnv_DataTableScatterPlotOptions pDataTableScatterPlotOptions, const char * pChannelIdentifier, const char * pColumnIdentifier, LibMCEnv_double dScaleFactor, LibMCEnv_double dOffsetFactor, LibMCEnv_uint32 nColor); +/** +* Lists all DataChannels of the ScatterPlot. +* +* @param[in] pDataTableScatterPlotOptions - DataTableScatterPlotOptions instance. +* @param[out] pIteratorInstance - Iterator instance. +* @return error code or 0 (success) +*/ +typedef LibMCEnvResult (*PLibMCEnvDataTableScatterPlotOptions_ListDataChannelsPtr) (LibMCEnv_DataTableScatterPlotOptions pDataTableScatterPlotOptions, LibMCEnv_ScatterPlotDataChannelIterator * pIteratorInstance); + /************************************************************************************************************************* Class definition for DataTable **************************************************************************************************************************/ @@ -10182,6 +10283,14 @@ typedef struct { PLibMCEnvDiscreteFieldData2D_DuplicatePtr m_DiscreteFieldData2D_Duplicate; PLibMCEnvDataTableCSVWriteOptions_GetSeparatorPtr m_DataTableCSVWriteOptions_GetSeparator; PLibMCEnvDataTableCSVWriteOptions_SetSeparatorPtr m_DataTableCSVWriteOptions_SetSeparator; + PLibMCEnvScatterPlotDataColumn_GetColumnIdentifierPtr m_ScatterPlotDataColumn_GetColumnIdentifier; + PLibMCEnvScatterPlotDataColumn_GetScaleFactorPtr m_ScatterPlotDataColumn_GetScaleFactor; + PLibMCEnvScatterPlotDataColumn_GetOffsetFactorPtr m_ScatterPlotDataColumn_GetOffsetFactor; + PLibMCEnvScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumnPtr m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn; + PLibMCEnvScatterPlotDataChannel_GetChannelIdentifierPtr m_ScatterPlotDataChannel_GetChannelIdentifier; + PLibMCEnvScatterPlotDataChannel_AddScatterPlotDataColumnPtr m_ScatterPlotDataChannel_AddScatterPlotDataColumn; + PLibMCEnvScatterPlotDataChannel_ListScatterPlotDataColumnsPtr m_ScatterPlotDataChannel_ListScatterPlotDataColumns; + PLibMCEnvScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannelPtr m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel; PLibMCEnvDataTableScatterPlotOptions_SetXAxisColumnPtr m_DataTableScatterPlotOptions_SetXAxisColumn; PLibMCEnvDataTableScatterPlotOptions_GetXAxisColumnPtr m_DataTableScatterPlotOptions_GetXAxisColumn; PLibMCEnvDataTableScatterPlotOptions_GetXAxisScalingPtr m_DataTableScatterPlotOptions_GetXAxisScaling; @@ -10191,6 +10300,7 @@ typedef struct { PLibMCEnvDataTableScatterPlotOptions_GetYAxisScalingPtr m_DataTableScatterPlotOptions_GetYAxisScaling; PLibMCEnvDataTableScatterPlotOptions_GetYAxisOffsetPtr m_DataTableScatterPlotOptions_GetYAxisOffset; PLibMCEnvDataTableScatterPlotOptions_AddDataChannelPtr m_DataTableScatterPlotOptions_AddDataChannel; + PLibMCEnvDataTableScatterPlotOptions_ListDataChannelsPtr m_DataTableScatterPlotOptions_ListDataChannels; PLibMCEnvDataTable_AddColumnPtr m_DataTable_AddColumn; PLibMCEnvDataTable_RemoveColumnPtr m_DataTable_RemoveColumn; PLibMCEnvDataTable_ClearPtr m_DataTable_Clear; diff --git a/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.hpp b/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.hpp index b997b39f..b5f9b7d3 100644 --- a/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.hpp +++ b/Framework/HeadersDev/CppDynamic/libmcenv_dynamic.hpp @@ -75,6 +75,10 @@ class CDiscreteFieldData2DStoreOptions; class CDiscreteFieldData2D; class CDataTableWriteOptions; class CDataTableCSVWriteOptions; +class CScatterPlotDataColumn; +class CScatterPlotDataColumnIterator; +class CScatterPlotDataChannel; +class CScatterPlotDataChannelIterator; class CDataTableScatterPlotOptions; class CDataTable; class CDataSeries; @@ -150,6 +154,10 @@ typedef CDiscreteFieldData2DStoreOptions CLibMCEnvDiscreteFieldData2DStoreOption typedef CDiscreteFieldData2D CLibMCEnvDiscreteFieldData2D; typedef CDataTableWriteOptions CLibMCEnvDataTableWriteOptions; typedef CDataTableCSVWriteOptions CLibMCEnvDataTableCSVWriteOptions; +typedef CScatterPlotDataColumn CLibMCEnvScatterPlotDataColumn; +typedef CScatterPlotDataColumnIterator CLibMCEnvScatterPlotDataColumnIterator; +typedef CScatterPlotDataChannel CLibMCEnvScatterPlotDataChannel; +typedef CScatterPlotDataChannelIterator CLibMCEnvScatterPlotDataChannelIterator; typedef CDataTableScatterPlotOptions CLibMCEnvDataTableScatterPlotOptions; typedef CDataTable CLibMCEnvDataTable; typedef CDataSeries CLibMCEnvDataSeries; @@ -225,6 +233,10 @@ typedef std::shared_ptr PDiscreteFieldData2DSt typedef std::shared_ptr PDiscreteFieldData2D; typedef std::shared_ptr PDataTableWriteOptions; typedef std::shared_ptr PDataTableCSVWriteOptions; +typedef std::shared_ptr PScatterPlotDataColumn; +typedef std::shared_ptr PScatterPlotDataColumnIterator; +typedef std::shared_ptr PScatterPlotDataChannel; +typedef std::shared_ptr PScatterPlotDataChannelIterator; typedef std::shared_ptr PDataTableScatterPlotOptions; typedef std::shared_ptr PDataTable; typedef std::shared_ptr PDataSeries; @@ -300,6 +312,10 @@ typedef PDiscreteFieldData2DStoreOptions PLibMCEnvDiscreteFieldData2DStoreOption typedef PDiscreteFieldData2D PLibMCEnvDiscreteFieldData2D; typedef PDataTableWriteOptions PLibMCEnvDataTableWriteOptions; typedef PDataTableCSVWriteOptions PLibMCEnvDataTableCSVWriteOptions; +typedef PScatterPlotDataColumn PLibMCEnvScatterPlotDataColumn; +typedef PScatterPlotDataColumnIterator PLibMCEnvScatterPlotDataColumnIterator; +typedef PScatterPlotDataChannel PLibMCEnvScatterPlotDataChannel; +typedef PScatterPlotDataChannelIterator PLibMCEnvScatterPlotDataChannelIterator; typedef PDataTableScatterPlotOptions PLibMCEnvDataTableScatterPlotOptions; typedef PDataTable PLibMCEnvDataTable; typedef PDataSeries PLibMCEnvDataSeries; @@ -1063,6 +1079,10 @@ class CWrapper { friend class CDiscreteFieldData2D; friend class CDataTableWriteOptions; friend class CDataTableCSVWriteOptions; + friend class CScatterPlotDataColumn; + friend class CScatterPlotDataColumnIterator; + friend class CScatterPlotDataChannel; + friend class CScatterPlotDataChannelIterator; friend class CDataTableScatterPlotOptions; friend class CDataTable; friend class CDataSeries; @@ -1495,6 +1515,78 @@ class CDataTableCSVWriteOptions : public CBase { inline void SetSeparator(const std::string & sSeparator); }; +/************************************************************************************************************************* + Class CScatterPlotDataColumn +**************************************************************************************************************************/ +class CScatterPlotDataColumn : public CBase { +public: + + /** + * CScatterPlotDataColumn::CScatterPlotDataColumn - Constructor for ScatterPlotDataColumn class. + */ + CScatterPlotDataColumn(CWrapper* pWrapper, LibMCEnvHandle pHandle) + : CBase(pWrapper, pHandle) + { + } + + inline std::string GetColumnIdentifier(); + inline LibMCEnv_double GetScaleFactor(); + inline LibMCEnv_double GetOffsetFactor(); +}; + +/************************************************************************************************************************* + Class CScatterPlotDataColumnIterator +**************************************************************************************************************************/ +class CScatterPlotDataColumnIterator : public CIterator { +public: + + /** + * CScatterPlotDataColumnIterator::CScatterPlotDataColumnIterator - Constructor for ScatterPlotDataColumnIterator class. + */ + CScatterPlotDataColumnIterator(CWrapper* pWrapper, LibMCEnvHandle pHandle) + : CIterator(pWrapper, pHandle) + { + } + + inline PScatterPlotDataColumn GetCurrentScatterPlotDataColumn(); +}; + +/************************************************************************************************************************* + Class CScatterPlotDataChannel +**************************************************************************************************************************/ +class CScatterPlotDataChannel : public CBase { +public: + + /** + * CScatterPlotDataChannel::CScatterPlotDataChannel - Constructor for ScatterPlotDataChannel class. + */ + CScatterPlotDataChannel(CWrapper* pWrapper, LibMCEnvHandle pHandle) + : CBase(pWrapper, pHandle) + { + } + + inline std::string GetChannelIdentifier(); + inline void AddScatterPlotDataColumn(classParam pColumnInstance); + inline PScatterPlotDataColumnIterator ListScatterPlotDataColumns(); +}; + +/************************************************************************************************************************* + Class CScatterPlotDataChannelIterator +**************************************************************************************************************************/ +class CScatterPlotDataChannelIterator : public CIterator { +public: + + /** + * CScatterPlotDataChannelIterator::CScatterPlotDataChannelIterator - Constructor for ScatterPlotDataChannelIterator class. + */ + CScatterPlotDataChannelIterator(CWrapper* pWrapper, LibMCEnvHandle pHandle) + : CIterator(pWrapper, pHandle) + { + } + + inline PScatterPlotDataChannel GetCurrentScatterPlotDataChannel(); +}; + /************************************************************************************************************************* Class CDataTableScatterPlotOptions **************************************************************************************************************************/ @@ -1518,6 +1610,7 @@ class CDataTableScatterPlotOptions : public CBase { inline LibMCEnv_double GetYAxisScaling(); inline LibMCEnv_double GetYAxisOffset(); inline void AddDataChannel(const std::string & sChannelIdentifier, const std::string & sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor, const LibMCEnv_uint32 nColor); + inline PScatterPlotDataChannelIterator ListDataChannels(); }; /************************************************************************************************************************* @@ -3372,6 +3465,14 @@ class CUIEnvironment : public CBase { pWrapperTable->m_DiscreteFieldData2D_Duplicate = nullptr; pWrapperTable->m_DataTableCSVWriteOptions_GetSeparator = nullptr; pWrapperTable->m_DataTableCSVWriteOptions_SetSeparator = nullptr; + pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier = nullptr; + pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor = nullptr; + pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor = nullptr; + pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn = nullptr; + pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier = nullptr; + pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn = nullptr; + pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns = nullptr; + pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel = nullptr; pWrapperTable->m_DataTableScatterPlotOptions_SetXAxisColumn = nullptr; pWrapperTable->m_DataTableScatterPlotOptions_GetXAxisColumn = nullptr; pWrapperTable->m_DataTableScatterPlotOptions_GetXAxisScaling = nullptr; @@ -3381,6 +3482,7 @@ class CUIEnvironment : public CBase { pWrapperTable->m_DataTableScatterPlotOptions_GetYAxisScaling = nullptr; pWrapperTable->m_DataTableScatterPlotOptions_GetYAxisOffset = nullptr; pWrapperTable->m_DataTableScatterPlotOptions_AddDataChannel = nullptr; + pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels = nullptr; pWrapperTable->m_DataTable_AddColumn = nullptr; pWrapperTable->m_DataTable_RemoveColumn = nullptr; pWrapperTable->m_DataTable_Clear = nullptr; @@ -4983,6 +5085,78 @@ class CUIEnvironment : public CBase { if (pWrapperTable->m_DataTableCSVWriteOptions_SetSeparator == nullptr) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier = (PLibMCEnvScatterPlotDataColumn_GetColumnIdentifierPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatacolumn_getcolumnidentifier"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier = (PLibMCEnvScatterPlotDataColumn_GetColumnIdentifierPtr) dlsym(hLibrary, "libmcenv_scatterplotdatacolumn_getcolumnidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor = (PLibMCEnvScatterPlotDataColumn_GetScaleFactorPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatacolumn_getscalefactor"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor = (PLibMCEnvScatterPlotDataColumn_GetScaleFactorPtr) dlsym(hLibrary, "libmcenv_scatterplotdatacolumn_getscalefactor"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor = (PLibMCEnvScatterPlotDataColumn_GetOffsetFactorPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatacolumn_getoffsetfactor"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor = (PLibMCEnvScatterPlotDataColumn_GetOffsetFactorPtr) dlsym(hLibrary, "libmcenv_scatterplotdatacolumn_getoffsetfactor"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn = (PLibMCEnvScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumnPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn = (PLibMCEnvScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumnPtr) dlsym(hLibrary, "libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier = (PLibMCEnvScatterPlotDataChannel_GetChannelIdentifierPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatachannel_getchannelidentifier"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier = (PLibMCEnvScatterPlotDataChannel_GetChannelIdentifierPtr) dlsym(hLibrary, "libmcenv_scatterplotdatachannel_getchannelidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn = (PLibMCEnvScatterPlotDataChannel_AddScatterPlotDataColumnPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatachannel_addscatterplotdatacolumn"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn = (PLibMCEnvScatterPlotDataChannel_AddScatterPlotDataColumnPtr) dlsym(hLibrary, "libmcenv_scatterplotdatachannel_addscatterplotdatacolumn"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns = (PLibMCEnvScatterPlotDataChannel_ListScatterPlotDataColumnsPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatachannel_listscatterplotdatacolumns"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns = (PLibMCEnvScatterPlotDataChannel_ListScatterPlotDataColumnsPtr) dlsym(hLibrary, "libmcenv_scatterplotdatachannel_listscatterplotdatacolumns"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel = (PLibMCEnvScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannelPtr) GetProcAddress(hLibrary, "libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel"); + #else // _WIN32 + pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel = (PLibMCEnvScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannelPtr) dlsym(hLibrary, "libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_DataTableScatterPlotOptions_SetXAxisColumn = (PLibMCEnvDataTableScatterPlotOptions_SetXAxisColumnPtr) GetProcAddress(hLibrary, "libmcenv_datatablescatterplotoptions_setxaxiscolumn"); #else // _WIN32 @@ -5064,6 +5238,15 @@ class CUIEnvironment : public CBase { if (pWrapperTable->m_DataTableScatterPlotOptions_AddDataChannel == nullptr) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels = (PLibMCEnvDataTableScatterPlotOptions_ListDataChannelsPtr) GetProcAddress(hLibrary, "libmcenv_datatablescatterplotoptions_listdatachannels"); + #else // _WIN32 + pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels = (PLibMCEnvDataTableScatterPlotOptions_ListDataChannelsPtr) dlsym(hLibrary, "libmcenv_datatablescatterplotoptions_listdatachannels"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels == nullptr) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_DataTable_AddColumn = (PLibMCEnvDataTable_AddColumnPtr) GetProcAddress(hLibrary, "libmcenv_datatable_addcolumn"); #else // _WIN32 @@ -13042,6 +13225,38 @@ class CUIEnvironment : public CBase { if ( (eLookupError != 0) || (pWrapperTable->m_DataTableCSVWriteOptions_SetSeparator == nullptr) ) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcenv_scatterplotdatacolumn_getcolumnidentifier", (void**)&(pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataColumn_GetColumnIdentifier == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatacolumn_getscalefactor", (void**)&(pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataColumn_GetScaleFactor == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatacolumn_getoffsetfactor", (void**)&(pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataColumn_GetOffsetFactor == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn", (void**)&(pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatachannel_getchannelidentifier", (void**)&(pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataChannel_GetChannelIdentifier == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatachannel_addscatterplotdatacolumn", (void**)&(pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataChannel_AddScatterPlotDataColumn == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatachannel_listscatterplotdatacolumns", (void**)&(pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataChannel_ListScatterPlotDataColumns == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel", (void**)&(pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel)); + if ( (eLookupError != 0) || (pWrapperTable->m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcenv_datatablescatterplotoptions_setxaxiscolumn", (void**)&(pWrapperTable->m_DataTableScatterPlotOptions_SetXAxisColumn)); if ( (eLookupError != 0) || (pWrapperTable->m_DataTableScatterPlotOptions_SetXAxisColumn == nullptr) ) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -13078,6 +13293,10 @@ class CUIEnvironment : public CBase { if ( (eLookupError != 0) || (pWrapperTable->m_DataTableScatterPlotOptions_AddDataChannel == nullptr) ) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcenv_datatablescatterplotoptions_listdatachannels", (void**)&(pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels)); + if ( (eLookupError != 0) || (pWrapperTable->m_DataTableScatterPlotOptions_ListDataChannels == nullptr) ) + return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("libmcenv_datatable_addcolumn", (void**)&(pWrapperTable->m_DataTable_AddColumn)); if ( (eLookupError != 0) || (pWrapperTable->m_DataTable_AddColumn == nullptr) ) return LIBMCENV_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -17550,6 +17769,131 @@ class CUIEnvironment : public CBase { CheckError(m_pWrapper->m_WrapperTable.m_DataTableCSVWriteOptions_SetSeparator(m_pHandle, sSeparator.c_str())); } + /** + * Method definitions for class CScatterPlotDataColumn + */ + + /** + * CScatterPlotDataColumn::GetColumnIdentifier - Returns the Column Identifier. + * @return Identifier of the column to use. Must be alphanumeric and not empty. + */ + std::string CScatterPlotDataColumn::GetColumnIdentifier() + { + LibMCEnv_uint32 bytesNeededColumnIdentifier = 0; + LibMCEnv_uint32 bytesWrittenColumnIdentifier = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataColumn_GetColumnIdentifier(m_pHandle, 0, &bytesNeededColumnIdentifier, nullptr)); + std::vector bufferColumnIdentifier(bytesNeededColumnIdentifier); + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataColumn_GetColumnIdentifier(m_pHandle, bytesNeededColumnIdentifier, &bytesWrittenColumnIdentifier, &bufferColumnIdentifier[0])); + + return std::string(&bufferColumnIdentifier[0]); + } + + /** + * CScatterPlotDataColumn::GetScaleFactor - Returns Scale Factor to use. + * @return Scale factor to use. The channel value will be computed as raw value times scale factor plus offset factor. + */ + LibMCEnv_double CScatterPlotDataColumn::GetScaleFactor() + { + LibMCEnv_double resultScaleFactor = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataColumn_GetScaleFactor(m_pHandle, &resultScaleFactor)); + + return resultScaleFactor; + } + + /** + * CScatterPlotDataColumn::GetOffsetFactor - Returns Offset Factor to use. + * @return Offset factor to use. The channel value will be computed as raw value times scale factor plus offset factor. + */ + LibMCEnv_double CScatterPlotDataColumn::GetOffsetFactor() + { + LibMCEnv_double resultOffsetFactor = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataColumn_GetOffsetFactor(m_pHandle, &resultOffsetFactor)); + + return resultOffsetFactor; + } + + /** + * Method definitions for class CScatterPlotDataColumnIterator + */ + + /** + * CScatterPlotDataColumnIterator::GetCurrentScatterPlotDataColumn - Returns the Current Channel Column the iterator points at. + * @return returns the DataChannel instance. + */ + PScatterPlotDataColumn CScatterPlotDataColumnIterator::GetCurrentScatterPlotDataColumn() + { + LibMCEnvHandle hScatterPlotDataColumnInstance = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataColumnIterator_GetCurrentScatterPlotDataColumn(m_pHandle, &hScatterPlotDataColumnInstance)); + + if (!hScatterPlotDataColumnInstance) { + CheckError(LIBMCENV_ERROR_INVALIDPARAM); + } + return std::make_shared(m_pWrapper, hScatterPlotDataColumnInstance); + } + + /** + * Method definitions for class CScatterPlotDataChannel + */ + + /** + * CScatterPlotDataChannel::GetChannelIdentifier - Returns the Scatter Plot Data Channel Identifier. + * @return Identifier of the channel. Must be alphanumeric and not empty. + */ + std::string CScatterPlotDataChannel::GetChannelIdentifier() + { + LibMCEnv_uint32 bytesNeededChannelIdentifier = 0; + LibMCEnv_uint32 bytesWrittenChannelIdentifier = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataChannel_GetChannelIdentifier(m_pHandle, 0, &bytesNeededChannelIdentifier, nullptr)); + std::vector bufferChannelIdentifier(bytesNeededChannelIdentifier); + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataChannel_GetChannelIdentifier(m_pHandle, bytesNeededChannelIdentifier, &bytesWrittenChannelIdentifier, &bufferChannelIdentifier[0])); + + return std::string(&bufferChannelIdentifier[0]); + } + + /** + * CScatterPlotDataChannel::AddScatterPlotDataColumn - Adds a new Columns to the Data Channel. + * @param[in] pColumnInstance - Column Instance + */ + void CScatterPlotDataChannel::AddScatterPlotDataColumn(classParam pColumnInstance) + { + LibMCEnvHandle hColumnInstance = pColumnInstance.GetHandle(); + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataChannel_AddScatterPlotDataColumn(m_pHandle, hColumnInstance)); + } + + /** + * CScatterPlotDataChannel::ListScatterPlotDataColumns - Lists all Columns of the Data Channel. + * @return Iterator instance. + */ + PScatterPlotDataColumnIterator CScatterPlotDataChannel::ListScatterPlotDataColumns() + { + LibMCEnvHandle hIteratorInstance = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataChannel_ListScatterPlotDataColumns(m_pHandle, &hIteratorInstance)); + + if (!hIteratorInstance) { + CheckError(LIBMCENV_ERROR_INVALIDPARAM); + } + return std::make_shared(m_pWrapper, hIteratorInstance); + } + + /** + * Method definitions for class CScatterPlotDataChannelIterator + */ + + /** + * CScatterPlotDataChannelIterator::GetCurrentScatterPlotDataChannel - Returns the Current Scatter Plot Data Channel the iterator points at. + * @return returns the ScatterPlotDataChannel instance. + */ + PScatterPlotDataChannel CScatterPlotDataChannelIterator::GetCurrentScatterPlotDataChannel() + { + LibMCEnvHandle hScatterPlotDataChannelInstance = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_ScatterPlotDataChannelIterator_GetCurrentScatterPlotDataChannel(m_pHandle, &hScatterPlotDataChannelInstance)); + + if (!hScatterPlotDataChannelInstance) { + CheckError(LIBMCENV_ERROR_INVALIDPARAM); + } + return std::make_shared(m_pWrapper, hScatterPlotDataChannelInstance); + } + /** * Method definitions for class CDataTableScatterPlotOptions */ @@ -17667,6 +18011,21 @@ class CUIEnvironment : public CBase { CheckError(m_pWrapper->m_WrapperTable.m_DataTableScatterPlotOptions_AddDataChannel(m_pHandle, sChannelIdentifier.c_str(), sColumnIdentifier.c_str(), dScaleFactor, dOffsetFactor, nColor)); } + /** + * CDataTableScatterPlotOptions::ListDataChannels - Lists all DataChannels of the ScatterPlot. + * @return Iterator instance. + */ + PScatterPlotDataChannelIterator CDataTableScatterPlotOptions::ListDataChannels() + { + LibMCEnvHandle hIteratorInstance = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_DataTableScatterPlotOptions_ListDataChannels(m_pHandle, &hIteratorInstance)); + + if (!hIteratorInstance) { + CheckError(LIBMCENV_ERROR_INVALIDPARAM); + } + return std::make_shared(m_pWrapper, hIteratorInstance); + } + /** * Method definitions for class CDataTable */ diff --git a/Framework/HeadersDev/CppDynamic/libmcenv_types.hpp b/Framework/HeadersDev/CppDynamic/libmcenv_types.hpp index c1765408..8ee9a94b 100644 --- a/Framework/HeadersDev/CppDynamic/libmcenv_types.hpp +++ b/Framework/HeadersDev/CppDynamic/libmcenv_types.hpp @@ -618,6 +618,10 @@ typedef LibMCEnvHandle LibMCEnv_DiscreteFieldData2DStoreOptions; typedef LibMCEnvHandle LibMCEnv_DiscreteFieldData2D; typedef LibMCEnvHandle LibMCEnv_DataTableWriteOptions; typedef LibMCEnvHandle LibMCEnv_DataTableCSVWriteOptions; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataColumn; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataColumnIterator; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataChannel; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataChannelIterator; typedef LibMCEnvHandle LibMCEnv_DataTableScatterPlotOptions; typedef LibMCEnvHandle LibMCEnv_DataTable; typedef LibMCEnvHandle LibMCEnv_DataSeries; diff --git a/Framework/InterfacesCore/libmcenv_abi.hpp b/Framework/InterfacesCore/libmcenv_abi.hpp index c8a56302..d4b511fa 100644 --- a/Framework/InterfacesCore/libmcenv_abi.hpp +++ b/Framework/InterfacesCore/libmcenv_abi.hpp @@ -977,6 +977,98 @@ LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_datatablecsvwriteoptions_getseparator( */ LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_datatablecsvwriteoptions_setseparator(LibMCEnv_DataTableCSVWriteOptions pDataTableCSVWriteOptions, const char * pSeparator); +/************************************************************************************************************************* + Class definition for ScatterPlotDataColumn +**************************************************************************************************************************/ + +/** +* Returns the Column Identifier. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[in] nColumnIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pColumnIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pColumnIdentifierBuffer - buffer of Identifier of the column to use. Must be alphanumeric and not empty., may be NULL +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatacolumn_getcolumnidentifier(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, const LibMCEnv_uint32 nColumnIdentifierBufferSize, LibMCEnv_uint32* pColumnIdentifierNeededChars, char * pColumnIdentifierBuffer); + +/** +* Returns Scale Factor to use. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[out] pScaleFactor - Scale factor to use. The channel value will be computed as raw value times scale factor plus offset factor. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatacolumn_getscalefactor(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pScaleFactor); + +/** +* Returns Offset Factor to use. +* +* @param[in] pScatterPlotDataColumn - ScatterPlotDataColumn instance. +* @param[out] pOffsetFactor - Offset factor to use. The channel value will be computed as raw value times scale factor plus offset factor. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatacolumn_getoffsetfactor(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pOffsetFactor); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataColumnIterator +**************************************************************************************************************************/ + +/** +* Returns the Current Channel Column the iterator points at. +* +* @param[in] pScatterPlotDataColumnIterator - ScatterPlotDataColumnIterator instance. +* @param[out] pScatterPlotDataColumnInstance - returns the DataChannel instance. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn(LibMCEnv_ScatterPlotDataColumnIterator pScatterPlotDataColumnIterator, LibMCEnv_ScatterPlotDataColumn * pScatterPlotDataColumnInstance); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataChannel +**************************************************************************************************************************/ + +/** +* Returns the Scatter Plot Data Channel Identifier. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[in] nChannelIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pChannelIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pChannelIdentifierBuffer - buffer of Identifier of the channel. Must be alphanumeric and not empty., may be NULL +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatachannel_getchannelidentifier(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, const LibMCEnv_uint32 nChannelIdentifierBufferSize, LibMCEnv_uint32* pChannelIdentifierNeededChars, char * pChannelIdentifierBuffer); + +/** +* Adds a new Columns to the Data Channel. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[in] pColumnInstance - Column Instance +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatachannel_addscatterplotdatacolumn(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumn pColumnInstance); + +/** +* Lists all Columns of the Data Channel. +* +* @param[in] pScatterPlotDataChannel - ScatterPlotDataChannel instance. +* @param[out] pIteratorInstance - Iterator instance. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatachannel_listscatterplotdatacolumns(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumnIterator * pIteratorInstance); + +/************************************************************************************************************************* + Class definition for ScatterPlotDataChannelIterator +**************************************************************************************************************************/ + +/** +* Returns the Current Scatter Plot Data Channel the iterator points at. +* +* @param[in] pScatterPlotDataChannelIterator - ScatterPlotDataChannelIterator instance. +* @param[out] pScatterPlotDataChannelInstance - returns the ScatterPlotDataChannel instance. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel(LibMCEnv_ScatterPlotDataChannelIterator pScatterPlotDataChannelIterator, LibMCEnv_ScatterPlotDataChannel * pScatterPlotDataChannelInstance); + /************************************************************************************************************************* Class definition for DataTableScatterPlotOptions **************************************************************************************************************************/ @@ -1074,6 +1166,15 @@ LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_datatablescatterplotoptions_getyaxisof */ LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_datatablescatterplotoptions_adddatachannel(LibMCEnv_DataTableScatterPlotOptions pDataTableScatterPlotOptions, const char * pChannelIdentifier, const char * pColumnIdentifier, LibMCEnv_double dScaleFactor, LibMCEnv_double dOffsetFactor, LibMCEnv_uint32 nColor); +/** +* Lists all DataChannels of the ScatterPlot. +* +* @param[in] pDataTableScatterPlotOptions - DataTableScatterPlotOptions instance. +* @param[out] pIteratorInstance - Iterator instance. +* @return error code or 0 (success) +*/ +LIBMCENV_DECLSPEC LibMCEnvResult libmcenv_datatablescatterplotoptions_listdatachannels(LibMCEnv_DataTableScatterPlotOptions pDataTableScatterPlotOptions, LibMCEnv_ScatterPlotDataChannelIterator * pIteratorInstance); + /************************************************************************************************************************* Class definition for DataTable **************************************************************************************************************************/ diff --git a/Framework/InterfacesCore/libmcenv_interfaces.hpp b/Framework/InterfacesCore/libmcenv_interfaces.hpp index f1a6f774..b4cbbe32 100644 --- a/Framework/InterfacesCore/libmcenv_interfaces.hpp +++ b/Framework/InterfacesCore/libmcenv_interfaces.hpp @@ -70,6 +70,10 @@ class IDiscreteFieldData2DStoreOptions; class IDiscreteFieldData2D; class IDataTableWriteOptions; class IDataTableCSVWriteOptions; +class IScatterPlotDataColumn; +class IScatterPlotDataColumnIterator; +class IScatterPlotDataChannel; +class IScatterPlotDataChannelIterator; class IDataTableScatterPlotOptions; class IDataTable; class IDataSeries; @@ -1120,6 +1124,98 @@ class IDataTableCSVWriteOptions : public virtual IBase { typedef IBaseSharedPtr PIDataTableCSVWriteOptions; +/************************************************************************************************************************* + Class interface for ScatterPlotDataColumn +**************************************************************************************************************************/ + +class IScatterPlotDataColumn : public virtual IBase { +public: + /** + * IScatterPlotDataColumn::GetColumnIdentifier - Returns the Column Identifier. + * @return Identifier of the column to use. Must be alphanumeric and not empty. + */ + virtual std::string GetColumnIdentifier() = 0; + + /** + * IScatterPlotDataColumn::GetScaleFactor - Returns Scale Factor to use. + * @return Scale factor to use. The channel value will be computed as raw value times scale factor plus offset factor. + */ + virtual LibMCEnv_double GetScaleFactor() = 0; + + /** + * IScatterPlotDataColumn::GetOffsetFactor - Returns Offset Factor to use. + * @return Offset factor to use. The channel value will be computed as raw value times scale factor plus offset factor. + */ + virtual LibMCEnv_double GetOffsetFactor() = 0; + +}; + +typedef IBaseSharedPtr PIScatterPlotDataColumn; + + +/************************************************************************************************************************* + Class interface for ScatterPlotDataColumnIterator +**************************************************************************************************************************/ + +class IScatterPlotDataColumnIterator : public virtual IIterator { +public: + /** + * IScatterPlotDataColumnIterator::GetCurrentScatterPlotDataColumn - Returns the Current Channel Column the iterator points at. + * @return returns the DataChannel instance. + */ + virtual IScatterPlotDataColumn * GetCurrentScatterPlotDataColumn() = 0; + +}; + +typedef IBaseSharedPtr PIScatterPlotDataColumnIterator; + + +/************************************************************************************************************************* + Class interface for ScatterPlotDataChannel +**************************************************************************************************************************/ + +class IScatterPlotDataChannel : public virtual IBase { +public: + /** + * IScatterPlotDataChannel::GetChannelIdentifier - Returns the Scatter Plot Data Channel Identifier. + * @return Identifier of the channel. Must be alphanumeric and not empty. + */ + virtual std::string GetChannelIdentifier() = 0; + + /** + * IScatterPlotDataChannel::AddScatterPlotDataColumn - Adds a new Columns to the Data Channel. + * @param[in] pColumnInstance - Column Instance + */ + virtual void AddScatterPlotDataColumn(IScatterPlotDataColumn* pColumnInstance) = 0; + + /** + * IScatterPlotDataChannel::ListScatterPlotDataColumns - Lists all Columns of the Data Channel. + * @return Iterator instance. + */ + virtual IScatterPlotDataColumnIterator * ListScatterPlotDataColumns() = 0; + +}; + +typedef IBaseSharedPtr PIScatterPlotDataChannel; + + +/************************************************************************************************************************* + Class interface for ScatterPlotDataChannelIterator +**************************************************************************************************************************/ + +class IScatterPlotDataChannelIterator : public virtual IIterator { +public: + /** + * IScatterPlotDataChannelIterator::GetCurrentScatterPlotDataChannel - Returns the Current Scatter Plot Data Channel the iterator points at. + * @return returns the ScatterPlotDataChannel instance. + */ + virtual IScatterPlotDataChannel * GetCurrentScatterPlotDataChannel() = 0; + +}; + +typedef IBaseSharedPtr PIScatterPlotDataChannelIterator; + + /************************************************************************************************************************* Class interface for DataTableScatterPlotOptions **************************************************************************************************************************/ @@ -1188,6 +1284,12 @@ class IDataTableScatterPlotOptions : public virtual IBase { */ virtual void AddDataChannel(const std::string & sChannelIdentifier, const std::string & sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor, const LibMCEnv_uint32 nColor) = 0; + /** + * IDataTableScatterPlotOptions::ListDataChannels - Lists all DataChannels of the ScatterPlot. + * @return Iterator instance. + */ + virtual IScatterPlotDataChannelIterator * ListDataChannels() = 0; + }; typedef IBaseSharedPtr PIDataTableScatterPlotOptions; diff --git a/Framework/InterfacesCore/libmcenv_interfacewrapper.cpp b/Framework/InterfacesCore/libmcenv_interfacewrapper.cpp index 1279fdbb..d91d36c9 100644 --- a/Framework/InterfacesCore/libmcenv_interfacewrapper.cpp +++ b/Framework/InterfacesCore/libmcenv_interfacewrapper.cpp @@ -2406,6 +2406,283 @@ LibMCEnvResult libmcenv_datatablecsvwriteoptions_setseparator(LibMCEnv_DataTable } +/************************************************************************************************************************* + Class implementation for ScatterPlotDataColumn +**************************************************************************************************************************/ +LibMCEnvResult libmcenv_scatterplotdatacolumn_getcolumnidentifier(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, const LibMCEnv_uint32 nColumnIdentifierBufferSize, LibMCEnv_uint32* pColumnIdentifierNeededChars, char * pColumnIdentifierBuffer) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataColumn; + + try { + if ( (!pColumnIdentifierBuffer) && !(pColumnIdentifierNeededChars) ) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + std::string sColumnIdentifier(""); + IScatterPlotDataColumn* pIScatterPlotDataColumn = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataColumn) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + bool isCacheCall = (pColumnIdentifierBuffer == nullptr); + if (isCacheCall) { + sColumnIdentifier = pIScatterPlotDataColumn->GetColumnIdentifier(); + + pIScatterPlotDataColumn->_setCache (new ParameterCache_1 (sColumnIdentifier)); + } + else { + auto cache = dynamic_cast*> (pIScatterPlotDataColumn->_getCache ()); + if (cache == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + cache->retrieveData (sColumnIdentifier); + pIScatterPlotDataColumn->_setCache (nullptr); + } + + if (pColumnIdentifierNeededChars) + *pColumnIdentifierNeededChars = (LibMCEnv_uint32) (sColumnIdentifier.size()+1); + if (pColumnIdentifierBuffer) { + if (sColumnIdentifier.size() >= nColumnIdentifierBufferSize) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_BUFFERTOOSMALL); + for (size_t iColumnIdentifier = 0; iColumnIdentifier < sColumnIdentifier.size(); iColumnIdentifier++) + pColumnIdentifierBuffer[iColumnIdentifier] = sColumnIdentifier[iColumnIdentifier]; + pColumnIdentifierBuffer[sColumnIdentifier.size()] = 0; + } + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + +LibMCEnvResult libmcenv_scatterplotdatacolumn_getscalefactor(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pScaleFactor) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataColumn; + + try { + if (pScaleFactor == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IScatterPlotDataColumn* pIScatterPlotDataColumn = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataColumn) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + *pScaleFactor = pIScatterPlotDataColumn->GetScaleFactor(); + + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + +LibMCEnvResult libmcenv_scatterplotdatacolumn_getoffsetfactor(LibMCEnv_ScatterPlotDataColumn pScatterPlotDataColumn, LibMCEnv_double * pOffsetFactor) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataColumn; + + try { + if (pOffsetFactor == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IScatterPlotDataColumn* pIScatterPlotDataColumn = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataColumn) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + *pOffsetFactor = pIScatterPlotDataColumn->GetOffsetFactor(); + + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + + +/************************************************************************************************************************* + Class implementation for ScatterPlotDataColumnIterator +**************************************************************************************************************************/ +LibMCEnvResult libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn(LibMCEnv_ScatterPlotDataColumnIterator pScatterPlotDataColumnIterator, LibMCEnv_ScatterPlotDataColumn * pScatterPlotDataColumnInstance) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataColumnIterator; + + try { + if (pScatterPlotDataColumnInstance == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IBase* pBaseScatterPlotDataColumnInstance(nullptr); + IScatterPlotDataColumnIterator* pIScatterPlotDataColumnIterator = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataColumnIterator) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + pBaseScatterPlotDataColumnInstance = pIScatterPlotDataColumnIterator->GetCurrentScatterPlotDataColumn(); + + *pScatterPlotDataColumnInstance = (IBase*)(pBaseScatterPlotDataColumnInstance); + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + + +/************************************************************************************************************************* + Class implementation for ScatterPlotDataChannel +**************************************************************************************************************************/ +LibMCEnvResult libmcenv_scatterplotdatachannel_getchannelidentifier(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, const LibMCEnv_uint32 nChannelIdentifierBufferSize, LibMCEnv_uint32* pChannelIdentifierNeededChars, char * pChannelIdentifierBuffer) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataChannel; + + try { + if ( (!pChannelIdentifierBuffer) && !(pChannelIdentifierNeededChars) ) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + std::string sChannelIdentifier(""); + IScatterPlotDataChannel* pIScatterPlotDataChannel = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataChannel) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + bool isCacheCall = (pChannelIdentifierBuffer == nullptr); + if (isCacheCall) { + sChannelIdentifier = pIScatterPlotDataChannel->GetChannelIdentifier(); + + pIScatterPlotDataChannel->_setCache (new ParameterCache_1 (sChannelIdentifier)); + } + else { + auto cache = dynamic_cast*> (pIScatterPlotDataChannel->_getCache ()); + if (cache == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + cache->retrieveData (sChannelIdentifier); + pIScatterPlotDataChannel->_setCache (nullptr); + } + + if (pChannelIdentifierNeededChars) + *pChannelIdentifierNeededChars = (LibMCEnv_uint32) (sChannelIdentifier.size()+1); + if (pChannelIdentifierBuffer) { + if (sChannelIdentifier.size() >= nChannelIdentifierBufferSize) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_BUFFERTOOSMALL); + for (size_t iChannelIdentifier = 0; iChannelIdentifier < sChannelIdentifier.size(); iChannelIdentifier++) + pChannelIdentifierBuffer[iChannelIdentifier] = sChannelIdentifier[iChannelIdentifier]; + pChannelIdentifierBuffer[sChannelIdentifier.size()] = 0; + } + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + +LibMCEnvResult libmcenv_scatterplotdatachannel_addscatterplotdatacolumn(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumn pColumnInstance) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataChannel; + + try { + IBase* pIBaseClassColumnInstance = (IBase *)pColumnInstance; + IScatterPlotDataColumn* pIColumnInstance = dynamic_cast(pIBaseClassColumnInstance); + if (!pIColumnInstance) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDCAST); + + IScatterPlotDataChannel* pIScatterPlotDataChannel = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataChannel) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + pIScatterPlotDataChannel->AddScatterPlotDataColumn(pIColumnInstance); + + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + +LibMCEnvResult libmcenv_scatterplotdatachannel_listscatterplotdatacolumns(LibMCEnv_ScatterPlotDataChannel pScatterPlotDataChannel, LibMCEnv_ScatterPlotDataColumnIterator * pIteratorInstance) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataChannel; + + try { + if (pIteratorInstance == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IBase* pBaseIteratorInstance(nullptr); + IScatterPlotDataChannel* pIScatterPlotDataChannel = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataChannel) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + pBaseIteratorInstance = pIScatterPlotDataChannel->ListScatterPlotDataColumns(); + + *pIteratorInstance = (IBase*)(pBaseIteratorInstance); + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + + +/************************************************************************************************************************* + Class implementation for ScatterPlotDataChannelIterator +**************************************************************************************************************************/ +LibMCEnvResult libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel(LibMCEnv_ScatterPlotDataChannelIterator pScatterPlotDataChannelIterator, LibMCEnv_ScatterPlotDataChannel * pScatterPlotDataChannelInstance) +{ + IBase* pIBaseClass = (IBase *)pScatterPlotDataChannelIterator; + + try { + if (pScatterPlotDataChannelInstance == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IBase* pBaseScatterPlotDataChannelInstance(nullptr); + IScatterPlotDataChannelIterator* pIScatterPlotDataChannelIterator = dynamic_cast(pIBaseClass); + if (!pIScatterPlotDataChannelIterator) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + pBaseScatterPlotDataChannelInstance = pIScatterPlotDataChannelIterator->GetCurrentScatterPlotDataChannel(); + + *pScatterPlotDataChannelInstance = (IBase*)(pBaseScatterPlotDataChannelInstance); + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + + /************************************************************************************************************************* Class implementation for DataTableScatterPlotOptions **************************************************************************************************************************/ @@ -2693,6 +2970,34 @@ LibMCEnvResult libmcenv_datatablescatterplotoptions_adddatachannel(LibMCEnv_Data } } +LibMCEnvResult libmcenv_datatablescatterplotoptions_listdatachannels(LibMCEnv_DataTableScatterPlotOptions pDataTableScatterPlotOptions, LibMCEnv_ScatterPlotDataChannelIterator * pIteratorInstance) +{ + IBase* pIBaseClass = (IBase *)pDataTableScatterPlotOptions; + + try { + if (pIteratorInstance == nullptr) + throw ELibMCEnvInterfaceException (LIBMCENV_ERROR_INVALIDPARAM); + IBase* pBaseIteratorInstance(nullptr); + IDataTableScatterPlotOptions* pIDataTableScatterPlotOptions = dynamic_cast(pIBaseClass); + if (!pIDataTableScatterPlotOptions) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + pBaseIteratorInstance = pIDataTableScatterPlotOptions->ListDataChannels(); + + *pIteratorInstance = (IBase*)(pBaseIteratorInstance); + return LIBMCENV_SUCCESS; + } + catch (ELibMCEnvInterfaceException & Exception) { + return handleLibMCEnvException(pIBaseClass, Exception); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException); + } + catch (...) { + return handleUnhandledException(pIBaseClass); + } +} + /************************************************************************************************************************* Class implementation for DataTable @@ -30378,6 +30683,22 @@ LibMCEnvResult LibMCEnv::Impl::LibMCEnv_GetProcAddress (const char * pProcName, *ppProcAddress = (void*) &libmcenv_datatablecsvwriteoptions_getseparator; if (sProcName == "libmcenv_datatablecsvwriteoptions_setseparator") *ppProcAddress = (void*) &libmcenv_datatablecsvwriteoptions_setseparator; + if (sProcName == "libmcenv_scatterplotdatacolumn_getcolumnidentifier") + *ppProcAddress = (void*) &libmcenv_scatterplotdatacolumn_getcolumnidentifier; + if (sProcName == "libmcenv_scatterplotdatacolumn_getscalefactor") + *ppProcAddress = (void*) &libmcenv_scatterplotdatacolumn_getscalefactor; + if (sProcName == "libmcenv_scatterplotdatacolumn_getoffsetfactor") + *ppProcAddress = (void*) &libmcenv_scatterplotdatacolumn_getoffsetfactor; + if (sProcName == "libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn") + *ppProcAddress = (void*) &libmcenv_scatterplotdatacolumniterator_getcurrentscatterplotdatacolumn; + if (sProcName == "libmcenv_scatterplotdatachannel_getchannelidentifier") + *ppProcAddress = (void*) &libmcenv_scatterplotdatachannel_getchannelidentifier; + if (sProcName == "libmcenv_scatterplotdatachannel_addscatterplotdatacolumn") + *ppProcAddress = (void*) &libmcenv_scatterplotdatachannel_addscatterplotdatacolumn; + if (sProcName == "libmcenv_scatterplotdatachannel_listscatterplotdatacolumns") + *ppProcAddress = (void*) &libmcenv_scatterplotdatachannel_listscatterplotdatacolumns; + if (sProcName == "libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel") + *ppProcAddress = (void*) &libmcenv_scatterplotdatachanneliterator_getcurrentscatterplotdatachannel; if (sProcName == "libmcenv_datatablescatterplotoptions_setxaxiscolumn") *ppProcAddress = (void*) &libmcenv_datatablescatterplotoptions_setxaxiscolumn; if (sProcName == "libmcenv_datatablescatterplotoptions_getxaxiscolumn") @@ -30396,6 +30717,8 @@ LibMCEnvResult LibMCEnv::Impl::LibMCEnv_GetProcAddress (const char * pProcName, *ppProcAddress = (void*) &libmcenv_datatablescatterplotoptions_getyaxisoffset; if (sProcName == "libmcenv_datatablescatterplotoptions_adddatachannel") *ppProcAddress = (void*) &libmcenv_datatablescatterplotoptions_adddatachannel; + if (sProcName == "libmcenv_datatablescatterplotoptions_listdatachannels") + *ppProcAddress = (void*) &libmcenv_datatablescatterplotoptions_listdatachannels; if (sProcName == "libmcenv_datatable_addcolumn") *ppProcAddress = (void*) &libmcenv_datatable_addcolumn; if (sProcName == "libmcenv_datatable_removecolumn") diff --git a/Framework/InterfacesCore/libmcenv_types.hpp b/Framework/InterfacesCore/libmcenv_types.hpp index c1765408..8ee9a94b 100644 --- a/Framework/InterfacesCore/libmcenv_types.hpp +++ b/Framework/InterfacesCore/libmcenv_types.hpp @@ -618,6 +618,10 @@ typedef LibMCEnvHandle LibMCEnv_DiscreteFieldData2DStoreOptions; typedef LibMCEnvHandle LibMCEnv_DiscreteFieldData2D; typedef LibMCEnvHandle LibMCEnv_DataTableWriteOptions; typedef LibMCEnvHandle LibMCEnv_DataTableCSVWriteOptions; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataColumn; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataColumnIterator; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataChannel; +typedef LibMCEnvHandle LibMCEnv_ScatterPlotDataChannelIterator; typedef LibMCEnvHandle LibMCEnv_DataTableScatterPlotOptions; typedef LibMCEnvHandle LibMCEnv_DataTable; typedef LibMCEnvHandle LibMCEnv_DataSeries; diff --git a/Implementation/API/amc_api_handler_ui.cpp b/Implementation/API/amc_api_handler_ui.cpp index 724a25c9..7f6cdef0 100644 --- a/Implementation/API/amc_api_handler_ui.cpp +++ b/Implementation/API/amc_api_handler_ui.cpp @@ -255,6 +255,14 @@ APIHandler_UIType CAPIHandler_UI::parseRequest(const std::string& sURI, const eA } } + if (sParameterString.length() == 60) { + if (sParameterString.substr(0, 18) == "/pointchanneldata/") { + sParameterUUID = AMCCommon::CUtils::normalizeUUIDString(sParameterString.substr(18, 36)); + sAdditionalParameter = sParameterString.substr(55); + return APIHandler_UIType::utPointChannel; + } + } + } @@ -522,6 +530,32 @@ void CAPIHandler_UI::handleWidgetRequest(CJSONWriter& writer, const std::string& } +void CAPIHandler_UI::handlePointChannelDataRequest(CJSONWriter& writer, const std::string& sParameterUUID, const std::string& sAdditionalParameter, PAPIAuth pAuth) +{ + auto pToolpathHandler = m_pSystemState->getToolpathHandlerInstance(); + auto pScatterplot = pToolpathHandler->restoreScatterplot(sParameterUUID, false); + + auto & channelEntries = pScatterplot->getChannelEntries(); + + auto channelIt = channelEntries.find(sAdditionalParameter); + if (channelIt != channelEntries.end()) { + + auto& columnEntries = channelIt->second; + for (const auto& pair : columnEntries) { + + auto sColumnName = pair.first; + auto& vecData = pair.second; + + CJSONWriterArray dataArray(writer); + + for (auto value : vecData) + dataArray.addDouble("", value); + + writer.addArray(sColumnName, dataArray); + } + } +} + PAPIResponse CAPIHandler_UI::handleRequest(const std::string& sURI, const eAPIRequestType requestType, CAPIFormFields & pFormFields, const uint8_t* pBodyData, const size_t nBodyDataSize, PAPIAuth pAuth) { std::string sParameterUUID; @@ -587,6 +621,11 @@ PAPIResponse CAPIHandler_UI::handleRequest(const std::string& sURI, const eAPIRe handleWidgetRequest (writer, sParameterUUID, sAdditionalParameter, pBodyData, nBodyDataSize, pAuth); break; + case APIHandler_UIType::utPointChannel: { + handlePointChannelDataRequest(writer, sParameterUUID, sAdditionalParameter, pAuth); + break; + } + default: throw ELibMCInterfaceException(LIBMC_ERROR_INVALIDPARAM); diff --git a/Implementation/API/amc_api_handler_ui.hpp b/Implementation/API/amc_api_handler_ui.hpp index c294846f..4ecaf679 100644 --- a/Implementation/API/amc_api_handler_ui.hpp +++ b/Implementation/API/amc_api_handler_ui.hpp @@ -52,7 +52,8 @@ namespace AMC { utMeshEdges = 8, utDownload = 9, utPointCloud = 10, - utWidgetRequest = 11 + utWidgetRequest = 11, + utPointChannel = 12 }; class CAPIHandler_UI : public CAPIHandler { @@ -71,6 +72,7 @@ namespace AMC { void handleEventRequest(CJSONWriter& writer, const uint8_t* pBodyData, const size_t nBodyDataSize, PAPIAuth pAuth); void handleWidgetRequest(CJSONWriter& writer, const std::string & sWidgetUUID, const std::string& sRequestType, const uint8_t* pBodyData, const size_t nBodyDataSize, PAPIAuth pAuth); + void handlePointChannelDataRequest(CJSONWriter& writer, const std::string& sParameterUUID, const std::string& sAdditionalParameter, PAPIAuth pAuth); public: diff --git a/Implementation/Core/amc_scatterplot.cpp b/Implementation/Core/amc_scatterplot.cpp index 20666310..6b772615 100644 --- a/Implementation/Core/amc_scatterplot.cpp +++ b/Implementation/Core/amc_scatterplot.cpp @@ -71,6 +71,11 @@ namespace AMC { return m_PointEntries; } + ChannelEntries& CScatterplot::getChannelEntries() + { + return m_ChannelEntries; + } + void CScatterplot::getBoundaries(double& dMinX, double& dMinY, double& dMaxX, double& dMaxY) { dMinX = m_dMinX; diff --git a/Implementation/Core/amc_scatterplot.hpp b/Implementation/Core/amc_scatterplot.hpp index 980e4fbc..69e2634c 100644 --- a/Implementation/Core/amc_scatterplot.hpp +++ b/Implementation/Core/amc_scatterplot.hpp @@ -49,6 +49,9 @@ namespace AMC { class CScatterplot; typedef std::shared_ptr PScatterplot; + typedef std::map> ColumnEntries; + typedef std::map ChannelEntries; + class CScatterplot { private: @@ -56,6 +59,8 @@ namespace AMC { std::vector m_PointEntries; + ChannelEntries m_ChannelEntries; + double m_dMinX; double m_dMinY; double m_dMaxX; @@ -77,6 +82,8 @@ namespace AMC { std::vector & getEntries (); + ChannelEntries& getChannelEntries (); + void getBoundaries(double& dMinX, double& dMinY, double& dMaxX, double& dMaxY); void computeBoundaries(); diff --git a/Implementation/LibMCEnv/libmcenv_datatable.cpp b/Implementation/LibMCEnv/libmcenv_datatable.cpp index 6dcdd606..1e3e79e6 100644 --- a/Implementation/LibMCEnv/libmcenv_datatable.cpp +++ b/Implementation/LibMCEnv/libmcenv_datatable.cpp @@ -291,6 +291,11 @@ class CDataTableColumn_Double : public CDataTableColumn } + void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override + { + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); + } + }; @@ -455,6 +460,37 @@ class CDataTableColumn_Uint32 : public CDataTableColumn } + void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override + { + if (pScatterplot == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); + + auto & channelEntries = pScatterplot->getChannelEntries(); + auto channelIter = channelEntries.find(sChannel); + + if (channelIter == channelEntries.end()) { + channelEntries[sChannel][sColumn] = std::vector(); + } + else { + auto & columnEntries = channelIter->second; + + if (columnEntries.find(sColumn) == columnEntries.end()) + columnEntries[sColumn] = std::vector(); + else { + std::string sException = "The channel = " + sChannel + " with the column = " + sColumn + " already exists"; + throw std::exception(sException.c_str()); + } + } + + auto & vecColumn = channelEntries[sChannel][sColumn]; + + vecColumn.resize(m_Rows.size()); + + for (size_t nIndex = 0; nIndex < m_Rows.size(); nIndex++) { + vecColumn[nIndex] = (double)m_Rows.at(nIndex) * dScaleFactor + dOffset; + } + } + }; @@ -610,6 +646,10 @@ class CDataTableColumn_Uint64 : public CDataTableColumn } + void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override + { + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); + } }; @@ -771,8 +811,13 @@ class CDataTableColumn_Int32 : public CDataTableColumn entry.m_dY = 0.0; } } + } + void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override + { + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); } + }; @@ -936,6 +981,12 @@ class CDataTableColumn_Int64 : public CDataTableColumn } } + + void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override + { + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); + } + }; CDataTableColumn::CDataTableColumn(const std::string& sIdentifier, const std::string& sDescription) @@ -1549,6 +1600,22 @@ IScatterPlot* CDataTable::CalculateScatterPlot(IDataTableScatterPlotOptions* pSc pScatterPlotInstance->computeBoundaries(); + auto pDataChannelsIterator = pScatterPlotInput->ListDataChannels(); + while (pDataChannelsIterator->MoveNext()) { + auto pDataChannel = dynamic_cast(pDataChannelsIterator->GetCurrent()); + auto sChannelIdentifier = pDataChannel->GetChannelIdentifier(); + + auto pDataColumnsIterator = pDataChannel->ListScatterPlotDataColumns(); + while (pDataColumnsIterator->MoveNext()){ + auto pDataColumn = dynamic_cast(pDataColumnsIterator->GetCurrent()); + auto sColumnIdentifier = pDataColumn->GetColumnIdentifier(); + + auto pColumn = findColumn(sColumnIdentifier, false); + if (pColumn) + pColumn->fillScatterplotChannel(pScatterPlotInstance.get(), sChannelIdentifier, sColumnIdentifier, pDataColumn->GetScaleFactor(), pDataColumn->GetOffsetFactor()); + } + } + m_pToolpathHandler->storeScatterplot(pScatterPlotInstance); return new CScatterPlot (pScatterPlotInstance); diff --git a/Implementation/LibMCEnv/libmcenv_datatable.hpp b/Implementation/LibMCEnv/libmcenv_datatable.hpp index 06dad8b4..15b89077 100644 --- a/Implementation/LibMCEnv/libmcenv_datatable.hpp +++ b/Implementation/LibMCEnv/libmcenv_datatable.hpp @@ -96,6 +96,8 @@ class CDataTableColumn virtual void fillScatterplotXCoordinates (AMC::CScatterplot* pScatterplot, double dScaleFactor, double dOffset) = 0; virtual void fillScatterplotYCoordinates(AMC::CScatterplot* pScatterplot, double dScaleFactor, double dOffset) = 0; + + virtual void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) = 0; }; typedef std::shared_ptr PDataTableColumn; diff --git a/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.cpp b/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.cpp index 4a659a87..81fb52d5 100644 --- a/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.cpp +++ b/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.cpp @@ -33,6 +33,7 @@ Abstract: This is a stub class definition of CDataTableScatterPlotOptions #include "libmcenv_datatablescatterplotoptions.hpp" #include "libmcenv_interfaceexception.hpp" +#include "libmcenv_scatterplotdatachanneliterator.hpp" using namespace LibMCEnv::Impl; @@ -98,6 +99,29 @@ LibMCEnv_double CDataTableScatterPlotOptions::GetYAxisOffset() void CDataTableScatterPlotOptions::AddDataChannel(const std::string & sChannelIdentifier, const std::string & sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor, const LibMCEnv_uint32 nColor) { - + auto dataColumn = new CScatterPlotDataColumn(sColumnIdentifier, dScaleFactor, dOffsetFactor); + + auto channelIt = m_DataChannelsMap.find(sChannelIdentifier); + + if (channelIt != m_DataChannelsMap.end()) { + auto& dataChannel = channelIt->second; + dataChannel->AddScatterPlotDataColumn(dataColumn); + } + else { + auto dataChannel = std::make_unique(sChannelIdentifier); + dataChannel->AddScatterPlotDataColumn(dataColumn); + m_DataChannelsMap[sChannelIdentifier] = std::move(dataChannel); + } } +IScatterPlotDataChannelIterator* CDataTableScatterPlotOptions::ListDataChannels() +{ + std::unique_ptr pResult(new CScatterPlotDataChannelIterator()); + + for (const auto& it : m_DataChannelsMap) { + auto dataChannel = std::shared_ptr(CScatterPlotDataChannel::makeFrom(it.second.get())); + pResult->AddScatterPlotDataChannel(dataChannel); + } + + return pResult.release(); +} \ No newline at end of file diff --git a/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.hpp b/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.hpp index 09a569a7..941d1536 100644 --- a/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.hpp +++ b/Implementation/LibMCEnv/libmcenv_datatablescatterplotoptions.hpp @@ -45,7 +45,8 @@ Abstract: This is the class declaration of CDataTableScatterPlotOptions #endif // Include custom headers here. - +#include "libmcenv_scatterplotdatachannel.hpp" +#include namespace LibMCEnv { namespace Impl { @@ -66,6 +67,8 @@ class CDataTableScatterPlotOptions : public virtual IDataTableScatterPlotOptions double m_dYAxisScaleFactor; double m_dYAxisOffset; + std::map> m_DataChannelsMap; + public: CDataTableScatterPlotOptions(); @@ -90,6 +93,7 @@ class CDataTableScatterPlotOptions : public virtual IDataTableScatterPlotOptions void AddDataChannel(const std::string & sChannelIdentifier, const std::string & sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor, const LibMCEnv_uint32 nColor) override; + IScatterPlotDataChannelIterator* ListDataChannels(); }; } // namespace Impl diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.cpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.cpp new file mode 100644 index 00000000..4ea5a787 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.cpp @@ -0,0 +1,99 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is a stub class definition of CScatterPlotDataChannel + +*/ + +#include "libmcenv_scatterplotdatachannel.hpp" +#include "libmcenv_interfaceexception.hpp" + +// Include custom headers here. +#include "libmcenv_scatterplotdatacolumniterator.hpp" + + +using namespace LibMCEnv::Impl; + +/************************************************************************************************************************* + Class definition of CScatterPlotDataChannel +**************************************************************************************************************************/ + +CScatterPlotDataChannel::CScatterPlotDataChannel(const std::string& sChannelIdentifier) + : m_sChannelIdentifier(sChannelIdentifier) +{ +} + +CScatterPlotDataChannel* CScatterPlotDataChannel::makeFrom(IScatterPlotDataChannel* pDataChannel) +{ + if (pDataChannel == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); + + auto pReturnDataChannel = new CScatterPlotDataChannel(pDataChannel->GetChannelIdentifier()); + + auto pDataColumns = pDataChannel->ListScatterPlotDataColumns(); + + while (pDataColumns->MoveNext()) + { + auto pDataColumn = dynamic_cast(pDataColumns->GetCurrent()); + pReturnDataChannel->AddScatterPlotDataColumn(pDataColumn); + } + + return pReturnDataChannel; +} + +std::string CScatterPlotDataChannel::GetChannelIdentifier() +{ + return m_sChannelIdentifier; +} + +void CScatterPlotDataChannel::AddScatterPlotDataColumn(IScatterPlotDataColumn* pColumnInstance) +{ + if (pColumnInstance == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); + + auto sColumnIdentifier = pColumnInstance->GetColumnIdentifier(); + + if (m_DataColumnsMap.find(sColumnIdentifier) == m_DataColumnsMap.end()) + m_DataColumnsMap[sColumnIdentifier] = std::unique_ptr(pColumnInstance); + else + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); // Todo : Exception +} + +IScatterPlotDataColumnIterator * CScatterPlotDataChannel::ListScatterPlotDataColumns() +{ + std::unique_ptr pResult(new CScatterPlotDataColumnIterator()); + + for (const auto& it : m_DataColumnsMap) { + auto dataColumn = std::shared_ptr(CScatterPlotDataColumn::makeFrom(it.second.get())); + pResult->AddScatterPlotDataColumn(dataColumn); + } + + return pResult.release(); +} + diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.hpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.hpp new file mode 100644 index 00000000..c9f813ac --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatachannel.hpp @@ -0,0 +1,107 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is the class declaration of CScatterPlotDataChannel + +*/ + + +#ifndef __LIBMCENV_SCATTERPLOTDATACHANNEL +#define __LIBMCENV_SCATTERPLOTDATACHANNEL + +#include "libmcenv_interfaces.hpp" + +// Parent classes +#include "libmcenv_base.hpp" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4250) +#endif + +// Include custom headers here. +#include "libmcenv_scatterplotdatacolumn.hpp" + +#include + +namespace LibMCEnv { +namespace Impl { + + +/************************************************************************************************************************* + Class declaration of CScatterPlotDataChannel +**************************************************************************************************************************/ + +class CScatterPlotDataChannel : public virtual IScatterPlotDataChannel, public virtual CBase { +private: + + /** + * Put private members here. + */ + + std::string m_sChannelIdentifier; + + std::map> m_DataColumnsMap; + +protected: + + /** + * Put protected members here. + */ + +public: + + CScatterPlotDataChannel(const std::string& sChannelIdentifier); + + static CScatterPlotDataChannel* makeFrom(IScatterPlotDataChannel* pDataChannel); + + + /** + * Put additional public members here. They will not be visible in the external API. + */ + + + /** + * Public member functions to implement. + */ + + void AddScatterPlotDataColumn(IScatterPlotDataColumn* pColumnInstance); + + std::string GetChannelIdentifier() override; + + IScatterPlotDataColumnIterator * ListScatterPlotDataColumns() override; + +}; + +} // namespace Impl +} // namespace LibMCEnv + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // __LIBMCENV_SCATTERPLOTDATACHANNEL diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.cpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.cpp new file mode 100644 index 00000000..c296e333 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.cpp @@ -0,0 +1,77 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is a stub class definition of CScatterPlotDataChannelIterator + +*/ + +#include "libmcenv_scatterplotdatachanneliterator.hpp" +#include "libmcenv_interfaceexception.hpp" + +// Include custom headers here. +#include "libmcenv_scatterplotdatachannel.hpp" + +using namespace LibMCEnv::Impl; + +/************************************************************************************************************************* + Class definition of CScatterPlotDataChannelIterator +**************************************************************************************************************************/ + +IBase* CScatterPlotDataChannelIterator::GetCurrent() +{ + return GetCurrentScatterPlotDataChannel(); +} + +IIterator* CScatterPlotDataChannelIterator::Clone() +{ + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); + + return nullptr; +} + +void CScatterPlotDataChannelIterator::AddScatterPlotDataChannel(std::shared_ptr pDataChannel) +{ + if (pDataChannel.get() == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); + + m_List.push_back(pDataChannel); +} + +IScatterPlotDataChannel* CScatterPlotDataChannelIterator::GetCurrentScatterPlotDataChannel() +{ + if ((m_nCurrentIndex < 0) || (m_nCurrentIndex >= m_List.size())) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDITERATOR); + + auto pDataChannel = std::dynamic_pointer_cast (m_List[m_nCurrentIndex]); + if (pDataChannel.get() == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + return CScatterPlotDataChannel::makeFrom(pDataChannel.get()); + +} diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.hpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.hpp new file mode 100644 index 00000000..40bec968 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatachanneliterator.hpp @@ -0,0 +1,104 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is the class declaration of CScatterPlotDataChannelIterator + +*/ + + +#ifndef __LIBMCENV_SCATTERPLOTDATACHANNELITERATOR +#define __LIBMCENV_SCATTERPLOTDATACHANNELITERATOR + +#include "libmcenv_interfaces.hpp" + +// Parent classes +#include "libmcenv_iterator.hpp" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4250) +#endif + +// Include custom headers here. +#include "libmcenv_scatterplotdatachannel.hpp" + +namespace LibMCEnv { +namespace Impl { + + +/************************************************************************************************************************* + Class declaration of CScatterPlotDataChannelIterator +**************************************************************************************************************************/ + +class CScatterPlotDataChannelIterator : public virtual IScatterPlotDataChannelIterator, public virtual CIterator { +private: + + /** + * Put private members here. + */ + +protected: + + /** + * Put protected members here. + */ + +public: + + /** + * CBuildExecutionIterator::CBuildExecutionIterator - Constructor for BuildExecutionIterator class. + */ + CScatterPlotDataChannelIterator() + { + } + + /** + * Put additional public members here. They will not be visible in the external API. + */ + + IIterator* Clone() override; + + IBase* GetCurrent() override; + + /** + * Public member functions to implement. + */ + + void AddScatterPlotDataChannel(std::shared_ptr pDataChannel); + + IScatterPlotDataChannel * GetCurrentScatterPlotDataChannel() override; + +}; + +} // namespace Impl +} // namespace LibMCEnv + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // __LIBMCENV_SCATTERPLOTDATACHANNELITERATOR diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.cpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.cpp new file mode 100644 index 00000000..4ec946b1 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.cpp @@ -0,0 +1,71 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is a stub class definition of CScatterPlotDataChannelColumn + +*/ + +#include "libmcenv_scatterplotdatacolumn.hpp" +#include "libmcenv_interfaceexception.hpp" + +// Include custom headers here. + + +using namespace LibMCEnv::Impl; + +/************************************************************************************************************************* + Class definition of CScatterPlotDataColumn +**************************************************************************************************************************/ + +CScatterPlotDataColumn::CScatterPlotDataColumn(const std::string& sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor) + : m_sColumnIdentifier(sColumnIdentifier) + , m_dScaleFactor(dScaleFactor) + , m_dOffsetFactor(dOffsetFactor) +{ +} + +CScatterPlotDataColumn* CScatterPlotDataColumn::makeFrom(IScatterPlotDataColumn* pDataColumn) +{ + return new CScatterPlotDataColumn(pDataColumn->GetColumnIdentifier(), pDataColumn->GetScaleFactor(), pDataColumn->GetOffsetFactor()); +} + +std::string CScatterPlotDataColumn::GetColumnIdentifier() +{ + return m_sColumnIdentifier; +} + +LibMCEnv_double CScatterPlotDataColumn::GetScaleFactor() +{ + return m_dScaleFactor; +} + +LibMCEnv_double CScatterPlotDataColumn::GetOffsetFactor() +{ + return m_dOffsetFactor; +} \ No newline at end of file diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.hpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.hpp new file mode 100644 index 00000000..581675d8 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumn.hpp @@ -0,0 +1,104 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is the class declaration of CScatterPlotDataChannelColumn + +*/ + + +#ifndef __LIBMCENV_SCATTERPLOTDATACOLUMN +#define __LIBMCENV_SCATTERPLOTDATACOLUMN + +#include "libmcenv_interfaces.hpp" + +// Parent classes +#include "libmcenv_base.hpp" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4250) +#endif + +// Include custom headers here. + + +namespace LibMCEnv { +namespace Impl { + + +/************************************************************************************************************************* + Class declaration of CScatterPlotDataColumn +**************************************************************************************************************************/ + +class CScatterPlotDataColumn : public virtual IScatterPlotDataColumn, public virtual CBase { +private: + + /** + * Put private members here. + */ + + std::string m_sColumnIdentifier; + + double m_dScaleFactor; + double m_dOffsetFactor; + +protected: + + /** + * Put protected members here. + */ + +public: + + /** + * Put additional public members here. They will not be visible in the external API. + */ + + + /** + * Public member functions to implement. + */ + + CScatterPlotDataColumn(const std::string& sColumnIdentifier, const LibMCEnv_double dScaleFactor, const LibMCEnv_double dOffsetFactor); + + static CScatterPlotDataColumn* makeFrom(IScatterPlotDataColumn* pDataColumn); + + std::string GetColumnIdentifier() override; + + LibMCEnv_double GetScaleFactor() override; + + LibMCEnv_double GetOffsetFactor() override; +}; + +} // namespace Impl +} // namespace LibMCEnv + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // __LIBMCENV_SCATTERPLOTDATACOLUMN diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.cpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.cpp new file mode 100644 index 00000000..24743e27 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.cpp @@ -0,0 +1,80 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is a stub class definition of CScatterPlotDataChannelColumnIterator + +*/ + +#include "libmcenv_scatterplotdatacolumniterator.hpp" +#include "libmcenv_interfaceexception.hpp" + +// Include custom headers here. + + +using namespace LibMCEnv::Impl; + +/************************************************************************************************************************* + Class definition of CScatterPlotDataChannelColumnIterator +**************************************************************************************************************************/ + +CScatterPlotDataColumnIterator::CScatterPlotDataColumnIterator() +{ +} + +IBase* CScatterPlotDataColumnIterator::GetCurrent() +{ + return GetCurrentScatterPlotDataColumn(); +} + +IIterator* CScatterPlotDataColumnIterator::Clone() +{ + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED); + + return nullptr; +} + +IScatterPlotDataColumn * CScatterPlotDataColumnIterator::GetCurrentScatterPlotDataColumn() +{ + if ((m_nCurrentIndex < 0) || (m_nCurrentIndex >= m_List.size())) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDITERATOR); + + auto pDataColumn = std::dynamic_pointer_cast (m_List[m_nCurrentIndex]); + if (pDataColumn.get() == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDCAST); + + return CScatterPlotDataColumn::makeFrom(pDataColumn.get()); +} + +void CScatterPlotDataColumnIterator::AddScatterPlotDataColumn(std::shared_ptr pDataColumn) +{ + if (pDataColumn.get() == nullptr) + throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM); + + m_List.push_back(pDataColumn); +} \ No newline at end of file diff --git a/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.hpp b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.hpp new file mode 100644 index 00000000..01ebac53 --- /dev/null +++ b/Implementation/LibMCEnv/libmcenv_scatterplotdatacolumniterator.hpp @@ -0,0 +1,100 @@ +/*++ + +Copyright (C) 2020 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Abstract: This is the class declaration of CScatterPlotDataColumnIterator + +*/ + + +#ifndef __LIBMCENV_SCATTERPLOTDATACOLUMNITERATOR +#define __LIBMCENV_SCATTERPLOTDATACOLUMNITERATOR + +#include "libmcenv_interfaces.hpp" + +// Parent classes +#include "libmcenv_iterator.hpp" +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4250) +#endif + +// Include custom headers here. +#include "libmcenv_scatterplotdatacolumn.hpp" + +namespace LibMCEnv { +namespace Impl { + + +/************************************************************************************************************************* + Class declaration of CScatterPlotDataColumnIterator +**************************************************************************************************************************/ + +class CScatterPlotDataColumnIterator : public virtual IScatterPlotDataColumnIterator, public virtual CIterator { +private: + + /** + * Put private members here. + */ + +protected: + + /** + * Put protected members here. + */ + +public: + + /** + * Put additional public members here. They will not be visible in the external API. + */ + + + /** + * Public member functions to implement. + */ + + CScatterPlotDataColumnIterator(); + + IIterator* Clone() override; + + IBase* GetCurrent() override; + + IScatterPlotDataColumn * GetCurrentScatterPlotDataColumn() override; + + void AddScatterPlotDataColumn(std::shared_ptr pDataColumn); + +}; + +} // namespace Impl +} // namespace LibMCEnv + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // __LIBMCENV_SCATTERPLOTDATACOLUMNITERATOR