+14
-14
@@ -4450,7 +4450,7 @@ olx.source.TileUTFGridOptions.prototype.url;
|
|||||||
* reprojectionErrorThreshold: (number|undefined),
|
* reprojectionErrorThreshold: (number|undefined),
|
||||||
* state: (ol.source.State|undefined),
|
* state: (ol.source.State|undefined),
|
||||||
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
|
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ?string,
|
* ol.TileState, string, ?string,
|
||||||
* ol.TileLoadFunctionType)|undefined),
|
* ol.TileLoadFunctionType)|undefined),
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||||
@@ -4535,7 +4535,7 @@ olx.source.TileImageOptions.prototype.state;
|
|||||||
/**
|
/**
|
||||||
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
|
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
|
||||||
* @type {function(new: ol.ImageTile, ol.TileCoord,
|
* @type {function(new: ol.ImageTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ?string,
|
* ol.TileState, string, ?string,
|
||||||
* ol.TileLoadFunctionType)|undefined}
|
* ol.TileLoadFunctionType)|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -4620,7 +4620,7 @@ olx.source.TileImageOptions.prototype.wrapX;
|
|||||||
* projection: ol.ProjectionLike,
|
* projection: ol.ProjectionLike,
|
||||||
* state: (ol.source.State|undefined),
|
* state: (ol.source.State|undefined),
|
||||||
* tileClass: (function(new: ol.VectorTile, ol.TileCoord,
|
* tileClass: (function(new: ol.VectorTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ol.format.Feature,
|
* ol.TileState, string, ol.format.Feature,
|
||||||
* ol.TileLoadFunctionType)|undefined),
|
* ol.TileLoadFunctionType)|undefined),
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||||
@@ -4696,7 +4696,7 @@ olx.source.VectorTileOptions.prototype.state;
|
|||||||
/**
|
/**
|
||||||
* Class used to instantiate image tiles. Default is {@link ol.VectorTile}.
|
* Class used to instantiate image tiles. Default is {@link ol.VectorTile}.
|
||||||
* @type {function(new: ol.VectorTile, ol.TileCoord,
|
* @type {function(new: ol.VectorTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ol.format.Feature,
|
* ol.TileState, string, ol.format.Feature,
|
||||||
* ol.TileLoadFunctionType)|undefined}
|
* ol.TileLoadFunctionType)|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -6206,7 +6206,7 @@ olx.source.VectorOptions.prototype.wrapX;
|
|||||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||||
* urls: (Array.<string>|undefined),
|
* urls: (Array.<string>|undefined),
|
||||||
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
|
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ?string,
|
* ol.TileState, string, ?string,
|
||||||
* ol.TileLoadFunctionType)|undefined),
|
* ol.TileLoadFunctionType)|undefined),
|
||||||
* wrapX: (boolean|undefined)}}
|
* wrapX: (boolean|undefined)}}
|
||||||
*/
|
*/
|
||||||
@@ -6301,7 +6301,7 @@ olx.source.WMTSOptions.prototype.style;
|
|||||||
/**
|
/**
|
||||||
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
|
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
|
||||||
* @type {function(new: ol.ImageTile, ol.TileCoord,
|
* @type {function(new: ol.ImageTile, ol.TileCoord,
|
||||||
* ol.Tile.State, string, ?string,
|
* ol.TileState, string, ?string,
|
||||||
* ol.TileLoadFunctionType)|undefined}
|
* ol.TileLoadFunctionType)|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -6845,14 +6845,14 @@ olx.style.FillOptions.prototype.color;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{anchor: (Array.<number>|undefined),
|
* @typedef {{anchor: (Array.<number>|undefined),
|
||||||
* anchorOrigin: (ol.style.Icon.Origin|undefined),
|
* anchorOrigin: (ol.style.IconOrigin|undefined),
|
||||||
* anchorXUnits: (ol.style.Icon.AnchorUnits|undefined),
|
* anchorXUnits: (ol.style.IconAnchorUnits|undefined),
|
||||||
* anchorYUnits: (ol.style.Icon.AnchorUnits|undefined),
|
* anchorYUnits: (ol.style.IconAnchorUnits|undefined),
|
||||||
* color: (ol.Color|string|undefined),
|
* color: (ol.Color|string|undefined),
|
||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* img: (Image|HTMLCanvasElement|undefined),
|
* img: (Image|HTMLCanvasElement|undefined),
|
||||||
* offset: (Array.<number>|undefined),
|
* offset: (Array.<number>|undefined),
|
||||||
* offsetOrigin: (ol.style.Icon.Origin|undefined),
|
* offsetOrigin: (ol.style.IconOrigin|undefined),
|
||||||
* opacity: (number|undefined),
|
* opacity: (number|undefined),
|
||||||
* scale: (number|undefined),
|
* scale: (number|undefined),
|
||||||
* snapToPixel: (boolean|undefined),
|
* snapToPixel: (boolean|undefined),
|
||||||
@@ -6876,7 +6876,7 @@ olx.style.IconOptions.prototype.anchor;
|
|||||||
/**
|
/**
|
||||||
* Origin of the anchor: `bottom-left`, `bottom-right`, `top-left` or
|
* Origin of the anchor: `bottom-left`, `bottom-right`, `top-left` or
|
||||||
* `top-right`. Default is `top-left`.
|
* `top-right`. Default is `top-left`.
|
||||||
* @type {ol.style.Icon.Origin|undefined}
|
* @type {ol.style.IconOrigin|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.style.IconOptions.prototype.anchorOrigin;
|
olx.style.IconOptions.prototype.anchorOrigin;
|
||||||
@@ -6886,7 +6886,7 @@ olx.style.IconOptions.prototype.anchorOrigin;
|
|||||||
* Units in which the anchor x value is specified. A value of `'fraction'`
|
* Units in which the anchor x value is specified. A value of `'fraction'`
|
||||||
* indicates the x value is a fraction of the icon. A value of `'pixels'`
|
* indicates the x value is a fraction of the icon. A value of `'pixels'`
|
||||||
* indicates the x value in pixels. Default is `'fraction'`.
|
* indicates the x value in pixels. Default is `'fraction'`.
|
||||||
* @type {ol.style.Icon.AnchorUnits|undefined}
|
* @type {ol.style.IconAnchorUnits|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.style.IconOptions.prototype.anchorXUnits;
|
olx.style.IconOptions.prototype.anchorXUnits;
|
||||||
@@ -6896,7 +6896,7 @@ olx.style.IconOptions.prototype.anchorXUnits;
|
|||||||
* Units in which the anchor y value is specified. A value of `'fraction'`
|
* Units in which the anchor y value is specified. A value of `'fraction'`
|
||||||
* indicates the y value is a fraction of the icon. A value of `'pixels'`
|
* indicates the y value is a fraction of the icon. A value of `'pixels'`
|
||||||
* indicates the y value in pixels. Default is `'fraction'`.
|
* indicates the y value in pixels. Default is `'fraction'`.
|
||||||
* @type {ol.style.Icon.AnchorUnits|undefined}
|
* @type {ol.style.IconAnchorUnits|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.style.IconOptions.prototype.anchorYUnits;
|
olx.style.IconOptions.prototype.anchorYUnits;
|
||||||
@@ -6945,7 +6945,7 @@ olx.style.IconOptions.prototype.offset;
|
|||||||
/**
|
/**
|
||||||
* Origin of the offset: `bottom-left`, `bottom-right`, `top-left` or
|
* Origin of the offset: `bottom-left`, `bottom-right`, `top-left` or
|
||||||
* `top-right`. Default is `top-left`.
|
* `top-right`. Default is `top-left`.
|
||||||
* @type {ol.style.Icon.Origin|undefined}
|
* @type {ol.style.IconOrigin|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.style.IconOptions.prototype.offsetOrigin;
|
olx.style.IconOptions.prototype.offsetOrigin;
|
||||||
|
|||||||
+9
-9
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.animation');
|
goog.provide('ol.animation');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
|
|
||||||
@@ -30,14 +30,14 @@ ol.animation.bounce = function(options) {
|
|||||||
function(map, frameState) {
|
function(map, frameState) {
|
||||||
if (frameState.time < start) {
|
if (frameState.time < start) {
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (frameState.time < start + duration) {
|
} else if (frameState.time < start + duration) {
|
||||||
var delta = easing((frameState.time - start) / duration);
|
var delta = easing((frameState.time - start) / duration);
|
||||||
var deltaResolution = resolution - frameState.viewState.resolution;
|
var deltaResolution = resolution - frameState.viewState.resolution;
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewState.resolution += delta * deltaResolution;
|
frameState.viewState.resolution += delta * deltaResolution;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -71,7 +71,7 @@ ol.animation.pan = function(options) {
|
|||||||
function(map, frameState) {
|
function(map, frameState) {
|
||||||
if (frameState.time < start) {
|
if (frameState.time < start) {
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (frameState.time < start + duration) {
|
} else if (frameState.time < start + duration) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
@@ -80,7 +80,7 @@ ol.animation.pan = function(options) {
|
|||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewState.center[0] += delta * deltaX;
|
frameState.viewState.center[0] += delta * deltaX;
|
||||||
frameState.viewState.center[1] += delta * deltaY;
|
frameState.viewState.center[1] += delta * deltaY;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -115,7 +115,7 @@ ol.animation.rotate = function(options) {
|
|||||||
function(map, frameState) {
|
function(map, frameState) {
|
||||||
if (frameState.time < start) {
|
if (frameState.time < start) {
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (frameState.time < start + duration) {
|
} else if (frameState.time < start + duration) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
@@ -129,7 +129,7 @@ ol.animation.rotate = function(options) {
|
|||||||
ol.coordinate.rotate(center, deltaRotation);
|
ol.coordinate.rotate(center, deltaRotation);
|
||||||
ol.coordinate.add(center, anchor);
|
ol.coordinate.add(center, anchor);
|
||||||
}
|
}
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -161,7 +161,7 @@ ol.animation.zoom = function(options) {
|
|||||||
function(map, frameState) {
|
function(map, frameState) {
|
||||||
if (frameState.time < start) {
|
if (frameState.time < start) {
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (frameState.time < start + duration) {
|
} else if (frameState.time < start + duration) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
@@ -169,7 +169,7 @@ ol.animation.zoom = function(options) {
|
|||||||
sourceResolution - frameState.viewState.resolution;
|
sourceResolution - frameState.viewState.resolution;
|
||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
frameState.viewState.resolution += delta * deltaResolution;
|
frameState.viewState.resolution += delta * deltaResolution;
|
||||||
frameState.viewHints[ol.View.Hint.ANIMATING] += 1;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ goog.require('ol');
|
|||||||
goog.require('ol.Collection');
|
goog.require('ol.Collection');
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.MapEvent');
|
goog.require('ol.MapEvent');
|
||||||
|
goog.require('ol.MapProperty');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.Overlay');
|
goog.require('ol.Overlay');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewProperty');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
@@ -191,7 +192,7 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
||||||
if (event.key === ol.Map.Property.VIEW) {
|
if (event.key === ol.MapProperty.VIEW) {
|
||||||
var oldView = /** @type {ol.View} */ (event.oldValue);
|
var oldView = /** @type {ol.View} */ (event.oldValue);
|
||||||
if (oldView) {
|
if (oldView) {
|
||||||
this.unbindView_(oldView);
|
this.unbindView_(oldView);
|
||||||
@@ -209,7 +210,7 @@ ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
|||||||
*/
|
*/
|
||||||
ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
||||||
ol.events.listen(view,
|
ol.events.listen(view,
|
||||||
ol.Object.getChangeEventType(ol.View.Property.ROTATION),
|
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||||
this.handleRotationChanged_, this);
|
this.handleRotationChanged_, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -221,7 +222,7 @@ ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
|||||||
*/
|
*/
|
||||||
ol.control.OverviewMap.prototype.unbindView_ = function(view) {
|
ol.control.OverviewMap.prototype.unbindView_ = function(view) {
|
||||||
ol.events.unlisten(view,
|
ol.events.unlisten(view,
|
||||||
ol.Object.getChangeEventType(ol.View.Property.ROTATION),
|
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||||
this.handleRotationChanged_, this);
|
this.handleRotationChanged_, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
goog.provide('ol.control.ZoomSlider');
|
goog.provide('ol.control.ZoomSlider');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
@@ -256,7 +256,7 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
|||||||
ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
||||||
if (!this.dragging_ &&
|
if (!this.dragging_ &&
|
||||||
event.originalEvent.target === this.element.firstElementChild) {
|
event.originalEvent.target === this.element.firstElementChild) {
|
||||||
this.getMap().getView().setHint(ol.View.Hint.INTERACTING, 1);
|
this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
this.previousX_ = event.clientX;
|
this.previousX_ = event.clientX;
|
||||||
this.previousY_ = event.clientY;
|
this.previousY_ = event.clientY;
|
||||||
this.dragging_ = true;
|
this.dragging_ = true;
|
||||||
@@ -306,7 +306,7 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
|
|||||||
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||||
if (this.dragging_) {
|
if (this.dragging_) {
|
||||||
var view = this.getMap().getView();
|
var view = this.getMap().getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
resolution: view.constrainResolution(this.currentResolution_),
|
resolution: view.constrainResolution(this.currentResolution_),
|
||||||
|
|||||||
+16
-14
@@ -27,6 +27,8 @@ goog.require('ol.math');
|
|||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.style.Fill');
|
goog.require('ol.style.Fill');
|
||||||
goog.require('ol.style.Icon');
|
goog.require('ol.style.Icon');
|
||||||
|
goog.require('ol.style.IconAnchorUnits');
|
||||||
|
goog.require('ol.style.IconOrigin');
|
||||||
goog.require('ol.style.Stroke');
|
goog.require('ol.style.Stroke');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
goog.require('ol.style.Text');
|
goog.require('ol.style.Text');
|
||||||
@@ -169,19 +171,19 @@ ol.format.KML.createStyleDefaults_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.style.Icon.AnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
|
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ =
|
||||||
ol.style.Icon.AnchorUnits.PIXELS;
|
ol.style.IconAnchorUnits.PIXELS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.style.Icon.AnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
|
ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ =
|
||||||
ol.style.Icon.AnchorUnits.PIXELS;
|
ol.style.IconAnchorUnits.PIXELS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
@@ -212,7 +214,7 @@ ol.format.KML.createStyleDefaults_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.DEFAULT_IMAGE_STYLE_ = new ol.style.Icon({
|
ol.format.KML.DEFAULT_IMAGE_STYLE_ = new ol.style.Icon({
|
||||||
anchor: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
|
anchor: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_,
|
||||||
anchorOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
|
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
||||||
anchorXUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
|
anchorXUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_,
|
||||||
anchorYUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
|
anchorYUnits: ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_,
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
@@ -287,12 +289,12 @@ ol.format.KML.createStyleDefaults_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {Object.<string, ol.style.Icon.AnchorUnits>}
|
* @type {Object.<string, ol.style.IconAnchorUnits>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
|
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
|
||||||
'fraction': ol.style.Icon.AnchorUnits.FRACTION,
|
'fraction': ol.style.IconAnchorUnits.FRACTION,
|
||||||
'pixels': ol.style.Icon.AnchorUnits.PIXELS
|
'pixels': ol.style.IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -585,8 +587,8 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
anchorYUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
anchorYUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_;
|
||||||
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
} else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
|
||||||
anchor = [0.5, 0];
|
anchor = [0.5, 0];
|
||||||
anchorXUnits = ol.style.Icon.AnchorUnits.FRACTION;
|
anchorXUnits = ol.style.IconAnchorUnits.FRACTION;
|
||||||
anchorYUnits = ol.style.Icon.AnchorUnits.FRACTION;
|
anchorYUnits = ol.style.IconAnchorUnits.FRACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
var offset;
|
var offset;
|
||||||
@@ -627,12 +629,12 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
|
|||||||
|
|
||||||
var imageStyle = new ol.style.Icon({
|
var imageStyle = new ol.style.Icon({
|
||||||
anchor: anchor,
|
anchor: anchor,
|
||||||
anchorOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
|
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
||||||
anchorXUnits: anchorXUnits,
|
anchorXUnits: anchorXUnits,
|
||||||
anchorYUnits: anchorYUnits,
|
anchorYUnits: anchorYUnits,
|
||||||
crossOrigin: 'anonymous', // FIXME should this be configurable?
|
crossOrigin: 'anonymous', // FIXME should this be configurable?
|
||||||
offset: offset,
|
offset: offset,
|
||||||
offsetOrigin: ol.style.Icon.Origin.BOTTOM_LEFT,
|
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
scale: scale,
|
scale: scale,
|
||||||
size: size,
|
size: size,
|
||||||
@@ -2411,9 +2413,9 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
|
|||||||
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
|
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
|
||||||
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
var /** @type {ol.KMLVec2_} */ hotSpot = {
|
||||||
x: anchor[0],
|
x: anchor[0],
|
||||||
xunits: ol.style.Icon.AnchorUnits.PIXELS,
|
xunits: ol.style.IconAnchorUnits.PIXELS,
|
||||||
y: size[1] - anchor[1],
|
y: size[1] - anchor[1],
|
||||||
yunits: ol.style.Icon.AnchorUnits.PIXELS
|
yunits: ol.style.IconAnchorUnits.PIXELS
|
||||||
};
|
};
|
||||||
properties['hotSpot'] = hotSpot;
|
properties['hotSpot'] = hotSpot;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ goog.require('ol.geom.LineString');
|
|||||||
goog.require('ol.geom.flat.geodesic');
|
goog.require('ol.geom.flat.geodesic');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.style.Stroke');
|
goog.require('ol.style.Stroke');
|
||||||
|
|
||||||
|
|
||||||
@@ -519,12 +519,12 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
|||||||
*/
|
*/
|
||||||
ol.Graticule.prototype.setMap = function(map) {
|
ol.Graticule.prototype.setMap = function(map) {
|
||||||
if (this.map_) {
|
if (this.map_) {
|
||||||
this.map_.un(ol.render.Event.Type.POSTCOMPOSE,
|
this.map_.un(ol.render.EventType.POSTCOMPOSE,
|
||||||
this.handlePostCompose_, this);
|
this.handlePostCompose_, this);
|
||||||
this.map_.render();
|
this.map_.render();
|
||||||
}
|
}
|
||||||
if (map) {
|
if (map) {
|
||||||
map.on(ol.render.Event.Type.POSTCOMPOSE,
|
map.on(ol.render.EventType.POSTCOMPOSE,
|
||||||
this.handlePostCompose_, this);
|
this.handlePostCompose_, this);
|
||||||
map.render();
|
map.render();
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-18
@@ -2,6 +2,7 @@ goog.provide('ol.Image');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.ImageBase');
|
goog.require('ol.ImageBase');
|
||||||
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -22,7 +23,7 @@ goog.require('ol.obj');
|
|||||||
ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
||||||
crossOrigin, imageLoadFunction) {
|
crossOrigin, imageLoadFunction) {
|
||||||
|
|
||||||
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.Image.State.IDLE,
|
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE,
|
||||||
attributions);
|
attributions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,9 +55,9 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {ol.Image.State}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
this.state = ol.Image.State.IDLE;
|
this.state = ol.ImageState.IDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -99,7 +100,7 @@ ol.Image.prototype.getImage = function(opt_context) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.Image.prototype.handleImageError_ = function() {
|
ol.Image.prototype.handleImageError_ = function() {
|
||||||
this.state = ol.Image.State.ERROR;
|
this.state = ol.ImageState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -114,7 +115,7 @@ ol.Image.prototype.handleImageLoad_ = function() {
|
|||||||
if (this.resolution === undefined) {
|
if (this.resolution === undefined) {
|
||||||
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
||||||
}
|
}
|
||||||
this.state = ol.Image.State.LOADED;
|
this.state = ol.ImageState.LOADED;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -127,8 +128,8 @@ ol.Image.prototype.handleImageLoad_ = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Image.prototype.load = function() {
|
ol.Image.prototype.load = function() {
|
||||||
if (this.state == ol.Image.State.IDLE || this.state == ol.Image.State.ERROR) {
|
if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) {
|
||||||
this.state = ol.Image.State.LOADING;
|
this.state = ol.ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
||||||
'this.imageListenerKeys_ should be null');
|
'this.imageListenerKeys_ should be null');
|
||||||
@@ -160,14 +161,3 @@ ol.Image.prototype.unlistenImage_ = function() {
|
|||||||
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||||
this.imageListenerKeys_ = null;
|
this.imageListenerKeys_ = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {number}
|
|
||||||
*/
|
|
||||||
ol.Image.State = {
|
|
||||||
IDLE: 0,
|
|
||||||
LOADING: 1,
|
|
||||||
LOADED: 2,
|
|
||||||
ERROR: 3
|
|
||||||
};
|
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ goog.require('ol.events.EventType');
|
|||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {number|undefined} resolution Resolution.
|
* @param {number|undefined} resolution Resolution.
|
||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {ol.Image.State} state State.
|
* @param {ol.ImageState} state State.
|
||||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||||
*/
|
*/
|
||||||
ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
||||||
@@ -44,7 +44,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {ol.Image.State}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ ol.ImageBase.prototype.getResolution = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {ol.Image.State} State.
|
* @return {ol.ImageState} State.
|
||||||
*/
|
*/
|
||||||
ol.ImageBase.prototype.getState = function() {
|
ol.ImageBase.prototype.getState = function() {
|
||||||
return this.state;
|
return this.state;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
goog.provide('ol.ImageCanvas');
|
goog.provide('ol.ImageCanvas');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
|
||||||
goog.require('ol.ImageBase');
|
goog.require('ol.ImageBase');
|
||||||
|
goog.require('ol.ImageState');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
|||||||
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
||||||
|
|
||||||
var state = opt_loader !== undefined ?
|
var state = opt_loader !== undefined ?
|
||||||
ol.Image.State.IDLE : ol.Image.State.LOADED;
|
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||||
|
|
||||||
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
|
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ ol.ImageCanvas.prototype.getError = function() {
|
|||||||
ol.ImageCanvas.prototype.handleLoad_ = function(err) {
|
ol.ImageCanvas.prototype.handleLoad_ = function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.error_ = err;
|
this.error_ = err;
|
||||||
this.state = ol.Image.State.ERROR;
|
this.state = ol.ImageState.ERROR;
|
||||||
} else {
|
} else {
|
||||||
this.state = ol.Image.State.LOADED;
|
this.state = ol.ImageState.LOADED;
|
||||||
}
|
}
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -76,9 +76,9 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
|
|||||||
* Trigger drawing on canvas.
|
* Trigger drawing on canvas.
|
||||||
*/
|
*/
|
||||||
ol.ImageCanvas.prototype.load = function() {
|
ol.ImageCanvas.prototype.load = function() {
|
||||||
if (this.state == ol.Image.State.IDLE) {
|
if (this.state == ol.ImageState.IDLE) {
|
||||||
ol.DEBUG && console.assert(this.loader_, 'this.loader_ must be set');
|
ol.DEBUG && console.assert(this.loader_, 'this.loader_ must be set');
|
||||||
this.state = ol.Image.State.LOADING;
|
this.state = ol.ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
this.loader_(this.handleLoad_.bind(this));
|
this.loader_(this.handleLoad_.bind(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
goog.provide('ol.ImageState');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
ol.ImageState = {
|
||||||
|
IDLE: 0,
|
||||||
|
LOADING: 1,
|
||||||
|
LOADED: 2,
|
||||||
|
ERROR: 3
|
||||||
|
};
|
||||||
+9
-8
@@ -2,6 +2,7 @@ goog.provide('ol.ImageTile');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ goog.require('ol.events.EventType');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Tile}
|
* @extends {ol.Tile}
|
||||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.Tile.State} state State.
|
* @param {ol.TileState} state State.
|
||||||
* @param {string} src Image source URI.
|
* @param {string} src Image source URI.
|
||||||
* @param {?string} crossOrigin Cross origin.
|
* @param {?string} crossOrigin Cross origin.
|
||||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||||
@@ -56,13 +57,13 @@ ol.inherits(ol.ImageTile, ol.Tile);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.ImageTile.prototype.disposeInternal = function() {
|
ol.ImageTile.prototype.disposeInternal = function() {
|
||||||
if (this.state == ol.Tile.State.LOADING) {
|
if (this.state == ol.TileState.LOADING) {
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
}
|
}
|
||||||
if (this.interimTile) {
|
if (this.interimTile) {
|
||||||
this.interimTile.dispose();
|
this.interimTile.dispose();
|
||||||
}
|
}
|
||||||
this.state = ol.Tile.State.ABORT;
|
this.state = ol.TileState.ABORT;
|
||||||
this.changed();
|
this.changed();
|
||||||
ol.Tile.prototype.disposeInternal.call(this);
|
ol.Tile.prototype.disposeInternal.call(this);
|
||||||
};
|
};
|
||||||
@@ -92,7 +93,7 @@ ol.ImageTile.prototype.getKey = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.ImageTile.prototype.handleImageError_ = function() {
|
ol.ImageTile.prototype.handleImageError_ = function() {
|
||||||
this.state = ol.Tile.State.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -105,9 +106,9 @@ ol.ImageTile.prototype.handleImageError_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.ImageTile.prototype.handleImageLoad_ = function() {
|
ol.ImageTile.prototype.handleImageLoad_ = function() {
|
||||||
if (this.image_.naturalWidth && this.image_.naturalHeight) {
|
if (this.image_.naturalWidth && this.image_.naturalHeight) {
|
||||||
this.state = ol.Tile.State.LOADED;
|
this.state = ol.TileState.LOADED;
|
||||||
} else {
|
} else {
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
}
|
}
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.changed();
|
this.changed();
|
||||||
@@ -121,8 +122,8 @@ ol.ImageTile.prototype.handleImageLoad_ = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.ImageTile.prototype.load = function() {
|
ol.ImageTile.prototype.load = function() {
|
||||||
if (this.state == ol.Tile.State.IDLE || this.state == ol.Tile.State.ERROR) {
|
if (this.state == ol.TileState.IDLE || this.state == ol.TileState.ERROR) {
|
||||||
this.state = ol.Tile.State.LOADING;
|
this.state = ol.TileState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
||||||
'this.imageListenerKeys_ should be null');
|
'this.imageListenerKeys_ should be null');
|
||||||
|
|||||||
+1
-1
@@ -164,7 +164,7 @@ ol.OVERVIEWMAP_MIN_RATIO = 0.1;
|
|||||||
* This can happen if the developer defines projections improperly and/or
|
* This can happen if the developer defines projections improperly and/or
|
||||||
* with unlimited extents.
|
* with unlimited extents.
|
||||||
* If too many tiles are required, no tiles are loaded and
|
* If too many tiles are required, no tiles are loaded and
|
||||||
* `ol.Tile.State.ERROR` state is set. Default is `100`.
|
* `ol.TileState.ERROR` state is set. Default is `100`.
|
||||||
*/
|
*/
|
||||||
ol.RASTER_REPROJECTION_MAX_SOURCE_TILES = 100;
|
ol.RASTER_REPROJECTION_MAX_SOURCE_TILES = 100;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DragPan');
|
goog.provide('ol.interaction.DragPan');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
@@ -111,7 +111,7 @@ ol.interaction.DragPan.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.lastCentroid = null;
|
this.lastCentroid = null;
|
||||||
@@ -132,7 +132,7 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
this.lastCentroid = null;
|
this.lastCentroid = null;
|
||||||
if (!this.handlingDownUpSequence) {
|
if (!this.handlingDownUpSequence) {
|
||||||
view.setHint(ol.View.Hint.INTERACTING, 1);
|
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
}
|
}
|
||||||
// stop any current animation
|
// stop any current animation
|
||||||
view.setCenter(mapBrowserEvent.frameState.viewState.center);
|
view.setCenter(mapBrowserEvent.frameState.viewState.center);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DragRotate');
|
goog.provide('ol.interaction.DragRotate');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
@@ -92,7 +92,7 @@ ol.interaction.DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
|
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
var rotation = view.getRotation();
|
var rotation = view.getRotation();
|
||||||
ol.interaction.Interaction.rotate(map, view, rotation,
|
ol.interaction.Interaction.rotate(map, view, rotation,
|
||||||
undefined, this.duration_);
|
undefined, this.duration_);
|
||||||
@@ -114,7 +114,7 @@ ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
if (ol.events.condition.mouseActionButton(mapBrowserEvent) &&
|
if (ol.events.condition.mouseActionButton(mapBrowserEvent) &&
|
||||||
this.condition_(mapBrowserEvent)) {
|
this.condition_(mapBrowserEvent)) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
map.getView().setHint(ol.View.Hint.INTERACTING, 1);
|
map.getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
this.lastAngle_ = undefined;
|
this.lastAngle_ = undefined;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DragRotateAndZoom');
|
goog.provide('ol.interaction.DragRotateAndZoom');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.interaction.Pointer');
|
goog.require('ol.interaction.Pointer');
|
||||||
@@ -115,7 +115,7 @@ ol.interaction.DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
|
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
var direction = this.lastScaleDelta_ - 1;
|
var direction = this.lastScaleDelta_ - 1;
|
||||||
ol.interaction.Interaction.rotate(map, view, view.getRotation());
|
ol.interaction.Interaction.rotate(map, view, view.getRotation());
|
||||||
ol.interaction.Interaction.zoom(map, view, view.getResolution(),
|
ol.interaction.Interaction.zoom(map, view, view.getResolution(),
|
||||||
@@ -137,7 +137,7 @@ ol.interaction.DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.condition_(mapBrowserEvent)) {
|
if (this.condition_(mapBrowserEvent)) {
|
||||||
mapBrowserEvent.map.getView().setHint(ol.View.Hint.INTERACTING, 1);
|
mapBrowserEvent.map.getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
this.lastAngle_ = undefined;
|
this.lastAngle_ = undefined;
|
||||||
this.lastMagnitude_ = undefined;
|
this.lastMagnitude_ = undefined;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
goog.provide('ol.interaction.Draw');
|
goog.provide('ol.interaction.Draw');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.events');
|
|
||||||
goog.require('ol.extent');
|
|
||||||
goog.require('ol.events.Event');
|
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.events');
|
||||||
|
goog.require('ol.events.Event');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.functions');
|
||||||
goog.require('ol.geom.Circle');
|
goog.require('ol.geom.Circle');
|
||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
goog.require('ol.geom.LineString');
|
goog.require('ol.geom.LineString');
|
||||||
@@ -18,8 +18,8 @@ goog.require('ol.geom.MultiPoint');
|
|||||||
goog.require('ol.geom.MultiPolygon');
|
goog.require('ol.geom.MultiPolygon');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.interaction.Interaction');
|
|
||||||
goog.require('ol.interaction.Pointer');
|
goog.require('ol.interaction.Pointer');
|
||||||
|
goog.require('ol.interaction.Property');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
@@ -265,7 +265,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ol.events.listen(this,
|
ol.events.listen(this,
|
||||||
ol.Object.getChangeEventType(ol.interaction.Interaction.Property.ACTIVE),
|
ol.Object.getChangeEventType(ol.interaction.Property.ACTIVE),
|
||||||
this.updateState_, this);
|
this.updateState_, this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ goog.provide('ol.interaction.Interaction');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
|
goog.require('ol.interaction.Property');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +54,7 @@ ol.inherits(ol.interaction.Interaction, ol.Object);
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Interaction.prototype.getActive = function() {
|
ol.interaction.Interaction.prototype.getActive = function() {
|
||||||
return /** @type {boolean} */ (
|
return /** @type {boolean} */ (
|
||||||
this.get(ol.interaction.Interaction.Property.ACTIVE));
|
this.get(ol.interaction.Property.ACTIVE));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ ol.interaction.Interaction.prototype.getMap = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.interaction.Interaction.prototype.setActive = function(active) {
|
ol.interaction.Interaction.prototype.setActive = function(active) {
|
||||||
this.set(ol.interaction.Interaction.Property.ACTIVE, active);
|
this.set(ol.interaction.Property.ACTIVE, active);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -217,11 +218,3 @@ ol.interaction.Interaction.zoomWithoutConstraints = function(map, view, resoluti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.interaction.Interaction.Property = {
|
|
||||||
ACTIVE: 'active'
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ goog.require('ol.Collection');
|
|||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.MapBrowserPointerEvent');
|
goog.require('ol.MapBrowserPointerEvent');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
@@ -655,7 +655,7 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
|||||||
this.lastPointerEvent_ = mapBrowserEvent;
|
this.lastPointerEvent_ = mapBrowserEvent;
|
||||||
|
|
||||||
var handled;
|
var handled;
|
||||||
if (!mapBrowserEvent.map.getView().getHints()[ol.View.Hint.INTERACTING] &&
|
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] &&
|
||||||
mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE &&
|
mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE &&
|
||||||
!this.handlingDownUpSequence) {
|
!this.handlingDownUpSequence) {
|
||||||
this.handlePointerMove_(mapBrowserEvent);
|
this.handlePointerMove_(mapBrowserEvent);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.MouseWheelZoom');
|
goog.provide('ol.interaction.MouseWheelZoom');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.has');
|
goog.require('ol.has');
|
||||||
@@ -167,7 +167,7 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
|
|||||||
if (this.trackpadTimeoutId_) {
|
if (this.trackpadTimeoutId_) {
|
||||||
clearTimeout(this.trackpadTimeoutId_);
|
clearTimeout(this.trackpadTimeoutId_);
|
||||||
} else {
|
} else {
|
||||||
view.setHint(ol.View.Hint.INTERACTING, 1);
|
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
}
|
}
|
||||||
this.trackpadTimeoutId_ = setTimeout(this.decrementInteractingHint_.bind(this), this.trackpadEventGap_);
|
this.trackpadTimeoutId_ = setTimeout(this.decrementInteractingHint_.bind(this), this.trackpadEventGap_);
|
||||||
var resolution = view.getResolution() * Math.pow(2, delta / this.trackpadDeltaPerZoom_);
|
var resolution = view.getResolution() * Math.pow(2, delta / this.trackpadDeltaPerZoom_);
|
||||||
@@ -222,7 +222,7 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
|
|||||||
ol.interaction.MouseWheelZoom.prototype.decrementInteractingHint_ = function() {
|
ol.interaction.MouseWheelZoom.prototype.decrementInteractingHint_ = function() {
|
||||||
this.trackpadTimeoutId_ = undefined;
|
this.trackpadTimeoutId_ = undefined;
|
||||||
var view = this.getMap().getView();
|
var view = this.getMap().getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.PinchRotate');
|
goog.provide('ol.interaction.PinchRotate');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.interaction.Pointer');
|
goog.require('ol.interaction.Pointer');
|
||||||
@@ -128,7 +128,7 @@ ol.interaction.PinchRotate.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
if (this.targetPointers.length < 2) {
|
if (this.targetPointers.length < 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
if (this.rotating_) {
|
if (this.rotating_) {
|
||||||
var rotation = view.getRotation();
|
var rotation = view.getRotation();
|
||||||
ol.interaction.Interaction.rotate(
|
ol.interaction.Interaction.rotate(
|
||||||
@@ -155,7 +155,7 @@ ol.interaction.PinchRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
this.rotating_ = false;
|
this.rotating_ = false;
|
||||||
this.rotationDelta_ = 0.0;
|
this.rotationDelta_ = 0.0;
|
||||||
if (!this.handlingDownUpSequence) {
|
if (!this.handlingDownUpSequence) {
|
||||||
map.getView().setHint(ol.View.Hint.INTERACTING, 1);
|
map.getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.PinchZoom');
|
goog.provide('ol.interaction.PinchZoom');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.interaction.Pointer');
|
goog.require('ol.interaction.Pointer');
|
||||||
@@ -116,7 +116,7 @@ ol.interaction.PinchZoom.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
if (this.targetPointers.length < 2) {
|
if (this.targetPointers.length < 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
view.setHint(ol.View.Hint.INTERACTING, -1);
|
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||||
if (this.constrainResolution_) {
|
if (this.constrainResolution_) {
|
||||||
var resolution = view.getResolution();
|
var resolution = view.getResolution();
|
||||||
// Zoom to final resolution, with an animation, and provide a
|
// Zoom to final resolution, with an animation, and provide a
|
||||||
@@ -146,7 +146,7 @@ ol.interaction.PinchZoom.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
this.lastDistance_ = undefined;
|
this.lastDistance_ = undefined;
|
||||||
this.lastScaleDelta_ = 1;
|
this.lastScaleDelta_ = 1;
|
||||||
if (!this.handlingDownUpSequence) {
|
if (!this.handlingDownUpSequence) {
|
||||||
map.getView().setHint(ol.View.Hint.INTERACTING, 1);
|
map.getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
goog.provide('ol.interaction.Property');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.interaction.Property = {
|
||||||
|
ACTIVE: 'active'
|
||||||
|
};
|
||||||
+18
-31
@@ -2,6 +2,7 @@ goog.provide('ol.layer.Base');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
|
goog.require('ol.layer.Property');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
goog.require('ol.obj');
|
goog.require('ol.obj');
|
||||||
|
|
||||||
@@ -27,15 +28,15 @@ ol.layer.Base = function(options) {
|
|||||||
* @type {Object.<string, *>}
|
* @type {Object.<string, *>}
|
||||||
*/
|
*/
|
||||||
var properties = ol.obj.assign({}, options);
|
var properties = ol.obj.assign({}, options);
|
||||||
properties[ol.layer.Base.Property.OPACITY] =
|
properties[ol.layer.Property.OPACITY] =
|
||||||
options.opacity !== undefined ? options.opacity : 1;
|
options.opacity !== undefined ? options.opacity : 1;
|
||||||
properties[ol.layer.Base.Property.VISIBLE] =
|
properties[ol.layer.Property.VISIBLE] =
|
||||||
options.visible !== undefined ? options.visible : true;
|
options.visible !== undefined ? options.visible : true;
|
||||||
properties[ol.layer.Base.Property.Z_INDEX] =
|
properties[ol.layer.Property.Z_INDEX] =
|
||||||
options.zIndex !== undefined ? options.zIndex : 0;
|
options.zIndex !== undefined ? options.zIndex : 0;
|
||||||
properties[ol.layer.Base.Property.MAX_RESOLUTION] =
|
properties[ol.layer.Property.MAX_RESOLUTION] =
|
||||||
options.maxResolution !== undefined ? options.maxResolution : Infinity;
|
options.maxResolution !== undefined ? options.maxResolution : Infinity;
|
||||||
properties[ol.layer.Base.Property.MIN_RESOLUTION] =
|
properties[ol.layer.Property.MIN_RESOLUTION] =
|
||||||
options.minResolution !== undefined ? options.minResolution : 0;
|
options.minResolution !== undefined ? options.minResolution : 0;
|
||||||
|
|
||||||
this.setProperties(properties);
|
this.setProperties(properties);
|
||||||
@@ -96,7 +97,7 @@ ol.layer.Base.prototype.getLayerStatesArray = function(opt_states) {};
|
|||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getExtent = function() {
|
ol.layer.Base.prototype.getExtent = function() {
|
||||||
return /** @type {ol.Extent|undefined} */ (
|
return /** @type {ol.Extent|undefined} */ (
|
||||||
this.get(ol.layer.Base.Property.EXTENT));
|
this.get(ol.layer.Property.EXTENT));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ ol.layer.Base.prototype.getExtent = function() {
|
|||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getMaxResolution = function() {
|
ol.layer.Base.prototype.getMaxResolution = function() {
|
||||||
return /** @type {number} */ (
|
return /** @type {number} */ (
|
||||||
this.get(ol.layer.Base.Property.MAX_RESOLUTION));
|
this.get(ol.layer.Property.MAX_RESOLUTION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ ol.layer.Base.prototype.getMaxResolution = function() {
|
|||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getMinResolution = function() {
|
ol.layer.Base.prototype.getMinResolution = function() {
|
||||||
return /** @type {number} */ (
|
return /** @type {number} */ (
|
||||||
this.get(ol.layer.Base.Property.MIN_RESOLUTION));
|
this.get(ol.layer.Property.MIN_RESOLUTION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ ol.layer.Base.prototype.getMinResolution = function() {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getOpacity = function() {
|
ol.layer.Base.prototype.getOpacity = function() {
|
||||||
return /** @type {number} */ (this.get(ol.layer.Base.Property.OPACITY));
|
return /** @type {number} */ (this.get(ol.layer.Property.OPACITY));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ ol.layer.Base.prototype.getSourceState = function() {};
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getVisible = function() {
|
ol.layer.Base.prototype.getVisible = function() {
|
||||||
return /** @type {boolean} */ (this.get(ol.layer.Base.Property.VISIBLE));
|
return /** @type {boolean} */ (this.get(ol.layer.Property.VISIBLE));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -161,7 +162,7 @@ ol.layer.Base.prototype.getVisible = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getZIndex = function() {
|
ol.layer.Base.prototype.getZIndex = function() {
|
||||||
return /** @type {number} */ (this.get(ol.layer.Base.Property.Z_INDEX));
|
return /** @type {number} */ (this.get(ol.layer.Property.Z_INDEX));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ ol.layer.Base.prototype.getZIndex = function() {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setExtent = function(extent) {
|
ol.layer.Base.prototype.setExtent = function(extent) {
|
||||||
this.set(ol.layer.Base.Property.EXTENT, extent);
|
this.set(ol.layer.Property.EXTENT, extent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ ol.layer.Base.prototype.setExtent = function(extent) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setMaxResolution = function(maxResolution) {
|
ol.layer.Base.prototype.setMaxResolution = function(maxResolution) {
|
||||||
this.set(ol.layer.Base.Property.MAX_RESOLUTION, maxResolution);
|
this.set(ol.layer.Property.MAX_RESOLUTION, maxResolution);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -195,7 +196,7 @@ ol.layer.Base.prototype.setMaxResolution = function(maxResolution) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setMinResolution = function(minResolution) {
|
ol.layer.Base.prototype.setMinResolution = function(minResolution) {
|
||||||
this.set(ol.layer.Base.Property.MIN_RESOLUTION, minResolution);
|
this.set(ol.layer.Property.MIN_RESOLUTION, minResolution);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +207,7 @@ ol.layer.Base.prototype.setMinResolution = function(minResolution) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setOpacity = function(opacity) {
|
ol.layer.Base.prototype.setOpacity = function(opacity) {
|
||||||
this.set(ol.layer.Base.Property.OPACITY, opacity);
|
this.set(ol.layer.Property.OPACITY, opacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -217,7 +218,7 @@ ol.layer.Base.prototype.setOpacity = function(opacity) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setVisible = function(visible) {
|
ol.layer.Base.prototype.setVisible = function(visible) {
|
||||||
this.set(ol.layer.Base.Property.VISIBLE, visible);
|
this.set(ol.layer.Property.VISIBLE, visible);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -229,19 +230,5 @@ ol.layer.Base.prototype.setVisible = function(visible) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.setZIndex = function(zindex) {
|
ol.layer.Base.prototype.setZIndex = function(zindex) {
|
||||||
this.set(ol.layer.Base.Property.Z_INDEX, zindex);
|
this.set(ol.layer.Property.Z_INDEX, zindex);
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.layer.Base.Property = {
|
|
||||||
OPACITY: 'opacity',
|
|
||||||
VISIBLE: 'visible',
|
|
||||||
EXTENT: 'extent',
|
|
||||||
Z_INDEX: 'zIndex',
|
|
||||||
MAX_RESOLUTION: 'maxResolution',
|
|
||||||
MIN_RESOLUTION: 'minResolution',
|
|
||||||
SOURCE: 'source'
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ goog.require('ol.dom');
|
|||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
goog.require('ol.obj');
|
goog.require('ol.obj');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.style.Icon');
|
goog.require('ol.style.Icon');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ ol.layer.Heatmap = function(opt_options) {
|
|||||||
// The render order is not relevant for a heatmap representation.
|
// The render order is not relevant for a heatmap representation.
|
||||||
this.setRenderOrder(null);
|
this.setRenderOrder(null);
|
||||||
|
|
||||||
ol.events.listen(this, ol.render.Event.Type.RENDER, this.handleRender_, this);
|
ol.events.listen(this, ol.render.EventType.RENDER, this.handleRender_, this);
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.layer.Heatmap, ol.layer.Vector);
|
ol.inherits(ol.layer.Heatmap, ol.layer.Vector);
|
||||||
@@ -236,7 +236,7 @@ ol.layer.Heatmap.prototype.handleStyleChanged_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
||||||
ol.DEBUG && console.assert(event.type == ol.render.Event.Type.RENDER,
|
ol.DEBUG && console.assert(event.type == ol.render.EventType.RENDER,
|
||||||
'event.type should be RENDER');
|
'event.type should be RENDER');
|
||||||
ol.DEBUG && console.assert(this.gradient_, 'this.gradient_ expected');
|
ol.DEBUG && console.assert(this.gradient_, 'this.gradient_ expected');
|
||||||
var context = event.context;
|
var context = event.context;
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ goog.require('ol.events.EventType');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.layer.Base');
|
goog.require('ol.layer.Base');
|
||||||
|
goog.require('ol.layer.Property');
|
||||||
goog.require('ol.obj');
|
goog.require('ol.obj');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.source.State');
|
goog.require('ol.source.State');
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ ol.layer.Layer = function(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ol.events.listen(this,
|
ol.events.listen(this,
|
||||||
ol.Object.getChangeEventType(ol.layer.Base.Property.SOURCE),
|
ol.Object.getChangeEventType(ol.layer.Property.SOURCE),
|
||||||
this.handleSourcePropertyChange_, this);
|
this.handleSourcePropertyChange_, this);
|
||||||
|
|
||||||
var source = options.source ? options.source : null;
|
var source = options.source ? options.source : null;
|
||||||
@@ -111,7 +112,7 @@ ol.layer.Layer.prototype.getLayerStatesArray = function(opt_states) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Layer.prototype.getSource = function() {
|
ol.layer.Layer.prototype.getSource = function() {
|
||||||
var source = this.get(ol.layer.Base.Property.SOURCE);
|
var source = this.get(ol.layer.Property.SOURCE);
|
||||||
return /** @type {ol.source.Source} */ (source) || null;
|
return /** @type {ol.source.Source} */ (source) || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ ol.layer.Layer.prototype.setMap = function(map) {
|
|||||||
}
|
}
|
||||||
if (map) {
|
if (map) {
|
||||||
this.mapPrecomposeKey_ = ol.events.listen(
|
this.mapPrecomposeKey_ = ol.events.listen(
|
||||||
map, ol.render.Event.Type.PRECOMPOSE, function(evt) {
|
map, ol.render.EventType.PRECOMPOSE, function(evt) {
|
||||||
var layerState = this.getLayerState();
|
var layerState = this.getLayerState();
|
||||||
layerState.managed = false;
|
layerState.managed = false;
|
||||||
layerState.zIndex = Infinity;
|
layerState.zIndex = Infinity;
|
||||||
@@ -197,5 +198,5 @@ ol.layer.Layer.prototype.setMap = function(map) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Layer.prototype.setSource = function(source) {
|
ol.layer.Layer.prototype.setSource = function(source) {
|
||||||
this.set(ol.layer.Base.Property.SOURCE, source);
|
this.set(ol.layer.Property.SOURCE, source);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
goog.provide('ol.layer.Property');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.layer.Property = {
|
||||||
|
OPACITY: 'opacity',
|
||||||
|
VISIBLE: 'visible',
|
||||||
|
EXTENT: 'extent',
|
||||||
|
Z_INDEX: 'zIndex',
|
||||||
|
MAX_RESOLUTION: 'maxResolution',
|
||||||
|
MIN_RESOLUTION: 'minResolution',
|
||||||
|
SOURCE: 'source'
|
||||||
|
};
|
||||||
+22
-31
@@ -9,9 +9,11 @@ goog.require('ol.Collection');
|
|||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.MapBrowserEventHandler');
|
goog.require('ol.MapBrowserEventHandler');
|
||||||
goog.require('ol.MapEvent');
|
goog.require('ol.MapEvent');
|
||||||
|
goog.require('ol.MapProperty');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.TileQueue');
|
goog.require('ol.TileQueue');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.control');
|
goog.require('ol.control');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
@@ -25,8 +27,8 @@ goog.require('ol.interaction');
|
|||||||
goog.require('ol.layer.Group');
|
goog.require('ol.layer.Group');
|
||||||
goog.require('ol.obj');
|
goog.require('ol.obj');
|
||||||
goog.require('ol.proj.common');
|
goog.require('ol.proj.common');
|
||||||
goog.require('ol.renderer.Type');
|
|
||||||
goog.require('ol.renderer.Map');
|
goog.require('ol.renderer.Map');
|
||||||
|
goog.require('ol.renderer.Type');
|
||||||
goog.require('ol.renderer.canvas.Map');
|
goog.require('ol.renderer.canvas.Map');
|
||||||
goog.require('ol.renderer.webgl.Map');
|
goog.require('ol.renderer.webgl.Map');
|
||||||
goog.require('ol.size');
|
goog.require('ol.size');
|
||||||
@@ -367,13 +369,13 @@ ol.Map = function(options) {
|
|||||||
this.skippedFeatureUids_ = {};
|
this.skippedFeatureUids_ = {};
|
||||||
|
|
||||||
ol.events.listen(
|
ol.events.listen(
|
||||||
this, ol.Object.getChangeEventType(ol.Map.Property.LAYERGROUP),
|
this, ol.Object.getChangeEventType(ol.MapProperty.LAYERGROUP),
|
||||||
this.handleLayerGroupChanged_, this);
|
this.handleLayerGroupChanged_, this);
|
||||||
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.VIEW),
|
ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.VIEW),
|
||||||
this.handleViewChanged_, this);
|
this.handleViewChanged_, this);
|
||||||
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.SIZE),
|
ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.SIZE),
|
||||||
this.handleSizeChanged_, this);
|
this.handleSizeChanged_, this);
|
||||||
ol.events.listen(this, ol.Object.getChangeEventType(ol.Map.Property.TARGET),
|
ol.events.listen(this, ol.Object.getChangeEventType(ol.MapProperty.TARGET),
|
||||||
this.handleTargetChanged_, this);
|
this.handleTargetChanged_, this);
|
||||||
|
|
||||||
// setProperties will trigger the rendering of the map if the map
|
// setProperties will trigger the rendering of the map if the map
|
||||||
@@ -689,7 +691,7 @@ ol.Map.prototype.getEventPixel = function(event) {
|
|||||||
*/
|
*/
|
||||||
ol.Map.prototype.getTarget = function() {
|
ol.Map.prototype.getTarget = function() {
|
||||||
return /** @type {Element|string|undefined} */ (
|
return /** @type {Element|string|undefined} */ (
|
||||||
this.get(ol.Map.Property.TARGET));
|
this.get(ol.MapProperty.TARGET));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -785,7 +787,7 @@ ol.Map.prototype.getInteractions = function() {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.getLayerGroup = function() {
|
ol.Map.prototype.getLayerGroup = function() {
|
||||||
return /** @type {ol.layer.Group} */ (this.get(ol.Map.Property.LAYERGROUP));
|
return /** @type {ol.layer.Group} */ (this.get(ol.MapProperty.LAYERGROUP));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -834,7 +836,7 @@ ol.Map.prototype.getRenderer = function() {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.getSize = function() {
|
ol.Map.prototype.getSize = function() {
|
||||||
return /** @type {ol.Size|undefined} */ (this.get(ol.Map.Property.SIZE));
|
return /** @type {ol.Size|undefined} */ (this.get(ol.MapProperty.SIZE));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -846,7 +848,7 @@ ol.Map.prototype.getSize = function() {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.getView = function() {
|
ol.Map.prototype.getView = function() {
|
||||||
return /** @type {ol.View} */ (this.get(ol.Map.Property.VIEW));
|
return /** @type {ol.View} */ (this.get(ol.MapProperty.VIEW));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -975,11 +977,11 @@ ol.Map.prototype.handlePostRender = function() {
|
|||||||
var maxNewLoads = maxTotalLoading;
|
var maxNewLoads = maxTotalLoading;
|
||||||
if (frameState) {
|
if (frameState) {
|
||||||
var hints = frameState.viewHints;
|
var hints = frameState.viewHints;
|
||||||
if (hints[ol.View.Hint.ANIMATING]) {
|
if (hints[ol.ViewHint.ANIMATING]) {
|
||||||
maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0;
|
maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0;
|
||||||
maxNewLoads = 2;
|
maxNewLoads = 2;
|
||||||
}
|
}
|
||||||
if (hints[ol.View.Hint.INTERACTING]) {
|
if (hints[ol.ViewHint.INTERACTING]) {
|
||||||
maxTotalLoading = this.loadTilesWhileInteracting_ ? 8 : 0;
|
maxTotalLoading = this.loadTilesWhileInteracting_ ? 8 : 0;
|
||||||
maxNewLoads = 2;
|
maxNewLoads = 2;
|
||||||
}
|
}
|
||||||
@@ -1278,8 +1280,8 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
|||||||
this.postRenderFunctions_, frameState.postRenderFunctions);
|
this.postRenderFunctions_, frameState.postRenderFunctions);
|
||||||
|
|
||||||
var idle = this.preRenderFunctions_.length === 0 &&
|
var idle = this.preRenderFunctions_.length === 0 &&
|
||||||
!frameState.viewHints[ol.View.Hint.ANIMATING] &&
|
!frameState.viewHints[ol.ViewHint.ANIMATING] &&
|
||||||
!frameState.viewHints[ol.View.Hint.INTERACTING] &&
|
!frameState.viewHints[ol.ViewHint.INTERACTING] &&
|
||||||
!ol.extent.equals(frameState.extent, this.previousExtent_);
|
!ol.extent.equals(frameState.extent, this.previousExtent_);
|
||||||
|
|
||||||
if (idle) {
|
if (idle) {
|
||||||
@@ -1305,7 +1307,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setLayerGroup = function(layerGroup) {
|
ol.Map.prototype.setLayerGroup = function(layerGroup) {
|
||||||
this.set(ol.Map.Property.LAYERGROUP, layerGroup);
|
this.set(ol.MapProperty.LAYERGROUP, layerGroup);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1316,7 +1318,7 @@ ol.Map.prototype.setLayerGroup = function(layerGroup) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setSize = function(size) {
|
ol.Map.prototype.setSize = function(size) {
|
||||||
this.set(ol.Map.Property.SIZE, size);
|
this.set(ol.MapProperty.SIZE, size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1328,7 +1330,7 @@ ol.Map.prototype.setSize = function(size) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setTarget = function(target) {
|
ol.Map.prototype.setTarget = function(target) {
|
||||||
this.set(ol.Map.Property.TARGET, target);
|
this.set(ol.MapProperty.TARGET, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1339,7 +1341,7 @@ ol.Map.prototype.setTarget = function(target) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.setView = function(view) {
|
ol.Map.prototype.setView = function(view) {
|
||||||
this.set(ol.Map.Property.VIEW, view);
|
this.set(ol.MapProperty.VIEW, view);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1431,11 +1433,11 @@ ol.Map.createOptionsInternal = function(options) {
|
|||||||
|
|
||||||
var layerGroup = (options.layers instanceof ol.layer.Group) ?
|
var layerGroup = (options.layers instanceof ol.layer.Group) ?
|
||||||
options.layers : new ol.layer.Group({layers: options.layers});
|
options.layers : new ol.layer.Group({layers: options.layers});
|
||||||
values[ol.Map.Property.LAYERGROUP] = layerGroup;
|
values[ol.MapProperty.LAYERGROUP] = layerGroup;
|
||||||
|
|
||||||
values[ol.Map.Property.TARGET] = options.target;
|
values[ol.MapProperty.TARGET] = options.target;
|
||||||
|
|
||||||
values[ol.Map.Property.VIEW] = options.view !== undefined ?
|
values[ol.MapProperty.VIEW] = options.view !== undefined ?
|
||||||
options.view : new ol.View();
|
options.view : new ol.View();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1531,15 +1533,4 @@ ol.Map.createOptionsInternal = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.Map.Property = {
|
|
||||||
LAYERGROUP: 'layergroup',
|
|
||||||
SIZE: 'size',
|
|
||||||
TARGET: 'target',
|
|
||||||
VIEW: 'view'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ol.proj.common.add();
|
ol.proj.common.add();
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
goog.provide('ol.MapProperty');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.MapProperty = {
|
||||||
|
LAYERGROUP: 'layergroup',
|
||||||
|
SIZE: 'size',
|
||||||
|
TARGET: 'target',
|
||||||
|
VIEW: 'view'
|
||||||
|
};
|
||||||
+1
-23
@@ -8,7 +8,7 @@ goog.require('ol.events.Event');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.events.Event}
|
* @extends {ol.events.Event}
|
||||||
* @implements {oli.render.Event}
|
* @implements {oli.render.Event}
|
||||||
* @param {ol.render.Event.Type} type Type.
|
* @param {ol.render.EventType} type Type.
|
||||||
* @param {ol.render.VectorContext=} opt_vectorContext Vector context.
|
* @param {ol.render.VectorContext=} opt_vectorContext Vector context.
|
||||||
* @param {olx.FrameState=} opt_frameState Frame state.
|
* @param {olx.FrameState=} opt_frameState Frame state.
|
||||||
* @param {?CanvasRenderingContext2D=} opt_context Context.
|
* @param {?CanvasRenderingContext2D=} opt_context Context.
|
||||||
@@ -52,25 +52,3 @@ ol.render.Event = function(
|
|||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.render.Event, ol.events.Event);
|
ol.inherits(ol.render.Event, ol.events.Event);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.render.Event.Type = {
|
|
||||||
/**
|
|
||||||
* @event ol.render.Event#postcompose
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
POSTCOMPOSE: 'postcompose',
|
|
||||||
/**
|
|
||||||
* @event ol.render.Event#precompose
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
PRECOMPOSE: 'precompose',
|
|
||||||
/**
|
|
||||||
* @event ol.render.Event#render
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
RENDER: 'render'
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
goog.provide('ol.render.EventType');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.render.EventType = {
|
||||||
|
/**
|
||||||
|
* @event ol.render.Event#postcompose
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
POSTCOMPOSE: 'postcompose',
|
||||||
|
/**
|
||||||
|
* @event ol.render.Event#precompose
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
PRECOMPOSE: 'precompose',
|
||||||
|
/**
|
||||||
|
* @event ol.render.Event#render
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
RENDER: 'render'
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.renderer.canvas.ImageLayer');
|
goog.provide('ol.renderer.canvas.ImageLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.renderer.canvas.IntermediateCanvas');
|
goog.require('ol.renderer.canvas.IntermediateCanvas');
|
||||||
@@ -72,7 +72,7 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye
|
|||||||
renderedExtent, layerState.extent);
|
renderedExtent, layerState.extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hints[ol.View.Hint.ANIMATING] && !hints[ol.View.Hint.INTERACTING] &&
|
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] &&
|
||||||
!ol.extent.isEmpty(renderedExtent)) {
|
!ol.extent.isEmpty(renderedExtent)) {
|
||||||
var projection = viewState.projection;
|
var projection = viewState.projection;
|
||||||
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ goog.require('ol');
|
|||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.Event');
|
||||||
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
goog.require('ol.render.canvas.Immediate');
|
goog.require('ol.render.canvas.Immediate');
|
||||||
goog.require('ol.renderer.Layer');
|
goog.require('ol.renderer.Layer');
|
||||||
@@ -69,7 +70,7 @@ ol.renderer.canvas.Layer.prototype.clip = function(context, frameState, extent)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.render.Event.Type} type Event type.
|
* @param {ol.render.EventType} type Event type.
|
||||||
* @param {CanvasRenderingContext2D} context Context.
|
* @param {CanvasRenderingContext2D} context Context.
|
||||||
* @param {olx.FrameState} frameState Frame state.
|
* @param {olx.FrameState} frameState Frame state.
|
||||||
* @param {ol.Transform=} opt_transform Transform.
|
* @param {ol.Transform=} opt_transform Transform.
|
||||||
@@ -124,7 +125,7 @@ ol.renderer.canvas.Layer.prototype.forEachLayerAtCoordinate = function(coordinat
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.renderer.canvas.Layer.prototype.postCompose = function(context, frameState, layerState, opt_transform) {
|
ol.renderer.canvas.Layer.prototype.postCompose = function(context, frameState, layerState, opt_transform) {
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.POSTCOMPOSE, context,
|
this.dispatchComposeEvent_(ol.render.EventType.POSTCOMPOSE, context,
|
||||||
frameState, opt_transform);
|
frameState, opt_transform);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ ol.renderer.canvas.Layer.prototype.postCompose = function(context, frameState, l
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.renderer.canvas.Layer.prototype.preCompose = function(context, frameState, opt_transform) {
|
ol.renderer.canvas.Layer.prototype.preCompose = function(context, frameState, opt_transform) {
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.PRECOMPOSE, context,
|
this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, context,
|
||||||
frameState, opt_transform);
|
frameState, opt_transform);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ ol.renderer.canvas.Layer.prototype.preCompose = function(context, frameState, op
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.renderer.canvas.Layer.prototype.dispatchRenderEvent = function(context, frameState, opt_transform) {
|
ol.renderer.canvas.Layer.prototype.dispatchRenderEvent = function(context, frameState, opt_transform) {
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.RENDER, context,
|
this.dispatchComposeEvent_(ol.render.EventType.RENDER, context,
|
||||||
frameState, opt_transform);
|
frameState, opt_transform);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ goog.require('ol.layer.Tile');
|
|||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.layer.VectorTile');
|
goog.require('ol.layer.VectorTile');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.Event');
|
||||||
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
goog.require('ol.render.canvas.Immediate');
|
goog.require('ol.render.canvas.Immediate');
|
||||||
goog.require('ol.renderer.Map');
|
goog.require('ol.renderer.Map');
|
||||||
@@ -87,7 +88,7 @@ ol.renderer.canvas.Map.prototype.createLayerRenderer = function(layer) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.render.Event.Type} type Event type.
|
* @param {ol.render.EventType} type Event type.
|
||||||
* @param {olx.FrameState} frameState Frame state.
|
* @param {olx.FrameState} frameState Frame state.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -165,7 +166,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
|
|||||||
|
|
||||||
this.calculateMatrices2D(frameState);
|
this.calculateMatrices2D(frameState);
|
||||||
|
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.PRECOMPOSE, frameState);
|
this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState);
|
||||||
|
|
||||||
var layerStatesArray = frameState.layerStatesArray;
|
var layerStatesArray = frameState.layerStatesArray;
|
||||||
ol.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex);
|
ol.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex);
|
||||||
@@ -190,7 +191,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
|
|||||||
ol.render.canvas.rotateAtOffset(context, -rotation, width / 2, height / 2);
|
ol.render.canvas.rotateAtOffset(context, -rotation, width / 2, height / 2);
|
||||||
|
|
||||||
this.dispatchComposeEvent_(
|
this.dispatchComposeEvent_(
|
||||||
ol.render.Event.Type.POSTCOMPOSE, frameState);
|
ol.render.EventType.POSTCOMPOSE, frameState);
|
||||||
|
|
||||||
if (!this.renderedVisible_) {
|
if (!this.renderedVisible_) {
|
||||||
this.canvas_.style.display = '';
|
this.canvas_.style.display = '';
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
goog.provide('ol.renderer.canvas.TileLayer');
|
goog.provide('ol.renderer.canvas.TileLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.transform');
|
|
||||||
goog.require('ol.TileRange');
|
goog.require('ol.TileRange');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.renderer.canvas.IntermediateCanvas');
|
goog.require('ol.renderer.canvas.IntermediateCanvas');
|
||||||
|
goog.require('ol.transform');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,9 +88,9 @@ ol.inherits(ol.renderer.canvas.TileLayer, ol.renderer.canvas.IntermediateCanvas)
|
|||||||
ol.renderer.canvas.TileLayer.prototype.isDrawableTile_ = function(tile) {
|
ol.renderer.canvas.TileLayer.prototype.isDrawableTile_ = function(tile) {
|
||||||
var tileState = tile.getState();
|
var tileState = tile.getState();
|
||||||
var useInterimTilesOnError = this.getLayer().getUseInterimTilesOnError();
|
var useInterimTilesOnError = this.getLayer().getUseInterimTilesOnError();
|
||||||
return tileState == ol.Tile.State.LOADED ||
|
return tileState == ol.TileState.LOADED ||
|
||||||
tileState == ol.Tile.State.EMPTY ||
|
tileState == ol.TileState.EMPTY ||
|
||||||
tileState == ol.Tile.State.ERROR && !useInterimTilesOnError;
|
tileState == ol.TileState.ERROR && !useInterimTilesOnError;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +147,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
|
|||||||
tile = tile.getInterimTile();
|
tile = tile.getInterimTile();
|
||||||
}
|
}
|
||||||
if (this.isDrawableTile_(tile)) {
|
if (this.isDrawableTile_(tile)) {
|
||||||
if (tile.getState() == ol.Tile.State.LOADED) {
|
if (tile.getState() == ol.TileState.LOADED) {
|
||||||
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
|
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
|
||||||
if (!newTiles && this.renderedTiles.indexOf(tile) == -1) {
|
if (!newTiles && this.renderedTiles.indexOf(tile) == -1) {
|
||||||
newTiles = true;
|
newTiles = true;
|
||||||
@@ -171,7 +171,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
|
|||||||
|
|
||||||
var hints = frameState.viewHints;
|
var hints = frameState.viewHints;
|
||||||
if (!(this.renderedResolution && Date.now() - frameState.time > 16 &&
|
if (!(this.renderedResolution && Date.now() - frameState.time > 16 &&
|
||||||
(hints[ol.View.Hint.ANIMATING] || hints[ol.View.Hint.INTERACTING])) &&
|
(hints[ol.ViewHint.ANIMATING] || hints[ol.ViewHint.INTERACTING])) &&
|
||||||
(newTiles || !(this.renderedExtent_ &&
|
(newTiles || !(this.renderedExtent_ &&
|
||||||
ol.extent.equals(this.renderedExtent_, imageExtent)) ||
|
ol.extent.equals(this.renderedExtent_, imageExtent)) ||
|
||||||
this.renderedRevision != sourceRevision)) {
|
this.renderedRevision != sourceRevision)) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
goog.provide('ol.renderer.canvas.VectorLayer');
|
goog.provide('ol.renderer.canvas.VectorLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
goog.require('ol.render.canvas.ReplayGroup');
|
goog.require('ol.render.canvas.ReplayGroup');
|
||||||
goog.require('ol.renderer.canvas.Layer');
|
goog.require('ol.renderer.canvas.Layer');
|
||||||
@@ -97,7 +97,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame = function(frameState, lay
|
|||||||
var drawOffsetX = 0;
|
var drawOffsetX = 0;
|
||||||
var drawOffsetY = 0;
|
var drawOffsetY = 0;
|
||||||
var replayContext;
|
var replayContext;
|
||||||
if (layer.hasListener(ol.render.Event.Type.RENDER)) {
|
if (layer.hasListener(ol.render.EventType.RENDER)) {
|
||||||
var drawWidth = context.canvas.width;
|
var drawWidth = context.canvas.width;
|
||||||
var drawHeight = context.canvas.height;
|
var drawHeight = context.canvas.height;
|
||||||
if (rotation) {
|
if (rotation) {
|
||||||
@@ -225,8 +225,8 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame = function(frameState, lay
|
|||||||
frameState.attributions, vectorSource.getAttributions());
|
frameState.attributions, vectorSource.getAttributions());
|
||||||
this.updateLogos(frameState, vectorSource);
|
this.updateLogos(frameState, vectorSource);
|
||||||
|
|
||||||
var animating = frameState.viewHints[ol.View.Hint.ANIMATING];
|
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
|
||||||
var interacting = frameState.viewHints[ol.View.Hint.INTERACTING];
|
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
|
||||||
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
||||||
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -1,9 +1,9 @@
|
|||||||
goog.provide('ol.renderer.Layer');
|
goog.provide('ol.renderer.Layer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.Observable');
|
goog.require('ol.Observable');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
@@ -98,7 +98,7 @@ ol.renderer.Layer.prototype.getLayer = function() {
|
|||||||
*/
|
*/
|
||||||
ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
|
ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
|
||||||
var image = /** @type {ol.Image} */ (event.target);
|
var image = /** @type {ol.Image} */ (event.target);
|
||||||
if (image.getState() === ol.Image.State.LOADED) {
|
if (image.getState() === ol.ImageState.LOADED) {
|
||||||
this.renderIfReadyAndVisible();
|
this.renderIfReadyAndVisible();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -114,24 +114,24 @@ ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
|
|||||||
*/
|
*/
|
||||||
ol.renderer.Layer.prototype.loadImage = function(image) {
|
ol.renderer.Layer.prototype.loadImage = function(image) {
|
||||||
var imageState = image.getState();
|
var imageState = image.getState();
|
||||||
if (imageState != ol.Image.State.LOADED &&
|
if (imageState != ol.ImageState.LOADED &&
|
||||||
imageState != ol.Image.State.ERROR) {
|
imageState != ol.ImageState.ERROR) {
|
||||||
// the image is either "idle" or "loading", register the change
|
// the image is either "idle" or "loading", register the change
|
||||||
// listener (a noop if the listener was already registered)
|
// listener (a noop if the listener was already registered)
|
||||||
ol.DEBUG && console.assert(imageState == ol.Image.State.IDLE ||
|
ol.DEBUG && console.assert(imageState == ol.ImageState.IDLE ||
|
||||||
imageState == ol.Image.State.LOADING,
|
imageState == ol.ImageState.LOADING,
|
||||||
'imageState is "idle" or "loading"');
|
'imageState is "idle" or "loading"');
|
||||||
ol.events.listen(image, ol.events.EventType.CHANGE,
|
ol.events.listen(image, ol.events.EventType.CHANGE,
|
||||||
this.handleImageChange_, this);
|
this.handleImageChange_, this);
|
||||||
}
|
}
|
||||||
if (imageState == ol.Image.State.IDLE) {
|
if (imageState == ol.ImageState.IDLE) {
|
||||||
image.load();
|
image.load();
|
||||||
imageState = image.getState();
|
imageState = image.getState();
|
||||||
ol.DEBUG && console.assert(imageState == ol.Image.State.LOADING ||
|
ol.DEBUG && console.assert(imageState == ol.ImageState.LOADING ||
|
||||||
imageState == ol.Image.State.LOADED,
|
imageState == ol.ImageState.LOADED,
|
||||||
'imageState is "loading" or "loaded"');
|
'imageState is "loading" or "loaded"');
|
||||||
}
|
}
|
||||||
return imageState == ol.Image.State.LOADED;
|
return imageState == ol.ImageState.LOADED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
|
|||||||
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
|
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
|
||||||
if (currentZ - z <= preload) {
|
if (currentZ - z <= preload) {
|
||||||
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
|
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
|
||||||
if (tile.getState() == ol.Tile.State.IDLE) {
|
if (tile.getState() == ol.TileState.IDLE) {
|
||||||
wantedTiles[tile.getKey()] = true;
|
wantedTiles[tile.getKey()] = true;
|
||||||
if (!tileQueue.isKeyQueued(tile.getKey())) {
|
if (!tileQueue.isKeyQueued(tile.getKey())) {
|
||||||
tileQueue.enqueue([tile, tileSourceKey,
|
tileQueue.enqueue([tile, tileSourceKey,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.renderer.vector');
|
goog.provide('ol.renderer.vector');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.render.ReplayType');
|
goog.require('ol.render.ReplayType');
|
||||||
|
|
||||||
|
|
||||||
@@ -79,15 +79,15 @@ ol.renderer.vector.renderFeature = function(
|
|||||||
imageStyle = style.getImage();
|
imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
imageState = imageStyle.getImageState();
|
imageState = imageStyle.getImageState();
|
||||||
if (imageState == ol.Image.State.LOADED ||
|
if (imageState == ol.ImageState.LOADED ||
|
||||||
imageState == ol.Image.State.ERROR) {
|
imageState == ol.ImageState.ERROR) {
|
||||||
imageStyle.unlistenImageChange(listener, thisArg);
|
imageStyle.unlistenImageChange(listener, thisArg);
|
||||||
} else {
|
} else {
|
||||||
if (imageState == ol.Image.State.IDLE) {
|
if (imageState == ol.ImageState.IDLE) {
|
||||||
imageStyle.load();
|
imageStyle.load();
|
||||||
}
|
}
|
||||||
imageState = imageStyle.getImageState();
|
imageState = imageStyle.getImageState();
|
||||||
ol.DEBUG && console.assert(imageState == ol.Image.State.LOADING,
|
ol.DEBUG && console.assert(imageState == ol.ImageState.LOADING,
|
||||||
'imageState should be LOADING');
|
'imageState should be LOADING');
|
||||||
imageStyle.listenImageChange(listener, thisArg);
|
imageStyle.listenImageChange(listener, thisArg);
|
||||||
loading = true;
|
loading = true;
|
||||||
@@ -227,7 +227,7 @@ ol.renderer.vector.renderMultiPolygonGeometry_ = function(replayGroup, geometry,
|
|||||||
ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != ol.Image.State.LOADED) {
|
if (imageStyle.getImageState() != ol.ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var imageReplay = replayGroup.getReplay(
|
var imageReplay = replayGroup.getReplay(
|
||||||
@@ -256,7 +256,7 @@ ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style,
|
|||||||
ol.renderer.vector.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
ol.renderer.vector.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||||
var imageStyle = style.getImage();
|
var imageStyle = style.getImage();
|
||||||
if (imageStyle) {
|
if (imageStyle) {
|
||||||
if (imageStyle.getImageState() != ol.Image.State.LOADED) {
|
if (imageStyle.getImageState() != ol.ImageState.LOADED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var imageReplay = replayGroup.getReplay(
|
var imageReplay = replayGroup.getReplay(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.renderer.webgl.ImageLayer');
|
goog.provide('ol.renderer.webgl.ImageLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
@@ -112,7 +112,7 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame = function(frameState, layer
|
|||||||
renderedExtent = ol.extent.getIntersection(
|
renderedExtent = ol.extent.getIntersection(
|
||||||
renderedExtent, layerState.extent);
|
renderedExtent, layerState.extent);
|
||||||
}
|
}
|
||||||
if (!hints[ol.View.Hint.ANIMATING] && !hints[ol.View.Hint.INTERACTING] &&
|
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] &&
|
||||||
!ol.extent.isEmpty(renderedExtent)) {
|
!ol.extent.isEmpty(renderedExtent)) {
|
||||||
var projection = viewState.projection;
|
var projection = viewState.projection;
|
||||||
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.renderer.webgl.Layer');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.Event');
|
||||||
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.render.webgl.Immediate');
|
goog.require('ol.render.webgl.Immediate');
|
||||||
goog.require('ol.renderer.Layer');
|
goog.require('ol.renderer.Layer');
|
||||||
goog.require('ol.renderer.webgl.defaultmapshader');
|
goog.require('ol.renderer.webgl.defaultmapshader');
|
||||||
@@ -139,7 +140,7 @@ ol.renderer.webgl.Layer.prototype.bindFramebuffer = function(frameState, framebu
|
|||||||
ol.renderer.webgl.Layer.prototype.composeFrame = function(frameState, layerState, context) {
|
ol.renderer.webgl.Layer.prototype.composeFrame = function(frameState, layerState, context) {
|
||||||
|
|
||||||
this.dispatchComposeEvent_(
|
this.dispatchComposeEvent_(
|
||||||
ol.render.Event.Type.PRECOMPOSE, context, frameState);
|
ol.render.EventType.PRECOMPOSE, context, frameState);
|
||||||
|
|
||||||
context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.arrayBuffer_);
|
context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.arrayBuffer_);
|
||||||
|
|
||||||
@@ -178,13 +179,13 @@ ol.renderer.webgl.Layer.prototype.composeFrame = function(frameState, layerState
|
|||||||
gl.drawArrays(ol.webgl.TRIANGLE_STRIP, 0, 4);
|
gl.drawArrays(ol.webgl.TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
this.dispatchComposeEvent_(
|
this.dispatchComposeEvent_(
|
||||||
ol.render.Event.Type.POSTCOMPOSE, context, frameState);
|
ol.render.EventType.POSTCOMPOSE, context, frameState);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.render.Event.Type} type Event type.
|
* @param {ol.render.EventType} type Event type.
|
||||||
* @param {ol.webgl.Context} context WebGL context.
|
* @param {ol.webgl.Context} context WebGL context.
|
||||||
* @param {olx.FrameState} frameState Frame state.
|
* @param {olx.FrameState} frameState Frame state.
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ goog.require('ol.layer.Layer');
|
|||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.render.Event');
|
goog.require('ol.render.Event');
|
||||||
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.render.webgl.Immediate');
|
goog.require('ol.render.webgl.Immediate');
|
||||||
goog.require('ol.renderer.Map');
|
goog.require('ol.renderer.Map');
|
||||||
goog.require('ol.renderer.Type');
|
goog.require('ol.renderer.Type');
|
||||||
@@ -250,7 +251,7 @@ ol.renderer.webgl.Map.prototype.createLayerRenderer = function(layer) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.render.Event.Type} type Event type.
|
* @param {ol.render.EventType} type Event type.
|
||||||
* @param {olx.FrameState} frameState Frame state.
|
* @param {olx.FrameState} frameState Frame state.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -432,7 +433,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
|
|||||||
this.textureCache_.set((-frameState.index).toString(), null);
|
this.textureCache_.set((-frameState.index).toString(), null);
|
||||||
++this.textureCacheFrameMarkerCount_;
|
++this.textureCacheFrameMarkerCount_;
|
||||||
|
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.PRECOMPOSE, frameState);
|
this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState);
|
||||||
|
|
||||||
/** @type {Array.<ol.LayerState>} */
|
/** @type {Array.<ol.LayerState>} */
|
||||||
var layerStatesToDraw = [];
|
var layerStatesToDraw = [];
|
||||||
@@ -491,7 +492,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
|
|||||||
frameState.animate = true;
|
frameState.animate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchComposeEvent_(ol.render.Event.Type.POSTCOMPOSE, frameState);
|
this.dispatchComposeEvent_(ol.render.EventType.POSTCOMPOSE, frameState);
|
||||||
|
|
||||||
this.scheduleRemoveUnusedLayerRenderers(frameState);
|
this.scheduleRemoveUnusedLayerRenderers(frameState);
|
||||||
this.scheduleExpireIconCache(frameState);
|
this.scheduleExpireIconCache(frameState);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
goog.provide('ol.renderer.webgl.TileLayer');
|
goog.provide('ol.renderer.webgl.TileLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.TileRange');
|
goog.require('ol.TileRange');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -242,20 +242,20 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame = function(frameState, layerS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tileState = tile.getState();
|
tileState = tile.getState();
|
||||||
drawable = tileState == ol.Tile.State.LOADED ||
|
drawable = tileState == ol.TileState.LOADED ||
|
||||||
tileState == ol.Tile.State.EMPTY ||
|
tileState == ol.TileState.EMPTY ||
|
||||||
tileState == ol.Tile.State.ERROR && !useInterimTilesOnError;
|
tileState == ol.TileState.ERROR && !useInterimTilesOnError;
|
||||||
if (!drawable) {
|
if (!drawable) {
|
||||||
tile = tile.getInterimTile();
|
tile = tile.getInterimTile();
|
||||||
}
|
}
|
||||||
tileState = tile.getState();
|
tileState = tile.getState();
|
||||||
if (tileState == ol.Tile.State.LOADED) {
|
if (tileState == ol.TileState.LOADED) {
|
||||||
if (mapRenderer.isTileTextureLoaded(tile)) {
|
if (mapRenderer.isTileTextureLoaded(tile)) {
|
||||||
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
|
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (tileState == ol.Tile.State.EMPTY ||
|
} else if (tileState == ol.TileState.EMPTY ||
|
||||||
(tileState == ol.Tile.State.ERROR &&
|
(tileState == ol.TileState.ERROR &&
|
||||||
!useInterimTilesOnError)) {
|
!useInterimTilesOnError)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame = function(frameState, layerS
|
|||||||
* @param {ol.Tile} tile Tile.
|
* @param {ol.Tile} tile Tile.
|
||||||
*/
|
*/
|
||||||
function(tile) {
|
function(tile) {
|
||||||
if (tile.getState() == ol.Tile.State.LOADED &&
|
if (tile.getState() == ol.TileState.LOADED &&
|
||||||
!mapRenderer.isTileTextureLoaded(tile) &&
|
!mapRenderer.isTileTextureLoaded(tile) &&
|
||||||
!tileTextureQueue.isKeyQueued(tile.getKey())) {
|
!tileTextureQueue.isKeyQueued(tile.getKey())) {
|
||||||
tileTextureQueue.enqueue([
|
tileTextureQueue.enqueue([
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.renderer.webgl.VectorLayer');
|
goog.provide('ol.renderer.webgl.VectorLayer');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.render.webgl.ReplayGroup');
|
goog.require('ol.render.webgl.ReplayGroup');
|
||||||
goog.require('ol.renderer.vector');
|
goog.require('ol.renderer.vector');
|
||||||
@@ -191,8 +191,8 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame = function(frameState, laye
|
|||||||
frameState.attributions, vectorSource.getAttributions());
|
frameState.attributions, vectorSource.getAttributions());
|
||||||
this.updateLogos(frameState, vectorSource);
|
this.updateLogos(frameState, vectorSource);
|
||||||
|
|
||||||
var animating = frameState.viewHints[ol.View.Hint.ANIMATING];
|
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
|
||||||
var interacting = frameState.viewHints[ol.View.Hint.INTERACTING];
|
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
|
||||||
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
||||||
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -1,8 +1,8 @@
|
|||||||
goog.provide('ol.reproj.Image');
|
goog.provide('ol.reproj.Image');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
|
||||||
goog.require('ol.ImageBase');
|
goog.require('ol.ImageBase');
|
||||||
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -99,11 +99,11 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
|||||||
this.sourceListenerKey_ = null;
|
this.sourceListenerKey_ = null;
|
||||||
|
|
||||||
|
|
||||||
var state = ol.Image.State.LOADED;
|
var state = ol.ImageState.LOADED;
|
||||||
var attributions = [];
|
var attributions = [];
|
||||||
|
|
||||||
if (this.sourceImage_) {
|
if (this.sourceImage_) {
|
||||||
state = ol.Image.State.IDLE;
|
state = ol.ImageState.IDLE;
|
||||||
attributions = this.sourceImage_.getAttributions();
|
attributions = this.sourceImage_.getAttributions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ ol.inherits(ol.reproj.Image, ol.ImageBase);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.reproj.Image.prototype.disposeInternal = function() {
|
ol.reproj.Image.prototype.disposeInternal = function() {
|
||||||
if (this.state == ol.Image.State.LOADING) {
|
if (this.state == ol.ImageState.LOADING) {
|
||||||
this.unlistenSource_();
|
this.unlistenSource_();
|
||||||
}
|
}
|
||||||
ol.ImageBase.prototype.disposeInternal.call(this);
|
ol.ImageBase.prototype.disposeInternal.call(this);
|
||||||
@@ -145,7 +145,7 @@ ol.reproj.Image.prototype.getProjection = function() {
|
|||||||
*/
|
*/
|
||||||
ol.reproj.Image.prototype.reproject_ = function() {
|
ol.reproj.Image.prototype.reproject_ = function() {
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == ol.Image.State.LOADED) {
|
if (sourceState == ol.ImageState.LOADED) {
|
||||||
var width = ol.extent.getWidth(this.targetExtent_) / this.targetResolution_;
|
var width = ol.extent.getWidth(this.targetExtent_) / this.targetResolution_;
|
||||||
var height =
|
var height =
|
||||||
ol.extent.getHeight(this.targetExtent_) / this.targetResolution_;
|
ol.extent.getHeight(this.targetExtent_) / this.targetResolution_;
|
||||||
@@ -166,20 +166,20 @@ ol.reproj.Image.prototype.reproject_ = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.reproj.Image.prototype.load = function() {
|
ol.reproj.Image.prototype.load = function() {
|
||||||
if (this.state == ol.Image.State.IDLE) {
|
if (this.state == ol.ImageState.IDLE) {
|
||||||
this.state = ol.Image.State.LOADING;
|
this.state = ol.ImageState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
|
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == ol.Image.State.LOADED ||
|
if (sourceState == ol.ImageState.LOADED ||
|
||||||
sourceState == ol.Image.State.ERROR) {
|
sourceState == ol.ImageState.ERROR) {
|
||||||
this.reproject_();
|
this.reproject_();
|
||||||
} else {
|
} else {
|
||||||
this.sourceListenerKey_ = ol.events.listen(this.sourceImage_,
|
this.sourceListenerKey_ = ol.events.listen(this.sourceImage_,
|
||||||
ol.events.EventType.CHANGE, function(e) {
|
ol.events.EventType.CHANGE, function(e) {
|
||||||
var sourceState = this.sourceImage_.getState();
|
var sourceState = this.sourceImage_.getState();
|
||||||
if (sourceState == ol.Image.State.LOADED ||
|
if (sourceState == ol.ImageState.LOADED ||
|
||||||
sourceState == ol.Image.State.ERROR) {
|
sourceState == ol.ImageState.ERROR) {
|
||||||
this.unlistenSource_();
|
this.unlistenSource_();
|
||||||
this.reproject_();
|
this.reproject_();
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-18
@@ -2,6 +2,7 @@ goog.provide('ol.reproj.Tile');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -35,7 +36,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
pixelRatio, gutter, getTileFunction,
|
pixelRatio, gutter, getTileFunction,
|
||||||
opt_errorThreshold,
|
opt_errorThreshold,
|
||||||
opt_renderEdges) {
|
opt_renderEdges) {
|
||||||
ol.Tile.call(this, tileCoord, ol.Tile.State.IDLE);
|
ol.Tile.call(this, tileCoord, ol.TileState.IDLE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -107,7 +108,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
if (ol.extent.getArea(limitedTargetExtent) === 0) {
|
if (ol.extent.getArea(limitedTargetExtent) === 0) {
|
||||||
// Tile is completely outside range -> EMPTY
|
// Tile is completely outside range -> EMPTY
|
||||||
// TODO: is it actually correct that the source even creates the tile ?
|
// TODO: is it actually correct that the source even creates the tile ?
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
if (!isFinite(sourceResolution) || sourceResolution <= 0) {
|
if (!isFinite(sourceResolution) || sourceResolution <= 0) {
|
||||||
// invalid sourceResolution -> EMPTY
|
// invalid sourceResolution -> EMPTY
|
||||||
// probably edges of the projections when no extent is defined
|
// probably edges of the projections when no extent is defined
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
|
|
||||||
if (this.triangulation_.getTriangles().length === 0) {
|
if (this.triangulation_.getTriangles().length === 0) {
|
||||||
// no valid triangles -> EMPTY
|
// no valid triangles -> EMPTY
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +168,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ol.extent.getArea(sourceExtent)) {
|
if (!ol.extent.getArea(sourceExtent)) {
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(
|
var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(
|
||||||
sourceExtent, this.sourceZ_);
|
sourceExtent, this.sourceZ_);
|
||||||
@@ -175,7 +176,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
var tilesRequired = sourceRange.getWidth() * sourceRange.getHeight();
|
var tilesRequired = sourceRange.getWidth() * sourceRange.getHeight();
|
||||||
if (ol.DEBUG && !(tilesRequired < ol.RASTER_REPROJECTION_MAX_SOURCE_TILES)) {
|
if (ol.DEBUG && !(tilesRequired < ol.RASTER_REPROJECTION_MAX_SOURCE_TILES)) {
|
||||||
console.assert(false, 'reasonable number of tiles is required');
|
console.assert(false, 'reasonable number of tiles is required');
|
||||||
this.state = ol.Tile.State.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {
|
for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {
|
||||||
@@ -188,7 +189,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.sourceTiles_.length === 0) {
|
if (this.sourceTiles_.length === 0) {
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -199,7 +200,7 @@ ol.inherits(ol.reproj.Tile, ol.Tile);
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.reproj.Tile.prototype.disposeInternal = function() {
|
ol.reproj.Tile.prototype.disposeInternal = function() {
|
||||||
if (this.state == ol.Tile.State.LOADING) {
|
if (this.state == ol.TileState.LOADING) {
|
||||||
this.unlistenSources_();
|
this.unlistenSources_();
|
||||||
}
|
}
|
||||||
ol.Tile.prototype.disposeInternal.call(this);
|
ol.Tile.prototype.disposeInternal.call(this);
|
||||||
@@ -220,7 +221,7 @@ ol.reproj.Tile.prototype.getImage = function() {
|
|||||||
ol.reproj.Tile.prototype.reproject_ = function() {
|
ol.reproj.Tile.prototype.reproject_ = function() {
|
||||||
var sources = [];
|
var sources = [];
|
||||||
this.sourceTiles_.forEach(function(tile, i, arr) {
|
this.sourceTiles_.forEach(function(tile, i, arr) {
|
||||||
if (tile && tile.getState() == ol.Tile.State.LOADED) {
|
if (tile && tile.getState() == ol.TileState.LOADED) {
|
||||||
sources.push({
|
sources.push({
|
||||||
extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
|
extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
|
||||||
image: tile.getImage()
|
image: tile.getImage()
|
||||||
@@ -230,7 +231,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
|||||||
this.sourceTiles_.length = 0;
|
this.sourceTiles_.length = 0;
|
||||||
|
|
||||||
if (sources.length === 0) {
|
if (sources.length === 0) {
|
||||||
this.state = ol.Tile.State.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
} else {
|
} else {
|
||||||
var z = this.wrappedTileCoord_[0];
|
var z = this.wrappedTileCoord_[0];
|
||||||
var size = this.targetTileGrid_.getTileSize(z);
|
var size = this.targetTileGrid_.getTileSize(z);
|
||||||
@@ -246,7 +247,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
|||||||
targetResolution, targetExtent, this.triangulation_, sources,
|
targetResolution, targetExtent, this.triangulation_, sources,
|
||||||
this.gutter_, this.renderEdges_);
|
this.gutter_, this.renderEdges_);
|
||||||
|
|
||||||
this.state = ol.Tile.State.LOADED;
|
this.state = ol.TileState.LOADED;
|
||||||
}
|
}
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
@@ -256,8 +257,8 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.reproj.Tile.prototype.load = function() {
|
ol.reproj.Tile.prototype.load = function() {
|
||||||
if (this.state == ol.Tile.State.IDLE) {
|
if (this.state == ol.TileState.IDLE) {
|
||||||
this.state = ol.Tile.State.LOADING;
|
this.state = ol.TileState.LOADING;
|
||||||
this.changed();
|
this.changed();
|
||||||
|
|
||||||
var leftToLoad = 0;
|
var leftToLoad = 0;
|
||||||
@@ -268,16 +269,16 @@ ol.reproj.Tile.prototype.load = function() {
|
|||||||
this.sourcesListenerKeys_ = [];
|
this.sourcesListenerKeys_ = [];
|
||||||
this.sourceTiles_.forEach(function(tile, i, arr) {
|
this.sourceTiles_.forEach(function(tile, i, arr) {
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (state == ol.Tile.State.IDLE || state == ol.Tile.State.LOADING) {
|
if (state == ol.TileState.IDLE || state == ol.TileState.LOADING) {
|
||||||
leftToLoad++;
|
leftToLoad++;
|
||||||
|
|
||||||
var sourceListenKey;
|
var sourceListenKey;
|
||||||
sourceListenKey = ol.events.listen(tile, ol.events.EventType.CHANGE,
|
sourceListenKey = ol.events.listen(tile, ol.events.EventType.CHANGE,
|
||||||
function(e) {
|
function(e) {
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (state == ol.Tile.State.LOADED ||
|
if (state == ol.TileState.LOADED ||
|
||||||
state == ol.Tile.State.ERROR ||
|
state == ol.TileState.ERROR ||
|
||||||
state == ol.Tile.State.EMPTY) {
|
state == ol.TileState.EMPTY) {
|
||||||
ol.events.unlistenByKey(sourceListenKey);
|
ol.events.unlistenByKey(sourceListenKey);
|
||||||
leftToLoad--;
|
leftToLoad--;
|
||||||
ol.DEBUG && console.assert(leftToLoad >= 0,
|
ol.DEBUG && console.assert(leftToLoad >= 0,
|
||||||
@@ -294,7 +295,7 @@ ol.reproj.Tile.prototype.load = function() {
|
|||||||
|
|
||||||
this.sourceTiles_.forEach(function(tile, i, arr) {
|
this.sourceTiles_.forEach(function(tile, i, arr) {
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (state == ol.Tile.State.IDLE) {
|
if (state == ol.TileState.IDLE) {
|
||||||
tile.load();
|
tile.load();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.source.Image');
|
goog.provide('ol.source.Image');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.events.Event');
|
goog.require('ol.events.Event');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -147,17 +147,17 @@ ol.source.Image.prototype.getImageInternal = function(extent, resolution, pixelR
|
|||||||
ol.source.Image.prototype.handleImageChange = function(event) {
|
ol.source.Image.prototype.handleImageChange = function(event) {
|
||||||
var image = /** @type {ol.Image} */ (event.target);
|
var image = /** @type {ol.Image} */ (event.target);
|
||||||
switch (image.getState()) {
|
switch (image.getState()) {
|
||||||
case ol.Image.State.LOADING:
|
case ol.ImageState.LOADING:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADSTART,
|
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADSTART,
|
||||||
image));
|
image));
|
||||||
break;
|
break;
|
||||||
case ol.Image.State.LOADED:
|
case ol.ImageState.LOADED:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADEND,
|
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADEND,
|
||||||
image));
|
image));
|
||||||
break;
|
break;
|
||||||
case ol.Image.State.ERROR:
|
case ol.ImageState.ERROR:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADERROR,
|
new ol.source.Image.Event(ol.source.Image.EventType.IMAGELOADERROR,
|
||||||
image));
|
image));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.source.ImageStatic');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.Image');
|
||||||
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
@@ -70,7 +71,7 @@ ol.source.ImageStatic.prototype.getImageInternal = function(extent, resolution,
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.ImageStatic.prototype.handleImageChange = function(evt) {
|
ol.source.ImageStatic.prototype.handleImageChange = function(evt) {
|
||||||
if (this.image_.getState() == ol.Image.State.LOADED) {
|
if (this.image_.getState() == ol.ImageState.LOADED) {
|
||||||
var imageExtent = this.image_.getExtent();
|
var imageExtent = this.image_.getExtent();
|
||||||
var image = this.image_.getImage();
|
var image = this.image_.getImage();
|
||||||
var imageWidth, imageHeight;
|
var imageWidth, imageHeight;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
goog.provide('ol.source.Tile');
|
goog.provide('ol.source.Tile');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
|
||||||
goog.require('ol.TileCache');
|
goog.require('ol.TileCache');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events.Event');
|
goog.require('ol.events.Event');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.size');
|
goog.require('ol.size');
|
||||||
@@ -117,7 +117,7 @@ ol.source.Tile.prototype.forEachLoadedTile = function(projection, z, tileRange,
|
|||||||
loaded = false;
|
loaded = false;
|
||||||
if (tileCache.containsKey(tileCoordKey)) {
|
if (tileCache.containsKey(tileCoordKey)) {
|
||||||
tile = /** @type {!ol.Tile} */ (tileCache.get(tileCoordKey));
|
tile = /** @type {!ol.Tile} */ (tileCache.get(tileCoordKey));
|
||||||
loaded = tile.getState() === ol.Tile.State.LOADED;
|
loaded = tile.getState() === ol.TileState.LOADED;
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
loaded = (callback(tile) !== false);
|
loaded = (callback(tile) !== false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.source.TileDebug');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.size');
|
goog.require('ol.size');
|
||||||
goog.require('ol.source.Tile');
|
goog.require('ol.source.Tile');
|
||||||
@@ -63,7 +64,7 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
|
|||||||
*/
|
*/
|
||||||
ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||||
|
|
||||||
ol.Tile.call(this, tileCoord, ol.Tile.State.LOADED);
|
ol.Tile.call(this, tileCoord, ol.TileState.LOADED);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ goog.provide('ol.source.TileImage');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.ImageTile');
|
goog.require('ol.ImageTile');
|
||||||
goog.require('ol.Tile');
|
|
||||||
goog.require('ol.TileCache');
|
goog.require('ol.TileCache');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
@@ -51,7 +51,7 @@ ol.source.TileImage = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {function(new: ol.ImageTile, ol.TileCoord, ol.Tile.State, string,
|
* @type {function(new: ol.ImageTile, ol.TileCoord, ol.TileState, string,
|
||||||
* ?string, ol.TileLoadFunctionType)}
|
* ?string, ol.TileLoadFunctionType)}
|
||||||
*/
|
*/
|
||||||
this.tileClass = options.tileClass !== undefined ?
|
this.tileClass = options.tileClass !== undefined ?
|
||||||
@@ -219,7 +219,7 @@ ol.source.TileImage.prototype.createTile_ = function(z, x, y, pixelRatio, projec
|
|||||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
||||||
var tile = new this.tileClass(
|
var tile = new this.tileClass(
|
||||||
tileCoord,
|
tileCoord,
|
||||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||||
tileUrl !== undefined ? tileUrl : '',
|
tileUrl !== undefined ? tileUrl : '',
|
||||||
this.crossOrigin,
|
this.crossOrigin,
|
||||||
this.tileLoadFunction);
|
this.tileLoadFunction);
|
||||||
@@ -305,7 +305,7 @@ ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, pr
|
|||||||
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
|
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
|
||||||
|
|
||||||
//make the new tile the head of the list,
|
//make the new tile the head of the list,
|
||||||
if (interimTile.getState() == ol.Tile.State.IDLE) {
|
if (interimTile.getState() == ol.TileState.IDLE) {
|
||||||
//the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
|
//the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
|
||||||
tile.interimTile = interimTile.interimTile;
|
tile.interimTile = interimTile.interimTile;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ goog.provide('ol.source.TileUTFGrid');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
@@ -236,7 +237,7 @@ ol.source.TileUTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projecti
|
|||||||
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
|
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
|
||||||
var tile = new ol.source.TileUTFGrid.Tile_(
|
var tile = new ol.source.TileUTFGrid.Tile_(
|
||||||
tileCoord,
|
tileCoord,
|
||||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||||
tileUrl !== undefined ? tileUrl : '',
|
tileUrl !== undefined ? tileUrl : '',
|
||||||
this.tileGrid.getTileCoordExtent(tileCoord),
|
this.tileGrid.getTileCoordExtent(tileCoord),
|
||||||
this.preemptive_,
|
this.preemptive_,
|
||||||
@@ -262,7 +263,7 @@ ol.source.TileUTFGrid.prototype.useTile = function(z, x, y) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Tile}
|
* @extends {ol.Tile}
|
||||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.Tile.State} state State.
|
* @param {ol.TileState} state State.
|
||||||
* @param {string} src Image source URI.
|
* @param {string} src Image source URI.
|
||||||
* @param {ol.Extent} extent Extent of the tile.
|
* @param {ol.Extent} extent Extent of the tile.
|
||||||
* @param {boolean} preemptive Load the tile when visible (before it's needed).
|
* @param {boolean} preemptive Load the tile when visible (before it's needed).
|
||||||
@@ -382,7 +383,7 @@ ol.source.TileUTFGrid.Tile_.prototype.getData = function(coordinate) {
|
|||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
ol.source.TileUTFGrid.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
|
ol.source.TileUTFGrid.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
|
||||||
if (this.state == ol.Tile.State.IDLE && opt_request === true) {
|
if (this.state == ol.TileState.IDLE && opt_request === true) {
|
||||||
ol.events.listenOnce(this, ol.events.EventType.CHANGE, function(e) {
|
ol.events.listenOnce(this, ol.events.EventType.CHANGE, function(e) {
|
||||||
callback.call(opt_this, this.getData(coordinate));
|
callback.call(opt_this, this.getData(coordinate));
|
||||||
}, this);
|
}, this);
|
||||||
@@ -411,7 +412,7 @@ ol.source.TileUTFGrid.Tile_.prototype.getKey = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.source.TileUTFGrid.Tile_.prototype.handleError_ = function() {
|
ol.source.TileUTFGrid.Tile_.prototype.handleError_ = function() {
|
||||||
this.state = ol.Tile.State.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -425,7 +426,7 @@ ol.source.TileUTFGrid.Tile_.prototype.handleLoad_ = function(json) {
|
|||||||
this.keys_ = json.keys;
|
this.keys_ = json.keys;
|
||||||
this.data_ = json.data;
|
this.data_ = json.data;
|
||||||
|
|
||||||
this.state = ol.Tile.State.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -434,8 +435,8 @@ ol.source.TileUTFGrid.Tile_.prototype.handleLoad_ = function(json) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.source.TileUTFGrid.Tile_.prototype.loadInternal_ = function() {
|
ol.source.TileUTFGrid.Tile_.prototype.loadInternal_ = function() {
|
||||||
if (this.state == ol.Tile.State.IDLE) {
|
if (this.state == ol.TileState.IDLE) {
|
||||||
this.state = ol.Tile.State.LOADING;
|
this.state = ol.TileState.LOADING;
|
||||||
if (this.jsonp_) {
|
if (this.jsonp_) {
|
||||||
ol.net.jsonp(this.src_, this.handleLoad_.bind(this),
|
ol.net.jsonp(this.src_, this.handleLoad_.bind(this),
|
||||||
this.handleError_.bind(this));
|
this.handleError_.bind(this));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.source.UrlTile');
|
goog.provide('ol.source.UrlTile');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
goog.require('ol.source.Tile');
|
goog.require('ol.source.Tile');
|
||||||
|
|
||||||
@@ -109,15 +109,15 @@ ol.source.UrlTile.prototype.getUrls = function() {
|
|||||||
ol.source.UrlTile.prototype.handleTileChange = function(event) {
|
ol.source.UrlTile.prototype.handleTileChange = function(event) {
|
||||||
var tile = /** @type {ol.Tile} */ (event.target);
|
var tile = /** @type {ol.Tile} */ (event.target);
|
||||||
switch (tile.getState()) {
|
switch (tile.getState()) {
|
||||||
case ol.Tile.State.LOADING:
|
case ol.TileState.LOADING:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADSTART, tile));
|
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADSTART, tile));
|
||||||
break;
|
break;
|
||||||
case ol.Tile.State.LOADED:
|
case ol.TileState.LOADED:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADEND, tile));
|
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADEND, tile));
|
||||||
break;
|
break;
|
||||||
case ol.Tile.State.ERROR:
|
case ol.TileState.ERROR:
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADERROR, tile));
|
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADERROR, tile));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.source.VectorTile');
|
goog.provide('ol.source.VectorTile');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.VectorTile');
|
goog.require('ol.VectorTile');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
@@ -59,7 +59,7 @@ ol.source.VectorTile = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.Tile.State, string,
|
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string,
|
||||||
* ol.format.Feature, ol.TileLoadFunctionType)}
|
* ol.format.Feature, ol.TileLoadFunctionType)}
|
||||||
*/
|
*/
|
||||||
this.tileClass = options.tileClass ? options.tileClass : ol.VectorTile;
|
this.tileClass = options.tileClass ? options.tileClass : ol.VectorTile;
|
||||||
@@ -91,7 +91,7 @@ ol.source.VectorTile.prototype.getTile = function(z, x, y, pixelRatio, projectio
|
|||||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
||||||
var tile = new this.tileClass(
|
var tile = new this.tileClass(
|
||||||
tileCoord,
|
tileCoord,
|
||||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||||
tileUrl !== undefined ? tileUrl : '',
|
tileUrl !== undefined ? tileUrl : '',
|
||||||
this.format_, this.tileLoadFunction);
|
this.format_, this.tileLoadFunction);
|
||||||
ol.events.listen(tile, ol.events.EventType.CHANGE,
|
ol.events.listen(tile, ol.events.EventType.CHANGE,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.provide('ol.source.Zoomify');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.ImageTile');
|
goog.require('ol.ImageTile');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
@@ -127,7 +127,7 @@ ol.inherits(ol.source.Zoomify, ol.source.TileImage);
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.ImageTile}
|
* @extends {ol.ImageTile}
|
||||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.Tile.State} state State.
|
* @param {ol.TileState} state State.
|
||||||
* @param {string} src Image source URI.
|
* @param {string} src Image source URI.
|
||||||
* @param {?string} crossOrigin Cross origin.
|
* @param {?string} crossOrigin Cross origin.
|
||||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||||
@@ -157,7 +157,7 @@ ol.source.Zoomify.Tile_.prototype.getImage = function() {
|
|||||||
}
|
}
|
||||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||||
var image = ol.ImageTile.prototype.getImage.call(this);
|
var image = ol.ImageTile.prototype.getImage.call(this);
|
||||||
if (this.state == ol.Tile.State.LOADED) {
|
if (this.state == ol.TileState.LOADED) {
|
||||||
if (image.width == tileSize && image.height == tileSize) {
|
if (image.width == tileSize && image.height == tileSize) {
|
||||||
this.zoomifyImage_ = image;
|
this.zoomifyImage_ = image;
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
+28
-48
@@ -1,12 +1,14 @@
|
|||||||
goog.provide('ol.style.Icon');
|
goog.provide('ol.style.Icon');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.color');
|
goog.require('ol.color');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.style.IconAnchorUnits');
|
||||||
goog.require('ol.style.IconImage');
|
goog.require('ol.style.IconImage');
|
||||||
|
goog.require('ol.style.IconOrigin');
|
||||||
goog.require('ol.style.Image');
|
goog.require('ol.style.Image');
|
||||||
|
|
||||||
|
|
||||||
@@ -37,24 +39,24 @@ ol.style.Icon = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.Icon.Origin}
|
* @type {ol.style.IconOrigin}
|
||||||
*/
|
*/
|
||||||
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
||||||
options.anchorOrigin : ol.style.Icon.Origin.TOP_LEFT;
|
options.anchorOrigin : ol.style.IconOrigin.TOP_LEFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.Icon.AnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
||||||
options.anchorXUnits : ol.style.Icon.AnchorUnits.FRACTION;
|
options.anchorXUnits : ol.style.IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.Icon.AnchorUnits}
|
* @type {ol.style.IconAnchorUnits}
|
||||||
*/
|
*/
|
||||||
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
||||||
options.anchorYUnits : ol.style.Icon.AnchorUnits.FRACTION;
|
options.anchorYUnits : ol.style.IconAnchorUnits.FRACTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -90,10 +92,10 @@ ol.style.Icon = function(opt_options) {
|
|||||||
6); // A defined and non-empty `src` or `image` must be provided
|
6); // A defined and non-empty `src` or `image` must be provided
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Image.State}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
var imageState = options.src !== undefined ?
|
var imageState = options.src !== undefined ?
|
||||||
ol.Image.State.IDLE : ol.Image.State.LOADED;
|
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -117,10 +119,10 @@ ol.style.Icon = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.style.Icon.Origin}
|
* @type {ol.style.IconOrigin}
|
||||||
*/
|
*/
|
||||||
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
||||||
options.offsetOrigin : ol.style.Icon.Origin.TOP_LEFT;
|
options.offsetOrigin : ol.style.IconOrigin.TOP_LEFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -181,7 +183,7 @@ ol.inherits(ol.style.Icon, ol.style.Image);
|
|||||||
ol.style.Icon.prototype.clone = function() {
|
ol.style.Icon.prototype.clone = function() {
|
||||||
var oldImage = this.getImage(1);
|
var oldImage = this.getImage(1);
|
||||||
var newImage;
|
var newImage;
|
||||||
if (this.iconImage_.getImageState() === ol.Image.State.LOADED) {
|
if (this.iconImage_.getImageState() === ol.ImageState.LOADED) {
|
||||||
if (oldImage.tagName.toUpperCase() === 'IMG') {
|
if (oldImage.tagName.toUpperCase() === 'IMG') {
|
||||||
newImage = /** @type {Image} */ (oldImage.cloneNode(true));
|
newImage = /** @type {Image} */ (oldImage.cloneNode(true));
|
||||||
} else {
|
} else {
|
||||||
@@ -224,33 +226,33 @@ ol.style.Icon.prototype.getAnchor = function() {
|
|||||||
}
|
}
|
||||||
var anchor = this.anchor_;
|
var anchor = this.anchor_;
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
if (this.anchorXUnits_ == ol.style.Icon.AnchorUnits.FRACTION ||
|
if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION ||
|
||||||
this.anchorYUnits_ == ol.style.Icon.AnchorUnits.FRACTION) {
|
this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
anchor = this.anchor_.slice();
|
anchor = this.anchor_.slice();
|
||||||
if (this.anchorXUnits_ == ol.style.Icon.AnchorUnits.FRACTION) {
|
if (this.anchorXUnits_ == ol.style.IconAnchorUnits.FRACTION) {
|
||||||
anchor[0] *= size[0];
|
anchor[0] *= size[0];
|
||||||
}
|
}
|
||||||
if (this.anchorYUnits_ == ol.style.Icon.AnchorUnits.FRACTION) {
|
if (this.anchorYUnits_ == ol.style.IconAnchorUnits.FRACTION) {
|
||||||
anchor[1] *= size[1];
|
anchor[1] *= size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.anchorOrigin_ != ol.style.Icon.Origin.TOP_LEFT) {
|
if (this.anchorOrigin_ != ol.style.IconOrigin.TOP_LEFT) {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (anchor === this.anchor_) {
|
if (anchor === this.anchor_) {
|
||||||
anchor = this.anchor_.slice();
|
anchor = this.anchor_.slice();
|
||||||
}
|
}
|
||||||
if (this.anchorOrigin_ == ol.style.Icon.Origin.TOP_RIGHT ||
|
if (this.anchorOrigin_ == ol.style.IconOrigin.TOP_RIGHT ||
|
||||||
this.anchorOrigin_ == ol.style.Icon.Origin.BOTTOM_RIGHT) {
|
this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
|
||||||
anchor[0] = -anchor[0] + size[0];
|
anchor[0] = -anchor[0] + size[0];
|
||||||
}
|
}
|
||||||
if (this.anchorOrigin_ == ol.style.Icon.Origin.BOTTOM_LEFT ||
|
if (this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT ||
|
||||||
this.anchorOrigin_ == ol.style.Icon.Origin.BOTTOM_RIGHT) {
|
this.anchorOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
|
||||||
anchor[1] = -anchor[1] + size[1];
|
anchor[1] = -anchor[1] + size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,19 +325,19 @@ ol.style.Icon.prototype.getOrigin = function() {
|
|||||||
}
|
}
|
||||||
var offset = this.offset_;
|
var offset = this.offset_;
|
||||||
|
|
||||||
if (this.offsetOrigin_ != ol.style.Icon.Origin.TOP_LEFT) {
|
if (this.offsetOrigin_ != ol.style.IconOrigin.TOP_LEFT) {
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
var iconImageSize = this.iconImage_.getSize();
|
var iconImageSize = this.iconImage_.getSize();
|
||||||
if (!size || !iconImageSize) {
|
if (!size || !iconImageSize) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
offset = offset.slice();
|
offset = offset.slice();
|
||||||
if (this.offsetOrigin_ == ol.style.Icon.Origin.TOP_RIGHT ||
|
if (this.offsetOrigin_ == ol.style.IconOrigin.TOP_RIGHT ||
|
||||||
this.offsetOrigin_ == ol.style.Icon.Origin.BOTTOM_RIGHT) {
|
this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
|
||||||
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
||||||
}
|
}
|
||||||
if (this.offsetOrigin_ == ol.style.Icon.Origin.BOTTOM_LEFT ||
|
if (this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_LEFT ||
|
||||||
this.offsetOrigin_ == ol.style.Icon.Origin.BOTTOM_RIGHT) {
|
this.offsetOrigin_ == ol.style.IconOrigin.BOTTOM_RIGHT) {
|
||||||
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,25 +393,3 @@ ol.style.Icon.prototype.unlistenImageChange = function(listener, thisArg) {
|
|||||||
ol.events.unlisten(this.iconImage_, ol.events.EventType.CHANGE,
|
ol.events.unlisten(this.iconImage_, ol.events.EventType.CHANGE,
|
||||||
listener, thisArg);
|
listener, thisArg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Icon anchor units. One of 'fraction', 'pixels'.
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.style.Icon.AnchorUnits = {
|
|
||||||
FRACTION: 'fraction',
|
|
||||||
PIXELS: 'pixels'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.style.Icon.Origin = {
|
|
||||||
BOTTOM_LEFT: 'bottom-left',
|
|
||||||
BOTTOM_RIGHT: 'bottom-right',
|
|
||||||
TOP_LEFT: 'top-left',
|
|
||||||
TOP_RIGHT: 'top-right'
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
goog.provide('ol.style.IconAnchorUnits');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icon anchor units. One of 'fraction', 'pixels'.
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.style.IconAnchorUnits = {
|
||||||
|
FRACTION: 'fraction',
|
||||||
|
PIXELS: 'pixels'
|
||||||
|
};
|
||||||
+10
-10
@@ -5,7 +5,7 @@ goog.require('ol.dom');
|
|||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventTarget');
|
goog.require('ol.events.EventTarget');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.style');
|
goog.require('ol.style');
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ goog.require('ol.style');
|
|||||||
* @param {string|undefined} src Src.
|
* @param {string|undefined} src Src.
|
||||||
* @param {ol.Size} size Size.
|
* @param {ol.Size} size Size.
|
||||||
* @param {?string} crossOrigin Cross origin.
|
* @param {?string} crossOrigin Cross origin.
|
||||||
* @param {ol.Image.State} imageState Image state.
|
* @param {ol.ImageState} imageState Image state.
|
||||||
* @param {ol.Color} color Color.
|
* @param {ol.Color} color Color.
|
||||||
* @extends {ol.events.EventTarget}
|
* @extends {ol.events.EventTarget}
|
||||||
*/
|
*/
|
||||||
@@ -62,7 +62,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Image.State}
|
* @type {ol.ImageState}
|
||||||
*/
|
*/
|
||||||
this.imageState_ = imageState;
|
this.imageState_ = imageState;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.tainting_ = false;
|
this.tainting_ = false;
|
||||||
if (this.imageState_ == ol.Image.State.LOADED) {
|
if (this.imageState_ == ol.ImageState.LOADED) {
|
||||||
this.determineTainting_();
|
this.determineTainting_();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ ol.inherits(ol.style.IconImage, ol.events.EventTarget);
|
|||||||
* @param {string} src Src.
|
* @param {string} src Src.
|
||||||
* @param {ol.Size} size Size.
|
* @param {ol.Size} size Size.
|
||||||
* @param {?string} crossOrigin Cross origin.
|
* @param {?string} crossOrigin Cross origin.
|
||||||
* @param {ol.Image.State} imageState Image state.
|
* @param {ol.ImageState} imageState Image state.
|
||||||
* @param {ol.Color} color Color.
|
* @param {ol.Color} color Color.
|
||||||
* @return {ol.style.IconImage} Icon image.
|
* @return {ol.style.IconImage} Icon image.
|
||||||
*/
|
*/
|
||||||
@@ -139,7 +139,7 @@ ol.style.IconImage.prototype.dispatchChangeEvent_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.style.IconImage.prototype.handleImageError_ = function() {
|
ol.style.IconImage.prototype.handleImageError_ = function() {
|
||||||
this.imageState_ = ol.Image.State.ERROR;
|
this.imageState_ = ol.ImageState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
this.dispatchChangeEvent_();
|
this.dispatchChangeEvent_();
|
||||||
};
|
};
|
||||||
@@ -149,7 +149,7 @@ ol.style.IconImage.prototype.handleImageError_ = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.style.IconImage.prototype.handleImageLoad_ = function() {
|
ol.style.IconImage.prototype.handleImageLoad_ = function() {
|
||||||
this.imageState_ = ol.Image.State.LOADED;
|
this.imageState_ = ol.ImageState.LOADED;
|
||||||
if (this.size_) {
|
if (this.size_) {
|
||||||
this.image_.width = this.size_[0];
|
this.image_.width = this.size_[0];
|
||||||
this.image_.height = this.size_[1];
|
this.image_.height = this.size_[1];
|
||||||
@@ -172,7 +172,7 @@ ol.style.IconImage.prototype.getImage = function(pixelRatio) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {ol.Image.State} Image state.
|
* @return {ol.ImageState} Image state.
|
||||||
*/
|
*/
|
||||||
ol.style.IconImage.prototype.getImageState = function() {
|
ol.style.IconImage.prototype.getImageState = function() {
|
||||||
return this.imageState_;
|
return this.imageState_;
|
||||||
@@ -219,12 +219,12 @@ ol.style.IconImage.prototype.getSrc = function() {
|
|||||||
* Load not yet loaded URI.
|
* Load not yet loaded URI.
|
||||||
*/
|
*/
|
||||||
ol.style.IconImage.prototype.load = function() {
|
ol.style.IconImage.prototype.load = function() {
|
||||||
if (this.imageState_ == ol.Image.State.IDLE) {
|
if (this.imageState_ == ol.ImageState.IDLE) {
|
||||||
ol.DEBUG && console.assert(this.src_ !== undefined,
|
ol.DEBUG && console.assert(this.src_ !== undefined,
|
||||||
'this.src_ must not be undefined');
|
'this.src_ must not be undefined');
|
||||||
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
ol.DEBUG && console.assert(!this.imageListenerKeys_,
|
||||||
'no listener keys existing');
|
'no listener keys existing');
|
||||||
this.imageState_ = ol.Image.State.LOADING;
|
this.imageState_ = ol.ImageState.LOADING;
|
||||||
this.imageListenerKeys_ = [
|
this.imageListenerKeys_ = [
|
||||||
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
||||||
this.handleImageError_, this),
|
this.handleImageError_, this),
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
goog.provide('ol.style.IconOrigin');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.style.IconOrigin = {
|
||||||
|
BOTTOM_LEFT: 'bottom-left',
|
||||||
|
BOTTOM_RIGHT: 'bottom-right',
|
||||||
|
TOP_LEFT: 'top-left',
|
||||||
|
TOP_RIGHT: 'top-right'
|
||||||
|
};
|
||||||
@@ -124,7 +124,7 @@ ol.style.Image.prototype.getHitDetectionImage = function(pixelRatio) {};
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* @abstract
|
||||||
* @return {ol.Image.State} Image state.
|
* @return {ol.ImageState} Image state.
|
||||||
*/
|
*/
|
||||||
ol.style.Image.prototype.getImageState = function() {};
|
ol.style.Image.prototype.getImageState = function() {};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ goog.require('ol');
|
|||||||
goog.require('ol.colorlike');
|
goog.require('ol.colorlike');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.has');
|
goog.require('ol.has');
|
||||||
goog.require('ol.Image');
|
goog.require('ol.ImageState');
|
||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
goog.require('ol.style.Image');
|
goog.require('ol.style.Image');
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.style.RegularShape.prototype.getImageState = function() {
|
ol.style.RegularShape.prototype.getImageState = function() {
|
||||||
return ol.Image.State.LOADED;
|
return ol.ImageState.LOADED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+8
-20
@@ -1,6 +1,7 @@
|
|||||||
goog.provide('ol.Tile');
|
goog.provide('ol.Tile');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events.EventTarget');
|
goog.require('ol.events.EventTarget');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ goog.require('ol.events.EventType');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.events.EventTarget}
|
* @extends {ol.events.EventTarget}
|
||||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.Tile.State} state State.
|
* @param {ol.TileState} state State.
|
||||||
*/
|
*/
|
||||||
ol.Tile = function(tileCoord, state) {
|
ol.Tile = function(tileCoord, state) {
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ ol.Tile = function(tileCoord, state) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {ol.Tile.State}
|
* @type {ol.TileState}
|
||||||
*/
|
*/
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ ol.Tile.prototype.getInterimTile = function() {
|
|||||||
// of the list (all those tiles correspond to older requests and will be
|
// of the list (all those tiles correspond to older requests and will be
|
||||||
// cleaned up by refreshInterimChain)
|
// cleaned up by refreshInterimChain)
|
||||||
do {
|
do {
|
||||||
if (tile.getState() == ol.Tile.State.LOADED) {
|
if (tile.getState() == ol.TileState.LOADED) {
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
tile = tile.interimTile;
|
tile = tile.interimTile;
|
||||||
@@ -113,17 +114,17 @@ ol.Tile.prototype.refreshInterimChain = function() {
|
|||||||
var prev = this;
|
var prev = this;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (tile.getState() == ol.Tile.State.LOADED) {
|
if (tile.getState() == ol.TileState.LOADED) {
|
||||||
//we have a loaded tile, we can discard the rest of the list
|
//we have a loaded tile, we can discard the rest of the list
|
||||||
//we would could abort any LOADING tile request
|
//we would could abort any LOADING tile request
|
||||||
//older than this tile (i.e. any LOADING tile following this entry in the chain)
|
//older than this tile (i.e. any LOADING tile following this entry in the chain)
|
||||||
tile.interimTile = null;
|
tile.interimTile = null;
|
||||||
break;
|
break;
|
||||||
} else if (tile.getState() == ol.Tile.State.LOADING) {
|
} else if (tile.getState() == ol.TileState.LOADING) {
|
||||||
//keep this LOADING tile any loaded tiles later in the chain are
|
//keep this LOADING tile any loaded tiles later in the chain are
|
||||||
//older than this tile, so we're still interested in the request
|
//older than this tile, so we're still interested in the request
|
||||||
prev = tile;
|
prev = tile;
|
||||||
} else if (tile.getState() == ol.Tile.State.IDLE) {
|
} else if (tile.getState() == ol.TileState.IDLE) {
|
||||||
//the head of the list is the most current tile, we don't need
|
//the head of the list is the most current tile, we don't need
|
||||||
//to start any other requests for this chain
|
//to start any other requests for this chain
|
||||||
prev.interimTile = tile.interimTile;
|
prev.interimTile = tile.interimTile;
|
||||||
@@ -145,7 +146,7 @@ ol.Tile.prototype.getTileCoord = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {ol.Tile.State} State.
|
* @return {ol.TileState} State.
|
||||||
*/
|
*/
|
||||||
ol.Tile.prototype.getState = function() {
|
ol.Tile.prototype.getState = function() {
|
||||||
return this.state;
|
return this.state;
|
||||||
@@ -160,16 +161,3 @@ ol.Tile.prototype.getState = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Tile.prototype.load = function() {};
|
ol.Tile.prototype.load = function() {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {number}
|
|
||||||
*/
|
|
||||||
ol.Tile.State = {
|
|
||||||
IDLE: 0,
|
|
||||||
LOADING: 1,
|
|
||||||
LOADED: 2,
|
|
||||||
ERROR: 3,
|
|
||||||
EMPTY: 4,
|
|
||||||
ABORT: 5
|
|
||||||
};
|
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.TileQueue');
|
goog.provide('ol.TileQueue');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.structs.PriorityQueue');
|
goog.require('ol.structs.PriorityQueue');
|
||||||
@@ -86,8 +86,8 @@ ol.TileQueue.prototype.getTilesLoading = function() {
|
|||||||
ol.TileQueue.prototype.handleTileChange = function(event) {
|
ol.TileQueue.prototype.handleTileChange = function(event) {
|
||||||
var tile = /** @type {ol.Tile} */ (event.target);
|
var tile = /** @type {ol.Tile} */ (event.target);
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (state === ol.Tile.State.LOADED || state === ol.Tile.State.ERROR ||
|
if (state === ol.TileState.LOADED || state === ol.TileState.ERROR ||
|
||||||
state === ol.Tile.State.EMPTY || state === ol.Tile.State.ABORT) {
|
state === ol.TileState.EMPTY || state === ol.TileState.ABORT) {
|
||||||
ol.events.unlisten(tile, ol.events.EventType.CHANGE,
|
ol.events.unlisten(tile, ol.events.EventType.CHANGE,
|
||||||
this.handleTileChange, this);
|
this.handleTileChange, this);
|
||||||
var tileKey = tile.getKey();
|
var tileKey = tile.getKey();
|
||||||
@@ -112,7 +112,7 @@ ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
|
|||||||
this.getCount() > 0) {
|
this.getCount() > 0) {
|
||||||
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
|
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
|
||||||
tileKey = tile.getKey();
|
tileKey = tile.getKey();
|
||||||
if (tile.getState() === ol.Tile.State.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
|
if (tile.getState() === ol.TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
|
||||||
this.tilesLoadingKeys_[tileKey] = true;
|
this.tilesLoadingKeys_[tileKey] = true;
|
||||||
++this.tilesLoading_;
|
++this.tilesLoading_;
|
||||||
++newLoads;
|
++newLoads;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
goog.provide('ol.TileState');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
ol.TileState = {
|
||||||
|
IDLE: 0,
|
||||||
|
LOADING: 1,
|
||||||
|
LOADED: 2,
|
||||||
|
ERROR: 3,
|
||||||
|
EMPTY: 4,
|
||||||
|
ABORT: 5
|
||||||
|
};
|
||||||
+2
-2
@@ -284,8 +284,8 @@ ol.ImageLoadFunctionType;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{x: number, xunits: (ol.style.Icon.AnchorUnits|undefined),
|
* @typedef {{x: number, xunits: (ol.style.IconAnchorUnits|undefined),
|
||||||
* y: number, yunits: (ol.style.Icon.AnchorUnits|undefined)}}
|
* y: number, yunits: (ol.style.IconAnchorUnits|undefined)}}
|
||||||
*/
|
*/
|
||||||
ol.KMLVec2_;
|
ol.KMLVec2_;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.VectorTile');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.featureloader');
|
goog.require('ol.featureloader');
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ goog.require('ol.featureloader');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Tile}
|
* @extends {ol.Tile}
|
||||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {ol.Tile.State} state State.
|
* @param {ol.TileState} state State.
|
||||||
* @param {string} src Data source url.
|
* @param {string} src Data source url.
|
||||||
* @param {ol.format.Feature} format Feature format.
|
* @param {ol.format.Feature} format Feature format.
|
||||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||||
@@ -141,8 +142,8 @@ ol.VectorTile.prototype.getProjection = function() {
|
|||||||
* Load the tile.
|
* Load the tile.
|
||||||
*/
|
*/
|
||||||
ol.VectorTile.prototype.load = function() {
|
ol.VectorTile.prototype.load = function() {
|
||||||
if (this.state == ol.Tile.State.IDLE) {
|
if (this.state == ol.TileState.IDLE) {
|
||||||
this.setState(ol.Tile.State.LOADING);
|
this.setState(ol.TileState.LOADING);
|
||||||
this.tileLoadFunction_(this, this.url_);
|
this.tileLoadFunction_(this, this.url_);
|
||||||
this.loader_(null, NaN, null);
|
this.loader_(null, NaN, null);
|
||||||
}
|
}
|
||||||
@@ -164,7 +165,7 @@ ol.VectorTile.prototype.onLoad_ = function(features, dataProjection) {
|
|||||||
* Handler for tile load errors.
|
* Handler for tile load errors.
|
||||||
*/
|
*/
|
||||||
ol.VectorTile.prototype.onError_ = function() {
|
ol.VectorTile.prototype.onError_ = function() {
|
||||||
this.setState(ol.Tile.State.ERROR);
|
this.setState(ol.TileState.ERROR);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ ol.VectorTile.prototype.onError_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.VectorTile.prototype.setFeatures = function(features) {
|
ol.VectorTile.prototype.setFeatures = function(features) {
|
||||||
this.features_ = features;
|
this.features_ = features;
|
||||||
this.setState(ol.Tile.State.LOADED);
|
this.setState(ol.TileState.LOADED);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -189,7 +190,7 @@ ol.VectorTile.prototype.setProjection = function(projection) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Tile.State} tileState Tile state.
|
* @param {ol.TileState} tileState Tile state.
|
||||||
*/
|
*/
|
||||||
ol.VectorTile.prototype.setState = function(tileState) {
|
ol.VectorTile.prototype.setState = function(tileState) {
|
||||||
this.state = tileState;
|
this.state = tileState;
|
||||||
|
|||||||
+22
-39
@@ -6,6 +6,8 @@ goog.require('ol.Constraints');
|
|||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.ResolutionConstraint');
|
goog.require('ol.ResolutionConstraint');
|
||||||
goog.require('ol.RotationConstraint');
|
goog.require('ol.RotationConstraint');
|
||||||
|
goog.require('ol.ViewHint');
|
||||||
|
goog.require('ol.ViewProperty');
|
||||||
goog.require('ol.array');
|
goog.require('ol.array');
|
||||||
goog.require('ol.asserts');
|
goog.require('ol.asserts');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
@@ -102,7 +104,7 @@ ol.View = function(opt_options) {
|
|||||||
* @type {Object.<string, *>}
|
* @type {Object.<string, *>}
|
||||||
*/
|
*/
|
||||||
var properties = {};
|
var properties = {};
|
||||||
properties[ol.View.Property.CENTER] = options.center !== undefined ?
|
properties[ol.ViewProperty.CENTER] = options.center !== undefined ?
|
||||||
options.center : null;
|
options.center : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,12 +159,12 @@ ol.View = function(opt_options) {
|
|||||||
centerConstraint, resolutionConstraint, rotationConstraint);
|
centerConstraint, resolutionConstraint, rotationConstraint);
|
||||||
|
|
||||||
if (options.resolution !== undefined) {
|
if (options.resolution !== undefined) {
|
||||||
properties[ol.View.Property.RESOLUTION] = options.resolution;
|
properties[ol.ViewProperty.RESOLUTION] = options.resolution;
|
||||||
} else if (options.zoom !== undefined) {
|
} else if (options.zoom !== undefined) {
|
||||||
properties[ol.View.Property.RESOLUTION] = this.constrainResolution(
|
properties[ol.ViewProperty.RESOLUTION] = this.constrainResolution(
|
||||||
this.maxResolution_, options.zoom - this.minZoom_);
|
this.maxResolution_, options.zoom - this.minZoom_);
|
||||||
}
|
}
|
||||||
properties[ol.View.Property.ROTATION] =
|
properties[ol.ViewProperty.ROTATION] =
|
||||||
options.rotation !== undefined ? options.rotation : 0;
|
options.rotation !== undefined ? options.rotation : 0;
|
||||||
this.setProperties(properties);
|
this.setProperties(properties);
|
||||||
};
|
};
|
||||||
@@ -253,7 +255,7 @@ ol.View.prototype.animate = function(var_args) {
|
|||||||
series.push(animation);
|
series.push(animation);
|
||||||
}
|
}
|
||||||
this.animations_.push(series);
|
this.animations_.push(series);
|
||||||
this.setHint(ol.View.Hint.ANIMATING, 1);
|
this.setHint(ol.ViewHint.ANIMATING, 1);
|
||||||
this.updateAnimations_();
|
this.updateAnimations_();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -263,7 +265,7 @@ ol.View.prototype.animate = function(var_args) {
|
|||||||
* @return {boolean} The view is being animated.
|
* @return {boolean} The view is being animated.
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.getAnimating = function() {
|
ol.View.prototype.getAnimating = function() {
|
||||||
return this.getHints()[ol.View.Hint.ANIMATING] > 0;
|
return this.getHints()[ol.ViewHint.ANIMATING] > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -271,7 +273,7 @@ ol.View.prototype.getAnimating = function() {
|
|||||||
* Cancel any ongoing animations.
|
* Cancel any ongoing animations.
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.cancelAnimations = function() {
|
ol.View.prototype.cancelAnimations = function() {
|
||||||
this.setHint(ol.View.Hint.ANIMATING, -this.getHints()[ol.View.Hint.ANIMATING]);
|
this.setHint(ol.ViewHint.ANIMATING, -this.getHints()[ol.ViewHint.ANIMATING]);
|
||||||
for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
|
for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
|
||||||
var series = this.animations_[i];
|
var series = this.animations_[i];
|
||||||
if (series[0].callback) {
|
if (series[0].callback) {
|
||||||
@@ -318,25 +320,25 @@ ol.View.prototype.updateAnimations_ = function() {
|
|||||||
var y1 = animation.targetCenter[1];
|
var y1 = animation.targetCenter[1];
|
||||||
var x = x0 + progress * (x1 - x0);
|
var x = x0 + progress * (x1 - x0);
|
||||||
var y = y0 + progress * (y1 - y0);
|
var y = y0 + progress * (y1 - y0);
|
||||||
this.set(ol.View.Property.CENTER, [x, y]);
|
this.set(ol.ViewProperty.CENTER, [x, y]);
|
||||||
}
|
}
|
||||||
if (animation.sourceResolution) {
|
if (animation.sourceResolution) {
|
||||||
var resolution = animation.sourceResolution +
|
var resolution = animation.sourceResolution +
|
||||||
progress * (animation.targetResolution - animation.sourceResolution);
|
progress * (animation.targetResolution - animation.sourceResolution);
|
||||||
if (animation.anchor) {
|
if (animation.anchor) {
|
||||||
this.set(ol.View.Property.CENTER,
|
this.set(ol.ViewProperty.CENTER,
|
||||||
this.calculateCenterZoom(resolution, animation.anchor));
|
this.calculateCenterZoom(resolution, animation.anchor));
|
||||||
}
|
}
|
||||||
this.set(ol.View.Property.RESOLUTION, resolution);
|
this.set(ol.ViewProperty.RESOLUTION, resolution);
|
||||||
}
|
}
|
||||||
if (animation.sourceRotation !== undefined) {
|
if (animation.sourceRotation !== undefined) {
|
||||||
var rotation = animation.sourceRotation +
|
var rotation = animation.sourceRotation +
|
||||||
progress * (animation.targetRotation - animation.sourceRotation);
|
progress * (animation.targetRotation - animation.sourceRotation);
|
||||||
if (animation.anchor) {
|
if (animation.anchor) {
|
||||||
this.set(ol.View.Property.CENTER,
|
this.set(ol.ViewProperty.CENTER,
|
||||||
this.calculateCenterRotate(rotation, animation.anchor));
|
this.calculateCenterRotate(rotation, animation.anchor));
|
||||||
}
|
}
|
||||||
this.set(ol.View.Property.ROTATION, rotation);
|
this.set(ol.ViewProperty.ROTATION, rotation);
|
||||||
}
|
}
|
||||||
more = true;
|
more = true;
|
||||||
if (!animation.complete) {
|
if (!animation.complete) {
|
||||||
@@ -345,7 +347,7 @@ ol.View.prototype.updateAnimations_ = function() {
|
|||||||
}
|
}
|
||||||
if (seriesComplete) {
|
if (seriesComplete) {
|
||||||
this.animations_[i] = null;
|
this.animations_[i] = null;
|
||||||
this.setHint(ol.View.Hint.ANIMATING, -1);
|
this.setHint(ol.ViewHint.ANIMATING, -1);
|
||||||
var callback = series[0].callback;
|
var callback = series[0].callback;
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(true);
|
callback(true);
|
||||||
@@ -444,7 +446,7 @@ ol.View.prototype.constrainRotation = function(rotation, opt_delta) {
|
|||||||
*/
|
*/
|
||||||
ol.View.prototype.getCenter = function() {
|
ol.View.prototype.getCenter = function() {
|
||||||
return /** @type {ol.Coordinate|undefined} */ (
|
return /** @type {ol.Coordinate|undefined} */ (
|
||||||
this.get(ol.View.Property.CENTER));
|
this.get(ol.ViewProperty.CENTER));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -522,7 +524,7 @@ ol.View.prototype.getProjection = function() {
|
|||||||
*/
|
*/
|
||||||
ol.View.prototype.getResolution = function() {
|
ol.View.prototype.getResolution = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.View.Property.RESOLUTION));
|
this.get(ol.ViewProperty.RESOLUTION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -585,7 +587,7 @@ ol.View.prototype.getResolutionForValueFunction = function(opt_power) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.getRotation = function() {
|
ol.View.prototype.getRotation = function() {
|
||||||
return /** @type {number} */ (this.get(ol.View.Property.ROTATION));
|
return /** @type {number} */ (this.get(ol.ViewProperty.ROTATION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -830,7 +832,7 @@ ol.View.prototype.rotate = function(rotation, opt_anchor) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.setCenter = function(center) {
|
ol.View.prototype.setCenter = function(center) {
|
||||||
this.set(ol.View.Property.CENTER, center);
|
this.set(ol.ViewProperty.CENTER, center);
|
||||||
if (this.getAnimating()) {
|
if (this.getAnimating()) {
|
||||||
this.cancelAnimations();
|
this.cancelAnimations();
|
||||||
}
|
}
|
||||||
@@ -838,7 +840,7 @@ ol.View.prototype.setCenter = function(center) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.View.Hint} hint Hint.
|
* @param {ol.ViewHint} hint Hint.
|
||||||
* @param {number} delta Delta.
|
* @param {number} delta Delta.
|
||||||
* @return {number} New value.
|
* @return {number} New value.
|
||||||
*/
|
*/
|
||||||
@@ -860,7 +862,7 @@ ol.View.prototype.setHint = function(hint, delta) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.setResolution = function(resolution) {
|
ol.View.prototype.setResolution = function(resolution) {
|
||||||
this.set(ol.View.Property.RESOLUTION, resolution);
|
this.set(ol.ViewProperty.RESOLUTION, resolution);
|
||||||
if (this.getAnimating()) {
|
if (this.getAnimating()) {
|
||||||
this.cancelAnimations();
|
this.cancelAnimations();
|
||||||
}
|
}
|
||||||
@@ -874,7 +876,7 @@ ol.View.prototype.setResolution = function(resolution) {
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.setRotation = function(rotation) {
|
ol.View.prototype.setRotation = function(rotation) {
|
||||||
this.set(ol.View.Property.ROTATION, rotation);
|
this.set(ol.ViewProperty.ROTATION, rotation);
|
||||||
if (this.getAnimating()) {
|
if (this.getAnimating()) {
|
||||||
this.cancelAnimations();
|
this.cancelAnimations();
|
||||||
}
|
}
|
||||||
@@ -1014,22 +1016,3 @@ ol.View.createRotationConstraint_ = function(options) {
|
|||||||
return ol.RotationConstraint.disable;
|
return ol.RotationConstraint.disable;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.View.Property = {
|
|
||||||
CENTER: 'center',
|
|
||||||
RESOLUTION: 'resolution',
|
|
||||||
ROTATION: 'rotation'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {number}
|
|
||||||
*/
|
|
||||||
ol.View.Hint = {
|
|
||||||
ANIMATING: 0,
|
|
||||||
INTERACTING: 1
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
goog.provide('ol.ViewHint');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
ol.ViewHint = {
|
||||||
|
ANIMATING: 0,
|
||||||
|
INTERACTING: 1
|
||||||
|
};
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
goog.provide('ol.ViewProperty');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.ViewProperty = {
|
||||||
|
CENTER: 'center',
|
||||||
|
RESOLUTION: 'resolution',
|
||||||
|
ROTATION: 'rotation'
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.test.ImageTile');
|
goog.provide('ol.test.ImageTile');
|
||||||
|
|
||||||
goog.require('ol.ImageTile');
|
goog.require('ol.ImageTile');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.source.Image');
|
goog.require('ol.source.Image');
|
||||||
@@ -13,7 +13,7 @@ describe('ol.ImageTile', function() {
|
|||||||
|
|
||||||
it('can load idle tile', function(done) {
|
it('can load idle tile', function(done) {
|
||||||
var tileCoord = [0, 0, 0];
|
var tileCoord = [0, 0, 0];
|
||||||
var state = ol.Tile.State.IDLE;
|
var state = ol.TileState.IDLE;
|
||||||
var src = 'spec/ol/data/osm-0-0-0.png';
|
var src = 'spec/ol/data/osm-0-0-0.png';
|
||||||
var tileLoadFunction = ol.source.Image.defaultImageLoadFunction;
|
var tileLoadFunction = ol.source.Image.defaultImageLoadFunction;
|
||||||
var tile = new ol.ImageTile(tileCoord, state, src, null, tileLoadFunction);
|
var tile = new ol.ImageTile(tileCoord, state, src, null, tileLoadFunction);
|
||||||
@@ -22,10 +22,10 @@ describe('ol.ImageTile', function() {
|
|||||||
|
|
||||||
ol.events.listen(tile, ol.events.EventType.CHANGE, function(event) {
|
ol.events.listen(tile, ol.events.EventType.CHANGE, function(event) {
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (previousState == ol.Tile.State.IDLE) {
|
if (previousState == ol.TileState.IDLE) {
|
||||||
expect(state).to.be(ol.Tile.State.LOADING);
|
expect(state).to.be(ol.TileState.LOADING);
|
||||||
} else if (previousState == ol.Tile.State.LOADING) {
|
} else if (previousState == ol.TileState.LOADING) {
|
||||||
expect(state).to.be(ol.Tile.State.LOADED);
|
expect(state).to.be(ol.TileState.LOADED);
|
||||||
done();
|
done();
|
||||||
} else {
|
} else {
|
||||||
expect().fail();
|
expect().fail();
|
||||||
@@ -38,7 +38,7 @@ describe('ol.ImageTile', function() {
|
|||||||
|
|
||||||
it('can load error tile', function(done) {
|
it('can load error tile', function(done) {
|
||||||
var tileCoord = [0, 0, 0];
|
var tileCoord = [0, 0, 0];
|
||||||
var state = ol.Tile.State.ERROR;
|
var state = ol.TileState.ERROR;
|
||||||
var src = 'spec/ol/data/osm-0-0-0.png';
|
var src = 'spec/ol/data/osm-0-0-0.png';
|
||||||
var tileLoadFunction = ol.source.Image.defaultImageLoadFunction;
|
var tileLoadFunction = ol.source.Image.defaultImageLoadFunction;
|
||||||
var tile = new ol.ImageTile(tileCoord, state, src, null, tileLoadFunction);
|
var tile = new ol.ImageTile(tileCoord, state, src, null, tileLoadFunction);
|
||||||
@@ -47,10 +47,10 @@ describe('ol.ImageTile', function() {
|
|||||||
|
|
||||||
ol.events.listen(tile, ol.events.EventType.CHANGE, function(event) {
|
ol.events.listen(tile, ol.events.EventType.CHANGE, function(event) {
|
||||||
var state = tile.getState();
|
var state = tile.getState();
|
||||||
if (previousState == ol.Tile.State.ERROR) {
|
if (previousState == ol.TileState.ERROR) {
|
||||||
expect(state).to.be(ol.Tile.State.LOADING);
|
expect(state).to.be(ol.TileState.LOADING);
|
||||||
} else if (previousState == ol.Tile.State.LOADING) {
|
} else if (previousState == ol.TileState.LOADING) {
|
||||||
expect(state).to.be(ol.Tile.State.LOADED);
|
expect(state).to.be(ol.TileState.LOADED);
|
||||||
done();
|
done();
|
||||||
} else {
|
} else {
|
||||||
expect().fail();
|
expect().fail();
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ describe('ol.source.Tile', function() {
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Tile}
|
* @extends {ol.source.Tile}
|
||||||
* @param {Object.<string, ol.Tile.State>} tileStates Lookup of tile key to
|
* @param {Object.<string, ol.TileState>} tileStates Lookup of tile key to
|
||||||
* tile state.
|
* tile state.
|
||||||
*/
|
*/
|
||||||
ol.test.source.TileMock = function(tileStates) {
|
ol.test.source.TileMock = function(tileStates) {
|
||||||
|
|||||||
+10
-10
@@ -1,13 +1,13 @@
|
|||||||
goog.provide('ol.test.Tile');
|
goog.provide('ol.test.Tile');
|
||||||
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
|
|
||||||
describe('ol.Tile', function() {
|
describe('ol.Tile', function() {
|
||||||
describe('interimChain', function() {
|
describe('interimChain', function() {
|
||||||
var head, renderTile;
|
var head, renderTile;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
var tileCoord = [0, 0, 0];
|
var tileCoord = [0, 0, 0];
|
||||||
head = new ol.ImageTile(tileCoord, ol.Tile.State.IDLE);
|
head = new ol.ImageTile(tileCoord, ol.TileState.IDLE);
|
||||||
ol.getUid(head);
|
ol.getUid(head);
|
||||||
|
|
||||||
var addToChain = function(tile, state) {
|
var addToChain = function(tile, state) {
|
||||||
@@ -16,15 +16,15 @@ describe('ol.Tile', function() {
|
|||||||
tile.interimTile = next;
|
tile.interimTile = next;
|
||||||
return next;
|
return next;
|
||||||
};
|
};
|
||||||
var tail = addToChain(head, ol.Tile.State.IDLE); //discard, deprecated by head
|
var tail = addToChain(head, ol.TileState.IDLE); //discard, deprecated by head
|
||||||
tail = addToChain(tail, ol.Tile.State.LOADING); //keep, request already going
|
tail = addToChain(tail, ol.TileState.LOADING); //keep, request already going
|
||||||
tail = addToChain(tail, ol.Tile.State.IDLE); //discard, deprecated by head
|
tail = addToChain(tail, ol.TileState.IDLE); //discard, deprecated by head
|
||||||
tail = addToChain(tail, ol.Tile.State.LOADED); //keep, use for rendering
|
tail = addToChain(tail, ol.TileState.LOADED); //keep, use for rendering
|
||||||
renderTile = tail; //store this tile for later tests
|
renderTile = tail; //store this tile for later tests
|
||||||
tail = addToChain(tail, ol.Tile.State.IDLE); //rest of list outdated by tile above
|
tail = addToChain(tail, ol.TileState.IDLE); //rest of list outdated by tile above
|
||||||
tail = addToChain(tail, ol.Tile.State.LOADED);
|
tail = addToChain(tail, ol.TileState.LOADED);
|
||||||
tail = addToChain(tail, ol.Tile.State.LOADING);
|
tail = addToChain(tail, ol.TileState.LOADING);
|
||||||
tail = addToChain(tail, ol.Tile.State.LOADED);
|
tail = addToChain(tail, ol.TileState.LOADED);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+11
-10
@@ -2,6 +2,7 @@ goog.provide('ol.test.View');
|
|||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.geom.LineString');
|
goog.require('ol.geom.LineString');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
@@ -311,7 +312,7 @@ describe('ol.View', function() {
|
|||||||
|
|
||||||
expect(view.getHints()).to.eql([0, 0]);
|
expect(view.getHints()).to.eql([0, 0]);
|
||||||
|
|
||||||
view.setHint(ol.View.Hint.INTERACTING, 1);
|
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
expect(view.getHints()).to.eql([0, 1]);
|
expect(view.getHints()).to.eql([0, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -325,7 +326,7 @@ describe('ol.View', function() {
|
|||||||
expect(view.getHints()).to.eql([0, 1]);
|
expect(view.getHints()).to.eql([0, 1]);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
view.setHint(ol.View.Hint.INTERACTING, 1);
|
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -477,7 +478,7 @@ describe('ol.View', function() {
|
|||||||
function decrement() {
|
function decrement() {
|
||||||
--count;
|
--count;
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(0);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(0);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -485,19 +486,19 @@ describe('ol.View', function() {
|
|||||||
center: [1, 2],
|
center: [1, 2],
|
||||||
duration: 25
|
duration: 25
|
||||||
}, decrement);
|
}, decrement);
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(1);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(1);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
duration: 25
|
duration: 25
|
||||||
}, decrement);
|
}, decrement);
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(2);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(2);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
rotate: Math.PI,
|
rotate: Math.PI,
|
||||||
duration: 25
|
duration: 25
|
||||||
}, decrement);
|
}, decrement);
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(3);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(3);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -512,23 +513,23 @@ describe('ol.View', function() {
|
|||||||
center: [1, 2],
|
center: [1, 2],
|
||||||
duration: 25
|
duration: 25
|
||||||
});
|
});
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(1);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(1);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
duration: 25
|
duration: 25
|
||||||
});
|
});
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(2);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(2);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
rotate: Math.PI,
|
rotate: Math.PI,
|
||||||
duration: 25
|
duration: 25
|
||||||
});
|
});
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(3);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(3);
|
||||||
|
|
||||||
// cancel animations
|
// cancel animations
|
||||||
view.setCenter([10, 20]);
|
view.setCenter([10, 20]);
|
||||||
expect(view.getHints()[ol.View.Hint.ANIMATING]).to.be(0);
|
expect(view.getHints()[ol.ViewHint.ANIMATING]).to.be(0);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
goog.provide('ol.test.rendering.reproj.Tile');
|
goog.provide('ol.test.rendering.reproj.Tile');
|
||||||
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.TileState');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.reproj.Tile');
|
goog.require('ol.reproj.Tile');
|
||||||
@@ -24,9 +24,9 @@ describe('ol.rendering.reproj.Tile', function() {
|
|||||||
tilesRequested++;
|
tilesRequested++;
|
||||||
return source.getTile(z, x, y, pixelRatio, sourceProjection);
|
return source.getTile(z, x, y, pixelRatio, sourceProjection);
|
||||||
});
|
});
|
||||||
if (tile.getState() == ol.Tile.State.IDLE) {
|
if (tile.getState() == ol.TileState.IDLE) {
|
||||||
ol.events.listen(tile, 'change', function(e) {
|
ol.events.listen(tile, 'change', function(e) {
|
||||||
if (tile.getState() == ol.Tile.State.LOADED) {
|
if (tile.getState() == ol.TileState.LOADED) {
|
||||||
expect(tilesRequested).to.be(expectedRequests);
|
expect(tilesRequested).to.be(expectedRequests);
|
||||||
resembleCanvas(tile.getImage(), expectedUrl, 7.5, done);
|
resembleCanvas(tile.getImage(), expectedUrl, 7.5, done);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user