[mapguide-commits] r8436 - in trunk/MgDev: Common/MapGuideCommon/Controller Common/MapGuideCommon/Services Server/src/Services/Rendering Server/src/UnitTesting UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Oct 31 05:57:39 PDT 2014
Author: jng
Date: 2014-10-31 05:57:38 -0700 (Fri, 31 Oct 2014)
New Revision: 8436
Modified:
trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.h
trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h
trunk/MgDev/Common/MapGuideCommon/Services/RenderingDefs.h
trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h
trunk/MgDev/Server/src/Services/Rendering/OpRenderMap.cpp
trunk/MgDev/Server/src/Services/Rendering/RenderingOperationFactory.cpp
trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp
trunk/MgDev/Server/src/UnitTesting/TestRenderingService.h
trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getmapimageform.html
trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp
trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.h
Log:
#2399: Implement RFC 148 - Support user-defined selection color in RenderMap.
This consists of the following changes:
- Add 2 new overloads of RenderMap to MgRenderingService that accept a selection color.
- Add new opcodes for the new RenderMap overloads.
- Add a new unit test that exercises all overloads of RenderMap, ensuring that any overload where a selection color is not passed still renders as blue and any overload that is passed a selection color will render any selections in said color.
- Add support for v3.0.0 of the GETMAPIMAGE operation in the mapagent.
- Add new overload of GetMapImage in MgHtmlController that accepts a selection color. This is invoked by the v3.0.0 GETMAPIMAGE operation from the mapagent.
Modified: trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -81,6 +81,15 @@
MgByteReader* MgHtmlController::GetMapImage(MgMap* map, MgSelection* selection,
CREFSTRING format, MgPropertyCollection* mapViewCommands, bool bKeepSelection, bool bClip)
{
+ return GetMapImage(map, selection, format, mapViewCommands, bKeepSelection, bClip, NULL);
+}
+
+//////////////////////////////////////////////////////////////////
+// Processes a GetMapImage request from the Viewer and returns an image of the specified map.
+//
+MgByteReader* MgHtmlController::GetMapImage(MgMap* map, MgSelection* selection,
+ CREFSTRING format, MgPropertyCollection* mapViewCommands, bool bKeepSelection, bool bClip, MgColor* selectionColor)
+{
// Apply map view commands
ApplyMapViewCommands(map, mapViewCommands);
@@ -92,7 +101,7 @@
Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
// Call the C++ API
- return service->RenderMap(map, selection, format, bKeepSelection, bClip);
+ return service->RenderMap(map, selection, format, bKeepSelection, bClip, selectionColor);
}
//////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -96,6 +96,39 @@
//////////////////////////////////////////////////////////////////
/// \brief
+ /// Processes a GetMapImage request from the Viewer and returns an image of the specified map.
+ ///
+ /// \param map
+ /// Map object to use
+ /// \param selection
+ /// Selection to use
+ /// \param format
+ /// Image format, from MgImageFormats
+ /// \param mapViewCommands
+ /// Commands to be applied to the map before generation
+ /// \param bKeepSelection
+ /// Input
+ /// true if you want to keep the selection
+ /// \param bClip
+ /// Input
+ /// true if you want to clip the feature geometry
+ /// \param selectionColor
+ /// The color to render selections with
+ ///
+ /// \return
+ /// A byte reader containing the map image
+ ///
+ MgByteReader* GetMapImage(
+ MgMap* map,
+ MgSelection* selection,
+ CREFSTRING format,
+ MgPropertyCollection* mapViewCommands,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
/// Processes a GetVisibleMapExtent request from the Viewer and returns info the specified map.
///
/// \param mapName
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -417,7 +417,59 @@
return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
+/////////////////////////////////////////////////////////////////
+/// <summary>
+/// Renders the specified MgMap to the requested image format.
+/// </summary>
+/// <param name="map">Input
+/// map object containing current state of map.
+/// </param>
+/// <param name="selection">Input
+/// map feature selection. Specifies the selected features on the map
+/// </param>
+/// <param name="format">Input
+/// image format. Defines the format of the resulting image
+/// </param>
+/// <param name="bKeepSelection">Input
+/// true if you want to keep the selection
+/// </param>
+/// <param name="bClip">Input
+/// true if you want to clip feature geometry
+/// </param>
+/// <param name="selectionColor">Input
+/// The color to render selections
+/// </param>
+/// <returns>
+/// A byte reader containing the rendered image
+/// </returns>
+MgByteReader* MgProxyRenderingService::RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ CREFSTRING format,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgRenderingServiceOpId::RenderMap7, // Command Code
+ 6, // No of arguments
+ Rendering_Service, // Service Id
+ BUILD_VERSION(3,0,0), // Operation version
+ MgCommand::knObject, map, // Argument#1
+ MgCommand::knObject, selection, // Argument#2
+ MgCommand::knString, &format, // Argument#3
+ MgCommand::knInt8, (INT8)bKeepSelection, // Argument#4
+ MgCommand::knInt8, (INT8)bClip, // Argument#5
+ MgCommand::knObject, selectionColor, // Argument#6
+ MgCommand::knNone); // End of arguments
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
+
/////////////////////////////////////////////////////////////////
/// <summary>
/// Renders the specified MgMap to the requested image format.
@@ -636,6 +688,42 @@
return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
+MgByteReader* MgProxyRenderingService::RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ MgCoordinate* center,
+ double scale,
+ INT32 width,
+ INT32 height,
+ MgColor* backgroundColor,
+ CREFSTRING format,
+ bool bKeepSelection,
+ MgColor* selectionColor)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgRenderingServiceOpId::RenderMap6, // Command Code
+ 10, // No of arguments
+ Rendering_Service, // Service Id
+ BUILD_VERSION(3,0,0), // Operation version
+ MgCommand::knObject, map, // Argument#1
+ MgCommand::knObject, selection, // Argument#2
+ MgCommand::knObject, center, // Argument#3
+ MgCommand::knDouble, scale, // Argument#4
+ MgCommand::knInt32, width, // Argument#5
+ MgCommand::knInt32, height, // Argument#6
+ MgCommand::knObject, backgroundColor, // Argument#7
+ MgCommand::knString, &format, // Argument#8
+ MgCommand::knInt8, (INT8)bKeepSelection,// Argument#9
+ MgCommand::knObject, selectionColor, // Argument#10
+ MgCommand::knNone); // End of arguments
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
+
/////////////////////////////////////////////////////////////////
/// <summary>
/// Renders the legend for the specified MgMap to the requested size and format
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -344,6 +344,37 @@
/// \param selection
/// Input
/// map feature selection. Specifies the selected features on the map
+ /// \param format
+ /// Input
+ /// image format. Defines the format of the resulting image
+ /// \param bKeepSelection
+ /// Input
+ /// true if you want to keep the selection
+ /// \param bClip
+ /// Input
+ /// true if you want to clip feature geometry
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ CREFSTRING format,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor);
+
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Renders the specified MgMap to the requested image format.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
/// \param extents
/// Input
/// map extents. Specifies the extents for the map
@@ -442,6 +473,12 @@
/// \param format
/// Input
/// image format. Defines the format of the resulting image
+ /// \param bKeepSelection
+ /// Input
+ /// true if you want to keep the selection
+ /// \param selectionColor
+ /// Input
+ /// The color to use for rendered selections
///
/// \return
/// A byte reader containing the rendered image
@@ -454,6 +491,50 @@
INT32 width,
INT32 height,
MgColor* backgroundColor,
+ CREFSTRING format,
+ bool bKeepSelection,
+ MgColor* selectionColor);
+
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Renders the specified MgMap to the requested image format.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
+ /// \param center
+ /// Input
+ /// map center point. Specifies the center point for the map
+ /// \param scale
+ /// Input
+ /// map scale. Specifies the scale for the map
+ /// \param width
+ /// Input
+ /// image width. Specifies the image width in pixels
+ /// \param height
+ /// Input
+ /// image height. Specifies the image height in pixels
+ /// \param backgroundColor
+ /// Input
+ /// background color. Specifies the map background color
+ /// \param format
+ /// Input
+ /// image format. Defines the format of the resulting image
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ MgCoordinate* center,
+ double scale,
+ INT32 width,
+ INT32 height,
+ MgColor* backgroundColor,
CREFSTRING format);
/////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Services/RenderingDefs.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/RenderingDefs.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Services/RenderingDefs.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -43,6 +43,8 @@
static const int RenderTile2 = 0x1111E90F;
static const int RenderTileXYZ = 0x1111E910;
static const int RenderTileXYZ2 = 0x1111E911;
+ static const int RenderMap6 = 0x1111E912;
+ static const int RenderMap7 = 0x1111E913;
};
/// \endcond
Modified: trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -360,6 +360,37 @@
/// \param selection
/// Input
/// map feature selection. Specifies the selected features on the map
+ /// \param format
+ /// Input
+ /// image format. Defines the format of the resulting image
+ /// \param bKeepSelection
+ /// Input
+ /// true if you want to keep the selection
+ /// \param bClip
+ /// Input
+ /// true if you want to clip feature geometry
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ CREFSTRING format,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor) = 0;
+
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Renders the specified MgMap to the requested image format.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
/// \param extents
/// Input
/// map extents. Specifies the extents for the map
@@ -520,6 +551,56 @@
/////////////////////////////////////////////////////////////////
/// \brief
+ /// Renders the specified MgMap to the requested image format.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
+ /// \param center
+ /// Input
+ /// map center point. Specifies the center point for the map
+ /// \param scale
+ /// Input
+ /// map scale. Specifies the scale for the map
+ /// \param width
+ /// Input
+ /// image width. Specifies the image width in pixels
+ /// \param height
+ /// Input
+ /// image height. Specifies the image height in pixels
+ /// \param backgroundColor
+ /// Input
+ /// background color. Specifies the map background color
+ /// \param format
+ /// Input
+ /// image format. Defines the format of the resulting image
+ /// \param bKeepSelection
+ /// Input
+ /// true if you want to keep the selection
+ /// \param selectionColor
+ /// Input
+ /// The color to use for rendered selections
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderMap(
+ MgMap* map,
+ MgSelection* selection,
+ MgCoordinate* center,
+ double scale,
+ INT32 width,
+ INT32 height,
+ MgColor* backgroundColor,
+ CREFSTRING format,
+ bool bKeepSelection,
+ MgColor* selectionColor) = 0;
+
+ /////////////////////////////////////////////////////////////////
+ /// \brief
/// Renders the legend for the specified MgMap to the requested size and format
///
/// \param map
Modified: trunk/MgDev/Server/src/Services/Rendering/OpRenderMap.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/OpRenderMap.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/Services/Rendering/OpRenderMap.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -169,6 +169,68 @@
EndExecution(byteReader);
}
+ else if (6 == m_packet.m_NumArguments)
+ {
+ Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+ Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+ map->SetDelayedLoadResourceService(m_resourceService);
+
+ Ptr<MgSelection> selection = (MgSelection*)m_stream->GetObject();
+ if(selection)
+ selection->SetMap(map);
+
+ Ptr<MgEnvelope> env = map->GetDataExtent();
+ Ptr<MgCoordinate> ll = env->GetLowerLeftCoordinate();
+ Ptr<MgCoordinate> ur = env->GetUpperRightCoordinate();
+
+ STRING format;
+ m_stream->GetString(format);
+
+ bool bKeepSelection = false;
+ m_stream->GetBoolean(bKeepSelection);
+
+ bool bClip = false;
+ m_stream->GetBoolean(bClip);
+
+ Ptr<MgColor> selColor = (MgColor*)m_stream->GetObject();
+
+ 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(L"MgSelection");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bKeepSelection);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bClip);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgSelection");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ // [(llx lly) (urx ury)]
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L" [");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START()
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(ll->GetX());
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L" ");
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(ll->GetY());
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L" ");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(ur->GetX());
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L" ");
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(ur->GetY());
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"] ");
+
+ Validate();
+
+ Ptr<MgByteReader> byteReader =
+ m_service->RenderMap(map, selection, format, bKeepSelection, bClip, selColor);
+
+ EndExecution(byteReader);
+ }
else if (8 == m_packet.m_NumArguments)
{
Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
@@ -342,39 +404,77 @@
bool bKeepSelection = false;
m_stream->GetBoolean(bKeepSelection);
- auto_ptr<ProfileRenderMapResult> pProfileRenderMapResult;
- pProfileRenderMapResult.reset((ProfileRenderMapResult*)m_stream->GetObject());
+ if (m_packet.m_OperationVersion == MG_API_VERSION(3, 0, 0)) //10th arg here is selection color
+ {
+ Ptr<MgColor> selColor = (MgColor*)m_stream->GetObject();
- BeginExecution();
+ 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(L"MgSelection");
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgCoordinate");
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(scale);
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_INT32(width);
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_INT32(height);
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgColor");
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bKeepSelection);
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"ProfileRenderMapResult");
- MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ 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(L"MgSelection");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgCoordinate");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(scale);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(width);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(height);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgColor");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bKeepSelection);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgColor");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
- Validate();
+ Validate();
- Ptr<MgByteReader> byteReader =
- m_service->RenderMap(map, selection, center, scale, width, height, color, format, bKeepSelection, pProfileRenderMapResult.get());
+ Ptr<MgByteReader> byteReader =
+ m_service->RenderMap(map, selection, center, scale, width, height, color, format, bKeepSelection, selColor);
- EndExecution(byteReader);
+ EndExecution(byteReader);
+ }
+ else
+ {
+ auto_ptr<ProfileRenderMapResult> pProfileRenderMapResult;
+ pProfileRenderMapResult.reset((ProfileRenderMapResult*)m_stream->GetObject());
+
+ 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(L"MgSelection");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgCoordinate");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(scale);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(width);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(height);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgColor");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_BOOL(bKeepSelection);
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"ProfileRenderMapResult");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ Ptr<MgByteReader> byteReader =
+ m_service->RenderMap(map, selection, center, scale, width, height, color, format, bKeepSelection, pProfileRenderMapResult.get());
+
+ EndExecution(byteReader);
+ }
}
else
{
Modified: trunk/MgDev/Server/src/Services/Rendering/RenderingOperationFactory.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/RenderingOperationFactory.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/Services/Rendering/RenderingOperationFactory.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -194,7 +194,28 @@
L"MgRenderingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
}
break;
-
+ case MgRenderingServiceOpId::RenderMap6:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(3,0):
+ handler.reset(new MgOpRenderMap());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgRenderingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
+ case MgRenderingServiceOpId::RenderMap7:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(3,0):
+ handler.reset(new MgOpRenderMap());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgRenderingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
case MgRenderingServiceOpId::QueryFeatures:
switch (VERSION_NO_PHASE(operationVersion))
{
Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -414,7 +414,7 @@
baseGroup->SetVisible(true);
// call the internal helper API to do all the stylization overhead work
- ret = RenderMapInternal(map, NULL, roLayers, dr.get(), drawWidth, drawHeight, width, height, tileImageFormat, scale, extent, true, true, false);
+ ret = RenderMapInternal(map, NULL, roLayers, dr.get(), drawWidth, drawHeight, width, height, tileImageFormat, scale, extent, true, true, false, NULL);
// restore the base group's visibility
baseGroup->SetVisible(groupVisible);
@@ -483,7 +483,7 @@
baseGroup->SetVisible(true);
// call the internal helper API to do all the stylization overhead work
- ret = RenderMapInternal(map, NULL, roLayers, dr.get(), width, height, width, height, format, scale, extent, true, true, false);
+ ret = RenderMapInternal(map, NULL, roLayers, dr.get(), width, height, width, height, format, scale, extent, true, true, false, NULL);
// restore the base group's visibility
baseGroup->SetVisible(groupVisible);
@@ -666,13 +666,26 @@
///////////////////////////////////////////////////////////////////////////////
// render complete map around center point in given scale using map's background
// color and display sizes as default arguments to call the real rendermap method
-// default arg (bKeepSelection = true, bClip = false)
+// default arg (bKeepSelection = true, bClip = false, selectionColor = NULL)
MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
MgSelection* selection,
CREFSTRING format,
bool bKeepSelection,
bool bClip)
{
+ return RenderMap(map, selection, format, bKeepSelection, bClip, NULL);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// render complete map around center point in given scale using map's background
+// color and display sizes as default arguments to call the real rendermap method
+MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
+ MgSelection* selection,
+ CREFSTRING format,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor)
+{
Ptr<MgByteReader> ret;
MG_TRY()
@@ -688,16 +701,15 @@
RS_Color col;
StylizationUtil::ParseColor(map->GetBackgroundColor(), col);
Ptr<MgColor> bgColor = new MgColor(col.red(), col.green(), col.blue(), col.alpha());
-
+
// punt to more specific RenderMap API
- ret = RenderMap(map, selection, center, scale, map->GetDisplayWidth(), map->GetDisplayHeight(), bgColor, format, bKeepSelection, bClip);
+ ret = RenderMap(map, selection, center, scale, map->GetDisplayWidth(), map->GetDisplayHeight(), bgColor, format, bKeepSelection, bClip, selectionColor);
MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderMap")
return ret.Detach();
}
-
///////////////////////////////////////////////////////////////////////////////
// default arg bKeepSelection = true
MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
@@ -812,7 +824,7 @@
auto_ptr<SE_Renderer> dr(CreateRenderer(drawWidth, drawHeight, bgcolor, false));
// call the internal helper API to do all the stylization overhead work
- ret = RenderMapInternal(map, selection, NULL, dr.get(), drawWidth, drawHeight, width, height, format, scale, b, false, bKeepSelection, true);
+ ret = RenderMapInternal(map, selection, NULL, dr.get(), drawWidth, drawHeight, width, height, format, scale, b, false, bKeepSelection, true, NULL);
MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderMap")
@@ -848,9 +860,24 @@
CREFSTRING format,
bool bKeepSelection)
{
- return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false);
+ Ptr<MgColor> selColor = new MgColor(0, 0, 255);
+ return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false, selColor);
}
+MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
+ MgSelection* selection,
+ MgCoordinate* center,
+ double scale,
+ INT32 width,
+ INT32 height,
+ MgColor* backgroundColor,
+ CREFSTRING format,
+ bool bKeepSelection,
+ MgColor* selectionColor)
+{
+ return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false, selectionColor);
+}
+
///////////////////////////////////////////////////////////////////////////////
// default arguments bClip = false
MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
@@ -864,7 +891,8 @@
bool bKeepSelection,
ProfileRenderMapResult* pPRMResult)
{
- return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false, pPRMResult);
+ Ptr<MgColor> selColor = new MgColor(0, 0, 255);
+ return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false, selColor, pPRMResult);
}
///////////////////////////////////////////////////////////////////////////////
@@ -881,6 +909,7 @@
CREFSTRING format,
bool bKeepSelection,
bool bClip,
+ MgColor* selectionColor,
ProfileRenderMapResult* pPRMResult)
{
Ptr<MgByteReader> ret;
@@ -943,7 +972,7 @@
}
// call the internal helper API to do all the stylization overhead work
- ret = RenderMapInternal(map, selection, NULL, dr.get(), width, height, width, height, format, scale, b, false, bKeepSelection, true, pPRMResult);
+ ret = RenderMapInternal(map, selection, NULL, dr.get(), width, height, width, height, format, scale, b, false, bKeepSelection, true, selectionColor, pPRMResult);
MG_CATCH(L"MgServerRenderingService.RenderMap")
if (mgException.p)
@@ -1139,10 +1168,12 @@
bool expandExtents,
bool bKeepSelection,
bool renderWatermark,
+ MgColor* selectionColor,
ProfileRenderMapResult* pPRMResult)
{
- MgRenderingOptions options(format, MgRenderingOptions::RenderSelection |
- MgRenderingOptions::RenderLayers | (bKeepSelection? MgRenderingOptions::KeepSelection : 0), NULL);
+ MgRenderingOptions options(format,
+ MgRenderingOptions::RenderSelection | MgRenderingOptions::RenderLayers | (bKeepSelection? MgRenderingOptions::KeepSelection : 0),
+ selectionColor);
return RenderMapInternal(map, selection, roLayers, dr, drawWidth, drawHeight, saveWidth, saveHeight, scale, b, expandExtents, &options, renderWatermark, pPRMResult);
}
Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -105,6 +105,13 @@
virtual MgByteReader* RenderMap(MgMap* map,
MgSelection* selection,
+ CREFSTRING format,
+ bool bKeepSelection,
+ bool bClip,
+ MgColor* selectionColor);
+
+ virtual MgByteReader* RenderMap(MgMap* map,
+ MgSelection* selection,
MgEnvelope* extents,
INT32 width,
INT32 height,
@@ -148,6 +155,17 @@
MgColor* backgroundColor,
CREFSTRING format,
bool bKeepSelection,
+ MgColor* selectionColor);
+
+ virtual MgByteReader* RenderMap(MgMap* map,
+ MgSelection* selection,
+ MgCoordinate* center,
+ double scale,
+ INT32 width,
+ INT32 height,
+ MgColor* backgroundColor,
+ CREFSTRING format,
+ bool bKeepSelection,
ProfileRenderMapResult* pPRMResult);
virtual MgByteReader* RenderMap(MgMap* map,
@@ -160,6 +178,7 @@
CREFSTRING format,
bool bKeepSelection,
bool bClip,
+ MgColor* selectionColor,
ProfileRenderMapResult* pPRMResult = NULL);
virtual MgByteReader* RenderMapLegend(MgMap* map,
@@ -235,6 +254,7 @@
bool expandExtents,
bool bKeepSelection,
bool renderWatermark,
+ MgColor* selectionColor,
ProfileRenderMapResult* pPRMResult = NULL);
MgByteReader* RenderMapInternal(MgMap* map,
Modified: trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -714,6 +714,89 @@
}
}
+void TestRenderingService::TestCase_RenderMapWithSelection(CREFSTRING imageFormat, CREFSTRING extension)
+{
+ try
+ {
+ // make a runtime map
+ Ptr<MgMap> map = CreateTestMap();
+
+ // Make a selection set and initialize it
+ Ptr<MgSelection> sel = new MgSelection(map);
+ sel->FromXml(L"");
+
+ MgServiceManager* serviceManager = MgServiceManager::GetInstance();
+ Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(serviceManager->RequestService(MgServiceType::FeatureService));
+ assert(featSvc != NULL);
+
+ Ptr<MgFeatureQueryOptions> query = new MgFeatureQueryOptions();
+ query->SetFilter(L"Autogenerated_SDF_ID = 1");
+ Ptr<MgLayerCollection> layers = map->GetLayers();
+ Ptr<MgLayerBase> layer = layers->GetItem(L"Parcels");
+ Ptr<MgFeatureReader> rdr = layer->SelectFeatures(query);
+
+ INT32 width = 640;
+ INT32 height = 480;
+ Ptr<MgColor> bgColor = new MgColor(map->GetBackgroundColor());
+ //This is the inflated bounds around the parcel with Autogenerated_SDF_ID = 1
+ Ptr<MgEnvelope> extents = new MgEnvelope(-87.75979253783224, 43.78089182030202, -87.75322168532644, 43.78710288549482);
+ Ptr<MgPoint> centerPt;
+ if (rdr->ReadNext())
+ {
+ MgAgfReaderWriter agfRw;
+ Ptr<MgByteReader> agf = ((MgReader*)rdr)->GetGeometry(layer->GetFeatureGeometryName());
+ Ptr<MgGeometry> geom = agfRw.Read(agf);
+ centerPt = geom->GetCentroid();
+
+ sel->AddFeatureIdInt32(layer, layer->GetFeatureClassName(), rdr->GetInt32(L"Autogenerated_SDF_ID"));
+ }
+
+ Ptr<MgCoordinate> center = centerPt->GetCoordinate();
+
+ rdr->Close();
+
+ //Exercise all overloads. Except for the last one, any of these overloads that render a selection should render with blue
+ map->SetViewScale(8000.0);
+ map->SetViewCenter(centerPt);
+
+ Ptr<MgByteReader> rdr1 = m_svcRendering->RenderMap(map, sel, imageFormat); //This just funnels the 4-arg version w/ keepSelection = true
+ rdr1->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr1", imageFormat, extension));
+
+ Ptr<MgByteReader> rdr2 = m_svcRendering->RenderMap(map, sel, imageFormat, false);
+ rdr2->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr2", imageFormat, extension));
+
+ Ptr<MgByteReader> rdr3 = m_svcRendering->RenderMap(map, sel, imageFormat, true, true);
+ rdr3->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr3", imageFormat, extension));
+
+ Ptr<MgByteReader> rdr4 = m_svcRendering->RenderMap(map, sel, extents, width, height, bgColor, imageFormat);
+ rdr4->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr4", imageFormat, extension)); //This just funnels to the version below w/ keepSelection = true
+
+ Ptr<MgByteReader> rdr5 = m_svcRendering->RenderMap(map, sel, extents, width, height, bgColor, imageFormat, false);
+ rdr5->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr5", imageFormat, extension));
+
+ Ptr<MgByteReader> rdr6 = m_svcRendering->RenderMap(map, sel, center, 5000.0, width, height, bgColor, imageFormat);
+ rdr6->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr6", imageFormat, extension));
+
+ Ptr<MgByteReader> rdr7 = m_svcRendering->RenderMap(map, sel, center, 5000.0, width, height, bgColor, imageFormat, false);
+ rdr7->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr7", imageFormat, extension));
+
+ //This is the new overload introduced with 3.0, it should render selections with the color we specify
+ Ptr<MgColor> selColor = new MgColor(255, 0, 0);
+ Ptr<MgByteReader> rdr8 = m_svcRendering->RenderMap(map, sel, center, 5000.0, width, height, bgColor, imageFormat, true, selColor);
+ rdr8->ToFile(GetPath(L"../UnitTestFiles/RenderMapWithSelection_rdr8", imageFormat, extension));
+ }
+ catch (MgException* e)
+ {
+ STRING message = e->GetDetails(TEST_LOCALE);
+ SAFE_RELEASE(e);
+ CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+ }
+ catch (...)
+ {
+ throw;
+ }
+}
+
void TestRenderingService::TestCase_RenderMapWithWatermark(CREFSTRING imageFormat, CREFSTRING extension)
{
try
Modified: trunk/MgDev/Server/src/UnitTesting/TestRenderingService.h
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestRenderingService.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Server/src/UnitTesting/TestRenderingService.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -42,6 +42,7 @@
CPPUNIT_TEST(TestCase_RenderDynamicOverlayPNG);
CPPUNIT_TEST(TestCase_RenderDynamicOverlayTiledMapPNG);
CPPUNIT_TEST(TestCase_RenderMapPNG);
+ CPPUNIT_TEST(TestCase_RenderMapWithSelectionPNG);
CPPUNIT_TEST(TestCase_RenderMapWithWatermarkPNG);
CPPUNIT_TEST(TestCase_RenderLegendPNG);
CPPUNIT_TEST(TestCase_RenderLegendEmptyGroupsPNG);
@@ -70,6 +71,7 @@
CPPUNIT_TEST(TestCase_RenderDynamicOverlayPNG8);
CPPUNIT_TEST(TestCase_RenderDynamicOverlayTiledMapPNG8);
CPPUNIT_TEST(TestCase_RenderMapPNG8);
+ CPPUNIT_TEST(TestCase_RenderMapWithSelectionPNG8);
CPPUNIT_TEST(TestCase_RenderMapWithWatermarkPNG8);
CPPUNIT_TEST(TestCase_RenderLegendPNG8);
CPPUNIT_TEST(TestCase_RenderLegendEmptyGroupsPNG8);
@@ -98,6 +100,7 @@
CPPUNIT_TEST(TestCase_RenderDynamicOverlayGIF);
CPPUNIT_TEST(TestCase_RenderDynamicOverlayTiledMapGIF);
CPPUNIT_TEST(TestCase_RenderMapGIF);
+ CPPUNIT_TEST(TestCase_RenderMapWithSelectionGIF);
CPPUNIT_TEST(TestCase_RenderMapWithWatermarkGIF);
CPPUNIT_TEST(TestCase_RenderLegendGIF);
CPPUNIT_TEST(TestCase_RenderLegendEmptyGroupsGIF);
@@ -126,6 +129,7 @@
CPPUNIT_TEST(TestCase_RenderDynamicOverlayJPG);
CPPUNIT_TEST(TestCase_RenderDynamicOverlayTiledMapJPG);
CPPUNIT_TEST(TestCase_RenderMapJPG);
+ CPPUNIT_TEST(TestCase_RenderMapWithSelectionJPG);
CPPUNIT_TEST(TestCase_RenderMapWithWatermarkJPG);
CPPUNIT_TEST(TestCase_RenderLegendJPG);
CPPUNIT_TEST(TestCase_RenderLegendEmptyGroupsJPG);
@@ -164,6 +168,7 @@
void TestCase_RenderDynamicOverlay(CREFSTRING imageFormat, CREFSTRING extension);
void TestCase_RenderDynamicOverlayTiledMap(CREFSTRING imageFormat, CREFSTRING extension);
void TestCase_RenderMap(CREFSTRING imageFormat, CREFSTRING extension);
+ void TestCase_RenderMapWithSelection(CREFSTRING imageFormat, CREFSTRING extension);
void TestCase_RenderMapWithWatermark(CREFSTRING imageFormat, CREFSTRING extension);
void TestCase_RenderLegend(CREFSTRING imageFormat, CREFSTRING extension);
void TestCase_RenderLegendEmptyGroups(CREFSTRING imageFormat, CREFSTRING extension);
@@ -192,6 +197,7 @@
void TestCase_RenderDynamicOverlayPNG() { TestCase_RenderDynamicOverlay(L"PNG", L"png"); }
void TestCase_RenderDynamicOverlayTiledMapPNG() { TestCase_RenderDynamicOverlayTiledMap(L"PNG", L"png"); }
void TestCase_RenderMapPNG() { TestCase_RenderMap(L"PNG", L"png"); }
+ void TestCase_RenderMapWithSelectionPNG() { TestCase_RenderMapWithSelection(L"PNG", L"png"); }
void TestCase_RenderMapWithWatermarkPNG() { TestCase_RenderMapWithWatermark(L"PNG", L"png"); }
void TestCase_RenderLegendPNG() { TestCase_RenderLegend(L"PNG", L"png"); }
void TestCase_RenderLegendEmptyGroupsPNG() { TestCase_RenderLegendEmptyGroups(L"PNG", L"png"); }
@@ -218,6 +224,7 @@
void TestCase_RenderDynamicOverlayPNG8() { TestCase_RenderDynamicOverlay(L"PNG8", L"png"); }
void TestCase_RenderDynamicOverlayTiledMapPNG8() { TestCase_RenderDynamicOverlayTiledMap(L"PNG8", L"png"); }
void TestCase_RenderMapPNG8() { TestCase_RenderMap(L"PNG8", L"png"); }
+ void TestCase_RenderMapWithSelectionPNG8() { TestCase_RenderMapWithSelection(L"PNG8", L"png"); }
void TestCase_RenderMapWithWatermarkPNG8() { TestCase_RenderMapWithWatermark(L"PNG8", L"png"); }
void TestCase_RenderLegendPNG8() { TestCase_RenderLegend(L"PNG8", L"png"); }
void TestCase_RenderLegendEmptyGroupsPNG8() { TestCase_RenderLegendEmptyGroups(L"PNG8", L"png"); }
@@ -244,6 +251,7 @@
void TestCase_RenderDynamicOverlayGIF() { TestCase_RenderDynamicOverlay(L"GIF", L"gif"); }
void TestCase_RenderDynamicOverlayTiledMapGIF() { TestCase_RenderDynamicOverlayTiledMap(L"GIF", L"gif"); }
void TestCase_RenderMapGIF() { TestCase_RenderMap(L"GIF", L"gif"); }
+ void TestCase_RenderMapWithSelectionGIF() { TestCase_RenderMapWithSelection(L"GIF", L"gif"); }
void TestCase_RenderMapWithWatermarkGIF() { TestCase_RenderMapWithWatermark(L"GIF", L"gif"); }
void TestCase_RenderLegendGIF() { TestCase_RenderLegend(L"GIF", L"gif"); }
void TestCase_RenderLegendEmptyGroupsGIF() { TestCase_RenderLegendEmptyGroups(L"GIF", L"gif"); }
@@ -270,6 +278,7 @@
void TestCase_RenderDynamicOverlayJPG() { TestCase_RenderDynamicOverlay(L"JPG", L"jpg"); }
void TestCase_RenderDynamicOverlayTiledMapJPG() { TestCase_RenderDynamicOverlayTiledMap(L"JPG", L"jpg"); }
void TestCase_RenderMapJPG() { TestCase_RenderMap(L"JPG", L"jpg"); }
+ void TestCase_RenderMapWithSelectionJPG() { TestCase_RenderMapWithSelection(L"JPG", L"jpg"); }
void TestCase_RenderMapWithWatermarkJPG() { TestCase_RenderMapWithWatermark(L"JPG", L"jpg"); }
void TestCase_RenderLegendJPG() { TestCase_RenderLegend(L"JPG", L"jpg"); }
void TestCase_RenderLegendEmptyGroupsJPG() { TestCase_RenderLegendEmptyGroups(L"JPG", L"jpg"); }
Modified: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getmapimageform.html
===================================================================
--- trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getmapimageform.html 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getmapimageform.html 2014-10-31 12:57:38 UTC (rev 8436)
@@ -9,7 +9,7 @@
<div nowrap="true">
<b>Operation:</b> <input type="text" name="OPERATION" value="GETMAPIMAGE" size="50" ID="Text1">
<p>
- Version: <input type="text" name="VERSION" value="1.0.0" size="10" ID="Text2">
+ Version: <input type="text" name="VERSION" value="3.0.0" size="10" ID="Text2">
<p>
<br>
Enter either:
@@ -31,6 +31,8 @@
<p>
Selection XML: <input type="text" name="SELECTION" value="" size="80" ID="Text8">
<p>
+ Selection Color: <input type="text" name="SELECTIONCOLOR" value="" size="80" ID="Text114">
+ <p>
------------------------------ Commands (optional) ------------------------------
<p>
View center X: <input type="text" name="SETVIEWCENTERX" size="10" ID="Text101">
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp 2014-10-31 12:57:38 UTC (rev 8436)
@@ -111,8 +111,21 @@
// Call the HTML controller to render the map image
MgHtmlController controller(m_siteConn);
- Ptr<MgByteReader> reader = controller.GetMapImage(map, selection, m_mapFormat, commands, m_bKeepSelection, m_bClip);
+ // v3.0 supports a selection color parameter
+ Ptr<MgColor> selColor;
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version == MG_API_VERSION(3,0,0))
+ {
+ STRING strSelColor = params->GetParameterValue(MgHttpResourceStrings::reqRenderingSelectionColor);
+ if (!strSelColor.empty())
+ {
+ selColor = new MgColor(strSelColor);
+ }
+ }
+
+ Ptr<MgByteReader> reader = controller.GetMapImage(map, selection, m_mapFormat, commands, m_bKeepSelection, m_bClip, selColor);
+
// If we opened the map from the repository then save it back to ensure
// any track changes are removed from the persisted version, since these
// are not applicable for AJAX.
@@ -124,3 +137,24 @@
MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetMapImage.Execute")
}
+
+/// <summary>
+/// This method is responsible for checking if
+/// a valid version was given
+/// </summary>
+/// <returns>Returns nothing</returns>
+void MgHttpGetMapImage::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(1,0,0) &&
+ version != MG_API_VERSION(3,0,0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpGetMapImage.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpGetMapImage.ValidateOperationVersion");
+}
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.h 2014-10-30 00:19:00 UTC (rev 8435)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetMapImage.h 2014-10-31 12:57:38 UTC (rev 8436)
@@ -51,6 +51,14 @@
/// </returns>
MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+protected:
+ /// <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_mapDefinition;
More information about the mapguide-commits
mailing list