# all files / ol/style/ circle.js

100% Statements 15/15
100% Branches 6/6
100% Functions 3/3
100% Lines 15/15

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    631×

    1×
    1×

    1×

    155×

    155×

    1×

    1×
    5×

    5×
    5×
    5×

    1×
    1×
    1×

     goog.provide('ol.style.Circle');

    goog.require('ol');
    goog.require('ol.style.RegularShape');

    /**
     * @classdesc
     * Set circle style for vector features.
     *
     * @constructor
     * @param {olx.style.CircleOptions=} opt_options Options.
     * @extends {ol.style.RegularShape}
     * @api
     */
    ol.style.Circle = function(opt_options) {

      var options = opt_options || {};

      ol.style.RegularShape.call(this, {
        points: Infinity,
        fill: options.fill,
        radius: options.radius,
        snapToPixel: options.snapToPixel,
        stroke: options.stroke,
        atlasManager: options.atlasManager
      });

    };
    ol.inherits(ol.style.Circle, ol.style.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
     */
    ol.style.Circle.prototype.clone = function() {
      var style = new ol.style.Circle({
        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
     */
    ol.style.Circle.prototype.setRadius = function(radius) {
      this.radius_ = radius;
      this.render_(this.atlasManager_);
    };