[mapguide-commits] r8333 - trunk/MgDev/Common/MapGuideCommon/Controller

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Aug 17 22:21:35 PDT 2014


Author: hubu
Date: 2014-08-17 22:21:35 -0700 (Sun, 17 Aug 2014)
New Revision: 8333

Modified:
   trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
Log:
#2479: Select features doesn't work if map has no CS.

The reason is that it will call MgCoordinateSystemFactory::Create(CREFSTRING wkt) in method MgHtmlController::QueryMapFeatures(). If the map doesn't have CS assigned, a null argument exception will be thrown. Now we add a check for map->GetMapSRS() to solve the issue.



Modified: trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2014-08-15 08:25:11 UTC (rev 8332)
+++ trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2014-08-18 05:21:35 UTC (rev 8333)
@@ -434,7 +434,9 @@
     Ptr<MgReadOnlyLayerCollection> selLayers = selectionSet->GetLayers();
     if (NULL != selLayers.p)
     {
-        Ptr<MgCoordinateSystem> mapCs = csFactory.Create(map->GetMapSRS());
+        Ptr<MgCoordinateSystem> mapCs;
+        if (map->GetMapSRS() != L"")
+            mapCs = csFactory.Create(map->GetMapSRS());
         // Our structure is as follows
         //
         // [0...n] <SelectedLayer> - A layer containing selected features
@@ -450,7 +452,9 @@
             Ptr<MgLayerBase> selLayer = selLayers->GetItem(i);
             STRING layerName = selLayer->GetName();
 
-            Ptr<MgCoordinateSystemTransform> transform = GetLayerToMapTransform(selLayer, mapCs, &csFactory, featureService);
+            Ptr<MgCoordinateSystemTransform> transform;
+            if (mapCs)
+                transform = GetLayerToMapTransform(selLayer, mapCs, &csFactory, featureService);
 
             xmlOut.append(L"<SelectedLayer id=\"");
             xmlOut.append(selLayer->GetObjectId());



More information about the mapguide-commits mailing list