[mapserver-commits] r7589 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue May 13 13:30:43 EDT 2008
Author: sdlime
Date: 2008-05-13 13:30:43 -0400 (Tue, 13 May 2008)
New Revision: 7589
Modified:
trunk/mapserver/maptemplate.c
Log:
Added limit support to [feature]...[/feature] tag (RFC 36).
Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c 2008-05-13 13:23:08 UTC (rev 7588)
+++ trunk/mapserver/maptemplate.c 2008-05-13 17:30:43 UTC (rev 7589)
@@ -825,9 +825,12 @@
{
char *preTag, *postTag; /* text before and after the tag */
+ char *argValue;
char *tag, *tagInstance, *tagStart;
hashTableObj *tagArgs=NULL;
+ int limit = -1;
+
int i, j, status;
if(!*line) {
@@ -841,7 +844,8 @@
/* check for any tag arguments */
if(getTagArgs("feature", tagStart, &tagArgs) != MS_SUCCESS) return(MS_FAILURE);
if(tagArgs) {
- /* todo */
+ argValue = msLookupHashTable(tagArgs, "limit");
+ if(argValue) limit = atoi(argValue);
}
if(strstr(*line, "[/feature]") == NULL) { /* we know the closing tag must be here, if not throw an error */
@@ -879,7 +883,12 @@
mapserv->resultlayer = layer;
msInitShape(&(mapserv->resultshape));
- for(i=0; i<layer->resultcache->numresults; i++) {
+ if(limit == -1) /* return all */
+ limit = layer->resultcache->numresults;
+ else
+ limit = MS_MIN(limit, layer->resultcache->numresults);
+
+ for(i=0; i<limit; i++) {
status = msLayerGetShape(layer, &(mapserv->resultshape), layer->resultcache->results[i].tileindex, layer->resultcache->results[i].shapeindex);
if(status != MS_SUCCESS) return status;
More information about the mapserver-commits
mailing list