From 2607399a48365c8917d049a4158818e74844a93e Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 29 Jul 2012 11:13:50 +0200 Subject: [PATCH] Add rotation property --- skeleton.js | 1 + src/ol/base/map.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/skeleton.js b/skeleton.js index b008450c77..153437b658 100644 --- a/skeleton.js +++ b/skeleton.js @@ -31,6 +31,7 @@ if (twoMaps) { map2.bindTo('center', map1); map2.bindTo('layers', map1); map2.bindTo('resolution', map1); + map2.bindTo('rotation', map1); } goog.exportSymbol('layer', layer); diff --git a/src/ol/base/map.js b/src/ol/base/map.js index 75c1ce4572..a95834d51a 100644 --- a/src/ol/base/map.js +++ b/src/ol/base/map.js @@ -50,6 +50,7 @@ ol.MapProperty = { LAYERS: 'layers', PROJECTION: 'projection', RESOLUTION: 'resolution', + ROTATION: 'rotation', SIZE: 'size', USER_PROJECTION: 'userProjection' }; @@ -193,6 +194,10 @@ ol.Map = function(target, opt_values, opt_viewportSizeMonitor) { this, ol.Object.getChangedEventType(ol.MapProperty.RESOLUTION), this.handleResolutionChanged, false, this); + goog.events.listen( + this, ol.Object.getChangedEventType(ol.MapProperty.ROTATION), + this.handleRotationChanged, false, this); + goog.events.listen( this, ol.Object.getChangedEventType(ol.MapProperty.SIZE), this.handleSizeChanged, false, this); @@ -413,6 +418,14 @@ ol.Map.prototype.getResolutionForExtent = function(extent) { }; +/** + * @return {number|undefined} Rotation. + */ +ol.Map.prototype.getRotation = function() { + return /** @type {number|undefined} */ this.get(ol.MapProperty.ROTATION); +}; + + /** * @return {ol.Size|undefined} Size. */ @@ -601,6 +614,12 @@ ol.Map.prototype.handleProjectionChanged = function() { ol.Map.prototype.handleResolutionChanged = goog.nullFunction; +/** + * @protected + */ +ol.Map.prototype.handleRotationChanged = goog.nullFunction; + + /** * @protected */ @@ -752,6 +771,14 @@ ol.Map.prototype.setResolution = function(resolution) { }; +/** + * @param {number} rotation Rotation. + */ +ol.Map.prototype.setRotation = function(rotation) { + this.set(ol.MapProperty.ROTATION, rotation); +}; + + /** * @param {ol.Size} size Size. */