Remove ol.View base class
This commit is contained in:
@@ -45,7 +45,6 @@ goog.require('ol.RendererType');
|
|||||||
goog.require('ol.Size');
|
goog.require('ol.Size');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileQueue');
|
goog.require('ol.TileQueue');
|
||||||
goog.require('ol.View');
|
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.ViewHint');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.control');
|
goog.require('ol.control');
|
||||||
|
|||||||
@@ -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.<number>}
|
|
||||||
*/
|
|
||||||
this.hints_ = [0, 0];
|
|
||||||
|
|
||||||
};
|
|
||||||
goog.inherits(ol.View, ol.Object);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {Array.<number>} 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];
|
|
||||||
};
|
|
||||||
+42
-4
@@ -1,15 +1,17 @@
|
|||||||
goog.provide('ol.View2D');
|
goog.provide('ol.View2D');
|
||||||
goog.provide('ol.View2DProperty');
|
goog.provide('ol.View2DProperty');
|
||||||
|
goog.provide('ol.ViewHint');
|
||||||
|
|
||||||
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.CenterConstraint');
|
goog.require('ol.CenterConstraint');
|
||||||
goog.require('ol.Constraints');
|
goog.require('ol.Constraints');
|
||||||
|
goog.require('ol.Object');
|
||||||
goog.require('ol.ResolutionConstraint');
|
goog.require('ol.ResolutionConstraint');
|
||||||
goog.require('ol.RotationConstraint');
|
goog.require('ol.RotationConstraint');
|
||||||
goog.require('ol.RotationConstraintType');
|
goog.require('ol.RotationConstraintType');
|
||||||
goog.require('ol.Size');
|
goog.require('ol.Size');
|
||||||
goog.require('ol.View');
|
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
@@ -29,6 +31,15 @@ ol.View2DProperty = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
ol.ViewHint = {
|
||||||
|
ANIMATING: 0,
|
||||||
|
INTERACTING: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -77,7 +88,7 @@ ol.View2DProperty = {
|
|||||||
* rotation value to zero when approaching the horizontal.
|
* rotation value to zero when approaching the horizontal.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.View}
|
* @extends {ol.Object}
|
||||||
* @param {olx.View2DOptions=} opt_options View2D options.
|
* @param {olx.View2DOptions=} opt_options View2D options.
|
||||||
* @todo api
|
* @todo api
|
||||||
*/
|
*/
|
||||||
@@ -85,6 +96,12 @@ ol.View2D = function(opt_options) {
|
|||||||
goog.base(this);
|
goog.base(this);
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<number>}
|
||||||
|
*/
|
||||||
|
this.hints_ = [0, 0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object.<string, *>}
|
* @type {Object.<string, *>}
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +153,7 @@ ol.View2D = function(opt_options) {
|
|||||||
goog.isDef(options.rotation) ? options.rotation : 0;
|
goog.isDef(options.rotation) ? options.rotation : 0;
|
||||||
this.setValues(values);
|
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);
|
ol.View2D.prototype.getCenter);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Array.<number>} 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
|
* Calculate the extent for the given size in pixels, based on the current
|
||||||
* resolution and the current center.
|
* resolution and the current center.
|
||||||
@@ -360,7 +385,7 @@ ol.View2D.prototype.getValueForResolutionFunction = function(opt_power) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @return {ol.View2D} View2D.
|
||||||
* @todo api
|
* @todo api
|
||||||
*/
|
*/
|
||||||
ol.View2D.prototype.getView2D = function() {
|
ol.View2D.prototype.getView2D = function() {
|
||||||
@@ -566,6 +591,19 @@ goog.exportProperty(
|
|||||||
ol.View2D.prototype.setCenter);
|
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.
|
* Set the projection of this view.
|
||||||
* Warning! This code is not yet implemented. Function should not be used.
|
* Warning! This code is not yet implemented. Function should not be used.
|
||||||
|
|||||||
Reference in New Issue
Block a user