Add getters to ol.style.Stroke
This commit is contained in:
@@ -131,8 +131,10 @@ ol.style.Circle.prototype.render_ = function() {
|
||||
context.fill();
|
||||
}
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
context.strokeStyle = ol.color.asString(this.stroke_.color);
|
||||
context.lineWidth = goog.isDef(this.stroke_.width) ? this.stroke_.width : 1;
|
||||
var strokeColor = this.stroke_.getColor();
|
||||
context.strokeStyle = ol.color.asString(strokeColor);
|
||||
var strokeWidth = this.stroke_.getWidth();
|
||||
context.lineWidth = goog.isDef(strokeWidth) ? strokeWidth : 1;
|
||||
context.stroke();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,32 +13,86 @@ ol.style.Stroke = function(opt_options) {
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Color|string}
|
||||
*/
|
||||
this.color = goog.isDef(options.color) ? options.color : null;
|
||||
this.color_ = goog.isDef(options.color) ? options.color : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.lineCap = options.lineCap;
|
||||
this.lineCap_ = options.lineCap;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
this.lineDash = goog.isDef(options.lineDash) ? options.lineDash : null;
|
||||
this.lineDash_ = goog.isDef(options.lineDash) ? options.lineDash : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.lineJoin = options.lineJoin;
|
||||
this.lineJoin_ = options.lineJoin;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.miterLimit = options.miterLimit;
|
||||
this.miterLimit_ = options.miterLimit;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.width = options.width;
|
||||
this.width_ = options.width;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Color|string} Color.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getColor = function() {
|
||||
return this.color_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {string|undefined} Line cap.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getLineCap = function() {
|
||||
return this.lineCap_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<number>} Line dash.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getLineDash = function() {
|
||||
return this.lineDash_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {string|undefined} Line join.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getLineJoin = function() {
|
||||
return this.lineJoin_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} Miter limit.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getMiterLimit = function() {
|
||||
return this.miterLimit_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} Width.
|
||||
*/
|
||||
ol.style.Stroke.prototype.getWidth = function() {
|
||||
return this.width_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user