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

Function msQueryByRect

mapquery.c:943–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941}
942
943int msQueryByRect(mapObj *map)
944{
945 int l; /* counters */
946 int start, stop=0;
947
948 layerObj *lp;
949
950 char status;
951 shapeObj shape, searchshape;
952 rectObj searchrect;
953 double layer_tolerance = 0, tolerance = 0;
954
955 int nclasses = 0;
956 int *classgroup = NULL;
957 double minfeaturesize = -1;
958
959 if(map->query.type != MS_QUERY_BY_RECT) {
960 msSetError(MS_QUERYERR, "The query is not properly defined.", "msQueryByRect()");
961 return(MS_FAILURE);
962 }
963
964 msInitShape(&shape);
965 msInitShape(&searchshape);
966
967 if(map->query.layer < 0 || map->query.layer >= map->numlayers)
968 start = map->numlayers-1;
969 else
970 start = stop = map->query.layer;
971
972 for(l=start; l>=stop; l--) {
973 lp = (GET_LAYER(map, l));
974
975 /* conditions may have changed since this layer last drawn, so set
976 layer->project true to recheck projection needs (Bug #673) */
977 lp->project = MS_TRUE;
978
979 /* free any previous search results, do it now in case one of the next few tests fail */
980 if(lp->resultcache) {
981 if(lp->resultcache->results) free(lp->resultcache->results);
982 free(lp->resultcache);
983 lp->resultcache = NULL;
984 }
985
986 if(!msIsLayerQueryable(lp)) continue;
987 if(lp->status == MS_OFF) continue;
988
989 if(map->scaledenom > 0) {
990 if((lp->maxscaledenom > 0) && (map->scaledenom > lp->maxscaledenom)) continue;
991 if((lp->minscaledenom > 0) && (map->scaledenom <= lp->minscaledenom)) continue;
992 }
993
994 if (lp->maxscaledenom <= 0 && lp->minscaledenom <= 0) {
995 if((lp->maxgeowidth > 0) && ((map->extent.maxx - map->extent.minx) > lp->maxgeowidth)) continue;
996 if((lp->mingeowidth > 0) && ((map->extent.maxx - map->extent.minx) < lp->mingeowidth)) continue;
997 }
998
999 searchrect = map->query.rect;
1000 if(lp->tolerance > 0) {

Callers 9

FLTApplySimpleSQLFilterFunction · 0.85
msExecuteQueryFunction · 0.85
msWMSFeatureInfoFunction · 0.85
msWFSGetFeatureFunction · 0.85
msSOSGetCapabilitiesFunction · 0.85
msSOSGetObservationFunction · 0.85
msSOSDescribeSensorFunction · 0.85
mapObj_queryByRectFunction · 0.85
layerObj_queryByRectFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msInitShapeFunction · 0.85
msIsLayerQueryableFunction · 0.85
msAdjustExtentFunction · 0.85
msInchesPerUnitFunction · 0.85
msRectToPolygonFunction · 0.85
msRasterQueryByRectFunction · 0.85
msLayerCloseFunction · 0.85
msLayerOpenFunction · 0.85
msLayerWhichItemsFunction · 0.85
msProjectionsDifferFunction · 0.85
msProjectRectFunction · 0.85

Tested by

no test coverage detected