use of org.geotoolkit.se.xml.v110.CategorizeType in project geotoolkit by Geomatys.
the class GTtoSE110Transformer method visit.
public CategorizeType visit(final Categorize categorize) {
final CategorizeType type = se_factory.createCategorizeType();
type.setFallbackValue(categorize.getFallbackValue().getValue().toString());
type.setLookupValue(visitExpression(categorize.getLookupValue()));
if (ThreshholdsBelongTo.PRECEDING == categorize.getBelongTo()) {
type.setThreshholdsBelongTo(ThreshholdsBelongToType.PRECEDING);
} else {
type.setThreshholdsBelongTo(ThreshholdsBelongToType.SUCCEEDING);
}
final Map<Expression, Expression> steps = categorize.getThresholds();
final List<JAXBElement<ParameterValueType>> elements = type.getThresholdAndTValue();
elements.clear();
int i = 0;
for (Entry<Expression, Expression> entry : steps.entrySet()) {
final Expression key = entry.getKey();
final Expression val = entry.getValue();
if (i == 0) {
// first element is for -infinity
type.setValue(visitExpression(val));
} else {
elements.add(se_factory.createThreshold(visitExpression(key)));
elements.add(se_factory.createTValue(visitExpression(val)));
}
i++;
}
return type;
}
Aggregations