For stars, use radius1 and radius2 in ol.style.RegularShape

This commit is contained in:
Bart van den Eijnden
2014-11-28 14:22:02 +01:00
parent 9e591d21d0
commit da39e9f96a
3 changed files with 62 additions and 8 deletions

View File

@@ -13,7 +13,9 @@ goog.require('ol.style.Stroke');
/**
* @classdesc
* Set regular shape style for vector features.
* Set regular shape style for vector features. The resulting shape will be
* a regular polygon when `radius` is provided, or a star when `radius1` and
* `radius2` are provided.
*
* @constructor
* @param {olx.style.RegularShapeOptions=} opt_options Options.
@@ -59,14 +61,14 @@ ol.style.RegularShape = function(opt_options) {
* @private
* @type {number}
*/
this.radius_ = options.radius;
this.radius_ = goog.isDef(options.radius) ? options.radius : options.radius1;
/**
* @private
* @type {number}
*/
this.radius2_ =
goog.isDef(options.radius2) ? options.radius2 : options.radius;
goog.isDef(options.radius2) ? options.radius2 : this.radius_;
/**
* @private
@@ -173,6 +175,15 @@ ol.style.RegularShape.prototype.getRadius = function() {
};
/**
* @return {number} Radius2.
* @api
*/
ol.style.RegularShape.prototype.getRadius2 = function() {
return this.radius2_;
};
/**
* @inheritDoc
* @api