@Test public void testEvaluate() throws Exception { SimpleFeatureCollection featureCollection = FunctionTestFixture.polygons(); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); Function exp = ff.function("minimumdiameter", ff.property("geom")); SimpleFeatureIterator iter = featureCollection.features(); while (iter.hasNext()) { SimpleFeature feature = iter.next(); Geometry geom = (Geometry) feature.getDefaultGeometry(); Geometry minimumDiameter = new MinimumDiameter(geom).getDiameter(); Object value = exp.evaluate(feature); assertTrue(value instanceof LineString); assertTrue(minimumDiameter.equalsExact((Geometry) value, 0.1)); } iter.close(); assertNull(exp.evaluate(null)); }
@Override public Object evaluate(Object feature) { Geometry arg0; try { arg0 = (Geometry) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function minimum diameter argument #0 - expected type Geometry"); } return (StaticGeometry.minimumDiameter(arg0)); }
FilterFunction_minimumDiameter extends FunctionExpressionImpl { @Override public Object evaluate(Object feature) { Geometry arg0; try { arg0 = (Geometry) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function minimum diameter argument #0 - expected type Geometry"); } return (StaticGeometry.minimumDiameter(arg0)); } }
FilterFunction_minimumDiameter extends FunctionExpressionImpl { @Override public Object evaluate(Object feature) { Geometry arg0; try { arg0 = (Geometry) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function minimum diameter argument #0 - expected type Geometry"); } return (StaticGeometry.minimumDiameter(arg0)); } FilterFunction_minimumDiameter(); }
FilterFunction_minimumDiameter extends FunctionExpressionImpl { @Override public Object evaluate(Object feature) { Geometry arg0; try { arg0 = (Geometry) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function minimum diameter argument #0 - expected type Geometry"); } return (StaticGeometry.minimumDiameter(arg0)); } FilterFunction_minimumDiameter(); @Override Object evaluate(Object feature); }
FilterFunction_minimumDiameter extends FunctionExpressionImpl { @Override public Object evaluate(Object feature) { Geometry arg0; try { arg0 = (Geometry) getExpression(0).evaluate(feature); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function minimum diameter argument #0 - expected type Geometry"); } return (StaticGeometry.minimumDiameter(arg0)); } FilterFunction_minimumDiameter(); @Override Object evaluate(Object feature); static FunctionName NAME; }