Merge branch 'master' of github.com:openlayers/ol3 into vector

This commit is contained in:
ahocevar
2013-03-11 15:21:01 +01:00
46 changed files with 699 additions and 227 deletions

View File

@@ -74,13 +74,18 @@
@exportObjectLiteralProperty ol.interaction.DefaultOptions.doubleClickZoom boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.dragPan boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.keyboard boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.keyboardPanOffset number|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.mouseWheelZoom boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.shiftDragZoom boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchPan boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchRotate boolean|undefined
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchZoom boolean|undefined
@exportObjectLiteral ol.interaction.KeyboardPanOptions
@exportObjectLiteralProperty ol.interaction.KeyboardPanOptions.pixelDelta number|undefined
@exportObjectLiteral ol.interaction.KeyboardZoomOptions
@exportObjectLiteralProperty ol.interaction.KeyboardZoomOptions.delta number|undefined
@exportObjectLiteral ol.layer.LayerOptions
@exportObjectLiteralProperty ol.layer.LayerOptions.brightness number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.contrast number|undefined
@@ -136,6 +141,9 @@
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
@exportObjectLiteral ol.source.TileJSONOptions
@exportObjectLiteralProperty ol.source.TileJSONOptions.uri string
@exportObjectLiteral ol.source.TiledWMSOptions
@exportObjectLiteralProperty ol.source.TiledWMSOptions.attributions Array.<ol.Attribution>|undefined
@exportObjectLiteralProperty ol.source.TiledWMSOptions.params Object

View File

