[mapguide-commits] r6673 - branches/2.4/MgDev/Desktop/MgDesktop/Services

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon May 21 10:24:06 EDT 2012


Author: jng
Date: 2012-05-21 07:24:06 -0700 (Mon, 21 May 2012)
New Revision: 6673

Modified:
   branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.h
Log:
mg-desktop logging enhancement part 3: Log public API access to MgRenderingService. Also re-route all PUBLISHED_API versions of RenderDynamicOverlay and RenderMap and GeneratePlot to an intermediate version of these respective methods to avoid access log pollution due to a PUBLISHED_API method chaining into multiple other PUBLISHED_API methods.

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.cpp	2012-05-21 13:13:43 UTC (rev 6672)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.cpp	2012-05-21 14:24:06 UTC (rev 6673)
@@ -234,8 +234,27 @@
 {
     Ptr<MgByteReader> byteReader;
 
+    MG_LOG_OPERATION_MESSAGE(L"GenerateLegendImage");
+
     MG_SERVER_MAPPING_SERVICE_TRY()
 
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 7);
+    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_DOUBLE(scale);
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_INT32(imgWidth);
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_INT32(imgHeight);
+    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_INT32(geomType);
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_INT32(themeCategory);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     MG_LOG_TRACE_ENTRY(L"MgServerMappingService::GenerateLegendImage");
 
     if (0 == resource)
@@ -338,8 +357,22 @@
         byteReader = src->GetReader();
     }
 
-    MG_SERVER_MAPPING_SERVICE_CATCH_AND_THROW(L"MgRenderingService::GenerateLegendImage")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_SERVER_MAPPING_SERVICE_CATCH(L"MgRenderingService::GenerateLegendImage")
+
+    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_SERVER_MAPPING_SERVICE_THROW()
+
     return byteReader.Detach();
 }
 
@@ -356,8 +389,27 @@
 {
     Ptr<MgByteReader> byteReader;
 
+    MG_LOG_OPERATION_MESSAGE(L"GeneratePlot");
+
     MG_SERVER_MAPPING_SERVICE_TRY()
 
+    Ptr<MgResourceIdentifier> mapId;
+    if (NULL != map)
+        mapId = map->GetResourceId();
+    Ptr<MgResourceIdentifier> layoutId;
+    if (NULL != layoutId)
+        layoutId = layout->GetLayout();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgResourceIdentifier" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgPlotSpecification");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == layoutId) ? L"MgResourceIdentifier" : layoutId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == dwfVersion) ? L"MgDwfVersion" : dwfVersion->GetLogString());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     MG_LOG_TRACE_ENTRY(L"MgServerMappingService::GeneratePlot()");
 
     if (NULL == map  || NULL == dwfVersion || NULL == plotSpec )
@@ -374,10 +426,24 @@
     mapPlots->Add(mapPlot);
 
     // Create the plot
-    byteReader = GenerateMultiPlot(mapPlots, dwfVersion);
+    byteReader = GenerateMultiPlotInternal(mapPlots, dwfVersion);
 
-    MG_SERVER_MAPPING_SERVICE_CATCH_AND_THROW(L"MgRenderingService::GeneratePlot")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_SERVER_MAPPING_SERVICE_CATCH(L"MgRenderingService::GeneratePlot")
+
+    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_SERVER_MAPPING_SERVICE_THROW()
+
     return byteReader.Detach();
 }
 
@@ -390,8 +456,31 @@
 {
     Ptr<MgByteReader> byteReader;
 
+    MG_LOG_OPERATION_MESSAGE(L"GeneratePlot");
+
     MG_SERVER_MAPPING_SERVICE_TRY()
 
+    Ptr<MgResourceIdentifier> mapId;
+    if (NULL != map)
+        mapId = map->GetResourceId();
+    Ptr<MgResourceIdentifier> layoutId;
+    if (NULL != layoutId)
+        layoutId = layout->GetLayout();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 6);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgResourceIdentifier" : mapId->ToString().c_str());
+    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_STRING(L"MgPlotSpecification");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == layoutId) ? L"MgResourceIdentifier" : layoutId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == dwfVersion) ? L"MgDwfVersion" : dwfVersion->GetLogString());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     MG_LOG_TRACE_ENTRY(L"MgServerMappingService::GeneratePlot()");
 
     if (NULL == map  || NULL == center || NULL == dwfVersion || NULL == plotSpec )
@@ -408,10 +497,24 @@
     mapPlots->Add(mapPlot);
 
     // Create the plot
