Changing extent structure back to single array: [minX, minY, maxX, maxY]

This means we'll have to have a new structure and new methods for 3D envelopes.
This commit is contained in:
Tim Schaub
2013-09-15 00:15:24 -06:00
parent de0e8aeced
commit e806f51b3d
63 changed files with 379 additions and 392 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][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])];
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])];
}
if (goog.isDef(container.distance)) {
args.push(container.distance);

View File

@@ -93,8 +93,8 @@ ol.parser.ogc.Filter_v1_0_0 = function() {
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
goog.asserts.assert(args[4] instanceof ol.expr.Literal);
var bbox = [
[args[0].getValue(), args[1].getValue()],
[args[2].getValue(), args[3].getValue()]
args[0].getValue(), args[1].getValue(),
args[2].getValue(), args[3].getValue()
];
var projection = args[4].getValue();
var property = args[5];
@@ -133,8 +133,8 @@ ol.parser.ogc.Filter_v1_0_0.prototype.writeSpatial_ = function(filter, name) {
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()]
args[0].getValue(), args[1].getValue(),
args[2].getValue(), args[3].getValue()
];
projection = args[4];
property = args[5];
@@ -168,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 === 2) {
} else if (bbox.length === 4) {
child = this.writeNode('Box', bbox,
'http://www.opengis.net/gml');
}

View File

@@ -131,8 +131,8 @@ ol.parser.ogc.Filter_v1_1_0 = function() {
goog.asserts.assert(args[3] instanceof ol.expr.Literal);
goog.asserts.assert(args[4] instanceof ol.expr.Literal);
var bbox = [
[args[0].getValue(), args[1].getValue()],
[args[2].getValue(), args[3].getValue()]
args[0].getValue(), args[1].getValue(),
args[2].getValue(), args[3].getValue()
];
var projection = args[4].getValue();
var property = args[5];
@@ -191,8 +191,8 @@ ol.parser.ogc.Filter_v1_1_0.prototype.writeSpatial_ = function(filter, name) {
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()]
args[0].getValue(), args[1].getValue(),
args[2].getValue(), args[3].getValue()
];
projection = args[4];
property = args[5];
@@ -226,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 === 2) {
} else if (bbox.length === 4) {
child = this.writeNode('Envelope', bbox,
'http://www.opengis.net/gml');
}

View File

@@ -2,7 +2,6 @@ goog.provide('ol.parser.ogc.GML_v2');
goog.require('goog.array');
goog.require('goog.object');
goog.require('ol.extent');
goog.require('ol.parser.ogc.GML');
@@ -36,7 +35,10 @@ ol.parser.ogc.GML_v2 = function(opt_options) {
[node, coordinates, container]);
this.readChildNodes(node, coordinates);
container.projection = node.getAttribute('srsName');
container.bounds = ol.extent.clone(coordinates[0]);
container.bounds = [
coordinates[0][0][0], coordinates[0][0][1],
coordinates[0][1][0], coordinates[0][1][1]
];
}
});
goog.object.extend(this.writers['http://www.opengis.net/gml'], {
@@ -104,7 +106,11 @@ ol.parser.ogc.GML_v2 = function(opt_options) {
},
'Box': function(extent) {
var node = this.createElementNS('gml:Box');
this.writeNode('coordinates', extent, null, node);
var coordinates = [
[extent[0], extent[1]],
[extent[2], extent[3]]
];
this.writeNode('coordinates', coordinates, null, node);
// srsName attribute is optional for gml:Box
if (goog.isDefAndNotNull(this.srsName)) {
node.setAttribute('srsName', this.srsName);

View File

@@ -3,7 +3,6 @@ goog.provide('ol.parser.ogc.GML_v3');
goog.require('goog.array');
goog.require('goog.functions');
goog.require('goog.object');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.parser.ogc.GML');
@@ -216,7 +215,10 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
[node, coordinates, container]);
this.readChildNodes(node, coordinates);
container.projection = node.getAttribute('srsName');
container.bounds = ol.extent.clone(coordinates);
container.bounds = [
coordinates[0][0], coordinates[0][1],
coordinates[1][0], coordinates[1][1]
];
},
'lowerCorner': function(node, envelope) {
var coordinates = [];
@@ -391,9 +393,9 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
// only 2d for simple features profile
var pos;
if (this.axisOrientation.substr(0, 2) === 'en') {
pos = (bounds[0][0] + ' ' + bounds[0][1]);
pos = (bounds[0] + ' ' + bounds[1]);
} else {
pos = (bounds[0][1] + ' ' + bounds[0][0]);
pos = (bounds[1] + ' ' + bounds[0]);
}
var node = this.createElementNS('gml:lowerCorner');
node.appendChild(this.createTextNode(pos));
@@ -403,9 +405,9 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
// only 2d for simple features profile
var pos;
if (this.axisOrientation.substr(0, 2) === 'en') {
pos = (bounds[1][0] + ' ' + bounds[1][1]);
pos = (bounds[2] + ' ' + bounds[3]);
} else {
pos = (bounds[1][1] + ' ' + bounds[1][0]);
pos = (bounds[3] + ' ' + bounds[2]);
}
var node = this.createElementNS('gml:upperCorner');
node.appendChild(this.createTextNode(pos));

View File

@@ -31,13 +31,12 @@ ol.parser.ogc.WMSCapabilities_v1 = function() {
},
'BoundingBox': function(node, obj) {
var bbox = {};
bbox['bbox'] = [[
bbox['bbox'] = [
parseFloat(node.getAttribute('minx')),
parseFloat(node.getAttribute('miny'))
], [
parseFloat(node.getAttribute('miny')),
parseFloat(node.getAttribute('maxx')),
parseFloat(node.getAttribute('maxy'))
]];
];
var res = {
x: parseFloat(node.getAttribute('resx')),
y: parseFloat(node.getAttribute('resy'))

View File

@@ -47,13 +47,12 @@ ol.parser.ogc.WMSCapabilities_v1_1 = function() {
obj['userSymbols'] = userSymbols;
},
'LatLonBoundingBox': function(node, obj) {
obj['llbbox'] = [[
obj['llbbox'] = [
parseFloat(node.getAttribute('minx')),
parseFloat(node.getAttribute('miny'))
], [
parseFloat(node.getAttribute('miny')),
parseFloat(node.getAttribute('maxx')),
parseFloat(node.getAttribute('maxy'))
]];
];
},
'BoundingBox': function(node, obj) {
var bbox = bboxreader.apply(this, arguments);