@@ -2,7 +2,6 @@
goog.provide('ol.animation');
goog.require('goog.fx.easing');
goog.require('ol.PreRenderFunction');
goog.require('ol.ViewHint');
goog.require('ol.easing');
@@ -48,7 +47,7 @@ ol.animation.pan = function(options) {
var sourceY = source.y;
var duration = goog.isDef(options.duration) ? options.duration : 1000;
var easing = goog.isDef(options.easing) ?
options.easing : goog.fx.easing.inAndOut;
options.easing : ol.easing.inAndOut;
return function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
@@ -79,7 +78,7 @@ ol.animation.rotate = function(options) {
var start = goog.isDef(options.start) ? options.start : goog.now();
var duration = goog.isDef(options.duration) ? options.duration : 1000;
var easing = goog.isDef(options.easing) ?
options.easing : goog.fx.easing.inAndOut;
options.easing : ol.easing.inAndOut;
return function(map, frameState) {
if (frameState.time < start) {
@@ -110,7 +109,7 @@ ol.animation.zoom = function(options) {
var start = goog.isDef(options.start) ? options.start : goog.now();
var duration = goog.isDef(options.duration) ? options.duration : 1000;
var easing = goog.isDef(options.easing) ?
options.easing : ol.easing.linear;
options.easing : ol.easing.inAndOut;
return function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;

View File

@@ -1,5 +1,8 @@
@exportSymbol ol.easing
@exportProperty ol.easing.bounce
@exportProperty ol.easing.easeIn
@exportProperty ol.easing.easeOut
@exportProperty ol.easing.elastic
@exportProperty ol.easing.inAndOut
@exportProperty ol.easing.linear
@exportProperty ol.easing.upAndDown
@exportProperty ol.easing.elastic
@exportProperty ol.easing.bounce

View File

@@ -1,36 +1,6 @@
goog.provide('ol.easing');
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.linear = function(t) {
return t;
};
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.upAndDown = function(t) {
if (t < 0.5) {
return goog.fx.easing.inAndOut(2 * t);
} else {
return 1 - goog.fx.easing.inAndOut(2 * (t - 0.5));
}
};
/**
* from https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.elastic = function(t) {
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
};
goog.require('goog.fx.easing');
/**
@@ -58,3 +28,56 @@ ol.easing.bounce = function(t) {
}
return l;
};
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.easeIn = goog.fx.easing.easeIn;
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.easeOut = goog.fx.easing.easeOut;
/**
* from https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.elastic = function(t) {
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
};
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.inAndOut = goog.fx.easing.inAndOut;
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.linear = function(t) {
return t;
};
/**
* @param {number} t Input between 0 and 1.
* @return {number} Output between 0 and 1.
*/
ol.easing.upAndDown = function(t) {
if (t < 0.5) {
return ol.easing.inAndOut(2 * t);
} else {
return 1 - ol.easing.inAndOut(2 * (t - 0.5));
}
};

View File

@@ -22,7 +22,9 @@ ol.GeolocationProperty = {
HEADING: 'heading',
POSITION: 'position',
PROJECTION: 'projection',
SPEED: 'speed'
SPEED: 'speed',
TRACKING: 'tracking',
TRACKING_OPTIONS: 'trackingOptions'
};
@@ -30,9 +32,8 @@ ol.GeolocationProperty = {
/**
* @constructor
* @extends {ol.Object}
* @param {GeolocationPositionOptions=} opt_positionOptions PositionOptions.
*/
ol.Geolocation = function(opt_positionOptions) {
ol.Geolocation = function() {
goog.base(this);
@@ -43,20 +44,20 @@ ol.Geolocation = function(opt_positionOptions) {
*/
this.position_ = null;
if (ol.Geolocation.SUPPORTED) {
goog.events.listen(
this, ol.Object.getChangedEventType(ol.GeolocationProperty.PROJECTION),
this.handleProjectionChanged_, false, this);
/**
* @private
* @type {number|undefined}
*/
this.watchId_;
/**
* @private
* @type {number}
*/
this.watchId_ = navigator.geolocation.watchPosition(
goog.bind(this.positionChange_, this),
goog.bind(this.positionError_, this),
opt_positionOptions);
}
this.setTracking(false);
goog.events.listen(
this, ol.Object.getChangedEventType(ol.GeolocationProperty.PROJECTION),
this.handleProjectionChanged_, false, this);
goog.events.listen(
this, ol.Object.getChangedEventType(ol.GeolocationProperty.TRACKING),
this.handleTrackingChanged_, false, this);
};
goog.inherits(ol.Geolocation, ol.Object);
@@ -65,7 +66,7 @@ goog.inherits(ol.Geolocation, ol.Object);
* @inheritDoc
*/
ol.Geolocation.prototype.disposeInternal = function() {
navigator.geolocation.clearWatch(this.watchId_);
this.setTracking(false);
goog.base(this, 'disposeInternal');
};
@@ -88,6 +89,25 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
};
/**
* @private
*/
ol.Geolocation.prototype.handleTrackingChanged_ = function() {
if (ol.Geolocation.SUPPORTED) {
var tracking = this.getTracking();
if (tracking && !goog.isDef(this.watchId_)) {
this.watchId_ = navigator.geolocation.watchPosition(
goog.bind(this.positionChange_, this),
goog.bind(this.positionError_, this),
this.getTrackingOptions());
} else if (!tracking && goog.isDef(this.watchId_)) {
navigator.geolocation.clearWatch(this.watchId_);
this.watchId_ = undefined;
}
}
};
/**
* @const
* @type {boolean} Is supported.
@@ -220,6 +240,32 @@ goog.exportProperty(
ol.Geolocation.prototype.getSpeed);
/**
* @return {boolean|undefined} tracking.
*/
ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.GeolocationProperty.TRACKING));
};
goog.exportProperty(
ol.Geolocation.prototype,
'getTracking',
ol.Geolocation.prototype.getTracking);
/**
* @return {GeolocationPositionOptions|undefined} tracking options.
*/
ol.Geolocation.prototype.getTrackingOptions = function() {
return /** @type {GeolocationPositionOptions} */ (
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
};
goog.exportProperty(
ol.Geolocation.prototype,
'getTrackingOptions',
ol.Geolocation.prototype.getTrackingOptions);
/**
* @param {ol.Projection} projection Projection.
*/
@@ -232,6 +278,30 @@ goog.exportProperty(
ol.Geolocation.prototype.setProjection);
/**
* @param {boolean} tracking Enable or disable tracking.
*/
ol.Geolocation.prototype.setTracking = function(tracking) {
this.set(ol.GeolocationProperty.TRACKING, tracking);
};
goog.exportProperty(
ol.Geolocation.prototype,
'setTracking',
ol.Geolocation.prototype.setTracking);
/**
* @param {GeolocationPositionOptions} options Tracking options.
*/
ol.Geolocation.prototype.setTrackingOptions = function(options) {
this.set(ol.GeolocationProperty.TRACKING_OPTIONS, options);
};
goog.exportProperty(
ol.Geolocation.prototype,
'setTrackingOptions',
ol.Geolocation.prototype.setTrackingOptions);
/**
* @private
* @param {Array.<number>} input Input coordinate values.

View File

@@ -13,12 +13,13 @@ goog.require('ol.TileState');
* @constructor
* @extends {ol.Tile}
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.TileState} state State.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
*/
ol.ImageTile = function(tileCoord, src, crossOrigin) {
ol.ImageTile = function(tileCoord, state, src, crossOrigin) {
goog.base(this, tileCoord);
goog.base(this, tileCoord, state);
/**
* Image URI

View File

@@ -72,10 +72,8 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
var keyboard = goog.isDef(options.keyboard) ?
options.keyboard : true;
var keyboardPanOffset = goog.isDef(options.keyboardPanOffset) ?
options.keyboardPanOffset : 80;
if (keyboard) {
interactions.push(new ol.interaction.KeyboardPan(keyboardPanOffset));
interactions.push(new ol.interaction.KeyboardPan());
interactions.push(new ol.interaction.KeyboardZoom());
}

View File

@@ -9,21 +9,29 @@ goog.require('ol.View2D');
goog.require('ol.interaction.Interaction');
/**
* @define {number} Pan duration.
*/
ol.interaction.KEYBOARD_PAN_DURATION = 100;
/**
* @constructor
* @extends {ol.interaction.Interaction}
* @param {number} pixelDelta Pixel delta.
* @param {ol.interaction.KeyboardPanOptions=} opt_options Options.
*/
ol.interaction.KeyboardPan = function(pixelDelta) {
ol.interaction.KeyboardPan = function(opt_options) {
goog.base(this);
var options = goog.isDef(opt_options) ? opt_options : {};
/**
* @private
* @type {number}
*/
this.pixelDelta_ = pixelDelta;
this.delta_ = goog.isDef(options.delta) ? options.delta : 128;
};
goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
@@ -47,22 +55,21 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
var view = map.getView();
goog.asserts.assert(view instanceof ol.View2D);
var resolution = view.getResolution();
var delta;
var mapUnitsDelta = resolution * this.pixelDelta_;
var rotation = view.getRotation();
var mapUnitsDelta = resolution * this.delta_;
var deltaX = 0, deltaY = 0;
if (keyCode == goog.events.KeyCodes.DOWN) {
delta = new ol.Coordinate(0, -mapUnitsDelta);
deltaY = -mapUnitsDelta;
} else if (keyCode == goog.events.KeyCodes.LEFT) {
delta = new ol.Coordinate(-mapUnitsDelta, 0);
deltaX = -mapUnitsDelta;
} else if (keyCode == goog.events.KeyCodes.RIGHT) {
delta = new ol.Coordinate(mapUnitsDelta, 0);
deltaX = mapUnitsDelta;
} else {
goog.asserts.assert(keyCode == goog.events.KeyCodes.UP);
delta = new ol.Coordinate(0, mapUnitsDelta);
deltaY = mapUnitsDelta;
}
var oldCenter = view.getCenter();
var newCenter = new ol.Coordinate(
oldCenter.x + delta.x, oldCenter.y + delta.y);
view.setCenter(newCenter);
var delta = new ol.Coordinate(deltaX, deltaY);
delta.rotate(rotation);
view.pan(map, delta, ol.interaction.KEYBOARD_PAN_DURATION);
keyEvent.preventDefault();
mapBrowserEvent.preventDefault();
}

View File

@@ -16,10 +16,21 @@ ol.interaction.KEYBOARD_ZOOM_DURATION = 100;
/**
* @constructor
* @param {ol.interaction.KeyboardZoomOptions=} opt_options Options.
* @extends {ol.interaction.Interaction}
*/
ol.interaction.KeyboardZoom = function() {
ol.interaction.KeyboardZoom = function(opt_options) {
goog.base(this);
var options = goog.isDef(opt_options) ? opt_options : {};
/**
* @private
* @type {number}
*/
this.delta_ = goog.isDef(options.delta) ? options.delta : 1;
};
goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
@@ -35,7 +46,7 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
var charCode = keyEvent.charCode;
if (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0)) {
var map = mapBrowserEvent.map;
var delta = (charCode == '+'.charCodeAt(0)) ? 4 : -4;
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
map.requestRenderFrame();
// FIXME works for View2D only
var view = map.getView();

View File

@@ -242,6 +242,12 @@ ol.Map = function(mapOptions) {
goog.events.listen(this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
this.handleBrowserWindowResize, false, this);
/**
* @private
* @type {ol.Coordinate}
*/
this.focus_ = null;
/**
* @private
* @type {Array.<ol.PreRenderFunction>}
@@ -487,9 +493,10 @@ ol.Map.prototype.getTilePriority = function(tile, tileSourceKey, tileCenter) {
if (!frameState.wantedTiles[tileSourceKey][coordKey]) {
return ol.TileQueue.DROP;
}
var center = frameState.view2DState.center;
var deltaX = tileCenter.x - center.x;
var deltaY = tileCenter.y - center.y;
var focus = goog.isNull(this.focus_) ?
frameState.view2DState.center : this.focus_;
var deltaX = tileCenter.x - focus.x;
var deltaY = tileCenter.y - focus.y;
return deltaX * deltaX + deltaY * deltaY;
};
@@ -502,6 +509,11 @@ ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
var type = opt_type || browserEvent.type;
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
this.handleMapBrowserEvent(mapBrowserEvent);
if (type == goog.events.EventType.MOUSEOUT) {
this.focus_ = null;
} else {
this.focus_ = mapBrowserEvent.getCoordinate();
}
};

View File

@@ -152,10 +152,6 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
tileCoord = new ol.TileCoord(z, x, y);
tile = tileSource.getTile(tileCoord, tileGrid, projection);
if (goog.isNull(tile)) {
continue;
}
tileState = tile.getState();
if (tileState == ol.TileState.IDLE) {
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
@@ -163,7 +159,8 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
frameState.tileQueue.enqueue(tile, tileSourceKey, tileCenter);
} else if (tileState == ol.TileState.LOADING) {
this.listenToTileChange(tile);
} else if (tileState == ol.TileState.LOADED) {
} else if (tileState == ol.TileState.LOADED ||
tileState == ol.TileState.EMPTY) {
tilesToDrawByZ[z][tileCoord.toString()] = tile;
continue;
} else if (tileState == ol.TileState.ERROR) {
@@ -198,10 +195,13 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
if (this.renderedTiles_[index] != tile) {
x = tileSize.width * (tile.tileCoord.x - tileRange.minX);
y = tileSize.height * (tileRange.maxY - tile.tileCoord.y);
if (!opaque) {
tileState = tile.getState();
if (tileState == ol.TileState.EMPTY || !opaque) {
context.clearRect(x, y, tileSize.width, tileSize.height);
}
context.drawImage(tile.getImage(), x, y);
if (tileState == ol.TileState.LOADED) {
context.drawImage(tile.getImage(), x, y);
}
this.renderedTiles_[index] = tile;
}
}
@@ -214,10 +214,13 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
y = (origin.y - tileExtent.maxY) / tileResolution;
width = scale * tileSize.width;
height = scale * tileSize.height;
if (!opaque) {
tileState = tile.getState();
if (tileState == ol.TileState.EMPTY || !opaque) {
context.clearRect(x, y, width, height);
}
context.drawImage(tile.getImage(), x, y, width, height);
if (tileState == ol.TileState.LOADED) {
context.drawImage(tile.getImage(), x, y, width, height);
}
interimTileRange =
tileGrid.getTileRangeForExtentAndZ(tileExtent, z);
minX = Math.max(interimTileRange.minX, tileRange.minX);

View File

@@ -110,10 +110,6 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
tileCoord = new ol.TileCoord(z, x, y);
tile = tileSource.getTile(tileCoord, tileGrid, projection);
if (goog.isNull(tile)) {
continue;
}
tileState = tile.getState();
if (tileState == ol.TileState.IDLE) {
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
@@ -124,7 +120,8 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
} else if (tileState == ol.TileState.LOADED) {
tilesToDrawByZ[z][tileCoord.toString()] = tile;
continue;
} else if (tileState == ol.TileState.ERROR) {
} else if (tileState == ol.TileState.ERROR ||
tileState == ol.TileState.EMPTY) {
continue;
}

View File

@@ -153,7 +153,7 @@ ol.renderer.webgl.Map = function(container, map) {
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST,
this.handleWebGLContextLost, false, this);
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED,
this.handleWebGLContextResourced, false, this);
this.handleWebGLContextRestored, false, this);
/**
* @private
@@ -433,9 +433,9 @@ ol.renderer.webgl.Map.prototype.handleWebGLContextLost = function(event) {
/**
* @protected
*/
ol.renderer.webgl.Map.prototype.handleWebGLContextResourced = function() {
ol.renderer.webgl.Map.prototype.handleWebGLContextRestored = function() {
if (goog.DEBUG) {
this.logger.info('WebGLContextResourced');
this.logger.info('WebGLContextRestored');
}
this.initializeGL_();
this.getMap().render();

View File

@@ -385,10 +385,6 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
tileCoord = new ol.TileCoord(z, x, y);
tile = tileSource.getTile(tileCoord, tileGrid, projection);
if (goog.isNull(tile)) {
continue;
}
tileState = tile.getState();
if (tileState == ol.TileState.IDLE) {
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
@@ -407,7 +403,8 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
priority = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
tilesToLoad.enqueue(priority, tile);
}
} else if (tileState == ol.TileState.ERROR) {
} else if (tileState == ol.TileState.ERROR ||
tileState == ol.TileState.EMPTY) {
continue;
}

View File

@@ -1 +1 @@
@exportSymbol ol.source.BingMaps
@exportClass ol.source.BingMaps ol.source.BingMapsOptions

View File

@@ -19,9 +19,7 @@ goog.require('ol.tilegrid.TileGrid');
*/
ol.DebugTile_ = function(tileCoord, tileGrid) {
goog.base(this, tileCoord);
this.state = ol.TileState.LOADED;
goog.base(this, tileCoord, ol.TileState.LOADED);
/**
* @private
@@ -127,7 +125,7 @@ ol.source.DebugTileSource.prototype.expireCache = function(usedTiles) {
ol.source.DebugTileSource.prototype.getTile = function(tileCoord) {
var key = tileCoord.toString();
if (this.tileCache_.containsKey(key)) {
return /** @type {ol.DebugTile_} */ (this.tileCache_.get(key));
return /** @type {!ol.DebugTile_} */ (this.tileCache_.get(key));
} else {
var tile = new ol.DebugTile_(tileCoord, this.tileGrid);
this.tileCache_.set(key, tile);

View File

@@ -7,6 +7,7 @@ goog.require('ol.ImageTile');
goog.require('ol.Projection');
goog.require('ol.Tile');
goog.require('ol.TileCache');
goog.require('ol.TileState');
goog.require('ol.TileUrlFunction');
goog.require('ol.TileUrlFunctionType');
goog.require('ol.source.TileSource');
@@ -89,18 +90,17 @@ ol.source.ImageTileSource.prototype.getTile =
function(tileCoord, tileGrid, projection) {
var key = tileCoord.toString();
if (this.tileCache_.containsKey(key)) {
return /** @type {ol.Tile} */ (this.tileCache_.get(key));
return /** @type {!ol.Tile} */ (this.tileCache_.get(key));
} else {
goog.asserts.assert(tileGrid);
goog.asserts.assert(projection);
var tileUrl = this.tileUrlFunction(tileCoord, tileGrid, projection);
var tile;
if (goog.isDef(tileUrl)) {
tile = new ol.ImageTile(tileCoord, tileUrl, this.crossOrigin_);
this.tileCache_.set(key, tile);
} else {
tile = null;
}
var tile = new ol.ImageTile(
tileCoord,
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
goog.isDef(tileUrl) ? tileUrl : '',
this.crossOrigin_);
this.tileCache_.set(key, tile);
return tile;
}
};

View File

@@ -1 +1 @@
@exportSymbol ol.source.SingleImageWMS
@exportClass ol.source.SingleImageWMS ol.source.SingleImageWMSOptions

View File

@@ -1 +1 @@
@exportSymbol ol.source.Stamen
@exportClass ol.source.Stamen ol.source.StamenOptions

View File

@@ -1 +1 @@
@exportSymbol ol.source.StaticImage
@exportClass ol.source.StaticImage ol.source.StaticImageOptions

View File

@@ -1 +1 @@
@exportSymbol ol.source.TiledWMS
@exportClass ol.source.TiledWMS ol.source.TiledWMSOptions

View File

@@ -1 +1 @@
@exportSymbol ol.source.TileJSON
@exportClass ol.source.TileJSON ol.source.TileJSONOptions

View File

@@ -21,12 +21,6 @@ goog.require('ol.source.ImageTileSource');
goog.require('ol.tilegrid.XYZ');
/**
* @typedef {{uri: string}}
*/
ol.source.TileJSONOptions;
/**
* @private
* @type {Array.<TileJSON>}

View File

@@ -125,7 +125,7 @@ ol.source.TileSource.prototype.getResolutions = function() {
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.tilegrid.TileGrid=} opt_tileGrid Tile grid.
* @param {ol.Projection=} opt_projection Projection.
* @return {ol.Tile} Tile.
* @return {!ol.Tile} Tile.
*/
ol.source.TileSource.prototype.getTile = goog.abstractMethod;

View File

@@ -16,7 +16,8 @@ ol.TileState = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3
ERROR: 3,
EMPTY: 4
};
@@ -25,8 +26,9 @@ ol.TileState = {
* @constructor
* @extends {goog.events.EventTarget}
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.TileState} state State.
*/
ol.Tile = function(tileCoord) {
ol.Tile = function(tileCoord, state) {
goog.base(this);
@@ -39,7 +41,7 @@ ol.Tile = function(tileCoord) {
* @protected
* @type {ol.TileState}
*/
this.state = ol.TileState.IDLE;
this.state = state;
};
goog.inherits(ol.Tile, goog.events.EventTarget);

View File

@@ -4,7 +4,6 @@
goog.provide('ol.View2D');
goog.provide('ol.View2DProperty');
goog.require('goog.fx.easing');
goog.require('ol.Constraints');
goog.require('ol.Coordinate');
goog.require('ol.Extent');
@@ -16,6 +15,7 @@ goog.require('ol.RotationConstraint');
goog.require('ol.Size');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.easing');
goog.require('ol.projection');
@@ -255,6 +255,28 @@ goog.exportProperty(
ol.View2D.prototype.setRotation);
/**
* @param {ol.Map} map Map.
* @param {ol.Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
ol.View2D.prototype.pan = function(map, delta, opt_duration) {
var currentCenter = this.getCenter();
if (goog.isDef(currentCenter)) {
if (goog.isDef(opt_duration)) {
map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.linear
}));
}
this.setCenter(new ol.Coordinate(
currentCenter.x + delta.x, currentCenter.y + delta.y));
}
};
/**
* @param {ol.Map} map Map.
* @param {number|undefined} rotation Rotation.
@@ -285,13 +307,13 @@ ol.View2D.prototype.rotateWithoutConstraints =
map.addPreRenderFunction(ol.animation.rotate({
rotation: currentRotation,
duration: opt_duration,
easing: goog.fx.easing.easeOut
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: goog.fx.easing.easeOut
easing: ol.easing.easeOut
}));
}
}
@@ -359,13 +381,13 @@ ol.View2D.prototype.zoomWithoutConstraints =
map.addPreRenderFunction(ol.animation.zoom({
resolution: currentResolution,
duration: opt_duration,
easing: goog.fx.easing.easeOut
easing: ol.easing.easeOut
}));
if (goog.isDef(opt_anchor)) {
map.addPreRenderFunction(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: goog.fx.easing.easeOut
easing: ol.easing.easeOut
}));
}
}