Filter encoding with new extent structure
This commit is contained in:
@@ -184,10 +184,10 @@ ol.parser.ogc.Filter_v1 = function() {
|
||||
if (goog.isDef(container.geometry)) {
|
||||
args.push(new ol.expr.Literal(this.gml_.createGeometry(container)));
|
||||
} else {
|
||||
args = [new ol.expr.Literal(container.bounds[0]),
|
||||
new ol.expr.Literal(container.bounds[1]),
|
||||
new ol.expr.Literal(container.bounds[2]),
|
||||
new ol.expr.Literal(container.bounds[3])];
|
||||
args = [new ol.expr.Literal(container.bounds[0][0]),
|
||||
new ol.expr.Literal(container.bounds[0][1]),
|
||||
new ol.expr.Literal(container.bounds[1][0]),
|
||||
new ol.expr.Literal(container.bounds[1][1])];
|
||||
}
|
||||
if (goog.isDef(container.distance)) {
|
||||
args.push(container.distance);
|
||||
|
||||
@@ -92,9 +92,12 @@ ol.parser.ogc.Filter_v1_0_0 = function() {
|
||||
goog.asserts.assert(args[2] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[4] instanceof ol.expr.Literal);
|
||||
var property = args[5], bbox = [args[0].getValue(), args[1].getValue(),
|
||||
args[2].getValue(), args[3].getValue()],
|
||||
projection = args[4].getValue();
|
||||
var bbox = [
|
||||
[args[0].getValue(), args[1].getValue()],
|
||||
[args[2].getValue(), args[3].getValue()]
|
||||
];
|
||||
var projection = args[4].getValue();
|
||||
var property = args[5];
|
||||
// PropertyName is mandatory in 1.0.0, but e.g. GeoServer also
|
||||
// accepts filters without it.
|
||||
if (goog.isDefAndNotNull(property)) {
|
||||
@@ -129,8 +132,10 @@ ol.parser.ogc.Filter_v1_0_0.prototype.writeSpatial_ = function(filter, name) {
|
||||
goog.asserts.assert(args[1] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[2] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
|
||||
bbox = [args[0].getValue(), args[1].getValue(), args[2].getValue(),
|
||||
args[3].getValue()];
|
||||
bbox = [
|
||||
[args[0].getValue(), args[1].getValue()],
|
||||
[args[2].getValue(), args[3].getValue()]
|
||||
];
|
||||
projection = args[4];
|
||||
property = args[5];
|
||||
} else if (args[0] instanceof ol.expr.Literal &&
|
||||
@@ -163,7 +168,7 @@ ol.parser.ogc.Filter_v1_0_0.prototype.writeSpatial_ = function(filter, name) {
|
||||
if (geom !== null) {
|
||||
child = this.writeNode('_geometry', geom,
|
||||
this.gml_.featureNS).firstChild;
|
||||
} else if (bbox.length === 4) {
|
||||
} else if (bbox.length === 2) {
|
||||
child = this.writeNode('Box', bbox,
|
||||
'http://www.opengis.net/gml');
|
||||
}
|
||||
|
||||
@@ -130,9 +130,12 @@ ol.parser.ogc.Filter_v1_1_0 = function() {
|
||||
goog.asserts.assert(args[2] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[4] instanceof ol.expr.Literal);
|
||||
var property = args[5], bbox = [args[0].getValue(), args[1].getValue(),
|
||||
args[2].getValue(), args[3].getValue()],
|
||||
projection = args[4].getValue();
|
||||
var bbox = [
|
||||
[args[0].getValue(), args[1].getValue()],
|
||||
[args[2].getValue(), args[3].getValue()]
|
||||
];
|
||||
var projection = args[4].getValue();
|
||||
var property = args[5];
|
||||
// PropertyName is optional in 1.1.0
|
||||
if (goog.isDefAndNotNull(property)) {
|
||||
this.writeNode('PropertyName', property, null, node);
|
||||
@@ -187,8 +190,10 @@ ol.parser.ogc.Filter_v1_1_0.prototype.writeSpatial_ = function(filter, name) {
|
||||
goog.asserts.assert(args[1] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[2] instanceof ol.expr.Literal);
|
||||
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
|
||||
bbox = [args[0].getValue(), args[1].getValue(), args[2].getValue(),
|
||||
args[3].getValue()];
|
||||
bbox = [
|
||||
[args[0].getValue(), args[1].getValue()],
|
||||
[args[2].getValue(), args[3].getValue()]
|
||||
];
|
||||
projection = args[4];
|
||||
property = args[5];
|
||||
} else if (args[0] instanceof ol.expr.Literal &&
|
||||
@@ -221,7 +226,7 @@ ol.parser.ogc.Filter_v1_1_0.prototype.writeSpatial_ = function(filter, name) {
|
||||
if (geom !== null) {
|
||||
child = this.writeNode('_geometry', geom,
|
||||
this.gml_.featureNS).firstChild;
|
||||
} else if (bbox.length === 4) {
|
||||
} else if (bbox.length === 2) {
|
||||
child = this.writeNode('Envelope', bbox,
|
||||
'http://www.opengis.net/gml');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user