GML parsing with new extent structure
This commit is contained in:
@@ -2,6 +2,7 @@ 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');
|
||||
|
||||
|
||||
@@ -35,8 +36,7 @@ ol.parser.ogc.GML_v2 = function(opt_options) {
|
||||
[node, coordinates, container]);
|
||||
this.readChildNodes(node, coordinates);
|
||||
container.projection = node.getAttribute('srsName');
|
||||
container.bounds = [coordinates[0][0][0], coordinates[0][1][0],
|
||||
coordinates[0][0][1], coordinates[0][1][1]];
|
||||
container.bounds = ol.extent.clone(coordinates[0]);
|
||||
}
|
||||
});
|
||||
goog.object.extend(this.writers['http://www.opengis.net/gml'], {
|
||||
@@ -104,8 +104,7 @@ ol.parser.ogc.GML_v2 = function(opt_options) {
|
||||
},
|
||||
'Box': function(extent) {
|
||||
var node = this.createElementNS('gml:Box');
|
||||
this.writeNode('coordinates', [[extent[0], extent[1]],
|
||||
[extent[2], extent[3]]], null, node);
|
||||
this.writeNode('coordinates', extent, null, node);
|
||||
// srsName attribute is optional for gml:Box
|
||||
if (goog.isDefAndNotNull(this.srsName)) {
|
||||
node.setAttribute('srsName', this.srsName);
|
||||
|
||||
@@ -3,6 +3,7 @@ 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');
|
||||
|
||||
@@ -113,7 +114,7 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
|
||||
if (coords.length === 2) {
|
||||
obj.push([coords.reverse()]);
|
||||
} else if (coords.length === 3) {
|
||||
obj.push([coords[1], coords[0], coords[2]]);
|
||||
obj.push([[coords[1], coords[0], coords[2]]]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -215,20 +216,19 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
|
||||
[node, coordinates, container]);
|
||||
this.readChildNodes(node, coordinates);
|
||||
container.projection = node.getAttribute('srsName');
|
||||
container.bounds = [coordinates[0][0][0][0], coordinates[1][0][0][0],
|
||||
coordinates[0][0][0][1], coordinates[1][0][0][1]];
|
||||
container.bounds = ol.extent.clone(coordinates);
|
||||
},
|
||||
'lowerCorner': function(node, envelope) {
|
||||
var coordinates = [];
|
||||
this.readers[this.defaultNamespaceURI]['pos'].apply(this,
|
||||
[node, coordinates]);
|
||||
envelope.push(coordinates);
|
||||
envelope.push(coordinates[0][0]);
|
||||
},
|
||||
'upperCorner': function(node, envelope) {
|
||||
var coordinates = [];
|
||||
this.readers[this.defaultNamespaceURI]['pos'].apply(this,
|
||||
[node, coordinates]);
|
||||
envelope.push(coordinates);
|
||||
envelope.push(coordinates[0][0]);
|
||||
}
|
||||
});
|
||||
goog.object.extend(this.writers['http://www.opengis.net/gml'], {
|
||||
@@ -391,9 +391,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] + ' ' + bounds[2]);
|
||||
pos = (bounds[0][0] + ' ' + bounds[0][1]);
|
||||
} else {
|
||||
pos = (bounds[2] + ' ' + bounds[0]);
|
||||
pos = (bounds[0][1] + ' ' + bounds[0][0]);
|
||||
}
|
||||
var node = this.createElementNS('gml:lowerCorner');
|
||||
node.appendChild(this.createTextNode(pos));
|
||||
@@ -403,9 +403,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] + ' ' + bounds[3]);
|
||||
pos = (bounds[1][0] + ' ' + bounds[1][1]);
|
||||
} else {
|
||||
pos = (bounds[3] + ' ' + bounds[1]);
|
||||
pos = (bounds[1][1] + ' ' + bounds[1][0]);
|
||||
}
|
||||
var node = this.createElementNS('gml:upperCorner');
|
||||
node.appendChild(this.createTextNode(pos));
|
||||
|
||||
Reference in New Issue
Block a user