[mapguide-commits] r7412 - sandbox/adsk/2.4j/Web/src/mapviewernet
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 25 00:53:59 PDT 2013
Author: hubu
Date: 2013-03-25 00:53:59 -0700 (Mon, 25 Mar 2013)
New Revision: 7412
Modified:
sandbox/adsk/2.4j/Web/src/mapviewernet/getselectedfeatures.aspx
Log:
Submit on behalf of Andy Zhang
This submission is part of ticket http://trac.osgeo.org/mapguide/ticket/2193
In previous change #7289, I updated the file 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 will result 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 most databases support very long SQL statement, we decide to partially revert the change #7289 to still use GenerateFilter in the ASP file.
Modified: sandbox/adsk/2.4j/Web/src/mapviewernet/getselectedfeatures.aspx
===================================================================
--- sandbox/adsk/2.4j/Web/src/mapviewernet/getselectedfeatures.aspx 2013-03-22 12:21:43 UTC (rev 7411)
+++ sandbox/adsk/2.4j/Web/src/mapviewernet/getselectedfeatures.aspx 2013-03-25 07:53:59 UTC (rev 7412)
@@ -83,7 +83,6 @@
String sessionId;
String locale;
CultureInfo culture;
- const int RenderSelectionBatchSize = 30000; /* default filter size */
static NameValueCollection GetLayerPropertyMappings(MgResourceService resSvc, MgLayerBase layer)
{
@@ -310,70 +309,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