Merge pull request #7642 from fredj/unexport_private_gpx

Don't store private function into GPX
This commit is contained in:
Frédéric Junod
2017-12-21 08:28:06 +01:00
committed by GitHub
4 changed files with 403 additions and 469 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -65,6 +65,37 @@ var GeoJSON = function(opt_options) {
inherits(GeoJSON, JSONFeature);
/**
* @const
* @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>}
*/
var GEOMETRY_READERS = {
'Point': readPointGeometry,
'LineString': readLineStringGeometry,
'Polygon': readPolygonGeometry,
'MultiPoint': readMultiPointGeometry,
'MultiLineString': readMultiLineStringGeometry,
'MultiPolygon': readMultiPolygonGeometry,
'GeometryCollection': readGeometryCollectionGeometry
};
/**
* @const
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/
var GEOMETRY_WRITERS = {
'Point': writePointGeometry,
'LineString': writeLineStringGeometry,
'Polygon': writePolygonGeometry,
'MultiPoint': writeMultiPointGeometry,
'MultiLineString': writeMultiLineStringGeometry,
'MultiPolygon': writeMultiPolygonGeometry,
'GeometryCollection': writeGeometryCollectionGeometry,
'Circle': writeEmptyGeometryCollectionGeometry
};
/**
* @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
* @param {olx.format.ReadOptions=} opt_options Read options.
@@ -74,7 +105,7 @@ function readGeometry(object, opt_options) {
if (!object) {
return null;
}
var geometryReader = GeoJSON.GEOMETRY_READERS_[object.type];
var geometryReader = GEOMETRY_READERS[object.type];
return (
/** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(
geometryReader(object), false, opt_options)
@@ -160,7 +191,7 @@ function readPolygonGeometry(object) {
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/
function writeGeometry(geometry, opt_options) {
var geometryWriter = GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
var geometryWriter = GEOMETRY_WRITERS[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ (
FeatureFormat.transformWithOptions(geometry, true, opt_options)),
opt_options);
@@ -283,39 +314,6 @@ function writePolygonGeometry(geometry, opt_options) {
}
/**
* @const
* @private
* @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>}
*/
GeoJSON.GEOMETRY_READERS_ = {
'Point': readPointGeometry,
'LineString': readLineStringGeometry,
'Polygon': readPolygonGeometry,
'MultiPoint': readMultiPointGeometry,
'MultiLineString': readMultiLineStringGeometry,
'MultiPolygon': readMultiPolygonGeometry,
'GeometryCollection': readGeometryCollectionGeometry
};
/**
* @const
* @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/
GeoJSON.GEOMETRY_WRITERS_ = {
'Point': writePointGeometry,
'LineString': writeLineStringGeometry,
'Polygon': writePolygonGeometry,
'MultiPoint': writeMultiPointGeometry,
'MultiLineString': writeMultiLineStringGeometry,
'MultiPolygon': writeMultiPolygonGeometry,
'GeometryCollection': writeGeometryCollectionGeometry,
'Circle': writeEmptyGeometryCollectionGeometry
};
/**
* Read a feature from a GeoJSON Feature source. Only works for Feature or
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read

View File

@@ -8,7 +8,7 @@ var XLink = {};
* @const
* @type {string}
*/
XLink.NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
var NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
/**
@@ -16,6 +16,6 @@ XLink.NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
* @return {boolean|undefined} Boolean.
*/
XLink.readHref = function(node) {
return node.getAttributeNS(XLink.NAMESPACE_URI, 'href');
return node.getAttributeNS(NAMESPACE_URI, 'href');
};
export default XLink;

View File

@@ -6,13 +6,6 @@ import _ol_string_ from '../string.js';
var XSD = {};
/**
* @const
* @type {string}
*/
XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';
/**
* @param {Node} node Node.
* @return {boolean|undefined} Boolean.