-    byteReader = GenerateMultiPlot(mapPlots, dwfVersion);
+    byteReader = GenerateMultiPlotInternal(mapPlots, dwfVersion);
 
-    MG_SERVER_MAPPING_SERVICE_CATCH_AND_THROW(L"MgRenderingService::GeneratePlot")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_SERVER_MAPPING_SERVICE_CATCH(L"MgRenderingService::GeneratePlot")
+
+    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_SERVER_MAPPING_SERVICE_THROW()
+
     return byteReader.Detach();
 }
 
@@ -424,8 +527,31 @@
 {
     Ptr<MgByteReader> byteReader;
 
+    MG_LOG_OPERATION_MESSAGE(L"GeneratePlot");
     MG_SERVER_MAPPING_SERVICE_TRY()
 
+    Ptr<MgResourceIdentifier> mapId;
+    if (NULL != map)
+        mapId = map->GetResourceId();
+    Ptr<MgResourceIdentifier> layoutId;
+    if (NULL != layoutId)
+        layoutId = layout->GetLayout();
+
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 6);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgResourceIdentifier" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgEnvelope")
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_BOOL(expandToFit)
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgPlotSpecification");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == layoutId) ? L"MgResourceIdentifier" : layoutId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == dwfVersion) ? L"MgDwfVersion" : dwfVersion->GetLogString());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     MG_LOG_TRACE_ENTRY(L"MgServerMappingService::GeneratePlot()");
 
     if (NULL == map  || NULL == extents || NULL == plotSpec || NULL == dwfVersion )
@@ -457,16 +583,63 @@
     mapPlots->Add(mapPlot);
 
     // Create the plot
-    byteReader = GenerateMultiPlot(mapPlots, dwfVersion);
+    byteReader = GenerateMultiPlotInternal(mapPlots, dwfVersion);
 
-    MG_SERVER_MAPPING_SERVICE_CATCH_AND_THROW(L"MgRenderingService::GeneratePlot")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_SERVER_MAPPING_SERVICE_CATCH(L"MgRenderingService::GeneratePlot")
+
+    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_SERVER_MAPPING_SERVICE_THROW()
+
     return byteReader.Detach();
 }
 
-MgByteReader* MgRenderingService::GenerateMultiPlot(MgMapPlotCollection* mapPlots,
-                                                    MgDwfVersion* dwfVersion)
+MgByteReader* MgRenderingService::GenerateMultiPlot(MgMapPlotCollection* mapPlots, MgDwfVersion* dwfVersion)
 {
+    Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"GenerateMultiPlot");
+
+    MG_SERVER_MAPPING_SERVICE_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgMapPlotCollection");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == dwfVersion) ? L"MgDwfVersion" : dwfVersion->GetLogString().c_str());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+    ret = GenerateMultiPlotInternal(mapPlots, dwfVersion);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_SERVER_MAPPING_SERVICE_CATCH(L"MgRenderingService::GenerateMultiPlot")
+
+    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_SERVER_MAPPING_SERVICE_THROW()
+    return ret.Detach();
+}
+
+MgByteReader* MgRenderingService::GenerateMultiPlotInternal(MgMapPlotCollection* mapPlots, MgDwfVersion* dwfVersion)
+{
     Ptr<MgByteReader> byteReader;
 
     MG_SERVER_MAPPING_SERVICE_TRY()
@@ -845,15 +1018,26 @@
 // ---------------------------------- BEGIN Rendering Service APIs ----------------------------------------------- //
 
 ///////////////////////////////////////////////////////////////////////////////
-MgByteReader* MgRenderingService::RenderTile(MgdMap* map,
-                                                   CREFSTRING baseMapLayerGroupName,
-                                                   INT32 tileColumn,
-                                                   INT32 tileRow)
+MgByteReader* MgRenderingService::RenderTile(MgdMap* map, CREFSTRING baseMapLayerGroupName, INT32 tileColumn, INT32 tileRow)
 {
     Ptr<MgByteReader> ret;
 
+    MG_LOG_OPERATION_MESSAGE(L"RenderTile");
+
     MG_TRY()
 
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgResourceIdentifier" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileColumn);
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileRow);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     if (NULL == map || baseMapLayerGroupName.empty())
         throw new MgNullArgumentException(L"MgRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
 
@@ -911,8 +1095,22 @@
     ret = RenderTile(map, baseGroup, scaleIndex, MgTileParameters::tileWidth, MgTileParameters::tileHeight, scale,
                      tileMinX, tileMaxX, tileMinY, tileMaxY, MgTileParameters::tileFormat);
 
-    MG_CATCH_AND_THROW(L"MgRenderingService.RenderTile")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_CATCH(L"MgRenderingService::RenderTile")
+
+    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()
+
     return ret.Detach();
 }
 
@@ -989,38 +1187,139 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 // default arg bKeepSelection = true
-MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map,
-                                                             MgdSelection* selection,
-                                                             CREFSTRING format)
+MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map, MgdSelection* selection, CREFSTRING format)
 {
+    Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"RenderDynamicOverlay");
+
+    MG_TRY()
+
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     // Call updated RenderDynamicOverlay API
-    return RenderDynamicOverlay(map, selection, format, true);
+    //ret = RenderDynamicOverlay(map, selection, format, true);
+
+    // Call updated RenderDynamicOverlay API
+    MgRenderingOptions options(format, MgRenderingOptions::RenderSelection |
+        MgRenderingOptions::RenderLayers | MgRenderingOptions::KeepSelection, NULL);
+    ret = RenderDynamicOverlayInternal(map, selection, &options, NULL);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderDynamicOverlay")
+
+    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()
+
+    return ret.Detach();
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////
 // default arg bKeepSelection = true
-MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map,
-                                                             MgdSelection* selection,
-                                                             CREFSTRING format,
-                                                             bool bKeepSelection)
+MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map, MgdSelection* selection, CREFSTRING format, bool bKeepSelection)
 {
+    Ptr<MgByteReader> ret;
+
+    MG_LOG_OPERATION_MESSAGE(L"RenderDynamicOverlay");
+
+    MG_TRY()
+
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    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_PARAMETERS_END();
+
     // Call updated RenderDynamicOverlay API
     MgRenderingOptions options(format, MgRenderingOptions::RenderSelection |
         MgRenderingOptions::RenderLayers | (bKeepSelection? MgRenderingOptions::KeepSelection : 0), NULL);
-    return RenderDynamicOverlay(map, selection, &options);
+    ret = RenderDynamicOverlayInternal(map, selection, &options, NULL);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderDynamicOverlay")
+
+    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()
+
+    return ret.Detach();
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////
 // called from API (first call of AjaxPgPViewerSampleApplication)
 // default arg pPRMResult = NULL
-MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map,
-                                                             MgdSelection* selection,
-                                                             MgRenderingOptions* options)
+MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map, MgdSelection* selection, MgRenderingOptions* options)
 {
+    Ptr<MgByteReader> ret;
+
+    MG_LOG_OPERATION_MESSAGE(L"RenderDynamicOverlay");
+
+    MG_TRY()
+
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgRenderingOptions");
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
     // Call updated RenderDynamicOverlay API 
-    return RenderDynamicOverlay(map, selection, options, NULL);
+    ret = RenderDynamicOverlayInternal(map, selection, options, NULL);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderDynamicOverlay")
+
+    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()
+
+    return ret.Detach();
 }
 
 
