Merge branch 'master' of github.com:openlayers/ol3 into animation-frame

This commit is contained in:
Tim Schaub
2012-10-06 00:03:38 -06:00
24 changed files with 688 additions and 292 deletions
+7 -10
View File
@@ -4,7 +4,6 @@
// FIXME check clean-up code
goog.provide('ol.control.Attribution');
goog.provide('ol.control.AttributionOptions');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
@@ -19,13 +18,6 @@ goog.require('ol.control.Control');
goog.require('ol.layer.Layer');
/**
* @typedef {{map: (ol.Map|undefined),
* target: (Element|undefined)}}
*/
ol.control.AttributionOptions;
/**
* @constructor
@@ -143,7 +135,9 @@ ol.control.Attribution.prototype.createAttributionElementsForLayer_ =
!layerVisible ||
goog.isNull(attributionVisibilities) ||
!attributionVisibilities[attributionKey]) {
goog.style.showElement(attributionElement, false);
if (goog.style.isElementShown(attributionElement)) {
goog.style.showElement(attributionElement, false);
}
}
goog.dom.appendChild(this.ulElement_, attributionElement);
@@ -400,7 +394,10 @@ ol.control.Attribution.prototype.updateLayerAttributionsVisibility_ =
attributionVisibilities,
function(attributionVisible, attributionKey) {
var attributionElement = this.attributionElements_[attributionKey];
goog.style.showElement(attributionElement, attributionVisible);
if (goog.style.isElementShown(attributionElement) !=
attributionVisible) {
goog.style.showElement(attributionElement, attributionVisible);
}
},
this);
} else {
-11
View File
@@ -1,7 +1,6 @@
// FIXME should listen on appropriate pane, once it is defined
goog.provide('ol.control.MousePosition');
goog.provide('ol.control.MousePositionOptions');
goog.require('goog.events');
goog.require('goog.events.EventType');
@@ -13,16 +12,6 @@ goog.require('ol.TransformFunction');
goog.require('ol.control.Control');
/**
* @typedef {{coordinateFormat: (ol.CoordinateFormatType|undefined),
* map: (ol.Map|undefined),
* projection: (ol.Projection|undefined),
* target: (Element|undefined),
* undefinedHtml: (string|undefined)}}
*/
ol.control.MousePositionOptions;
/**
* @constructor
-9
View File
@@ -1,5 +1,4 @@
goog.provide('ol.control.Zoom');
goog.provide('ol.control.ZoomOptions');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
@@ -10,14 +9,6 @@ goog.require('ol.Projection');
goog.require('ol.control.Control');
/**
* @typedef {{delta: (number|undefined),
* map: (ol.Map|undefined),
* target: (Element|undefined)}}
*/
ol.control.ZoomOptions;
/**
* @constructor
+84 -3
View File
@@ -1,3 +1,5 @@
@exportProperty ol.MapBrowserEvent.prototype.getCoordinate
@exportSymbol ol.Collection
@exportProperty ol.Collection.prototype.clear
@exportProperty ol.Collection.prototype.forEach
@@ -12,9 +14,40 @@
@exportSymbol ol.Coordinate
@exportSymbol ol.CoordinateFormat
@exportProperty ol.CoordinateFormat.hdms
@exportSymbol ol.Extent
@exportSymbol ol.Map
@exportObjectLiteral ol.MapOptions
@exportObjectLiteralProperty ol.MapOptions.center ol.Coordinate|undefined
@exportObjectLiteralProperty ol.MapOptions.controls ol.Collection|undefined
@exportObjectLiteralProperty ol.MapOptions.doubleClickZoom boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.dragPan boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.interactions ol.Collection|undefined
@exportObjectLiteralProperty ol.MapOptions.keyboard boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.keyboardPanOffset number|undefined
@exportObjectLiteralProperty ol.MapOptions.layers ol.Collection|undefined
@exportObjectLiteralProperty ol.MapOptions.maxResolution number|undefined
@exportObjectLiteralProperty ol.MapOptions.mouseWheelZoom boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.mouseWheelZoomDelta number|undefined
@exportObjectLiteralProperty ol.MapOptions.numZoomLevels number|undefined
@exportObjectLiteralProperty ol.MapOptions.projection ol.Projection|string|undefined
@exportObjectLiteralProperty ol.MapOptions.renderer ol.RendererHint|undefined
@exportObjectLiteralProperty ol.MapOptions.renderers Array.<ol.RendererHint>|undefined
@exportObjectLiteralProperty ol.MapOptions.resolution number|undefined
@exportObjectLiteralProperty ol.MapOptions.resolutions Array.<number>|undefined
@exportObjectLiteralProperty ol.MapOptions.rotate boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.shiftDragZoom boolean|undefined
@exportObjectLiteralProperty ol.MapOptions.target Element|string
@exportObjectLiteralProperty ol.MapOptions.userProjection ol.Projection|string|undefined
@exportObjectLiteralProperty ol.MapOptions.zoom number|undefined
@exportObjectLiteralProperty ol.MapOptions.zoomDelta number|undefined
@exportObjectLiteralProperty ol.MapOptions.zoomFactor number|undefined
@exportClass ol.Map ol.MapOptions
@exportProperty ol.Map.prototype.getControls
@exportProperty ol.Map.prototype.getInteractions
@exportSymbol ol.Object
@exportProperty ol.Object.prototype.bindTo
@@ -32,13 +65,61 @@
@exportProperty ol.Projection.getTransform
@exportProperty ol.Projection.getTransformFromCodes
@exportProperty ol.Projection.transform
@exportProperty ol.Projection.transformWithCodes
@exportProperty ol.Projection.prototype.getCode
@exportProperty ol.Projection.prototype.getExtent
@exportProperty ol.Projection.prototype.getUnits
@exportSymbol ol.layer.TileLayer
@exportSymbol ol.RendererHint
@exportProperty ol.RendererHint.DOM
@exportProperty ol.RendererHint.WEBGL
@exportSymbol ol.overlay.Overlay
@exportObjectLiteral ol.control.AttributionOptions
@exportObjectLiteralProperty ol.control.AttributionOptions.map ol.Map|undefined
@exportObjectLiteralProperty ol.control.AttributionOptions.target Element|undefined
@exportClass ol.control.Attribution ol.control.AttributionOptions
@exportObjectLiteral ol.control.MousePositionOptions
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.Projection|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHtml string|undefined
@exportClass ol.control.MousePosition ol.control.MousePositionOptions
@exportObjectLiteral ol.control.ZoomOptions
@exportObjectLiteralProperty ol.control.ZoomOptions.delta number|undefined
@exportObjectLiteralProperty ol.control.ZoomOptions.map ol.Map|undefined
@exportObjectLiteralProperty ol.control.ZoomOptions.target Element|undefined
@exportClass ol.control.Zoom ol.control.ZoomOptions
@exportObjectLiteral ol.layer.LayerOptions
@exportObjectLiteralProperty ol.layer.LayerOptions.brightness number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.contrast number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.hue number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.opacity number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.saturation number|undefined
@exportObjectLiteralProperty ol.layer.LayerOptions.source ol.source.Source
@exportObjectLiteralProperty ol.layer.LayerOptions.visible boolean|undefined
@exportSymbol ol.interaction.Keyboard
@exportProperty ol.interaction.Keyboard.prototype.addCallback
@exportClass ol.layer.TileLayer ol.layer.LayerOptions
@exportObjectLiteral ol.overlay.OverlayOptions
@exportObjectLiteralProperty ol.overlay.OverlayOptions.coordinate ol.Coordinate|undefined
@exportObjectLiteralProperty ol.overlay.OverlayOptions.element Element|undefined
@exportObjectLiteralProperty ol.overlay.OverlayOptions.map ol.Map|undefined
@exportObjectLiteralProperty ol.overlay.OverlayOptions.positioning Array.<string>|undefined
@exportClass ol.overlay.Overlay ol.overlay.OverlayOptions
@exportProperty ol.overlay.Overlay.prototype.getElement
@exportProperty ol.overlay.Overlay.prototype.setCoordinate
@exportProperty ol.overlay.Overlay.prototype.setMap
@exportSymbol ol.source.BingMaps
+1 -1
View File
@@ -25,7 +25,7 @@ ol.layer.LayerProperty = {
/**
* @constructor
* @extends {ol.Object}
* @param {olx.layer.LayerOptions} layerOptions LayerOptions.
* @param {ol.layer.LayerOptions} layerOptions LayerOptions.
*/
ol.layer.Layer = function(layerOptions) {
+1 -1
View File
@@ -8,7 +8,7 @@ goog.require('ol.source.TileSource');
/**
* @constructor
* @extends {ol.layer.Layer}
* @param {olx.layer.LayerOptions} layerOptions Layer options.
* @param {ol.layer.LayerOptions} layerOptions Layer options.
*/
ol.layer.TileLayer = function(layerOptions) {
goog.base(this, layerOptions);
+30 -31
View File
@@ -100,7 +100,6 @@ ol.MapEventType = {
ol.MapProperty = {
BACKGROUND_COLOR: 'backgroundColor',
CENTER: 'center',
INTERACTIONS: 'interactions',
LAYERS: 'layers',
PROJECTION: 'projection',
RESOLUTION: 'resolution',
@@ -114,7 +113,7 @@ ol.MapProperty = {
/**
* @constructor
* @extends {ol.Object}
* @param {olx.MapOptions} mapOptions Map options.
* @param {ol.MapOptions} mapOptions Map options.
*/
ol.Map = function(mapOptions) {
@@ -211,6 +210,12 @@ ol.Map = function(mapOptions) {
goog.events.listen(this.controls_, ol.CollectionEventType.REMOVE,
this.handleControlsRemove_, false, this);
/**
* @type {ol.Collection}
* @private
*/
this.interactions_ = mapOptionsInternal.interactions;
/**
* @type {ol.renderer.Map}
* @private
@@ -375,12 +380,8 @@ ol.Map.prototype.getExtent = function() {
* @return {ol.Collection} Interactions.
*/
ol.Map.prototype.getInteractions = function() {
return /** @type {ol.Collection} */ this.get(ol.MapProperty.INTERACTIONS);
return this.interactions_;
};
goog.exportProperty(
ol.Map.prototype,
'getInteractions',
ol.Map.prototype.getInteractions);
/**
@@ -589,10 +590,13 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
var interactionsArray = /** @type {Array.<ol.interaction.Interaction>} */
interactions.getArray();
if (this.dispatchEvent(mapBrowserEvent) !== false) {
goog.array.every(interactionsArray, function(interaction) {
for (var i = interactionsArray.length - 1; i >= 0; i--) {
var interaction = interactionsArray[i];
interaction.handleMapBrowserEvent(mapBrowserEvent);
return !mapBrowserEvent.defaultPrevented;
});
if (mapBrowserEvent.defaultPrevented) {
break;
}
}
}
};
@@ -720,18 +724,6 @@ goog.exportProperty(
ol.Map.prototype.setCenter);
/**
* @param {ol.Collection} interactions Interactions.
*/
ol.Map.prototype.setInteractions = function(interactions) {
this.set(ol.MapProperty.INTERACTIONS, interactions);
};
goog.exportProperty(
ol.Map.prototype,
'setInteractions',
ol.Map.prototype.setInteractions);
/**
* @param {ol.Collection} layers Layers.
*/
@@ -859,6 +851,7 @@ ol.Map.prototype.zoomToResolution = function(resolution, opt_anchor) {
/**
* @typedef {{controls: ol.Collection,
* interactions: ol.Collection,
* constraints: ol.Constraints,
* rendererConstructor:
* function(new: ol.renderer.Map, Element, ol.Map),
@@ -869,7 +862,7 @@ ol.MapOptionsInternal;
/**
* @param {olx.MapOptions} mapOptions Map options.
* @param {ol.MapOptions} mapOptions Map options.
* @return {ol.MapOptionsInternal} Map options.
*/
ol.Map.createOptionsInternal = function(mapOptions) {
@@ -883,11 +876,6 @@ ol.Map.createOptionsInternal = function(mapOptions) {
values[ol.MapProperty.CENTER] = mapOptions.center;
}
values[ol.MapProperty.INTERACTIONS] =
goog.isDef(mapOptions.interactions) ?
mapOptions.interactions :
ol.Map.createInteractions_(mapOptions);
values[ol.MapProperty.LAYERS] = goog.isDef(mapOptions.layers) ?
mapOptions.layers : new ol.Collection();
@@ -952,6 +940,16 @@ ol.Map.createOptionsInternal = function(mapOptions) {
controls = ol.Map.createControls_(mapOptions);
}
/**
* @type {ol.Collection}
*/
var interactions;
if (goog.isDef(mapOptions.interactions)) {
interactions = mapOptions.interactions;
} else {
interactions = ol.Map.createInteractions_(mapOptions);
}
/**
* @type {Element}
*/
@@ -960,6 +958,7 @@ ol.Map.createOptionsInternal = function(mapOptions) {
return {
constraints: constraints,
controls: controls,
interactions: interactions,
rendererConstructor: rendererConstructor,
target: target,
values: values
@@ -970,7 +969,7 @@ ol.Map.createOptionsInternal = function(mapOptions) {
/**
* @private
* @param {olx.MapOptions} mapOptions Map options.
* @param {ol.MapOptions} mapOptions Map options.
* @return {ol.Constraints} Map constraints.
*/
ol.Map.createConstraints_ = function(mapOptions) {
@@ -1004,7 +1003,7 @@ ol.Map.createConstraints_ = function(mapOptions) {
/**
* @private
* @param {olx.MapOptions} mapOptions Map options.
* @param {ol.MapOptions} mapOptions Map options.
* @return {ol.Collection} Controls.
*/
ol.Map.createControls_ = function(mapOptions) {
@@ -1026,7 +1025,7 @@ ol.Map.createControls_ = function(mapOptions) {
/**
* @private
* @param {olx.MapOptions} mapOptions Map options.
* @param {ol.MapOptions} mapOptions Map options.
* @return {ol.Collection} Interactions.
*/
ol.Map.createInteractions_ = function(mapOptions) {
-10
View File
@@ -1,20 +1,10 @@
goog.provide('ol.overlay.Overlay');
goog.provide('ol.overlay.OverlayOptions');
goog.provide('ol.overlay.OverlayPositioning');
goog.require('goog.events');
goog.require('goog.style');
/**
* @typedef {{coordinate: (ol.Coordinate|undefined),
* element: (Element|undefined),
* map: (ol.Map|undefined),
* positioning: (Array.<string>|undefined)}}
*/
ol.overlay.OverlayOptions;
/**
* @constructor
+8 -6
View File
@@ -139,12 +139,14 @@ ol.renderer.Map.prototype.disposeInternal = function() {
*/
ol.renderer.Map.prototype.forEachReadyVisibleLayer = function(f, opt_obj) {
var layers = this.map.getLayers();
layers.forEach(function(layer, index) {
if (layer.isReady() && layer.getVisible()) {
var layerRenderer = this.getLayerRenderer(layer);
f.call(opt_obj, layer, layerRenderer, index);
}
}, this);
if (goog.isDef(layers)) {
layers.forEach(function(layer, index) {
if (layer.isReady() && layer.getVisible()) {
var layerRenderer = this.getLayerRenderer(layer);
f.call(opt_obj, layer, layerRenderer, index);
}
}, this);
}
};
+5 -1
View File
@@ -481,12 +481,16 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
ol.MapEventType.POSTRENDER,
goog.partial(function(mapRenderer, imagesToLoad) {
if (goog.DEBUG) {
this.logger.info('uploading textures');
this.logger.info(
'uploading ' + imagesToLoad.length + ' textures');
}
goog.array.forEach(imagesToLoad, function(image) {
mapRenderer.bindImageTexture(
image, goog.webgl.LINEAR, goog.webgl.LINEAR);
});
if (goog.DEBUG) {
this.logger.info('uploaded textures');
}
}, mapRenderer, imagesToLoad));
rerender = true;
}
+1 -1
View File
@@ -55,7 +55,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
this.ready_ = false;
var uri = new goog.Uri(
'http://dev.virtualearth.net/REST/v1/Imagery/Metadata/' +
'//dev.virtualearth.net/REST/v1/Imagery/Metadata/' +
bingMapsOptions.style);
var jsonp = new goog.net.Jsonp(uri, 'jsonp');
jsonp.send({
-34
View File
@@ -1,34 +0,0 @@
@exportType olx.MapOptions
center: ol.Coordinate|undefined
controls: ol.Collection|undefined
doubleClickZoom: boolean|undefined
dragPan: boolean|undefined
interactions: ol.Collection|undefined
keyboard: boolean|undefined
keyboardPanOffset: number|undefined
layers: ol.Collection|undefined
maxResolution: number|undefined
mouseWheelZoom: boolean|undefined
mouseWheelZoomDelta: number|undefined
numZoomLevels: number|undefined
projection: ol.Projection|string|undefined
renderer: ol.RendererHint|undefined
renderers: Array.<ol.RendererHint>|undefined
resolution: number|undefined
resolutions: Array.<number>|undefined
rotate: boolean|undefined
shiftDragZoom: boolean|undefined
target: Element|string
userProjection: ol.Projection|string|undefined
zoom: number|undefined
zoomDelta: number|undefined
zoomFactor: number|undefined
@exportType olx.layer.LayerOptions
brightness: number|undefined
contrast: number|undefined
hue: number|undefined
opacity: number|undefined
saturation: number|undefined
source: ol.source.Source
visible: boolean|undefined