Implement rotation for ol.style.RegularShape

This commit is contained in:
Bart van den Eijnden
2014-12-12 15:19:31 +01:00
parent 2c9fab22c8
commit 38dca7792c
3 changed files with 12 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ var styles = {
stroke: stroke, stroke: stroke,
points: 3, points: 3,
radius: 10, radius: 10,
rotation: Math.PI / 4,
angle: 0 angle: 0
})) }))
})], })],

View File

@@ -5709,6 +5709,7 @@ olx.style.IconOptions.prototype.src;
* angle: (number|undefined), * angle: (number|undefined),
* snapToPixel: (boolean|undefined), * snapToPixel: (boolean|undefined),
* stroke: (ol.style.Stroke|undefined), * stroke: (ol.style.Stroke|undefined),
* rotation: (number|undefined),
* atlasManager: (ol.style.AtlasManager|undefined)}} * atlasManager: (ol.style.AtlasManager|undefined)}}
* @api * @api
*/ */
@@ -5757,7 +5758,7 @@ olx.style.RegularShapeOptions.prototype.radius2;
/** /**
* Shape's rotation in radians. A value of 0 will have one of the shape's point * Shape's angle in radians. A value of 0 will have one of the shape's point
* facing up. * facing up.
* Default value is 0. * Default value is 0.
* @type {number|undefined} * @type {number|undefined}
@@ -5788,6 +5789,14 @@ olx.style.RegularShapeOptions.prototype.snapToPixel;
olx.style.RegularShapeOptions.prototype.stroke; olx.style.RegularShapeOptions.prototype.stroke;
/**
* Rotation in radians (positive rotation clockwise). Default is `0`.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.rotation;
/** /**
* The atlas manager to use for this symbol. When using WebGL it is * The atlas manager to use for this symbol. When using WebGL it is
* recommended to use an atlas manager to avoid texture switching. * recommended to use an atlas manager to avoid texture switching.

View File

@@ -133,7 +133,7 @@ ol.style.RegularShape = function(options) {
goog.base(this, { goog.base(this, {
opacity: 1, opacity: 1,
rotateWithView: false, rotateWithView: false,
rotation: 0, rotation: goog.isDef(options.rotation) ? options.rotation : 0,
scale: 1, scale: 1,
snapToPixel: snapToPixel snapToPixel: snapToPixel
}); });