Home | Docs | Issue Tracker | FAQ | Download | |
Date: | 2007/07/09 |
---|---|
Author: | Steve Lime |
Contact: | steve.lime at dnr.state.mn.us |
Last Edited: | 2007/07/09 |
Status: | draft |
Version: | MapServer 5.0 |
Id: | $Id$ |
The function msLayerWhichItems() is a function in maplayer.c that determines exactly which feature attributes need to be retrieved from a given data source. All item-based properties (e.g. CLASSITEM, bound properties, EXPRESSIONs, etc...) are checked and a master list (an array) is compiled. At the same time index references are made (e.g. classitemindex, labelitemindex, etc...). The item indexes are used instead of names to access attribute values at runtime.
The problem with this method is that a feature (a shapeObj) used for drawing or the first pass of a query is not the same as that used for presentation (the second pass of a query). The second pass of a query uses msLayerGetShape() which by default requests all attributes of a feature since we don’t know ahead of time which attributes might be output.
By removing msLayerWhichItems() and always retrieving all attributes a feature is a feature whether drawing, querying or outputing via a template so caching features now becomes practical.
As mentioned earlier msLayerWhichItems() does a couple of things. Some of these functions would need to be retained somehow and are described below.
int msGetItemIndex(char **itemlist, int numitems, char *item) {
int i;
if (!itemlist || numitems <= 0 || !item) return -1;
for (i=0; i<numitems; i++)
if(strcasecmp(itemlist[i], item) return i;
return -1; /* failure */
}
Note
this RFC does not address single pass queries, but rather sets the stage for them. Subsequent drawing, query and template output processes would remain unaltered.
maplayer.c - msLayerWhichItems() goes away. msLayerOpen() now sets the layer->items array.
maputil.c - Binding functions now must assign index references when executed. Same goes for the functions to assign a classObj to a feature.
mapdraw.c - Layeritemindex and classitemindex must now be dynamically assigned values.
It is unclear how each driver made use of the output of msLayerWhichItems(). It may be as easy as calling msLayerGetItems() instead of using msLayerGetItemInfo() in msLayerOpen() in which case we’d loose the msLayerGetItemInfo() function for each driver too (and the main wrapper function). TODO...
mapshape.c - mapsde.c - mapogr.cpp - mappostgis.c - maporaclespatial.c - mapmygis.c -
No changes.
No changes anticipated.
None. This is a new feature.
None assigned.
None