Moving SRSReferenceGroup parser from Base to v3.
This commit is contained in:
@@ -241,14 +241,8 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
*/
|
*/
|
||||||
readers: {
|
readers: {
|
||||||
"gml": {
|
"gml": {
|
||||||
// Part of the v3 spec, but defined here for common readers.
|
"_inherit": function(node, obj, container) {
|
||||||
// Read-only for now.
|
// To be implemented by version specific parsers
|
||||||
"_srsReferenceGroup": function(node, obj, container) {
|
|
||||||
var dim = parseInt(node.getAttribute("srsDimension"), 10) ||
|
|
||||||
(container && container.srsDimension);
|
|
||||||
if (dim) {
|
|
||||||
obj.srsDimension = dim;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"featureMember": function(node, obj) {
|
"featureMember": function(node, obj) {
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
@@ -318,7 +312,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"MultiPoint": function(node, container) {
|
"MultiPoint": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiPoint(obj.components)
|
new OpenLayers.Geometry.MultiPoint(obj.components)
|
||||||
@@ -329,7 +323,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"LineString": function(node, container) {
|
"LineString": function(node, container) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
container.components = [];
|
container.components = [];
|
||||||
@@ -340,7 +334,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"MultiLineString": function(node, container) {
|
"MultiLineString": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiLineString(obj.components)
|
new OpenLayers.Geometry.MultiLineString(obj.components)
|
||||||
@@ -351,7 +345,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"Polygon": function(node, container) {
|
"Polygon": function(node, container) {
|
||||||
var obj = {outer: null, inner: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
obj.inner.unshift(obj.outer);
|
obj.inner.unshift(obj.outer);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
@@ -363,7 +357,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"LinearRing": function(node, obj) {
|
"LinearRing": function(node, obj) {
|
||||||
var container = {};
|
var container = {};
|
||||||
this.readers.gml._srsReferenceGroup.apply(this, [node, container]);
|
this.readers.gml._inherit.apply(this, [node, container]);
|
||||||
this.readChildNodes(node, container);
|
this.readChildNodes(node, container);
|
||||||
obj.components = [new OpenLayers.Geometry.LinearRing(
|
obj.components = [new OpenLayers.Geometry.LinearRing(
|
||||||
container.points
|
container.points
|
||||||
@@ -371,7 +365,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"MultiPolygon": function(node, container) {
|
"MultiPolygon": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiPolygon(obj.components)
|
new OpenLayers.Geometry.MultiPolygon(obj.components)
|
||||||
@@ -382,7 +376,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
},
|
},
|
||||||
"GeometryCollection": function(node, container) {
|
"GeometryCollection": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.Collection(obj.components)
|
new OpenLayers.Geometry.Collection(obj.components)
|
||||||
|
|||||||
@@ -90,12 +90,20 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
|||||||
*/
|
*/
|
||||||
readers: {
|
readers: {
|
||||||
"gml": OpenLayers.Util.applyDefaults({
|
"gml": OpenLayers.Util.applyDefaults({
|
||||||
|
"_inherit": function(node, obj, container) {
|
||||||
|
// SRSReferenceGroup attributes
|
||||||
|
var dim = parseInt(node.getAttribute("srsDimension"), 10) ||
|
||||||
|
(container && container.srsDimension);
|
||||||
|
if (dim) {
|
||||||
|
obj.srsDimension = dim;
|
||||||
|
}
|
||||||
|
},
|
||||||
"featureMembers": function(node, obj) {
|
"featureMembers": function(node, obj) {
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
},
|
},
|
||||||
"Curve": function(node, container) {
|
"Curve": function(node, container) {
|
||||||
var obj = {points: []};
|
var obj = {points: []};
|
||||||
this.readers.gml._srsReferenceGroup.apply(this, [node, obj, container]);
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
container.components = [];
|
container.components = [];
|
||||||
@@ -174,7 +182,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
|||||||
},
|
},
|
||||||
"MultiCurve": function(node, container) {
|
"MultiCurve": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
if(obj.components.length > 0) {
|
if(obj.components.length > 0) {
|
||||||
container.components = [
|
container.components = [
|
||||||
@@ -187,7 +195,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
|||||||
},
|
},
|
||||||
"MultiSurface": function(node, container) {
|
"MultiSurface": function(node, container) {
|
||||||
var obj = {components: []};
|
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);
|
this.readChildNodes(node, obj);
|
||||||
if(obj.components.length > 0) {
|
if(obj.components.length > 0) {
|
||||||
container.components = [
|
container.components = [
|
||||||
|
|||||||
Reference in New Issue
Block a user