use of org.n52.shetland.ogc.swe.simpleType.SweAllowedValues in project arctic-sea by 52North.
the class SweCommonDecoderV101 method parseAllowedValues.
@SuppressWarnings({ "unchecked", "rawtypes" })
private SweAllowedValues parseAllowedValues(AllowedValues avt) {
SweAllowedValues allowedValues = new SweAllowedValues();
if (avt.isSetId()) {
allowedValues.setGmlId(avt.getId());
}
if (CollectionHelper.isNotNullOrEmpty(avt.getValueListArray())) {
for (List list : avt.getValueListArray()) {
if (CollectionHelper.isNotEmpty(list)) {
for (Object value : list) {
allowedValues.addValue(Double.parseDouble(value.toString()));
}
}
}
}
if (CollectionHelper.isNotNullOrEmpty(avt.getIntervalArray())) {
for (List interval : avt.getIntervalArray()) {
RangeValue<Double> rangeValue = new RangeValue<Double>();
Iterator<Double> iterator = interval.iterator();
if (iterator.hasNext()) {
rangeValue.setRangeStart(iterator.next());
}
if (iterator.hasNext()) {
rangeValue.setRangeEnd(iterator.next());
}
allowedValues.addInterval(rangeValue);
}
}
return allowedValues;
}
use of org.n52.shetland.ogc.swe.simpleType.SweAllowedValues in project arctic-sea by 52North.
the class SweCommonDecoderV20 method parseAllowedValues.
@SuppressWarnings({ "rawtypes", "unchecked" })
private SweAllowedValues parseAllowedValues(AllowedValuesType avt) {
SweAllowedValues allowedValues = new SweAllowedValues();
if (avt.isSetId()) {
allowedValues.setGmlId(avt.getId());
}
if (avt.getValueArray() != null && avt.getValueArray().length > 0) {
for (double value : avt.getValueArray()) {
allowedValues.addValue(value);
}
}
if (CollectionHelper.isNotNullOrEmpty(avt.getIntervalArray())) {
for (List interval : avt.getIntervalArray()) {
RangeValue<Double> rangeValue = new RangeValue<Double>();
Iterator<Double> iterator = interval.iterator();
if (iterator.hasNext()) {
rangeValue.setRangeStart(iterator.next());
}
if (iterator.hasNext()) {
rangeValue.setRangeEnd(iterator.next());
}
allowedValues.addInterval(rangeValue);
}
}
if (avt.isSetSignificantFigures()) {
allowedValues.setSignificantFigures(avt.getSignificantFigures());
}
return allowedValues;
}
Aggregations