Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions
+148 -145
View File
@@ -1,25 +1,25 @@
goog.provide('ol.format.EsriJSON');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.asserts');
goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.flat.deflate');
goog.require('ol.geom.flat.orient');
goog.require('ol.obj');
goog.require('ol.proj');
/**
* @module ol/format/EsriJSON
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_asserts_ from '../asserts.js';
import _ol_extent_ from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -30,11 +30,11 @@ goog.require('ol.proj');
* @param {olx.format.EsriJSONOptions=} opt_options Options.
* @api
*/
ol.format.EsriJSON = function(opt_options) {
var _ol_format_EsriJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* Name of the geometry attribute for features.
@@ -44,7 +44,8 @@ ol.format.EsriJSON = function(opt_options) {
this.geometryName_ = options.geometryName;
};
ol.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_EsriJSON_, _ol_format_JSONFeature_);
/**
@@ -53,38 +54,39 @@ ol.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
* @private
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
_ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
if (!object) {
return null;
}
/** @type {ol.geom.GeometryType} */
var type;
if (typeof object.x === 'number' && typeof object.y === 'number') {
type = ol.geom.GeometryType.POINT;
type = _ol_geom_GeometryType_.POINT;
} else if (object.points) {
type = ol.geom.GeometryType.MULTI_POINT;
type = _ol_geom_GeometryType_.MULTI_POINT;
} else if (object.paths) {
if (object.paths.length === 1) {
type = ol.geom.GeometryType.LINE_STRING;
type = _ol_geom_GeometryType_.LINE_STRING;
} else {
type = ol.geom.GeometryType.MULTI_LINE_STRING;
type = _ol_geom_GeometryType_.MULTI_LINE_STRING;
}
} else if (object.rings) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
var rings = ol.format.EsriJSON.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(ol.obj.assign({}, object));
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
var rings = _ol_format_EsriJSON_.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object));
if (rings.length === 1) {
type = ol.geom.GeometryType.POLYGON;
type = _ol_geom_GeometryType_.POLYGON;
object.rings = rings[0];
} else {
type = ol.geom.GeometryType.MULTI_POLYGON;
type = _ol_geom_GeometryType_.MULTI_POLYGON;
object.rings = rings;
}
}
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
var geometryReader = _ol_format_EsriJSON_.GEOMETRY_READERS_[type];
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
geometryReader(object), false, opt_options)
);
};
@@ -98,16 +100,16 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
* @private
* @return {Array.<!Array.<!Array.<number>>>} Transformed rings.
*/
ol.format.EsriJSON.convertRings_ = function(rings, layout) {
_ol_format_EsriJSON_.convertRings_ = function(rings, layout) {
var flatRing = [];
var outerRings = [];
var holes = [];
var i, ii;
for (i = 0, ii = rings.length; i < ii; ++i) {
flatRing.length = 0;
ol.geom.flat.deflate.coordinates(flatRing, 0, rings[i], layout.length);
_ol_geom_flat_deflate_.coordinates(flatRing, 0, rings[i], layout.length);
// is this ring an outer ring? is it clockwise?
var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0,
var clockwise = _ol_geom_flat_orient_.linearRingIsClockwise(flatRing, 0,
flatRing.length, layout.length);
if (clockwise) {
outerRings.push([rings[i]]);
@@ -121,9 +123,9 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
// loop over all outer rings and see if they contain our hole.
for (i = outerRings.length - 1; i >= 0; i--) {
var outerRing = outerRings[i][0];
var containsHole = ol.extent.containsExtent(
new ol.geom.LinearRing(outerRing).getExtent(),
new ol.geom.LinearRing(hole).getExtent()
var containsHole = _ol_extent_.containsExtent(
new _ol_geom_LinearRing_(outerRing).getExtent(),
new _ol_geom_LinearRing_(hole).getExtent()
);
if (containsHole) {
// the hole is contained push it into our polygon
@@ -147,19 +149,19 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
* @private
* @return {ol.geom.Geometry} Point.
*/
ol.format.EsriJSON.readPointGeometry_ = function(object) {
_ol_format_EsriJSON_.readPointGeometry_ = function(object) {
var point;
if (object.m !== undefined && object.z !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.z, object.m],
ol.geom.GeometryLayout.XYZM);
point = new _ol_geom_Point_([object.x, object.y, object.z, object.m],
_ol_geom_GeometryLayout_.XYZM);
} else if (object.z !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.z],
ol.geom.GeometryLayout.XYZ);
point = new _ol_geom_Point_([object.x, object.y, object.z],
_ol_geom_GeometryLayout_.XYZ);
} else if (object.m !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.m],
ol.geom.GeometryLayout.XYM);
point = new _ol_geom_Point_([object.x, object.y, object.m],
_ol_geom_GeometryLayout_.XYM);
} else {
point = new ol.geom.Point([object.x, object.y]);
point = new _ol_geom_Point_([object.x, object.y]);
}
return point;
};
@@ -170,9 +172,9 @@ ol.format.EsriJSON.readPointGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} LineString.
*/
ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.LineString(object.paths[0], layout);
_ol_format_EsriJSON_.readLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_LineString_(object.paths[0], layout);
};
@@ -181,9 +183,9 @@ ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiLineString.
*/
ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiLineString(object.paths, layout);
_ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiLineString_(object.paths, layout);
};
@@ -192,14 +194,14 @@ ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.GeometryLayout} The geometry layout to use.
*/
ol.format.EsriJSON.getGeometryLayout_ = function(object) {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_EsriJSON_.getGeometryLayout_ = function(object) {
var layout = _ol_geom_GeometryLayout_.XY;
if (object.hasZ === true && object.hasM === true) {
layout = ol.geom.GeometryLayout.XYZM;
layout = _ol_geom_GeometryLayout_.XYZM;
} else if (object.hasZ === true) {
layout = ol.geom.GeometryLayout.XYZ;
layout = _ol_geom_GeometryLayout_.XYZ;
} else if (object.hasM === true) {
layout = ol.geom.GeometryLayout.XYM;
layout = _ol_geom_GeometryLayout_.XYM;
}
return layout;
};
@@ -210,9 +212,9 @@ ol.format.EsriJSON.getGeometryLayout_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiPoint.
*/
ol.format.EsriJSON.readMultiPointGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiPoint(object.points, layout);
_ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiPoint_(object.points, layout);
};
@@ -221,9 +223,9 @@ ol.format.EsriJSON.readMultiPointGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiPolygon.
*/
ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiPolygon(
_ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiPolygon_(
/** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings),
layout);
};
@@ -234,9 +236,9 @@ ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} Polygon.
*/
ol.format.EsriJSON.readPolygonGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.Polygon(object.rings, layout);
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_Polygon_(object.rings, layout);
};
@@ -246,36 +248,36 @@ ol.format.EsriJSON.readPolygonGeometry_ = function(object) {
* @private
* @return {EsriJSONGeometry} EsriJSON geometry.
*/
ol.format.EsriJSON.writePointGeometry_ = function(geometry, opt_options) {
_ol_format_EsriJSON_.writePointGeometry_ = function(geometry, opt_options) {
var coordinates = /** @type {ol.geom.Point} */ (geometry).getCoordinates();
var esriJSON;
var layout = /** @type {ol.geom.Point} */ (geometry).getLayout();
if (layout === ol.geom.GeometryLayout.XYZ) {
if (layout === _ol_geom_GeometryLayout_.XYZ) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
z: coordinates[2]
});
} else if (layout === ol.geom.GeometryLayout.XYM) {
} else if (layout === _ol_geom_GeometryLayout_.XYM) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
m: coordinates[2]
});
} else if (layout === ol.geom.GeometryLayout.XYZM) {
} else if (layout === _ol_geom_GeometryLayout_.XYZM) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
z: coordinates[2],
m: coordinates[3]
});
} else if (layout === ol.geom.GeometryLayout.XY) {
} else if (layout === _ol_geom_GeometryLayout_.XY) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1]
});
} else {
ol.asserts.assert(false, 34); // Invalid geometry layout
_ol_asserts_.assert(false, 34); // Invalid geometry layout
}
return /** @type {EsriJSONGeometry} */ (esriJSON);
};
@@ -286,13 +288,13 @@ ol.format.EsriJSON.writePointGeometry_ = function(geometry, opt_options) {
* @private
* @return {Object} Object with boolean hasZ and hasM keys.
*/
ol.format.EsriJSON.getHasZM_ = function(geometry) {
_ol_format_EsriJSON_.getHasZM_ = function(geometry) {
var layout = geometry.getLayout();
return {
hasZ: (layout === ol.geom.GeometryLayout.XYZ ||
layout === ol.geom.GeometryLayout.XYZM),
hasM: (layout === ol.geom.GeometryLayout.XYM ||
layout === ol.geom.GeometryLayout.XYZM)
hasZ: (layout === _ol_geom_GeometryLayout_.XYZ ||
layout === _ol_geom_GeometryLayout_.XYZM),
hasM: (layout === _ol_geom_GeometryLayout_.XYM ||
layout === _ol_geom_GeometryLayout_.XYZM)
};
};
@@ -303,8 +305,8 @@ ol.format.EsriJSON.getHasZM_ = function(geometry) {
* @private
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.LineString} */(geometry));
_ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.LineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -321,9 +323,9 @@ ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) {
_ol_format_EsriJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
// Esri geometries use the left-hand rule
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.Polygon} */(geometry));
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.Polygon} */(geometry));
return /** @type {EsriJSONPolygon} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -338,8 +340,8 @@ ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry));
_ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -354,8 +356,8 @@ ol.format.EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_option
* @private
* @return {EsriJSONMultipoint} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry));
_ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry));
return /** @type {EsriJSONMultipoint} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -370,9 +372,9 @@ ol.format.EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiPolygonGeometry_ = function(geometry,
_ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry,
opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry));
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry));
var coordinates = /** @type {ol.geom.MultiPolygon} */ (geometry).getCoordinates(false);
var output = [];
for (var i = 0; i < coordinates.length; i++) {
@@ -393,19 +395,19 @@ ol.format.EsriJSON.writeMultiPolygonGeometry_ = function(geometry,
* @private
* @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>}
*/
ol.format.EsriJSON.GEOMETRY_READERS_ = {};
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POINT] =
ol.format.EsriJSON.readPointGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.LINE_STRING] =
ol.format.EsriJSON.readLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POLYGON] =
ol.format.EsriJSON.readPolygonGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POINT] =
ol.format.EsriJSON.readMultiPointGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_LINE_STRING] =
ol.format.EsriJSON.readMultiLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POLYGON] =
ol.format.EsriJSON.readMultiPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.readPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.readLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.readPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.readMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.readMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.readMultiPolygonGeometry_;
/**
@@ -413,19 +415,19 @@ ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POLYGON] =
* @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>}
*/
ol.format.EsriJSON.GEOMETRY_WRITERS_ = {};
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POINT] =
ol.format.EsriJSON.writePointGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.LINE_STRING] =
ol.format.EsriJSON.writeLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POLYGON] =
ol.format.EsriJSON.writePolygonGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POINT] =
ol.format.EsriJSON.writeMultiPointGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_LINE_STRING] =
ol.format.EsriJSON.writeMultiLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POLYGON] =
ol.format.EsriJSON.writeMultiPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.writePointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.writeLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.writePolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.writeMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.writeMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.writeMultiPolygonGeometry_;
/**
@@ -438,7 +440,7 @@ ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POLYGON] =
* @return {ol.Feature} Feature.
* @api
*/
ol.format.EsriJSON.prototype.readFeature;
_ol_format_EsriJSON_.prototype.readFeature;
/**
@@ -451,18 +453,18 @@ ol.format.EsriJSON.prototype.readFeature;
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.EsriJSON.prototype.readFeatures;
_ol_format_EsriJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readFeatureFromObject = function(
_ol_format_EsriJSON_.prototype.readFeatureFromObject = function(
object, opt_options) {
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
var geometry = ol.format.EsriJSON.readGeometry_(esriJSONFeature.geometry,
var geometry = _ol_format_EsriJSON_.readGeometry_(esriJSONFeature.geometry,
opt_options);
var feature = new ol.Feature();
var feature = new _ol_Feature_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
}
@@ -482,7 +484,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readFeaturesFromObject = function(
_ol_format_EsriJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object);
var options = opt_options ? opt_options : {};
@@ -514,15 +516,15 @@ ol.format.EsriJSON.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.EsriJSON.prototype.readGeometry;
_ol_format_EsriJSON_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readGeometryFromObject = function(
_ol_format_EsriJSON_.prototype.readGeometryFromObject = function(
object, opt_options) {
return ol.format.EsriJSON.readGeometry_(
return _ol_format_EsriJSON_.readGeometry_(
/** @type {EsriJSONGeometry} */(object), opt_options);
};
@@ -535,17 +537,17 @@ ol.format.EsriJSON.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.EsriJSON.prototype.readProjection;
_ol_format_EsriJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object);
if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) {
var crs = esriJSONObject.spatialReference.wkid;
return ol.proj.get('EPSG:' + crs);
return _ol_proj_.get('EPSG:' + crs);
} else {
return null;
}
@@ -558,10 +560,10 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
* @private
* @return {EsriJSONGeometry} EsriJSON geometry.
*/
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
_ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_EsriJSON_.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */(
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)),
opt_options);
};
@@ -575,7 +577,7 @@ ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeGeometry;
_ol_format_EsriJSON_.prototype.writeGeometry;
/**
@@ -587,9 +589,9 @@ ol.format.EsriJSON.prototype.writeGeometry;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeGeometryObject = function(geometry,
_ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry,
opt_options) {
return ol.format.EsriJSON.writeGeometry_(geometry,
return _ol_format_EsriJSON_.writeGeometry_(geometry,
this.adaptOptions(opt_options));
};
@@ -603,7 +605,7 @@ ol.format.EsriJSON.prototype.writeGeometryObject = function(geometry,
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeFeature;
_ol_format_EsriJSON_.prototype.writeFeature;
/**
@@ -615,24 +617,24 @@ ol.format.EsriJSON.prototype.writeFeature;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeFeatureObject = function(
_ol_format_EsriJSON_.prototype.writeFeatureObject = function(
feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
var object = {};
var geometry = feature.getGeometry();
if (geometry) {
object['geometry'] =
ol.format.EsriJSON.writeGeometry_(geometry, opt_options);
_ol_format_EsriJSON_.writeGeometry_(geometry, opt_options);
if (opt_options && opt_options.featureProjection) {
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
wkid: ol.proj.get(
wkid: _ol_proj_.get(
opt_options.featureProjection).getCode().split(':').pop()
});
}
}
var properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!ol.obj.isEmpty(properties)) {
if (!_ol_obj_.isEmpty(properties)) {
object['attributes'] = properties;
} else {
object['attributes'] = {};
@@ -650,7 +652,7 @@ ol.format.EsriJSON.prototype.writeFeatureObject = function(
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeFeatures;
_ol_format_EsriJSON_.prototype.writeFeatures;
/**
@@ -662,7 +664,7 @@ ol.format.EsriJSON.prototype.writeFeatures;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
_ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var objects = [];
var i, ii;
@@ -673,3 +675,4 @@ ol.format.EsriJSON.prototype.writeFeaturesObject = function(features, opt_option
'features': objects
});
};
export default _ol_format_EsriJSON_;
+26 -25
View File
@@ -1,9 +1,9 @@
goog.provide('ol.format.Feature');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj');
/**
* @module ol/format/Feature
*/
import _ol_geom_Geometry_ from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -18,7 +18,7 @@ goog.require('ol.proj');
* @abstract
* @api
*/
ol.format.Feature = function() {
var _ol_format_Feature_ = function() {
/**
* @protected
@@ -42,7 +42,7 @@ ol.format.Feature = function() {
* @return {olx.format.ReadOptions|undefined} Options.
* @protected
*/
ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
_ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) {
var options;
if (opt_options) {
options = {
@@ -64,8 +64,8 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
* @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined}
* Updated options.
*/
ol.format.Feature.prototype.adaptOptions = function(options) {
return ol.obj.assign({
_ol_format_Feature_.prototype.adaptOptions = function(options) {
return _ol_obj_.assign({
dataProjection: this.defaultDataProjection,
featureProjection: this.defaultFeatureProjection
}, options);
@@ -76,7 +76,7 @@ ol.format.Feature.prototype.adaptOptions = function(options) {
* Get the extent from the source of the last {@link readFeatures} call.
* @return {ol.Extent} Tile extent.
*/
ol.format.Feature.prototype.getLastExtent = function() {
_ol_format_Feature_.prototype.getLastExtent = function() {
return null;
};
@@ -85,7 +85,7 @@ ol.format.Feature.prototype.getLastExtent = function() {
* @abstract
* @return {ol.format.FormatType} Format.
*/
ol.format.Feature.prototype.getType = function() {};
_ol_format_Feature_.prototype.getType = function() {};
/**
@@ -96,7 +96,7 @@ ol.format.Feature.prototype.getType = function() {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature.
*/
ol.format.Feature.prototype.readFeature = function(source, opt_options) {};
_ol_format_Feature_.prototype.readFeature = function(source, opt_options) {};
/**
@@ -107,7 +107,7 @@ ol.format.Feature.prototype.readFeature = function(source, opt_options) {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.Feature.prototype.readFeatures = function(source, opt_options) {};
_ol_format_Feature_.prototype.readFeatures = function(source, opt_options) {};
/**
@@ -118,7 +118,7 @@ ol.format.Feature.prototype.readFeatures = function(source, opt_options) {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Feature.prototype.readGeometry = function(source, opt_options) {};
_ol_format_Feature_.prototype.readGeometry = function(source, opt_options) {};
/**
@@ -128,7 +128,7 @@ ol.format.Feature.prototype.readGeometry = function(source, opt_options) {};
* @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.Feature.prototype.readProjection = function(source) {};
_ol_format_Feature_.prototype.readProjection = function(source) {};
/**
@@ -139,7 +139,7 @@ ol.format.Feature.prototype.readProjection = function(source) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeature = function(feature, opt_options) {};
_ol_format_Feature_.prototype.writeFeature = function(feature, opt_options) {};
/**
@@ -150,7 +150,7 @@ ol.format.Feature.prototype.writeFeature = function(feature, opt_options) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeatures = function(features, opt_options) {};
_ol_format_Feature_.prototype.writeFeatures = function(features, opt_options) {};
/**
@@ -161,7 +161,7 @@ ol.format.Feature.prototype.writeFeatures = function(features, opt_options) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
_ol_format_Feature_.prototype.writeGeometry = function(geometry, opt_options) {};
/**
@@ -172,26 +172,26 @@ ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
* @return {ol.geom.Geometry|ol.Extent} Transformed geometry.
* @protected
*/
ol.format.Feature.transformWithOptions = function(
_ol_format_Feature_.transformWithOptions = function(
geometry, write, opt_options) {
var featureProjection = opt_options ?
ol.proj.get(opt_options.featureProjection) : null;
_ol_proj_.get(opt_options.featureProjection) : null;
var dataProjection = opt_options ?
ol.proj.get(opt_options.dataProjection) : null;
_ol_proj_.get(opt_options.dataProjection) : null;
/**
* @type {ol.geom.Geometry|ol.Extent}
*/
var transformed;
if (featureProjection && dataProjection &&
!ol.proj.equivalent(featureProjection, dataProjection)) {
if (geometry instanceof ol.geom.Geometry) {
!_ol_proj_.equivalent(featureProjection, dataProjection)) {
if (geometry instanceof _ol_geom_Geometry_) {
transformed = (write ? geometry.clone() : geometry).transform(
write ? featureProjection : dataProjection,
write ? dataProjection : featureProjection);
} else {
// FIXME this is necessary because ol.format.GML treats extents
// as geometries
transformed = ol.proj.transformExtent(
transformed = _ol_proj_.transformExtent(
geometry,
dataProjection,
featureProjection);
@@ -219,3 +219,4 @@ ol.format.Feature.transformWithOptions = function(
}
return transformed;
};
export default _ol_format_Feature_;
+6 -4
View File
@@ -1,12 +1,14 @@
goog.provide('ol.format.FormatType');
/**
* @module ol/format/FormatType
*/
/**
* @enum {string}
*/
ol.format.FormatType = {
var _ol_format_FormatType_ = {
ARRAY_BUFFER: 'arraybuffer',
JSON: 'json',
TEXT: 'text',
XML: 'xml'
};
export default _ol_format_FormatType_;
+8 -7
View File
@@ -1,7 +1,7 @@
goog.provide('ol.format.GML');
goog.require('ol.format.GML3');
/**
* @module ol/format/GML
*/
import _ol_format_GML3_ from '../format/GML3.js';
/**
* @classdesc
@@ -15,7 +15,7 @@ goog.require('ol.format.GML3');
* @extends {ol.format.GMLBase}
* @api
*/
ol.format.GML = ol.format.GML3;
var _ol_format_GML_ = _ol_format_GML3_;
/**
@@ -27,7 +27,7 @@ ol.format.GML = ol.format.GML3;
* @return {string} Result.
* @api
*/
ol.format.GML.prototype.writeFeatures;
_ol_format_GML_.prototype.writeFeatures;
/**
@@ -39,4 +39,5 @@ ol.format.GML.prototype.writeFeatures;
* @return {Node} Node.
* @api
*/
ol.format.GML.prototype.writeFeaturesNode;
_ol_format_GML_.prototype.writeFeaturesNode;
export default _ol_format_GML_;
+158 -156
View File
@@ -1,15 +1,15 @@
goog.provide('ol.format.GML2');
goog.require('ol');
goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @module ol/format/GML2
*/
import _ol_ from '../index.js';
import _ol_extent_ from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_geom_Geometry_ from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -21,24 +21,25 @@ goog.require('ol.xml');
* @extends {ol.format.GMLBase}
* @api
*/
ol.format.GML2 = function(opt_options) {
var _ol_format_GML2_ = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {});
ol.format.GMLBase.call(this, options);
_ol_format_GMLBase_.call(this, options);
this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][
this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS][
'featureMember'] =
ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readFeaturesInternal);
_ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal);
/**
* @inheritDoc
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML2.schemaLocation_;
options.schemaLocation : _ol_format_GML2_.schemaLocation_;
};
ol.inherits(ol.format.GML2, ol.format.GMLBase);
_ol_.inherits(_ol_format_GML2_, _ol_format_GMLBase_);
/**
@@ -46,7 +47,7 @@ ol.inherits(ol.format.GML2, ol.format.GMLBase);
* @type {string}
* @private
*/
ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS +
_ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
@@ -56,13 +57,13 @@ ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS +
* @private
* @return {Array.<number>|undefined} Flat coordinates.
*/
ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
_ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName'];
var axisOrientation = 'enu';
if (containerSrs) {
var proj = ol.proj.get(containerSrs);
var proj = _ol_proj_.get(containerSrs);
if (proj) {
axisOrientation = proj.getAxisOrientation();
}
@@ -91,11 +92,11 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
* @private
* @return {ol.Extent|undefined} Envelope.
*/
ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
_ol_format_GML2_.prototype.readBox_ = function(node, objectStack) {
/** @type {Array.<number>} */
var flatCoordinates = ol.xml.pushParseAndPop([null],
var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this);
return ol.extent.createOrUpdate(flatCoordinates[1][0],
return _ol_extent_.createOrUpdate(flatCoordinates[1][0],
flatCoordinates[1][1], flatCoordinates[1][3],
flatCoordinates[1][4]);
};
@@ -106,9 +107,9 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
_ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
@@ -123,9 +124,9 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
_ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
@@ -140,10 +141,10 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
_ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml': {
'coordinates': ol.xml.makeReplacer(
ol.format.GML2.prototype.readFlatCoordinates_)
'coordinates': _ol_xml_.makeReplacer(
_ol_format_GML2_.prototype.readFlatCoordinates_)
}
};
@@ -153,10 +154,10 @@ ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
_ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml': {
'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_
'innerBoundaryIs': _ol_format_GML2_.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': _ol_format_GML2_.prototype.outerBoundaryIsParser_
}
};
@@ -166,10 +167,10 @@ ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.BOX_PARSERS_ = {
_ol_format_GML2_.prototype.BOX_PARSERS_ = {
'http://www.opengis.net/gml': {
'coordinates': ol.xml.makeArrayPusher(
ol.format.GML2.prototype.readFlatCoordinates_)
'coordinates': _ol_xml_.makeArrayPusher(
_ol_format_GML2_.prototype.readFlatCoordinates_)
}
};
@@ -179,21 +180,21 @@ ol.format.GML2.prototype.BOX_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
_ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml': {
'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint),
'MultiPoint': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPoint),
'LineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLineString),
'MultiLineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiLineString),
'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLinearRing),
'Polygon': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPolygon),
'MultiPolygon': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPolygon),
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_)
'Point': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPoint),
'MultiPoint': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPoint),
'LineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLineString),
'MultiLineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiLineString),
'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLinearRing),
'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon),
'MultiPolygon': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPolygon),
'Box': _ol_xml_.makeReplacer(_ol_format_GML2_.prototype.readBox_)
}
};
@@ -206,7 +207,7 @@ ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface'];
var surface = context['surface'];
@@ -224,7 +225,7 @@ ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
} else {
nodeName = 'Envelope';
}
return ol.xml.createElementNS('http://www.opengis.net/gml',
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
nodeName);
};
@@ -234,7 +235,7 @@ ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
* @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
_ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectStack) {
var fid = feature.getId();
if (fid) {
node.setAttribute('fid', fid);
@@ -253,24 +254,24 @@ ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectSta
if (value !== null) {
keys.push(key);
values.push(value);
if (key == geometryName || value instanceof ol.geom.Geometry) {
if (key == geometryName || value instanceof _ol_geom_Geometry_) {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
this.writeGeometryElement, this);
}
} else {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
ol.format.XSD.writeStringTextNode);
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeStringTextNode);
}
}
}
}
var item = ol.obj.assign({}, context);
var item = _ol_obj_.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
ol.xml.makeSimpleNodeFactory(undefined, featureNS),
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
values,
objectStack, keys);
};
@@ -281,24 +282,24 @@ ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectSta
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = ol.obj.assign({}, context);
var item = _ol_obj_.assign({}, context);
item.node = node;
var value;
if (Array.isArray(geometry)) {
if (context.dataProjection) {
value = ol.proj.transformExtent(
value = _ol_proj_.transformExtent(
geometry, context.featureProjection, context.dataProjection);
} else {
value = geometry;
}
} else {
value =
ol.format.Feature.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
_ol_format_Feature_.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), ol.format.GML2.GEOMETRY_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), _ol_format_GML2_.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this);
};
@@ -310,7 +311,7 @@ ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectS
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -322,7 +323,7 @@ ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, obje
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
} else if (node.nodeName === 'Curve') {
var segments = ol.xml.createElementNS(node.namespaceURI, 'segments');
var segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
node.appendChild(segments);
this.writeCurveSegments_(segments,
geometry, objectStack);
@@ -335,8 +336,8 @@ ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, obje
* @returns {Node} coordinates node.
* @private
*/
ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = ol.xml.createElementNS(namespaceURI, 'coordinates');
_ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ',');
coordinates.setAttribute('ts', ' ');
@@ -351,7 +352,7 @@ ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
_ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -364,7 +365,7 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ);
}
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
_ol_format_XSD_.writeStringTextNode(node, parts.join(' '));
};
@@ -374,8 +375,8 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI,
_ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI,
'LineStringSegment');
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
@@ -388,7 +389,7 @@ ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -397,13 +398,13 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
}
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
_ol_xml_.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.RING_SERIALIZERS_,
_ol_format_GML2_.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') {
var patches = ol.xml.createElementNS(node.namespaceURI, 'patches');
var patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
node.appendChild(patches);
this.writeSurfacePatches_(
patches, geometry, objectStack);
@@ -418,14 +419,14 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
* @return {Node} Node.
* @private
*/
ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var exteriorWritten = context['exteriorWritten'];
if (exteriorWritten === undefined) {
context['exteriorWritten'] = true;
}
return ol.xml.createElementNS(parentNode.namespaceURI,
return _ol_xml_.createElementNS(parentNode.namespaceURI,
exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
};
@@ -436,8 +437,8 @@ ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_n
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch');
_ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
};
@@ -449,8 +450,8 @@ ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectSt
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = ol.xml.createElementNS(node.namespaceURI, 'LinearRing');
_ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack);
};
@@ -463,10 +464,10 @@ ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
* @return {string} The coords string.
* @private
*/
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
axisOrientation = _ol_proj_.get(opt_srsName).getAxisOrientation();
}
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
@@ -487,7 +488,7 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -496,8 +497,8 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this);
};
@@ -509,7 +510,7 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -520,7 +521,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
node.appendChild(coordinates);
var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName, hasZ);
ol.format.XSD.writeStringTextNode(coordinates, coord);
_ol_format_XSD_.writeStringTextNode(coordinates, coord);
};
@@ -530,7 +531,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
_ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
@@ -539,9 +540,9 @@ ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
};
@@ -552,8 +553,8 @@ ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'Point');
_ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child);
this.writePoint_(child, point, objectStack);
};
@@ -565,7 +566,7 @@ ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) {
node.appendChild(child);
@@ -580,7 +581,7 @@ ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, ob
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
@@ -598,7 +599,7 @@ ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -607,8 +608,8 @@ ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this);
};
@@ -620,7 +621,7 @@ ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack);
if (child) {
@@ -636,7 +637,7 @@ ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
_ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
@@ -644,9 +645,9 @@ ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
}
var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), ol.format.GML2.ENVELOPE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), _ol_format_GML2_.ENVELOPE_SERIALIZERS_,
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values,
objectStack, keys, this);
};
@@ -657,31 +658,31 @@ ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
_ol_format_GML2_.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'Curve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiCurve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'Point': ol.xml.makeChildAppender(ol.format.GML2.prototype.writePoint_),
'MultiPoint': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiPoint_),
'LineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiLineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLinearRing_),
'Polygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeEnvelope)
'Curve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_),
'MultiCurve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_),
'Point': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writePoint_),
'MultiPoint': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiPoint_),
'LineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_),
'MultiLineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_),
'LinearRing': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLinearRing_),
'Polygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_),
'Surface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_),
'MultiSurface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeEnvelope)
}
};
@@ -690,10 +691,10 @@ ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.RING_SERIALIZERS_ = {
_ol_format_GML2_.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'outerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_),
'innerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_)
'outerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_),
'innerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_)
}
};
@@ -702,10 +703,10 @@ ol.format.GML2.RING_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writePointMember_)
'pointMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writePointMember_)
}
};
@@ -714,12 +715,12 @@ ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_)
'lineStringMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_),
'curveMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_)
}
};
@@ -732,10 +733,10 @@ ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS('http://www.opengis.net/gml',
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
};
/**
@@ -743,7 +744,7 @@ ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, ob
* @type {Object.<string, string>}
* @private
*/
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember',
@@ -756,12 +757,12 @@ ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'surfaceMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_)
'surfaceMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_)
}
};
@@ -770,9 +771,10 @@ ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.ENVELOPE_SERIALIZERS_ = {
_ol_format_GML2_.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lowerCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'upperCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode)
}
};
export default _ol_format_GML2_;
+247 -245
View File
File diff suppressed because it is too large Load Diff
+114 -111
View File
@@ -1,25 +1,25 @@
/**
* @module ol/format/GMLBase
*/
// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part
// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect
// envelopes/extents, only geometries!
goog.provide('ol.format.GMLBase');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -36,7 +36,7 @@ goog.require('ol.xml');
* Optional configuration object.
* @extends {ol.format.XMLFeature}
*/
ol.format.GMLBase = function(opt_options) {
var _ol_format_GMLBase_ = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {});
@@ -68,23 +68,24 @@ ol.format.GMLBase = function(opt_options) {
* @type {Object.<string, Object.<string, Object>>}
*/
this.FEATURE_COLLECTION_PARSERS = {};
this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS] = {
'featureMember': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFeaturesInternal),
'featureMembers': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFeaturesInternal)
this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS] = {
'featureMember': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFeaturesInternal),
'featureMembers': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFeaturesInternal)
};
ol.format.XMLFeature.call(this);
_ol_format_XMLFeature_.call(this);
};
ol.inherits(ol.format.GMLBase, ol.format.XMLFeature);
_ol_.inherits(_ol_format_GMLBase_, _ol_format_XMLFeature_);
/**
* @const
* @type {string}
*/
ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
_ol_format_GMLBase_.GMLNS = 'http://www.opengis.net/gml';
/**
@@ -99,7 +100,7 @@ ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
* @type {RegExp}
* @private
*/
ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
_ol_format_GMLBase_.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
/**
@@ -107,16 +108,16 @@ ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature> | undefined} Features.
*/
ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack) {
var localName = node.localName;
var features = null;
if (localName == 'FeatureCollection') {
if (node.namespaceURI === 'http://www.opengis.net/wfs') {
features = ol.xml.pushParseAndPop([],
features = _ol_xml_.pushParseAndPop([],
this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this);
} else {
features = ol.xml.pushParseAndPop(null,
features = _ol_xml_.pushParseAndPop(null,
this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this);
}
@@ -171,16 +172,16 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
if (featurePrefix === p) {
parsers[featureTypes[i].split(':').pop()] =
(localName == 'featureMembers') ?
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this);
_ol_xml_.makeArrayPusher(this.readFeatureElement, this) :
_ol_xml_.makeReplacer(this.readFeatureElement, this);
}
}
parsersNS[featureNS[p]] = parsers;
}
if (localName == 'featureMember') {
features = ol.xml.pushParseAndPop(undefined, parsersNS, node, objectStack);
features = _ol_xml_.pushParseAndPop(undefined, parsersNS, node, objectStack);
} else {
features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack);
features = _ol_xml_.pushParseAndPop([], parsersNS, node, objectStack);
}
}
if (features === null) {
@@ -195,16 +196,17 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Geometry|undefined} Geometry.
*/
ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack) {
var context = /** @type {Object} */ (objectStack[0]);
context['srsName'] = node.firstElementChild.getAttribute('srsName');
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
/** @type {ol.geom.Geometry} */
var geometry = ol.xml.pushParseAndPop(null,
var geometry = _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_PARSERS_, node, objectStack, this);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, context)
);
} else {
return undefined;
}
@@ -216,10 +218,10 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.Feature} Feature.
*/
ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) {
var n;
var fid = node.getAttribute('fid') ||
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
_ol_xml_.getAttributeNS(node, _ol_format_GMLBase_.GMLNS, 'id');
var values = {}, geometryName;
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
@@ -229,8 +231,8 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
if (n.childNodes.length === 0 ||
(n.childNodes.length === 1 &&
(n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
var value = ol.xml.getAllTextContent(n, false);
if (ol.format.GMLBase.ONLY_WHITESPACE_RE_.test(value)) {
var value = _ol_xml_.getAllTextContent(n, false);
if (_ol_format_GMLBase_.ONLY_WHITESPACE_RE_.test(value)) {
value = undefined;
}
values[localName] = value;
@@ -242,7 +244,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
values[localName] = this.readGeometryElement(n, objectStack);
}
}
var feature = new ol.Feature(values);
var feature = new _ol_Feature_(values);
if (geometryName) {
feature.setGeometryName(geometryName);
}
@@ -258,12 +260,12 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Point|undefined} Point.
*/
ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var point = new ol.geom.Point(null);
point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var point = new _ol_geom_Point_(null);
point.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return point;
}
};
@@ -274,12 +276,12 @@ ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPoint|undefined} MultiPoint.
*/
ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */
var coordinates = ol.xml.pushParseAndPop([],
var coordinates = _ol_xml_.pushParseAndPop([],
this.MULTIPOINT_PARSERS_, node, objectStack, this);
if (coordinates) {
return new ol.geom.MultiPoint(coordinates);
return new _ol_geom_MultiPoint_(coordinates);
} else {
return undefined;
}
@@ -291,12 +293,12 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiLineString|undefined} MultiLineString.
*/
ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack) {
/** @type {Array.<ol.geom.LineString>} */
var lineStrings = ol.xml.pushParseAndPop([],
var lineStrings = _ol_xml_.pushParseAndPop([],
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
if (lineStrings) {
var multiLineString = new ol.geom.MultiLineString(null);
var multiLineString = new _ol_geom_MultiLineString_(null);
multiLineString.setLineStrings(lineStrings);
return multiLineString;
} else {
@@ -310,12 +312,12 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPolygon|undefined} MultiPolygon.
*/
ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) {
/** @type {Array.<ol.geom.Polygon>} */
var polygons = ol.xml.pushParseAndPop([],
var polygons = _ol_xml_.pushParseAndPop([],
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (polygons) {
var multiPolygon = new ol.geom.MultiPolygon(null);
var multiPolygon = new _ol_geom_MultiPolygon_(null);
multiPolygon.setPolygons(polygons);
return multiPolygon;
} else {
@@ -329,8 +331,8 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.POINTMEMBER_PARSERS_,
_ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -340,8 +342,8 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_,
_ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -351,8 +353,8 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node,
_ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this);
};
@@ -362,12 +364,12 @@ ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LineString|undefined} LineString.
*/
ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var lineString = new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var lineString = new _ol_geom_LineString_(null);
lineString.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return lineString;
} else {
return undefined;
@@ -381,8 +383,8 @@ ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
* @private
* @return {Array.<number>|undefined} LinearRing flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
var ring = ol.xml.pushParseAndPop(null,
_ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack) {
var ring = _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
if (ring) {
@@ -398,12 +400,12 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LinearRing|undefined} LinearRing.
*/
ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var ring = new ol.geom.LinearRing(null);
ring.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var ring = new _ol_geom_LinearRing_(null);
ring.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return ring;
} else {
return undefined;
@@ -416,21 +418,21 @@ ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Polygon|undefined} Polygon.
*/
ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */
var flatLinearRings = ol.xml.pushParseAndPop([null],
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
if (flatLinearRings && flatLinearRings[0]) {
var polygon = new ol.geom.Polygon(null);
var polygon = new _ol_geom_Polygon_(null);
var flatCoordinates = flatLinearRings[0];
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
ol.array.extend(flatCoordinates, flatLinearRings[i]);
_ol_array_.extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
ol.geom.GeometryLayout.XYZ, flatCoordinates, ends);
_ol_geom_GeometryLayout_.XYZ, flatCoordinates, ends);
return polygon;
} else {
return undefined;
@@ -444,8 +446,8 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(null,
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
};
@@ -456,12 +458,12 @@ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, object
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_),
'pointMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_)
'pointMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_),
'pointMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_)
}
};
@@ -471,12 +473,12 @@ ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_)
'lineStringMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_),
'lineStringMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_)
}
};
@@ -486,12 +488,12 @@ ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = {
'http://www.opengis.net/gml': {
'polygonMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_),
'polygonMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_)
'polygonMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_),
'polygonMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_)
}
};
@@ -501,10 +503,10 @@ ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Point': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_)
'Point': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_)
}
};
@@ -514,10 +516,10 @@ ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'LineString': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readLineString)
'LineString': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readLineString)
}
};
@@ -527,10 +529,10 @@ ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Polygon': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readPolygon)
'Polygon': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readPolygon)
}
};
@@ -540,10 +542,10 @@ ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @protected
*/
ol.format.GMLBase.prototype.RING_PARSERS = {
_ol_format_GMLBase_.prototype.RING_PARSERS = {
'http://www.opengis.net/gml': {
'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFlatLinearRing_)
'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFlatLinearRing_)
}
};
@@ -551,7 +553,7 @@ ol.format.GMLBase.prototype.RING_PARSERS = {
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
_ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options) {
var geometry = this.readGeometryElement(node,
[this.getReadOptions(node, opt_options ? opt_options : {})]);
return geometry ? geometry : null;
@@ -567,19 +569,19 @@ ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GMLBase.prototype.readFeatures;
_ol_format_GMLBase_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = {
featureType: this.featureType,
featureNS: this.featureNS
};
if (opt_options) {
ol.obj.assign(options, this.getReadOptions(node, opt_options));
_ol_obj_.assign(options, this.getReadOptions(node, opt_options));
}
var features = this.readFeaturesInternal(node, [options]);
return features || [];
@@ -589,7 +591,8 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
return ol.proj.get(this.srsName ? this.srsName :
_ol_format_GMLBase_.prototype.readProjectionFromNode = function(node) {
return _ol_proj_.get(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName'));
};
export default _ol_format_GMLBase_;
+258 -256
View File
@@ -1,18 +1,18 @@
goog.provide('ol.format.GPX');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.array');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.Point');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @module ol/format/GPX
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_array_ from '../array.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -23,16 +23,16 @@ goog.require('ol.xml');
* @param {olx.format.GPXOptions=} opt_options Options.
* @api
*/
ol.format.GPX = function(opt_options) {
var _ol_format_GPX_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.XMLFeature.call(this);
_ol_format_XMLFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @type {function(ol.Feature, Node)|undefined}
@@ -40,7 +40,8 @@ ol.format.GPX = function(opt_options) {
*/
this.readExtensions_ = options.readExtensions;
};
ol.inherits(ol.format.GPX, ol.format.XMLFeature);
_ol_.inherits(_ol_format_GPX_, _ol_format_XMLFeature_);
/**
@@ -48,7 +49,7 @@ ol.inherits(ol.format.GPX, ol.format.XMLFeature);
* @private
* @type {Array.<string>}
*/
ol.format.GPX.NAMESPACE_URIS_ = [
_ol_format_GPX_.NAMESPACE_URIS_ = [
null,
'http://www.topografix.com/GPX/1/0',
'http://www.topografix.com/GPX/1/1'
@@ -60,7 +61,7 @@ ol.format.GPX.NAMESPACE_URIS_ = [
* @type {string}
* @private
*/
ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
_ol_format_GPX_.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
'http://www.topografix.com/GPX/1/1/gpx.xsd';
@@ -72,7 +73,7 @@ ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
_ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
flatCoordinates.push(
parseFloat(node.getAttribute('lon')),
parseFloat(node.getAttribute('lat')));
@@ -103,17 +104,17 @@ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node,
* @param {Array.<number>=} ends Ends.
* @return {ol.geom.GeometryLayout} Layout.
*/
ol.format.GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = _ol_geom_GeometryLayout_.XY;
var stride = 2;
if (layoutOptions.hasZ && layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYZM;
layout = _ol_geom_GeometryLayout_.XYZM;
stride = 4;
} else if (layoutOptions.hasZ) {
layout = ol.geom.GeometryLayout.XYZ;
layout = _ol_geom_GeometryLayout_.XYZ;
stride = 3;
} else if (layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYM;
layout = _ol_geom_GeometryLayout_.XYM;
stride = 3;
}
if (stride !== 4) {
@@ -144,13 +145,13 @@ ol.format.GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, end
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseLink_ = function(node, objectStack) {
_ol_format_GPX_.parseLink_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var href = node.getAttribute('href');
if (href !== null) {
values['link'] = href;
}
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
_ol_xml_.parseNode(_ol_format_GPX_.LINK_PARSERS_, node, objectStack);
};
@@ -159,7 +160,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseExtensions_ = function(node, objectStack) {
_ol_format_GPX_.parseExtensions_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values['extensionsNode_'] = node;
};
@@ -170,16 +171,16 @@ ol.format.GPX.parseExtensions_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseRtePt_ = function(node, objectStack) {
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.RTEPT_PARSERS_, node, objectStack);
_ol_format_GPX_.parseRtePt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.RTEPT_PARSERS_, node, objectStack);
if (values) {
var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(rteValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */
(rteValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
_ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -189,16 +190,16 @@ ol.format.GPX.parseRtePt_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseTrkPt_ = function(node, objectStack) {
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.TRKPT_PARSERS_, node, objectStack);
_ol_format_GPX_.parseTrkPt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.TRKPT_PARSERS_, node, objectStack);
if (values) {
var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(trkValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */
(trkValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
_ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -208,9 +209,9 @@ ol.format.GPX.parseTrkPt_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
_ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
_ol_xml_.parseNode(_ol_format_GPX_.TRKSEG_PARSERS_, node, objectStack);
var flatCoordinates = /** @type {Array.<number>} */
(values['flatCoordinates']);
var ends = /** @type {Array.<number>} */ (values['ends']);
@@ -224,12 +225,12 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Track.
*/
ol.format.GPX.readRte_ = function(node, objectStack) {
_ol_format_GPX_.readRte_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [],
'layoutOptions': {}
}, ol.format.GPX.RTE_PARSERS_, node, objectStack);
}, _ol_format_GPX_.RTE_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
@@ -238,11 +239,11 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
delete values['flatCoordinates'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new ol.geom.LineString(null);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new _ol_geom_LineString_(null);
geometry.setFlatCoordinates(layout, flatCoordinates);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -254,13 +255,13 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Track.
*/
ol.format.GPX.readTrk_ = function(node, objectStack) {
_ol_format_GPX_.readTrk_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [],
'ends': [],
'layoutOptions': {}
}, ol.format.GPX.TRK_PARSERS_, node, objectStack);
}, _ol_format_GPX_.TRK_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
@@ -271,11 +272,11 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
delete values['ends'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates, ends);
var geometry = new ol.geom.MultiLineString(null);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates, ends);
var geometry = new _ol_geom_MultiLineString_(null);
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -287,19 +288,19 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Waypoint.
*/
ol.format.GPX.readWpt_ = function(node, objectStack) {
_ol_format_GPX_.readWpt_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.WPT_PARSERS_, node, objectStack);
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.WPT_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
var layoutOptions = /** @type {ol.LayoutOptions} */ ({});
var coordinates = ol.format.GPX.appendCoordinate_([], layoutOptions, node, values);
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new ol.geom.Point(coordinates, layout);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
var coordinates = _ol_format_GPX_.appendCoordinate_([], layoutOptions, node, values);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new _ol_geom_Point_(coordinates, layout);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -310,10 +311,10 @@ ol.format.GPX.readWpt_ = function(node, objectStack) {
* @type {Object.<string, function(Node, Array.<*>): (ol.Feature|undefined)>}
* @private
*/
ol.format.GPX.FEATURE_READER_ = {
'rte': ol.format.GPX.readRte_,
'trk': ol.format.GPX.readTrk_,
'wpt': ol.format.GPX.readWpt_
_ol_format_GPX_.FEATURE_READER_ = {
'rte': _ol_format_GPX_.readRte_,
'trk': _ol_format_GPX_.readTrk_,
'wpt': _ol_format_GPX_.readWpt_
};
@@ -322,11 +323,11 @@ ol.format.GPX.FEATURE_READER_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'rte': ol.xml.makeArrayPusher(ol.format.GPX.readRte_),
'trk': ol.xml.makeArrayPusher(ol.format.GPX.readTrk_),
'wpt': ol.xml.makeArrayPusher(ol.format.GPX.readWpt_)
_ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readRte_),
'trk': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readTrk_),
'wpt': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readWpt_)
});
@@ -335,12 +336,12 @@ ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
_ol_format_GPX_.LINK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'text':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkText'),
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkText'),
'type':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkType')
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkType')
});
@@ -349,18 +350,18 @@ ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
_ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'number':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'extensions': ol.format.GPX.parseExtensions_,
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'rtept': ol.format.GPX.parseRtePt_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_,
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'rtept': _ol_format_GPX_.parseRtePt_
});
@@ -369,10 +370,10 @@ ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime)
_ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime)
});
@@ -381,18 +382,18 @@ ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
_ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'number':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'extensions': ol.format.GPX.parseExtensions_,
'trkseg': ol.format.GPX.parseTrkSeg_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'extensions': _ol_format_GPX_.parseExtensions_,
'trkseg': _ol_format_GPX_.parseTrkSeg_
});
@@ -401,9 +402,9 @@ ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'trkpt': ol.format.GPX.parseTrkPt_
_ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'trkpt': _ol_format_GPX_.parseTrkPt_
});
@@ -412,10 +413,10 @@ ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime)
_ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime)
});
@@ -424,30 +425,30 @@ ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime),
'magvar': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'geoidheight': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
'sym': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'fix': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'sat': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'hdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'vdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'pdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
_ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime),
'magvar': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'geoidheight': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'sym': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'fix': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'sat': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'hdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'vdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'pdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'ageofdgpsdata':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'dgpsid':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'extensions': ol.format.GPX.parseExtensions_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_
});
@@ -455,7 +456,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
* @param {Array.<ol.Feature>} features List of features.
* @private
*/
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
_ol_format_GPX_.prototype.handleReadExtensions_ = function(features) {
if (!features) {
features = [];
}
@@ -481,17 +482,17 @@ ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.GPX.prototype.readFeature;
_ol_format_GPX_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) {
if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) {
_ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) {
return null;
}
var featureReader = ol.format.GPX.FEATURE_READER_[node.localName];
var featureReader = _ol_format_GPX_.FEATURE_READER_[node.localName];
if (!featureReader) {
return null;
}
@@ -515,19 +516,19 @@ ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GPX.prototype.readFeatures;
_ol_format_GPX_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) {
_ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) {
return [];
}
if (node.localName == 'gpx') {
/** @type {Array.<ol.Feature>} */
var features = ol.xml.pushParseAndPop([], ol.format.GPX.GPX_PARSERS_,
var features = _ol_xml_.pushParseAndPop([], _ol_format_GPX_.GPX_PARSERS_,
node, [this.getReadOptions(node, opt_options)]);
if (features) {
this.handleReadExtensions_(features);
@@ -548,7 +549,7 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.GPX.prototype.readProjection;
_ol_format_GPX_.prototype.readProjection;
/**
@@ -557,7 +558,7 @@ ol.format.GPX.prototype.readProjection;
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GPX.writeLink_ = function(node, value, objectStack) {
_ol_format_GPX_.writeLink_ = function(node, value, objectStack) {
node.setAttribute('href', value);
var context = objectStack[objectStack.length - 1];
var properties = context['properties'];
@@ -565,9 +566,9 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) {
properties['linkText'],
properties['linkType']
];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
ol.format.GPX.LINK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, ol.format.GPX.LINK_SEQUENCE_);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
_ol_format_GPX_.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, _ol_format_GPX_.LINK_SEQUENCE_);
};
@@ -577,27 +578,27 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
_ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var namespaceURI = parentNode.namespaceURI;
var properties = context['properties'];
//FIXME Projection handling
ol.xml.setAttributeNS(node, null, 'lat', coordinate[1]);
ol.xml.setAttributeNS(node, null, 'lon', coordinate[0]);
_ol_xml_.setAttributeNS(node, null, 'lat', coordinate[1]);
_ol_xml_.setAttributeNS(node, null, 'lon', coordinate[0]);
var geometryLayout = context['geometryLayout'];
switch (geometryLayout) {
case ol.geom.GeometryLayout.XYZM:
case _ol_geom_GeometryLayout_.XYZM:
if (coordinate[3] !== 0) {
properties['time'] = coordinate[3];
}
// fall through
case ol.geom.GeometryLayout.XYZ:
case _ol_geom_GeometryLayout_.XYZ:
if (coordinate[2] !== 0) {
properties['ele'] = coordinate[2];
}
break;
case ol.geom.GeometryLayout.XYM:
case _ol_geom_GeometryLayout_.XYM:
if (coordinate[2] !== 0) {
properties['time'] = coordinate[2];
}
@@ -606,12 +607,12 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
// pass
}
var orderedKeys = (node.nodeName == 'rtept') ?
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
_ol_format_GPX_.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node, 'properties': properties}),
ol.format.GPX.WPT_TYPE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
_ol_format_GPX_.WPT_TYPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -622,22 +623,22 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeRte_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties();
var context = {node: node, 'properties': properties};
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
properties['rtept'] = geometry.getCoordinates();
}
var parentNode = objectStack[objectStack.length - 1].node;
var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
var orderedKeys = _ol_format_GPX_.RTE_SEQUENCE_[parentNode.namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.RTE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -648,7 +649,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties();
/** @type {ol.XmlNodeStackItem} */
@@ -656,14 +657,14 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.MultiLineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
properties['trkseg'] = geometry.getLineStrings();
}
var parentNode = objectStack[objectStack.length - 1].node;
var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
var orderedKeys = _ol_format_GPX_.TRK_SEQUENCE_[parentNode.namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.TRK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -674,12 +675,12 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
_ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) {
/** @type {ol.XmlNodeStackItem} */
var context = {node: node, 'geometryLayout': lineString.getLayout(),
'properties': {}};
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_,
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.TRKSEG_SERIALIZERS_, _ol_format_GPX_.TRKSEG_NODE_FACTORY_,
lineString.getCoordinates(), objectStack);
};
@@ -690,16 +691,16 @@ ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeWpt_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var context = objectStack[objectStack.length - 1];
context['properties'] = feature.getProperties();
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.Point} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
_ol_format_GPX_.writeWptType_(node, geometry.getCoordinates(), objectStack);
}
};
@@ -709,17 +710,17 @@ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
* @type {Array.<string>}
* @private
*/
ol.format.GPX.LINK_SEQUENCE_ = ['text', 'type'];
_ol_format_GPX_.LINK_SEQUENCE_ = ['text', 'type'];
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'text': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
_ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'text': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode)
});
@@ -728,8 +729,8 @@ ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept'
]);
@@ -739,18 +740,18 @@ ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'number': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'rtept': ol.xml.makeArraySerializer(ol.xml.makeChildAppender(
ol.format.GPX.writeWptType_))
_ol_format_GPX_.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(
_ol_format_GPX_.writeWptType_))
});
@@ -759,8 +760,8 @@ ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.RTEPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'ele', 'time'
]);
@@ -770,8 +771,8 @@ ol.format.GPX.RTEPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg'
]);
@@ -781,18 +782,18 @@ ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'number': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'trkseg': ol.xml.makeArraySerializer(ol.xml.makeChildAppender(
ol.format.GPX.writeTrkSeg_))
_ol_format_GPX_.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(
_ol_format_GPX_.writeTrkSeg_))
});
@@ -801,7 +802,7 @@ ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {function(*, Array.<*>, string=): (Node|undefined)}
* @private
*/
ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt');
_ol_format_GPX_.TRKSEG_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('trkpt');
/**
@@ -809,9 +810,9 @@ ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt');
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'trkpt': ol.xml.makeChildAppender(ol.format.GPX.writeWptType_)
_ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'trkpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWptType_)
});
@@ -820,8 +821,8 @@ ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src',
'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop',
'ageofdgpsdata', 'dgpsid'
@@ -832,30 +833,30 @@ ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'time': ol.xml.makeChildAppender(ol.format.XSD.writeDateTimeTextNode),
'magvar': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'geoidheight': ol.xml.makeChildAppender(
ol.format.XSD.writeDecimalTextNode),
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'sym': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'fix': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'sat': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'hdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'vdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'pdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'ageofdgpsdata': ol.xml.makeChildAppender(
ol.format.XSD.writeDecimalTextNode),
'dgpsid': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode)
_ol_format_GPX_.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'time': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDateTimeTextNode),
'magvar': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'geoidheight': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode),
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'sym': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'fix': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'sat': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'hdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'vdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'pdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'ageofdgpsdata': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode),
'dgpsid': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode)
});
@@ -864,7 +865,7 @@ ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, string>}
* @private
*/
ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_ = {
_ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = {
'Point': 'wpt',
'LineString': 'rte',
'MultiLineString': 'trk'
@@ -879,13 +880,13 @@ ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GPX_.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var geometry = /** @type {ol.Feature} */ (value).getGeometry();
if (geometry) {
var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
var nodeName = _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
if (nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS(parentNode.namespaceURI, nodeName);
return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName);
}
}
};
@@ -896,11 +897,11 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'rte': ol.xml.makeChildAppender(ol.format.GPX.writeRte_),
'trk': ol.xml.makeChildAppender(ol.format.GPX.writeTrk_),
'wpt': ol.xml.makeChildAppender(ol.format.GPX.writeWpt_)
_ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeRte_),
'trk': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeTrk_),
'wpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWpt_)
});
@@ -915,7 +916,7 @@ ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
* @return {string} Result.
* @api
*/
ol.format.GPX.prototype.writeFeatures;
_ol_format_GPX_.prototype.writeFeatures;
/**
@@ -929,20 +930,21 @@ ol.format.GPX.prototype.writeFeatures;
* @override
* @api
*/
ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) {
_ol_format_GPX_.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
//FIXME Serialize metadata
var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
var gpx = _ol_xml_.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';
ol.xml.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
ol.xml.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
ol.format.GPX.SCHEMA_LOCATION_);
_ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
_ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
_ol_format_GPX_.SCHEMA_LOCATION_);
gpx.setAttribute('version', '1.1');
gpx.setAttribute('creator', 'OpenLayers');
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_,
ol.format.GPX.GPX_NODE_FACTORY_, features, [opt_options]);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: gpx}), _ol_format_GPX_.GPX_SERIALIZERS_,
_ol_format_GPX_.GPX_NODE_FACTORY_, features, [opt_options]);
return gpx;
};
export default _ol_format_GPX_;
+97 -94
View File
@@ -1,23 +1,23 @@
/**
* @module ol/format/GeoJSON
*/
// TODO: serialize dataProjection as crs member when writing
// see https://github.com/openlayers/openlayers/issues/2078
goog.provide('ol.format.GeoJSON');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -28,22 +28,22 @@ goog.require('ol.proj');
* @param {olx.format.GeoJSONOptions=} opt_options Options.
* @api
*/
ol.format.GeoJSON = function(opt_options) {
var _ol_format_GeoJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get(
this.defaultDataProjection = _ol_proj_.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
if (options.featureProjection) {
this.defaultFeatureProjection = ol.proj.get(options.featureProjection);
this.defaultFeatureProjection = _ol_proj_.get(options.featureProjection);
}
/**
@@ -61,7 +61,8 @@ ol.format.GeoJSON = function(opt_options) {
this.extractGeometryName_ = options.extractGeometryName;
};
ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_GeoJSON_, _ol_format_JSONFeature_);
/**
@@ -70,14 +71,15 @@ ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
* @private
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
_ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) {
if (!object) {
return null;
}
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
var geometryReader = _ol_format_GeoJSON_.GEOMETRY_READERS_[object.type];
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
geometryReader(object), false, opt_options)
);
};
@@ -87,7 +89,7 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
* @private
* @return {ol.geom.GeometryCollection} Geometry collection.
*/
ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
_ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function(
object, opt_options) {
var geometries = object.geometries.map(
/**
@@ -95,9 +97,9 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
* @return {ol.geom.Geometry} geometry Geometry.
*/
function(geometry) {
return ol.format.GeoJSON.readGeometry_(geometry, opt_options);
return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options);
});
return new ol.geom.GeometryCollection(geometries);
return new _ol_geom_GeometryCollection_(geometries);
};
@@ -106,8 +108,8 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
* @private
* @return {ol.geom.Point} Point.
*/
ol.format.GeoJSON.readPointGeometry_ = function(object) {
return new ol.geom.Point(object.coordinates);
_ol_format_GeoJSON_.readPointGeometry_ = function(object) {
return new _ol_geom_Point_(object.coordinates);
};
@@ -116,8 +118,8 @@ ol.format.GeoJSON.readPointGeometry_ = function(object) {
* @private
* @return {ol.geom.LineString} LineString.
*/
ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
return new ol.geom.LineString(object.coordinates);
_ol_format_GeoJSON_.readLineStringGeometry_ = function(object) {
return new _ol_geom_LineString_(object.coordinates);
};
@@ -126,8 +128,8 @@ ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiLineString} MultiLineString.
*/
ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
return new ol.geom.MultiLineString(object.coordinates);
_ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) {
return new _ol_geom_MultiLineString_(object.coordinates);
};
@@ -136,8 +138,8 @@ ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiPoint} MultiPoint.
*/
ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
return new ol.geom.MultiPoint(object.coordinates);
_ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) {
return new _ol_geom_MultiPoint_(object.coordinates);
};
@@ -146,8 +148,8 @@ ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiPolygon} MultiPolygon.
*/
ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
return new ol.geom.MultiPolygon(object.coordinates);
_ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) {
return new _ol_geom_MultiPolygon_(object.coordinates);
};
@@ -156,8 +158,8 @@ ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
* @private
* @return {ol.geom.Polygon} Polygon.
*/
ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
return new ol.geom.Polygon(object.coordinates);
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
return new _ol_geom_Polygon_(object.coordinates);
};
@@ -167,10 +169,10 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
* @private
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
_ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_GeoJSON_.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)),
opt_options);
};
@@ -180,7 +182,7 @@ ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection.
*/
ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
_ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection',
geometries: []
@@ -194,12 +196,12 @@ ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
* @private
* @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
*/
ol.format.GeoJSON.writeGeometryCollectionGeometry_ = function(
_ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function(
geometry, opt_options) {
var geometries = geometry.getGeometriesArray().map(function(geometry) {
var options = ol.obj.assign({}, opt_options);
var options = _ol_obj_.assign({}, opt_options);
delete options.featureProjection;
return ol.format.GeoJSON.writeGeometry_(geometry, options);
return _ol_format_GeoJSON_.writeGeometry_(geometry, options);
});
return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection',
@@ -214,7 +216,7 @@ ol.format.GeoJSON.writeGeometryCollectionGeometry_ = function(
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'LineString',
coordinates: geometry.getCoordinates()
@@ -228,7 +230,7 @@ ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'MultiLineString',
coordinates: geometry.getCoordinates()
@@ -242,7 +244,7 @@ ol.format.GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'MultiPoint',
coordinates: geometry.getCoordinates()
@@ -256,7 +258,7 @@ ol.format.GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
var right;
if (opt_options) {
right = opt_options.rightHanded;
@@ -274,7 +276,7 @@ ol.format.GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writePointGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'Point',
coordinates: geometry.getCoordinates()
@@ -288,7 +290,7 @@ ol.format.GeoJSON.writePointGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
var right;
if (opt_options) {
right = opt_options.rightHanded;
@@ -305,14 +307,14 @@ ol.format.GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) {
* @private
* @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>}
*/
ol.format.GeoJSON.GEOMETRY_READERS_ = {
'Point': ol.format.GeoJSON.readPointGeometry_,
'LineString': ol.format.GeoJSON.readLineStringGeometry_,
'Polygon': ol.format.GeoJSON.readPolygonGeometry_,
'MultiPoint': ol.format.GeoJSON.readMultiPointGeometry_,
'MultiLineString': ol.format.GeoJSON.readMultiLineStringGeometry_,
'MultiPolygon': ol.format.GeoJSON.readMultiPolygonGeometry_,
'GeometryCollection': ol.format.GeoJSON.readGeometryCollectionGeometry_
_ol_format_GeoJSON_.GEOMETRY_READERS_ = {
'Point': _ol_format_GeoJSON_.readPointGeometry_,
'LineString': _ol_format_GeoJSON_.readLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.readPolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.readMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.readMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.readGeometryCollectionGeometry_
};
@@ -321,15 +323,15 @@ ol.format.GeoJSON.GEOMETRY_READERS_ = {
* @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/
ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
'Point': ol.format.GeoJSON.writePointGeometry_,
'LineString': ol.format.GeoJSON.writeLineStringGeometry_,
'Polygon': ol.format.GeoJSON.writePolygonGeometry_,
'MultiPoint': ol.format.GeoJSON.writeMultiPointGeometry_,
'MultiLineString': ol.format.GeoJSON.writeMultiLineStringGeometry_,
'MultiPolygon': ol.format.GeoJSON.writeMultiPolygonGeometry_,
'GeometryCollection': ol.format.GeoJSON.writeGeometryCollectionGeometry_,
'Circle': ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_
_ol_format_GeoJSON_.GEOMETRY_WRITERS_ = {
'Point': _ol_format_GeoJSON_.writePointGeometry_,
'LineString': _ol_format_GeoJSON_.writeLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.writePolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.writeMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.writeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.writeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.writeGeometryCollectionGeometry_,
'Circle': _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_
};
@@ -345,7 +347,7 @@ ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.GeoJSON.prototype.readFeature;
_ol_format_GeoJSON_.prototype.readFeature;
/**
@@ -359,13 +361,13 @@ ol.format.GeoJSON.prototype.readFeature;
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GeoJSON.prototype.readFeatures;
_ol_format_GeoJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readFeatureFromObject = function(
_ol_format_GeoJSON_.prototype.readFeatureFromObject = function(
object, opt_options) {
/**
* @type {GeoJSONFeature}
@@ -380,8 +382,8 @@ ol.format.GeoJSON.prototype.readFeatureFromObject = function(
});
}
var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry, opt_options);
var feature = new ol.Feature();
var geometry = _ol_format_GeoJSON_.readGeometry_(geoJSONFeature.geometry, opt_options);
var feature = new _ol_Feature_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
} else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) {
@@ -401,7 +403,7 @@ ol.format.GeoJSON.prototype.readFeatureFromObject = function(
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
_ol_format_GeoJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array.<ol.Feature>} */
@@ -432,15 +434,15 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.GeoJSON.prototype.readGeometry;
_ol_format_GeoJSON_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readGeometryFromObject = function(
_ol_format_GeoJSON_.prototype.readGeometryFromObject = function(
object, opt_options) {
return ol.format.GeoJSON.readGeometry_(
return _ol_format_GeoJSON_.readGeometry_(
/** @type {GeoJSONGeometry} */ (object), opt_options);
};
@@ -453,21 +455,21 @@ ol.format.GeoJSON.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.GeoJSON.prototype.readProjection;
_ol_format_GeoJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
var crs = geoJSONObject.crs;
var projection;
if (crs) {
if (crs.type == 'name') {
projection = ol.proj.get(crs.properties.name);
projection = _ol_proj_.get(crs.properties.name);
} else {
ol.asserts.assert(false, 36); // Unknown SRS type
_ol_asserts_.assert(false, 36); // Unknown SRS type
}
} else {
projection = this.defaultDataProjection;
@@ -486,7 +488,7 @@ ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeature;
_ol_format_GeoJSON_.prototype.writeFeature;
/**
@@ -498,7 +500,7 @@ ol.format.GeoJSON.prototype.writeFeature;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
_ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
var object = /** @type {GeoJSONFeature} */ ({
@@ -511,13 +513,13 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options)
var geometry = feature.getGeometry();
if (geometry) {
object.geometry =
ol.format.GeoJSON.writeGeometry_(geometry, opt_options);
_ol_format_GeoJSON_.writeGeometry_(geometry, opt_options);
} else {
object.geometry = null;
}
var properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!ol.obj.isEmpty(properties)) {
if (!_ol_obj_.isEmpty(properties)) {
object.properties = properties;
} else {
object.properties = null;
@@ -535,7 +537,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options)
* @return {string} GeoJSON.
* @api
*/
ol.format.GeoJSON.prototype.writeFeatures;
_ol_format_GeoJSON_.prototype.writeFeatures;
/**
@@ -547,7 +549,7 @@ ol.format.GeoJSON.prototype.writeFeatures;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
_ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var objects = [];
var i, ii;
@@ -570,7 +572,7 @@ ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options
* @return {string} GeoJSON.
* @api
*/
ol.format.GeoJSON.prototype.writeGeometry;
_ol_format_GeoJSON_.prototype.writeGeometry;
/**
@@ -582,8 +584,9 @@ ol.format.GeoJSON.prototype.writeGeometry;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry,
_ol_format_GeoJSON_.prototype.writeGeometryObject = function(geometry,
opt_options) {
return ol.format.GeoJSON.writeGeometry_(geometry,
return _ol_format_GeoJSON_.writeGeometry_(geometry,
this.adaptOptions(opt_options));
};
export default _ol_format_GeoJSON_;
+42 -40
View File
@@ -1,14 +1,14 @@
goog.provide('ol.format.IGC');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.IGCZ');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.proj');
/**
* @module ol/format/IGC
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_IGCZ_ from '../format/IGCZ.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -19,26 +19,27 @@ goog.require('ol.proj');
* @param {olx.format.IGCOptions=} opt_options Options.
* @api
*/
ol.format.IGC = function(opt_options) {
var _ol_format_IGC_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @private
* @type {ol.format.IGCZ}
*/
this.altitudeMode_ = options.altitudeMode ?
options.altitudeMode : ol.format.IGCZ.NONE;
options.altitudeMode : _ol_format_IGCZ_.NONE;
};
ol.inherits(ol.format.IGC, ol.format.TextFeature);
_ol_.inherits(_ol_format_IGC_, _ol_format_TextFeature_);
/**
@@ -46,7 +47,7 @@ ol.inherits(ol.format.IGC, ol.format.TextFeature);
* @type {RegExp}
* @private
*/
ol.format.IGC.B_RECORD_RE_ =
_ol_format_IGC_.B_RECORD_RE_ =
/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/;
@@ -55,7 +56,7 @@ ol.format.IGC.B_RECORD_RE_ =
* @type {RegExp}
* @private
*/
ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
_ol_format_IGC_.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
/**
@@ -63,7 +64,7 @@ ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
* @type {RegExp}
* @private
*/
ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
_ol_format_IGC_.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
/**
@@ -73,7 +74,7 @@ ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
* @type {RegExp}
* @private
*/
ol.format.IGC.NEWLINE_RE_ = /\r\n|\r|\n/;
_ol_format_IGC_.NEWLINE_RE_ = /\r\n|\r|\n/;
/**
@@ -85,15 +86,15 @@ ol.format.IGC.NEWLINE_RE_ = /\r\n|\r|\n/;
* @return {ol.Feature} Feature.
* @api
*/
ol.format.IGC.prototype.readFeature;
_ol_format_IGC_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) {
var altitudeMode = this.altitudeMode_;
var lines = text.split(ol.format.IGC.NEWLINE_RE_);
var lines = text.split(_ol_format_IGC_.NEWLINE_RE_);
/** @type {Object.<string, string>} */
var properties = {};
var flatCoordinates = [];
@@ -106,7 +107,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
var line = lines[i];
var m;
if (line.charAt(0) == 'B') {
m = ol.format.IGC.B_RECORD_RE_.exec(line);
m = _ol_format_IGC_.B_RECORD_RE_.exec(line);
if (m) {
var hour = parseInt(m[1], 10);
var minute = parseInt(m[2], 10);
@@ -120,11 +121,11 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
x = -x;
}
flatCoordinates.push(x, y);
if (altitudeMode != ol.format.IGCZ.NONE) {
if (altitudeMode != _ol_format_IGCZ_.NONE) {
var z;
if (altitudeMode == ol.format.IGCZ.GPS) {
if (altitudeMode == _ol_format_IGCZ_.GPS) {
z = parseInt(m[11], 10);
} else if (altitudeMode == ol.format.IGCZ.BAROMETRIC) {
} else if (altitudeMode == _ol_format_IGCZ_.BAROMETRIC) {
z = parseInt(m[12], 10);
} else {
z = 0;
@@ -140,13 +141,13 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
lastDateTime = dateTime;
}
} else if (line.charAt(0) == 'H') {
m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line);
m = _ol_format_IGC_.HFDTE_RECORD_RE_.exec(line);
if (m) {
day = parseInt(m[1], 10);
month = parseInt(m[2], 10) - 1;
year = 2000 + parseInt(m[3], 10);
} else {
m = ol.format.IGC.H_RECORD_RE_.exec(line);
m = _ol_format_IGC_.H_RECORD_RE_.exec(line);
if (m) {
properties[m[1]] = m[2].trim();
}
@@ -156,11 +157,11 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
if (flatCoordinates.length === 0) {
return null;
}
var lineString = new ol.geom.LineString(null);
var layout = altitudeMode == ol.format.IGCZ.NONE ?
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
var lineString = new _ol_geom_LineString_(null);
var layout = altitudeMode == _ol_format_IGCZ_.NONE ?
_ol_geom_GeometryLayout_.XYM : _ol_geom_GeometryLayout_.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
var feature = new _ol_Feature_(_ol_format_Feature_.transformWithOptions(
lineString, false, opt_options));
feature.setProperties(properties);
return feature;
@@ -177,13 +178,13 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.IGC.prototype.readFeatures;
_ol_format_IGC_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options);
if (feature) {
return [feature];
@@ -201,32 +202,33 @@ ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.IGC.prototype.readProjection;
_ol_format_IGC_.prototype.readProjection;
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeFeatureText = function(feature, opt_options) {};
_ol_format_IGC_.prototype.writeFeatureText = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeFeaturesText = function(features, opt_options) {};
_ol_format_IGC_.prototype.writeFeaturesText = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeGeometryText = function(geometry, opt_options) {};
_ol_format_IGC_.prototype.writeGeometryText = function(geometry, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.readGeometryFromText = function(text, opt_options) {};
_ol_format_IGC_.prototype.readGeometryFromText = function(text, opt_options) {};
export default _ol_format_IGC_;
+6 -3
View File
@@ -1,11 +1,14 @@
goog.provide('ol.format.IGCZ');
/**
* @module ol/format/IGCZ
*/
/**
* IGC altitude/z. One of 'barometric', 'gps', 'none'.
* @enum {string}
*/
ol.format.IGCZ = {
var _ol_format_IGCZ_ = {
BAROMETRIC: 'barometric',
GPS: 'gps',
NONE: 'none'
};
export default _ol_format_IGCZ_;
+28 -26
View File
@@ -1,9 +1,9 @@
goog.provide('ol.format.JSONFeature');
goog.require('ol');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @module ol/format/JSONFeature
*/
import _ol_ from '../index.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
/**
* @classdesc
@@ -15,10 +15,11 @@ goog.require('ol.format.FormatType');
* @abstract
* @extends {ol.format.Feature}
*/
ol.format.JSONFeature = function() {
ol.format.Feature.call(this);
var _ol_format_JSONFeature_ = function() {
_ol_format_Feature_.call(this);
};
ol.inherits(ol.format.JSONFeature, ol.format.Feature);
_ol_.inherits(_ol_format_JSONFeature_, _ol_format_Feature_);
/**
@@ -26,7 +27,7 @@ ol.inherits(ol.format.JSONFeature, ol.format.Feature);
* @private
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.getObject_ = function(source) {
_ol_format_JSONFeature_.prototype.getObject_ = function(source) {
if (typeof source === 'string') {
var object = JSON.parse(source);
return object ? /** @type {Object} */ (object) : null;
@@ -41,15 +42,15 @@ ol.format.JSONFeature.prototype.getObject_ = function(source) {
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.getType = function() {
return ol.format.FormatType.JSON;
_ol_format_JSONFeature_.prototype.getType = function() {
return _ol_format_FormatType_.JSON;
};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readFeature = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -58,7 +59,7 @@ ol.format.JSONFeature.prototype.readFeature = function(source, opt_options) {
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readFeatures = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -71,7 +72,7 @@ ol.format.JSONFeature.prototype.readFeatures = function(source, opt_options) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.JSONFeature.prototype.readFeatureFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readFeatureFromObject = function(object, opt_options) {};
/**
@@ -81,13 +82,13 @@ ol.format.JSONFeature.prototype.readFeatureFromObject = function(object, opt_opt
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.JSONFeature.prototype.readFeaturesFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readFeaturesFromObject = function(object, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readGeometry = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -100,13 +101,13 @@ ol.format.JSONFeature.prototype.readGeometry = function(source, opt_options) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.JSONFeature.prototype.readGeometryFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readGeometryFromObject = function(object, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readProjection = function(source) {
_ol_format_JSONFeature_.prototype.readProjection = function(source) {
return this.readProjectionFromObject(this.getObject_(source));
};
@@ -117,13 +118,13 @@ ol.format.JSONFeature.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.JSONFeature.prototype.readProjectionFromObject = function(object) {};
_ol_format_JSONFeature_.prototype.readProjectionFromObject = function(object) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) {
_ol_format_JSONFeature_.prototype.writeFeature = function(feature, opt_options) {
return JSON.stringify(this.writeFeatureObject(feature, opt_options));
};
@@ -134,13 +135,13 @@ ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) {
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {};
_ol_format_JSONFeature_.prototype.writeFeatureObject = function(feature, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeFeatures = function(features, opt_options) {
_ol_format_JSONFeature_.prototype.writeFeatures = function(features, opt_options) {
return JSON.stringify(this.writeFeaturesObject(features, opt_options));
};
@@ -151,13 +152,13 @@ ol.format.JSONFeature.prototype.writeFeatures = function(features, opt_options)
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {};
_ol_format_JSONFeature_.prototype.writeFeaturesObject = function(features, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeGeometry = function(geometry, opt_options) {
_ol_format_JSONFeature_.prototype.writeGeometry = function(geometry, opt_options) {
return JSON.stringify(this.writeGeometryObject(geometry, opt_options));
};
@@ -168,4 +169,5 @@ ol.format.JSONFeature.prototype.writeGeometry = function(geometry, opt_options)
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {};
_ol_format_JSONFeature_.prototype.writeGeometryObject = function(geometry, opt_options) {};
export default _ol_format_JSONFeature_;
+725 -722
View File
File diff suppressed because it is too large Load Diff
+68 -66
View File
@@ -1,25 +1,25 @@
/**
* @module ol/format/MVT
*/
//FIXME Implement projection handling
goog.provide('ol.format.MVT');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.ext.PBF');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.flat.orient');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.render.Feature');
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_ext_PBF_ from 'pbf';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import _ol_proj_Projection_ from '../proj/Projection.js';
import _ol_proj_Units_ from '../proj/Units.js';
import _ol_render_Feature_ from '../render/Feature.js';
/**
* @classdesc
@@ -30,18 +30,18 @@ goog.require('ol.render.Feature');
* @param {olx.format.MVTOptions=} opt_options Options.
* @api
*/
ol.format.MVT = function(opt_options) {
var _ol_format_MVT_ = function(opt_options) {
ol.format.Feature.call(this);
_ol_format_Feature_.call(this);
var options = opt_options ? opt_options : {};
/**
* @type {ol.proj.Projection}
*/
this.defaultDataProjection = new ol.proj.Projection({
this.defaultDataProjection = new _ol_proj_Projection_({
code: '',
units: ol.proj.Units.TILE_PIXELS
units: _ol_proj_Units_.TILE_PIXELS
});
/**
@@ -51,7 +51,7 @@ ol.format.MVT = function(opt_options) {
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
*/
this.featureClass_ = options.featureClass ?
options.featureClass : ol.render.Feature;
options.featureClass : _ol_render_Feature_;
/**
* @private
@@ -78,14 +78,15 @@ ol.format.MVT = function(opt_options) {
this.extent_ = null;
};
ol.inherits(ol.format.MVT, ol.format.Feature);
_ol_.inherits(_ol_format_MVT_, _ol_format_Feature_);
/**
* Reader callbacks for parsing the PBF.
* @type {Object.<string, function(number, Object, ol.ext.PBF)>}
*/
ol.format.MVT.pbfReaders_ = {
_ol_format_MVT_.pbfReaders_ = {
layers: function(tag, layers, pbf) {
if (tag === 3) {
var layer = {
@@ -94,7 +95,7 @@ ol.format.MVT.pbfReaders_ = {
features: []
};
var end = pbf.readVarint() + pbf.pos;
pbf.readFields(ol.format.MVT.pbfReaders_.layer, layer, end);
pbf.readFields(_ol_format_MVT_.pbfReaders_.layer, layer, end);
layer.length = layer.features.length;
if (layer.length) {
layers[layer.name] = layer;
@@ -156,7 +157,7 @@ ol.format.MVT.pbfReaders_ = {
* @param {number} i Index of the feature in the raw layer's `features` array.
* @return {Object} Raw feature.
*/
ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
_ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
pbf.pos = layer.features[i];
var end = pbf.readVarint() + pbf.pos;
@@ -165,7 +166,7 @@ ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
type: 0,
properties: {}
};
pbf.readFields(ol.format.MVT.pbfReaders_.feature, feature, end);
pbf.readFields(_ol_format_MVT_.pbfReaders_.feature, feature, end);
return feature;
};
@@ -180,7 +181,7 @@ ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in.
*/
ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
_ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
pbf.pos = feature.geometry;
var end = pbf.readVarint() + pbf.pos;
@@ -224,7 +225,7 @@ ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
}
} else {
ol.asserts.assert(false, 59); // Invalid command found in the PBF
_ol_asserts_.assert(false, 59); // Invalid command found in the PBF
}
}
@@ -244,18 +245,18 @@ ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
* geometry.
* @return {ol.geom.GeometryType} The geometry type.
*/
ol.format.MVT.getGeometryType_ = function(type, numEnds) {
_ol_format_MVT_.getGeometryType_ = function(type, numEnds) {
/** @type {ol.geom.GeometryType} */
var geometryType;
if (type === 1) {
geometryType = numEnds === 1 ?
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
_ol_geom_GeometryType_.POINT : _ol_geom_GeometryType_.MULTI_POINT;
} else if (type === 2) {
geometryType = numEnds === 1 ?
ol.geom.GeometryType.LINE_STRING :
ol.geom.GeometryType.MULTI_LINE_STRING;
_ol_geom_GeometryType_.LINE_STRING :
_ol_geom_GeometryType_.MULTI_LINE_STRING;
} else if (type === 3) {
geometryType = ol.geom.GeometryType.POLYGON;
geometryType = _ol_geom_GeometryType_.POLYGON;
// MultiPolygon not relevant for rendering - winding order determines
// outer rings of polygons.
}
@@ -269,7 +270,7 @@ ol.format.MVT.getGeometryType_ = function(type, numEnds) {
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature|ol.render.Feature} Feature.
*/
ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
_ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
var type = rawFeature.type;
if (type === 0) {
return null;
@@ -282,21 +283,21 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
var flatCoordinates = [];
var ends = [];
ol.format.MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
_ol_format_MVT_.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
var geometryType = ol.format.MVT.getGeometryType_(type, ends.length);
var geometryType = _ol_format_MVT_.getGeometryType_(type, ends.length);
if (this.featureClass_ === ol.render.Feature) {
if (this.featureClass_ === _ol_render_Feature_) {
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
} else {
var geom;
if (geometryType == ol.geom.GeometryType.POLYGON) {
if (geometryType == _ol_geom_GeometryType_.POLYGON) {
var endss = [];
var offset = 0;
var prevEndIndex = 0;
for (var i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
if (!ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
if (!_ol_geom_flat_orient_.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
endss.push(ends.slice(prevEndIndex, i));
prevEndIndex = i;
}
@@ -304,24 +305,24 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
}
if (endss.length > 1) {
ends = endss;
geom = new ol.geom.MultiPolygon(null);
geom = new _ol_geom_MultiPolygon_(null);
} else {
geom = new ol.geom.Polygon(null);
geom = new _ol_geom_Polygon_(null);
}
} else {
geom = geometryType === ol.geom.GeometryType.POINT ? new ol.geom.Point(null) :
geometryType === ol.geom.GeometryType.LINE_STRING ? new ol.geom.LineString(null) :
geometryType === ol.geom.GeometryType.POLYGON ? new ol.geom.Polygon(null) :
geometryType === ol.geom.GeometryType.MULTI_POINT ? new ol.geom.MultiPoint (null) :
geometryType === ol.geom.GeometryType.MULTI_LINE_STRING ? new ol.geom.MultiLineString(null) :
geom = geometryType === _ol_geom_GeometryType_.POINT ? new _ol_geom_Point_(null) :
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new _ol_geom_LineString_(null) :
geometryType === _ol_geom_GeometryType_.POLYGON ? new _ol_geom_Polygon_(null) :
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new _ol_geom_MultiPoint_ (null) :
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new _ol_geom_MultiLineString_(null) :
null;
}
geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, ends);
geom.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates, ends);
feature = new this.featureClass_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
}
var geometry = ol.format.Feature.transformWithOptions(geom, false, this.adaptOptions(opt_options));
var geometry = _ol_format_Feature_.transformWithOptions(geom, false, this.adaptOptions(opt_options));
feature.setGeometry(geometry);
feature.setId(id);
feature.setProperties(values);
@@ -335,7 +336,7 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.getLastExtent = function() {
_ol_format_MVT_.prototype.getLastExtent = function() {
return this.extent_;
};
@@ -343,8 +344,8 @@ ol.format.MVT.prototype.getLastExtent = function() {
/**
* @inheritDoc
*/
ol.format.MVT.prototype.getType = function() {
return ol.format.FormatType.ARRAY_BUFFER;
_ol_format_MVT_.prototype.getType = function() {
return _ol_format_FormatType_.ARRAY_BUFFER;
};
@@ -352,11 +353,11 @@ ol.format.MVT.prototype.getType = function() {
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
_ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_;
var pbf = new ol.ext.PBF(/** @type {ArrayBuffer} */ (source));
var pbfLayers = pbf.readFields(ol.format.MVT.pbfReaders_.layers, {});
var pbf = new _ol_ext_PBF_(/** @type {ArrayBuffer} */ (source));
var pbfLayers = pbf.readFields(_ol_format_MVT_.pbfReaders_.layers, {});
/** @type {Array.<ol.Feature|ol.render.Feature>} */
var features = [];
var pbfLayer;
@@ -368,7 +369,7 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
var rawFeature;
for (var i = 0, ii = pbfLayer.length; i < ii; ++i) {
rawFeature = ol.format.MVT.readRawFeature_(pbf, pbfLayer, i);
rawFeature = _ol_format_MVT_.readRawFeature_(pbf, pbfLayer, i);
features.push(this.createFeature_(pbf, rawFeature));
}
this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;
@@ -382,7 +383,7 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readProjection = function(source) {
_ol_format_MVT_.prototype.readProjection = function(source) {
return this.defaultDataProjection;
};
@@ -392,7 +393,7 @@ ol.format.MVT.prototype.readProjection = function(source) {
* @param {Array.<string>} layers Layers.
* @api
*/
ol.format.MVT.prototype.setLayers = function(layers) {
_ol_format_MVT_.prototype.setLayers = function(layers) {
this.layers_ = layers;
};
@@ -401,32 +402,33 @@ ol.format.MVT.prototype.setLayers = function(layers) {
* Not implemented.
* @override
*/
ol.format.MVT.prototype.readFeature = function() {};
_ol_format_MVT_.prototype.readFeature = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.readGeometry = function() {};
_ol_format_MVT_.prototype.readGeometry = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeFeature = function() {};
_ol_format_MVT_.prototype.writeFeature = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeGeometry = function() {};
_ol_format_MVT_.prototype.writeGeometry = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeFeatures = function() {};
_ol_format_MVT_.prototype.writeFeatures = function() {};
export default _ol_format_MVT_;
+60 -58
View File
@@ -1,19 +1,19 @@
/**
* @module ol/format/OSMXML
*/
// FIXME add typedef for stack state objects
goog.provide('ol.format.OSMXML');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -24,15 +24,16 @@ goog.require('ol.xml');
* @extends {ol.format.XMLFeature}
* @api
*/
ol.format.OSMXML = function() {
ol.format.XMLFeature.call(this);
var _ol_format_OSMXML_ = function() {
_ol_format_XMLFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
};
ol.inherits(ol.format.OSMXML, ol.format.XMLFeature);
_ol_.inherits(_ol_format_OSMXML_, _ol_format_XMLFeature_);
/**
@@ -40,7 +41,7 @@ ol.inherits(ol.format.OSMXML, ol.format.XMLFeature);
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readNode_ = function(node, objectStack) {
_ol_format_OSMXML_.readNode_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var id = node.getAttribute('id');
@@ -51,13 +52,13 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
];
state.nodes[id] = coordinates;
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
tags: {}
}, ol.format.OSMXML.NODE_PARSERS_, node, objectStack);
if (!ol.obj.isEmpty(values.tags)) {
var geometry = new ol.geom.Point(coordinates);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
}, _ol_format_OSMXML_.NODE_PARSERS_, node, objectStack);
if (!_ol_obj_.isEmpty(values.tags)) {
var geometry = new _ol_geom_Point_(coordinates);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setId(id);
feature.setProperties(values.tags);
state.features.push(feature);
@@ -70,13 +71,13 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readWay_ = function(node, objectStack) {
_ol_format_OSMXML_.readWay_ = function(node, objectStack) {
var id = node.getAttribute('id');
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
id: id,
ndrefs: [],
tags: {}
}, ol.format.OSMXML.WAY_PARSERS_, node, objectStack);
}, _ol_format_OSMXML_.WAY_PARSERS_, node, objectStack);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
state.ways.push(values);
};
@@ -87,7 +88,7 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readNd_ = function(node, objectStack) {
_ol_format_OSMXML_.readNd_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.ndrefs.push(node.getAttribute('ref'));
};
@@ -98,7 +99,7 @@ ol.format.OSMXML.readNd_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readTag_ = function(node, objectStack) {
_ol_format_OSMXML_.readTag_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.tags[node.getAttribute('k')] = node.getAttribute('v');
};
@@ -109,7 +110,7 @@ ol.format.OSMXML.readTag_ = function(node, objectStack) {
* @private
* @type {Array.<string>}
*/
ol.format.OSMXML.NAMESPACE_URIS_ = [
_ol_format_OSMXML_.NAMESPACE_URIS_ = [
null
];
@@ -119,10 +120,10 @@ ol.format.OSMXML.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'nd': ol.format.OSMXML.readNd_,
'tag': ol.format.OSMXML.readTag_
_ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'nd': _ol_format_OSMXML_.readNd_,
'tag': _ol_format_OSMXML_.readTag_
});
@@ -131,10 +132,10 @@ ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'node': ol.format.OSMXML.readNode_,
'way': ol.format.OSMXML.readWay_
_ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'node': _ol_format_OSMXML_.readNode_,
'way': _ol_format_OSMXML_.readWay_
});
@@ -143,9 +144,9 @@ ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'tag': ol.format.OSMXML.readTag_
_ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'tag': _ol_format_OSMXML_.readTag_
});
@@ -158,20 +159,20 @@ ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.OSMXML.prototype.readFeatures;
_ol_format_OSMXML_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = this.getReadOptions(node, opt_options);
if (node.localName == 'osm') {
var state = ol.xml.pushParseAndPop({
var state = _ol_xml_.pushParseAndPop({
nodes: {},
ways: [],
features: []
}, ol.format.OSMXML.PARSERS_, node, [options]);
}, _ol_format_OSMXML_.PARSERS_, node, [options]);
// parse nodes in ways
for (var j = 0; j < state.ways.length; j++) {
var values = /** @type {Object} */ (state.ways[j]);
@@ -179,20 +180,20 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
var flatCoordinates = [];
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
var point = state.nodes[values.ndrefs[i]];
ol.array.extend(flatCoordinates, point);
_ol_array_.extend(flatCoordinates, point);
}
var geometry;
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
// closed way
geometry = new ol.geom.Polygon(null);
geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates,
geometry = new _ol_geom_Polygon_(null);
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates,
[flatCoordinates.length]);
} else {
geometry = new ol.geom.LineString(null);
geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
geometry = new _ol_geom_LineString_(null);
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates);
}
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setId(values.id);
feature.setProperties(values.tags);
state.features.push(feature);
@@ -213,25 +214,26 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.OSMXML.prototype.readProjection;
_ol_format_OSMXML_.prototype.readProjection;
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeFeatureNode = function(feature, opt_options) {};
_ol_format_OSMXML_.prototype.writeFeatureNode = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeFeaturesNode = function(features, opt_options) {};
_ol_format_OSMXML_.prototype.writeFeaturesNode = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeGeometryNode = function(geometry, opt_options) {};
_ol_format_OSMXML_.prototype.writeGeometryNode = function(geometry, opt_options) {};
export default _ol_format_OSMXML_;
+134 -132
View File
@@ -1,26 +1,27 @@
goog.provide('ol.format.OWS');
goog.require('ol');
goog.require('ol.format.XLink');
goog.require('ol.format.XML');
goog.require('ol.format.XSD');
goog.require('ol.xml');
/**
* @module ol/format/OWS
*/
import _ol_ from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_xml_ from '../xml.js';
/**
* @constructor
* @extends {ol.format.XML}
*/
ol.format.OWS = function() {
ol.format.XML.call(this);
var _ol_format_OWS_ = function() {
_ol_format_XML_.call(this);
};
ol.inherits(ol.format.OWS, ol.format.XML);
_ol_.inherits(_ol_format_OWS_, _ol_format_XML_);
/**
* @inheritDoc
*/
ol.format.OWS.prototype.readFromDocument = function(doc) {
_ol_format_OWS_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
@@ -33,9 +34,9 @@ ol.format.OWS.prototype.readFromDocument = function(doc) {
/**
* @inheritDoc
*/
ol.format.OWS.prototype.readFromNode = function(node) {
var owsObject = ol.xml.pushParseAndPop({},
ol.format.OWS.PARSERS_, node, []);
_ol_format_OWS_.prototype.readFromNode = function(node) {
var owsObject = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.PARSERS_, node, []);
return owsObject ? owsObject : null;
};
@@ -46,9 +47,9 @@ ol.format.OWS.prototype.readFromNode = function(node) {
* @private
* @return {Object|undefined} The address.
*/
ol.format.OWS.readAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.ADDRESS_PARSERS_, node, objectStack);
_ol_format_OWS_.readAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.ADDRESS_PARSERS_, node, objectStack);
};
@@ -58,9 +59,9 @@ ol.format.OWS.readAddress_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The values.
*/
ol.format.OWS.readAllowedValues_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.ALLOWED_VALUES_PARSERS_, node, objectStack);
_ol_format_OWS_.readAllowedValues_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.ALLOWED_VALUES_PARSERS_, node, objectStack);
};
@@ -70,13 +71,13 @@ ol.format.OWS.readAllowedValues_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The constraint.
*/
ol.format.OWS.readConstraint_ = function(node, objectStack) {
_ol_format_OWS_.readConstraint_ = function(node, objectStack) {
var name = node.getAttribute('name');
if (!name) {
return undefined;
}
return ol.xml.pushParseAndPop({'name': name},
ol.format.OWS.CONSTRAINT_PARSERS_, node,
return _ol_xml_.pushParseAndPop({'name': name},
_ol_format_OWS_.CONSTRAINT_PARSERS_, node,
objectStack);
};
@@ -87,9 +88,9 @@ ol.format.OWS.readConstraint_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The contact info.
*/
ol.format.OWS.readContactInfo_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.CONTACT_INFO_PARSERS_, node, objectStack);
_ol_format_OWS_.readContactInfo_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.CONTACT_INFO_PARSERS_, node, objectStack);
};
@@ -99,9 +100,9 @@ ol.format.OWS.readContactInfo_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The DCP.
*/
ol.format.OWS.readDcp_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.DCP_PARSERS_, node, objectStack);
_ol_format_OWS_.readDcp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.DCP_PARSERS_, node, objectStack);
};
@@ -111,13 +112,13 @@ ol.format.OWS.readDcp_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The GET object.
*/
ol.format.OWS.readGet_ = function(node, objectStack) {
var href = ol.format.XLink.readHref(node);
_ol_format_OWS_.readGet_ = function(node, objectStack) {
var href = _ol_format_XLink_.readHref(node);
if (!href) {
return undefined;
}
return ol.xml.pushParseAndPop({'href': href},
ol.format.OWS.REQUEST_METHOD_PARSERS_, node, objectStack);
return _ol_xml_.pushParseAndPop({'href': href},
_ol_format_OWS_.REQUEST_METHOD_PARSERS_, node, objectStack);
};
@@ -127,8 +128,8 @@ ol.format.OWS.readGet_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The HTTP object.
*/
ol.format.OWS.readHttp_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({}, ol.format.OWS.HTTP_PARSERS_,
_ol_format_OWS_.readHttp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, _ol_format_OWS_.HTTP_PARSERS_,
node, objectStack);
};
@@ -139,10 +140,10 @@ ol.format.OWS.readHttp_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The operation.
*/
ol.format.OWS.readOperation_ = function(node, objectStack) {
_ol_format_OWS_.readOperation_ = function(node, objectStack) {
var name = node.getAttribute('name');
var value = ol.xml.pushParseAndPop({},
ol.format.OWS.OPERATION_PARSERS_, node, objectStack);
var value = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATION_PARSERS_, node, objectStack);
if (!value) {
return undefined;
}
@@ -158,10 +159,10 @@ ol.format.OWS.readOperation_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The operations metadata.
*/
ol.format.OWS.readOperationsMetadata_ = function(node,
_ol_format_OWS_.readOperationsMetadata_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.OPERATIONS_METADATA_PARSERS_, node,
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_, node,
objectStack);
};
@@ -172,9 +173,9 @@ ol.format.OWS.readOperationsMetadata_ = function(node,
* @private
* @return {Object|undefined} The phone.
*/
ol.format.OWS.readPhone_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.PHONE_PARSERS_, node, objectStack);
_ol_format_OWS_.readPhone_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.PHONE_PARSERS_, node, objectStack);
};
@@ -184,10 +185,10 @@ ol.format.OWS.readPhone_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The service identification.
*/
ol.format.OWS.readServiceIdentification_ = function(node,
_ol_format_OWS_.readServiceIdentification_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_, node,
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_, node,
objectStack);
};
@@ -198,9 +199,9 @@ ol.format.OWS.readServiceIdentification_ = function(node,
* @private
* @return {Object|undefined} The service contact.
*/
ol.format.OWS.readServiceContact_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_CONTACT_PARSERS_, node,
_ol_format_OWS_.readServiceContact_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_CONTACT_PARSERS_, node,
objectStack);
};
@@ -211,9 +212,9 @@ ol.format.OWS.readServiceContact_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The service provider.
*/
ol.format.OWS.readServiceProvider_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_PROVIDER_PARSERS_, node,
_ol_format_OWS_.readServiceProvider_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_PROVIDER_PARSERS_, node,
objectStack);
};
@@ -224,8 +225,8 @@ ol.format.OWS.readServiceProvider_ = function(node, objectStack) {
* @private
* @return {string|undefined} The value.
*/
ol.format.OWS.readValue_ = function(node, objectStack) {
return ol.format.XSD.readString(node);
_ol_format_OWS_.readValue_ = function(node, objectStack) {
return _ol_format_XSD_.readString(node);
};
@@ -234,7 +235,7 @@ ol.format.OWS.readValue_ = function(node, objectStack) {
* @type {Array.<string>}
* @private
*/
ol.format.OWS.NAMESPACE_URIS_ = [
_ol_format_OWS_.NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/ows/1.1'
];
@@ -245,14 +246,14 @@ ol.format.OWS.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'ServiceIdentification': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceIdentification_),
'ServiceProvider': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceProvider_),
'OperationsMetadata': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readOperationsMetadata_)
_ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'ServiceIdentification': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceIdentification_),
'ServiceProvider': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceProvider_),
'OperationsMetadata': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readOperationsMetadata_)
});
@@ -261,17 +262,17 @@ ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'DeliveryPoint': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AdministrativeArea': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PostalCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ElectronicMailAddress': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'DeliveryPoint': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AdministrativeArea': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PostalCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -280,9 +281,9 @@ ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Value': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readValue_)
_ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Value': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readValue_)
});
@@ -291,10 +292,10 @@ ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'AllowedValues': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readAllowedValues_)
_ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'AllowedValues': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readAllowedValues_)
});
@@ -303,10 +304,10 @@ ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Phone': ol.xml.makeObjectPropertySetter(ol.format.OWS.readPhone_),
'Address': ol.xml.makeObjectPropertySetter(ol.format.OWS.readAddress_)
_ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Phone': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readPhone_),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readAddress_)
});
@@ -315,9 +316,9 @@ ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'HTTP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readHttp_)
_ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readHttp_)
});
@@ -326,9 +327,9 @@ ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Get': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readGet_),
_ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readGet_),
'Post': undefined // TODO
});
@@ -338,9 +339,9 @@ ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'DCP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readDcp_)
_ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'DCP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readDcp_)
});
@@ -349,9 +350,9 @@ ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Operation': ol.format.OWS.readOperation_
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Operation': _ol_format_OWS_.readOperation_
});
@@ -360,10 +361,10 @@ ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Voice': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Facsimile': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Voice': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Facsimile': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -372,10 +373,10 @@ ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Constraint': ol.xml.makeObjectPropertyPusher(
ol.format.OWS.readConstraint_)
_ol_format_OWS_.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Constraint': _ol_xml_.makeObjectPropertyPusher(
_ol_format_OWS_.readConstraint_)
});
@@ -384,14 +385,14 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'IndividualName': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ContactInfo': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readContactInfo_)
_ol_format_OWS_.SERVICE_CONTACT_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'IndividualName': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PositionName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ContactInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readContactInfo_)
});
@@ -400,16 +401,16 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AccessConstraints': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ServiceType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -418,11 +419,12 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
'ServiceContact': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceContact_)
_ol_format_OWS_.SERVICE_PROVIDER_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'ProviderName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ProviderSite': _ol_xml_.makeObjectPropertySetter(_ol_format_XLink_.readHref),
'ServiceContact': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceContact_)
});
export default _ol_format_OWS_;
+62 -59
View File
@@ -1,17 +1,17 @@
goog.provide('ol.format.Polyline');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.SimpleGeometry');
goog.require('ol.geom.flat.flip');
goog.require('ol.geom.flat.inflate');
goog.require('ol.proj');
/**
* @module ol/format/Polyline
*/
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
import _ol_geom_flat_flip_ from '../geom/flat/flip.js';
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -24,16 +24,16 @@ goog.require('ol.proj');
* Optional configuration object.
* @api
*/
ol.format.Polyline = function(opt_options) {
var _ol_format_Polyline_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @private
@@ -46,9 +46,10 @@ ol.format.Polyline = function(opt_options) {
* @type {ol.geom.GeometryLayout}
*/
this.geometryLayout_ = options.geometryLayout ?
options.geometryLayout : ol.geom.GeometryLayout.XY;
options.geometryLayout : _ol_geom_GeometryLayout_.XY;
};
ol.inherits(ol.format.Polyline, ol.format.TextFeature);
_ol_.inherits(_ol_format_Polyline_, _ol_format_TextFeature_);
/**
@@ -64,7 +65,7 @@ ol.inherits(ol.format.Polyline, ol.format.TextFeature);
* @return {string} The encoded string.
* @api
*/
ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
_ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var d;
@@ -84,7 +85,7 @@ ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
}
}
return ol.format.Polyline.encodeFloats(numbers, factor);
return _ol_format_Polyline_.encodeFloats(numbers, factor);
};
@@ -99,7 +100,7 @@ ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
* @return {Array.<number>} A list of n-dimensional points.
* @api
*/
ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
_ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var d;
@@ -109,7 +110,7 @@ ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
lastNumbers[d] = 0;
}
var numbers = ol.format.Polyline.decodeFloats(encoded, factor);
var numbers = _ol_format_Polyline_.decodeFloats(encoded, factor);
var i, ii;
for (i = 0, ii = numbers.length; i < ii;) {
@@ -136,14 +137,14 @@ ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
* @return {string} The encoded string.
* @api
*/
ol.format.Polyline.encodeFloats = function(numbers, opt_factor) {
_ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] = Math.round(numbers[i] * factor);
}
return ol.format.Polyline.encodeSignedIntegers(numbers);
return _ol_format_Polyline_.encodeSignedIntegers(numbers);
};
@@ -156,9 +157,9 @@ ol.format.Polyline.encodeFloats = function(numbers, opt_factor) {
* @return {Array.<number>} A list of floating point numbers.
* @api
*/
ol.format.Polyline.decodeFloats = function(encoded, opt_factor) {
_ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var numbers = ol.format.Polyline.decodeSignedIntegers(encoded);
var numbers = _ol_format_Polyline_.decodeSignedIntegers(encoded);
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] /= factor;
@@ -175,13 +176,13 @@ ol.format.Polyline.decodeFloats = function(encoded, opt_factor) {
* @param {Array.<number>} numbers A list of signed integers.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeSignedIntegers = function(numbers) {
_ol_format_Polyline_.encodeSignedIntegers = function(numbers) {
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i];
numbers[i] = (num < 0) ? ~(num << 1) : (num << 1);
}
return ol.format.Polyline.encodeUnsignedIntegers(numbers);
return _ol_format_Polyline_.encodeUnsignedIntegers(numbers);
};
@@ -191,8 +192,8 @@ ol.format.Polyline.encodeSignedIntegers = function(numbers) {
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of signed integers.
*/
ol.format.Polyline.decodeSignedIntegers = function(encoded) {
var numbers = ol.format.Polyline.decodeUnsignedIntegers(encoded);
_ol_format_Polyline_.decodeSignedIntegers = function(encoded) {
var numbers = _ol_format_Polyline_.decodeUnsignedIntegers(encoded);
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i];
@@ -208,11 +209,11 @@ ol.format.Polyline.decodeSignedIntegers = function(encoded) {
* @param {Array.<number>} numbers A list of unsigned integers.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeUnsignedIntegers = function(numbers) {
_ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) {
var encoded = '';
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
encoded += ol.format.Polyline.encodeUnsignedInteger(numbers[i]);
encoded += _ol_format_Polyline_.encodeUnsignedInteger(numbers[i]);
}
return encoded;
};
@@ -224,7 +225,7 @@ ol.format.Polyline.encodeUnsignedIntegers = function(numbers) {
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of unsigned integers.
*/
ol.format.Polyline.decodeUnsignedIntegers = function(encoded) {
_ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) {
var numbers = [];
var current = 0;
var shift = 0;
@@ -250,7 +251,7 @@ ol.format.Polyline.decodeUnsignedIntegers = function(encoded) {
* @param {number} num Unsigned integer that should be encoded.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeUnsignedInteger = function(num) {
_ol_format_Polyline_.encodeUnsignedInteger = function(num) {
var value, encoded = '';
while (num >= 0x20) {
value = (0x20 | (num & 0x1f)) + 63;
@@ -273,15 +274,15 @@ ol.format.Polyline.encodeUnsignedInteger = function(num) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.Polyline.prototype.readFeature;
_ol_format_Polyline_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) {
var geometry = this.readGeometryFromText(text, opt_options);
return new ol.Feature(geometry);
return new _ol_Feature_(geometry);
};
@@ -295,13 +296,13 @@ ol.format.Polyline.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.Polyline.prototype.readFeatures;
_ol_format_Polyline_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options);
return [feature];
};
@@ -316,25 +317,26 @@ ol.format.Polyline.prototype.readFeaturesFromText = function(text, opt_options)
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.Polyline.prototype.readGeometry;
_ol_format_Polyline_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options) {
var stride = ol.geom.SimpleGeometry.getStrideForLayout(this.geometryLayout_);
var flatCoordinates = ol.format.Polyline.decodeDeltas(
_ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options) {
var stride = _ol_geom_SimpleGeometry_.getStrideForLayout(this.geometryLayout_);
var flatCoordinates = _ol_format_Polyline_.decodeDeltas(
text, stride, this.factor_);
ol.geom.flat.flip.flipXY(
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
var coordinates = ol.geom.flat.inflate.coordinates(
var coordinates = _ol_geom_flat_inflate_.coordinates(
flatCoordinates, 0, flatCoordinates.length, stride);
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options)));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
new _ol_geom_LineString_(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options))
);
};
@@ -346,18 +348,18 @@ ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options)
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.Polyline.prototype.readProjection;
_ol_format_Polyline_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
_ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
} else {
ol.asserts.assert(false, 40); // Expected `feature` to have a geometry
_ol_asserts_.assert(false, 40); // Expected `feature` to have a geometry
return '';
}
};
@@ -366,7 +368,7 @@ ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeFeaturesText = function(features, opt_options) {
_ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_options) {
return this.writeFeatureText(features[0], opt_options);
};
@@ -380,19 +382,20 @@ ol.format.Polyline.prototype.writeFeaturesText = function(features, opt_options)
* @return {string} Geometry.
* @api
*/
ol.format.Polyline.prototype.writeGeometry;
_ol_format_Polyline_.prototype.writeGeometry;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
_ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_options) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(
(_ol_format_Feature_.transformWithOptions(
geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
ol.geom.flat.flip.flipXY(
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
return ol.format.Polyline.encodeDeltas(flatCoordinates, stride, this.factor_);
return _ol_format_Polyline_.encodeDeltas(flatCoordinates, stride, this.factor_);
};
export default _ol_format_Polyline_;
+28 -26
View File
@@ -1,9 +1,9 @@
goog.provide('ol.format.TextFeature');
goog.require('ol');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @module ol/format/TextFeature
*/
import _ol_ from '../index.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
/**
* @classdesc
@@ -15,10 +15,11 @@ goog.require('ol.format.FormatType');
* @abstract
* @extends {ol.format.Feature}
*/
ol.format.TextFeature = function() {
ol.format.Feature.call(this);
var _ol_format_TextFeature_ = function() {
_ol_format_Feature_.call(this);
};
ol.inherits(ol.format.TextFeature, ol.format.Feature);
_ol_.inherits(_ol_format_TextFeature_, _ol_format_Feature_);
/**
@@ -26,7 +27,7 @@ ol.inherits(ol.format.TextFeature, ol.format.Feature);
* @private
* @return {string} Text.
*/
ol.format.TextFeature.prototype.getText_ = function(source) {
_ol_format_TextFeature_.prototype.getText_ = function(source) {
if (typeof source === 'string') {
return source;
} else {
@@ -38,15 +39,15 @@ ol.format.TextFeature.prototype.getText_ = function(source) {
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.getType = function() {
return ol.format.FormatType.TEXT;
_ol_format_TextFeature_.prototype.getType = function() {
return _ol_format_FormatType_.TEXT;
};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readFeature = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -59,13 +60,13 @@ ol.format.TextFeature.prototype.readFeature = function(source, opt_options) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.TextFeature.prototype.readFeatureFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readFeatureFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -78,13 +79,13 @@ ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.TextFeature.prototype.readFeaturesFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readFeaturesFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -97,13 +98,13 @@ ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.TextFeature.prototype.readGeometryFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readGeometryFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readProjection = function(source) {
_ol_format_TextFeature_.prototype.readProjection = function(source) {
return this.readProjectionFromText(this.getText_(source));
};
@@ -113,7 +114,7 @@ ol.format.TextFeature.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.TextFeature.prototype.readProjectionFromText = function(text) {
_ol_format_TextFeature_.prototype.readProjectionFromText = function(text) {
return this.defaultDataProjection;
};
@@ -121,7 +122,7 @@ ol.format.TextFeature.prototype.readProjectionFromText = function(text) {
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) {
_ol_format_TextFeature_.prototype.writeFeature = function(feature, opt_options) {
return this.writeFeatureText(feature, this.adaptOptions(opt_options));
};
@@ -133,13 +134,13 @@ ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) {
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeFeatureText = function(feature, opt_options) {};
_ol_format_TextFeature_.prototype.writeFeatureText = function(feature, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeFeatures = function(
_ol_format_TextFeature_.prototype.writeFeatures = function(
features, opt_options) {
return this.writeFeaturesText(features, this.adaptOptions(opt_options));
};
@@ -152,13 +153,13 @@ ol.format.TextFeature.prototype.writeFeatures = function(
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeFeaturesText = function(features, opt_options) {};
_ol_format_TextFeature_.prototype.writeFeaturesText = function(features, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeGeometry = function(
_ol_format_TextFeature_.prototype.writeGeometry = function(
geometry, opt_options) {
return this.writeGeometryText(geometry, this.adaptOptions(opt_options));
};
@@ -171,4 +172,5 @@ ol.format.TextFeature.prototype.writeGeometry = function(
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeGeometryText = function(geometry, opt_options) {};
_ol_format_TextFeature_.prototype.writeGeometryText = function(geometry, opt_options) {};
export default _ol_format_TextFeature_;
+69 -67
View File
@@ -1,17 +1,17 @@
goog.provide('ol.format.TopoJSON');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.proj');
/**
* @module ol/format/TopoJSON
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -22,11 +22,11 @@ goog.require('ol.proj');
* @param {olx.format.TopoJSONOptions=} opt_options Options.
* @api
*/
ol.format.TopoJSON = function(opt_options) {
var _ol_format_TopoJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* @private
@@ -43,12 +43,13 @@ ol.format.TopoJSON = function(opt_options) {
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get(
this.defaultDataProjection = _ol_proj_.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
};
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_TopoJSON_, _ol_format_JSONFeature_);
/**
@@ -60,7 +61,7 @@ ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
* @return {Array.<ol.Coordinate>} Coordinates array.
* @private
*/
ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
_ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) {
/** @type {Array.<ol.Coordinate>} */
var coordinates = [];
var index, arc;
@@ -98,12 +99,12 @@ ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
* @return {ol.geom.Point} Geometry.
* @private
*/
ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
_ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) {
var coordinates = object.coordinates;
if (scale && translate) {
ol.format.TopoJSON.transformVertex_(coordinates, scale, translate);
_ol_format_TopoJSON_.transformVertex_(coordinates, scale, translate);
}
return new ol.geom.Point(coordinates);
return new _ol_geom_Point_(coordinates);
};
@@ -116,16 +117,16 @@ ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
* @return {ol.geom.MultiPoint} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
_ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale,
translate) {
var coordinates = object.coordinates;
var i, ii;
if (scale && translate) {
for (i = 0, ii = coordinates.length; i < ii; ++i) {
ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate);
_ol_format_TopoJSON_.transformVertex_(coordinates[i], scale, translate);
}
}
return new ol.geom.MultiPoint(coordinates);
return new _ol_geom_MultiPoint_(coordinates);
};
@@ -137,9 +138,9 @@ ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
* @return {ol.geom.LineString} Geometry.
* @private
*/
ol.format.TopoJSON.readLineStringGeometry_ = function(object, arcs) {
var coordinates = ol.format.TopoJSON.concatenateArcs_(object.arcs, arcs);
return new ol.geom.LineString(coordinates);
_ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) {
var coordinates = _ol_format_TopoJSON_.concatenateArcs_(object.arcs, arcs);
return new _ol_geom_LineString_(coordinates);
};
@@ -151,13 +152,13 @@ ol.format.TopoJSON.readLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiLineString} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs);
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
}
return new ol.geom.MultiLineString(coordinates);
return new _ol_geom_MultiLineString_(coordinates);
};
@@ -169,13 +170,13 @@ ol.format.TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.Polygon} Geometry.
* @private
*/
ol.format.TopoJSON.readPolygonGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs);
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
}
return new ol.geom.Polygon(coordinates);
return new _ol_geom_Polygon_(coordinates);
};
@@ -187,7 +188,7 @@ ol.format.TopoJSON.readPolygonGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiPolygon} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) {
var coordinates = [];
var polyArray, ringCoords, j, jj;
var i, ii;
@@ -197,11 +198,11 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
ringCoords = [];
for (j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring
ringCoords[j] = ol.format.TopoJSON.concatenateArcs_(polyArray[j], arcs);
ringCoords[j] = _ol_format_TopoJSON_.concatenateArcs_(polyArray[j], arcs);
}
coordinates[i] = ringCoords;
}
return new ol.geom.MultiPolygon(coordinates);
return new _ol_geom_MultiPolygon_(coordinates);
};
@@ -220,13 +221,13 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
* @return {Array.<ol.Feature>} Array of features.
* @private
*/
ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function(
collection, arcs, scale, translate, property, name, opt_options) {
var geometries = collection.geometries;
var features = [];
var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) {
features[i] = ol.format.TopoJSON.readFeatureFromGeometry_(
features[i] = _ol_format_TopoJSON_.readFeatureFromGeometry_(
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
@@ -247,19 +248,19 @@ ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
* @return {ol.Feature} Feature.
* @private
*/
ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
_ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs,
scale, translate, property, name, opt_options) {
var geometry;
var type = object.type;
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
var geometryReader = _ol_format_TopoJSON_.GEOMETRY_READERS_[type];
if ((type === 'Point') || (type === 'MultiPoint')) {
geometry = geometryReader(object, scale, translate);
} else {
geometry = geometryReader(object, arcs);
}
var feature = new ol.Feature();
var feature = new _ol_Feature_();
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
_ol_format_Feature_.transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) {
feature.setId(object.id);
}
@@ -285,13 +286,13 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.TopoJSON.prototype.readFeatures;
_ol_format_TopoJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
_ol_format_TopoJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
if (object.type == 'Topology') {
var topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
@@ -303,7 +304,7 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
}
var arcs = topoJSONTopology.arcs;
if (transform) {
ol.format.TopoJSON.transformArcs_(arcs, scale, translate);
_ol_format_TopoJSON_.transformArcs_(arcs, scale, translate);
}
/** @type {Array.<ol.Feature>} */
var features = [];
@@ -318,12 +319,12 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[objectName]);
features.push.apply(features,
ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, property, objectName, opt_options));
} else {
feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[objectName]);
features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
features.push(_ol_format_TopoJSON_.readFeatureFromGeometry_(
feature, arcs, scale, translate, property, objectName, opt_options));
}
}
@@ -343,10 +344,10 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformArcs_ = function(arcs, scale, translate) {
_ol_format_TopoJSON_.transformArcs_ = function(arcs, scale, translate) {
var i, ii;
for (i = 0, ii = arcs.length; i < ii; ++i) {
ol.format.TopoJSON.transformArc_(arcs[i], scale, translate);
_ol_format_TopoJSON_.transformArc_(arcs[i], scale, translate);
}
};
@@ -359,7 +360,7 @@ ol.format.TopoJSON.transformArcs_ = function(arcs, scale, translate) {
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
_ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) {
var x = 0;
var y = 0;
var vertex;
@@ -370,7 +371,7 @@ ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
y += vertex[1];
vertex[0] = x;
vertex[1] = y;
ol.format.TopoJSON.transformVertex_(vertex, scale, translate);
_ol_format_TopoJSON_.transformVertex_(vertex, scale, translate);
}
};
@@ -384,7 +385,7 @@ ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) {
_ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1];
};
@@ -398,13 +399,13 @@ ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) {
* @override
* @api
*/
ol.format.TopoJSON.prototype.readProjection;
_ol_format_TopoJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.TopoJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) {
return this.defaultDataProjection;
};
@@ -414,13 +415,13 @@ ol.format.TopoJSON.prototype.readProjectionFromObject = function(object) {
* @private
* @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): ol.geom.Geometry>}
*/
ol.format.TopoJSON.GEOMETRY_READERS_ = {
'Point': ol.format.TopoJSON.readPointGeometry_,
'LineString': ol.format.TopoJSON.readLineStringGeometry_,
'Polygon': ol.format.TopoJSON.readPolygonGeometry_,
'MultiPoint': ol.format.TopoJSON.readMultiPointGeometry_,
'MultiLineString': ol.format.TopoJSON.readMultiLineStringGeometry_,
'MultiPolygon': ol.format.TopoJSON.readMultiPolygonGeometry_
_ol_format_TopoJSON_.GEOMETRY_READERS_ = {
'Point': _ol_format_TopoJSON_.readPointGeometry_,
'LineString': _ol_format_TopoJSON_.readLineStringGeometry_,
'Polygon': _ol_format_TopoJSON_.readPolygonGeometry_,
'MultiPoint': _ol_format_TopoJSON_.readMultiPointGeometry_,
'MultiLineString': _ol_format_TopoJSON_.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_TopoJSON_.readMultiPolygonGeometry_
};
@@ -428,32 +429,33 @@ ol.format.TopoJSON.GEOMETRY_READERS_ = {
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeFeatureObject = function(feature, opt_options) {};
_ol_format_TopoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeFeaturesObject = function(features, opt_options) {};
_ol_format_TopoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeGeometryObject = function(geometry, opt_options) {};
_ol_format_TopoJSON_.prototype.writeGeometryObject = function(geometry, opt_options) {};
/**
* Not implemented.
* @override
*/
ol.format.TopoJSON.prototype.readGeometryFromObject = function() {};
_ol_format_TopoJSON_.prototype.readGeometryFromObject = function() {};
/**
* Not implemented.
* @override
*/
ol.format.TopoJSON.prototype.readFeatureFromObject = function() {};
_ol_format_TopoJSON_.prototype.readFeatureFromObject = function() {};
export default _ol_format_TopoJSON_;
+247 -245
View File
File diff suppressed because it is too large Load Diff
+168 -165
View File
@@ -1,20 +1,20 @@
goog.provide('ol.format.WKT');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.SimpleGeometry');
/**
* @module ol/format/WKT
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
/**
* @classdesc
@@ -26,11 +26,11 @@ goog.require('ol.geom.SimpleGeometry');
* @param {olx.format.WKTOptions=} opt_options Options.
* @api
*/
ol.format.WKT = function(opt_options) {
var _ol_format_WKT_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* Split GeometryCollection into multiple features.
@@ -41,35 +41,36 @@ ol.format.WKT = function(opt_options) {
options.splitCollection : false;
};
ol.inherits(ol.format.WKT, ol.format.TextFeature);
_ol_.inherits(_ol_format_WKT_, _ol_format_TextFeature_);
/**
* @const
* @type {string}
*/
ol.format.WKT.EMPTY = 'EMPTY';
_ol_format_WKT_.EMPTY = 'EMPTY';
/**
* @const
* @type {string}
*/
ol.format.WKT.Z = 'Z';
_ol_format_WKT_.Z = 'Z';
/**
* @const
* @type {string}
*/
ol.format.WKT.M = 'M';
_ol_format_WKT_.M = 'M';
/**
* @const
* @type {string}
*/
ol.format.WKT.ZM = 'ZM';
_ol_format_WKT_.ZM = 'ZM';
/**
@@ -77,7 +78,7 @@ ol.format.WKT.ZM = 'ZM';
* @return {string} Coordinates part of Point as WKT.
* @private
*/
ol.format.WKT.encodePointGeometry_ = function(geom) {
_ol_format_WKT_.encodePointGeometry_ = function(geom) {
var coordinates = geom.getCoordinates();
if (coordinates.length === 0) {
return '';
@@ -91,11 +92,11 @@ ol.format.WKT.encodePointGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPoint as WKT.
* @private
*/
ol.format.WKT.encodeMultiPointGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) {
var array = [];
var components = geom.getPoints();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodePointGeometry_(components[i]) + ')');
array.push('(' + _ol_format_WKT_.encodePointGeometry_(components[i]) + ')');
}
return array.join(',');
};
@@ -106,11 +107,11 @@ ol.format.WKT.encodeMultiPointGeometry_ = function(geom) {
* @return {string} Coordinates part of GeometryCollection as WKT.
* @private
*/
ol.format.WKT.encodeGeometryCollectionGeometry_ = function(geom) {
_ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) {
var array = [];
var geoms = geom.getGeometries();
for (var i = 0, ii = geoms.length; i < ii; ++i) {
array.push(ol.format.WKT.encode_(geoms[i]));
array.push(_ol_format_WKT_.encode_(geoms[i]));
}
return array.join(',');
};
@@ -121,7 +122,7 @@ ol.format.WKT.encodeGeometryCollectionGeometry_ = function(geom) {
* @return {string} Coordinates part of LineString as WKT.
* @private
*/
ol.format.WKT.encodeLineStringGeometry_ = function(geom) {
_ol_format_WKT_.encodeLineStringGeometry_ = function(geom) {
var coordinates = geom.getCoordinates();
var array = [];
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
@@ -136,11 +137,11 @@ ol.format.WKT.encodeLineStringGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiLineString as WKT.
* @private
*/
ol.format.WKT.encodeMultiLineStringGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) {
var array = [];
var components = geom.getLineStrings();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodeLineStringGeometry_(
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_(
components[i]) + ')');
}
return array.join(',');
@@ -152,11 +153,11 @@ ol.format.WKT.encodeMultiLineStringGeometry_ = function(geom) {
* @return {string} Coordinates part of Polygon as WKT.
* @private
*/
ol.format.WKT.encodePolygonGeometry_ = function(geom) {
_ol_format_WKT_.encodePolygonGeometry_ = function(geom) {
var array = [];
var rings = geom.getLinearRings();
for (var i = 0, ii = rings.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodeLineStringGeometry_(
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_(
rings[i]) + ')');
}
return array.join(',');
@@ -168,11 +169,11 @@ ol.format.WKT.encodePolygonGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPolygon as WKT.
* @private
*/
ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) {
var array = [];
var components = geom.getPolygons();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodePolygonGeometry_(
array.push('(' + _ol_format_WKT_.encodePolygonGeometry_(
components[i]) + ')');
}
return array.join(',');
@@ -183,14 +184,14 @@ ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) {
* @return {string} Potential dimensional information for WKT type.
* @private
*/
ol.format.WKT.encodeGeometryLayout_ = function(geom) {
_ol_format_WKT_.encodeGeometryLayout_ = function(geom) {
var layout = geom.getLayout();
var dimInfo = '';
if (layout === ol.geom.GeometryLayout.XYZ || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.Z;
if (layout === _ol_geom_GeometryLayout_.XYZ || layout === _ol_geom_GeometryLayout_.XYZM) {
dimInfo += _ol_format_WKT_.Z;
}
if (layout === ol.geom.GeometryLayout.XYM || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.M;
if (layout === _ol_geom_GeometryLayout_.XYM || layout === _ol_geom_GeometryLayout_.XYZM) {
dimInfo += _ol_format_WKT_.M;
}
return dimInfo;
};
@@ -202,19 +203,19 @@ ol.format.WKT.encodeGeometryLayout_ = function(geom) {
* @return {string} WKT string for the geometry.
* @private
*/
ol.format.WKT.encode_ = function(geom) {
_ol_format_WKT_.encode_ = function(geom) {
var type = geom.getType();
var geometryEncoder = ol.format.WKT.GeometryEncoder_[type];
var geometryEncoder = _ol_format_WKT_.GeometryEncoder_[type];
var enc = geometryEncoder(geom);
type = type.toUpperCase();
if (geom instanceof ol.geom.SimpleGeometry) {
var dimInfo = ol.format.WKT.encodeGeometryLayout_(geom);
if (geom instanceof _ol_geom_SimpleGeometry_) {
var dimInfo = _ol_format_WKT_.encodeGeometryLayout_(geom);
if (dimInfo.length > 0) {
type += ' ' + dimInfo;
}
}
if (enc.length === 0) {
return type + ' ' + ol.format.WKT.EMPTY;
return type + ' ' + _ol_format_WKT_.EMPTY;
}
return type + '(' + enc + ')';
};
@@ -225,14 +226,14 @@ ol.format.WKT.encode_ = function(geom) {
* @type {Object.<string, function(ol.geom.Geometry): string>}
* @private
*/
ol.format.WKT.GeometryEncoder_ = {
'Point': ol.format.WKT.encodePointGeometry_,
'LineString': ol.format.WKT.encodeLineStringGeometry_,
'Polygon': ol.format.WKT.encodePolygonGeometry_,
'MultiPoint': ol.format.WKT.encodeMultiPointGeometry_,
'MultiLineString': ol.format.WKT.encodeMultiLineStringGeometry_,
'MultiPolygon': ol.format.WKT.encodeMultiPolygonGeometry_,
'GeometryCollection': ol.format.WKT.encodeGeometryCollectionGeometry_
_ol_format_WKT_.GeometryEncoder_ = {
'Point': _ol_format_WKT_.encodePointGeometry_,
'LineString': _ol_format_WKT_.encodeLineStringGeometry_,
'Polygon': _ol_format_WKT_.encodePolygonGeometry_,
'MultiPoint': _ol_format_WKT_.encodeMultiPointGeometry_,
'MultiLineString': _ol_format_WKT_.encodeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_WKT_.encodeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_WKT_.encodeGeometryCollectionGeometry_
};
@@ -243,9 +244,9 @@ ol.format.WKT.GeometryEncoder_ = {
* The geometry created.
* @private
*/
ol.format.WKT.prototype.parse_ = function(wkt) {
var lexer = new ol.format.WKT.Lexer(wkt);
var parser = new ol.format.WKT.Parser(lexer);
_ol_format_WKT_.prototype.parse_ = function(wkt) {
var lexer = new _ol_format_WKT_.Lexer(wkt);
var parser = new _ol_format_WKT_.Parser(lexer);
return parser.parse();
};
@@ -259,16 +260,16 @@ ol.format.WKT.prototype.parse_ = function(wkt) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.WKT.prototype.readFeature;
_ol_format_WKT_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) {
var geom = this.readGeometryFromText(text, opt_options);
if (geom) {
var feature = new ol.Feature();
var feature = new _ol_Feature_();
feature.setGeometry(geom);
return feature;
}
@@ -285,17 +286,17 @@ ol.format.WKT.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.WKT.prototype.readFeatures;
_ol_format_WKT_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) {
var geometries = [];
var geometry = this.readGeometryFromText(text, opt_options);
if (this.splitCollection_ &&
geometry.getType() == ol.geom.GeometryType.GEOMETRY_COLLECTION) {
geometry.getType() == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
geometries = (/** @type {ol.geom.GeometryCollection} */ (geometry))
.getGeometriesArray();
} else {
@@ -303,7 +304,7 @@ ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
}
var feature, features = [];
for (var i = 0, ii = geometries.length; i < ii; ++i) {
feature = new ol.Feature();
feature = new _ol_Feature_();
feature.setGeometry(geometries[i]);
features.push(feature);
}
@@ -320,17 +321,18 @@ ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.WKT.prototype.readGeometry;
_ol_format_WKT_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) {
var geometry = this.parse_(text);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, opt_options)
);
} else {
return null;
}
@@ -346,13 +348,13 @@ ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeFeature;
_ol_format_WKT_.prototype.writeFeature;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeFeatureText = function(feature, opt_options) {
_ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
@@ -370,13 +372,13 @@ ol.format.WKT.prototype.writeFeatureText = function(feature, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeFeatures;
_ol_format_WKT_.prototype.writeFeatures;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
_ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) {
if (features.length == 1) {
return this.writeFeatureText(features[0], opt_options);
}
@@ -384,7 +386,7 @@ ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
for (var i = 0, ii = features.length; i < ii; ++i) {
geometries.push(features[i].getGeometry());
}
var collection = new ol.geom.GeometryCollection(geometries);
var collection = new _ol_geom_GeometryCollection_(geometries);
return this.writeGeometryText(collection, opt_options);
};
@@ -398,15 +400,15 @@ ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeGeometry;
_ol_format_WKT_.prototype.writeGeometry;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
_ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) {
return _ol_format_WKT_.encode_(/** @type {ol.geom.Geometry} */ (
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)));
};
@@ -415,7 +417,7 @@ ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
* @enum {number}
* @private
*/
ol.format.WKT.TokenType_ = {
_ol_format_WKT_.TokenType_ = {
TEXT: 1,
LEFT_PAREN: 2,
RIGHT_PAREN: 3,
@@ -431,7 +433,7 @@ ol.format.WKT.TokenType_ = {
* @constructor
* @protected
*/
ol.format.WKT.Lexer = function(wkt) {
_ol_format_WKT_.Lexer = function(wkt) {
/**
* @type {string}
@@ -451,7 +453,7 @@ ol.format.WKT.Lexer = function(wkt) {
* @return {boolean} Whether the character is alphabetic.
* @private
*/
ol.format.WKT.Lexer.prototype.isAlpha_ = function(c) {
_ol_format_WKT_.Lexer.prototype.isAlpha_ = function(c) {
return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
};
@@ -463,7 +465,7 @@ ol.format.WKT.Lexer.prototype.isAlpha_ = function(c) {
* @return {boolean} Whether the character is numeric.
* @private
*/
ol.format.WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
_ol_format_WKT_.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
var decimal = opt_decimal !== undefined ? opt_decimal : false;
return c >= '0' && c <= '9' || c == '.' && !decimal;
};
@@ -474,7 +476,7 @@ ol.format.WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
* @return {boolean} Whether the character is whitespace.
* @private
*/
ol.format.WKT.Lexer.prototype.isWhiteSpace_ = function(c) {
_ol_format_WKT_.Lexer.prototype.isWhiteSpace_ = function(c) {
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
};
@@ -483,7 +485,7 @@ ol.format.WKT.Lexer.prototype.isWhiteSpace_ = function(c) {
* @return {string} Next string character.
* @private
*/
ol.format.WKT.Lexer.prototype.nextChar_ = function() {
_ol_format_WKT_.Lexer.prototype.nextChar_ = function() {
return this.wkt.charAt(++this.index_);
};
@@ -492,26 +494,26 @@ ol.format.WKT.Lexer.prototype.nextChar_ = function() {
* Fetch and return the next token.
* @return {!ol.WKTToken} Next string token.
*/
ol.format.WKT.Lexer.prototype.nextToken = function() {
_ol_format_WKT_.Lexer.prototype.nextToken = function() {
var c = this.nextChar_();
var token = {position: this.index_, value: c};
if (c == '(') {
token.type = ol.format.WKT.TokenType_.LEFT_PAREN;
token.type = _ol_format_WKT_.TokenType_.LEFT_PAREN;
} else if (c == ',') {
token.type = ol.format.WKT.TokenType_.COMMA;
token.type = _ol_format_WKT_.TokenType_.COMMA;
} else if (c == ')') {
token.type = ol.format.WKT.TokenType_.RIGHT_PAREN;
token.type = _ol_format_WKT_.TokenType_.RIGHT_PAREN;
} else if (this.isNumeric_(c) || c == '-') {
token.type = ol.format.WKT.TokenType_.NUMBER;
token.type = _ol_format_WKT_.TokenType_.NUMBER;
token.value = this.readNumber_();
} else if (this.isAlpha_(c)) {
token.type = ol.format.WKT.TokenType_.TEXT;
token.type = _ol_format_WKT_.TokenType_.TEXT;
token.value = this.readText_();
} else if (this.isWhiteSpace_(c)) {
return this.nextToken();
} else if (c === '') {
token.type = ol.format.WKT.TokenType_.EOF;
token.type = _ol_format_WKT_.TokenType_.EOF;
} else {
throw new Error('Unexpected character: ' + c);
}
@@ -524,7 +526,7 @@ ol.format.WKT.Lexer.prototype.nextToken = function() {
* @return {number} Numeric token value.
* @private
*/
ol.format.WKT.Lexer.prototype.readNumber_ = function() {
_ol_format_WKT_.Lexer.prototype.readNumber_ = function() {
var c, index = this.index_;
var decimal = false;
var scientificNotation = false;
@@ -552,7 +554,7 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() {
* @return {string} String token value.
* @private
*/
ol.format.WKT.Lexer.prototype.readText_ = function() {
_ol_format_WKT_.Lexer.prototype.readText_ = function() {
var c, index = this.index_;
do {
c = this.nextChar_();
@@ -567,7 +569,7 @@ ol.format.WKT.Lexer.prototype.readText_ = function() {
* @constructor
* @protected
*/
ol.format.WKT.Parser = function(lexer) {
_ol_format_WKT_.Parser = function(lexer) {
/**
* @type {ol.format.WKT.Lexer}
@@ -585,7 +587,7 @@ ol.format.WKT.Parser = function(lexer) {
* @type {ol.geom.GeometryLayout}
* @private
*/
this.layout_ = ol.geom.GeometryLayout.XY;
this.layout_ = _ol_geom_GeometryLayout_.XY;
};
@@ -593,7 +595,7 @@ ol.format.WKT.Parser = function(lexer) {
* Fetch the next token form the lexer and replace the active token.
* @private
*/
ol.format.WKT.Parser.prototype.consume_ = function() {
_ol_format_WKT_.Parser.prototype.consume_ = function() {
this.token_ = this.lexer_.nextToken();
};
@@ -602,7 +604,7 @@ ol.format.WKT.Parser.prototype.consume_ = function() {
* @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.isTokenType = function(type) {
_ol_format_WKT_.Parser.prototype.isTokenType = function(type) {
var isMatch = this.token_.type == type;
return isMatch;
};
@@ -613,7 +615,7 @@ ol.format.WKT.Parser.prototype.isTokenType = function(type) {
* @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.match = function(type) {
_ol_format_WKT_.Parser.prototype.match = function(type) {
var isMatch = this.isTokenType(type);
if (isMatch) {
this.consume_();
@@ -626,7 +628,7 @@ ol.format.WKT.Parser.prototype.match = function(type) {
* Try to parse the tokens provided by the lexer.
* @return {ol.geom.Geometry} The geometry.
*/
ol.format.WKT.Parser.prototype.parse = function() {
_ol_format_WKT_.Parser.prototype.parse = function() {
this.consume_();
var geometry = this.parseGeometry_();
return geometry;
@@ -638,19 +640,19 @@ ol.format.WKT.Parser.prototype.parse = function() {
* @return {ol.geom.GeometryLayout} The layout.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometryLayout_ = function() {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() {
var layout = _ol_geom_GeometryLayout_.XY;
var dimToken = this.token_;
if (this.isTokenType(ol.format.WKT.TokenType_.TEXT)) {
if (this.isTokenType(_ol_format_WKT_.TokenType_.TEXT)) {
var dimInfo = dimToken.value;
if (dimInfo === ol.format.WKT.Z) {
layout = ol.geom.GeometryLayout.XYZ;
} else if (dimInfo === ol.format.WKT.M) {
layout = ol.geom.GeometryLayout.XYM;
} else if (dimInfo === ol.format.WKT.ZM) {
layout = ol.geom.GeometryLayout.XYZM;
if (dimInfo === _ol_format_WKT_.Z) {
layout = _ol_geom_GeometryLayout_.XYZ;
} else if (dimInfo === _ol_format_WKT_.M) {
layout = _ol_geom_GeometryLayout_.XYM;
} else if (dimInfo === _ol_format_WKT_.ZM) {
layout = _ol_geom_GeometryLayout_.XYZM;
}
if (layout !== ol.geom.GeometryLayout.XY) {
if (layout !== _ol_geom_GeometryLayout_.XY) {
this.consume_();
}
}
@@ -662,17 +664,17 @@ ol.format.WKT.Parser.prototype.parseGeometryLayout_ = function() {
* @return {!ol.geom.Geometry} The geometry.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
_ol_format_WKT_.Parser.prototype.parseGeometry_ = function() {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType_.TEXT)) {
if (this.match(_ol_format_WKT_.TokenType_.TEXT)) {
var geomType = token.value;
this.layout_ = this.parseGeometryLayout_();
if (geomType == ol.geom.GeometryType.GEOMETRY_COLLECTION.toUpperCase()) {
if (geomType == _ol_geom_GeometryType_.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_();
return new ol.geom.GeometryCollection(geometries);
return new _ol_geom_GeometryCollection_(geometries);
} else {
var parser = ol.format.WKT.Parser.GeometryParser_[geomType];
var ctor = ol.format.WKT.Parser.GeometryConstructor_[geomType];
var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType];
var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType];
if (!parser || !ctor) {
throw new Error('Invalid geometry type: ' + geomType);
}
@@ -688,13 +690,13 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
* @return {!Array.<ol.geom.Geometry>} A collection of geometries.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var geometries = [];
do {
geometries.push(this.parseGeometry_());
} while (this.match(ol.format.WKT.TokenType_.COMMA));
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
} while (this.match(_ol_format_WKT_.TokenType_.COMMA));
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return geometries;
}
} else if (this.isEmptyGeometry_()) {
@@ -708,10 +710,10 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
* @return {Array.<number>} All values in a point.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parsePointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePoint_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -725,10 +727,10 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a linestring.
* @private
*/
ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePointList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -742,10 +744,10 @@ ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a polygon.
* @private
*/
ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -759,15 +761,15 @@ ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a multipoint.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates;
if (this.token_.type == ol.format.WKT.TokenType_.LEFT_PAREN) {
if (this.token_.type == _ol_format_WKT_.TokenType_.LEFT_PAREN) {
coordinates = this.parsePointTextList_();
} else {
coordinates = this.parsePointList_();
}
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -782,10 +784,10 @@ ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
* in a multilinestring.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -799,10 +801,10 @@ ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All polygon points in a multipolygon.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePolygonTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -816,12 +818,12 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
* @return {!Array.<number>} A point.
* @private
*/
ol.format.WKT.Parser.prototype.parsePoint_ = function() {
_ol_format_WKT_.Parser.prototype.parsePoint_ = function() {
var coordinates = [];
var dimensions = this.layout_.length;
for (var i = 0; i < dimensions; ++i) {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType_.NUMBER)) {
if (this.match(_ol_format_WKT_.TokenType_.NUMBER)) {
coordinates.push(token.value);
} else {
break;
@@ -838,9 +840,9 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePointList_ = function() {
var coordinates = [this.parsePoint_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePoint_());
}
return coordinates;
@@ -851,9 +853,9 @@ ol.format.WKT.Parser.prototype.parsePointList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() {
var coordinates = [this.parsePointText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePointText_());
}
return coordinates;
@@ -864,9 +866,9 @@ ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() {
var coordinates = [this.parseLineStringText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parseLineStringText_());
}
return coordinates;
@@ -877,9 +879,9 @@ ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() {
var coordinates = [this.parsePolygonText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePolygonText_());
}
return coordinates;
@@ -890,9 +892,9 @@ ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
* @return {boolean} Whether the token implies an empty geometry.
* @private
*/
ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.isTokenType(ol.format.WKT.TokenType_.TEXT) &&
this.token_.value == ol.format.WKT.EMPTY;
_ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.isTokenType(_ol_format_WKT_.TokenType_.TEXT) &&
this.token_.value == _ol_format_WKT_.EMPTY;
if (isEmpty) {
this.consume_();
}
@@ -905,7 +907,7 @@ ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
* @return {string} Error message.
* @private
*/
ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
_ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() {
return 'Unexpected `' + this.token_.value + '` at position ' +
this.token_.position + ' in `' + this.lexer_.wkt + '`';
};
@@ -915,13 +917,13 @@ ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
* @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout)}
* @private
*/
ol.format.WKT.Parser.GeometryConstructor_ = {
'POINT': ol.geom.Point,
'LINESTRING': ol.geom.LineString,
'POLYGON': ol.geom.Polygon,
'MULTIPOINT': ol.geom.MultiPoint,
'MULTILINESTRING': ol.geom.MultiLineString,
'MULTIPOLYGON': ol.geom.MultiPolygon
_ol_format_WKT_.Parser.GeometryConstructor_ = {
'POINT': _ol_geom_Point_,
'LINESTRING': _ol_geom_LineString_,
'POLYGON': _ol_geom_Polygon_,
'MULTIPOINT': _ol_geom_MultiPoint_,
'MULTILINESTRING': _ol_geom_MultiLineString_,
'MULTIPOLYGON': _ol_geom_MultiPolygon_
};
@@ -929,11 +931,12 @@ ol.format.WKT.Parser.GeometryConstructor_ = {
* @enum {(function(): Array)}
* @private
*/
ol.format.WKT.Parser.GeometryParser_ = {
'POINT': ol.format.WKT.Parser.prototype.parsePointText_,
'LINESTRING': ol.format.WKT.Parser.prototype.parseLineStringText_,
'POLYGON': ol.format.WKT.Parser.prototype.parsePolygonText_,
'MULTIPOINT': ol.format.WKT.Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': ol.format.WKT.Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': ol.format.WKT.Parser.prototype.parseMultiPolygonText_
_ol_format_WKT_.Parser.GeometryParser_ = {
'POINT': _ol_format_WKT_.Parser.prototype.parsePointText_,
'LINESTRING': _ol_format_WKT_.Parser.prototype.parseLineStringText_,
'POLYGON': _ol_format_WKT_.Parser.prototype.parsePolygonText_,
'MULTIPOINT': _ol_format_WKT_.Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_
};
export default _ol_format_WKT_;
+254 -252
View File
@@ -1,11 +1,11 @@
goog.provide('ol.format.WMSCapabilities');
goog.require('ol');
goog.require('ol.format.XLink');
goog.require('ol.format.XML');
goog.require('ol.format.XSD');
goog.require('ol.xml');
/**
* @module ol/format/WMSCapabilities
*/
import _ol_ from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -15,16 +15,17 @@ goog.require('ol.xml');
* @extends {ol.format.XML}
* @api
*/
ol.format.WMSCapabilities = function() {
var _ol_format_WMSCapabilities_ = function() {
ol.format.XML.call(this);
_ol_format_XML_.call(this);
/**
* @type {string|undefined}
*/
this.version = undefined;
};
ol.inherits(ol.format.WMSCapabilities, ol.format.XML);
_ol_.inherits(_ol_format_WMSCapabilities_, _ol_format_XML_);
/**
@@ -35,13 +36,13 @@ ol.inherits(ol.format.WMSCapabilities, ol.format.XML);
* @return {Object} An object representing the WMS capabilities.
* @api
*/
ol.format.WMSCapabilities.prototype.read;
_ol_format_WMSCapabilities_.prototype.read;
/**
* @inheritDoc
*/
ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
_ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
@@ -54,11 +55,11 @@ ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
/**
* @inheritDoc
*/
ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
_ol_format_WMSCapabilities_.prototype.readFromNode = function(node) {
this.version = node.getAttribute('version').trim();
var wmsCapabilityObject = ol.xml.pushParseAndPop({
var wmsCapabilityObject = _ol_xml_.pushParseAndPop({
'version': this.version
}, ol.format.WMSCapabilities.PARSERS_, node, []);
}, _ol_format_WMSCapabilities_.PARSERS_, node, []);
return wmsCapabilityObject ? wmsCapabilityObject : null;
};
@@ -69,9 +70,9 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object.
*/
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readAttribution_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_, node, objectStack);
};
@@ -81,17 +82,17 @@ ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object} Bounding box object.
*/
ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) {
var extent = [
ol.format.XSD.readDecimalString(node.getAttribute('minx')),
ol.format.XSD.readDecimalString(node.getAttribute('miny')),
ol.format.XSD.readDecimalString(node.getAttribute('maxx')),
ol.format.XSD.readDecimalString(node.getAttribute('maxy'))
_ol_format_XSD_.readDecimalString(node.getAttribute('minx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('miny')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxy'))
];
var resolutions = [
ol.format.XSD.readDecimalString(node.getAttribute('resx')),
ol.format.XSD.readDecimalString(node.getAttribute('resy'))
_ol_format_XSD_.readDecimalString(node.getAttribute('resx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('resy'))
];
return {
@@ -108,10 +109,10 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.Extent|undefined} Bounding box object.
*/
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = ol.xml.pushParseAndPop(
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = _ol_xml_.pushParseAndPop(
{},
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack);
if (!geographicBoundingBox) {
return undefined;
@@ -141,9 +142,9 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
* @private
* @return {Object|undefined} Capability object.
*/
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readCapability_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CAPABILITY_PARSERS_, node, objectStack);
};
@@ -153,9 +154,9 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Service object.
*/
ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readService_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.SERVICE_PARSERS_, node, objectStack);
};
@@ -165,9 +166,9 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Contact information object.
*/
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
_ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_,
node, objectStack);
};
@@ -178,9 +179,9 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack)
* @private
* @return {Object|undefined} Contact person object.
*/
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
_ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_,
node, objectStack);
};
@@ -191,9 +192,9 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack
* @private
* @return {Object|undefined} Contact address object.
*/
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
_ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_,
node, objectStack);
};
@@ -204,9 +205,9 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
* @private
* @return {Array.<string>|undefined} Format array.
*/
ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readException_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
[], _ol_format_WMSCapabilities_.EXCEPTION_PARSERS_, node, objectStack);
};
@@ -216,9 +217,9 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Layer object.
*/
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readCapabilityLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack);
};
@@ -228,52 +229,52 @@ ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Layer object.
*/
ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) {
var parentLayerObject = /** @type {Object.<string,*>} */
(objectStack[objectStack.length - 1]);
var layerObject = ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
var layerObject = _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack);
if (!layerObject) {
return undefined;
}
var queryable =
ol.format.XSD.readBooleanString(node.getAttribute('queryable'));
_ol_format_XSD_.readBooleanString(node.getAttribute('queryable'));
if (queryable === undefined) {
queryable = parentLayerObject['queryable'];
}
layerObject['queryable'] = queryable !== undefined ? queryable : false;
var cascaded = ol.format.XSD.readNonNegativeIntegerString(
var cascaded = _ol_format_XSD_.readNonNegativeIntegerString(
node.getAttribute('cascaded'));
if (cascaded === undefined) {
cascaded = parentLayerObject['cascaded'];
}
layerObject['cascaded'] = cascaded;
var opaque = ol.format.XSD.readBooleanString(node.getAttribute('opaque'));
var opaque = _ol_format_XSD_.readBooleanString(node.getAttribute('opaque'));
if (opaque === undefined) {
opaque = parentLayerObject['opaque'];
}
layerObject['opaque'] = opaque !== undefined ? opaque : false;
var noSubsets =
ol.format.XSD.readBooleanString(node.getAttribute('noSubsets'));
_ol_format_XSD_.readBooleanString(node.getAttribute('noSubsets'));
if (noSubsets === undefined) {
noSubsets = parentLayerObject['noSubsets'];
}
layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;
var fixedWidth =
ol.format.XSD.readDecimalString(node.getAttribute('fixedWidth'));
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedWidth'));
if (!fixedWidth) {
fixedWidth = parentLayerObject['fixedWidth'];
}
layerObject['fixedWidth'] = fixedWidth;
var fixedHeight =
ol.format.XSD.readDecimalString(node.getAttribute('fixedHeight'));
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedHeight'));
if (!fixedHeight) {
fixedHeight = parentLayerObject['fixedHeight'];
}
@@ -307,18 +308,18 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object} Dimension object.
*/
ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) {
var dimensionObject = {
'name': node.getAttribute('name'),
'units': node.getAttribute('units'),
'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'),
'multipleValues': ol.format.XSD.readBooleanString(
'multipleValues': _ol_format_XSD_.readBooleanString(
node.getAttribute('multipleValues')),
'nearestValue': ol.format.XSD.readBooleanString(
'nearestValue': _ol_format_XSD_.readBooleanString(
node.getAttribute('nearestValue')),
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
'values': ol.format.XSD.readString(node)
'current': _ol_format_XSD_.readBooleanString(node.getAttribute('current')),
'values': _ol_format_XSD_.readString(node)
};
return dimensionObject;
};
@@ -330,9 +331,9 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
_ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack);
};
@@ -343,9 +344,9 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Request object.
*/
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readRequest_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.REQUEST_PARSERS_, node, objectStack);
};
@@ -355,9 +356,9 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} DCP type object.
*/
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readDCPType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.DCPTYPE_PARSERS_, node, objectStack);
};
@@ -367,9 +368,9 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} HTTP object.
*/
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readHTTP_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.HTTP_PARSERS_, node, objectStack);
};
@@ -379,9 +380,9 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Operation type object.
*/
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readOperationType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_, node, objectStack);
};
@@ -391,13 +392,13 @@ ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, objectStack) {
var formatOnlineresource =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (formatOnlineresource) {
var size = [
ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('width')),
ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('height'))
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('width')),
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('height'))
];
formatOnlineresource['size'] = size;
return formatOnlineresource;
@@ -412,9 +413,9 @@ ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, object
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Authority URL object.
*/
ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) {
var authorityObject =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (authorityObject) {
authorityObject['name'] = node.getAttribute('name');
return authorityObject;
@@ -429,9 +430,9 @@ ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Metadata URL object.
*/
ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) {
var metadataObject =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (metadataObject) {
metadataObject['type'] = node.getAttribute('type');
return metadataObject;
@@ -446,9 +447,9 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Style object.
*/
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readStyle_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.STYLE_PARSERS_, node, objectStack);
};
@@ -458,9 +459,9 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Keyword list.
*/
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readKeywordList_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
[], _ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_, node, objectStack);
};
@@ -469,7 +470,7 @@ ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
* @private
* @type {Array.<string>}
*/
ol.format.WMSCapabilities.NAMESPACE_URIS_ = [
_ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/wms'
];
@@ -480,12 +481,12 @@ ol.format.WMSCapabilities.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Service': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readService_),
'Capability': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readCapability_)
_ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Service': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readService_),
'Capability': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapability_)
});
@@ -494,14 +495,14 @@ ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Request': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readRequest_),
'Exception': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readException_),
'Layer': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readCapabilityLayer_)
_ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Request': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readRequest_),
'Exception': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readException_),
'Layer': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapabilityLayer_)
});
@@ -510,26 +511,26 @@ ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'KeywordList': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readKeywordList_),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref),
'ContactInformation': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactInformation_),
'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AccessConstraints': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'LayerLimit': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxWidth': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxHeight': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger)
_ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref),
'ContactInformation': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactInformation_),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'LayerLimit': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger)
});
@@ -538,20 +539,20 @@ ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'ContactPersonPrimary': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactPersonPrimary_),
'ContactPosition': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactAddress': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactAddress_),
'ContactVoiceTelephone': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactFacsimileTelephone': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactElectronicMailAddress': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactPersonPrimary_),
'ContactPosition': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactAddress_),
'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -560,12 +561,12 @@ ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'ContactPerson': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactOrganization': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'ContactPerson': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactOrganization': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -574,15 +575,15 @@ ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'AddressType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'StateOrProvince': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PostCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'AddressType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'StateOrProvince': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PostCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -591,9 +592,9 @@ ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeArrayPusher(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString)
});
@@ -602,39 +603,39 @@ ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'KeywordList': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readKeywordList_),
'CRS': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'EX_GeographicBoundingBox': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readEXGeographicBoundingBox_),
'BoundingBox': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readBoundingBox_),
'Dimension': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readDimension_),
'Attribution': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readAttribution_),
'AuthorityURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readAuthorityURL_),
'Identifier': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'MetadataURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readMetadataURL_),
'DataURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'FeatureListURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'Style': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readStyle_),
'MinScaleDenominator': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'MaxScaleDenominator': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'Layer': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readLayer_)
_ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_),
'CRS': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_),
'BoundingBox': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readBoundingBox_),
'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDimension_),
'Attribution': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readAttribution_),
'AuthorityURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readAuthorityURL_),
'Identifier': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'MetadataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readMetadataURL_),
'DataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'FeatureListURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readStyle_),
'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readLayer_)
});
@@ -643,13 +644,13 @@ ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref),
'LogoURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readSizedFormatOnlineresource_)
_ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref),
'LogoURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_)
});
@@ -658,16 +659,16 @@ ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'westBoundLongitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'eastBoundLongitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'southBoundLatitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'northBoundLatitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal)
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'westBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'southBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'northBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal)
});
@@ -676,14 +677,14 @@ ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'GetCapabilities': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_),
'GetMap': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_),
'GetFeatureInfo': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_)
_ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'GetCapabilities': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_),
'GetMap': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_),
'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_)
});
@@ -692,11 +693,11 @@ ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'DCPType': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readDCPType_)
_ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'DCPType': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDCPType_)
});
@@ -705,10 +706,10 @@ ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'HTTP': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readHTTP_)
_ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readHTTP_)
});
@@ -717,12 +718,12 @@ ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Get': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'Post': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_)
_ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'Post': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_)
});
@@ -731,17 +732,17 @@ ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'LegendURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readSizedFormatOnlineresource_),
'StyleSheetURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'StyleURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_)
_ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_),
'StyleSheetURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'StyleURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_)
});
@@ -750,11 +751,11 @@ ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref)
_ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref)
});
@@ -763,7 +764,8 @@ ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Keyword': ol.xml.makeArrayPusher(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Keyword': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString)
});
export default _ol_format_WMSCapabilities_;
+34 -32
View File
@@ -1,12 +1,12 @@
goog.provide('ol.format.WMSGetFeatureInfo');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.format.GML2');
goog.require('ol.format.XMLFeature');
goog.require('ol.obj');
goog.require('ol.xml');
/**
* @module ol/format/WMSGetFeatureInfo
*/
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_format_GML2_ from '../format/GML2.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_obj_ from '../obj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -18,7 +18,7 @@ goog.require('ol.xml');
* @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
* @api
*/
ol.format.WMSGetFeatureInfo = function(opt_options) {
var _ol_format_WMSGetFeatureInfo_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -33,7 +33,7 @@ ol.format.WMSGetFeatureInfo = function(opt_options) {
* @private
* @type {ol.format.GML2}
*/
this.gmlFormat_ = new ol.format.GML2();
this.gmlFormat_ = new _ol_format_GML2_();
/**
@@ -42,9 +42,10 @@ ol.format.WMSGetFeatureInfo = function(opt_options) {
*/
this.layers_ = options.layers ? options.layers : null;
ol.format.XMLFeature.call(this);
_ol_format_XMLFeature_.call(this);
};
ol.inherits(ol.format.WMSGetFeatureInfo, ol.format.XMLFeature);
_ol_.inherits(_ol_format_WMSGetFeatureInfo_, _ol_format_XMLFeature_);
/**
@@ -52,7 +53,7 @@ ol.inherits(ol.format.WMSGetFeatureInfo, ol.format.XMLFeature);
* @type {string}
* @private
*/
ol.format.WMSGetFeatureInfo.featureIdentifier_ = '_feature';
_ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature';
/**
@@ -60,13 +61,13 @@ ol.format.WMSGetFeatureInfo.featureIdentifier_ = '_feature';
* @type {string}
* @private
*/
ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer';
_ol_format_WMSGetFeatureInfo_.layerIdentifier_ = '_layer';
/**
* @return {Array.<string>} layers
*/
ol.format.WMSGetFeatureInfo.prototype.getLayers = function() {
_ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() {
return this.layers_;
};
@@ -74,7 +75,7 @@ ol.format.WMSGetFeatureInfo.prototype.getLayers = function() {
/**
* @param {Array.<string>} layers Layers to parse.
*/
ol.format.WMSGetFeatureInfo.prototype.setLayers = function(layers) {
_ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) {
this.layers_ = layers;
};
@@ -85,7 +86,7 @@ ol.format.WMSGetFeatureInfo.prototype.setLayers = function(layers) {
* @return {Array.<ol.Feature>} Features.
* @private
*/
ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectStack) {
node.setAttribute('namespaceURI', this.featureNS_);
var localName = node.localName;
/** @type {Array.<ol.Feature>} */
@@ -101,34 +102,34 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack
}
var context = objectStack[0];
var toRemove = ol.format.WMSGetFeatureInfo.layerIdentifier_;
var toRemove = _ol_format_WMSGetFeatureInfo_.layerIdentifier_;
var layerName = layer.localName.replace(toRemove, '');
if (this.layers_ && !ol.array.includes(this.layers_, layerName)) {
if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) {
continue;
}
var featureType = layerName +
ol.format.WMSGetFeatureInfo.featureIdentifier_;
_ol_format_WMSGetFeatureInfo_.featureIdentifier_;
context['featureType'] = featureType;
context['featureNS'] = this.featureNS_;
var parsers = {};
parsers[featureType] = ol.xml.makeArrayPusher(
parsers[featureType] = _ol_xml_.makeArrayPusher(
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
var parsersNS = ol.xml.makeStructureNS(
var parsersNS = _ol_xml_.makeStructureNS(
[context['featureNS'], null], parsers);
layer.setAttribute('namespaceURI', this.featureNS_);
var layerFeatures = ol.xml.pushParseAndPop(
var layerFeatures = _ol_xml_.pushParseAndPop(
[], parsersNS, layer, objectStack, this.gmlFormat_);
if (layerFeatures) {
ol.array.extend(features, layerFeatures);
_ol_array_.extend(features, layerFeatures);
}
}
}
if (localName == 'FeatureCollection') {
var gmlFeatures = ol.xml.pushParseAndPop([],
var gmlFeatures = _ol_xml_.pushParseAndPop([],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
[{}], this.gmlFormat_);
if (gmlFeatures) {
@@ -148,16 +149,16 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.WMSGetFeatureInfo.prototype.readFeatures;
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = {};
if (opt_options) {
ol.obj.assign(options, this.getReadOptions(node, opt_options));
_ol_obj_.assign(options, this.getReadOptions(node, opt_options));
}
return this.readFeatures_(node, [options]);
};
@@ -167,18 +168,19 @@ ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_
* Not implemented.
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.writeFeatureNode = function(feature, opt_options) {};
_ol_format_WMSGetFeatureInfo_.prototype.writeFeatureNode = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.writeFeaturesNode = function(features, opt_options) {};
_ol_format_WMSGetFeatureInfo_.prototype.writeFeaturesNode = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.writeGeometryNode = function(geometry, opt_options) {};
_ol_format_WMSGetFeatureInfo_.prototype.writeGeometryNode = function(geometry, opt_options) {};
export default _ol_format_WMSGetFeatureInfo_;
+164 -162
View File
@@ -1,13 +1,13 @@
goog.provide('ol.format.WMTSCapabilities');
goog.require('ol');
goog.require('ol.extent');
goog.require('ol.format.OWS');
goog.require('ol.format.XLink');
goog.require('ol.format.XML');
goog.require('ol.format.XSD');
goog.require('ol.xml');
/**
* @module ol/format/WMTSCapabilities
*/
import _ol_ from '../index.js';
import _ol_extent_ from '../extent.js';
import _ol_format_OWS_ from '../format/OWS.js';
import _ol_format_XLink_ from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -17,16 +17,17 @@ goog.require('ol.xml');
* @extends {ol.format.XML}
* @api
*/
ol.format.WMTSCapabilities = function() {
ol.format.XML.call(this);
var _ol_format_WMTSCapabilities_ = function() {
_ol_format_XML_.call(this);
/**
* @type {ol.format.OWS}
* @private
*/
this.owsParser_ = new ol.format.OWS();
this.owsParser_ = new _ol_format_OWS_();
};
ol.inherits(ol.format.WMTSCapabilities, ol.format.XML);
_ol_.inherits(_ol_format_WMTSCapabilities_, _ol_format_XML_);
/**
@@ -37,13 +38,13 @@ ol.inherits(ol.format.WMTSCapabilities, ol.format.XML);
* @return {Object} An object representing the WMTS capabilities.
* @api
*/
ol.format.WMTSCapabilities.prototype.read;
_ol_format_WMTSCapabilities_.prototype.read;
/**
* @inheritDoc
*/
ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {
_ol_format_WMTSCapabilities_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
@@ -56,15 +57,15 @@ ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {
/**
* @inheritDoc
*/
ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
_ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) {
var version = node.getAttribute('version').trim();
var WMTSCapabilityObject = this.owsParser_.readFromNode(node);
if (!WMTSCapabilityObject) {
return null;
}
WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,
ol.format.WMTSCapabilities.PARSERS_, node, []);
WMTSCapabilityObject = _ol_xml_.pushParseAndPop(WMTSCapabilityObject,
_ol_format_WMTSCapabilities_.PARSERS_, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
};
@@ -75,9 +76,9 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object.
*/
ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readContents_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_, node, objectStack);
};
@@ -87,9 +88,9 @@ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Layers object.
*/
ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.LAYER_PARSERS_, node, objectStack);
};
@@ -99,9 +100,9 @@ ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set object.
*/
ol.format.WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.TMS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readTileMatrixSet_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_PARSERS_, node, objectStack);
};
@@ -111,9 +112,9 @@ ol.format.WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Style object.
*/
ol.format.WMTSCapabilities.readStyle_ = function(node, objectStack) {
var style = ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.STYLE_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readStyle_ = function(node, objectStack) {
var style = _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.STYLE_PARSERS_, node, objectStack);
if (!style) {
return undefined;
}
@@ -130,10 +131,10 @@ ol.format.WMTSCapabilities.readStyle_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set Link object.
*/
ol.format.WMTSCapabilities.readTileMatrixSetLink_ = function(node,
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_, node, objectStack);
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_, node, objectStack);
};
@@ -143,9 +144,9 @@ ol.format.WMTSCapabilities.readTileMatrixSetLink_ = function(node,
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Dimension object.
*/
ol.format.WMTSCapabilities.readDimensions_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.DIMENSION_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readDimensions_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_, node, objectStack);
};
@@ -155,7 +156,7 @@ ol.format.WMTSCapabilities.readDimensions_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Resource URL object.
*/
ol.format.WMTSCapabilities.readResourceUrl_ = function(node, objectStack) {
_ol_format_WMTSCapabilities_.readResourceUrl_ = function(node, objectStack) {
var format = node.getAttribute('format');
var template = node.getAttribute('template');
var resourceType = node.getAttribute('resourceType');
@@ -179,13 +180,13 @@ ol.format.WMTSCapabilities.readResourceUrl_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} WGS84 BBox object.
*/
ol.format.WMTSCapabilities.readWgs84BoundingBox_ = function(node, objectStack) {
var coordinates = ol.xml.pushParseAndPop([],
ol.format.WMTSCapabilities.WGS84_BBOX_READERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack) {
var coordinates = _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_, node, objectStack);
if (coordinates.length != 2) {
return undefined;
}
return ol.extent.boundingExtent(coordinates);
return _ol_extent_.boundingExtent(coordinates);
};
@@ -195,10 +196,10 @@ ol.format.WMTSCapabilities.readWgs84BoundingBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Legend object.
*/
ol.format.WMTSCapabilities.readLegendUrl_ = function(node, objectStack) {
_ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
var legend = {};
legend['format'] = node.getAttribute('format');
legend['href'] = ol.format.XLink.readHref(node);
legend['href'] = _ol_format_XLink_.readHref(node);
return legend;
};
@@ -209,8 +210,8 @@ ol.format.WMTSCapabilities.readLegendUrl_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Coordinates object.
*/
ol.format.WMTSCapabilities.readCoordinates_ = function(node, objectStack) {
var coordinates = ol.format.XSD.readString(node).split(' ');
_ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) {
var coordinates = _ol_format_XSD_.readString(node).split(' ');
if (!coordinates || coordinates.length != 2) {
return undefined;
}
@@ -229,9 +230,9 @@ ol.format.WMTSCapabilities.readCoordinates_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrix object.
*/
ol.format.WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.TM_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readTileMatrix_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TM_PARSERS_, node, objectStack);
};
@@ -241,10 +242,10 @@ ol.format.WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixSetLimits Object.
*/
ol.format.WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop([],
ol.format.WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_, node,
return _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_, node,
objectStack);
};
@@ -255,9 +256,9 @@ ol.format.WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixLimits Array.
*/
ol.format.WMTSCapabilities.readTileMatrixLimits_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.TMS_LIMITS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.readTileMatrixLimits_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_, node, objectStack);
};
@@ -266,7 +267,7 @@ ol.format.WMTSCapabilities.readTileMatrixLimits_ = function(node, objectStack) {
* @private
* @type {Array.<string>}
*/
ol.format.WMTSCapabilities.NAMESPACE_URIS_ = [
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/wmts/1.0'
];
@@ -277,7 +278,7 @@ ol.format.WMTSCapabilities.NAMESPACE_URIS_ = [
* @private
* @type {Array.<string>}
*/
ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_ = [
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/ows/1.1'
];
@@ -288,10 +289,10 @@ ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'Contents': ol.xml.makeObjectPropertySetter(
ol.format.WMTSCapabilities.readContents_)
_ol_format_WMTSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Contents': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readContents_)
});
@@ -300,12 +301,12 @@ ol.format.WMTSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.CONTENTS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'Layer': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readLayer_),
'TileMatrixSet': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readTileMatrixSet_)
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLayer_),
'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSet_)
});
@@ -314,27 +315,27 @@ ol.format.WMTSCapabilities.CONTENTS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'Style': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readStyle_),
'Format': ol.xml.makeObjectPropertyPusher(
ol.format.XSD.readString),
'TileMatrixSetLink': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readTileMatrixSetLink_),
'Dimension': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readDimensions_),
'ResourceURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readResourceUrl_)
}, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'WGS84BoundingBox': ol.xml.makeObjectPropertySetter(
ol.format.WMTSCapabilities.readWgs84BoundingBox_),
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readStyle_),
'Format': _ol_xml_.makeObjectPropertyPusher(
_ol_format_XSD_.readString),
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_),
'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readDimensions_),
'ResourceURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readResourceUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_),
'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
}));
@@ -343,15 +344,15 @@ ol.format.WMTSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'LegendURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readLegendUrl_)
}, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLegendUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
}));
@@ -360,12 +361,12 @@ ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixSet': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'TileMatrixSetLimits': ol.xml.makeObjectPropertySetter(
ol.format.WMTSCapabilities.readTileMatrixLimitsList_)
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_)
});
/**
@@ -373,10 +374,10 @@ ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixLimits': ol.xml.makeArrayPusher(
ol.format.WMTSCapabilities.readTileMatrixLimits_)
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixLimits': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readTileMatrixLimits_)
});
@@ -385,18 +386,18 @@ ol.format.WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LIMITS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrix': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'MinTileRow': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxTileRow': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MinTileCol': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxTileCol': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger)
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrix': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'MinTileRow': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxTileRow': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MinTileCol': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxTileCol': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger)
});
@@ -405,15 +406,15 @@ ol.format.WMTSCapabilities.TMS_LIMITS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.DIMENSION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'Default': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'Value': ol.xml.makeObjectPropertyPusher(
ol.format.XSD.readString)
}, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Default': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'Value': _ol_xml_.makeObjectPropertyPusher(
_ol_format_XSD_.readString)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
}));
@@ -422,12 +423,12 @@ ol.format.WMTSCapabilities.DIMENSION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.WGS84_BBOX_READERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'LowerCorner': ol.xml.makeArrayPusher(
ol.format.WMTSCapabilities.readCoordinates_),
'UpperCorner': ol.xml.makeArrayPusher(
ol.format.WMTSCapabilities.readCoordinates_)
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'LowerCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_),
'UpperCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_)
});
@@ -436,17 +437,17 @@ ol.format.WMTSCapabilities.WGS84_BBOX_READERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'WellKnownScaleSet': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'TileMatrix': ol.xml.makeObjectPropertyPusher(
ol.format.WMTSCapabilities.readTileMatrix_)
}, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'SupportedCRS': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrix_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
}));
@@ -455,21 +456,22 @@ ol.format.WMTSCapabilities.TMS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TM_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TopLeftCorner': ol.xml.makeObjectPropertySetter(
ol.format.WMTSCapabilities.readCoordinates_),
'ScaleDenominator': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'TileWidth': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'TileHeight': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MatrixWidth': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MatrixHeight': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger)
}, ol.xml.makeStructureNS(ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readCoordinates_),
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'TileWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'TileHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MatrixWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
}));
export default _ol_format_WMTSCapabilities_;
+8 -4
View File
@@ -1,17 +1,21 @@
goog.provide('ol.format.XLink');
/**
* @module ol/format/XLink
*/
var _ol_format_XLink_ = {};
/**
* @const
* @type {string}
*/
ol.format.XLink.NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
_ol_format_XLink_.NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
/**
* @param {Node} node Node.
* @return {boolean|undefined} Boolean.
*/
ol.format.XLink.readHref = function(node) {
return node.getAttributeNS(ol.format.XLink.NAMESPACE_URI, 'href');
_ol_format_XLink_.readHref = function(node) {
return node.getAttributeNS(_ol_format_XLink_.NAMESPACE_URI, 'href');
};
export default _ol_format_XLink_;
+12 -11
View File
@@ -1,7 +1,7 @@
goog.provide('ol.format.XML');
goog.require('ol.xml');
/**
* @module ol/format/XML
*/
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -11,7 +11,7 @@ goog.require('ol.xml');
* @abstract
* @struct
*/
ol.format.XML = function() {
var _ol_format_XML_ = function() {
};
@@ -19,13 +19,13 @@ ol.format.XML = function() {
* @param {Document|Node|string} source Source.
* @return {Object} The parsed result.
*/
ol.format.XML.prototype.read = function(source) {
if (ol.xml.isDocument(source)) {
_ol_format_XML_.prototype.read = function(source) {
if (_ol_xml_.isDocument(source)) {
return this.readFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
} else if (_ol_xml_.isNode(source)) {
return this.readFromNode(/** @type {Node} */ (source));
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
var doc = _ol_xml_.parse(source);
return this.readFromDocument(doc);
} else {
return null;
@@ -38,7 +38,7 @@ ol.format.XML.prototype.read = function(source) {
* @param {Document} doc Document.
* @return {Object} Object
*/
ol.format.XML.prototype.readFromDocument = function(doc) {};
_ol_format_XML_.prototype.readFromDocument = function(doc) {};
/**
@@ -46,4 +46,5 @@ ol.format.XML.prototype.readFromDocument = function(doc) {};
* @param {Node} node Node.
* @return {Object} Object
*/
ol.format.XML.prototype.readFromNode = function(node) {};
_ol_format_XML_.prototype.readFromNode = function(node) {};
export default _ol_format_XML_;
+46 -44
View File
@@ -1,11 +1,11 @@
goog.provide('ol.format.XMLFeature');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.xml');
/**
* @module ol/format/XMLFeature
*/
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -17,7 +17,7 @@ goog.require('ol.xml');
* @abstract
* @extends {ol.format.Feature}
*/
ol.format.XMLFeature = function() {
var _ol_format_XMLFeature_ = function() {
/**
* @type {XMLSerializer}
@@ -25,30 +25,31 @@ ol.format.XMLFeature = function() {
*/
this.xmlSerializer_ = new XMLSerializer();
ol.format.Feature.call(this);
_ol_format_Feature_.call(this);
};
ol.inherits(ol.format.XMLFeature, ol.format.Feature);
_ol_.inherits(_ol_format_XMLFeature_, _ol_format_Feature_);
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.getType = function() {
return ol.format.FormatType.XML;
_ol_format_XMLFeature_.prototype.getType = function() {
return _ol_format_FormatType_.XML;
};
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
if (ol.xml.isDocument(source)) {
_ol_format_XMLFeature_.prototype.readFeature = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) {
return this.readFeatureFromDocument(
/** @type {Document} */ (source), opt_options);
} else if (ol.xml.isNode(source)) {
} else if (_ol_xml_.isNode(source)) {
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
var doc = _ol_xml_.parse(source);
return this.readFeatureFromDocument(doc, opt_options);
} else {
return null;
@@ -61,7 +62,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
* @param {olx.format.ReadOptions=} opt_options Options.
* @return {ol.Feature} Feature.
*/
ol.format.XMLFeature.prototype.readFeatureFromDocument = function(
_ol_format_XMLFeature_.prototype.readFeatureFromDocument = function(
doc, opt_options) {
var features = this.readFeaturesFromDocument(doc, opt_options);
if (features.length > 0) {
@@ -77,7 +78,7 @@ ol.format.XMLFeature.prototype.readFeatureFromDocument = function(
* @param {olx.format.ReadOptions=} opt_options Options.
* @return {ol.Feature} Feature.
*/
ol.format.XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) {
_ol_format_XMLFeature_.prototype.readFeatureFromNode = function(node, opt_options) {
return null; // not implemented
};
@@ -85,14 +86,14 @@ ol.format.XMLFeature.prototype.readFeatureFromNode = function(node, opt_options)
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
if (ol.xml.isDocument(source)) {
_ol_format_XMLFeature_.prototype.readFeatures = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) {
return this.readFeaturesFromDocument(
/** @type {Document} */ (source), opt_options);
} else if (ol.xml.isNode(source)) {
} else if (_ol_xml_.isNode(source)) {
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
var doc = _ol_xml_.parse(source);
return this.readFeaturesFromDocument(doc, opt_options);
} else {
return [];
@@ -106,14 +107,14 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(
_ol_format_XMLFeature_.prototype.readFeaturesFromDocument = function(
doc, opt_options) {
/** @type {Array.<ol.Feature>} */
var features = [];
var n;
for (n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
ol.array.extend(features, this.readFeaturesFromNode(n, opt_options));
_ol_array_.extend(features, this.readFeaturesFromNode(n, opt_options));
}
}
return features;
@@ -127,20 +128,20 @@ ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.XMLFeature.prototype.readFeaturesFromNode = function(node, opt_options) {};
_ol_format_XMLFeature_.prototype.readFeaturesFromNode = function(node, opt_options) {};
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
if (ol.xml.isDocument(source)) {
_ol_format_XMLFeature_.prototype.readGeometry = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) {
return this.readGeometryFromDocument(
/** @type {Document} */ (source), opt_options);
} else if (ol.xml.isNode(source)) {
} else if (_ol_xml_.isNode(source)) {
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
var doc = _ol_xml_.parse(source);
return this.readGeometryFromDocument(doc, opt_options);
} else {
return null;
@@ -154,7 +155,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.XMLFeature.prototype.readGeometryFromDocument = function(doc, opt_options) {
_ol_format_XMLFeature_.prototype.readGeometryFromDocument = function(doc, opt_options) {
return null; // not implemented
};
@@ -165,7 +166,7 @@ ol.format.XMLFeature.prototype.readGeometryFromDocument = function(doc, opt_opti
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.XMLFeature.prototype.readGeometryFromNode = function(node, opt_options) {
_ol_format_XMLFeature_.prototype.readGeometryFromNode = function(node, opt_options) {
return null; // not implemented
};
@@ -173,13 +174,13 @@ ol.format.XMLFeature.prototype.readGeometryFromNode = function(node, opt_options
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.readProjection = function(source) {
if (ol.xml.isDocument(source)) {
_ol_format_XMLFeature_.prototype.readProjection = function(source) {
if (_ol_xml_.isDocument(source)) {
return this.readProjectionFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
} else if (_ol_xml_.isNode(source)) {
return this.readProjectionFromNode(/** @type {Node} */ (source));
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
var doc = _ol_xml_.parse(source);
return this.readProjectionFromDocument(doc);
} else {
return null;
@@ -192,7 +193,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.XMLFeature.prototype.readProjectionFromDocument = function(doc) {
_ol_format_XMLFeature_.prototype.readProjectionFromDocument = function(doc) {
return this.defaultDataProjection;
};
@@ -202,7 +203,7 @@ ol.format.XMLFeature.prototype.readProjectionFromDocument = function(doc) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.XMLFeature.prototype.readProjectionFromNode = function(node) {
_ol_format_XMLFeature_.prototype.readProjectionFromNode = function(node) {
return this.defaultDataProjection;
};
@@ -210,7 +211,7 @@ ol.format.XMLFeature.prototype.readProjectionFromNode = function(node) {
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) {
_ol_format_XMLFeature_.prototype.writeFeature = function(feature, opt_options) {
var node = this.writeFeatureNode(feature, opt_options);
return this.xmlSerializer_.serializeToString(node);
};
@@ -222,7 +223,7 @@ ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) {
* @protected
* @return {Node} Node.
*/
ol.format.XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) {
_ol_format_XMLFeature_.prototype.writeFeatureNode = function(feature, opt_options) {
return null; // not implemented
};
@@ -230,7 +231,7 @@ ol.format.XMLFeature.prototype.writeFeatureNode = function(feature, opt_options)
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) {
_ol_format_XMLFeature_.prototype.writeFeatures = function(features, opt_options) {
var node = this.writeFeaturesNode(features, opt_options);
return this.xmlSerializer_.serializeToString(node);
};
@@ -241,7 +242,7 @@ ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) {
* @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node.
*/
ol.format.XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) {
_ol_format_XMLFeature_.prototype.writeFeaturesNode = function(features, opt_options) {
return null; // not implemented
};
@@ -249,7 +250,7 @@ ol.format.XMLFeature.prototype.writeFeaturesNode = function(features, opt_option
/**
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
_ol_format_XMLFeature_.prototype.writeGeometry = function(geometry, opt_options) {
var node = this.writeGeometryNode(geometry, opt_options);
return this.xmlSerializer_.serializeToString(node);
};
@@ -260,6 +261,7 @@ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
* @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node.
*/
ol.format.XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) {
_ol_format_XMLFeature_.prototype.writeGeometryNode = function(geometry, opt_options) {
return null; // not implemented
};
export default _ol_format_XMLFeature_;
+41 -38
View File
@@ -1,23 +1,25 @@
goog.provide('ol.format.XSD');
goog.require('ol.xml');
goog.require('ol.string');
/**
* @module ol/format/XSD
*/
import _ol_xml_ from '../xml.js';
import _ol_string_ from '../string.js';
var _ol_format_XSD_ = {};
/**
* @const
* @type {string}
*/
ol.format.XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';
_ol_format_XSD_.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';
/**
* @param {Node} node Node.
* @return {boolean|undefined} Boolean.
*/
ol.format.XSD.readBoolean = function(node) {
var s = ol.xml.getAllTextContent(node, false);
return ol.format.XSD.readBooleanString(s);
_ol_format_XSD_.readBoolean = function(node) {
var s = _ol_xml_.getAllTextContent(node, false);
return _ol_format_XSD_.readBooleanString(s);
};
@@ -25,7 +27,7 @@ ol.format.XSD.readBoolean = function(node) {
* @param {string} string String.
* @return {boolean|undefined} Boolean.
*/
ol.format.XSD.readBooleanString = function(string) {
_ol_format_XSD_.readBooleanString = function(string) {
var m = /^\s*(true|1)|(false|0)\s*$/.exec(string);
if (m) {
return m[1] !== undefined || false;
@@ -39,8 +41,8 @@ ol.format.XSD.readBooleanString = function(string) {
* @param {Node} node Node.
* @return {number|undefined} DateTime in seconds.
*/
ol.format.XSD.readDateTime = function(node) {
var s = ol.xml.getAllTextContent(node, false);
_ol_format_XSD_.readDateTime = function(node) {
var s = _ol_xml_.getAllTextContent(node, false);
var dateTime = Date.parse(s);
return isNaN(dateTime) ? undefined : dateTime / 1000;
};
@@ -50,9 +52,9 @@ ol.format.XSD.readDateTime = function(node) {
* @param {Node} node Node.
* @return {number|undefined} Decimal.
*/
ol.format.XSD.readDecimal = function(node) {
var s = ol.xml.getAllTextContent(node, false);
return ol.format.XSD.readDecimalString(s);
_ol_format_XSD_.readDecimal = function(node) {
var s = _ol_xml_.getAllTextContent(node, false);
return _ol_format_XSD_.readDecimalString(s);
};
@@ -60,7 +62,7 @@ ol.format.XSD.readDecimal = function(node) {
* @param {string} string String.
* @return {number|undefined} Decimal.
*/
ol.format.XSD.readDecimalString = function(string) {
_ol_format_XSD_.readDecimalString = function(string) {
// FIXME check spec
var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string);
if (m) {
@@ -75,9 +77,9 @@ ol.format.XSD.readDecimalString = function(string) {
* @param {Node} node Node.
* @return {number|undefined} Non negative integer.
*/
ol.format.XSD.readNonNegativeInteger = function(node) {
var s = ol.xml.getAllTextContent(node, false);
return ol.format.XSD.readNonNegativeIntegerString(s);
_ol_format_XSD_.readNonNegativeInteger = function(node) {
var s = _ol_xml_.getAllTextContent(node, false);
return _ol_format_XSD_.readNonNegativeIntegerString(s);
};
@@ -85,7 +87,7 @@ ol.format.XSD.readNonNegativeInteger = function(node) {
* @param {string} string String.
* @return {number|undefined} Non negative integer.
*/
ol.format.XSD.readNonNegativeIntegerString = function(string) {
_ol_format_XSD_.readNonNegativeIntegerString = function(string) {
var m = /^\s*(\d+)\s*$/.exec(string);
if (m) {
return parseInt(m[1], 10);
@@ -99,8 +101,8 @@ ol.format.XSD.readNonNegativeIntegerString = function(string) {
* @param {Node} node Node.
* @return {string|undefined} String.
*/
ol.format.XSD.readString = function(node) {
return ol.xml.getAllTextContent(node, false).trim();
_ol_format_XSD_.readString = function(node) {
return _ol_xml_.getAllTextContent(node, false).trim();
};
@@ -108,8 +110,8 @@ ol.format.XSD.readString = function(node) {
* @param {Node} node Node to append a TextNode with the boolean to.
* @param {boolean} bool Boolean.
*/
ol.format.XSD.writeBooleanTextNode = function(node, bool) {
ol.format.XSD.writeStringTextNode(node, (bool) ? '1' : '0');
_ol_format_XSD_.writeBooleanTextNode = function(node, bool) {
_ol_format_XSD_.writeStringTextNode(node, (bool) ? '1' : '0');
};
@@ -117,8 +119,8 @@ ol.format.XSD.writeBooleanTextNode = function(node, bool) {
* @param {Node} node Node to append a CDATA Section with the string to.
* @param {string} string String.
*/
ol.format.XSD.writeCDATASection = function(node, string) {
node.appendChild(ol.xml.DOCUMENT.createCDATASection(string));
_ol_format_XSD_.writeCDATASection = function(node, string) {
node.appendChild(_ol_xml_.DOCUMENT.createCDATASection(string));
};
@@ -126,15 +128,15 @@ ol.format.XSD.writeCDATASection = function(node, string) {
* @param {Node} node Node to append a TextNode with the dateTime to.
* @param {number} dateTime DateTime in seconds.
*/
ol.format.XSD.writeDateTimeTextNode = function(node, dateTime) {
_ol_format_XSD_.writeDateTimeTextNode = function(node, dateTime) {
var date = new Date(dateTime * 1000);
var string = date.getUTCFullYear() + '-' +
ol.string.padNumber(date.getUTCMonth() + 1, 2) + '-' +
ol.string.padNumber(date.getUTCDate(), 2) + 'T' +
ol.string.padNumber(date.getUTCHours(), 2) + ':' +
ol.string.padNumber(date.getUTCMinutes(), 2) + ':' +
ol.string.padNumber(date.getUTCSeconds(), 2) + 'Z';
node.appendChild(ol.xml.DOCUMENT.createTextNode(string));
_ol_string_.padNumber(date.getUTCMonth() + 1, 2) + '-' +
_ol_string_.padNumber(date.getUTCDate(), 2) + 'T' +
_ol_string_.padNumber(date.getUTCHours(), 2) + ':' +
_ol_string_.padNumber(date.getUTCMinutes(), 2) + ':' +
_ol_string_.padNumber(date.getUTCSeconds(), 2) + 'Z';
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
};
@@ -142,9 +144,9 @@ ol.format.XSD.writeDateTimeTextNode = function(node, dateTime) {
* @param {Node} node Node to append a TextNode with the decimal to.
* @param {number} decimal Decimal.
*/
ol.format.XSD.writeDecimalTextNode = function(node, decimal) {
_ol_format_XSD_.writeDecimalTextNode = function(node, decimal) {
var string = decimal.toPrecision();
node.appendChild(ol.xml.DOCUMENT.createTextNode(string));
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
};
@@ -152,9 +154,9 @@ ol.format.XSD.writeDecimalTextNode = function(node, decimal) {
* @param {Node} node Node to append a TextNode with the decimal to.
* @param {number} nonNegativeInteger Non negative integer.
*/
ol.format.XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) {
_ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) {
var string = nonNegativeInteger.toString();
node.appendChild(ol.xml.DOCUMENT.createTextNode(string));
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
};
@@ -162,6 +164,7 @@ ol.format.XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeIntege
* @param {Node} node Node to append a TextNode with the string to.
* @param {string} string String.
*/
ol.format.XSD.writeStringTextNode = function(node, string) {
node.appendChild(ol.xml.DOCUMENT.createTextNode(string));
_ol_format_XSD_.writeStringTextNode = function(node, string) {
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
};
export default _ol_format_XSD_;
+56 -53
View File
@@ -1,22 +1,24 @@
goog.provide('ol.format.filter');
goog.require('ol.format.filter.And');
goog.require('ol.format.filter.Bbox');
goog.require('ol.format.filter.Contains');
goog.require('ol.format.filter.During');
goog.require('ol.format.filter.EqualTo');
goog.require('ol.format.filter.GreaterThan');
goog.require('ol.format.filter.GreaterThanOrEqualTo');
goog.require('ol.format.filter.Intersects');
goog.require('ol.format.filter.IsBetween');
goog.require('ol.format.filter.IsLike');
goog.require('ol.format.filter.IsNull');
goog.require('ol.format.filter.LessThan');
goog.require('ol.format.filter.LessThanOrEqualTo');
goog.require('ol.format.filter.Not');
goog.require('ol.format.filter.NotEqualTo');
goog.require('ol.format.filter.Or');
goog.require('ol.format.filter.Within');
/**
* @module ol/format/filter
*/
import _ol_format_filter_And_ from '../format/filter/And.js';
import _ol_format_filter_Bbox_ from '../format/filter/Bbox.js';
import _ol_format_filter_Contains_ from '../format/filter/Contains.js';
import _ol_format_filter_During_ from '../format/filter/During.js';
import _ol_format_filter_EqualTo_ from '../format/filter/EqualTo.js';
import _ol_format_filter_GreaterThan_ from '../format/filter/GreaterThan.js';
import _ol_format_filter_GreaterThanOrEqualTo_ from '../format/filter/GreaterThanOrEqualTo.js';
import _ol_format_filter_Intersects_ from '../format/filter/Intersects.js';
import _ol_format_filter_IsBetween_ from '../format/filter/IsBetween.js';
import _ol_format_filter_IsLike_ from '../format/filter/IsLike.js';
import _ol_format_filter_IsNull_ from '../format/filter/IsNull.js';
import _ol_format_filter_LessThan_ from '../format/filter/LessThan.js';
import _ol_format_filter_LessThanOrEqualTo_ from '../format/filter/LessThanOrEqualTo.js';
import _ol_format_filter_Not_ from '../format/filter/Not.js';
import _ol_format_filter_NotEqualTo_ from '../format/filter/NotEqualTo.js';
import _ol_format_filter_Or_ from '../format/filter/Or.js';
import _ol_format_filter_Within_ from '../format/filter/Within.js';
var _ol_format_filter_ = {};
/**
@@ -26,9 +28,9 @@ goog.require('ol.format.filter.Within');
* @returns {!ol.format.filter.And} `<And>` operator.
* @api
*/
ol.format.filter.and = function(conditions) {
_ol_format_filter_.and = function(conditions) {
var params = [null].concat(Array.prototype.slice.call(arguments));
return new (Function.prototype.bind.apply(ol.format.filter.And, params));
return new (Function.prototype.bind.apply(_ol_format_filter_And_, params));
};
@@ -39,9 +41,9 @@ ol.format.filter.and = function(conditions) {
* @returns {!ol.format.filter.Or} `<Or>` operator.
* @api
*/
ol.format.filter.or = function(conditions) {
_ol_format_filter_.or = function(conditions) {
var params = [null].concat(Array.prototype.slice.call(arguments));
return new (Function.prototype.bind.apply(ol.format.filter.Or, params));
return new (Function.prototype.bind.apply(_ol_format_filter_Or_, params));
};
@@ -52,8 +54,8 @@ ol.format.filter.or = function(conditions) {
* @returns {!ol.format.filter.Not} `<Not>` operator.
* @api
*/
ol.format.filter.not = function(condition) {
return new ol.format.filter.Not(condition);
_ol_format_filter_.not = function(condition) {
return new _ol_format_filter_Not_(condition);
};
@@ -68,8 +70,8 @@ ol.format.filter.not = function(condition) {
* @returns {!ol.format.filter.Bbox} `<BBOX>` operator.
* @api
*/
ol.format.filter.bbox = function(geometryName, extent, opt_srsName) {
return new ol.format.filter.Bbox(geometryName, extent, opt_srsName);
_ol_format_filter_.bbox = function(geometryName, extent, opt_srsName) {
return new _ol_format_filter_Bbox_(geometryName, extent, opt_srsName);
};
/**
@@ -83,8 +85,8 @@ ol.format.filter.bbox = function(geometryName, extent, opt_srsName) {
* @returns {!ol.format.filter.Contains} `<Contains>` operator.
* @api
*/
ol.format.filter.contains = function(geometryName, geometry, opt_srsName) {
return new ol.format.filter.Contains(geometryName, geometry, opt_srsName);
_ol_format_filter_.contains = function(geometryName, geometry, opt_srsName) {
return new _ol_format_filter_Contains_(geometryName, geometry, opt_srsName);
};
/**
@@ -98,8 +100,8 @@ ol.format.filter.contains = function(geometryName, geometry, opt_srsName) {
* @returns {!ol.format.filter.Intersects} `<Intersects>` operator.
* @api
*/
ol.format.filter.intersects = function(geometryName, geometry, opt_srsName) {
return new ol.format.filter.Intersects(geometryName, geometry, opt_srsName);
_ol_format_filter_.intersects = function(geometryName, geometry, opt_srsName) {
return new _ol_format_filter_Intersects_(geometryName, geometry, opt_srsName);
};
/**
@@ -113,8 +115,8 @@ ol.format.filter.intersects = function(geometryName, geometry, opt_srsName) {
* @returns {!ol.format.filter.Within} `<Within>` operator.
* @api
*/
ol.format.filter.within = function(geometryName, geometry, opt_srsName) {
return new ol.format.filter.Within(geometryName, geometry, opt_srsName);
_ol_format_filter_.within = function(geometryName, geometry, opt_srsName) {
return new _ol_format_filter_Within_(geometryName, geometry, opt_srsName);
};
@@ -127,8 +129,8 @@ ol.format.filter.within = function(geometryName, geometry, opt_srsName) {
* @returns {!ol.format.filter.EqualTo} `<PropertyIsEqualTo>` operator.
* @api
*/
ol.format.filter.equalTo = function(propertyName, expression, opt_matchCase) {
return new ol.format.filter.EqualTo(propertyName, expression, opt_matchCase);
_ol_format_filter_.equalTo = function(propertyName, expression, opt_matchCase) {
return new _ol_format_filter_EqualTo_(propertyName, expression, opt_matchCase);
};
@@ -141,8 +143,8 @@ ol.format.filter.equalTo = function(propertyName, expression, opt_matchCase) {
* @returns {!ol.format.filter.NotEqualTo} `<PropertyIsNotEqualTo>` operator.
* @api
*/
ol.format.filter.notEqualTo = function(propertyName, expression, opt_matchCase) {
return new ol.format.filter.NotEqualTo(propertyName, expression, opt_matchCase);
_ol_format_filter_.notEqualTo = function(propertyName, expression, opt_matchCase) {
return new _ol_format_filter_NotEqualTo_(propertyName, expression, opt_matchCase);
};
@@ -154,8 +156,8 @@ ol.format.filter.notEqualTo = function(propertyName, expression, opt_matchCase)
* @returns {!ol.format.filter.LessThan} `<PropertyIsLessThan>` operator.
* @api
*/
ol.format.filter.lessThan = function(propertyName, expression) {
return new ol.format.filter.LessThan(propertyName, expression);
_ol_format_filter_.lessThan = function(propertyName, expression) {
return new _ol_format_filter_LessThan_(propertyName, expression);
};
@@ -167,8 +169,8 @@ ol.format.filter.lessThan = function(propertyName, expression) {
* @returns {!ol.format.filter.LessThanOrEqualTo} `<PropertyIsLessThanOrEqualTo>` operator.
* @api
*/
ol.format.filter.lessThanOrEqualTo = function(propertyName, expression) {
return new ol.format.filter.LessThanOrEqualTo(propertyName, expression);
_ol_format_filter_.lessThanOrEqualTo = function(propertyName, expression) {
return new _ol_format_filter_LessThanOrEqualTo_(propertyName, expression);
};
@@ -180,8 +182,8 @@ ol.format.filter.lessThanOrEqualTo = function(propertyName, expression) {
* @returns {!ol.format.filter.GreaterThan} `<PropertyIsGreaterThan>` operator.
* @api
*/
ol.format.filter.greaterThan = function(propertyName, expression) {
return new ol.format.filter.GreaterThan(propertyName, expression);
_ol_format_filter_.greaterThan = function(propertyName, expression) {
return new _ol_format_filter_GreaterThan_(propertyName, expression);
};
@@ -193,8 +195,8 @@ ol.format.filter.greaterThan = function(propertyName, expression) {
* @returns {!ol.format.filter.GreaterThanOrEqualTo} `<PropertyIsGreaterThanOrEqualTo>` operator.
* @api
*/
ol.format.filter.greaterThanOrEqualTo = function(propertyName, expression) {
return new ol.format.filter.GreaterThanOrEqualTo(propertyName, expression);
_ol_format_filter_.greaterThanOrEqualTo = function(propertyName, expression) {
return new _ol_format_filter_GreaterThanOrEqualTo_(propertyName, expression);
};
@@ -206,8 +208,8 @@ ol.format.filter.greaterThanOrEqualTo = function(propertyName, expression) {
* @returns {!ol.format.filter.IsNull} `<PropertyIsNull>` operator.
* @api
*/
ol.format.filter.isNull = function(propertyName) {
return new ol.format.filter.IsNull(propertyName);
_ol_format_filter_.isNull = function(propertyName) {
return new _ol_format_filter_IsNull_(propertyName);
};
@@ -221,8 +223,8 @@ ol.format.filter.isNull = function(propertyName) {
* @returns {!ol.format.filter.IsBetween} `<PropertyIsBetween>` operator.
* @api
*/
ol.format.filter.between = function(propertyName, lowerBoundary, upperBoundary) {
return new ol.format.filter.IsBetween(propertyName, lowerBoundary, upperBoundary);
_ol_format_filter_.between = function(propertyName, lowerBoundary, upperBoundary) {
return new _ol_format_filter_IsBetween_(propertyName, lowerBoundary, upperBoundary);
};
@@ -242,9 +244,9 @@ ol.format.filter.between = function(propertyName, lowerBoundary, upperBoundary)
* @returns {!ol.format.filter.IsLike} `<PropertyIsLike>` operator.
* @api
*/
ol.format.filter.like = function(propertyName, pattern,
_ol_format_filter_.like = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
return new ol.format.filter.IsLike(propertyName, pattern,
return new _ol_format_filter_IsLike_(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
};
@@ -258,6 +260,7 @@ ol.format.filter.like = function(propertyName, pattern,
* @returns {!ol.format.filter.During} `<During>` operator.
* @api
*/
ol.format.filter.during = function(propertyName, begin, end) {
return new ol.format.filter.During(propertyName, begin, end);
_ol_format_filter_.during = function(propertyName, begin, end) {
return new _ol_format_filter_During_(propertyName, begin, end);
};
export default _ol_format_filter_;
+10 -7
View File
@@ -1,7 +1,8 @@
goog.provide('ol.format.filter.And');
goog.require('ol');
goog.require('ol.format.filter.LogicalNary');
/**
* @module ol/format/filter/And
*/
import _ol_ from '../../index.js';
import _ol_format_filter_LogicalNary_ from '../filter/LogicalNary.js';
/**
* @classdesc
@@ -15,8 +16,10 @@ goog.require('ol.format.filter.LogicalNary');
* @extends {ol.format.filter.LogicalNary}
* @api
*/
ol.format.filter.And = function(conditions) {
var _ol_format_filter_And_ = function(conditions) {
var params = ['And'].concat(Array.prototype.slice.call(arguments));
ol.format.filter.LogicalNary.apply(this, params);
_ol_format_filter_LogicalNary_.apply(this, params);
};
ol.inherits(ol.format.filter.And, ol.format.filter.LogicalNary);
_ol_.inherits(_ol_format_filter_And_, _ol_format_filter_LogicalNary_);
export default _ol_format_filter_And_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Bbox');
goog.require('ol');
goog.require('ol.format.filter.Filter');
/**
* @module ol/format/filter/Bbox
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Filter_ from '../filter/Filter.js';
/**
* @classdesc
@@ -17,9 +17,9 @@ goog.require('ol.format.filter.Filter');
* @extends {ol.format.filter.Filter}
* @api
*/
ol.format.filter.Bbox = function(geometryName, extent, opt_srsName) {
var _ol_format_filter_Bbox_ = function(geometryName, extent, opt_srsName) {
ol.format.filter.Filter.call(this, 'BBOX');
_ol_format_filter_Filter_.call(this, 'BBOX');
/**
* @public
@@ -39,4 +39,6 @@ ol.format.filter.Bbox = function(geometryName, extent, opt_srsName) {
*/
this.srsName = opt_srsName;
};
ol.inherits(ol.format.filter.Bbox, ol.format.filter.Filter);
_ol_.inherits(_ol_format_filter_Bbox_, _ol_format_filter_Filter_);
export default _ol_format_filter_Bbox_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Comparison');
goog.require('ol');
goog.require('ol.format.filter.Filter');
/**
* @module ol/format/filter/Comparison
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Filter_ from '../filter/Filter.js';
/**
* @classdesc
@@ -18,9 +18,9 @@ goog.require('ol.format.filter.Filter');
* @extends {ol.format.filter.Filter}
* @api
*/
ol.format.filter.Comparison = function(tagName, propertyName) {
var _ol_format_filter_Comparison_ = function(tagName, propertyName) {
ol.format.filter.Filter.call(this, tagName);
_ol_format_filter_Filter_.call(this, tagName);
/**
* @public
@@ -28,4 +28,6 @@ ol.format.filter.Comparison = function(tagName, propertyName) {
*/
this.propertyName = propertyName;
};
ol.inherits(ol.format.filter.Comparison, ol.format.filter.Filter);
_ol_.inherits(_ol_format_filter_Comparison_, _ol_format_filter_Filter_);
export default _ol_format_filter_Comparison_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.ComparisonBinary');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @module ol/format/filter/ComparisonBinary
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Comparison_ from '../filter/Comparison.js';
/**
* @classdesc
@@ -20,10 +20,10 @@ goog.require('ol.format.filter.Comparison');
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.ComparisonBinary = function(
var _ol_format_filter_ComparisonBinary_ = function(
tagName, propertyName, expression, opt_matchCase) {
ol.format.filter.Comparison.call(this, tagName, propertyName);
_ol_format_filter_Comparison_.call(this, tagName, propertyName);
/**
* @public
@@ -37,4 +37,6 @@ ol.format.filter.ComparisonBinary = function(
*/
this.matchCase = opt_matchCase;
};
ol.inherits(ol.format.filter.ComparisonBinary, ol.format.filter.Comparison);
_ol_.inherits(_ol_format_filter_ComparisonBinary_, _ol_format_filter_Comparison_);
export default _ol_format_filter_ComparisonBinary_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Contains');
goog.require('ol');
goog.require('ol.format.filter.Spatial');
/**
* @module ol/format/filter/Contains
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Spatial_ from '../filter/Spatial.js';
/**
* @classdesc
@@ -17,9 +17,11 @@ goog.require('ol.format.filter.Spatial');
* @extends {ol.format.filter.Spatial}
* @api
*/
ol.format.filter.Contains = function(geometryName, geometry, opt_srsName) {
var _ol_format_filter_Contains_ = function(geometryName, geometry, opt_srsName) {
ol.format.filter.Spatial.call(this, 'Contains', geometryName, geometry, opt_srsName);
_ol_format_filter_Spatial_.call(this, 'Contains', geometryName, geometry, opt_srsName);
};
ol.inherits(ol.format.filter.Contains, ol.format.filter.Spatial);
_ol_.inherits(_ol_format_filter_Contains_, _ol_format_filter_Spatial_);
export default _ol_format_filter_Contains_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.During');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @module ol/format/filter/During
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Comparison_ from '../filter/Comparison.js';
/**
* @classdesc
@@ -15,8 +15,8 @@ goog.require('ol.format.filter.Comparison');
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.During = function(propertyName, begin, end) {
ol.format.filter.Comparison.call(this, 'During', propertyName);
var _ol_format_filter_During_ = function(propertyName, begin, end) {
_ol_format_filter_Comparison_.call(this, 'During', propertyName);
/**
* @public
@@ -30,4 +30,6 @@ ol.format.filter.During = function(propertyName, begin, end) {
*/
this.end = end;
};
ol.inherits(ol.format.filter.During, ol.format.filter.Comparison);
_ol_.inherits(_ol_format_filter_During_, _ol_format_filter_Comparison_);
export default _ol_format_filter_During_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.EqualTo');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/EqualTo
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -15,7 +15,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.EqualTo = function(propertyName, expression, opt_matchCase) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase);
var _ol_format_filter_EqualTo_ = function(propertyName, expression, opt_matchCase) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase);
};
ol.inherits(ol.format.filter.EqualTo, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_EqualTo_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_EqualTo_;
+6 -5
View File
@@ -1,6 +1,6 @@
goog.provide('ol.format.filter.Filter');
/**
* @module ol/format/filter/Filter
*/
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
@@ -14,7 +14,7 @@ goog.provide('ol.format.filter.Filter');
* @struct
* @api
*/
ol.format.filter.Filter = function(tagName) {
var _ol_format_filter_Filter_ = function(tagName) {
/**
* @private
@@ -27,6 +27,7 @@ ol.format.filter.Filter = function(tagName) {
* The XML tag name for a filter.
* @returns {!string} Name.
*/
ol.format.filter.Filter.prototype.getTagName = function() {
_ol_format_filter_Filter_.prototype.getTagName = function() {
return this.tagName_;
};
export default _ol_format_filter_Filter_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.GreaterThan');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/GreaterThan
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -14,7 +14,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.GreaterThan = function(propertyName, expression) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThan', propertyName, expression);
var _ol_format_filter_GreaterThan_ = function(propertyName, expression) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsGreaterThan', propertyName, expression);
};
ol.inherits(ol.format.filter.GreaterThan, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_GreaterThan_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_GreaterThan_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.GreaterThanOrEqualTo');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/GreaterThanOrEqualTo
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -14,7 +14,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.GreaterThanOrEqualTo = function(propertyName, expression) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression);
var _ol_format_filter_GreaterThanOrEqualTo_ = function(propertyName, expression) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression);
};
ol.inherits(ol.format.filter.GreaterThanOrEqualTo, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_GreaterThanOrEqualTo_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_GreaterThanOrEqualTo_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Intersects');
goog.require('ol');
goog.require('ol.format.filter.Spatial');
/**
* @module ol/format/filter/Intersects
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Spatial_ from '../filter/Spatial.js';
/**
* @classdesc
@@ -17,9 +17,11 @@ goog.require('ol.format.filter.Spatial');
* @extends {ol.format.filter.Spatial}
* @api
*/
ol.format.filter.Intersects = function(geometryName, geometry, opt_srsName) {
var _ol_format_filter_Intersects_ = function(geometryName, geometry, opt_srsName) {
ol.format.filter.Spatial.call(this, 'Intersects', geometryName, geometry, opt_srsName);
_ol_format_filter_Spatial_.call(this, 'Intersects', geometryName, geometry, opt_srsName);
};
ol.inherits(ol.format.filter.Intersects, ol.format.filter.Spatial);
_ol_.inherits(_ol_format_filter_Intersects_, _ol_format_filter_Spatial_);
export default _ol_format_filter_Intersects_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.IsBetween');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @module ol/format/filter/IsBetween
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Comparison_ from '../filter/Comparison.js';
/**
* @classdesc
@@ -15,8 +15,8 @@ goog.require('ol.format.filter.Comparison');
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.IsBetween = function(propertyName, lowerBoundary, upperBoundary) {
ol.format.filter.Comparison.call(this, 'PropertyIsBetween', propertyName);
var _ol_format_filter_IsBetween_ = function(propertyName, lowerBoundary, upperBoundary) {
_ol_format_filter_Comparison_.call(this, 'PropertyIsBetween', propertyName);
/**
* @public
@@ -30,4 +30,6 @@ ol.format.filter.IsBetween = function(propertyName, lowerBoundary, upperBoundary
*/
this.upperBoundary = upperBoundary;
};
ol.inherits(ol.format.filter.IsBetween, ol.format.filter.Comparison);
_ol_.inherits(_ol_format_filter_IsBetween_, _ol_format_filter_Comparison_);
export default _ol_format_filter_IsBetween_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.IsLike');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @module ol/format/filter/IsLike
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Comparison_ from '../filter/Comparison.js';
/**
* @classdesc
@@ -21,9 +21,9 @@ goog.require('ol.format.filter.Comparison');
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.IsLike = function(propertyName, pattern,
var _ol_format_filter_IsLike_ = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
ol.format.filter.Comparison.call(this, 'PropertyIsLike', propertyName);
_ol_format_filter_Comparison_.call(this, 'PropertyIsLike', propertyName);
/**
* @public
@@ -55,4 +55,6 @@ ol.format.filter.IsLike = function(propertyName, pattern,
*/
this.matchCase = opt_matchCase;
};
ol.inherits(ol.format.filter.IsLike, ol.format.filter.Comparison);
_ol_.inherits(_ol_format_filter_IsLike_, _ol_format_filter_Comparison_);
export default _ol_format_filter_IsLike_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.IsNull');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @module ol/format/filter/IsNull
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Comparison_ from '../filter/Comparison.js';
/**
* @classdesc
@@ -13,7 +13,9 @@ goog.require('ol.format.filter.Comparison');
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.IsNull = function(propertyName) {
ol.format.filter.Comparison.call(this, 'PropertyIsNull', propertyName);
var _ol_format_filter_IsNull_ = function(propertyName) {
_ol_format_filter_Comparison_.call(this, 'PropertyIsNull', propertyName);
};
ol.inherits(ol.format.filter.IsNull, ol.format.filter.Comparison);
_ol_.inherits(_ol_format_filter_IsNull_, _ol_format_filter_Comparison_);
export default _ol_format_filter_IsNull_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.LessThan');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/LessThan
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -14,7 +14,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.LessThan = function(propertyName, expression) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsLessThan', propertyName, expression);
var _ol_format_filter_LessThan_ = function(propertyName, expression) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsLessThan', propertyName, expression);
};
ol.inherits(ol.format.filter.LessThan, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_LessThan_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_LessThan_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.LessThanOrEqualTo');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/LessThanOrEqualTo
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -14,7 +14,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.LessThanOrEqualTo = function(propertyName, expression) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression);
var _ol_format_filter_LessThanOrEqualTo_ = function(propertyName, expression) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression);
};
ol.inherits(ol.format.filter.LessThanOrEqualTo, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_LessThanOrEqualTo_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_LessThanOrEqualTo_;
+12 -10
View File
@@ -1,9 +1,9 @@
goog.provide('ol.format.filter.LogicalNary');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.format.filter.Filter');
/**
* @module ol/format/filter/LogicalNary
*/
import _ol_ from '../../index.js';
import _ol_asserts_ from '../../asserts.js';
import _ol_format_filter_Filter_ from '../filter/Filter.js';
/**
* @classdesc
@@ -16,15 +16,17 @@ goog.require('ol.format.filter.Filter');
* @param {...ol.format.filter.Filter} conditions Conditions.
* @extends {ol.format.filter.Filter}
*/
ol.format.filter.LogicalNary = function(tagName, conditions) {
var _ol_format_filter_LogicalNary_ = function(tagName, conditions) {
ol.format.filter.Filter.call(this, tagName);
_ol_format_filter_Filter_.call(this, tagName);
/**
* @public
* @type {Array.<ol.format.filter.Filter>}
*/
this.conditions = Array.prototype.slice.call(arguments, 1);
ol.asserts.assert(this.conditions.length >= 2, 57); // At least 2 conditions are required.
_ol_asserts_.assert(this.conditions.length >= 2, 57); // At least 2 conditions are required.
};
ol.inherits(ol.format.filter.LogicalNary, ol.format.filter.Filter);
_ol_.inherits(_ol_format_filter_LogicalNary_, _ol_format_filter_Filter_);
export default _ol_format_filter_LogicalNary_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Not');
goog.require('ol');
goog.require('ol.format.filter.Filter');
/**
* @module ol/format/filter/Not
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Filter_ from '../filter/Filter.js';
/**
* @classdesc
@@ -13,9 +13,9 @@ goog.require('ol.format.filter.Filter');
* @extends {ol.format.filter.Filter}
* @api
*/
ol.format.filter.Not = function(condition) {
var _ol_format_filter_Not_ = function(condition) {
ol.format.filter.Filter.call(this, 'Not');
_ol_format_filter_Filter_.call(this, 'Not');
/**
* @public
@@ -23,4 +23,6 @@ ol.format.filter.Not = function(condition) {
*/
this.condition = condition;
};
ol.inherits(ol.format.filter.Not, ol.format.filter.Filter);
_ol_.inherits(_ol_format_filter_Not_, _ol_format_filter_Filter_);
export default _ol_format_filter_Not_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.NotEqualTo');
goog.require('ol');
goog.require('ol.format.filter.ComparisonBinary');
/**
* @module ol/format/filter/NotEqualTo
*/
import _ol_ from '../../index.js';
import _ol_format_filter_ComparisonBinary_ from '../filter/ComparisonBinary.js';
/**
* @classdesc
@@ -15,7 +15,9 @@ goog.require('ol.format.filter.ComparisonBinary');
* @extends {ol.format.filter.ComparisonBinary}
* @api
*/
ol.format.filter.NotEqualTo = function(propertyName, expression, opt_matchCase) {
ol.format.filter.ComparisonBinary.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
var _ol_format_filter_NotEqualTo_ = function(propertyName, expression, opt_matchCase) {
_ol_format_filter_ComparisonBinary_.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
};
ol.inherits(ol.format.filter.NotEqualTo, ol.format.filter.ComparisonBinary);
_ol_.inherits(_ol_format_filter_NotEqualTo_, _ol_format_filter_ComparisonBinary_);
export default _ol_format_filter_NotEqualTo_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Or');
goog.require('ol');
goog.require('ol.format.filter.LogicalNary');
/**
* @module ol/format/filter/Or
*/
import _ol_ from '../../index.js';
import _ol_format_filter_LogicalNary_ from '../filter/LogicalNary.js';
/**
* @classdesc
@@ -13,8 +13,10 @@ goog.require('ol.format.filter.LogicalNary');
* @extends {ol.format.filter.LogicalNary}
* @api
*/
ol.format.filter.Or = function(conditions) {
var _ol_format_filter_Or_ = function(conditions) {
var params = ['Or'].concat(Array.prototype.slice.call(arguments));
ol.format.filter.LogicalNary.apply(this, params);
_ol_format_filter_LogicalNary_.apply(this, params);
};
ol.inherits(ol.format.filter.Or, ol.format.filter.LogicalNary);
_ol_.inherits(_ol_format_filter_Or_, _ol_format_filter_LogicalNary_);
export default _ol_format_filter_Or_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Spatial');
goog.require('ol');
goog.require('ol.format.filter.Filter');
/**
* @module ol/format/filter/Spatial
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Filter_ from '../filter/Filter.js';
/**
* @classdesc
@@ -22,9 +22,9 @@ goog.require('ol.format.filter.Filter');
* @extends {ol.format.filter.Filter}
* @api
*/
ol.format.filter.Spatial = function(tagName, geometryName, geometry, opt_srsName) {
var _ol_format_filter_Spatial_ = function(tagName, geometryName, geometry, opt_srsName) {
ol.format.filter.Filter.call(this, tagName);
_ol_format_filter_Filter_.call(this, tagName);
/**
* @public
@@ -44,4 +44,6 @@ ol.format.filter.Spatial = function(tagName, geometryName, geometry, opt_srsName
*/
this.srsName = opt_srsName;
};
ol.inherits(ol.format.filter.Spatial, ol.format.filter.Filter);
_ol_.inherits(_ol_format_filter_Spatial_, _ol_format_filter_Filter_);
export default _ol_format_filter_Spatial_;
+10 -8
View File
@@ -1,8 +1,8 @@
goog.provide('ol.format.filter.Within');
goog.require('ol');
goog.require('ol.format.filter.Spatial');
/**
* @module ol/format/filter/Within
*/
import _ol_ from '../../index.js';
import _ol_format_filter_Spatial_ from '../filter/Spatial.js';
/**
* @classdesc
@@ -17,9 +17,11 @@ goog.require('ol.format.filter.Spatial');
* @extends {ol.format.filter.Spatial}
* @api
*/
ol.format.filter.Within = function(geometryName, geometry, opt_srsName) {
var _ol_format_filter_Within_ = function(geometryName, geometry, opt_srsName) {
ol.format.filter.Spatial.call(this, 'Within', geometryName, geometry, opt_srsName);
_ol_format_filter_Spatial_.call(this, 'Within', geometryName, geometry, opt_srsName);
};
ol.inherits(ol.format.filter.Within, ol.format.filter.Spatial);
_ol_.inherits(_ol_format_filter_Within_, _ol_format_filter_Spatial_);
export default _ol_format_filter_Within_;