Filter encoding with new extent structure

This commit is contained in:
Tim Schaub
2013-09-03 17:45:27 -06:00
parent 3ea6041714
commit 5d18da4035
3 changed files with 26 additions and 16 deletions

View File

@@ -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);

View File

@@ -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');
}

View File

@@ -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');
}