Automated class transform
npx lebab --replace src --transform class
This commit is contained in:
+159
-168
@@ -91,114 +91,181 @@ const Property = {
|
||||
* @param {module:ol/layer/Vector~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const VectorLayer = function(opt_options) {
|
||||
const options = opt_options ?
|
||||
opt_options : /** @type {module:ol/layer/Vector~Options} */ ({});
|
||||
class VectorLayer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ?
|
||||
opt_options : /** @type {module:ol/layer/Vector~Options} */ ({});
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = assign({}, options);
|
||||
|
||||
delete baseOptions.style;
|
||||
delete baseOptions.renderBuffer;
|
||||
delete baseOptions.updateWhileAnimating;
|
||||
delete baseOptions.updateWhileInteracting;
|
||||
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
|
||||
delete baseOptions.style;
|
||||
delete baseOptions.renderBuffer;
|
||||
delete baseOptions.updateWhileAnimating;
|
||||
delete baseOptions.updateWhileInteracting;
|
||||
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.declutter_ = options.declutter !== undefined ? options.declutter : false;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.declutter_ = options.declutter !== undefined ? options.declutter : false;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.renderBuffer_ = options.renderBuffer !== undefined ?
|
||||
options.renderBuffer : 100;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.renderBuffer_ = options.renderBuffer !== undefined ?
|
||||
options.renderBuffer : 100;
|
||||
|
||||
/**
|
||||
* User provided style.
|
||||
* @type {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
|
||||
* @private
|
||||
*/
|
||||
this.style_ = null;
|
||||
/**
|
||||
* User provided style.
|
||||
* @type {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
|
||||
* @private
|
||||
*/
|
||||
this.style_ = null;
|
||||
|
||||
/**
|
||||
* Style function for use within the library.
|
||||
* @type {module:ol/style/Style~StyleFunction|undefined}
|
||||
* @private
|
||||
*/
|
||||
this.styleFunction_ = undefined;
|
||||
/**
|
||||
* Style function for use within the library.
|
||||
* @type {module:ol/style/Style~StyleFunction|undefined}
|
||||
* @private
|
||||
*/
|
||||
this.styleFunction_ = undefined;
|
||||
|
||||
this.setStyle(options.style);
|
||||
this.setStyle(options.style);
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
|
||||
options.updateWhileAnimating : false;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
|
||||
options.updateWhileAnimating : false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
|
||||
options.updateWhileInteracting : false;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
|
||||
options.updateWhileInteracting : false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/layer/VectorTileRenderType|string}
|
||||
*/
|
||||
this.renderMode_ = options.renderMode || VectorRenderType.VECTOR;
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/layer/VectorTileRenderType|string}
|
||||
*/
|
||||
this.renderMode_ = options.renderMode || VectorRenderType.VECTOR;
|
||||
|
||||
/**
|
||||
* The layer type.
|
||||
* @protected
|
||||
* @type {module:ol/LayerType}
|
||||
*/
|
||||
this.type = LayerType.VECTOR;
|
||||
/**
|
||||
* The layer type.
|
||||
* @protected
|
||||
* @type {module:ol/LayerType}
|
||||
*/
|
||||
this.type = LayerType.VECTOR;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean} Declutter.
|
||||
*/
|
||||
getDeclutter() {
|
||||
return this.declutter_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} declutter Declutter.
|
||||
*/
|
||||
setDeclutter(declutter) {
|
||||
this.declutter_ = declutter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number|undefined} Render buffer.
|
||||
*/
|
||||
getRenderBuffer() {
|
||||
return this.renderBuffer_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {function(module:ol/Feature, module:ol/Feature): number|null|undefined} Render
|
||||
* order.
|
||||
*/
|
||||
getRenderOrder() {
|
||||
return (
|
||||
/** @type {module:ol/render~OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style for features. This returns whatever was passed to the `style`
|
||||
* option at construction or to the `setStyle` method.
|
||||
* @return {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
|
||||
* Layer style.
|
||||
* @api
|
||||
*/
|
||||
getStyle() {
|
||||
return this.style_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style function.
|
||||
* @return {module:ol/style/Style~StyleFunction|undefined} Layer style function.
|
||||
* @api
|
||||
*/
|
||||
getStyleFunction() {
|
||||
return this.styleFunction_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the rendered layer should be updated while
|
||||
* animating.
|
||||
*/
|
||||
getUpdateWhileAnimating() {
|
||||
return this.updateWhileAnimating_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the rendered layer should be updated while
|
||||
* interacting.
|
||||
*/
|
||||
getUpdateWhileInteracting() {
|
||||
return this.updateWhileInteracting_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render~OrderFunction|null|undefined} renderOrder
|
||||
* Render order.
|
||||
*/
|
||||
setRenderOrder(renderOrder) {
|
||||
this.set(Property.RENDER_ORDER, renderOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the style for features. This can be a single style object, an array
|
||||
* of styles, or a function that takes a feature and resolution and returns
|
||||
* an array of styles. If it is `undefined` the default style is used. If
|
||||
* it is `null` the layer has no style (a `null` style), so only features
|
||||
* that have their own styles will be rendered in the layer. See
|
||||
* {@link module:ol/style} for information on the default style.
|
||||
* @param {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction|null|undefined}
|
||||
* style Layer style.
|
||||
* @api
|
||||
*/
|
||||
setStyle(style) {
|
||||
this.style_ = style !== undefined ? style : createDefaultStyle;
|
||||
this.styleFunction_ = style === null ?
|
||||
undefined : toStyleFunction(this.style_);
|
||||
this.changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {module:ol/layer/VectorRenderType|string} The render mode.
|
||||
*/
|
||||
getRenderMode() {
|
||||
return this.renderMode_;
|
||||
}
|
||||
}
|
||||
|
||||
inherits(VectorLayer, Layer);
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Declutter.
|
||||
*/
|
||||
VectorLayer.prototype.getDeclutter = function() {
|
||||
return this.declutter_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {boolean} declutter Declutter.
|
||||
*/
|
||||
VectorLayer.prototype.setDeclutter = function(declutter) {
|
||||
this.declutter_ = declutter;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} Render buffer.
|
||||
*/
|
||||
VectorLayer.prototype.getRenderBuffer = function() {
|
||||
return this.renderBuffer_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {function(module:ol/Feature, module:ol/Feature): number|null|undefined} Render
|
||||
* order.
|
||||
*/
|
||||
VectorLayer.prototype.getRenderOrder = function() {
|
||||
return (
|
||||
/** @type {module:ol/render~OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER))
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return the associated {@link module:ol/source/Vector vectorsource} of the layer.
|
||||
* @function
|
||||
@@ -208,80 +275,4 @@ VectorLayer.prototype.getRenderOrder = function() {
|
||||
VectorLayer.prototype.getSource;
|
||||
|
||||
|
||||
/**
|
||||
* Get the style for features. This returns whatever was passed to the `style`
|
||||
* option at construction or to the `setStyle` method.
|
||||
* @return {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
|
||||
* Layer style.
|
||||
* @api
|
||||
*/
|
||||
VectorLayer.prototype.getStyle = function() {
|
||||
return this.style_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the style function.
|
||||
* @return {module:ol/style/Style~StyleFunction|undefined} Layer style function.
|
||||
* @api
|
||||
*/
|
||||
VectorLayer.prototype.getStyleFunction = function() {
|
||||
return this.styleFunction_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the rendered layer should be updated while
|
||||
* animating.
|
||||
*/
|
||||
VectorLayer.prototype.getUpdateWhileAnimating = function() {
|
||||
return this.updateWhileAnimating_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the rendered layer should be updated while
|
||||
* interacting.
|
||||
*/
|
||||
VectorLayer.prototype.getUpdateWhileInteracting = function() {
|
||||
return this.updateWhileInteracting_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/render~OrderFunction|null|undefined} renderOrder
|
||||
* Render order.
|
||||
*/
|
||||
VectorLayer.prototype.setRenderOrder = function(renderOrder) {
|
||||
this.set(Property.RENDER_ORDER, renderOrder);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Set the style for features. This can be a single style object, an array
|
||||
* of styles, or a function that takes a feature and resolution and returns
|
||||
* an array of styles. If it is `undefined` the default style is used. If
|
||||
* it is `null` the layer has no style (a `null` style), so only features
|
||||
* that have their own styles will be rendered in the layer. See
|
||||
* {@link module:ol/style} for information on the default style.
|
||||
* @param {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction|null|undefined}
|
||||
* style Layer style.
|
||||
* @api
|
||||
*/
|
||||
VectorLayer.prototype.setStyle = function(style) {
|
||||
this.style_ = style !== undefined ? style : createDefaultStyle;
|
||||
this.styleFunction_ = style === null ?
|
||||
undefined : toStyleFunction(this.style_);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {module:ol/layer/VectorRenderType|string} The render mode.
|
||||
*/
|
||||
VectorLayer.prototype.getRenderMode = function() {
|
||||
return this.renderMode_;
|
||||
};
|
||||
|
||||
|
||||
export default VectorLayer;
|
||||
|
||||
Reference in New Issue
Block a user