MCPcopy Index your code
hub / github.com/MapServer/MapServer / msQueryByPoint

Function msQueryByPoint

mapquery.c:1449–1642  ·  view source on GitHub ↗

msQueryByPoint() * * With mode=MS_QUERY_SINGLE: * Set maxresults = 0 to have a single result across all layers (the closest * shape from the first layer that finds a match). * Set maxresults = 1 to have up to one result per layer (the closest shape * from each layer). * * With mode=MS_QUERY_MULTIPLE: * Set maxresults = 0 to have an unlimited number of results. * Set maxre

Source from the content-addressed store, hash-verified

1447 * the closest ones).
1448 */
1449int msQueryByPoint(mapObj *map)
1450{
1451 int l;
1452 int start, stop=0;
1453
1454 double d, t;
1455 double layer_tolerance;
1456
1457 layerObj *lp;
1458
1459 char status;
1460 rectObj rect, searchrect;
1461 shapeObj shape;
1462 int nclasses = 0;
1463 int *classgroup = NULL;
1464 double minfeaturesize = -1;
1465
1466 if(map->query.type != MS_QUERY_BY_POINT) {
1467 msSetError(MS_QUERYERR, "The query is not properly defined.", "msQueryByPoint()");
1468 return(MS_FAILURE);
1469 }
1470
1471 msInitShape(&shape);
1472
1473 if(map->query.layer < 0 || map->query.layer >= map->numlayers)
1474 start = map->numlayers-1;
1475 else
1476 start = stop = map->query.layer;
1477
1478 for(l=start; l>=stop; l--) {
1479 lp = (GET_LAYER(map, l));
1480
1481 /* conditions may have changed since this layer last drawn, so set
1482 layer->project true to recheck projection needs (Bug #673) */
1483 lp->project = MS_TRUE;
1484
1485 /* free any previous search results, do it now in case one of the next few tests fail */
1486 if(lp->resultcache) {
1487 if(lp->resultcache->results) free(lp->resultcache->results);
1488 free(lp->resultcache);
1489 lp->resultcache = NULL;
1490 }
1491
1492 if(!msIsLayerQueryable(lp)) continue;
1493 if(lp->status == MS_OFF) continue;
1494
1495 if(map->scaledenom > 0) {
1496 if((lp->maxscaledenom > 0) && (map->scaledenom > lp->maxscaledenom)) continue;
1497 if((lp->minscaledenom > 0) && (map->scaledenom <= lp->minscaledenom)) continue;
1498 }
1499
1500 if (lp->maxscaledenom <= 0 && lp->minscaledenom <= 0) {
1501 if((lp->maxgeowidth > 0) && ((map->extent.maxx - map->extent.minx) > lp->maxgeowidth)) continue;
1502 if((lp->mingeowidth > 0) && ((map->extent.maxx - map->extent.minx) < lp->mingeowidth)) continue;
1503 }
1504
1505 /* Raster layers are handled specially. */
1506 if( lp->type == MS_LAYER_RASTER ) {

Callers 4

msExecuteQueryFunction · 0.85
msWMSFeatureInfoFunction · 0.85
mapObj_queryByPointFunction · 0.85
layerObj_queryByPointFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msInitShapeFunction · 0.85
msIsLayerQueryableFunction · 0.85
msRasterQueryByPointFunction · 0.85
msInchesPerUnitFunction · 0.85
msLayerCloseFunction · 0.85
msLayerOpenFunction · 0.85
msLayerWhichItemsFunction · 0.85
msProjectionsDifferFunction · 0.85
msProjectRectFunction · 0.85
msLayerWhichShapesFunction · 0.85
initResultCacheFunction · 0.85

Tested by

no test coverage detected