01: package org.geotools.filter.function;
02:
03: /*
04: * GeoTools - OpenSource mapping toolkit
05: * http://geotools.org
06: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation;
11: * version 2.1 of the License.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: */
18:
19: //this code is autogenerated - you shouldnt be modifying it!
20: import com.vividsolutions.jts.geom.*; //generic JTS support
21: import org.geotools.filter.function.StaticGeometry; //make sure you include this or you will not be able to call the functions!!
22:
23: import org.geotools.feature.Feature;
24: import org.geotools.filter.Expression;
25: import org.geotools.filter.FilterFactory;
26: import org.geotools.filter.FunctionExpression;
27: import org.geotools.filter.FunctionExpressionImpl;
28: import org.geotools.filter.LiteralExpression;
29:
30: public class FilterFunction_relatePattern extends
31: FunctionExpressionImpl implements FunctionExpression {
32:
33: public FilterFunction_relatePattern() {
34: super ("relatePattern");
35: }
36:
37: public int getArgCount() {
38: return 3;
39: }
40:
41: public Object evaluate(Object feature) {
42: Geometry arg0;
43: Geometry arg1;
44: String arg2;
45:
46: try { // attempt to get value and perform conversion
47: arg0 = (Geometry) getExpression(0).evaluate(feature);
48: } catch (Exception e) // probably a type error
49: {
50: throw new IllegalArgumentException(
51: "Filter Function problem for function relatePattern argument #0 - expected type Geometry");
52: }
53:
54: try { // attempt to get value and perform conversion
55: arg1 = (Geometry) getExpression(1).evaluate(feature);
56: } catch (Exception e) // probably a type error
57: {
58: throw new IllegalArgumentException(
59: "Filter Function problem for function relatePattern argument #1 - expected type Geometry");
60: }
61:
62: try { // attempt to get value and perform conversion
63: arg2 = (String) getExpression(2).evaluate(feature,
64: String.class); // extra
65: // protection
66: // for
67: // strings
68: } catch (Exception e) // probably a type error
69: {
70: throw new IllegalArgumentException(
71: "Filter Function problem for function relatePattern argument #2 - expected type String");
72: }
73:
74: return new Boolean(StaticGeometry.relatePattern(arg0, arg1,
75: arg2));
76: }
77: }
|