|
|
|
@ -306,10 +306,16 @@ public class ConvertToDataViewModel {
|
|
|
|
|
|
|
|
|
|
String wmsLink = layerConcessione.getWmsLink();
|
|
|
|
|
String layerName = null;
|
|
|
|
|
BoundsMap bounds = null;
|
|
|
|
|
|
|
|
|
|
//reading layer name from wmsLink
|
|
|
|
|
//string bbox
|
|
|
|
|
if(wmsLink!=null) {
|
|
|
|
|
layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink);
|
|
|
|
|
String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink);
|
|
|
|
|
String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink);
|
|
|
|
|
bounds = toBoundMap(wmsVersion, bbox, ",");
|
|
|
|
|
LOG.debug("Built bounds from wmsLInk: "+bounds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(layerName!=null)
|
|
|
|
@ -322,7 +328,10 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theLayerConessione.setLayerID(layerConcessione.getLayerID());
|
|
|
|
|
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
|
|
|
|
|
theLayerConessione.setAuthors(layerConcessione.getAuthors());
|
|
|
|
|
BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
|
|
|
|
|
|
|
|
|
|
if(bounds==null)
|
|
|
|
|
bounds = toBoundMap(layerConcessione.getBbox());
|
|
|
|
|
|
|
|
|
|
theLayerConessione.setBbox(bounds);
|
|
|
|
|
theLayerConessione.setCreationTime(toDateFormatString(layerConcessione.getCreationTime()));
|
|
|
|
|
theLayerConessione.setId(layerConcessione.getId());
|
|
|
|
@ -378,5 +387,50 @@ public class ConvertToDataViewModel {
|
|
|
|
|
|
|
|
|
|
return new BoundsMap(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong(), bbox.getMaxLat(), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To bound map.
|
|
|
|
|
*
|
|
|
|
|
* @param bbox the bbox
|
|
|
|
|
* @return the bounds map
|
|
|
|
|
*/
|
|
|
|
|
public static BoundsMap toBoundMap(String wmsVersion, String bbox, String separator) {
|
|
|
|
|
|
|
|
|
|
if (bbox == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if(wmsVersion==null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
if(separator==null)
|
|
|
|
|
separator = ",";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String[] bboxArr = bbox.split(separator);
|
|
|
|
|
|
|
|
|
|
if(wmsVersion.startsWith("1.3")) {
|
|
|
|
|
//is 1.3.x
|
|
|
|
|
return new BoundsMap(toDouble(bboxArr[1]), toDouble(bboxArr[0]), toDouble(bboxArr[3]), toDouble(bboxArr[2]), wmsVersion);
|
|
|
|
|
}else {
|
|
|
|
|
//should be 1.1.X
|
|
|
|
|
return new BoundsMap(toDouble(bboxArr[0]), toDouble(bboxArr[1]), toDouble(bboxArr[2]), toDouble(bboxArr[3]), wmsVersion);
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
LOG.warn("Error on creating Bounds for wmsVersion "+wmsVersion+" and bbox "+bbox+" : ",e);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Double toDouble(String value) {
|
|
|
|
|
try {
|
|
|
|
|
return Double.parseDouble(value);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
LOG.warn("Error on parsing "+value+" as double: ",e);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|