Moving SRSReferenceGroup parser from Base to v3.

This commit is contained in:
ahocevar
2012-06-14 15:11:55 +02:00
parent fa90a42806
commit 88982e043f
2 changed files with 20 additions and 18 deletions

View File

@@ -241,14 +241,8 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
*/
readers: {
"gml": {
// Part of the v3 spec, but defined here for common readers.
// Read-only for now.
"_srsReferenceGroup": function(node, obj, container) {
var dim = parseInt(node.getAttribute("srsDimension"), 10) ||
(container && container.srsDimension);
if (dim) {
obj.srsDimension = dim;
}
"_inherit": function(node, obj, container) {
// To be implemented by version specific parsers
},
"featureMember": function(node, obj) {
this.readChildNodes(node, obj);
@@ -318,7 +312,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiPoint": function(node, container) {
var obj = {components: []};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiPoint(obj.components)
@@ -329,7 +323,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"LineString": function(node, container) {
var obj = {};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
if(!container.components) {
container.components = [];
@@ -340,7 +334,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiLineString": function(node, container) {
var obj = {components: []};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiLineString(obj.components)
@@ -351,7 +345,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"Polygon": function(node, container) {
var obj = {outer: null, inner: []};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
obj.inner.unshift(obj.outer);
if(!container.components) {
@@ -363,7 +357,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"LinearRing": function(node, obj) {
var container = {};
this.readers.gml._srsReferenceGroup.apply(this, [node, container]);
this.readers.gml._inherit.apply(this, [node, container]);
this.readChildNodes(node, container);
obj.components = [new OpenLayers.Geometry.LinearRing(
container.points
@@ -371,7 +365,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiPolygon": function(node, container) {
var obj = {components: []};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiPolygon(obj.components)
@@ -382,7 +376,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"GeometryCollection": function(node, container) {
var obj = {components: []};
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.Collection(obj.components)