Merge remote-tracking branch 'upstream/master' into webgl-point
Conflicts: src/ol/style/circlestyle.js src/ol/style/regularshapestyle.js test/spec/ol/style/regularshapestyle.test.js
This commit is contained in:
@@ -4,6 +4,7 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('ol.color');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.render.canvas');
|
||||
goog.require('ol.structs.IHasChecksum');
|
||||
goog.require('ol.style.Fill');
|
||||
@@ -243,7 +244,7 @@ ol.style.Circle.prototype.unlistenImageChange = goog.nullFunction;
|
||||
|
||||
/**
|
||||
* @typedef {{strokeStyle: (string|undefined), strokeWidth: number,
|
||||
* size: number}}
|
||||
* size: number, lineDash: Array.<number>}}
|
||||
*/
|
||||
ol.style.Circle.RenderOptions;
|
||||
|
||||
@@ -253,7 +254,10 @@ ol.style.Circle.RenderOptions;
|
||||
* @param {ol.style.AtlasManager|undefined} atlasManager
|
||||
*/
|
||||
ol.style.Circle.prototype.render_ = function(atlasManager) {
|
||||
var strokeStyle, strokeWidth = 0, imageSize;
|
||||
var imageSize;
|
||||
var lineDash = null;
|
||||
var strokeStyle;
|
||||
var strokeWidth = 0;
|
||||
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
strokeStyle = ol.color.asString(this.stroke_.getColor());
|
||||
@@ -261,15 +265,21 @@ ol.style.Circle.prototype.render_ = function(atlasManager) {
|
||||
if (!goog.isDef(strokeWidth)) {
|
||||
strokeWidth = ol.render.canvas.defaultLineWidth;
|
||||
}
|
||||
lineDash = this.stroke_.getLineDash();
|
||||
if (!ol.has.CANVAS_LINE_DASH) {
|
||||
lineDash = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var size = 2 * (this.radius_ + strokeWidth) + 1;
|
||||
|
||||
/** @type {ol.style.Circle.RenderOptions} */
|
||||
var renderOptions = {
|
||||
strokeStyle: strokeStyle,
|
||||
strokeWidth: strokeWidth,
|
||||
size: size
|
||||
size: size,
|
||||
lineDash: lineDash
|
||||
};
|
||||
|
||||
if (!goog.isDef(atlasManager)) {
|
||||
@@ -355,6 +365,9 @@ ol.style.Circle.prototype.draw_ = function(renderOptions, context, x, y) {
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (!goog.isNull(renderOptions.lineDash)) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
}
|
||||
context.stroke();
|
||||
}
|
||||
context.closePath();
|
||||
@@ -412,6 +425,9 @@ ol.style.Circle.prototype.drawHitDetectionCanvas_ =
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (!goog.isNull(renderOptions.lineDash)) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
}
|
||||
context.stroke();
|
||||
}
|
||||
context.closePath();
|
||||
|
||||
@@ -4,6 +4,7 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('ol.color');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.render.canvas');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Image');
|
||||
@@ -14,7 +15,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.
|
||||
@@ -68,18 +71,22 @@ ol.style.RegularShape = function(opt_options) {
|
||||
*/
|
||||
this.points_ = options.points;
|
||||
|
||||
goog.asserts.assert(goog.isDef(options.radius) ||
|
||||
goog.isDef(options.radius1));
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.radius_ = options.radius;
|
||||
this.radius_ = /** @type {number} */ (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
|
||||
@@ -222,6 +229,15 @@ ol.style.RegularShape.prototype.getRadius = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} Radius2.
|
||||
* @api
|
||||
*/
|
||||
ol.style.RegularShape.prototype.getRadius2 = function() {
|
||||
return this.radius2_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @api
|
||||
@@ -260,7 +276,7 @@ ol.style.RegularShape.prototype.unlistenImageChange = goog.nullFunction;
|
||||
|
||||
/**
|
||||
* @typedef {{strokeStyle: (string|undefined), strokeWidth: number,
|
||||
* size: number}}
|
||||
* size: number, lineDash: Array.<number>}}
|
||||
*/
|
||||
ol.style.RegularShape.RenderOptions;
|
||||
|
||||
@@ -270,7 +286,10 @@ ol.style.RegularShape.RenderOptions;
|
||||
* @param {ol.style.AtlasManager|undefined} atlasManager
|
||||
*/
|
||||
ol.style.RegularShape.prototype.render_ = function(atlasManager) {
|
||||
var strokeStyle, strokeWidth = 0, imageSize;
|
||||
var imageSize;
|
||||
var lineDash = null;
|
||||
var strokeStyle;
|
||||
var strokeWidth = 0;
|
||||
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
strokeStyle = ol.color.asString(this.stroke_.getColor());
|
||||
@@ -278,6 +297,10 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
|
||||
if (!goog.isDef(strokeWidth)) {
|
||||
strokeWidth = ol.render.canvas.defaultLineWidth;
|
||||
}
|
||||
lineDash = this.stroke_.getLineDash();
|
||||
if (!ol.has.CANVAS_LINE_DASH) {
|
||||
lineDash = null;
|
||||
}
|
||||
}
|
||||
|
||||
var size = 2 * (this.radius_ + strokeWidth) + 1;
|
||||
@@ -286,7 +309,8 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
|
||||
var renderOptions = {
|
||||
strokeStyle: strokeStyle,
|
||||
strokeWidth: strokeWidth,
|
||||
size: size
|
||||
size: size,
|
||||
lineDash: lineDash
|
||||
};
|
||||
|
||||
if (!goog.isDef(atlasManager)) {
|
||||
@@ -379,6 +403,9 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (!goog.isNull(renderOptions.lineDash)) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
}
|
||||
context.stroke();
|
||||
}
|
||||
context.closePath();
|
||||
@@ -444,6 +471,9 @@ ol.style.RegularShape.prototype.drawHitDetectionCanvas_ =
|
||||
if (!goog.isNull(this.stroke_)) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (!goog.isNull(renderOptions.lineDash)) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
}
|
||||
context.stroke();
|
||||
}
|
||||
context.closePath();
|
||||
|
||||
Reference in New Issue
Block a user