Add rotation property
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user