Implement view hints architecture

This commit is contained in:
Tom Payne
2013-01-12 16:51:17 +01:00
parent 2a08e7add2
commit 5d31a44c12
4 changed files with 39 additions and 1 deletions

View File

@@ -1,10 +1,19 @@
goog.provide('ol.View');
goog.provide('ol.ViewHint');
goog.require('ol.IView');
goog.require('ol.IView2D');
goog.require('ol.IView3D');
/**
* @enum {number}
*/
ol.ViewHint = {
PANNING: 0
};
/**
* @constructor
@@ -12,10 +21,25 @@ goog.require('ol.IView3D');
* @extends {ol.Object}
*/
ol.View = function() {
/**
* @private
* @type {Array.<number>}
*/
this.hints_ = [0];
};
goog.inherits(ol.View, ol.Object);
/**
* @return {Array.<number>} Hint.
*/
ol.View.prototype.getHints = function() {
return this.hints_;
};
/**
* @inheritDoc
*/
@@ -27,3 +51,13 @@ ol.View.prototype.getView2D = goog.abstractMethod;
*/
ol.View.prototype.getView3D = goog.abstractMethod;
/**
* @param {ol.ViewHint} hint Hint.
* @param {number} delta Delta.
*/
ol.View.prototype.setHint = function(hint, delta) {
goog.asserts.assert(0 <= hint && hint < this.hints_.length);
this.hints_[hint] += delta;
goog.asserts.assert(this.hints_[hint] >= 0);
};