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
+368 -425
View File
File diff suppressed because it is too large Load Diff
+33 -35
View File
@@ -65,6 +65,37 @@ var GeoJSON = function(opt_options) {
inherits(GeoJSON, JSONFeature); 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 {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
@@ -74,7 +105,7 @@ function readGeometry(object, opt_options) {
if (!object) { if (!object) {
return null; return null;
} }
var geometryReader = GeoJSON.GEOMETRY_READERS_[object.type]; var geometryReader = GEOMETRY_READERS[object.type];
return ( return (
/** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions( /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(
geometryReader(object), false, opt_options) geometryReader(object), false, opt_options)
@@ -160,7 +191,7 @@ function readPolygonGeometry(object) {
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/ */
function writeGeometry(geometry, opt_options) { function writeGeometry(geometry, opt_options) {
var geometryWriter = GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; var geometryWriter = GEOMETRY_WRITERS[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ ( return geometryWriter(/** @type {ol.geom.Geometry} */ (
FeatureFormat.transformWithOptions(geometry, true, opt_options)), FeatureFormat.transformWithOptions(geometry, true, opt_options)),
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 * Read a feature from a GeoJSON Feature source. Only works for Feature or
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read * geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read
+2 -2
View File
@@ -8,7 +8,7 @@ var XLink = {};
* @const * @const
* @type {string} * @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. * @return {boolean|undefined} Boolean.
*/ */
XLink.readHref = function(node) { XLink.readHref = function(node) {
return node.getAttributeNS(XLink.NAMESPACE_URI, 'href'); return node.getAttributeNS(NAMESPACE_URI, 'href');
}; };
export default XLink; export default XLink;
-7
View File
@@ -6,13 +6,6 @@ import _ol_string_ from '../string.js';
var XSD = {}; var XSD = {};
/**
* @const
* @type {string}
*/
XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @return {boolean|undefined} Boolean. * @return {boolean|undefined} Boolean.