| 1051 | **********************************************************************/ |
| 1052 | |
| 1053 | int msWFSLayerWhichShapes(layerObj *lp, rectObj rect, int isQuery) |
| 1054 | { |
| 1055 | #ifdef USE_WFS_LYR |
| 1056 | msWFSLayerInfo *psInfo; |
| 1057 | int status = MS_SUCCESS; |
| 1058 | const char *pszTmp; |
| 1059 | FILE *fp; |
| 1060 | |
| 1061 | if ( msCheckParentPointer(lp->map,"map")==MS_FAILURE ) |
| 1062 | return MS_FAILURE; |
| 1063 | |
| 1064 | |
| 1065 | psInfo =(msWFSLayerInfo*)lp->wfslayerinfo; |
| 1066 | |
| 1067 | if (psInfo == NULL) |
| 1068 | { |
| 1069 | msSetError(MS_WFSCONNERR, "Assertion failed: WFS layer not opened!!!", |
| 1070 | "msWFSLayerWhichShapes()"); |
| 1071 | return(MS_FAILURE); |
| 1072 | } |
| 1073 | |
| 1074 | /* ------------------------------------------------------------------ |
| 1075 | * Check if layer overlaps current view window (using wfs_latlonboundingbox) |
| 1076 | * ------------------------------------------------------------------ */ |
| 1077 | if ((pszTmp = msOWSLookupMetadata(&(lp->metadata), |
| 1078 | "FO", "latlonboundingbox")) != NULL) |
| 1079 | { |
| 1080 | char **tokens; |
| 1081 | int n; |
| 1082 | rectObj ext; |
| 1083 | |
| 1084 | tokens = msStringSplit(pszTmp, ' ', &n); |
| 1085 | if (tokens==NULL || n != 4) { |
| 1086 | msSetError(MS_WFSCONNERR, "Wrong number of values in 'wfs_latlonboundingbox' metadata.", |
| 1087 | "msWFSLayerWhichShapes()"); |
| 1088 | return MS_FAILURE; |
| 1089 | } |
| 1090 | |
| 1091 | ext.minx = atof(tokens[0]); |
| 1092 | ext.miny = atof(tokens[1]); |
| 1093 | ext.maxx = atof(tokens[2]); |
| 1094 | ext.maxy = atof(tokens[3]); |
| 1095 | |
| 1096 | msFreeCharArray(tokens, n); |
| 1097 | |
| 1098 | /* Reproject latlonboundingbox to the selected SRS for the layer and */ |
| 1099 | /* check if it overlaps the bbox that we calculated for the request */ |
| 1100 | |
| 1101 | msProjectRect(&(lp->map->latlon), &(lp->projection), &ext); |
| 1102 | if (!msRectOverlap(&rect, &ext)) |
| 1103 | { |
| 1104 | /* No overlap... nothing to do. If layer was never opened, go open it.*/ |
| 1105 | if (lp->layerinfo) |
| 1106 | return MS_DONE; /* No overlap. */ |
| 1107 | } |
| 1108 | } |
| 1109 | |
| 1110 |
no test coverage detected