[mapserver-commits] r7147 - in trunk/mapserver: . mapscript/php3
mapscript/swiginc
svn at osgeo.org
svn at osgeo.org
Wed Dec 5 14:40:28 EST 2007
Author: dmorissette
Date: 2007-12-05 14:40:28 -0500 (Wed, 05 Dec 2007)
New Revision: 7147
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapogcfilter.c
trunk/mapserver/mapquery.c
trunk/mapserver/mapscript/php3/mapscript_i.c
trunk/mapserver/mapscript/swiginc/layer.i
trunk/mapserver/mapscript/swiginc/map.i
trunk/mapserver/mapserv.c
trunk/mapserver/mapserver.h
trunk/mapserver/mapwms.c
Log:
WMS GetFeatureInfo: honour FEATURE_COUNT for any INFO_FORMAT and
apply the FEATURE_COUNT per layer instead of globally (#2420, #1686)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/HISTORY.TXT 2007-12-05 19:40:28 UTC (rev 7147)
@@ -12,13 +12,17 @@
Current Version (5.1-dev, SVN trunk):
-------------------------------------
-- enable soft outlines on truetype labels. This is triggered with a new keyword OUTLINEWIDTH
- for the LABEL block (#2417)
+- WMS GetFeatureInfo: honour FEATURE_COUNT for any INFO_FORMAT and
+ apply the FEATURE_COUNT per layer instead of globally (#2420, #1686)
+
+- enable soft outlines on truetype labels. This is triggered with a new
+ keyword OUTLINEWIDTH for the LABEL block (#2417)
+
- fix clipping rectangle to take width as well as size into account (#2411)
- AGG: added and use a line and polygon adaptor to avoid copying shapeObj
- points to an agg path_storage. avoids a few mallocs and a few copies.
+ points to an agg path_storage. avoids a few mallocs and a few copies.
- fixed symbolsetObj not to set the SWIG immutable flag permanently
don't expose refcount and the symbol attributes (Ticket #2407)
@@ -35,7 +39,8 @@
- merge GD and AGG label cache drawing functions (#2390)
-- Enable AGG rendering of bitmap font labels instead of falling back to GD (#2387)
+- Enable AGG rendering of bitmap font labels instead of falling back to
+ GD (#2387)
- clean up treatment of encoding and wrap caracter
@@ -45,7 +50,8 @@
- AGG: pixel level simplification for line and polygon shapes (#2381)
-- fixed blue/green color swapping for space delimited strings bound to an attribute. (bug 2378)
+- fixed blue/green color swapping for space delimited strings bound to an
+ attribute. (bug 2378)
- don't remove points that are checked as being colinear (#2366)
@@ -68,13 +74,14 @@
this is triggered when the symbol is of TYPE SYMBOL *and* its ANTIALIAS is off
(wating to find a better solution to trigger this).
-- AGG: the pixmap of pixmap symbols is now cached in an agg-compatible state the first
- time it is accessed. this avoids rereading and retransforming it each time that
- symbol is used.
+- AGG: the pixmap of pixmap symbols is now cached in an agg-compatible state
+ the first time it is accessed. this avoids rereading and retransforming
+ it each time that symbol is used.
-- AGG: the imageObj now stores in what state it's alpha channel is in. The number of
- msAlphaGD2AGG/AGG2GD calls is now reduced, but most importantly each of these calls
- is usually just a check for this state and does no computation.
+- AGG: the imageObj now stores in what state it's alpha channel is in. The
+ number ofmsAlphaGD2AGG/AGG2GD calls is now reduced, but most importantly
+ each of these calls is usually just a check for this state and does
+ no computation.
- AGG: fixed a few artifacts in embedded legend rendering on rgba images.
@@ -111,7 +118,8 @@
- mappdf.c: support output in fastcgi case via msIO_fwrite() (#2406)
-- mapogcsos.c: Initial support for POST requests (#2379) and updated msSOSDispatch() handling
+- mapogcsos.c: Initial support for POST requests (#2379) and updated
+ msSOSDispatch() handling
- mapogr.cpp: Use pooling api to ensure per-thread sharing of connections
only (#2408)
Modified: trunk/mapserver/mapogcfilter.c
===================================================================
--- trunk/mapserver/mapogcfilter.c 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapogcfilter.c 2007-12-05 19:40:28 UTC (rev 7147)
@@ -355,7 +355,7 @@
}
msQueryByPoint(map, lp->index, MS_MULTIPLE,
- psQueryShape->line[0].point[0], 0);
+ psQueryShape->line[0].point[0], 0, 0);
}
}
else if (bShapeQuery && psQueryShape && psQueryShape->numlines > 0
Modified: trunk/mapserver/mapquery.c
===================================================================
--- trunk/mapserver/mapquery.c 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapquery.c 2007-12-05 19:40:28 UTC (rev 7147)
@@ -797,7 +797,21 @@
return(MS_FAILURE);
}
-int msQueryByPoint(mapObj *map, int qlayer, int mode, pointObj p, double buffer)
+/* msQueryByPoint()
+ *
+ * With mode=MS_SINGLE:
+ * Pass maxresults = 0 to have a single result across all layers (the closest
+ * shape from the first layer that finds a match).
+ * Pass maxresults = 1 to have up to one result per layer (the closest shape
+ * from each layer).
+ *
+ * With mode=MS_MULTIPLE:
+ * Pass maxresults = 0 to have an unlimited number of results.
+ * Pass maxresults > 0 to limit the number of results per layer (the shapes
+ * returned are the first ones found in each layer and are not necessarily
+ * the closest ones).
+ */
+int msQueryByPoint(mapObj *map, int qlayer, int mode, pointObj p, double buffer, int maxresults)
{
int l;
int start, stop=0;
@@ -937,15 +951,21 @@
}
}
- msFreeShape(&shape);
+ msFreeShape(&shape);
+
+ if (mode == MS_MULTIPLE && maxresults > 0 && lp->resultcache->numresults == maxresults) {
+ status = MS_DONE; /* got enough results for this layer */
+ break;
+ }
+
} /* next shape */
if(status != MS_DONE) return(MS_FAILURE);
msLayerClose(lp);
- if((lp->resultcache->numresults > 0) && (mode == MS_SINGLE)) /* no need to search any further */
- break;
+ if((lp->resultcache->numresults > 0) && (mode == MS_SINGLE) && (maxresults == 0))
+ break; /* no need to search any further */
} /* next layer */
/* was anything found? */
Modified: trunk/mapserver/mapscript/php3/mapscript_i.c
===================================================================
--- trunk/mapserver/mapscript/php3/mapscript_i.c 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapscript/php3/mapscript_i.c 2007-12-05 19:40:28 UTC (rev 7147)
@@ -145,7 +145,7 @@
int mapObj_queryByPoint(mapObj* self, pointObj *point,
int mode, double buffer) {
- return msQueryByPoint(self, -1, mode, *point, buffer);
+ return msQueryByPoint(self, -1, mode, *point, buffer, 0);
}
int mapObj_queryByRect(mapObj* self, rectObj rect) {
@@ -437,7 +437,7 @@
status = self->status;
self->status = MS_ON;
- retval = msQueryByPoint(map, self->index, mode, *point, buffer);
+ retval = msQueryByPoint(map, self->index, mode, *point, buffer, 0);
self->status = status;
return retval;
Modified: trunk/mapserver/mapscript/swiginc/layer.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/layer.i 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapscript/swiginc/layer.i 2007-12-05 19:40:28 UTC (rev 7147)
@@ -272,7 +272,7 @@
status = self->status;
self->status = MS_ON;
- retval = msQueryByPoint(map, self->index, mode, *point, buffer);
+ retval = msQueryByPoint(map, self->index, mode, *point, buffer, 0);
self->status = status;
return retval;
}
Modified: trunk/mapserver/mapscript/swiginc/map.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/map.i 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapscript/swiginc/map.i 2007-12-05 19:40:28 UTC (rev 7147)
@@ -222,7 +222,7 @@
}
int queryByPoint(pointObj *point, int mode, double buffer) {
- return msQueryByPoint(self, -1, mode, *point, buffer);
+ return msQueryByPoint(self, -1, mode, *point, buffer, 0);
}
int queryByRect(rectObj rect) {
Modified: trunk/mapserver/mapserv.c
===================================================================
--- trunk/mapserver/mapserv.c 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapserv.c 2007-12-05 19:40:28 UTC (rev 7147)
@@ -1382,14 +1382,14 @@
case FROMIMGPNT:
msObj->Map->extent = msObj->ImgExt; /* use the existing map extent */
setCoordinate();
- if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_SINGLE, msObj->MapPnt, 0)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_SINGLE, msObj->MapPnt, 0, 0)) != MS_SUCCESS) writeError();
break;
case FROMUSERPNT: /* only a buffer makes sense */
if(msObj->Buffer == -1) {
msSetError(MS_WEBERR, "Point given but no search buffer specified.", "mapserv()");
writeError();
}
- if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_SINGLE, msObj->MapPnt, msObj->Buffer)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_SINGLE, msObj->MapPnt, msObj->Buffer, 0)) != MS_SUCCESS) writeError();
break;
default:
msSetError(MS_WEBERR, "No way to the initial search, not enough information.", "mapserv()");
@@ -1401,12 +1401,12 @@
case FROMIMGPNT:
msObj->Map->extent = msObj->ImgExt; /* use the existing map extent */
setCoordinate();
- if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_MULTIPLE, msObj->MapPnt, 0)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_MULTIPLE, msObj->MapPnt, 0, 0)) != MS_SUCCESS) writeError();
break;
case FROMIMGBOX:
break;
case FROMUSERPNT: /* only a buffer makes sense */
- if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_MULTIPLE, msObj->MapPnt, msObj->Buffer)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, SelectLayerIndex, MS_MULTIPLE, msObj->MapPnt, msObj->Buffer, 0)) != MS_SUCCESS) writeError();
default:
setExtent(msObj);
if((status = msQueryByRect(msObj->Map, SelectLayerIndex, msObj->Map->extent)) != MS_SUCCESS) writeError();
@@ -1463,7 +1463,7 @@
msObj->Map->width = msObj->ImgCols;
msObj->Map->height = msObj->ImgRows;
if((status = msCalculateScale(msObj->Map->extent, msObj->Map->units, msObj->Map->width, msObj->Map->height, msObj->Map->resolution, &msObj->Map->scaledenom)) != MS_SUCCESS) writeError();
- if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_MULTIPLE, msObj->MapPnt, 0)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_MULTIPLE, msObj->MapPnt, 0, 0)) != MS_SUCCESS) writeError();
}
break;
case FROMIMGBOX:
@@ -1509,7 +1509,7 @@
break;
case FROMUSERPNT:
if(msObj->Buffer == 0) {
- if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_MULTIPLE, msObj->MapPnt, msObj->Buffer)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_MULTIPLE, msObj->MapPnt, msObj->Buffer, 0)) != MS_SUCCESS) writeError();
setExtent(msObj);
} else {
setExtent(msObj);
@@ -1543,11 +1543,11 @@
msObj->Map->width = msObj->ImgCols;
msObj->Map->height = msObj->ImgRows;
if((status = msCalculateScale(msObj->Map->extent, msObj->Map->units, msObj->Map->width, msObj->Map->height, msObj->Map->resolution, &msObj->Map->scaledenom)) != MS_SUCCESS) writeError();
- if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_SINGLE, msObj->MapPnt, 0)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_SINGLE, msObj->MapPnt, 0, 0)) != MS_SUCCESS) writeError();
break;
case FROMUSERPNT: /* only a buffer makes sense, DOES IT? */
setExtent(msObj);
- if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_SINGLE, msObj->MapPnt, msObj->Buffer)) != MS_SUCCESS) writeError();
+ if((status = msQueryByPoint(msObj->Map, QueryLayerIndex, MS_SINGLE, msObj->MapPnt, msObj->Buffer, 0)) != MS_SUCCESS) writeError();
break;
default:
msSetError(MS_WEBERR, "Query mode needs a point, imgxy and mapxy are not set.", "mapserv()");
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapserver.h 2007-12-05 19:40:28 UTC (rev 7147)
@@ -1552,7 +1552,7 @@
MS_DLL_EXPORT int msQueryByIndex(mapObj *map, int qlayer, int tileindex, int shapeindex);
MS_DLL_EXPORT int msQueryByIndexAdd(mapObj *map, int qlayer, int tileindex, int shapeindex);
MS_DLL_EXPORT int msQueryByAttributes(mapObj *map, int qlayer, char *qitem, char *qstring, int mode);
-MS_DLL_EXPORT int msQueryByPoint(mapObj *map, int qlayer, int mode, pointObj p, double buffer);
+MS_DLL_EXPORT int msQueryByPoint(mapObj *map, int qlayer, int mode, pointObj p, double buffer, int maxresults);
MS_DLL_EXPORT int msQueryByRect(mapObj *map, int qlayer, rectObj rect);
MS_DLL_EXPORT int msQueryByFeatures(mapObj *map, int qlayer, int slayer);
MS_DLL_EXPORT int msQueryByShape(mapObj *map, int qlayer, shapeObj *selectshape);
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2007-12-05 17:07:14 UTC (rev 7146)
+++ trunk/mapserver/mapwms.c 2007-12-05 19:40:28 UTC (rev 7147)
@@ -2091,12 +2091,12 @@
return(MS_SUCCESS);
}
-int msDumpResult(mapObj *map, int bFormatHtml, int nVersion, int feature_count)
+int msDumpResult(mapObj *map, int bFormatHtml, int nVersion)
{
int numresults=0;
int i;
- for(i=0; i<map->numlayers && numresults<feature_count; i++)
+ for(i=0; i<map->numlayers; i++)
{
int j, k, *itemvisible;
char **incitems=NULL;
@@ -2157,7 +2157,7 @@
/* Output selected shapes for this layer */
msIO_printf("\nLayer '%s'\n", lp->name);
- for(j=0; j<lp->resultcache->numresults && numresults<feature_count; j++) {
+ for(j=0; j<lp->resultcache->numresults; j++) {
shapeObj shape;
msInitShape(&shape);
@@ -2295,7 +2295,13 @@
point.x = MS_IMAGE2MAP_X(point.x, map->extent.minx, cellx);
point.y = MS_IMAGE2MAP_Y(point.y, map->extent.maxy, celly);
- if(msQueryByPoint(map, -1, (feature_count==1?MS_SINGLE:MS_MULTIPLE), point, 0) != MS_SUCCESS)
+ /* WMS 1.3.0 states that feature_count is *per layer*.
+ * Its value is a positive integer, if omitted then the default is 1
+ */
+ if (feature_count < 1)
+ feature_count = 1;
+
+ if(msQueryByPoint(map, -1, (feature_count==1?MS_SINGLE:MS_MULTIPLE), point, 0, feature_count) != MS_SUCCESS)
if(ms_error->code != MS_NOTFOUND) return msWMSException(map, nVersion, NULL);
/* Generate response */
@@ -2308,7 +2314,7 @@
msIO_printf("Content-type: text/plain%c%c", 10,10);
msIO_printf("GetFeatureInfo results:\n");
- numresults = msDumpResult(map, 0, nVersion, feature_count);
+ numresults = msDumpResult(map, 0, nVersion);
if (numresults == 0) msIO_printf("\n Search returned no results.\n");
More information about the mapserver-commits
mailing list