[mapguide-commits] r7763 - in trunk/MgDev: Common/MapGuideCommon/Services Server/src/Services/Mapping Server/src/UnitTesting Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Aug 13 07:46:28 PDT 2013
Author: jng
Date: 2013-08-13 07:46:28 -0700 (Tue, 13 Aug 2013)
New Revision: 7763
Added:
trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.cpp
trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.h
trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.cpp
trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.h
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/MappingDefs.h
trunk/MgDev/Common/MapGuideCommon/Services/MappingService.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.h
trunk/MgDev/Server/src/Services/Mapping/Makefile.am
trunk/MgDev/Server/src/Services/Mapping/MappingOperationFactory.cpp
trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp
trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.h
trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj
trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj.filters
trunk/MgDev/Server/src/Services/Mapping/ServerMappingServiceBuild.cpp
trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp
trunk/MgDev/Server/src/UnitTesting/TestMappingService.h
trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj
trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters
trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp
trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp
trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h
trunk/MgDev/Web/src/HttpHandler/Makefile.am
Log:
Merge RFC 137 sandbox to trunk.
Modified: trunk/MgDev/Common/MapGuideCommon/Services/MappingDefs.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/MappingDefs.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Common/MapGuideCommon/Services/MappingDefs.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -105,6 +105,8 @@
static const int GenerateLegendImage = 0x1111EE0D;
static const int CreateRuntimeMap = 0x1111EE0E;
static const int CreateRuntimeMap2 = 0x1111EE0F;
+ static const int DescribeRuntimeMap = 0x1111EE10;
+ static const int DescribeRuntimeMap2 = 0x1111EE11;
};
/// \endcond
Modified: trunk/MgDev/Common/MapGuideCommon/Services/MappingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/MappingService.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Common/MapGuideCommon/Services/MappingService.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -467,8 +467,91 @@
INT32 iconHeight,
INT32 requestedFeatures,
INT32 iconsPerScaleRange) = 0;
-
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns an XML-based description of the runtime map
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param map (MgMap)
+ /// The map to describe
+ /// \param requestedFeatures (int)
+ /// A bitmask representing the desired information to return in the XML response:
+ /// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+ /// \param iconsPerScaleRange (int)
+ /// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+ /// If a scale range contains a number of rules that exceeds this value, only the first and
+ /// last rules of a type style in the scale range will have inline icons
+ ///
+ /// \remarks
+ /// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+ /// is not specified
+ ///
+ /// \return
+ /// Returns an XML-based description of the runtime map
+ ///
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange) = 0;
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns an XML-based description of the given runtime map
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, String iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param map (MgMap)
+ /// The map to describe
+ /// \param iconFormat (String/string)
+ /// The desired image format for icons (from MgImageFormats)
+ /// \param iconWidth (int)
+ /// The width of each individual inline legend icons. Has no effect if icons was not requested in the response.
+ /// \param iconHeight (int)
+ /// The height of each individual inline legend icons. Has no effect if icons was not requested in the response.
+ /// \param requestedFeatures (int)
+ /// A bitmask representing the desired information to return in the XML response:
+ /// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+ /// \param iconsPerScaleRange (int)
+ /// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+ /// If a scale range contains a number of rules that exceeds this value, only the first and
+ /// last rules of a type style in the scale range will have inline icons
+ ///
+ /// \remarks
+ /// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+ /// is not specified
+ ///
+ /// \return
+ /// Returns an XML-based description of the runtime map
+ ///
+ /// \exception MgInvalidArgumentException
+ /// \exception MgNullArgumentException
+ ///
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange) = 0;
+
EXTERNAL_API:
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -642,7 +725,9 @@
opIdGeneratePlot3 = 0x1111EE0A,
opIdGenerateLegendImage = 0x1111EE0D,
opIdCreateRuntimeMap = 0x1111EE0E,
- opIdCreateRuntimeMap2 = 0x1111EE0F
+ opIdCreateRuntimeMap2 = 0x1111EE0F,
+ opIdDescribeRuntimeMap = 0x1111EE10,
+ opIdDescribeRuntimeMap2 = 0x1111EE11
};
};
/// \}
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -509,6 +509,129 @@
return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
+////////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns an XML-based description of the runtime map
+///
+/// <!-- Syntax in .Net, Java, and PHP -->
+/// \htmlinclude DotNetSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+/// \htmlinclude JavaSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+/// \htmlinclude PHPSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+///
+/// \param map (MgMap)
+/// The map to describe
+/// \param requestedFeatures (int)
+/// A bitmask representing the desired information to return in the XML response:
+/// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+/// \param iconsPerScaleRange (int)
+/// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+/// If a scale range contains a number of rules that exceeds this value, only the first and
+/// last rules of a type style in the scale range will have inline icons
+///
+/// \remarks
+/// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+/// is not specified
+///
+/// \return
+/// Returns an XML-based description of the runtime map
+///
+MgByteReader* MgProxyMappingService::DescribeRuntimeMap(MgMap* map,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
+{
+ MgCommand cmd;
+
+ cmd.ExecuteCommand(m_connProp,
+ MgCommand::knObject,
+ MgMappingServiceOpId::DescribeRuntimeMap,
+ 3,
+ Mapping_Service,
+ BUILD_VERSION(2,6,0),
+ MgCommand::knObject, map,
+ MgCommand::knInt32, requestedFeatures,
+ MgCommand::knInt32, iconsPerScaleRange,
+ MgCommand::knNone);
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns an XML-based description of the given runtime map
+///
+/// <!-- Syntax in .Net, Java, and PHP -->
+/// \htmlinclude DotNetSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+/// \htmlinclude JavaSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, String iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+/// \htmlinclude PHPSyntaxTop.html
+/// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+/// \htmlinclude SyntaxBottom.html
+///
+/// \param map (MgMap)
+/// The map to describe
+/// \param iconFormat (String/string)
+/// The desired image format for icons (from MgImageFormats)
+/// \param iconWidth (int)
+/// The width of each individual inline legend icons. Has no effect if icons was not requested in the response.
+/// \param iconHeight (int)
+/// The height of each individual inline legend icons. Has no effect if icons was not requested in the response.
+/// \param requestedFeatures (int)
+/// A bitmask representing the desired information to return in the XML response:
+/// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+/// \param iconsPerScaleRange (int)
+/// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+/// If a scale range contains a number of rules that exceeds this value, only the first and
+/// last rules of a type style in the scale range will have inline icons
+///
+/// \remarks
+/// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+/// is not specified
+///
+/// \return
+/// Returns an XML-based description of the runtime map
+///
+/// \exception MgInvalidArgumentException
+/// \exception MgNullArgumentException
+///
+MgByteReader* MgProxyMappingService::DescribeRuntimeMap(MgMap* map,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
+{
+ MgCommand cmd;
+
+ cmd.ExecuteCommand(m_connProp,
+ MgCommand::knObject,
+ MgMappingServiceOpId::DescribeRuntimeMap2,
+ 6,
+ Mapping_Service,
+ BUILD_VERSION(2,6,0),
+ MgCommand::knObject, map,
+ MgCommand::knString, &iconFormat,
+ MgCommand::knInt32, iconWidth,
+ MgCommand::knInt32, iconHeight,
+ MgCommand::knInt32, requestedFeatures,
+ MgCommand::knInt32, iconsPerScaleRange,
+ MgCommand::knNone);
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Sets the connection properties for the Proxy Service. This
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyMappingService.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -428,6 +428,90 @@
INT32 requestedFeatures,
INT32 iconsPerScaleRange);
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns an XML-based description of the runtime map
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param map (MgMap)
+ /// The map to describe
+ /// \param requestedFeatures (int)
+ /// A bitmask representing the desired information to return in the XML response:
+ /// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+ /// \param iconsPerScaleRange (int)
+ /// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+ /// If a scale range contains a number of rules that exceeds this value, only the first and
+ /// last rules of a type style in the scale range will have inline icons
+ ///
+ /// \remarks
+ /// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+ /// is not specified
+ ///
+ /// \return
+ /// Returns an XML-based description of the runtime map
+ ///
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns an XML-based description of the given runtime map
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, String iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// virtual MgByteReader DescribeRuntimeMap(MgMap map, string iconFormat, int iconWidth, int iconHeight, int requestedFeatures, int iconsPerScaleRange);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param map (MgMap)
+ /// The map to describe
+ /// \param iconFormat (String/string)
+ /// The desired image format for icons (from MgImageFormats)
+ /// \param iconWidth (int)
+ /// The width of each individual inline legend icons. Has no effect if icons was not requested in the response.
+ /// \param iconHeight (int)
+ /// The height of each individual inline legend icons. Has no effect if icons was not requested in the response.
+ /// \param requestedFeatures (int)
+ /// A bitmask representing the desired information to return in the XML response:
+ /// 1=Layer/Group structure, 2=Layer Icons, 4=Layer Feature Source Information
+ /// \param iconsPerScaleRange (int)
+ /// The number of legend icons per scale range to render inline in the XML response as base64 strings.
+ /// If a scale range contains a number of rules that exceeds this value, only the first and
+ /// last rules of a type style in the scale range will have inline icons
+ ///
+ /// \remarks
+ /// The bitmask values of 2 (Layer Icons) and 4 (Layer Feature Source Information) have no effect if 1 (Layer/Group structure)
+ /// is not specified
+ ///
+ /// \return
+ /// Returns an XML-based description of the runtime map
+ ///
+ /// \exception MgInvalidArgumentException
+ /// \exception MgNullArgumentException
+ ///
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange);
+
INTERNAL_API:
//////////////////////////////////////////////////////////////////
/// \brief
Modified: trunk/MgDev/Server/src/Services/Mapping/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/Makefile.am 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/Makefile.am 2013-08-13 14:46:28 UTC (rev 7763)
@@ -36,6 +36,7 @@
MappingServiceHandler.cpp \
MappingUtil.cpp \
OpCreateRuntimeMap.cpp \
+ OpDescribeRuntimeMap.cpp \
OpGenerateLegendImage.cpp \
OpGenerateLegendPlot.cpp \
OpGenerateMap.cpp \
@@ -58,6 +59,7 @@
MappingServiceHandler.h \
MappingUtil.h \
OpCreateRuntimeMap.h \
+ OpDescribeRuntimeMap.h \
OpGenerateLegendImage.h \
OpGenerateLegendPlot.h \
OpGenerateMap.h \
Modified: trunk/MgDev/Server/src/Services/Mapping/MappingOperationFactory.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingOperationFactory.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingOperationFactory.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -19,6 +19,7 @@
#include "MappingOperationFactory.h"
#include "OpCreateRuntimeMap.h"
+#include "OpDescribeRuntimeMap.h"
#include "OpGenerateMap.h"
#include "OpGenerateMapUpdate.h"
#include "OpGeneratePlot.h"
@@ -220,6 +221,30 @@
}
break;
+ case MgMappingService::opIdDescribeRuntimeMap:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(2,6):
+ handler.reset(new MgOpDescribeRuntimeMap());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgDrawingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+
+ case MgMappingService::opIdDescribeRuntimeMap2:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(2,6):
+ handler.reset(new MgOpDescribeRuntimeMap());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgDrawingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+
default:
throw new MgInvalidOperationException(
L"MgMappingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
Copied: trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.cpp (from rev 7708, sandbox/jng/getruntimemap/Server/src/Services/Mapping/OpDescribeRuntimeMap.cpp)
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -0,0 +1,159 @@
+//
+// Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "ServerMappingServiceDefs.h"
+#include "OpDescribeRuntimeMap.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpDescribeRuntimeMap::MgOpDescribeRuntimeMap()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpDescribeRuntimeMap::~MgOpDescribeRuntimeMap()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpDescribeRuntimeMap::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpDescribeRuntimeMap::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"DescribeRuntimeMap");
+
+ MG_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (6 == m_packet.m_NumArguments)
+ {
+ STRING targetMapName;
+ STRING sessionId;
+ STRING iconFormat;
+ INT32 iconWidth, iconHeight, requestedFeatures, iconsPerScaleRange;
+
+ Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+ map->SetDelayedLoadResourceService(m_resourceService);
+ Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+
+ m_stream->GetString(iconFormat);
+ m_stream->GetInt32(iconWidth);
+ m_stream->GetInt32(iconHeight);
+ m_stream->GetInt32(requestedFeatures);
+ m_stream->GetInt32(iconsPerScaleRange);
+
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(iconFormat);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(iconWidth);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(iconHeight);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(requestedFeatures);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(iconsPerScaleRange);
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ Ptr<MgByteReader> byteReader =
+ m_service->DescribeRuntimeMap(map, iconFormat, iconWidth, iconHeight, requestedFeatures, iconsPerScaleRange);
+
+ EndExecution(byteReader);
+ }
+ else if (3 == m_packet.m_NumArguments)
+ {
+ STRING sessionId;
+ INT32 requestedFeatures, iconsPerScaleRange;
+
+ Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+ map->SetDelayedLoadResourceService(m_resourceService);
+ Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+
+ m_stream->GetInt32(requestedFeatures);
+ m_stream->GetInt32(iconsPerScaleRange);
+
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(requestedFeatures);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(iconsPerScaleRange);
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ Ptr<MgByteReader> byteReader =
+ m_service->DescribeRuntimeMap(map, requestedFeatures, iconsPerScaleRange);
+
+ EndExecution(byteReader);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpDescribeRuntimeMap.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_CATCH(L"MgOpDescribeRuntimeMap.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add access log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+ MG_THROW()
+}
Copied: trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.h (from rev 7708, sandbox/jng/getruntimemap/Server/src/Services/Mapping/OpDescribeRuntimeMap.h)
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.h (rev 0)
+++ trunk/MgDev/Server/src/Services/Mapping/OpDescribeRuntimeMap.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -0,0 +1,31 @@
+//
+// Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_OP_DESCRIBE_RUNTIME_MAP_H
+#define MG_OP_DESCRIBE_RUNTIME_MAP_H
+
+class MgOpDescribeRuntimeMap : public MgMappingOperation
+{
+ public:
+ MgOpDescribeRuntimeMap();
+ virtual ~MgOpDescribeRuntimeMap();
+
+ public:
+ virtual void Execute();
+};
+
+#endif
\ No newline at end of file
Modified: trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -1862,26 +1862,21 @@
// Do nothing. No connection properties are required for Server-side service objects.
}
-MgByteReader* MgServerMappingService::CreateRuntimeMap(MgResourceIdentifier* mapDefinition,
- CREFSTRING sessionId,
- INT32 requestedFeatures,
- INT32 iconsPerScaleRange)
+MgByteReader* MgServerMappingService::DescribeRuntimeMap(MgMap* map,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
{
- CHECKNULL(mapDefinition, L"MgServerMappingService.CreateRuntimeMap");
- STRING mapName = mapDefinition->GetName();
- return CreateRuntimeMap(mapDefinition, mapName, sessionId, MgImageFormats::Png, LEGEND_BITMAP_SIZE, LEGEND_BITMAP_SIZE, requestedFeatures, iconsPerScaleRange);
+ CHECKNULL(map, L"MgServerMappingService.DescribeRuntimeMap");
+ return DescribeRuntimeMap(map, MgImageFormats::Png, LEGEND_BITMAP_SIZE, LEGEND_BITMAP_SIZE, requestedFeatures, iconsPerScaleRange);
}
-MgByteReader* MgServerMappingService::CreateRuntimeMap(MgResourceIdentifier* mapDefinition,
- CREFSTRING targetMapName,
- CREFSTRING sessionId,
- CREFSTRING iconFormat,
- INT32 iconWidth,
- INT32 iconHeight,
- INT32 requestedFeatures,
- INT32 iconsPerScaleRange)
+MgByteReader* MgServerMappingService::DescribeRuntimeMap(MgMap* map,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
{
- CHECKARGUMENTNULL(mapDefinition, L"MgServerMappingService.CreateRuntimeMap");
LayerDefinitionMap layerDefinitionMap;
if (MgImageFormats::Png != iconFormat &&
MgImageFormats::Gif != iconFormat &&
@@ -1890,7 +1885,7 @@
{
MgStringCollection args;
args.Add(iconFormat);
- throw new MgInvalidArgumentException(L"MgServerMappingService.CreateRuntimeMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageFormat", &args);
+ throw new MgInvalidArgumentException(L"MgServerMappingService.DescribeRuntimeMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageFormat", &args);
}
Ptr<MgByteReader> byteReader;
@@ -1899,26 +1894,10 @@
if (m_svcResource == NULL)
InitializeResourceService();
- Ptr<MgSiteConnection> siteConn = new MgSiteConnection();
- Ptr<MgUserInformation> userInfo = new MgUserInformation(sessionId);
- siteConn->Open(userInfo);
- Ptr<MgMap> map = new MgMap(siteConn);
- map->Create(mapDefinition, targetMapName);
-
- STRING sStateId = L"Session:";
- sStateId += sessionId;
- sStateId += L"//";
- sStateId += targetMapName;
- sStateId += L".";
- sStateId += MgResourceType::Map;
+ STRING sessionId = map->GetSessionId();
+ STRING targetMapName = map->GetName();
+ Ptr<MgResourceIdentifier> mapDefinition = map->GetMapDefinition();
- Ptr<MgResourceIdentifier> mapStateId = new MgResourceIdentifier(sStateId);
- Ptr<MgSelection> sel = new MgSelection(map);
- //Call our special Save() API that doesn't try to look for a MgUserInformation that's not
- //there
- sel->Save(m_svcResource, sessionId, targetMapName);
- map->Save(m_svcResource, mapStateId);
-
//TODO: Possible future caching opportunity?
std::string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; // NOXLATE
xml.append("<RuntimeMap xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"RuntimeMap-2.6.0.xsd\">\n");
@@ -2084,7 +2063,7 @@
byteSource->SetMimeType(MgMimeType::Xml);
byteReader = byteSource->GetReader();
- MG_SERVER_MAPPING_SERVICE_CATCH(L"MgServerMappingService.CreateRuntimeMap")
+ MG_SERVER_MAPPING_SERVICE_CATCH(L"MgServerMappingService.DescribeRuntimeMap")
//Cleanup our LayerDefinition pointers. Do it here so we don't leak on any exception
for (LayerDefinitionMap::iterator it = layerDefinitionMap.begin(); it != layerDefinitionMap.end(); it++)
@@ -2099,6 +2078,70 @@
return byteReader.Detach();
}
+MgByteReader* MgServerMappingService::CreateRuntimeMap(MgResourceIdentifier* mapDefinition,
+ CREFSTRING sessionId,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
+{
+ CHECKNULL(mapDefinition, L"MgServerMappingService.CreateRuntimeMap");
+ STRING mapName = mapDefinition->GetName();
+ return CreateRuntimeMap(mapDefinition, mapName, sessionId, MgImageFormats::Png, LEGEND_BITMAP_SIZE, LEGEND_BITMAP_SIZE, requestedFeatures, iconsPerScaleRange);
+}
+
+MgByteReader* MgServerMappingService::CreateRuntimeMap(MgResourceIdentifier* mapDefinition,
+ CREFSTRING targetMapName,
+ CREFSTRING sessionId,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange)
+{
+ CHECKARGUMENTNULL(mapDefinition, L"MgServerMappingService.CreateRuntimeMap");
+ LayerDefinitionMap layerDefinitionMap;
+ if (MgImageFormats::Png != iconFormat &&
+ MgImageFormats::Gif != iconFormat &&
+ MgImageFormats::Png8 != iconFormat &&
+ MgImageFormats::Jpeg != iconFormat)
+ {
+ MgStringCollection args;
+ args.Add(iconFormat);
+ throw new MgInvalidArgumentException(L"MgServerMappingService.CreateRuntimeMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageFormat", &args);
+ }
+ Ptr<MgByteReader> byteReader;
+
+ MG_SERVER_MAPPING_SERVICE_TRY()
+
+ if (m_svcResource == NULL)
+ InitializeResourceService();
+
+ Ptr<MgSiteConnection> siteConn = new MgSiteConnection();
+ Ptr<MgUserInformation> userInfo = new MgUserInformation(sessionId);
+ siteConn->Open(userInfo);
+ Ptr<MgMap> map = new MgMap(siteConn);
+ map->Create(mapDefinition, targetMapName);
+
+ STRING sStateId = L"Session:";
+ sStateId += sessionId;
+ sStateId += L"//";
+ sStateId += targetMapName;
+ sStateId += L".";
+ sStateId += MgResourceType::Map;
+
+ Ptr<MgResourceIdentifier> mapStateId = new MgResourceIdentifier(sStateId);
+ Ptr<MgSelection> sel = new MgSelection(map);
+ //Call our special Save() API that doesn't try to look for a MgUserInformation that's not
+ //there
+ sel->Save(m_svcResource, sessionId, targetMapName);
+ map->Save(m_svcResource, mapStateId);
+
+ byteReader = DescribeRuntimeMap(map, iconFormat, iconWidth, iconHeight, requestedFeatures, iconsPerScaleRange);
+
+ MG_SERVER_MAPPING_SERVICE_CATCH_AND_THROW(L"MgServerMappingService.CreateRuntimeMap")
+
+ return byteReader.Detach();
+}
+
void MgServerMappingService::CreateGroupItem(MgLayerGroup* group, MgLayerGroup* parent, std::string& xml)
{
MG_SERVER_MAPPING_SERVICE_TRY()
Modified: trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -130,6 +130,17 @@
INT32 requestedFeatures,
INT32 iconsPerScaleRange);
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange);
+
+ virtual MgByteReader* DescribeRuntimeMap(MgMap* map,
+ CREFSTRING iconFormat,
+ INT32 iconWidth,
+ INT32 iconHeight,
+ INT32 requestedFeatures,
+ INT32 iconsPerScaleRange);
+
void SetConnectionProperties(MgConnectionProperties* connProp);
// Data Members
Modified: trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj 2013-08-13 14:46:28 UTC (rev 7763)
@@ -220,6 +220,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="OpDescribeRuntimeMap.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="OpGenerateLegendImage.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -328,6 +334,7 @@
<ClInclude Include="MappingOperation.h" />
<ClInclude Include="MappingOperationFactory.h" />
<ClInclude Include="OpCreateRuntimeMap.h" />
+ <ClInclude Include="OpDescribeRuntimeMap.h" />
<ClInclude Include="OpGenerateLegendImage.h" />
<ClInclude Include="OpGenerateLegendPlot.h" />
<ClInclude Include="OpGenerateMap.h" />
Modified: trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj.filters
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj.filters 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/ServerMappingService.vcxproj.filters 2013-08-13 14:46:28 UTC (rev 7763)
@@ -49,6 +49,9 @@
<ClCompile Include="OpCreateRuntimeMap.cpp">
<Filter>Ops</Filter>
</ClCompile>
+ <ClCompile Include="OpDescribeRuntimeMap.cpp">
+ <Filter>Ops</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MappingOperation.h">
@@ -96,6 +99,9 @@
<ClInclude Include="OpCreateRuntimeMap.h">
<Filter>Ops</Filter>
</ClInclude>
+ <ClInclude Include="OpDescribeRuntimeMap.h">
+ <Filter>Ops</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ServerMappingService.rc" />
Modified: trunk/MgDev/Server/src/Services/Mapping/ServerMappingServiceBuild.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/ServerMappingServiceBuild.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/Services/Mapping/ServerMappingServiceBuild.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -22,6 +22,7 @@
#include "MappingOperationFactory.cpp"
#include "MappingServiceHandler.cpp"
#include "OpCreateRuntimeMap.cpp"
+#include "OpDescribeRuntimeMap.cpp"
#include "OpGeneratePlot.cpp"
#include "OpGenerateMap.cpp"
#include "OpGenerateMapUpdate.cpp"
Modified: trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -357,7 +357,108 @@
}
}
+void TestMappingService::TestCase_DescribeRuntimeMap()
+{
+ try
+ {
+ //make a runtime map
+ Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan.MapDefinition");
+ STRING format = MgImageFormats::Png;
+ //call the API
+ Ptr<MgByteReader> rtMap = m_svcMapping->CreateRuntimeMap(mdfres, L"UnitTestSheboygan1", m_session, format, 16, 16, 0, 25);
+ Ptr<MgMap> map = new MgMap(m_siteConnection);
+ map->Open(L"UnitTestSheboygan1");
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, 0, 25);
+ Ptr<MgByteSink> sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapBarebones.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, 1, 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroups.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsPNG16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourcePNG16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsPNG32x32.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourcePNG32x32.xml");
+
+ format = MgImageFormats::Gif;
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsGIF16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourceGIF16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsGIF32x32.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourceGIF32x32.xml");
+
+ format = MgImageFormats::Jpeg;
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsJPEG16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourceJPEG16x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsJPEG32x32.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourceJPEG32x32.xml");
+
+ format = MgImageFormats::Png8;
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsPNG816x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 16, 16, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourcePNG816x16.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsPNG832x32.xml");
+
+ rtMap = m_svcMapping->DescribeRuntimeMap(map, format, 32, 32, (1 | 2 | 4), 25);
+ sink = new MgByteSink(rtMap);
+ sink->ToFile(L"../UnitTestFiles/DescribeRuntimeMapLayersAndGroupsWithIconsAndFeatureSourcePNG832x32.xml");
+ }
+ catch(MgException* e)
+ {
+ STRING message = e->GetDetails(TEST_LOCALE);
+ SAFE_RELEASE(e);
+ CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+ }
+ catch(...)
+ {
+ throw;
+ }
+}
+
void TestMappingService::TestCase_GetMap()
{
try
Modified: trunk/MgDev/Server/src/UnitTesting/TestMappingService.h
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestMappingService.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Server/src/UnitTesting/TestMappingService.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -37,6 +37,7 @@
CPPUNIT_TEST(TestCase_GetLegendImage);
CPPUNIT_TEST(TestCase_GetLegendImagePointStyleWithConstRotations);
CPPUNIT_TEST(TestCase_CreateRuntimeMap);
+ CPPUNIT_TEST(TestCase_DescribeRuntimeMap);
//CPPUNIT_TEST(TestCase_QueryFeaturesImageMap);
CPPUNIT_TEST(TestEnd); // This must be the very last unit test
@@ -53,6 +54,7 @@
void TestEnd();
void TestCase_CreateRuntimeMap();
+ void TestCase_DescribeRuntimeMap();
void TestCase_GetMap();
void TestCase_GetMapUpdate();
void TestCase_SaveMap();
Copied: trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.cpp (from rev 7708, sandbox/jng/getruntimemap/Web/src/HttpHandler/HttpDescribeRuntimeMap.cpp)
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.cpp (rev 0)
+++ trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -0,0 +1,128 @@
+//
+// Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "HttpHandler.h"
+#include "HttpDescribeRuntimeMap.h"
+#include "VectorLayerDefinition.h"
+#include "PointTypeStyle.h"
+#include "AreaTypeStyle.h"
+#include "LineTypeStyle.h"
+#include "CompositeTypeStyle.h"
+
+#define REQUEST_LAYER_STRUCTURE 1 /* Request layer and group structure */
+#define REQUEST_LAYER_ICONS 2 /* Request layer scale and icon information */
+#define REQUEST_LAYER_FEATURE_SOURCE 4 /* Request information about a layer's feature source */
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpDescribeRuntimeMap)
+
+/// <summary>
+/// Initializes the common parameters and parameters specific to this request.
+/// </summary>
+/// <param name="name">Input
+/// MgHttpRequest
+/// This contains all the parameters of the request.
+/// </param>
+/// <returns>
+/// nothing
+/// </returns>
+MgHttpDescribeRuntimeMap::MgHttpDescribeRuntimeMap(MgHttpRequest *hRequest)
+{
+ InitializeCommonParameters(hRequest);
+
+ Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
+ m_mapName = params->GetParameterValue(MgHttpResourceStrings::reqMappingMapName);
+ STRING mask = params->GetParameterValue(MgHttpResourceStrings::reqMappingRequestedFeatures);
+ if (mask.empty())
+ m_requestDataMask = 0;
+ else
+ m_requestDataMask = MgUtil::StringToInt32(mask);
+ m_iconLimitPerScaleRange = 25;
+ STRING sIconsPerScaleRange = params->GetParameterValue(MgHttpResourceStrings::reqMappingIconsPerScaleRange);
+ if (!sIconsPerScaleRange.empty())
+ {
+ m_iconLimitPerScaleRange = MgUtil::StringToInt32(sIconsPerScaleRange);
+ }
+ m_iconFormat = MgImageFormats::Png;
+ m_iconWidth = 16;
+ m_iconHeight = 16;
+ STRING sIconFormat = params->GetParameterValue(MgHttpResourceStrings::reqMappingIconFormat);
+ if (!sIconFormat.empty())
+ {
+ m_iconFormat = sIconFormat;
+ }
+ STRING sIconWidth = params->GetParameterValue(MgHttpResourceStrings::reqMappingIconWidth);
+ if (!sIconWidth.empty())
+ {
+ m_iconWidth = MgUtil::StringToInt32(sIconWidth);
+ }
+ STRING sIconHeight = params->GetParameterValue(MgHttpResourceStrings::reqMappingIconHeight);
+ if (!sIconHeight.empty())
+ {
+ m_iconHeight = MgUtil::StringToInt32(sIconHeight);
+ }
+}
+
+/// <summary>
+/// Executes the specific request.
+/// </summary>
+/// <returns>
+/// MgHttpResponse
+/// This contains the response (including MgHttpResult and StatusCode) from the server.
+/// </returns>
+void MgHttpDescribeRuntimeMap::Execute(MgHttpResponse& hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ Ptr<MgByteReader> byteReader;
+
+ Ptr<MgMap> map = new MgMap(m_siteConn);
+ map->Open(m_mapName);
+
+ Ptr<MgMappingService> mappingService = (MgMappingService*)CreateService(MgServiceType::MappingService);
+ byteReader = mappingService->DescribeRuntimeMap(map, m_iconFormat, m_iconWidth, m_iconHeight, m_requestDataMask, m_iconLimitPerScaleRange);
+ // Convert to requested response format, if necessary
+ ProcessFormatConversion(byteReader);
+
+ hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpDescribeRuntimeMap.Execute")
+}
+
+/// <summary>
+/// This method is responsible for checking if
+/// a valid version was given
+/// </summary>
+/// <returns>Returns nothing</returns>
+void MgHttpDescribeRuntimeMap::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(2,6,0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpDescribeRuntimeMap.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpDescribeRuntimeMap.ValidateOperationVersion");
+}
Copied: trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.h (from rev 7708, sandbox/jng/getruntimemap/Web/src/HttpHandler/HttpDescribeRuntimeMap.h)
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.h (rev 0)
+++ trunk/MgDev/Web/src/HttpHandler/HttpDescribeRuntimeMap.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -0,0 +1,72 @@
+//
+// Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _HTTP_DESCRIBE_RUNTIME_MAP_
+#define _HTTP_DESCRIBE_RUNTIME_MAP_
+
+typedef std::map<STRING, MdfModel::LayerDefinition*> LayerDefinitionMap;
+
+class MgHttpDescribeRuntimeMap : public MgHttpRequestResponseHandler
+{
+HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpDescribeRuntimeMap(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+ /// <summary>
+ /// Returns the classification of this request/response handler
+ /// </summary>
+ /// <returns>
+ /// Classification of handler
+ /// </returns>
+ MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+
+ /// <summary>
+ /// This method is responsible for checking if
+ /// a valid version was given
+ /// </summary>
+ /// <returns>Returns nothing</returns>
+ virtual void ValidateOperationVersion();
+
+private:
+ STRING m_mapName;
+ STRING m_iconFormat;
+ INT32 m_iconWidth;
+ INT32 m_iconHeight;
+ INT32 m_requestDataMask;
+ INT32 m_iconLimitPerScaleRange;
+};
+
+#endif // _HTTP_CREATE_RUNTIME_MAP_
Modified: trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj 2013-08-13 14:46:28 UTC (rev 7763)
@@ -246,6 +246,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="HttpDescribeRuntimeMap.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="HttpEnumerateRepositories.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -951,6 +957,7 @@
<ClInclude Include="HttpDeleteRepository.h" />
<ClInclude Include="HttpDeleteResource.h" />
<ClInclude Include="HttpDeleteResourceData.h" />
+ <ClInclude Include="HttpDescribeRuntimeMap.h" />
<ClInclude Include="HttpEnumerateRepositories.h" />
<ClInclude Include="HttpEnumerateResourceData.h" />
<ClInclude Include="HttpEnumerateResourceReferences.h" />
Modified: trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2013-08-13 14:46:28 UTC (rev 7763)
@@ -383,6 +383,9 @@
<ClCompile Include="HttpCreateRuntimeMap.cpp">
<Filter>Mapping Service</Filter>
</ClCompile>
+ <ClCompile Include="HttpDescribeRuntimeMap.cpp">
+ <Filter>Mapping Service</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="HttpApplyResourcePackage.h">
@@ -754,6 +757,9 @@
<ClInclude Include="HttpCreateRuntimeMap.h">
<Filter>Mapping Service</Filter>
</ClInclude>
+ <ClInclude Include="HttpDescribeRuntimeMap.h">
+ <Filter>Mapping Service</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HttpHandler.rc" />
Modified: trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -40,6 +40,7 @@
#include "HttpDeleteResource.cpp"
#include "HttpDeleteResourceData.cpp"
#include "HttpDescribeDrawing.cpp"
+#include "HttpDescribeRuntimeMap.cpp"
#include "HttpDescribeSchema.cpp"
#include "HttpEnumerateDataStores.cpp"
#include "HttpEnumerateDrawingLayers.cpp"
Modified: trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -79,6 +79,7 @@
#include "HttpGetPlot.h"
#include "HttpGetLegendImage.h"
#include "HttpGetFeatureSetEnvelope.h"
+#include "HttpDescribeRuntimeMap.h"
// Http Rendering Service operations
#include "HttpGetDynamicMapOverlayImage.h"
@@ -342,6 +343,7 @@
//declare each Http class creator, associate the operation name with it
//
httpClassCreators[MgHttpResourceStrings::opCreateRuntimeMap] = MgHttpCreateRuntimeMap::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opDescribeRuntimeMap] = MgHttpDescribeRuntimeMap::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetMap] = MgHttpGetMap::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetMapUpdate] = MgHttpGetMapUpdate::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetDrawing] = MgHttpGetDrawing::CreateObject;
Modified: trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp 2013-08-13 14:46:28 UTC (rev 7763)
@@ -189,6 +189,7 @@
// Mapping Service Operation Requests
const STRING MgHttpResourceStrings::opCreateRuntimeMap = L"CREATERUNTIMEMAP";
+const STRING MgHttpResourceStrings::opDescribeRuntimeMap = L"DESCRIBERUNTIMEMAP";
const STRING MgHttpResourceStrings::opGetMap = L"GETMAP";
const STRING MgHttpResourceStrings::opGetMapUpdate = L"GETMAPUPDATE";
const STRING MgHttpResourceStrings::opGetPlot = L"GETPLOT";
Modified: trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h 2013-08-13 14:46:28 UTC (rev 7763)
@@ -298,6 +298,7 @@
// Mapping services
static const STRING opCreateRuntimeMap;
+ static const STRING opDescribeRuntimeMap;
static const STRING opGetMap;
static const STRING opGetMapUpdate;
static const STRING opGetPlot;
Modified: trunk/MgDev/Web/src/HttpHandler/Makefile.am
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/Makefile.am 2013-08-12 14:49:57 UTC (rev 7762)
+++ trunk/MgDev/Web/src/HttpHandler/Makefile.am 2013-08-13 14:46:28 UTC (rev 7763)
@@ -38,6 +38,7 @@
HttpDeleteResource.cpp \
HttpDeleteResourceData.cpp \
HttpDescribeDrawing.cpp \
+ HttpDescribeRuntimeMap.cpp \
HttpDescribeSchema.cpp \
HttpEnumerateDataStores.cpp \
HttpEnumerateDrawingLayers.cpp \
@@ -163,6 +164,7 @@
HttpDeleteResource.h \
HttpDeleteResourceData.h \
HttpDescribeDrawing.h \
+ HttpDescribeRuntimeMap.h \
HttpDescribeSchema.h \
HttpEnumerateDataStores.h \
HttpEnumerateDrawingLayers.h \
More information about the mapguide-commits
mailing list