diff --git a/src/ol/map.js b/src/ol/map.js index 33a9987bfa..bf120edcb5 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -45,7 +45,6 @@ goog.require('ol.RendererType'); goog.require('ol.Size'); goog.require('ol.Tile'); goog.require('ol.TileQueue'); -goog.require('ol.View'); goog.require('ol.View2D'); goog.require('ol.ViewHint'); goog.require('ol.control'); diff --git a/src/ol/view.js b/src/ol/view.js deleted file mode 100644 index 73b2af8b3f..0000000000 --- a/src/ol/view.js +++ /dev/null @@ -1,85 +0,0 @@ -goog.provide('ol.View'); -goog.provide('ol.ViewHint'); - -goog.require('goog.array'); -goog.require('goog.asserts'); -goog.require('ol.Object'); - - -/** - * @enum {number} - */ -ol.ViewHint = { - ANIMATING: 0, - INTERACTING: 1 -}; - - - -/** - * @classdesc - * Abstract base class; normally only used for creating subclasses and not - * instantiated in apps. - * Maps can be viewed from different perspectives: 2D or 3D, or at different - * angles. To enable this, properties determining projection, position, angle or - * rotation cannot be part of the map itself, but of the particular view of that - * map. This is similar to the concept of Camera in Google Earth or KML. - * - * Only {@link ol.View2D} is currently implemented. - * - * @constructor - * @extends {ol.Object} - */ -ol.View = function() { - - goog.base(this); - - /** - * @private - * @type {Array.} - */ - this.hints_ = [0, 0]; - -}; -goog.inherits(ol.View, ol.Object); - - -/** - * @return {Array.} Hint. - */ -ol.View.prototype.getHints = function() { - return goog.array.clone(this.hints_); -}; - - -/** - * @return {ol.View2D} View2D. - */ -ol.View.prototype.getView2D = function() { - // FIXME for some reason, we can't use goog.abstractMethod here - goog.asserts.fail(); - return null; -}; - - -/** - * @return {boolean} Is defined. - */ -ol.View.prototype.isDef = function() { - // FIXME for some reason, we can't use goog.abstractMethod here - goog.asserts.fail(); - return false; -}; - - -/** - * @param {ol.ViewHint} hint Hint. - * @param {number} delta Delta. - * @return {number} New value. - */ -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); - return this.hints_[hint]; -}; diff --git a/src/ol/view2d.js b/src/ol/view2d.js index f87bbf40c7..c29d0c69c6 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -1,15 +1,17 @@ goog.provide('ol.View2D'); goog.provide('ol.View2DProperty'); +goog.provide('ol.ViewHint'); +goog.require('goog.array'); goog.require('goog.asserts'); goog.require('ol'); goog.require('ol.CenterConstraint'); goog.require('ol.Constraints'); +goog.require('ol.Object'); goog.require('ol.ResolutionConstraint'); goog.require('ol.RotationConstraint'); goog.require('ol.RotationConstraintType'); goog.require('ol.Size'); -goog.require('ol.View'); goog.require('ol.coordinate'); goog.require('ol.extent'); goog.require('ol.proj'); @@ -29,6 +31,15 @@ ol.View2DProperty = { }; +/** + * @enum {number} + */ +ol.ViewHint = { + ANIMATING: 0, + INTERACTING: 1 +}; + + /** * @classdesc @@ -77,7 +88,7 @@ ol.View2DProperty = { * rotation value to zero when approaching the horizontal. * * @constructor - * @extends {ol.View} + * @extends {ol.Object} * @param {olx.View2DOptions=} opt_options View2D options. * @todo api */ @@ -85,6 +96,12 @@ ol.View2D = function(opt_options) { goog.base(this); var options = goog.isDef(opt_options) ? opt_options : {}; + /** + * @private + * @type {Array.} + */ + this.hints_ = [0, 0]; + /** * @type {Object.} */ @@ -136,7 +153,7 @@ ol.View2D = function(opt_options) { goog.isDef(options.rotation) ? options.rotation : 0; this.setValues(values); }; -goog.inherits(ol.View2D, ol.View); +goog.inherits(ol.View2D, ol.Object); /** @@ -231,6 +248,14 @@ goog.exportProperty( ol.View2D.prototype.getCenter); +/** + * @return {Array.} Hint. + */ +ol.View2D.prototype.getHints = function() { + return goog.array.clone(this.hints_); +}; + + /** * Calculate the extent for the given size in pixels, based on the current * resolution and the current center. @@ -360,7 +385,7 @@ ol.View2D.prototype.getValueForResolutionFunction = function(opt_power) { /** - * @inheritDoc + * @return {ol.View2D} View2D. * @todo api */ ol.View2D.prototype.getView2D = function() { @@ -566,6 +591,19 @@ goog.exportProperty( ol.View2D.prototype.setCenter); +/** + * @param {ol.ViewHint} hint Hint. + * @param {number} delta Delta. + * @return {number} New value. + */ +ol.View2D.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); + return this.hints_[hint]; +}; + + /** * Set the projection of this view. * Warning! This code is not yet implemented. Function should not be used.