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