[mapguide-commits] r1061 - in branches/1.1.x/MgDev: Common/MapGuideCommon/Controller Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jan 18 22:55:32 EST 2007


Author: waltweltonlair
Date: 2007-01-18 22:55:32 -0500 (Thu, 18 Jan 2007)
New Revision: 1061

Modified:
   branches/1.1.x/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
   branches/1.1.x/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp
Log:
We are currently generating track changes in the context of AJAX Viewer, but
these are never getting cleared.  Over time the number of track changes stored
in the MgMap could potentially grow large.  Track changes are only needed for
DWF.  Ideally MgMap would have a flag which indicated whether the map is being
used in the context of DWF or AJAX, and then we could simply check that flag in
MgMapBase::TrackChange and not track if AJAX is active.

For now I've added calls to clear the track changes for all rendering APIs used
by AJAX Viewer:
	GetDynamicMapOverlayImage
	GetMapImage
	GetMapLegendImage
	GetMapVisibleExtent
	QueryMapFeatures


Modified: branches/1.1.x/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- branches/1.1.x/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2007-01-19 03:46:04 UTC (rev 1060)
+++ branches/1.1.x/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2007-01-19 03:55:32 UTC (rev 1061)
@@ -37,6 +37,14 @@
     Ptr<MgMap> map = new MgMap();
     map->Open(resourceService, mapName);
 
+    // Make sure we clear any track changes - these are not applicable for AJAX.
+    Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
+    if (changeLists->GetCount() > 0)
+    {
+        map->ClearChanges();
+        map->Save(resourceService);
+    }
+
     // Get the selection
     Ptr<MgSelection> selection = new MgSelection(map);
     selection->Open(resourceService, mapName);
@@ -57,6 +65,10 @@
     // Apply map view commands
     ApplyMapViewCommands(map, mapViewCommands);
 
+    // Make sure we clear any track changes - these are not applicable for AJAX.
+    if (NULL != map)
+        map->ClearChanges();
+
     // Get Proxy Rendering Service instance
     Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
 
@@ -80,6 +92,9 @@
     // Apply map view commands
     ApplyMapViewCommands(map, mapViewCommands);
 
+    // Make sure we clear any track changes - these are not applicable for AJAX.
+    map->ClearChanges();
+
     // Save the MgMap state
     map->Save(resourceService);
 
@@ -128,6 +143,14 @@
     Ptr<MgMap> map = new MgMap();
     map->Open(resourceService, mapName);
 
+    // Make sure we clear any track changes - these are not applicable for AJAX.
+    Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
+    if (changeLists->GetCount() > 0)
+    {
+        map->ClearChanges();
+        map->Save(resourceService);
+    }
+
     // Create Proxy Rendering Service instance
     Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
 
@@ -153,6 +176,14 @@
     Ptr<MgMap> map = new MgMap();
     map->Open(resourceService, mapName);
 
+    // Make sure we clear any track changes - these are not applicable for AJAX.
+    Ptr<MgNamedCollection> changeLists = map->GetChangeLists();
+    if (changeLists->GetCount() > 0)
+    {
+        map->ClearChanges();
+        map->Save(resourceService);
+    }
+
     // Create Proxy Rendering Service instance
     Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
 

Modified: branches/1.1.x/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp
===================================================================
--- branches/1.1.x/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp	2007-01-19 03:46:04 UTC (rev 1060)
+++ branches/1.1.x/MgDev/Web/src/HttpHandler/HttpGetMapImage.cpp	2007-01-19 03:55:32 UTC (rev 1061)
@@ -67,11 +67,15 @@
 
     Ptr<MgResourceService> resourceService = dynamic_cast<MgResourceService*>(CreateService(MgServiceType::ResourceService));
 
+    bool openedMap = false;
+
     // Create MgMap and selection
     Ptr<MgMap> map = new MgMap();
     Ptr<MgSelection> selection;
     if (!m_mapName.empty() && !sessionId.empty())
     {
+        openedMap = true;
+
         map->Open(resourceService, m_mapName);
 
         // Get the selection
@@ -93,6 +97,12 @@
     MgHtmlController controller(m_siteConn);
     Ptr<MgByteReader> reader = controller.GetMapImage(map, selection, m_mapFormat, commands);
 
+    // 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.
+    if (openedMap)
+        map->Save(resourceService);
+
     // Set the result
     hResult->SetResultObject(reader, reader->GetMimeType());
 



More information about the mapguide-commits mailing list