01: package org.geotools.filter.function;
02:
03: //this code is autogenerated - you shouldnt be modifying it!
04:
05: import org.geotools.filter.FunctionExpression;
06: import org.geotools.filter.FunctionExpressionImpl;
07:
08: import com.vividsolutions.jts.geom.Geometry;
09:
10: public class FilterFunction_getZ extends FunctionExpressionImpl
11: implements FunctionExpression {
12:
13: public FilterFunction_getZ() {
14: super ("getZ");
15: }
16:
17: public int getArgCount() {
18: return 1;
19: }
20:
21: public Object evaluate(Object feature) {
22: Geometry arg0;
23:
24: try { //attempt to get value and perform conversion
25: arg0 = (Geometry) getExpression(0).evaluate(feature);
26: } catch (Exception e) // probably a type error
27: {
28: throw new IllegalArgumentException(
29: "Filter Function problem for function getZ argument #0 - expected type Geometry");
30: }
31:
32: return new Double(arg0.getCentroid().getCoordinate().z);
33:
34: }
35: }
|