if (bands != null) {
if (bands.contains("/")) {
List<String> unparsed = KvpUtils.readFlat(bands, new Tokenizer("/"));
IntervalType interval = Wcs10Factory.eINSTANCE.createIntervalType();
TypedLiteralType min = Wcs10Factory.eINSTANCE.createTypedLiteralType();
TypedLiteralType max = Wcs10Factory.eINSTANCE.createTypedLiteralType();
TypedLiteralType res = Wcs10Factory.eINSTANCE.createTypedLiteralType();
if (unparsed.size() == 2) {
min.setValue(unparsed.get(0));
max.setValue(unparsed.get(1));
interval.setMin(min);
interval.setMax(max);
} else {
min.setValue(unparsed.get(0));
max.setValue(unparsed.get(1));
res.setValue(unparsed.get(2));
interval.setMin(min);
interval.setMax(max);
interval.setRes(res);
}
final AxisSubsetType axisSubset = Wcs10Factory.eINSTANCE.createAxisSubsetType();
axisSubset.setName(axisName);
axisSubset.getInterval().add(interval);
rangeSubset.getAxisSubset().add(axisSubset);
} else {
List<String> unparsed = KvpUtils.readFlat(bands, KvpUtils.INNER_DELIMETER);
if (unparsed.size() == 0) {
throw new WcsException(
"Requested axis subset contains wrong number of values (should have at least 1): "
+ unparsed.size(), WcsExceptionCode.InvalidParameterValue,
"band");
}
final AxisSubsetType axisSubset = Wcs10Factory.eINSTANCE.createAxisSubsetType();
axisSubset.setName(axisName);
for (String bandValue : unparsed) {
TypedLiteralType singleValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
singleValue.setValue(bandValue);
axisSubset.getSingleValue().add(singleValue);
}
rangeSubset.getAxisSubset().add(axisSubset);
}
}
} else if (axis instanceof Double || axis instanceof Integer) {
final AxisSubsetType axisSubset = Wcs10Factory.eINSTANCE.createAxisSubsetType();
axisSubset.setName(axisName);
TypedLiteralType singleValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
singleValue.setValue(String.valueOf(axis));
axisSubset.getSingleValue().add(singleValue);
rangeSubset.getAxisSubset().add(axisSubset);
}