From f2075f6d1d39e047a69d66d35150c5391feacf4c Mon Sep 17 00:00:00 2001
From: Lyn Elisa Goltz
Date: Thu, 26 May 2016 12:16:37 +0200
Subject: [PATCH 01/25] #3475 - implemented parsing of a ValueReference as
second parameter in Intersects operator
---
.../deegree/filter/spatial/Intersects.java | 43 ++++++++++++++--
.../filter/xml/Filter200XMLDecoder.java | 51 +++++++++++--------
.../filter/xml/Filter200XMLDecoderTest.java | 17 +++++++
.../xml/v200/intersectsWithSpatialJoin.xml | 9 ++++
4 files changed, 97 insertions(+), 23 deletions(-)
create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v200/intersectsWithSpatialJoin.xml
diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/spatial/Intersects.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/spatial/Intersects.java
index 067e0668a7..f75590ca0d 100644
--- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/spatial/Intersects.java
+++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/spatial/Intersects.java
@@ -41,6 +41,7 @@
import org.deegree.filter.Expression;
import org.deegree.filter.FilterEvaluationException;
import org.deegree.filter.XPathEvaluator;
+import org.deegree.filter.expression.ValueReference;
import org.deegree.geometry.Envelope;
import org.deegree.geometry.Geometry;
import org.slf4j.Logger;
@@ -60,15 +61,38 @@ public class Intersects extends SpatialOperator {
private final Geometry geometry;
+ private final ValueReference valueReference;
+
/**
+ * Instantiates a {@link Intersects} operator with geometry as second parameter.
+ *
* @param propName
* may actually be null
(deegree extension to cope with features that have only hidden
* geometry props)
* @param geometry
+ * never null
*/
public Intersects( Expression propName, Geometry geometry ) {
+ this( propName, geometry, null );
+ }
+
+ /**
+ * Instantiates a {@link Intersects} operator with value reference as second parameter.
+ *
+ * @param propName
+ * may actually be null
(deegree extension to cope with features that have only hidden
+ * geometry props)
+ * @param valueReference
+ * never null
+ */
+ public Intersects( Expression propName, ValueReference valueReference ) {
+ this( propName, null, valueReference );
+ }
+
+ private Intersects( Expression propName, Geometry geometry, ValueReference valueReference ) {
super( propName );
this.geometry = geometry;
+ this.valueReference = valueReference;
}
@Override
@@ -125,22 +149,35 @@ public boolean evaluate( T obj, XPathEvaluator xpathEvaluator )
}
/**
- * @return the geometry
+ * @return the second parameter, null
if it is a value reference
*/
public Geometry getGeometry() {
return geometry;
}
+ /**
+ * @return the second parameter, null
if it is a geometry
+ */
+ public ValueReference getValueReference() {
+ return valueReference;
+ }
+
@Override
public String toString( String indent ) {
String s = indent + "-Intersects\n";
s += indent + propName + "\n";
- s += indent + geometry;
+ if ( geometry != null )
+ s += indent + geometry;
+ if ( valueReference != null )
+ s += indent + valueReference;
return s;
}
@Override
public Object[] getParams() {
+ if ( valueReference != null )
+ return new Object[] { propName, valueReference };
return new Object[] { propName, geometry };
}
-}
+
+}
\ No newline at end of file
diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLDecoder.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLDecoder.java
index 1e6a02c167..06eed8e361 100644
--- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLDecoder.java
+++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLDecoder.java
@@ -341,7 +341,8 @@ public static Filter parse( XMLStreamReader xmlStream )
*
*
* - Precondition: cursor must point at the
START_ELEMENT
event (<fes:expression>)
- * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:expression>)
+ * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:expression>)
+ *
*
*
*
@@ -434,7 +435,8 @@ public static Function parseFunction( XMLStreamReader xmlStream )
*
*
* - Precondition: cursor must point at the
START_ELEMENT
event (<fes:expression>)
- * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:expression>)
+ * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:expression>)
+ *
*
*
*
@@ -500,8 +502,7 @@ public static ComparisonOperator parseComparisonOperator( XMLStreamReader xmlStr
// check if element name is a valid comparison operator element
ComparisonOperator.SubType type = elementNameToComparisonOperatorType.get( xmlStream.getName() );
if ( type == null ) {
- String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
- xmlStream.getName(),
+ String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(),
elemNames( ComparisonOperator.SubType.class,
comparisonOperatorTypeToElementName ) );
throw new XMLParsingException( xmlStream, msg );
@@ -557,7 +558,8 @@ public static ComparisonOperator parseComparisonOperator( XMLStreamReader xmlStr
*
*
* - Precondition: cursor must point at the
START_ELEMENT
event (<fes:temporalOps>)
- * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:temporalOps>)
+ * - Postcondition: cursor points at the corresponding
END_ELEMENT
event (</fes:temporalOps>)
+ *
*
*
*
@@ -624,8 +626,7 @@ public static TemporalOperator parseTemporalOperator( final XMLStreamReader xmlS
private static TemporalOperator.SubType checkTemporalOperatorName( final XMLStreamReader xmlStream ) {
TemporalOperator.SubType type = elementNameToTemporalOperatorType.get( xmlStream.getName() );
if ( type == null ) {
- String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
- xmlStream.getName(),
+ String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(),
elemNames( TemporalOperator.SubType.class,
temporalOperatorTypeToElementName ) );
throw new XMLParsingException( xmlStream, msg );
@@ -643,7 +644,8 @@ private static Operator parseOperator( XMLStreamReader xmlStream )
String expectedList = elemNames( LogicalOperator.SubType.class, logicalOperatorTypeToElementName ) + ", "
+ elemNames( SpatialOperator.SubType.class, spatialOperatorTypeToElementName ) + ", "
+ elemNames( ComparisonOperator.SubType.class, comparisonOperatorTypeToElementName )
- + "," + elemNames( TemporalOperator.SubType.class, temporalOperatorTypeToElementName );
+ + ","
+ + elemNames( TemporalOperator.SubType.class, temporalOperatorTypeToElementName );
String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(), expectedList );
throw new XMLParsingException( xmlStream, msg );
}
@@ -783,7 +785,7 @@ private static Literal> parseLiteral( XMLStreamReader xmlStream )
while ( xmlStream.next() != END_ELEMENT ) {
int eventType = xmlStream.getEventType();
if ( eventType == START_ELEMENT ) {
- checkIfCurrentStartElementIsGmlGeometry( xmlStream );
+ checkRequiredGmlGeometry( xmlStream );
children.add( parseElement( xmlStream ) );
} else if ( eventType == CHARACTERS || eventType == CDATA ) {
children.add( new PrimitiveValue( xmlStream.getText() ) );
@@ -944,8 +946,7 @@ private static LogicalOperator parseLogicalOperator( XMLStreamReader xmlStream )
// check if element name is a valid logical operator element
LogicalOperator.SubType type = elementNameToLogicalOperatorType.get( xmlStream.getName() );
if ( type == null ) {
- String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
- xmlStream.getName(),
+ String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(),
elemNames( LogicalOperator.SubType.class,
logicalOperatorTypeToElementName ) );
throw new XMLParsingException( xmlStream, msg );
@@ -996,8 +997,7 @@ private static SpatialOperator parseSpatialOperator( XMLStreamReader xmlStream )
// check if element name is a valid spatial operator element name
SpatialOperator.SubType type = elementNameToSpatialOperatorType.get( xmlStream.getName() );
if ( type == null ) {
- String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
- xmlStream.getName(),
+ String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(),
elemNames( SpatialOperator.SubType.class,
spatialOperatorTypeToElementName ) );
throw new XMLParsingException( xmlStream, msg );
@@ -1043,9 +1043,15 @@ private static SpatialOperator parseSpatialOperator( XMLStreamReader xmlStream )
param1 = parseExpression( xmlStream );
nextElement( xmlStream );
}
- // (must be 'gml:Geometry')
- Geometry param2 = parseGeomOrEnvelope( xmlStream );
- spatialOperator = new Intersects( param1, param2 );
+ if ( isCurrentStartElementIsGmlGeometry( xmlStream ) ) {
+ // (is 'gml:Geometry')
+ Geometry param2 = parseGeomOrEnvelope( xmlStream );
+ spatialOperator = new Intersects( param1, param2 );
+ } else {
+ // (is 'fes:ValueReference')
+ ValueReference param2 = parseValueReference( xmlStream, false );
+ spatialOperator = new Intersects( param1, param2 );
+ }
break;
}
case CONTAINS: {
@@ -1171,15 +1177,20 @@ private static Geometry parseGeomOrEnvelope( XMLStreamReader xmlStream )
}
}
- private static void checkIfCurrentStartElementIsGmlGeometry( XMLStreamReader xmlStream )
+ private static void checkRequiredGmlGeometry( XMLStreamReader xmlStream )
+ throws XMLStreamException {
+ if ( isCurrentStartElementIsGmlGeometry( xmlStream ) )
+ throw new XMLParsingException( xmlStream, "Geometry elements as Literal child are not supported!" );
+ }
+
+ private static boolean isCurrentStartElementIsGmlGeometry( XMLStreamReader xmlStream )
throws XMLStreamException {
String ns = xmlStream.getNamespaceURI();
if ( CommonNamespaces.GMLNS.equals( ns ) || CommonNamespaces.GML3_2_NS.equals( ns ) ) {
GMLGeometryReader gmlReader = GMLGeometryVersionHelper.getGeometryReader( xmlStream.getName(), xmlStream );
- boolean isGeometryElement = gmlReader.isGeometryOrEnvelopeElement( xmlStream );
- if ( isGeometryElement )
- throw new XMLParsingException( xmlStream, "Geometry elements as Literal child are not supported!" );
+ return gmlReader.isGeometryOrEnvelopeElement( xmlStream );
}
+ return false;
}
/**
diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLDecoderTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLDecoderTest.java
index ba7c95a58f..59dc610882 100644
--- a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLDecoderTest.java
+++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLDecoderTest.java
@@ -35,7 +35,9 @@
----------------------------------------------------------------------------*/
package org.deegree.filter.xml;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.IOException;
@@ -66,10 +68,12 @@
import org.deegree.filter.logical.And;
import org.deegree.filter.logical.Not;
import org.deegree.filter.spatial.Disjoint;
+import org.deegree.filter.spatial.Intersects;
import org.deegree.filter.spatial.Overlaps;
import org.deegree.geometry.Envelope;
import org.deegree.geometry.primitive.Polygon;
import org.deegree.workspace.standard.DefaultWorkspace;
+import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -328,6 +332,19 @@ public void parseOGCExample14()
}
}
+ @Test
+ public void parseIntersectsWithSpatialJoin()
+ throws XMLStreamException, FactoryConfigurationError, IOException {
+ InputStream filterAsStream = this.getClass().getResourceAsStream( "v200/intersectsWithSpatialJoin.xml" );
+ XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader( filterAsStream );
+ XMLStreamUtils.skipStartDocument( xmlStream );
+ Intersects intersects = (Intersects) ( (OperatorFilter) Filter200XMLDecoder.parse( xmlStream ) ).getOperator();
+
+ assertThat( ( (ValueReference) intersects.getParam1() ).getAsText(), is( "app:ft1/geometry" ) );
+ assertThat( intersects.getGeometry(), is( CoreMatchers.nullValue() ) );
+ assertThat( intersects.getValueReference().getAsText(), is( "app:ft2/geometry" ) );
+ }
+
@Test(expected = XMLParsingException.class)
public void parsePropertyIsLessThanOrEuqlToWithLiteralContainingUnexpectedGeometry()
throws Exception {
diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v200/intersectsWithSpatialJoin.xml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v200/intersectsWithSpatialJoin.xml
new file mode 100644
index 0000000000..b9f3157ad6
--- /dev/null
+++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v200/intersectsWithSpatialJoin.xml
@@ -0,0 +1,9 @@
+
+
+
+ app:ft1/geometry
+ app:ft2/geometry
+
+
\ No newline at end of file
From 9d06eec160de7d38612e72d01b53661bac51cb44 Mon Sep 17 00:00:00 2001
From: Lyn Elisa Goltz
Date: Thu, 26 May 2016 13:28:32 +0200
Subject: [PATCH 02/25] #3475 - implememted parsing of second paramater as
PropertyName for 1.1.0
---
.../filter/xml/Filter110XMLDecoder.java | 27 ++++++++++++++++---
.../filter/xml/Filter110XMLDecoderTest.java | 19 ++++++++++++-
.../xml/v110/intersectsWithSpatialJoin.xml | 8 ++++++
3 files changed, 49 insertions(+), 5 deletions(-)
create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v110/intersectsWithSpatialJoin.xml
diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLDecoder.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLDecoder.java
index 11df2adf1a..1db80338ec 100644
--- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLDecoder.java
+++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLDecoder.java
@@ -66,6 +66,7 @@
import org.deegree.commons.tom.primitive.PrimitiveValue;
import org.deegree.commons.uom.Measure;
import org.deegree.commons.utils.ArrayUtils;
+import org.deegree.commons.xml.CommonNamespaces;
import org.deegree.commons.xml.NamespaceBindings;
import org.deegree.commons.xml.XMLParsingException;
import org.deegree.commons.xml.XPathUtils;
@@ -122,6 +123,8 @@
import org.deegree.gml.GMLInputFactory;
import org.deegree.gml.GMLStreamReader;
import org.deegree.gml.geometry.GML3GeometryReader;
+import org.deegree.gml.geometry.GMLGeometryReader;
+import org.deegree.gml.geometry.GMLGeometryVersionHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -880,9 +883,14 @@ private static SpatialOperator parseSpatialOperator( XMLStreamReader xmlStream )
// first parameter: 'ogc:PropertyName' (cannot be empty)
ValueReference param1 = parsePropertyName( xmlStream, false );
nextElement( xmlStream );
- // second parameter: 'gml:_Geometry' or 'gml:Envelope'
- Geometry param2 = geomParser.parseGeometryOrEnvelope( wrapper );
- spatialOperator = new Intersects( param1, param2 );
+ if ( isCurrentStartElementIsGmlGeometry( xmlStream ) ) {
+ // second parameter: 'gml:_Geometry' or 'gml:Envelope'
+ Geometry param2 = geomParser.parseGeometryOrEnvelope( wrapper );
+ spatialOperator = new Intersects( param1, param2 );
+ } else {
+ ValueReference param2 = parsePropertyName( xmlStream, false );
+ spatialOperator = new Intersects( param1, param2 );
+ }
break;
}
case CONTAINS: {
@@ -991,4 +999,15 @@ private static String elemNames( Class extends Enum>> enumClass, Map exten
}
return ArrayUtils.join( ", ", names );
}
-}
+
+ private static boolean isCurrentStartElementIsGmlGeometry( XMLStreamReader xmlStream )
+ throws XMLStreamException {
+ String ns = xmlStream.getNamespaceURI();
+ if ( CommonNamespaces.GMLNS.equals( ns ) || CommonNamespaces.GML3_2_NS.equals( ns ) ) {
+ GMLGeometryReader gmlReader = GMLGeometryVersionHelper.getGeometryReader( xmlStream.getName(), xmlStream );
+ return gmlReader.isGeometryOrEnvelopeElement( xmlStream );
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLDecoderTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLDecoderTest.java
index 7b957954f6..9f19b8f36b 100644
--- a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLDecoderTest.java
+++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLDecoderTest.java
@@ -35,7 +35,9 @@
----------------------------------------------------------------------------*/
package org.deegree.filter.xml;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.slf4j.LoggerFactory.getLogger;
import java.io.File;
@@ -56,11 +58,14 @@
import org.deegree.filter.Operator;
import org.deegree.filter.OperatorFilter;
import org.deegree.filter.comparison.ComparisonOperator;
+import org.deegree.filter.expression.ValueReference;
import org.deegree.filter.logical.And;
import org.deegree.filter.logical.LogicalOperator;
+import org.deegree.filter.spatial.Intersects;
import org.deegree.junit.XMLAssert;
import org.deegree.junit.XMLMemoryStreamWriter;
import org.deegree.workspace.standard.DefaultWorkspace;
+import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -243,4 +248,16 @@ public void parseWithinFilter()
Assert.assertNotNull( filter );
}
-}
+
+ @Test
+ public void parseIntersectsWithSpatialJoin()
+ throws XMLStreamException, FactoryConfigurationError, IOException {
+ Filter filter = parse( "intersectsWithSpatialJoin.xml" );
+ Intersects intersects = (Intersects) ( (OperatorFilter) filter ).getOperator();
+
+ assertThat( ( (ValueReference) intersects.getParam1() ).getAsText(), is( "app:ft1/app:geom" ) );
+ assertThat( intersects.getGeometry(), is( CoreMatchers.nullValue() ) );
+ assertThat( intersects.getValueReference().getAsText(), is( "app:ft2/app:geom" ) );
+ }
+
+}
\ No newline at end of file
diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v110/intersectsWithSpatialJoin.xml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v110/intersectsWithSpatialJoin.xml
new file mode 100644
index 0000000000..cf15990fa8
--- /dev/null
+++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/filter/xml/v110/intersectsWithSpatialJoin.xml
@@ -0,0 +1,8 @@
+
+
+
+ app:ft1/app:geom
+ app:ft2/app:geom
+
+
From a970a7ae27b1c1219de9cc77353c91b7a31ba5f4 Mon Sep 17 00:00:00 2001
From: Lyn Elisa Goltz
Date: Thu, 26 May 2016 13:29:56 +0200
Subject: [PATCH 03/25] #3475 - enhanced filter encoder to export second
PropertyName/ValueReference
---
.../java/org/deegree/filter/xml/Filter110XMLEncoder.java | 7 +++++++
.../java/org/deegree/filter/xml/Filter200XMLEncoder.java | 7 ++++++-
.../org/deegree/filter/xml/Filter110XMLEncoderTest.java | 9 +++++++++
.../filter/xml/Filter200XMLEncoderParameterizedTest.java | 1 +
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLEncoder.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLEncoder.java
index 53c04ffdfd..5a50ac9abf 100644
--- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLEncoder.java
+++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter110XMLEncoder.java
@@ -386,6 +386,7 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
ValueReference propertyName = null;
Geometry geometry = null;
+ ValueReference secondParam = null;
Measure distance = null;
switch ( operator.getSubType() ) {
@@ -423,6 +424,7 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
case INTERSECTS:
propertyName = ( (Intersects) operator ).getPropName();
geometry = ( (Intersects) operator ).getGeometry();
+ secondParam = ( (Intersects) operator ).getValueReference();
break;
case OVERLAPS:
propertyName = ( (Overlaps) operator ).getPropName();
@@ -441,12 +443,17 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
// exporting the comparable geometry property
export( propertyName, writer );
+
// serializing the geometry
if ( geometry != null ) {
gmlWriter.setOutputCrs( geometry.getCoordinateSystem() );
gmlWriter.write( geometry );
}
+ // or value reference
+ if ( secondParam != null )
+ export( secondParam, writer );
+
if ( distance != null ) { // in case of Beyond- and DWithin-operators export their distance variable
QName distanceElementName = new QName( CommonNamespaces.OGCNS, "Distance" );
writer.writeStartElement( distanceElementName.getNamespaceURI(), distanceElementName.getLocalPart() );
diff --git a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLEncoder.java b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLEncoder.java
index 296045c594..0c47c9cdec 100644
--- a/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLEncoder.java
+++ b/deegree-core/deegree-core-base/src/main/java/org/deegree/filter/xml/Filter200XMLEncoder.java
@@ -276,6 +276,7 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
writer.writeStartElement( elementName.getNamespaceURI(), elementName.getLocalPart() );
Geometry geometry = null;
+ ValueReference secondParam = null;
Measure distance = null;
switch ( operator.getSubType() ) {
case BBOX:
@@ -303,6 +304,7 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
break;
case INTERSECTS:
geometry = ( (Intersects) operator ).getGeometry();
+ secondParam = ( (Intersects) operator ).getValueReference();
break;
case OVERLAPS:
geometry = ( (Overlaps) operator ).getGeometry();
@@ -320,7 +322,10 @@ private static void export( SpatialOperator operator, XMLStreamWriter writer )
GMLStreamWriter gmlWriter = createGml32StreamWriter( writer );
export( operator.getParam1(), writer );
- exportGeometry( geometry, gmlWriter );
+ if ( secondParam != null )
+ export( secondParam, writer );
+ if ( geometry != null )
+ exportGeometry( geometry, gmlWriter );
exportDistance( distance, writer );
writer.writeEndElement();
}
diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLEncoderTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLEncoderTest.java
index e5bbd6d81f..9d885bc39f 100644
--- a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLEncoderTest.java
+++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter110XMLEncoderTest.java
@@ -265,4 +265,13 @@ public void parseWithinFilter()
Assert.assertNotNull( filter );
}
+
+ @Test
+ public void parseIntersectsWithSpatialJoin()
+ throws XMLStreamException, FactoryConfigurationError, IOException, UnknownCRSException,
+ TransformationException {
+ Filter filter = testImportExportImport( "intersectsWithSpatialJoin.xml" );
+ Assert.assertNotNull( filter );
+ }
+
}
diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLEncoderParameterizedTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLEncoderParameterizedTest.java
index 0b62fa904b..9658f3a168 100644
--- a/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLEncoderParameterizedTest.java
+++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/filter/xml/Filter200XMLEncoderParameterizedTest.java
@@ -93,6 +93,7 @@ public static List