** msDumpLayer() */
| 1397 | ** msDumpLayer() |
| 1398 | */ |
| 1399 | int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_encoded, const char *indent) |
| 1400 | { |
| 1401 | rectObj ext; |
| 1402 | const char *value; |
| 1403 | const char *pszWmsTimeExtent, *pszWmsTimeDefault= NULL, *pszStyle=NULL; |
| 1404 | const char *pszLegendURL=NULL; |
| 1405 | char *pszMetadataName=NULL, *mimetype=NULL; |
| 1406 | char **classgroups = NULL; |
| 1407 | int iclassgroups=0 ,j=0; |
| 1408 | char szVersionBuf[OWS_VERSION_MAXLEN]; |
| 1409 | size_t bufferSize = 0; |
| 1410 | |
| 1411 | /* if the layer status is set to MS_DEFAULT, output a warning */ |
| 1412 | if (lp->status == MS_DEFAULT) |
| 1413 | msIO_fprintf(stdout, "<!-- WARNING: This layer has its status set to DEFAULT and will always be displayed when doing a GetMap request even if it is not requested by the client. This is not in line with the expected behavior of a WMS server. Using status ON or OFF is recommended. -->\n"); |
| 1414 | |
| 1415 | if (nVersion <= OWS_1_0_7) |
| 1416 | { |
| 1417 | msIO_printf("%s <Layer queryable=\"%d\">\n", |
| 1418 | indent, msIsLayerQueryable(lp)); |
| 1419 | } |
| 1420 | else |
| 1421 | { |
| 1422 | /* 1.1.0 and later: opaque and cascaded are new. */ |
| 1423 | int cascaded=0, opaque=0; |
| 1424 | if ((value = msOWSLookupMetadata(&(lp->metadata), "MO", "opaque")) != NULL) |
| 1425 | opaque = atoi(value); |
| 1426 | if (lp->connectiontype == MS_WMS) |
| 1427 | cascaded = 1; |
| 1428 | |
| 1429 | msIO_printf("%s <Layer queryable=\"%d\" opaque=\"%d\" cascaded=\"%d\">\n", |
| 1430 | indent, msIsLayerQueryable(lp), opaque, cascaded); |
| 1431 | } |
| 1432 | |
| 1433 | if (lp->name && strlen(lp->name) > 0 && |
| 1434 | (msIsXMLTagValid(lp->name) == MS_FALSE || isdigit(lp->name[0]))) |
| 1435 | msIO_fprintf(stdout, "<!-- WARNING: The layer name '%s' might contain spaces or " |
| 1436 | "invalid characters or may start with a number. This could lead to potential problems. -->\n", |
| 1437 | lp->name); |
| 1438 | msOWSPrintEncodeParam(stdout, "LAYER.NAME", lp->name, OWS_NOERR, |
| 1439 | " <Name>%s</Name>\n", NULL); |
| 1440 | |
| 1441 | /* the majority of this section is dependent on appropriately named metadata in the LAYER object */ |
| 1442 | msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO", "title", |
| 1443 | OWS_WARN, " <Title>%s</Title>\n", lp->name); |
| 1444 | |
| 1445 | msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO", "abstract", |
| 1446 | OWS_NOERR, " <Abstract>%s</Abstract>\n", NULL); |
| 1447 | |
| 1448 | if (nVersion == OWS_1_0_0) |
| 1449 | { |
| 1450 | /* <Keywords> in V 1.0.0 */ |
| 1451 | /* The 1.0.0 spec doesn't specify which delimiter to use so let's use spaces */ |
| 1452 | msOWSPrintEncodeMetadataList(stdout, &(lp->metadata), "MO", |
| 1453 | "keywordlist", |
| 1454 | " <Keywords>", |
| 1455 | " </Keywords>\n", |
| 1456 | "%s ", NULL); |
no test coverage detected