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

Function msReturnTemplateQuery

maptemplate.c:230–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230int msReturnTemplateQuery(mapservObj *mapserv, char *queryFormat, char **papszBuffer)
231{
232 imageObj *img = NULL;
233 int i, status;
234
235 outputFormatObj *outputFormat=NULL;
236 mapObj *map = mapserv->map;
237
238 if(!queryFormat) {
239 msSetError(MS_WEBERR, "Return format/mime-type not specified.", "msReturnTemplateQuery()");
240 return MS_FAILURE;
241 }
242
243 msApplyDefaultOutputFormats(map);
244
245 i = msGetOutputFormatIndex(map, queryFormat); /* queryFormat can be a mime-type or name */
246 if(i >= 0) outputFormat = map->outputformatlist[i];
247
248 if(outputFormat) {
249 if( MS_RENDERER_PLUGIN(outputFormat) ) {
250 msInitializeRendererVTable(outputFormat);
251 }
252
253 if( MS_RENDERER_OGR(outputFormat) )
254 {
255 if( mapserv != NULL )
256 checkWebScale(mapserv);
257
258 status = msOGRWriteFromQuery(map, outputFormat, mapserv->sendheaders);
259
260 return status;
261 }
262
263 if( !MS_RENDERER_TEMPLATE(outputFormat) ) { /* got an image format, return the query results that way */
264 outputFormatObj *tempOutputFormat = map->outputformat; /* save format */
265
266 if( mapserv != NULL )
267 checkWebScale(mapserv);
268
269 map->outputformat = outputFormat; /* override what was given for IMAGETYPE */
270 img = msDrawMap(map, MS_TRUE);
271 if(!img) return MS_FAILURE;
272 map->outputformat = tempOutputFormat; /* restore format */
273
274 if(mapserv == NULL || mapserv->sendheaders)
275 msIO_printf("Content-type: %s%c%c", MS_IMAGE_MIME_TYPE(outputFormat), 10,10);
276 status = msSaveImage(map, img, NULL);
277 msFreeImage(img);
278
279 return status;
280 }
281 }
282
283 /*
284 ** At this point we know we have a template of some sort, either the new style that references a or the old
285 ** style made up of external files slammed together. Either way we may have to compute a query map and other
286 ** images. We only create support images IF the querymap has status=MS_ON.
287 */

Callers 4

mainFunction · 0.85
msProcessQueryTemplateFunction · 0.85
msWMSFeatureInfoFunction · 0.85
msWFSGetFeatureFunction · 0.85

Calls 14

msSetErrorFunction · 0.85
msGetOutputFormatIndexFunction · 0.85
checkWebScaleFunction · 0.85
msOGRWriteFromQueryFunction · 0.85
msDrawMapFunction · 0.85
msIO_printfFunction · 0.85
msSaveImageFunction · 0.85
msFreeImageFunction · 0.85
msGenerateImagesFunction · 0.85
msGetOutputFormatOptionFunction · 0.85

Tested by

no test coverage detected