static Element and(Document document, Node parent) { return and(document, parent, false); }
static Element propertyIsLessThan(Document document, Node parent) { return binaryComparisonOp(document, parent, OGC.PropertyIsLessThan); }
static Element mul(Document document, Node parent) { return binaryExpression(document, parent, OGC.Mul); }
static Element distanceBufferOperator(Document document, Node parent, QName name) { Element doperator = binarySpatialOperator(document, parent, name); Element distance = element(document, doperator, new QName(OGC.NAMESPACE, "Distance")); distance.appendChild(document.createTextNode("1.0")); distance.setAttribute("units", "m"); return doperator; }
static Element contains(Document document, Node parent) { return binarySpatialOperator(document, parent, OGC.Contains); }
public void testEncodeLogical() throws Exception { Document doc = encode(FilterMockData.and(), OGC.Filter); assertEquals("ogc:Filter", doc.getDocumentElement().getNodeName()); assertEquals(1, doc.getElementsByTagNameNS(OGC.NAMESPACE, "And").getLength()); doc = encode(FilterMockData.not(), OGC.Filter); assertEquals("ogc:Filter", doc.getDocumentElement().getNodeName()); assertEquals(1, doc.getElementsByTagNameNS(OGC.NAMESPACE, "Not").getLength()); } }
public void testAndWithBetweenParse() throws Exception { Element e = FilterMockData.and(document, document, true); FilterMockData.propertyIsBetween(document, e); FilterMockData.propertyIsBetween(document, e); And and = (And) parse(); assertEquals(2, and.getChildren().size()); assertTrue(and.getChildren().get(0) instanceof PropertyIsBetween); assertTrue(and.getChildren().get(1) instanceof PropertyIsBetween); }
public void testAndWithLikeParse() throws Exception { Element e = FilterMockData.and(document, document, true); FilterMockData.propertyIsLike(document, e); FilterMockData.propertyIsLike(document, e); And and = (And) parse(); assertEquals(2, and.getChildren().size()); assertTrue(and.getChildren().get(0) instanceof PropertyIsLike); assertTrue(and.getChildren().get(1) instanceof PropertyIsLike); }
public void testAndWithNullParse() throws Exception { Element e = FilterMockData.and(document, document, true); FilterMockData.propertyisNull(document, e); FilterMockData.propertyisNull(document, e); And and = (And) parse(); assertEquals(2, and.getChildren().size()); assertTrue(and.getChildren().get(0) instanceof PropertyIsNull); assertTrue(and.getChildren().get(1) instanceof PropertyIsNull); }
public void testDWithinEncode() throws Exception { Document dom = encode(FilterMockData.beyond(), OGC.DWithin); assertEquals( 1, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, dom.getElementsByTagNameNS(GML.NAMESPACE, GML.Point.getLocalPart()).getLength()); assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE, "Distance").getLength()); assertEquals( "1.0", dom.getElementsByTagNameNS(OGC.NAMESPACE, "Distance") .item(0) .getFirstChild() .getNodeValue()); }
public void testEncode() throws Exception { Document doc = encode(FilterMockData.bbox(), OGC.BBOX); assertEquals( 1, doc.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, doc.getElementsByTagNameNS(GML.NAMESPACE, GML.Box.getLocalPart()).getLength()); } }
public void testDisjointEncode() throws Exception { Document dom = encode(FilterMockData.disjoint(), OGC.Disjoint); assertEquals( 1, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, dom.getElementsByTagNameNS(GML.NAMESPACE, GML.Point.getLocalPart()).getLength()); }
public void testContainsEncode() throws Exception { Document dom = encode(FilterMockData.contains(), OGC.Contains); assertEquals( 1, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, dom.getElementsByTagNameNS(GML.NAMESPACE, GML.Point.getLocalPart()).getLength()); }
public void testCrossesEncode() throws Exception { Document dom = encode(FilterMockData.crosses(), OGC.Crosses); assertEquals( 1, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, dom.getElementsByTagNameNS(GML.NAMESPACE, GML.Point.getLocalPart()).getLength()); }
public void testAddEncode() throws Exception { Document dom = encode(FilterMockData.add(), OGC.Add); assertEquals( 2, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.Literal.getLocalPart()).getLength()); }
static Element disjoint(Document document, Node parent) { return binarySpatialOperator(document, parent, OGC.Disjoint); }
public void testBeyondEncode() throws Exception { Document dom = encode(FilterMockData.beyond(), OGC.Beyond); assertEquals( 1, dom.getElementsByTagNameNS(OGC.NAMESPACE, OGC.PropertyName.getLocalPart()) .getLength()); assertEquals( 1, dom.getElementsByTagNameNS(GML.NAMESPACE, GML.Point.getLocalPart()).getLength()); assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE, "Distance").getLength()); assertEquals( "1.0", dom.getElementsByTagNameNS(OGC.NAMESPACE, "Distance") .item(0) .getFirstChild() .getNodeValue()); // assertEquals( "m",((Element)dom.getElementsByTagNameNS(OGC.NAMESPACE, // "Distance").item(0)).getAttribute("units")); }
public void testParse() throws Exception { FilterMockData.bbox(document, document); BBOX box = (BBOX) parse(); assertEquals("foo", box.getPropertyName()); assertEquals(0, box.getMinX(), 0.0); assertEquals(0, box.getMinY(), 0.0); assertEquals(1, box.getMaxX(), 0.0); assertEquals(1, box.getMaxY(), 0.0); assertEquals("EPSG:4326", box.getSRS()); }
public void testDisjointParse() throws Exception { FilterMockData.disjoint(document, document); Disjoint disjoint = (Disjoint) parse(); assertNotNull(disjoint.getExpression1()); assertNotNull(disjoint.getExpression2()); }