Add rotation property

This commit is contained in:
Tom Payne
2012-07-29 11:13:50 +02:00
parent 74b67a2e3a
commit 2607399a48
2 changed files with 28 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ if (twoMaps) {
map2.bindTo('center', map1); map2.bindTo('center', map1);
map2.bindTo('layers', map1); map2.bindTo('layers', map1);
map2.bindTo('resolution', map1); map2.bindTo('resolution', map1);
map2.bindTo('rotation', map1);
} }
goog.exportSymbol('layer', layer); goog.exportSymbol('layer', layer);
+27
View File
@@ -50,6 +50,7 @@ ol.MapProperty = {
LAYERS: 'layers', LAYERS: 'layers',
PROJECTION: 'projection', PROJECTION: 'projection',
RESOLUTION: 'resolution', RESOLUTION: 'resolution',
ROTATION: 'rotation',
SIZE: 'size', SIZE: 'size',
USER_PROJECTION: 'userProjection' USER_PROJECTION: 'userProjection'
}; };
@@ -193,6 +194,10 @@ ol.Map = function(target, opt_values, opt_viewportSizeMonitor) {
this, ol.Object.getChangedEventType(ol.MapProperty.RESOLUTION), this, ol.Object.getChangedEventType(ol.MapProperty.RESOLUTION),
this.handleResolutionChanged, false, this); this.handleResolutionChanged, false, this);
goog.events.listen(
this, ol.Object.getChangedEventType(ol.MapProperty.ROTATION),
this.handleRotationChanged, false, this);
goog.events.listen( goog.events.listen(
this, ol.Object.getChangedEventType(ol.MapProperty.SIZE), this, ol.Object.getChangedEventType(ol.MapProperty.SIZE),
this.handleSizeChanged, false, this); 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. * @return {ol.Size|undefined} Size.
*/ */
@@ -601,6 +614,12 @@ ol.Map.prototype.handleProjectionChanged = function() {
ol.Map.prototype.handleResolutionChanged = goog.nullFunction; ol.Map.prototype.handleResolutionChanged = goog.nullFunction;
/**
* @protected
*/
ol.Map.prototype.handleRotationChanged = goog.nullFunction;
/** /**
* @protected * @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. * @param {ol.Size} size Size.
*/ */