[mapguide-commits] r7382 - branches/2.5/MgDev/Web/src/mapviewernet

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Feb 21 17:00:59 PST 2013


Author: hubu
Date: 2013-02-21 17:00:58 -0800 (Thu, 21 Feb 2013)
New Revision: 7382

Modified:
   branches/2.5/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx
Log:
Submit on behalf of Andy Zhang.

This submission refines change list #7290 which implemented ticket #2193. 
In previous change #7290, I updated the web side ASP files to Use API MgSelectionBase::GenerateFilters instead of MgSelectionBase::GenerateFilter to avoid the filter text exceed the SQL length limit. We find the performance of 'select features' degrades a lot when selecting many features after this change. The reason is that previous change results in multiple DB queries + multiple request/response traffic between Web Server and Map Server, which will impact the performance a lot. 
Because the case that 'filter text exceed the SQL length limit' only happens when the PK of a feature class has more than one columns, and now most databases support very long SQL statement (actually only one customer reported this issue until now), we decide to partially revert the change #7290 to still uses API GenerateFilter in the ASP files. 

Modified: branches/2.5/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx
===================================================================
--- branches/2.5/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx	2013-02-21 13:21:51 UTC (rev 7381)
+++ branches/2.5/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx	2013-02-22 01:00:58 UTC (rev 7382)
@@ -84,7 +84,6 @@
     String locale;
     CultureInfo culture;
     System.Text.RegularExpressions.Regex regex;
-    const int RenderSelectionBatchSize = 30000; /* default filter size */
 
     static NameValueCollection GetLayerPropertyMappings(MgResourceService resSvc, MgLayerBase layer)
     {
@@ -313,70 +312,66 @@
                 }
 
                 query.AddFeatureProperty(geomName);
-                MgStringCollection filters = selection.GenerateFilters(layer, className, RenderSelectionBatchSize);
-                for (int j = 0; j < filters.GetCount(); j++)
-                {
-                    String filter = filters.GetItem(j);
-                    query.SetFilter(filter);
+                String filter = selection.GenerateFilter(layer, className);
+                query.SetFilter(filter);
 
-                    MgFeatureReader reader = layer.SelectFeatures(query);
+                MgFeatureReader reader = layer.SelectFeatures(query);
 
-                    MgClassDefinition clsDef = reader.GetClassDefinition();
-                    MgPropertyDefinitionCollection props = clsDef.GetProperties();
+                MgClassDefinition clsDef = reader.GetClassDefinition();
+                MgPropertyDefinitionCollection props = clsDef.GetProperties();
 
-                    while (reader.ReadNext())
+                while (reader.ReadNext())
+                {
+                    Feature feat = new Feature(layerName);
+                    ZoomBox zoom = null;
+
+                    for (int k = 0; k < props.Count; k++)
                     {
-                        Feature feat = new Feature(layerName);
-                        ZoomBox zoom = null;
+                        MgPropertyDefinition propDef = props[k];
+                        String propName = propDef.Name;
+                        int propType = reader.GetPropertyType(propName);
 
-                        for (int k = 0; k < props.Count; k++)
+                        if (mappings[propName] != null || propType == MgPropertyType.Geometry)
                         {
-                            MgPropertyDefinition propDef = props[k];
-                            String propName = propDef.Name;
-                            int propType = reader.GetPropertyType(propName);
-
-                            if (mappings[propName] != null || propType == MgPropertyType.Geometry)
+                            String value = "";
+                            if (!reader.IsNull(propName))
                             {
-                                String value = "";
-                                if (!reader.IsNull(propName))
+                                if (propName == geomName)
                                 {
-                                    if (propName == geomName)
-                                    {
-                                        MgByteReader agf = reader.GetGeometry(propName);
-                                        MgGeometry geom = agfRW.Read(agf);
+                                    MgByteReader agf = reader.GetGeometry(propName);
+                                    MgGeometry geom = agfRW.Read(agf);
 
-                                        MgEnvelope env = geom.Envelope();
-                                        MgCoordinate ll = env.GetLowerLeftCoordinate();
-                                        MgCoordinate ur = env.GetUpperRightCoordinate();
+                                    MgEnvelope env = geom.Envelope();
+                                    MgCoordinate ll = env.GetLowerLeftCoordinate();
+                                    MgCoordinate ur = env.GetUpperRightCoordinate();
 
-                                        zoom = new ZoomBox();
-                                        zoom.MinX = ll.X;
-                                        zoom.MinY = ll.Y;
-                                        zoom.MaxX = ur.X;
-                                        zoom.MaxY = ur.Y;
+                                    zoom = new ZoomBox();
+                                    zoom.MinX = ll.X;
+                                    zoom.MinY = ll.Y;
+                                    zoom.MaxX = ur.X;
+                                    zoom.MaxY = ur.Y;
 
-                                        feat.Zoom = zoom;
-                                    }
-                                    else
-                                    {
-                                        value = GetPropertyValueFromFeatureReader(reader, agfRW, propType, propName);
-                                    }
+                                    feat.Zoom = zoom;
+                                }
+                                else
+                                {
+                                    value = GetPropertyValueFromFeatureReader(reader, agfRW, propType, propName);
+                                }
 
-                                    if (mappings[propName] != null)
-                                    {
-                                        FeatureProperty fp = new FeatureProperty();
-                                        fp.Name = mappings[propName];
-                                        fp.Value = value;
+                                if (mappings[propName] != null)
+                                {
+                                    FeatureProperty fp = new FeatureProperty();
+                                    fp.Name = mappings[propName];
+                                    fp.Value = value;
 
-                                        feat.AddProperty(fp);
-                                    }
+                                    feat.AddProperty(fp);
                                 }
                             }
                         }
-                        selectionSet.AddFeature(feat);
                     }
-                    reader.Close();
+                    selectionSet.AddFeature(feat);
                 }
+                reader.Close();
             }
 
             //Now output the selection set



More information about the mapguide-commits mailing list