[mapguide-commits] r8563 - sandbox/adsk/3.0m/Common/MapGuideCommon/Controller

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Mar 8 18:03:18 PDT 2015


Author: hubu
Date: 2015-03-08 18:03:18 -0700 (Sun, 08 Mar 2015)
New Revision: 8563

Modified:
   sandbox/adsk/3.0m/Common/MapGuideCommon/Controller/HtmlController.cpp
Log:
#2547: Attribute values are wrong in Selection Panel if feature source is joined.
http://trac.osgeo.org/mapguide/ticket/2547, submit on behalf of Andy Zhang.

In selection panel, the order of attribute names is from 'LayerMetaData', which is same as the order of layer's property mappings. But the order of values is same as the order of properties in class definition. They are same in most cases. However, they may be different if feature source is joined or a view.

Now we use the order of properties in class definition for both cases. 


Modified: sandbox/adsk/3.0m/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- sandbox/adsk/3.0m/Common/MapGuideCommon/Controller/HtmlController.cpp	2015-03-05 15:35:06 UTC (rev 8562)
+++ sandbox/adsk/3.0m/Common/MapGuideCommon/Controller/HtmlController.cpp	2015-03-09 01:03:18 UTC (rev 8563)
@@ -486,37 +486,41 @@
                     MdfModel::NameStringPairCollection* pmappings = vl->GetPropertyMappings();
                     for (int j=0; j<pmappings->GetCount(); j++)
                     {
-                        STRING pTypeStr;
                         MdfModel::NameStringPair* m = pmappings->GetAt(j);
                         propNames->Add(m->GetName());
                         displayNameMap.insert(std::make_pair(m->GetName(), m->GetValue()));
-                        INT32 pidx = clsProps->IndexOf(m->GetName());
-                        if (pidx >= 0)
+                    }
+                    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())
+                            continue;
+                        INT32 pdType = propDef->GetPropertyType();
+                        INT32 pType = MgPropertyType::Null;
+                        if (pdType == MgFeaturePropertyType::DataProperty)
                         {
-                            Ptr<MgPropertyDefinition> propDef = clsProps->GetItem(pidx);
-                            INT32 pdType = propDef->GetPropertyType();
-                            INT32 pType = MgPropertyType::Null;
-                            if (pdType == MgFeaturePropertyType::DataProperty)
-                            {
-                                pType = ((MgDataPropertyDefinition*)propDef.p)->GetDataType();
-                            }
-                            else if (pdType == MgFeaturePropertyType::GeometricProperty)
-                            {
-                                pType = MgPropertyType::Geometry;
-                            }
-                            MgUtil::Int32ToString(pType, pTypeStr);
-                            xmlOut.append(L"<Property>\n");
-                            xmlOut.append(L"<Name>");
-                            xmlOut.append(m->GetName());
-                            xmlOut.append(L"</Name>\n");
-                            xmlOut.append(L"<Type>");
-                            xmlOut.append(pTypeStr);
-                            xmlOut.append(L"</Type>\n");
-                            xmlOut.append(L"<DisplayName>");
-                            xmlOut.append(m->GetValue());
-                            xmlOut.append(L"</DisplayName>\n");
-                            xmlOut.append(L"</Property>\n");
+                            pType = ((MgDataPropertyDefinition*)propDef.p)->GetDataType();
                         }
+                        else if (pdType == MgFeaturePropertyType::GeometricProperty)
+                        {
+                            pType = MgPropertyType::Geometry;
+                        }
+                        MgUtil::Int32ToString(pType, pTypeStr);
+                        xmlOut.append(L"<Property>\n");
+                        xmlOut.append(L"<Name>");
+                        xmlOut.append(it->first);
+                        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(L"</DisplayName>\n");
+                        xmlOut.append(L"</Property>\n");
                     }
                 }
             }



More information about the mapguide-commits mailing list