use of org.geotoolkit.se.xml.v110.InterpolationPointType in project geotoolkit by Geomatys.
the class GTtoSE110Transformer method visit.
public InterpolateType visit(final Interpolate interpolate) {
final InterpolateType type = se_factory.createInterpolateType();
type.setFallbackValue(interpolate.getFallbackValue().toString());
type.setLookupValue(visitExpression(interpolate.getLookupValue()));
if (interpolate.getMethod() == Method.COLOR) {
type.setMethod(MethodType.COLOR);
} else {
type.setMethod(MethodType.NUMERIC);
}
final Mode mode = interpolate.getMode();
if (mode == Mode.COSINE) {
type.setMode(ModeType.COSINE);
} else if (mode == Mode.CUBIC) {
type.setMode(ModeType.CUBIC);
} else {
type.setMode(ModeType.LINEAR);
}
final List<InterpolationPointType> points = type.getInterpolationPoint();
points.clear();
for (final InterpolationPoint ip : interpolate.getInterpolationPoints()) {
final InterpolationPointType point = se_factory.createInterpolationPointType();
point.setData(ip.getData().doubleValue());
point.setValue(visitExpression(ip.getValue()));
points.add(point);
}
return type;
}
use of org.geotoolkit.se.xml.v110.InterpolationPointType in project geotoolkit by Geomatys.
the class SE110toGTTransformer method visit.
/**
* Transform a SLD v1.1 interpolate function in GT interpolate function.
*/
public Interpolate visit(final InterpolateType interpolate) {
if (interpolate == null)
return null;
final Literal fallback = filterFactory.literal(interpolate.getFallbackValue());
final Expression lookup = visitExpression(interpolate.getLookupValue());
final Method method;
if (MethodType.COLOR.equals(interpolate.getMethod())) {
method = Method.COLOR;
} else {
method = Method.NUMERIC;
}
final Mode mode;
if (ModeType.COSINE.equals(interpolate.getMode())) {
mode = Mode.COSINE;
} else if (ModeType.CUBIC.equals(interpolate.getMode())) {
mode = Mode.CUBIC;
} else {
mode = Mode.LINEAR;
}
final List<InterpolationPoint> values = new ArrayList<InterpolationPoint>();
for (final InterpolationPointType ip : interpolate.getInterpolationPoint()) {
values.add(styleFactory.interpolationPoint(ip.getData(), visitExpression(ip.getValue())));
}
return styleFactory.interpolateFunction(lookup, values, method, mode, fallback);
}
Aggregations