* @author Martin Davis
*/
public class FilterFunction_isWithinDistance3DTest extends TestCase{
public void testDistance3D() {
FilterFactoryImpl ff = new FilterFactoryImpl();
GeometryFactory gf = new GeometryFactory(new PrecisionModel());
SimpleFeatureType type = null;
try {
type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry");
} catch (SchemaException e) {
e.printStackTrace();
}
Feature f = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null);
Literal literal_geom = ff.literal(gf.createPoint(new Coordinate(10, 30, 40)));
Literal literal_num = ff.literal(15.0);
Function exp = ff.function("isWithinDistance3D", ff.property("geom"), literal_geom, literal_num);
Object value = exp.evaluate(f);
assertTrue(value instanceof Boolean);
assertTrue((Boolean) value);
}