use of net.opengis.gml.x32.BooleanListDocument in project arctic-sea by 52North.
the class AbstractCoverageEncoder method encodeValueList.
/**
* Encode value list of {@link RangeSetType} from {@link DiscreteCoverage}
*
* @param rst
* The {@link RangeSetType} to encode value list for
* @param discreteCoverage
* The {@link DiscreteCoverage} with the value list
* @throws EncodingException
* If an error occurs
*/
protected void encodeValueList(RangeSetType rst, DiscreteCoverage<?> discreteCoverage) throws EncodingException {
List<?> list = getList(discreteCoverage);
Value<?> value = discreteCoverage.getRangeSet().iterator().next();
if (value instanceof BooleanValue) {
BooleanListDocument bld = BooleanListDocument.Factory.newInstance(getXmlOptions());
bld.setBooleanList(list);
rst.set(bld);
} else if (value instanceof CategoryValue || value instanceof TextValue) {
DataBlockType dbt = rst.addNewDataBlock();
dbt.addNewRangeParameters().setHref(discreteCoverage.getRangeParameters());
CoordinatesType ct = dbt.addNewTupleList();
ct.setCs(",");
ct.setStringValue(Joiner.on(",").join(list));
} else if (value instanceof CountValue) {
CountListDocument cld = CountListDocument.Factory.newInstance(getXmlOptions());
cld.setCountList(list);
rst.set(cld);
} else if (value instanceof QuantityValue) {
QuantityListDocument qld = QuantityListDocument.Factory.newInstance(getXmlOptions());
MeasureOrNilReasonListType monrlt = qld.addNewQuantityList();
if (discreteCoverage.isSetUnit()) {
monrlt.setUom(discreteCoverage.getUnit());
} else if (value.isSetUnit()) {
monrlt.setUom(value.getUnit());
}
monrlt.setListValue(list);
rst.set(qld);
}
}
Aggregations