[mapguide-commits] r9058 - branches/3.1/MgDev/Common/MapGuideCommon/Controller

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Oct 6 10:59:13 PDT 2016


Author: jng
Date: 2016-10-06 10:59:12 -0700 (Thu, 06 Oct 2016)
New Revision: 9058

Modified:
   branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
Log:
#2746: Use iteration of PropertyMapping elements to control the order in which property names are written out. Thus the LayerMetadata element of a QUERYMAPFEATURES response is the source of truth with regards to display order of feature attributes.

The AJAX and Fusion viewers will be updated in future commits to display attributes in the order specified by the LayerMetadata element.

Modified: branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-09-30 13:03:39 UTC (rev 9057)
+++ branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-10-06 17:59:12 UTC (rev 9058)
@@ -492,22 +492,22 @@
                 MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
                 if(vl != NULL)
                 {
+                    STRING pTypeStr;
                     MdfModel::NameStringPairCollection* pmappings = vl->GetPropertyMappings();
                     for (int j=0; j<pmappings->GetCount(); j++)
                     {
                         MdfModel::NameStringPair* m = pmappings->GetAt(j);
-                        propNames->Add(m->GetName());
-                        displayNameMap.insert(std::make_pair(m->GetName(), m->GetValue()));
-                    }
-                    STRING pTypeStr;
-                    for (int k = 0; k < clsProps->GetCount(); k++)
-                    {
-                        Ptr<MgPropertyDefinition> propDef = clsProps->GetItem(k);
-                        STRING propName = propDef->GetName();
-                        DisplayNameMap::iterator it = displayNameMap.find(propName);
-                        //Skip properties without display mappings
-                        if (it == displayNameMap.end())
+                        const MdfModel::MdfString& name = m->GetName();
+                        const MdfModel::MdfString& dispName = m->GetValue();
+                        propNames->Add(name);
+                        displayNameMap.insert(std::make_pair(name, dispName));
+
+                        INT32 propIndex = clsProps->IndexOf(name);
+                        if (propIndex < 0) {
                             continue;
+                        }
+
+                        Ptr<MgPropertyDefinition> propDef = clsProps->GetItem(propIndex);
                         INT32 pdType = propDef->GetPropertyType();
                         INT32 pType = MgPropertyType::Null;
                         if (pdType == MgFeaturePropertyType::DataProperty)
@@ -521,13 +521,13 @@
                         MgUtil::Int32ToString(pType, pTypeStr);
                         xmlOut.append(L"<Property>\n");
                         xmlOut.append(L"<Name>");
-                        xmlOut.append(it->first);
+                        xmlOut.append(name);
                         xmlOut.append(L"</Name>\n");
                         xmlOut.append(L"<Type>");
                         xmlOut.append(pTypeStr);
                         xmlOut.append(L"</Type>\n");
                         xmlOut.append(L"<DisplayName>");
-                        xmlOut.append(it->second);
+                        xmlOut.append(dispName);
                         xmlOut.append(L"</DisplayName>\n");
                         xmlOut.append(L"</Property>\n");
                     }



More information about the mapguide-commits mailing list