@@ -1028,16 +1327,60 @@
 // Non-published RenderDynamicOverlay API with profile result parameter
 // pPRMResult - a pointer points to Profile Render Map Result.
 MgByteReader* MgRenderingService::RenderDynamicOverlay(MgdMap* map,
-                                                             MgdSelection* selection,
-                                                             MgRenderingOptions* options,
-                                                             ProfileRenderMapResult* pPRMResult)
+                                                       MgdSelection* selection,
+                                                       MgRenderingOptions* options,
+                                                       ProfileRenderMapResult* pPRMResult)
 {
     Ptr<MgByteReader> ret;
 
+    MG_LOG_OPERATION_MESSAGE(L"RenderDynamicOverlay");
+
     MG_TRY()
 
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgRenderingOptions");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"ProfileRenderMapResult");
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+    ret = RenderDynamicOverlayInternal(map, selection, options, pPRMResult);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderDynamicOverlay")
+
+    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()
+
+    return ret.Detach();
+}
+
+MgByteReader* MgRenderingService::RenderDynamicOverlayInternal(MgdMap* map,
+                                                               MgdSelection* selection,
+                                                               MgRenderingOptions* options,
+                                                               ProfileRenderMapResult* pPRMResult)
+{
+    Ptr<MgByteReader> ret;
+
+    MG_TRY()
+
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgNullArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // validate map view parameters
     int width            = map->GetDisplayWidth();
@@ -1047,23 +1390,23 @@
     double metersPerUnit = map->GetMetersPerUnit();
 
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     if (dpi <= 0)
-        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
 
     if (scale <= 0.0)
-        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
 
     if (metersPerUnit <= 0.0)
-        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgInvalidArgumentException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
     if (width * height > MAX_PIXELS)
-        throw new MgOutOfRangeException(L"MgRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
+        throw new MgOutOfRangeException(L"MgRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // compute map extent that corresponds to pixel extent
     Ptr<MgPoint> pt          = map->GetViewCenter();
@@ -1108,7 +1451,7 @@
     // call the internal helper API to do all the stylization overhead work
     ret = RenderMapInternal(map, selection, roLayers, dr.get(), width, height, width, height, scale, extent, false, options, true, pPRMResult);
 
-    MG_CATCH(L"MgRenderingService.RenderDynamicOverlay")
+    MG_CATCH(L"MgRenderingService.RenderDynamicOverlayInternal")
     if (mgException.p)
     {
         if(NULL != pPRMResult)
@@ -1133,22 +1476,89 @@
 ///////////////////////////////////////////////////////////////////////////////
 // default arg bKeepSelection = true
 MgByteReader* MgRenderingService::RenderMap(MgdMap* map,
-                                                  MgdSelection* selection,
-                                                  CREFSTRING format)
+                                            MgdSelection* selection,
+                                            CREFSTRING format)
 {
-    // Call updated RenderMap API
-    return RenderMap(map, selection, format, true);
+    Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"RenderMap");
+
+    MG_TRY()
+
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 3);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+    ret = RenderMapPublished(map, selection, format, true, false);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderMap")
+
+    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()
+
+    return ret.Detach();
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////
 // default arg bClip = false
 MgByteReader* MgRenderingService::RenderMap(MgdMap* map,
-                                                  MgdSelection* selection,
-                                                  CREFSTRING format,
-                                                  bool bKeepSelection)
+                                            MgdSelection* selection,
+                                            CREFSTRING format,
+                                            bool bKeepSelection)
 {
-    return RenderMap(map, selection, format, bKeepSelection, false);
+    Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"RenderMap");
+
+    MG_TRY()
+
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    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_PARAMETERS_END();
+
+    ret = RenderMapPublished(map, selection, format, bKeepSelection, false);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderMap")
+
+    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()
+
+    return ret.Detach();
 }
 
 
@@ -1157,17 +1567,63 @@
 // color and display sizes as default arguments to call the real rendermap method
 // default arg (bKeepSelection = true, bClip = false)
 MgByteReader* MgRenderingService::RenderMap(MgdMap* map,
-                                                  MgdSelection* selection,
-                                                  CREFSTRING format,
-                                                  bool bKeepSelection,
-                                                  bool bClip)
+                                            MgdSelection* selection,
+                                            CREFSTRING format,
+                                            bool bKeepSelection,
+                                            bool bClip)
 {
     Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"RenderMap");
 
     MG_TRY()
 
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 5);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgdSelection");
+    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_PARAMETERS_END();
+
+    ret = RenderMapPublished(map, selection, format, bKeepSelection, bClip);
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgRenderingService::RenderMap")
+
+    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()
+
+    return ret.Detach();
+}
+
+MgByteReader* MgRenderingService::RenderMapPublished(MgdMap* map,
+                                                     MgdSelection* selection,
+                                                     CREFSTRING format,
+                                                     bool bKeepSelection,
+                                                     bool bClip)
+{
+    Ptr<MgByteReader> ret;
+
+    MG_TRY()
+
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgNullArgumentException(L"MgRenderingService.RenderMapPublished", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgPoint> pt = map->GetViewCenter();
     Ptr<MgCoordinate> center = pt->GetCoordinate();
@@ -1181,7 +1637,7 @@
     // punt to more specific RenderMap API
     ret = RenderMap(map, selection, center, scale, map->GetDisplayWidth(), map->GetDisplayHeight(), bgColor, format, bKeepSelection, bClip);
 
-    MG_CATCH_AND_THROW(L"MgRenderingService.RenderMap")
+    MG_CATCH_AND_THROW(L"MgRenderingService.RenderMapPublished")
 
     return ret.Detach();
 }
@@ -1617,15 +2073,30 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 MgByteReader* MgRenderingService::RenderMapLegend(MgdMap* map,
-                                                        INT32 width,
-                                                        INT32 height,
-                                                        MgColor* backgroundColor,
-                                                        CREFSTRING format)
+                                                  INT32 width,
+                                                  INT32 height,
+                                                  MgColor* backgroundColor,
+                                                  CREFSTRING format)
 {
     Ptr<MgByteReader> ret;
+    MG_LOG_OPERATION_MESSAGE(L"CopyResource");
 
     MG_TRY()
 
+    Ptr<MgResourceIdentifier> mapId = map->GetResourceId();
+    MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 5);
+    MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapId) ? L"MgdMap" : mapId->ToString().c_str());
+    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_PARAMETERS_END();
+
     if (NULL == map || NULL == backgroundColor)
         throw new MgNullArgumentException(L"MgRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"", NULL);
 
@@ -1698,8 +2169,22 @@
         ret = bs->GetReader();
     }
 
