* Generic function to render the map file. * The type of the image created is based on the imagetype parameter in the map file. * * mapObj *map - map object loaded in MapScript or via a mapfile to use * int querymap - is this map the result of a query operation, MS_TRUE|MS_FALSE */
| 257 | * int querymap - is this map the result of a query operation, MS_TRUE|MS_FALSE |
| 258 | */ |
| 259 | imageObj *msDrawMap(mapObj *map, int querymap) |
| 260 | { |
| 261 | int i; |
| 262 | layerObj *lp=NULL; |
| 263 | int status = MS_FAILURE; |
| 264 | imageObj *image = NULL; |
| 265 | struct mstimeval mapstarttime, mapendtime; |
| 266 | struct mstimeval starttime, endtime; |
| 267 | |
| 268 | #if defined(USE_WMS_LYR) || defined(USE_WFS_LYR) |
| 269 | enum MS_CONNECTION_TYPE lastconnectiontype; |
| 270 | httpRequestObj *pasOWSReqInfo=NULL; |
| 271 | int numOWSLayers=0, numOWSRequests=0; |
| 272 | wmsParamsObj sLastWMSParams; |
| 273 | #endif |
| 274 | |
| 275 | if(map->debug >= MS_DEBUGLEVEL_TUNING) msGettimeofday(&mapstarttime, NULL); |
| 276 | |
| 277 | if(querymap) { /* use queryMapObj image dimensions */ |
| 278 | if(map->querymap.width != -1) map->width = map->querymap.width; |
| 279 | if(map->querymap.height != -1) map->height = map->querymap.height; |
| 280 | } |
| 281 | |
| 282 | msApplyMapConfigOptions(map); |
| 283 | image = msPrepareImage(map, MS_TRUE); |
| 284 | |
| 285 | if(!image) { |
| 286 | msSetError(MS_IMGERR, "Unable to initialize image.", "msDrawMap()"); |
| 287 | return(NULL); |
| 288 | } |
| 289 | |
| 290 | if( map->debug >= MS_DEBUGLEVEL_DEBUG ) |
| 291 | msDebug( "msDrawMap(): rendering using outputformat named %s (%s).\n", |
| 292 | map->outputformat->name, |
| 293 | map->outputformat->driver ); |
| 294 | |
| 295 | #if defined(USE_WMS_LYR) || defined(USE_WFS_LYR) |
| 296 | |
| 297 | /* Time the OWS query phase */ |
| 298 | if(map->debug >= MS_DEBUGLEVEL_TUNING ) msGettimeofday(&starttime, NULL); |
| 299 | |
| 300 | /* How many OWS (WMS/WFS) layers do we have to draw? |
| 301 | * Note: numOWSLayers is the number of actual layers and numOWSRequests is |
| 302 | * the number of HTTP requests which could be lower if multiple layers |
| 303 | * are merged into the same request. |
| 304 | */ |
| 305 | numOWSLayers=0; |
| 306 | for(i=0; i<map->numlayers; i++) { |
| 307 | if(map->layerorder[i] != -1 && |
| 308 | msLayerIsVisible(map, GET_LAYER(map,map->layerorder[i]))) |
| 309 | numOWSLayers++; |
| 310 | } |
| 311 | |
| 312 | |
| 313 | if (numOWSLayers > 0) { |
| 314 | /* Alloc and init pasOWSReqInfo... |
| 315 | */ |
| 316 | pasOWSReqInfo = (httpRequestObj *)malloc((numOWSLayers+1)*sizeof(httpRequestObj)); |
no test coverage detected