Files
openlayers/src/ol/style/Circle.js
Tim Schaub ad62739a6e Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
2018-01-12 00:50:30 -07:00

65 lines
1.5 KiB
JavaScript

/**
* @module ol/style/Circle
*/
import {inherits} from '../index.js';
import RegularShape from '../style/RegularShape.js';
/**
* @classdesc
* Set circle style for vector features.
*
* @constructor
* @param {olx.style.CircleOptions=} opt_options Options.
* @extends {ol.style.RegularShape}
* @api
*/
const CircleStyle = function(opt_options) {
const options = opt_options || {};
RegularShape.call(this, {
points: Infinity,
fill: options.fill,
radius: options.radius,
snapToPixel: options.snapToPixel,
stroke: options.stroke,
atlasManager: options.atlasManager
});
};
inherits(CircleStyle, RegularShape);
/**
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
* @return {ol.style.Circle} The cloned style.
* @override
* @api
*/
CircleStyle.prototype.clone = function() {
const style = new CircleStyle({
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
radius: this.getRadius(),
snapToPixel: this.getSnapToPixel(),
atlasManager: this.atlasManager_
});
style.setOpacity(this.getOpacity());
style.setScale(this.getScale());
return style;
};
/**
* Set the circle radius.
*
* @param {number} radius Circle radius.
* @api
*/
CircleStyle.prototype.setRadius = function(radius) {
this.radius_ = radius;
this.render_(this.atlasManager_);
};
export default CircleStyle;