[mapguide-commits] r6478 - sandbox/adsk/2.4j/Common/MapGuideCommon/MapLayer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Feb 2 20:56:19 EST 2012


Author: christinebao
Date: 2012-02-02 17:56:19 -0800 (Thu, 02 Feb 2012)
New Revision: 6478

Modified:
   sandbox/adsk/2.4j/Common/MapGuideCommon/MapLayer/Map.cpp
Log:
Fix ticket http://trac.osgeo.org/mapguide/ticket/1944
when the map's layers are from different schemas, the features can't be selected

Modified: sandbox/adsk/2.4j/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- sandbox/adsk/2.4j/Common/MapGuideCommon/MapLayer/Map.cpp	2012-02-03 01:44:27 UTC (rev 6477)
+++ sandbox/adsk/2.4j/Common/MapGuideCommon/MapLayer/Map.cpp	2012-02-03 01:56:19 UTC (rev 6478)
@@ -1063,10 +1063,10 @@
     /// Typedefs for populating identity properties into the map
     typedef std::list<MgLayer*> LayerList;
     typedef std::map<STRING,LayerList> LayerClassMap;
-    typedef std::map<STRING,LayerClassMap> LayerFeatureSourceMap;
+    typedef std::map<STRING,LayerClassMap> LayerSchemaMap;
+    typedef std::map<STRING,LayerSchemaMap> LayerFeatureSourceMap;
 
     LayerFeatureSourceMap fsMap;
-    std::map<STRING,STRING> fsSchema;
 
     // Group layers by their feature source / class name
     for(int i = 0; i < m_layers->GetCount(); i++)
@@ -1080,8 +1080,7 @@
             layer->ParseFeatureName(featureService, className, schemaName);
             if (!schemaName.empty())
             {
-                fsMap[featureSource][className].push_back(layer.p);
-                fsSchema[featureSource] = schemaName;
+                fsMap[featureSource][schemaName][className].push_back(layer.p);
             }
         }
     }
@@ -1090,35 +1089,39 @@
     {
         // Assumption:  feature source is only referencing one schema
         STRING featureSource = fsIter->first;
-        STRING schemaName = fsSchema[featureSource];
         Ptr<MgResourceIdentifier> resId = new MgResourceIdentifier(featureSource);
-        LayerClassMap& classList = fsIter->second;
-        Ptr<MgStringCollection> classNames = new MgStringCollection();
-        for (LayerClassMap::iterator cIter = classList.begin(); cIter != classList.end(); ++cIter)
+        LayerSchemaMap& schemaList = fsIter->second;
+        for (LayerSchemaMap::iterator schemaIter = schemaList.begin(); schemaIter != schemaList.end(); ++schemaIter)
         {
-            classNames->Add(cIter->first);
-        }
+            STRING schemaName = schemaIter->first;
+            LayerClassMap& classList = schemaIter->second;
+            Ptr<MgStringCollection> classNames = new MgStringCollection();
+            for (LayerClassMap::iterator cIter = classList.begin(); cIter != classList.end(); ++cIter)
+            {
+                classNames->Add(cIter->first);
+            }
 
-        try
-        {
-            // Ignore failures when pulling identity properties
-            Ptr<MgClassDefinitionCollection> partialDefs = featureService->GetIdentityProperties(resId, schemaName, classNames);
-            for (int i = 0; i < partialDefs->GetCount(); i++)
+            try
             {
-                Ptr<MgClassDefinition> def = partialDefs->GetItem(i);
-                STRING className = def->GetName();
+                // Ignore failures when pulling identity properties
+                Ptr<MgClassDefinitionCollection> partialDefs = featureService->GetIdentityProperties(resId, schemaName, classNames);
+                for (int i = 0; i < partialDefs->GetCount(); i++)
+                {
+                    Ptr<MgClassDefinition> def = partialDefs->GetItem(i);
+                    STRING className = def->GetName();
 
-                LayerList& layers = fsMap[featureSource][className];
-                for (LayerList::iterator lIter = layers.begin(); lIter != layers.end(); ++lIter)
-                {
-                    (*lIter)->PopulateIdentityProperties(def);
+                    LayerList& layers = fsMap[featureSource][schemaName][className];
+                    for (LayerList::iterator lIter = layers.begin(); lIter != layers.end(); ++lIter)
+                    {
+                        (*lIter)->PopulateIdentityProperties(def);
+                    }
                 }
             }
+            catch (MgException* e)
+            {
+                e->Release();
+            }
         }
-        catch (MgException* e)
-        {
-            e->Release();
-        }
     }
 }
 



More information about the mapguide-commits mailing list