Remove IView and IView2D
This commit is contained in:
@@ -103,5 +103,7 @@ ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() {
|
||||
var view2D = view.getView2D();
|
||||
var extent = goog.isNull(this.extent_) ?
|
||||
view2D.getProjection().getExtent() : this.extent_;
|
||||
view2D.fitExtent(extent, map.getSize());
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(goog.isDef(size));
|
||||
view2D.fitExtent(extent, size);
|
||||
};
|
||||
|
||||
@@ -57,7 +57,9 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
||||
var view = map.getView().getView2D();
|
||||
var extent = this.getGeometry().getExtent();
|
||||
var center = ol.extent.getCenter(extent);
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(goog.isDef(size));
|
||||
ol.interaction.Interaction.zoom(map, view,
|
||||
view.getResolutionForExtent(extent, map.getSize()),
|
||||
view.getResolutionForExtent(extent, size),
|
||||
center, ol.DRAGZOOM_ANIMATION_DURATION);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,6 @@ goog.provide('ol.interaction.Interaction');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.Observable');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.animation');
|
||||
goog.require('ol.easing');
|
||||
|
||||
@@ -69,13 +68,12 @@ ol.interaction.Interaction.prototype.setMap = function(map) {
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.interaction.Interaction.pan = function(
|
||||
map, view, delta, opt_duration) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
var currentCenter = view.getCenter();
|
||||
if (goog.isDef(currentCenter)) {
|
||||
if (goog.isDef(opt_duration) && opt_duration > 0) {
|
||||
@@ -94,14 +92,13 @@ ol.interaction.Interaction.pan = function(
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.interaction.Interaction.rotate =
|
||||
function(map, view, rotation, opt_anchor, opt_duration) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
rotation = view.constrainRotation(rotation, 0);
|
||||
ol.interaction.Interaction.rotateWithoutConstraints(
|
||||
map, view, rotation, opt_anchor, opt_duration);
|
||||
@@ -110,14 +107,13 @@ ol.interaction.Interaction.rotate =
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.interaction.Interaction.rotateWithoutConstraints =
|
||||
function(map, view, rotation, opt_anchor, opt_duration) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
if (goog.isDefAndNotNull(rotation)) {
|
||||
var currentRotation = view.getRotation();
|
||||
var currentCenter = view.getCenter();
|
||||
@@ -136,7 +132,6 @@ ol.interaction.Interaction.rotateWithoutConstraints =
|
||||
}));
|
||||
}
|
||||
}
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
view.rotate(rotation, opt_anchor);
|
||||
}
|
||||
};
|
||||
@@ -144,7 +139,7 @@ ol.interaction.Interaction.rotateWithoutConstraints =
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {number|undefined} resolution Resolution to go to.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
|
||||
* @param {number=} opt_duration Duration.
|
||||
@@ -159,7 +154,6 @@ ol.interaction.Interaction.rotateWithoutConstraints =
|
||||
*/
|
||||
ol.interaction.Interaction.zoom =
|
||||
function(map, view, resolution, opt_anchor, opt_duration, opt_direction) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
resolution = view.constrainResolution(resolution, 0, opt_direction);
|
||||
ol.interaction.Interaction.zoomWithoutConstraints(
|
||||
map, view, resolution, opt_anchor, opt_duration);
|
||||
@@ -168,14 +162,13 @@ ol.interaction.Interaction.zoom =
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {number} delta Delta from previous zoom level.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.interaction.Interaction.zoomByDelta =
|
||||
function(map, view, delta, opt_anchor, opt_duration) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
var currentResolution = view.getResolution();
|
||||
var resolution = view.constrainResolution(currentResolution, delta, 0);
|
||||
ol.interaction.Interaction.zoomWithoutConstraints(
|
||||
@@ -185,14 +178,13 @@ ol.interaction.Interaction.zoomByDelta =
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.IView2D} view View.
|
||||
* @param {ol.View2D} view View.
|
||||
* @param {number|undefined} resolution Resolution to go to.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.interaction.Interaction.zoomWithoutConstraints =
|
||||
function(map, view, resolution, opt_anchor, opt_duration) {
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
if (goog.isDefAndNotNull(resolution)) {
|
||||
var currentResolution = view.getResolution();
|
||||
var currentCenter = view.getCenter();
|
||||
@@ -211,7 +203,6 @@ ol.interaction.Interaction.zoomWithoutConstraints =
|
||||
}));
|
||||
}
|
||||
}
|
||||
goog.asserts.assertInstanceof(view, ol.View2D);
|
||||
if (goog.isDefAndNotNull(opt_anchor)) {
|
||||
var center = view.calculateCenterZoom(resolution, opt_anchor);
|
||||
view.setCenter(center);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
goog.provide('ol.IView');
|
||||
|
||||
goog.require('ol.IView2D');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Interface for views.
|
||||
* @interface
|
||||
* @extends {goog.events.Listenable}
|
||||
*/
|
||||
ol.IView = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.IView2D} View2D.
|
||||
*/
|
||||
ol.IView.prototype.getView2D = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is defined.
|
||||
*/
|
||||
ol.IView.prototype.isDef = function() {
|
||||
};
|
||||
@@ -1,54 +0,0 @@
|
||||
goog.provide('ol.IView2D');
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Interface for views.
|
||||
* @interface
|
||||
*/
|
||||
ol.IView2D = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Coordinate|undefined} The center of the view.
|
||||
*/
|
||||
ol.IView2D.prototype.getCenter = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.proj.Projection|undefined} The projection of the view.
|
||||
*/
|
||||
ol.IView2D.prototype.getProjection = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} The resolution of the view.
|
||||
*/
|
||||
ol.IView2D.prototype.getResolution = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {number|undefined} The rotation of the view.
|
||||
*/
|
||||
ol.IView2D.prototype.getRotation = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {olx.View2DState} View2D state.
|
||||
*/
|
||||
ol.IView2D.prototype.getView2DState = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is defined.
|
||||
*/
|
||||
ol.IView2D.prototype.isDef = function() {
|
||||
};
|
||||
@@ -30,7 +30,6 @@ goog.require('goog.vec.Mat4');
|
||||
goog.require('ol.BrowserFeature');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.CollectionEventType');
|
||||
goog.require('ol.IView');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEvent.EventType');
|
||||
goog.require('ol.MapBrowserEventHandler');
|
||||
@@ -748,14 +747,14 @@ goog.exportProperty(
|
||||
|
||||
|
||||
/**
|
||||
* Get the view associated with this map. This can be a 2D or 3D view. A 2D
|
||||
* view manages properties such as center and resolution.
|
||||
* @return {ol.IView|undefined} The view that controls this map.
|
||||
* Get the view associated with this map. A view manages properties such as
|
||||
* center and resolution.
|
||||
* @return {ol.View2D|undefined} The view that controls this map.
|
||||
* @todo observable
|
||||
* @todo api stable
|
||||
*/
|
||||
ol.Map.prototype.getView = function() {
|
||||
return /** @type {ol.IView} */ (this.get(ol.MapProperty.VIEW));
|
||||
return /** @type {ol.View2D} */ (this.get(ol.MapProperty.VIEW));
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Map.prototype,
|
||||
@@ -1319,7 +1318,7 @@ goog.exportProperty(
|
||||
|
||||
/**
|
||||
* Set the view for this map.
|
||||
* @param {ol.IView} view The view that controls this map.
|
||||
* @param {ol.View2D} view The view that controls this map.
|
||||
* @todo observable
|
||||
* @todo api stable
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.provide('ol.ViewHint');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.IView');
|
||||
goog.require('ol.Object');
|
||||
|
||||
|
||||
@@ -29,7 +28,6 @@ ol.ViewHint = {
|
||||
* Only {@link ol.View2D} is currently implemented.
|
||||
*
|
||||
* @constructor
|
||||
* @implements {ol.IView}
|
||||
* @extends {ol.Object}
|
||||
*/
|
||||
ol.View = function() {
|
||||
@@ -55,7 +53,7 @@ ol.View.prototype.getHints = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {ol.View2D} View2D.
|
||||
*/
|
||||
ol.View.prototype.getView2D = function() {
|
||||
// FIXME for some reason, we can't use goog.abstractMethod here
|
||||
@@ -65,7 +63,7 @@ ol.View.prototype.getView2D = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {boolean} Is defined.
|
||||
*/
|
||||
ol.View.prototype.isDef = function() {
|
||||
// FIXME for some reason, we can't use goog.abstractMethod here
|
||||
|
||||
@@ -5,7 +5,6 @@ goog.require('goog.asserts');
|
||||
goog.require('ol');
|
||||
goog.require('ol.CenterConstraint');
|
||||
goog.require('ol.Constraints');
|
||||
goog.require('ol.IView2D');
|
||||
goog.require('ol.ResolutionConstraint');
|
||||
goog.require('ol.RotationConstraint');
|
||||
goog.require('ol.RotationConstraintType');
|
||||
@@ -78,7 +77,6 @@ ol.View2DProperty = {
|
||||
* rotation value to zero when approaching the horizontal.
|
||||
*
|
||||
* @constructor
|
||||
* @implements {ol.IView2D}
|
||||
* @extends {ol.View}
|
||||
* @param {olx.View2DOptions=} opt_options View2D options.
|
||||
* @todo api
|
||||
@@ -219,7 +217,7 @@ ol.View2D.prototype.constrainRotation = function(rotation, opt_delta) {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {ol.Coordinate|undefined} The center of the view.
|
||||
* @todo observable
|
||||
* @todo api
|
||||
*/
|
||||
@@ -253,7 +251,7 @@ ol.View2D.prototype.calculateExtent = function(size) {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {ol.proj.Projection|undefined} The projection of the view.
|
||||
* @todo observable
|
||||
* @todo api
|
||||
*/
|
||||
@@ -268,7 +266,7 @@ goog.exportProperty(
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {number|undefined} The resolution of the view.
|
||||
* @todo observable
|
||||
* @todo api
|
||||
*/
|
||||
@@ -323,7 +321,7 @@ ol.View2D.prototype.getResolutionForValueFunction = function(opt_power) {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {number|undefined} The rotation of the view.
|
||||
* @todo observable
|
||||
* @todo api
|
||||
*/
|
||||
@@ -371,7 +369,7 @@ ol.View2D.prototype.getView2D = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return {olx.View2DState} View2D state.
|
||||
*/
|
||||
ol.View2D.prototype.getView2DState = function() {
|
||||
goog.asserts.assert(this.isDef());
|
||||
|
||||
Reference in New Issue
Block a user