Handle concrete classes with non implemented abstract methods
This commit is contained in:
@@ -223,3 +223,11 @@ ol.format.IGC.prototype.writeFeaturesText = function(features, opt_options) {};
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.IGC.prototype.writeGeometryText = function(geometry, opt_options) {};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.IGC.prototype.readGeometryFromText = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
@@ -253,3 +253,43 @@ ol.format.MVT.readGeometry_ = function(rawFeature) {
|
||||
|
||||
return geom;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.MVT.prototype.readFeature = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.MVT.prototype.readGeometry = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.MVT.prototype.writeFeature = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.MVT.prototype.writeGeometry = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.MVT.prototype.writeFeatures = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
@@ -416,3 +416,19 @@ ol.format.TopoJSON.prototype.writeFeaturesObject = function(features, opt_option
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.TopoJSON.prototype.writeGeometryObject = function(geometry, opt_options) {};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.TopoJSON.prototype.readGeometryFromObject = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.format.TopoJSON.prototype.readFeatureFromObject = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
@@ -7,6 +7,9 @@ goog.require('ol.format.FormatType');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
/* eslint-disable valid-jsdoc */
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
@@ -73,12 +76,13 @@ ol.format.XMLFeature.prototype.readFeatureFromDocument = function(
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {Node} node Node.
|
||||
* @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) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -148,23 +152,25 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {Document} doc Document.
|
||||
* @param {olx.format.ReadOptions=} opt_options 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) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {Node} node Node.
|
||||
* @param {olx.format.ReadOptions=} opt_options Options.
|
||||
* @protected
|
||||
* @return {ol.geom.Geometry} Geometry.
|
||||
*/
|
||||
ol.format.XMLFeature.prototype.readGeometryFromNode = function(node, opt_options) {};
|
||||
ol.format.XMLFeature.prototype.readGeometryFromNode = function(node, opt_options) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -214,13 +220,14 @@ ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) {
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @param {olx.format.WriteOptions=} opt_options Options.
|
||||
* @protected
|
||||
* @return {Node} Node.
|
||||
*/
|
||||
ol.format.XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) {};
|
||||
ol.format.XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -233,12 +240,13 @@ ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) {
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @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) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -251,9 +259,10 @@ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
|
||||
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {ol.geom.Geometry} geometry Geometry.
|
||||
* @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) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
@@ -101,11 +101,19 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
|
||||
var view = map.getView();
|
||||
projection = view.getProjection();
|
||||
}
|
||||
|
||||
var formatConstructors = this.formatConstructors_;
|
||||
var features = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = formatConstructors.length; i < ii; ++i) {
|
||||
/**
|
||||
* Avoid "cannot instantiate abstract class" error.
|
||||
* @type {Function}
|
||||
*/
|
||||
var formatConstructor = formatConstructors[i];
|
||||
/**
|
||||
* @type {ol.format.Feature}
|
||||
*/
|
||||
var format = new formatConstructor();
|
||||
features = this.tryReadFeatures_(format, result, {
|
||||
featureProjection: projection
|
||||
|
||||
@@ -331,7 +331,7 @@ ol.Map = function(options) {
|
||||
* @type {ol.renderer.Map}
|
||||
* @private
|
||||
*/
|
||||
this.renderer_ = new optionsInternal.rendererConstructor(this.viewport_, this);
|
||||
this.renderer_ = new /** @type {Function} */ (optionsInternal.rendererConstructor)(this.viewport_, this);
|
||||
|
||||
/**
|
||||
* @type {function(Event)|undefined}
|
||||
|
||||
@@ -109,6 +109,9 @@ if (ol.ENABLE_WEBGL) {
|
||||
}
|
||||
var replay = replays[replayType];
|
||||
if (replay === undefined) {
|
||||
/**
|
||||
* @type {Function}
|
||||
*/
|
||||
var Constructor = ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_[replayType];
|
||||
replay = new Constructor(this.tolerance_, this.maxExtent_);
|
||||
replays[replayType] = replay;
|
||||
|
||||
@@ -485,6 +485,14 @@ ol.source.Raster.Event = function(type, frameState, data) {
|
||||
ol.inherits(ol.source.Raster.Event, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ol.source.Raster.prototype.getImageInternal = function() {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user