this.catalog = catalog;
this.geoServer = geoServer;
}
public GetFeatureInfoRequest read(Object request, Map kvp, Map rawKvp) throws Exception {
GetFeatureInfoRequest gfi = (GetFeatureInfoRequest) super.read(request, kvp, rawKvp);
String aux = (String) rawKvp.get("SERVICE");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter SERVICE is missing: "
+ rawKvp.toString());
}
// TODO: Test service validity.
String service = "W3DS";
aux = (String) rawKvp.get("VERSION");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter VERSION is missing: "
+ rawKvp.toString());
}
// TODO: Test version validity.
String version = "0.4.0";
aux = (String) rawKvp.get("REQUEST");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter REQUEST is missing: "
+ rawKvp.toString());
}
// TODO: Test request validity.
Operation requestStr = Operation.GETFEATUREINFO;
aux = (String) rawKvp.get("FORMAT");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter FORMAT is missing: "
+ rawKvp.toString());
}
Format format = KVPUtils.parseFormat(aux, gfi);
aux = (String) rawKvp.get("CRS");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter CRS is missing: " + rawKvp.toString());
}
CoordinateReferenceSystem crs = KVPUtils.parseCRS(aux);
aux = (String) rawKvp.get("LAYERS");
if (aux == null) {
throw new IllegalArgumentException(
"Mandatory parameter LAYERS is missing: "
+ rawKvp.toString());
}
List<W3DSLayerInfo> layers = KVPUtils.parseLayers(aux, catalog, LOGGER);
// TODO: Handle the baseURL parameter.
String baseUrl = "geoserver/w3ds?";
aux = (String) rawKvp.get("COORDINATE");
Coordinate coordinate = KVPUtils.parseCoordinate(aux, crs);
gfi.setMandatoryParameters(service, requestStr, version, baseUrl, rawKvp, crs, format, layers, coordinate);
// Hacking to use WMS to generate KML(provisory)
gfi.setGeoServer(geoServer);
return gfi;
}