fix up build
This commit is contained in:
committed by
ahocevar
parent
0168c2e46f
commit
7b31ec26ea
@@ -514,7 +514,7 @@
|
||||
* @property {Object|string|undefined} data Data to parse.
|
||||
* @property {ol.Extent|undefined} extent Extent.
|
||||
* @property {string|undefined} logo Logo.
|
||||
* @property {ol.parser.FeatureParser} parser Parser instance to parse data
|
||||
* @property {ol.parser.Parser} parser Parser instance to parse data
|
||||
* provided as `data` or fetched from `url`.
|
||||
* @property {ol.ProjectionLike|undefined} projection Projection. EPSG:4326
|
||||
* is assumed if not defined. TODO: Get projection from the parser instead
|
||||
|
||||
@@ -418,7 +418,7 @@ ol.layer.Vector.prototype.groupFeaturesBySymbolizerLiteral =
|
||||
|
||||
/**
|
||||
* @param {Object|Element|Document|string} data Feature data.
|
||||
* @param {ol.parser.FeatureParser} parser Feature parser.
|
||||
* @param {ol.parser.Parser} parser Feature parser.
|
||||
* @param {ol.Projection} projection This sucks. The layer should be a view in
|
||||
* one projection.
|
||||
*/
|
||||
@@ -462,7 +462,7 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
|
||||
this.addFeatures(features);
|
||||
};
|
||||
|
||||
var options = {callback: callback};
|
||||
var options = {callback: callback}, result;
|
||||
if (goog.isString(data)) {
|
||||
if (goog.isFunction(parser.readFeaturesFromStringAsync)) {
|
||||
parser.readFeaturesFromStringAsync(data, goog.bind(addFeatures, this),
|
||||
|
||||
@@ -96,7 +96,7 @@ ol.parser.AsyncObjectFeatureParser = function() {};
|
||||
|
||||
/**
|
||||
* @param {Object} obj Object representing features.
|
||||
* @param {function(Array.<ol.Feature>), ol.parser.ReadFeaturesMetadata}
|
||||
* @param {function(Array.<ol.Feature>, ol.parser.ReadFeaturesMetadata)}
|
||||
* callback Callback which is called
|
||||
* after parsing.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
|
||||
@@ -16,6 +16,7 @@ goog.require('ol.geom.SharedVertices');
|
||||
goog.require('ol.parser.Parser');
|
||||
goog.require('ol.parser.ReadFeaturesOptions');
|
||||
goog.require('ol.parser.StringFeatureParser');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
@@ -58,12 +59,13 @@ ol.parser.GeoJSON.read = function(str) {
|
||||
* Parse a GeoJSON feature collection.
|
||||
* @param {string} str GeoJSON feature collection.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.GeoJSON.prototype.readFeaturesFromString =
|
||||
ol.parser.GeoJSON.prototype.readFeaturesWithMetadataFromString =
|
||||
function(str, opt_options) {
|
||||
var json = /** @type {GeoJSONFeatureCollection} */ (JSON.parse(str));
|
||||
return this.parseFeatureCollection_(json, opt_options);
|
||||
return {features: this.parseFeatureCollection_(json, opt_options),
|
||||
metadata: {projection: ol.proj.get('EPSG:4326')}};
|
||||
};
|
||||
|
||||
|
||||
@@ -72,11 +74,12 @@ ol.parser.GeoJSON.prototype.readFeaturesFromString =
|
||||
* @param {GeoJSONFeatureCollection} object GeoJSON feature collection decoded
|
||||
* from JSON.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.GeoJSON.prototype.readFeaturesFromObject =
|
||||
ol.parser.GeoJSON.prototype.readFeaturesWithMetadataFromObject =
|
||||
function(object, opt_options) {
|
||||
return this.parseFeatureCollection_(object, opt_options);
|
||||
return {features: this.parseFeatureCollection_(object, opt_options),
|
||||
metadata: {projection: ol.proj.get('EPSG:4326')}};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ ol.parser.GPX = function(opt_options) {
|
||||
'gpx': function(node, obj) {
|
||||
if (!goog.isDef(obj.features)) {
|
||||
obj.features = [];
|
||||
obj.metadata = {projection: ol.proj.get('EPSG:4326')};
|
||||
}
|
||||
this.readChildNodes(node, obj);
|
||||
},
|
||||
@@ -233,17 +234,9 @@ ol.parser.GPX = function(opt_options) {
|
||||
goog.inherits(ol.parser.GPX, ol.parser.XML);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.parser.GPX.prototype.getProjection = function() {
|
||||
return ol.proj.get('EPSG:4326');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|Document|Element|Object} data Data to read.
|
||||
* @return {Object} An object representing the document.
|
||||
* @return {ol.parser.ReadFeaturesResult} An object representing the document.
|
||||
*/
|
||||
ol.parser.GPX.prototype.read = function(data) {
|
||||
if (goog.isString(data)) {
|
||||
@@ -252,7 +245,7 @@ ol.parser.GPX.prototype.read = function(data) {
|
||||
if (data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var obj = {};
|
||||
var obj = {features: [], metadata: {projection: ol.proj.get('EPSG:4326')}};
|
||||
this.readNode(data, obj);
|
||||
return obj;
|
||||
};
|
||||
@@ -262,12 +255,12 @@ ol.parser.GPX.prototype.read = function(data) {
|
||||
* Parse a GPX document provided as a string.
|
||||
* @param {string} str GPX document.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.GPX.prototype.readFeaturesFromString =
|
||||
ol.parser.GPX.prototype.readFeaturesWithMetadataFromString =
|
||||
function(str, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(str).features;
|
||||
return this.read(str);
|
||||
};
|
||||
|
||||
|
||||
@@ -275,24 +268,24 @@ ol.parser.GPX.prototype.readFeaturesFromString =
|
||||
* Parse a GPX document provided as a DOM structure.
|
||||
* @param {Element|Document} node Document or element node.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.GPX.prototype.readFeaturesFromNode =
|
||||
ol.parser.GPX.prototype.readFeaturesWithMetadataFromNode =
|
||||
function(node, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(node).features;
|
||||
return this.read(node);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj Object representing features.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.GPX.prototype.readFeaturesFromObject =
|
||||
ol.parser.GPX.prototype.readFeaturesWithMetadataFromObject =
|
||||
function(obj, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(obj).features;
|
||||
return this.read(obj);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ ol.parser.KML = function(opt_options) {
|
||||
'kml': function(node, obj) {
|
||||
if (!goog.isDef(obj.features)) {
|
||||
obj.features = [];
|
||||
obj.metadata = {projection: ol.proj.get('EPSG:4326')};
|
||||
}
|
||||
if (!goog.isDef(obj.links)) {
|
||||
obj.links = [];
|
||||
@@ -822,7 +823,8 @@ goog.inherits(ol.parser.KML, ol.parser.XML);
|
||||
|
||||
/**
|
||||
* @param {Object} obj Object representing features.
|
||||
* @param {function(Array.<ol.Feature>)} callback Callback which is called
|
||||
* @param {function(Array.<ol.Feature>, ol.parser.ReadFeaturesMetadata)}
|
||||
* callback Callback which is called
|
||||
* after parsing.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
*/
|
||||
@@ -834,15 +836,16 @@ ol.parser.KML.prototype.readFeaturesFromObjectAsync =
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} str KML document.
|
||||
* @param {function(Array.<ol.Feature>)} callback Callback which is called
|
||||
* @param {string} data String data.
|
||||
* @param {function(Array.<ol.Feature>, ol.parser.ReadFeaturesMetadata)}
|
||||
* callback Callback which is called
|
||||
* after parsing.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
*/
|
||||
ol.parser.KML.prototype.readFeaturesFromStringAsync =
|
||||
function(str, callback, opt_options) {
|
||||
function(data, callback, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
this.read(str, callback);
|
||||
this.read(data, callback);
|
||||
};
|
||||
|
||||
|
||||
@@ -850,12 +853,12 @@ ol.parser.KML.prototype.readFeaturesFromStringAsync =
|
||||
* Parse a KML document provided as a string.
|
||||
* @param {string} str KML document.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.KML.prototype.readFeaturesFromString =
|
||||
ol.parser.KML.prototype.readFeaturesWithMetadataFromString =
|
||||
function(str, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(str).features;
|
||||
return this.read(str);
|
||||
};
|
||||
|
||||
|
||||
@@ -863,24 +866,24 @@ ol.parser.KML.prototype.readFeaturesFromString =
|
||||
* Parse a KML document provided as a DOM structure.
|
||||
* @param {Element|Document} node Document or element node.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.KML.prototype.readFeaturesFromNode =
|
||||
ol.parser.KML.prototype.readFeaturesWithMetadataFromNode =
|
||||
function(node, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(node).features;
|
||||
return this.read(node);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj Object representing features.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.KML.prototype.readFeaturesFromObject =
|
||||
ol.parser.KML.prototype.readFeaturesWithMetadataFromObject =
|
||||
function(obj, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(obj).features;
|
||||
return this.read(obj);
|
||||
};
|
||||
|
||||
|
||||
@@ -929,19 +932,12 @@ ol.parser.KML.prototype.parseLinks = function(deferreds, obj, done) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.parser.KML.prototype.getProjection = function() {
|
||||
return ol.proj.get('EPSG:4326');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|Document|Element|Object} data Data to read.
|
||||
* @param {Function=} opt_callback Optional callback to call when reading
|
||||
* is done.
|
||||
* @return {Object} An object representing the document.
|
||||
* @return {ol.parser.ReadFeaturesResult} An object representing the
|
||||
* document.
|
||||
*/
|
||||
ol.parser.KML.prototype.read = function(data, opt_callback) {
|
||||
if (goog.isString(data)) {
|
||||
@@ -950,7 +946,7 @@ ol.parser.KML.prototype.read = function(data, opt_callback) {
|
||||
if (data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var obj = {};
|
||||
var obj = {features: [], metadata: {projection: ol.proj.get('EPSG:4326')}};
|
||||
this.readNode(data, obj);
|
||||
if (goog.isDef(opt_callback)) {
|
||||
var deferreds = [];
|
||||
@@ -964,15 +960,15 @@ ol.parser.KML.prototype.read = function(data, opt_callback) {
|
||||
var feature = obj.features[i];
|
||||
this.applyStyle_(feature, obj['styles']);
|
||||
}
|
||||
opt_callback.call(null, obj.features);
|
||||
opt_callback.call(null, obj);
|
||||
}, function() {
|
||||
throw new Error('KML: parsing of NetworkLinks failed');
|
||||
}, this);
|
||||
});
|
||||
} else {
|
||||
return obj;
|
||||
return /* ol.parser.ReadFeaturesResult */(obj);
|
||||
}
|
||||
return null;
|
||||
return {features: null, metadata: {projection: ol.proj.get('EPSG:4326')}};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ goog.inherits(ol.parser.ogc.GML, ol.parser.XML);
|
||||
|
||||
/**
|
||||
* @param {string|Document|Element|Object} data Data to read.
|
||||
* @return {Object} An object representing the document.
|
||||
* @return {ol.parser.ReadFeaturesResult} An object representing the document.
|
||||
*/
|
||||
ol.parser.ogc.GML.prototype.read = function(data) {
|
||||
if (typeof data == 'string') {
|
||||
@@ -464,7 +464,7 @@ ol.parser.ogc.GML.prototype.read = function(data) {
|
||||
if (data && data.nodeType == 9) {
|
||||
data = data.documentElement;
|
||||
}
|
||||
var obj = {features: []};
|
||||
var obj = {features: [], metadata: {projection: null}};
|
||||
this.readNode(data, obj, true);
|
||||
return obj;
|
||||
};
|
||||
@@ -570,10 +570,10 @@ ol.parser.ogc.GML.prototype.createGeometry_ = function(container,
|
||||
* Parse a GML document provided as a string.
|
||||
* @param {string} str GML document.
|
||||
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
|
||||
* @return {Array.<ol.Feature>} Array of features.
|
||||
* @return {ol.parser.ReadFeaturesResult} Features and metadata.
|
||||
*/
|
||||
ol.parser.ogc.GML.prototype.readFeaturesFromString =
|
||||
ol.parser.ogc.GML.prototype.readFeaturesWithMetadataFromString =
|
||||
function(str, opt_options) {
|
||||
this.readFeaturesOptions_ = opt_options;
|
||||
return this.read(str).features;
|
||||
return this.read(str);
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ ol.source.Vector = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.parser.FeatureParser}
|
||||
* @type {ol.parser.Parser}
|
||||
*/
|
||||
this.parser_ = goog.isDef(options.parser) ? options.parser : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user