*
* </p>
*/
@Test
public void geometryLiterals() throws Exception {
BinarySpatialOperator result;
Literal geom;
// Point":" <time-second> "Z"
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language, "WITHIN(ATTR1, POINT(1 2))");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.Point);
// LineString
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,"WITHIN(ATTR1, LINESTRING(1 2, 10 15))");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.LineString);
// Polygon
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,
"WITHIN(ATTR1, POLYGON((1 2, 15 2, 15 20, 15 21, 1 2)))");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.Polygon);
// MultiPoint
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,
"WITHIN(ATTR1, MULTIPOINT( (1 2), (15 2), (15 20), (15 21), (1 2) ))");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.MultiPoint);
// MultiLineString
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,
"WITHIN(ATTR1, MULTILINESTRING((10 10, 20 20),(15 15,30 15)) )");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.MultiLineString);
// MultiPolygon
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,
"WITHIN(ATTR1, MULTIPOLYGON( ((10 10, 10 20, 20 20, 20 15, 10 10)),((60 60, 70 70, 80 60, 60 60 )) ) )");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.MultiPolygon);
// ENVELOPE
result = (BinarySpatialOperator) CompilerUtil.parseFilter(this.language,
"WITHIN(ATTR1, ENVELOPE( 10, 20, 30, 40) )");
geom = (Literal) result.getExpression2();
Assert.assertNotNull(geom.getValue());
Assert.assertTrue(geom.getValue() instanceof com.vividsolutions.jts.geom.Polygon);
}