-    MG_CATCH_AND_THROW(L"MgRenderingService.RenderMapLegend")
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
 
+    MG_CATCH(L"MgRenderingService::RenderMapLegend")
+
+    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()
+
     return ret.Detach();
 }
 

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.h
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.h	2012-05-21 13:13:43 UTC (rev 6672)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/RenderingService.h	2012-05-21 14:24:06 UTC (rev 6673)
@@ -86,40 +86,36 @@
 
     // --------------- BEGIN: DWF Rendering and miscellaneous APIs from MgMappingService -----------------------//
 	 virtual MgByteReader* GenerateLegendImage(MgResourceIdentifier* resource,
-                                              double scale,
-                                              INT32 width,
-                                              INT32 height,
-                                              CREFSTRING format,
-                                              INT32 geomType,
-                                              INT32 themeCategory);
+                                               double scale,
+                                               INT32 width,
+                                               INT32 height,
+                                               CREFSTRING format,
+                                               INT32 geomType,
+                                               INT32 themeCategory);
 
-    virtual MgByteReader* GeneratePlot(
-        MgdMap* map,
-        MgPlotSpecification* plotSpec,
-        MgLayout* layout,
-        MgDwfVersion* dwfVersion);
+    virtual MgByteReader* GeneratePlot(MgdMap* map,
+                                       MgPlotSpecification* plotSpec,
+                                       MgLayout* layout,
+                                       MgDwfVersion* dwfVersion);
 
-    virtual MgByteReader* GeneratePlot(
-        MgdMap* map,
-        MgCoordinate* center,
-        double scale,
-        MgPlotSpecification* plotSpec,
-        MgLayout* layout,
-        MgDwfVersion* dwfVersion);
+    virtual MgByteReader* GeneratePlot(MgdMap* map,
+                                       MgCoordinate* center,
+                                       double scale,
+                                       MgPlotSpecification* plotSpec,
+                                       MgLayout* layout,
+                                       MgDwfVersion* dwfVersion);
 
-    virtual MgByteReader* GeneratePlot(
-        MgdMap* map,
-        MgEnvelope* extents,
-        bool expandToFit,
-        MgPlotSpecification* plotSpec,
-        MgLayout* layout,
-        MgDwfVersion* dwfVersion);
+    virtual MgByteReader* GeneratePlot(MgdMap* map,
+                                       MgEnvelope* extents,
+                                       bool expandToFit,
+                                       MgPlotSpecification* plotSpec,
+                                       MgLayout* layout,
+                                       MgDwfVersion* dwfVersion);
 
-    virtual MgByteReader* GenerateMultiPlot(
-        MgMapPlotCollection* mapPlots,
-        MgDwfVersion* dwfVersion);
+    virtual MgByteReader* GenerateMultiPlot(MgMapPlotCollection* mapPlots, MgDwfVersion* dwfVersion);
 
 private:
+    virtual MgByteReader* GenerateMultiPlotInternal(MgMapPlotCollection* mapPlots, MgDwfVersion* dwfVersion);
 	bool FeatureTypeStyleSupportsGeomType(MdfModel::FeatureTypeStyle* fts, INT32 geomType);
 	// --------------- END: DWF Rendering and miscellaneous APIs from MgMappingService -----------------------//
 
@@ -198,6 +194,19 @@
                              double mcsMaxY,
                              CREFSTRING format);
 
+    // Internal help called by our PUBLISHED_API versions of RenderDynamicOverlay
+    MgByteReader* RenderDynamicOverlayInternal(MgdMap* map,
+                                               MgdSelection* selection,
+                                               MgRenderingOptions* options,
+                                               ProfileRenderMapResult* pPRMResult);
+
+    // Internal help called by our PUBLISHED_API versions of RenderMap
+    MgByteReader* RenderMapPublished(MgdMap* map,
+                                     MgdSelection* selection,
+                                     CREFSTRING format,
+                                     bool bKeepSelection,
+                                     bool bClip);
+
     // helper used by other methods
     MgByteReader* RenderMapInternal(MgdMap* map,
                                     MgdSelection* selection,



More information about the mapguide-commits mailing list