Remove logos

This commit is contained in:
Tim Schaub
2017-12-16 08:40:02 -07:00
parent 9a3d7eedc4
commit b7e9b8b461
40 changed files with 8 additions and 448 deletions

View File

@@ -31,6 +31,10 @@ and calling it before using projections, and any time the proj4 registry was cha
register(proj4);
```
#### Removal of logos
The map and sources no longer accept a `logo` option. Instead, if you wish to append a logo to your map, add the desired markup directly in your HTML. In addition, you can use the `attributions` property of a source to display arbitrary markup per-source with the attribution control.
### v4.6.0
#### Renamed `exceedLength` option of `ol.style.Text` to `overflow`

View File

@@ -179,9 +179,6 @@
.ol-attribution.ol-collapsed ul {
display: none;
}
.ol-attribution.ol-logo-only ul {
display: block;
}
.ol-attribution:not(.ol-collapsed) {
background: rgba(255,255,255,0.8);
}
@@ -192,17 +189,10 @@
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-logo-only {
background: transparent;
bottom: .4em;
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-uncollapsible img {
margin-top: -.2em;
max-height: 1.6em;
}
.ol-attribution.ol-logo-only button,
.ol-attribution.ol-uncollapsible button {
display: none;
}

View File

@@ -165,14 +165,6 @@ Expected an `ol.style.Style` or an array of `ol.style.Style`.
Expected `layers` to be an array or an `ol.Collection`.
### 44
`logo.href` should be a string.
### 45
`logo.src` should be a string.
### 46
Incorrect format for `renderer` option.

View File

@@ -1,9 +0,0 @@
---
layout: example.html
title: Custom Icon
shortdesc: Example using a custom attribution icon object
docs: >
This example creates a custom element for the attribution icon
tags: "icon, element"
---
<div id="map" class="map"><div id="popup"></div></div>

View File

@@ -1,27 +0,0 @@
import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
var logoElement = document.createElement('a');
logoElement.href = 'https://www.osgeo.org/';
logoElement.target = '_blank';
var logoImage = document.createElement('img');
logoImage.src = 'https://www.osgeo.org/sites/all/themes/osgeo/logo.png';
logoElement.appendChild(logoImage);
var map = new _ol_Map_({
layers: [
new _ol_layer_Tile_({
source: new _ol_source_OSM_()
})
],
target: 'map',
view: new _ol_View_({
center: [0, 0],
zoom: 2
}),
logo: logoElement
});

View File

@@ -95,7 +95,6 @@ source.on('imageloaderror', function() {
});
var map = new _ol_Map_({
logo: false,
layers: [
new _ol_layer_Image_({source: source})
],

View File

@@ -94,7 +94,6 @@ source.on('tileloaderror', function() {
});
var map = new _ol_Map_({
logo: false,
layers: [
new _ol_layer_Tile_({source: source})
],

View File

@@ -3,7 +3,6 @@
*/
/**
* @constructor
*/
@@ -28,7 +27,6 @@ BingMapsCoverageArea.prototype.zoomMax;
BingMapsCoverageArea.prototype.zoomMin;
/**
* @constructor
*/
@@ -47,7 +45,6 @@ BingMapsImageryProvider.prototype.attribution;
BingMapsImageryProvider.prototype.coverageAreas;
/**
* @constructor
*/
@@ -60,12 +57,6 @@ var BingMapsImageryMetadataResponse = function() {};
BingMapsImageryMetadataResponse.prototype.authenticationResultCode;
/**
* @type {string}
*/
BingMapsImageryMetadataResponse.prototype.brandLogoUri;
/**
* @type {string}
*/
@@ -96,7 +87,6 @@ BingMapsImageryMetadataResponse.prototype.statusDescription;
BingMapsImageryMetadataResponse.prototype.traceId;
/**
* @constructor
*/
@@ -157,7 +147,6 @@ BingMapsResource.prototype.zoomMax;
BingMapsResource.prototype.zoomMin;
/**
* @constructor
*/

View File

@@ -5,29 +5,6 @@
var olx;
/**
* Object literal with config options for the map logo.
* @typedef {{href: (string), src: (string)}}
*/
olx.LogoOptions;
/**
* Link url for the logo. Will be followed when the logo is clicked.
* @type {string}
* @api
*/
olx.LogoOptions.prototype.href;
/**
* Image src for the logo.
* @type {string}
* @api
*/
olx.LogoOptions.prototype.src;
/**
* Options for tile constructors.
* @typedef {{transition: (number|undefined)}}
@@ -4177,7 +4154,6 @@ olx.source.BingMapsOptions.prototype.transition;
* extent: (ol.Extent|undefined),
* format: (ol.format.Feature|undefined),
* geometryFunction: (undefined|function(ol.Feature):ol.geom.Point),
* logo: (string|undefined),
* projection: ol.ProjectionLike,
* source: ol.source.Vector,
* wrapX: (boolean|undefined)}}
@@ -4236,14 +4212,6 @@ olx.source.ClusterOptions.prototype.geometryFunction;
olx.source.ClusterOptions.prototype.format;
/**
* Logo.
* @type {string|undefined}
* @api
*/
olx.source.ClusterOptions.prototype.logo;
/**
* Projection.
* @type {ol.ProjectionLike}
@@ -4321,7 +4289,6 @@ olx.source.TileUTFGridOptions.prototype.url;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined),
* projection: ol.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
@@ -4369,14 +4336,6 @@ olx.source.TileImageOptions.prototype.cacheSize;
olx.source.TileImageOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.TileImageOptions.prototype.logo;
/**
* Whether the layer is opaque.
* @type {boolean|undefined}
@@ -4502,7 +4461,6 @@ olx.source.TileImageOptions.prototype.transition;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* format: (ol.format.Feature|undefined),
* logo: (string|olx.LogoOptions|undefined),
* overlaps: (boolean|undefined),
* projection: ol.ProjectionLike,
* state: (ol.source.State|undefined),
@@ -4545,14 +4503,6 @@ olx.source.VectorTileOptions.prototype.cacheSize;
olx.source.VectorTileOptions.prototype.format;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.VectorTileOptions.prototype.logo;
/**
* This source may have overlapping geometries. Default is `true`. Setting this
* to `false` (e.g. for sources with polygons that represent administrative
@@ -4953,7 +4903,6 @@ olx.source.OSMOptions.prototype.wrapX;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined),
* hidpi: (boolean|undefined),
* logo: (string|olx.LogoOptions|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: Object.<string,*>,
* projection: ol.ProjectionLike,
@@ -4993,14 +4942,6 @@ olx.source.ImageArcGISRestOptions.prototype.crossOrigin;
olx.source.ImageArcGISRestOptions.prototype.hidpi;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.logo;
/**
* Optional function to load an image given a URL.
* @type {ol.ImageLoadFunctionType|undefined}
@@ -5060,7 +5001,6 @@ olx.source.ImageArcGISRestOptions.prototype.url;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* canvasFunction: ol.CanvasFunctionType,
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.ProjectionLike,
* ratio: (number|undefined),
* resolutions: (Array.<number>|undefined),
@@ -5092,14 +5032,6 @@ olx.source.ImageCanvasOptions.prototype.attributions;
olx.source.ImageCanvasOptions.prototype.canvasFunction;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ImageCanvasOptions.prototype.logo;
/**
* Projection.
* @type {ol.ProjectionLike}
@@ -5199,7 +5131,6 @@ olx.source.RasterOptions.prototype.operationType;
* crossOrigin: (null|string|undefined),
* hidpi: (boolean|undefined),
* serverType: (ol.source.WMSServerType|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: Object.<string,*>,
* projection: ol.ProjectionLike,
@@ -5256,14 +5187,6 @@ olx.source.ImageWMSOptions.prototype.serverType;
olx.source.ImageWMSOptions.prototype.imageLoadFunction;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ImageWMSOptions.prototype.logo;
/**
* WMS request parameters. At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
@@ -5407,7 +5330,6 @@ olx.source.StamenOptions.prototype.wrapX;
* imageExtent: (ol.Extent),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* imageSize: (ol.Size|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.ProjectionLike,
* url: string}}
*/
@@ -5451,14 +5373,6 @@ olx.source.ImageStaticOptions.prototype.imageExtent;
olx.source.ImageStaticOptions.prototype.imageLoadFunction;
/**
* Optional logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ImageStaticOptions.prototype.logo;
/**
* Projection.
* @type {ol.ProjectionLike}
@@ -5489,7 +5403,6 @@ olx.source.ImageStaticOptions.prototype.url;
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* params: (Object.<string, *>|undefined),
* logo: (string|olx.LogoOptions|undefined),
* tileGrid: (ol.tilegrid.TileGrid|undefined),
* projection: ol.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
@@ -5544,14 +5457,6 @@ olx.source.TileArcGISRestOptions.prototype.crossOrigin;
olx.source.TileArcGISRestOptions.prototype.params;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.TileArcGISRestOptions.prototype.logo;
/**
* Tile grid. Base this on the resolutions, tilesize and extent supported by the
* server.
@@ -5746,7 +5651,6 @@ olx.source.TileJSONOptions.prototype.transition;
* crossOrigin: (null|string|undefined),
* gutter: (number|undefined),
* hidpi: (boolean|undefined),
* logo: (string|olx.LogoOptions|undefined),
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)|undefined),
@@ -5825,14 +5729,6 @@ olx.source.TileWMSOptions.prototype.gutter;
olx.source.TileWMSOptions.prototype.hidpi;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.TileWMSOptions.prototype.logo;
/**
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
* @type {function(new: ol.ImageTile, ol.TileCoord,
@@ -5936,7 +5832,6 @@ olx.source.TileWMSOptions.prototype.transition;
* features: (Array.<ol.Feature>|ol.Collection.<ol.Feature>|undefined),
* format: (ol.format.Feature|undefined),
* loader: (ol.FeatureLoader|undefined),
* logo: (string|olx.LogoOptions|undefined),
* overlaps: (boolean|undefined),
* strategy: (ol.LoadingStrategy|undefined),
* url: (string|ol.FeatureUrlFunction|undefined),
@@ -6013,14 +5908,6 @@ olx.source.VectorOptions.prototype.format;
olx.source.VectorOptions.prototype.loader;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.VectorOptions.prototype.logo;
/**
* This source may have overlapping geometries. Default is `true`. Setting this
* to `false` (e.g. for sources with polygons that represent administrative
@@ -6099,7 +5986,6 @@ olx.source.VectorOptions.prototype.wrapX;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (string|null|undefined),
* logo: (string|olx.LogoOptions|undefined),
* tileGrid: ol.tilegrid.WMTS,
* projection: ol.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
@@ -6151,14 +6037,6 @@ olx.source.WMTSOptions.prototype.cacheSize;
olx.source.WMTSOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.logo;
/**
* Tile grid.
* @type {ol.tilegrid.WMTS}
@@ -6315,7 +6193,6 @@ olx.source.WMTSOptions.prototype.transition;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined),
* projection: ol.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
@@ -6362,14 +6239,6 @@ olx.source.XYZOptions.prototype.cacheSize;
olx.source.XYZOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.XYZOptions.prototype.logo;
/**
* Whether the layer is opaque.
* @type {boolean|undefined}
@@ -6499,7 +6368,6 @@ olx.source.XYZOptions.prototype.transition;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.ProjectionLike,
* maxZoom: (number|undefined),
* minZoom: (number|undefined),
@@ -6539,14 +6407,6 @@ olx.source.CartoDBOptions.prototype.cacheSize;
olx.source.CartoDBOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.CartoDBOptions.prototype.logo;
/**
* Projection. Default is `EPSG:3857`.
* @type {ol.ProjectionLike}
@@ -6614,7 +6474,6 @@ olx.source.CartoDBOptions.prototype.account;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: (ol.ProjectionLike|undefined),
* reprojectionErrorThreshold: (number|undefined),
* url: !string,
@@ -6655,14 +6514,6 @@ olx.source.ZoomifyOptions.prototype.cacheSize;
olx.source.ZoomifyOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ZoomifyOptions.prototype.logo;
/**
* Projection.
* @type {ol.ProjectionLike|undefined}
@@ -7798,7 +7649,6 @@ olx.view.FitOptions.prototype.callback;
* index: number,
* layerStates: Object.<number, ol.LayerState>,
* layerStatesArray: Array.<ol.LayerState>,
* logos: Object.<string, (string|Element)>,
* pixelRatio: number,
* pixelToCoordinateTransform: ol.Transform,
* postRenderFunctions: Array.<ol.PostRenderFunction>,

View File

@@ -24,7 +24,6 @@ import {createEmpty, clone, createOrUpdateEmpty, equals, getForViewAndSize, isEm
import {TRUE} from './functions.js';
import _ol_has_ from './has.js';
import _ol_layer_Group_ from './layer/Group.js';
import _ol_obj_ from './obj.js';
import _ol_plugins_ from './plugins.js';
import _ol_renderer_Type_ from './renderer/Type.js';
import _ol_size_ from './size.js';
@@ -41,7 +40,6 @@ import _ol_transform_ from './transform.js';
* layers: (Array.<ol.layer.Base>|ol.Collection.<ol.layer.Base>|undefined),
* loadTilesWhileAnimating: (boolean|undefined),
* loadTilesWhileInteracting: (boolean|undefined),
* logo: (boolean|string|olx.LogoOptions|Element|undefined),
* moveTolerance: (number|undefined),
* overlays: (ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined),
* renderer: (ol.renderer.Type|Array.<ol.renderer.Type>|undefined),
@@ -86,13 +84,6 @@ export var MapOptions;
* true, tiles will be loaded while interacting with the map. This may
* improve the user experience, but can also make map panning and zooming
* choppy on devices with slow memory. Default is `false`.
* @param {boolean|string|olx.LogoOptions|Element|undefined} options.logo The
* map logo. A logo to be displayed on the map at all times. If a string is
* provided, it will be set as the image source of the logo. If an object is
* provided, the `src` property should be the URL for an image and the
* `href` property should be a URL for creating a link. If an element is
* provided, the element will be used. To disable the map logo, set the
* option to `false`. By default, the OpenLayers logo is shown.
* @param {number|undefined} options.moveTolerance The minimum distance in
* pixels the cursor must move to be detected as a map move event instead
* of a click. Increasing this value can make it easier to click on the map.
@@ -147,12 +138,6 @@ var _ol_PluggableMap_ = function(options) {
this.pixelRatio_ = options.pixelRatio !== undefined ?
options.pixelRatio : _ol_has_.DEVICE_PIXEL_RATIO;
/**
* @private
* @type {Object.<string, string>}
*/
this.logos_ = optionsInternal.logos;
/**
* @private
* @type {number|undefined}
@@ -1234,7 +1219,6 @@ _ol_PluggableMap_.prototype.renderFrame_ = function(time) {
index: this.frameIndex_++,
layerStates: layerStates,
layerStatesArray: layerStatesArray,
logos: _ol_obj_.assign({}, this.logos_),
pixelRatio: this.pixelRatio_,
pixelToCoordinateTransform: this.pixelToCoordinateTransform_,
postRenderFunctions: [],
@@ -1399,34 +1383,6 @@ _ol_PluggableMap_.DEFAULT_RENDERER_TYPES = [
];
/**
* @const
* @type {string}
*/
_ol_PluggableMap_.LOGO_URL = 'data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBI' +
'WXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAA' +
'AhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszW' +
'WMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvY' +
'asvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvX' +
'H1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1Vk' +
'bMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW' +
'2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLP' +
'VcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqT' +
'acrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaar' +
'ldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+Hi' +
'zeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDn' +
'BAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSF' +
'hYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJ' +
'REFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxC' +
'Brb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe' +
'0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8' +
'a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7a' +
'hgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCn' +
'B3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDg' +
'q82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC';
/**
* @param {MapOptions} options Map options.
* @return {ol.MapOptionsInternal} Internal map options.
@@ -1448,23 +1404,6 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
*/
var values = {};
var logos = {};
if (options.logo === undefined ||
(typeof options.logo === 'boolean' && options.logo)) {
logos[_ol_PluggableMap_.LOGO_URL] = 'https://openlayers.org/';
} else {
var logo = options.logo;
if (typeof logo === 'string') {
logos[logo] = '';
} else if (logo instanceof HTMLElement) {
logos[getUid(logo).toString()] = logo;
} else if (logo) {
_ol_asserts_.assert(typeof logo.href == 'string', 44); // `logo.href` should be a string.
_ol_asserts_.assert(typeof logo.src == 'string', 45); // `logo.src` should be a string.
logos[logo.src] = logo.href;
}
}
var layerGroup = (options.layers instanceof _ol_layer_Group_) ?
options.layers : new _ol_layer_Group_({layers: options.layers});
values[_ol_MapProperty_.LAYERGROUP] = layerGroup;
@@ -1554,7 +1493,6 @@ _ol_PluggableMap_.createOptionsInternal = function(options) {
controls: controls,
interactions: interactions,
keyboardEventTarget: keyboardEventTarget,
logos: logos,
overlays: overlays,
mapRendererPlugin: mapRendererPlugin,
values: values

View File

@@ -1,17 +1,14 @@
/**
* @module ol/control/Attribution
*/
// FIXME handle date line wrap
import {inherits} from '../index.js';
import _ol_array_ from '../array.js';
import Control from '../control/Control.js';
import _ol_css_ from '../css.js';
import {removeNode, replaceNode} from '../dom.js';
import {removeChildren, replaceNode} from '../dom.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import _ol_layer_Layer_ from '../layer/Layer.js';
import _ol_obj_ from '../obj.js';
/**
* @classdesc
@@ -35,15 +32,6 @@ var Attribution = function(opt_options) {
*/
this.ulElement_ = document.createElement('UL');
/**
* @private
* @type {Element}
*/
this.logoLi_ = document.createElement('LI');
this.ulElement_.appendChild(this.logoLi_);
this.logoLi_.style.display = 'none';
/**
* @private
* @type {boolean}
@@ -131,12 +119,6 @@ var Attribution = function(opt_options) {
*/
this.renderedVisible_ = true;
/**
* @private
* @type {Object.<string, Element>}
*/
this.logoElements_ = {};
};
inherits(Attribution, Control);
@@ -231,10 +213,7 @@ Attribution.prototype.updateElement_ = function(frameState) {
return;
}
// remove everything but the logo
while (this.ulElement_.lastChild !== this.logoLi_) {
this.ulElement_.removeChild(this.ulElement_.lastChild);
}
removeChildren(this.ulElement_);
// append the attributions
for (var i = 0, ii = attributions.length; i < ii; ++i) {
@@ -244,64 +223,13 @@ Attribution.prototype.updateElement_ = function(frameState) {
}
if (attributions.length === 0 && this.renderedAttributions_.length > 0) {
this.element.classList.add('ol-logo-only');
} else if (this.renderedAttributions_.length === 0 && attributions.length > 0) {
this.element.classList.remove('ol-logo-only');
}
var visible = attributions.length > 0 || !_ol_obj_.isEmpty(frameState.logos);
var visible = attributions.length > 0;
if (this.renderedVisible_ != visible) {
this.element.style.display = visible ? '' : 'none';
this.renderedVisible_ = visible;
}
this.renderedAttributions_ = attributions;
this.insertLogos_(frameState);
};
/**
* @param {?olx.FrameState} frameState Frame state.
* @private
*/
Attribution.prototype.insertLogos_ = function(frameState) {
var logo;
var logos = frameState.logos;
var logoElements = this.logoElements_;
for (logo in logoElements) {
if (!(logo in logos)) {
removeNode(logoElements[logo]);
delete logoElements[logo];
}
}
var image, logoElement, logoKey;
for (logoKey in logos) {
var logoValue = logos[logoKey];
if (logoValue instanceof HTMLElement) {
this.logoLi_.appendChild(logoValue);
logoElements[logoKey] = logoValue;
}
if (!(logoKey in logoElements)) {
image = new Image();
image.src = logoKey;
if (logoValue === '') {
logoElement = image;
} else {
logoElement = document.createElement('a');
logoElement.href = logoValue;
logoElement.appendChild(image);
}
this.logoLi_.appendChild(logoElement);
logoElements[logoKey] = logoElement;
}
}
this.logoLi_.style.display = !_ol_obj_.isEmpty(logos) ? '' : 'none';
};

View File

@@ -5,7 +5,6 @@ import {getUid, inherits, nullFunction} from '../index.js';
import _ol_ImageState_ from '../ImageState.js';
import _ol_Observable_ from '../Observable.js';
import _ol_TileState_ from '../TileState.js';
import _ol_asserts_ from '../asserts.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js';
@@ -166,25 +165,6 @@ _ol_renderer_Layer_.prototype.scheduleExpireCache = function(frameState, tileSou
};
/**
* @param {olx.FrameState} frameState Frame state.
* @param {ol.source.Source} source Source.
* @protected
*/
_ol_renderer_Layer_.prototype.updateLogos = function(frameState, source) {
var logo = source.getLogo();
if (logo !== undefined) {
if (typeof logo === 'string') {
frameState.logos[logo] = '';
} else if (logo) {
_ol_asserts_.assert(typeof logo.href == 'string', 44); // `logo.href` should be a string.
_ol_asserts_.assert(typeof logo.src == 'string', 45); // `logo.src` should be a string.
frameState.logos[logo.src] = logo.href;
}
}
};
/**
* @param {Object.<string, Object.<string, ol.TileRange>>} usedTiles Used tiles.
* @param {ol.source.Tile} tileSource Tile source.

View File

@@ -187,7 +187,6 @@ _ol_renderer_canvas_ImageLayer_.prototype.prepareFrame = function(frameState, la
0,
-viewCenter[0], -viewCenter[1]);
this.updateLogos(frameState, imageSource);
this.renderedResolution = imageResolution * pixelRatio / imagePixelRatio;
}

View File

@@ -292,7 +292,6 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay
this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio,
projection, extent, z, tileLayer.getPreload());
this.scheduleExpireCache(frameState, tileSource);
this.updateLogos(frameState, tileSource);
return this.renderedTiles.length > 0;
};

View File

@@ -299,12 +299,9 @@ _ol_renderer_canvas_VectorLayer_.prototype.handleStyleImageChange_ = function(ev
* @inheritDoc
*/
_ol_renderer_canvas_VectorLayer_.prototype.prepareFrame = function(frameState, layerState) {
var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer());
var vectorSource = vectorLayer.getSource();
this.updateLogos(frameState, vectorSource);
var animating = frameState.viewHints[_ol_ViewHint_.ANIMATING];
var interacting = frameState.viewHints[_ol_ViewHint_.INTERACTING];
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();

View File

@@ -189,8 +189,6 @@ _ol_renderer_webgl_ImageLayer_.prototype.prepareFrame = function(frameState, lay
this.image_ = image;
this.texture = texture;
this.updateLogos(frameState, imageSource);
}
return !!image;

View File

@@ -354,7 +354,6 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye
}
}, this);
this.scheduleExpireCache(frameState, tileSource);
this.updateLogos(frameState, tileSource);
var texCoordMatrix = this.texCoordMatrix;
_ol_transform_.reset(texCoordMatrix);

View File

@@ -212,12 +212,9 @@ _ol_renderer_webgl_VectorLayer_.prototype.handleStyleImageChange_ = function(eve
* @inheritDoc
*/
_ol_renderer_webgl_VectorLayer_.prototype.prepareFrame = function(frameState, layerState, context) {
var vectorLayer = /** @type {ol.layer.Vector} */ (this.getLayer());
var vectorSource = vectorLayer.getSource();
this.updateLogos(frameState, vectorSource);
var animating = frameState.viewHints[_ol_ViewHint_.ANIMATING];
var interacting = frameState.viewHints[_ol_ViewHint_.INTERACTING];
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();

View File

@@ -125,11 +125,6 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
return;
}
var brandLogoUri = response.brandLogoUri;
if (brandLogoUri.indexOf('https') == -1) {
brandLogoUri = brandLogoUri.replace('http', 'https');
}
//var copyright = response.copyright; // FIXME do we need to display this?
var resource = response.resourceSets[0].resources[0];
var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
@@ -209,8 +204,6 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
});
}
this.setLogo(brandLogoUri);
this.setState(_ol_source_State_.READY);
};
export default _ol_source_BingMaps_;

View File

@@ -45,7 +45,6 @@ var _ol_source_CartoDB_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
minZoom: options.minZoom,
projection: options.projection,

View File

@@ -26,7 +26,6 @@ var _ol_source_Cluster_ = function(options) {
_ol_source_Vector_.call(this, {
attributions: options.attributions,
extent: options.extent,
logo: options.logo,
projection: options.projection,
wrapX: options.wrapX
});

View File

@@ -27,7 +27,6 @@ var _ol_source_Image_ = function(options) {
_ol_source_Source_.call(this, {
attributions: options.attributions,
extent: options.extent,
logo: options.logo,
projection: options.projection,
state: options.state
});

View File

@@ -32,7 +32,6 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) {
_ol_source_Image_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: options.projection,
resolutions: options.resolutions
});

View File

@@ -19,7 +19,6 @@ var _ol_source_ImageCanvas_ = function(options) {
_ol_source_Image_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: options.projection,
resolutions: options.resolutions,
state: options.state

View File

@@ -32,7 +32,6 @@ var _ol_source_ImageStatic_ = function(options) {
_ol_source_Image_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: getProjection(options.projection)
});

View File

@@ -33,7 +33,6 @@ var _ol_source_ImageWMS_ = function(opt_options) {
_ol_source_Image_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: options.projection,
resolutions: options.resolutions
});

View File

@@ -113,7 +113,6 @@ var _ol_source_Raster_ = function(options) {
index: 0,
layerStates: layerStates,
layerStatesArray: layerStatesArray,
logos: {},
pixelRatio: 1,
pixelToCoordinateTransform: _ol_transform_.create(),
postRenderFunctions: [],

View File

@@ -7,13 +7,6 @@ import {get as getProjection} from '../proj.js';
import _ol_source_State_ from '../source/State.js';
/**
* Object literal with config options for the map logo.
* @typedef {{href: (string), src: (string)}}
*/
export var LogoOptions;
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
@@ -44,12 +37,6 @@ var _ol_source_Source_ = function(options) {
*/
this.attributions_ = this.adaptAttributions_(options.attributions);
/**
* @private
* @type {string|LogoOptions|undefined}
*/
this.logo_ = options.logo;
/**
* @private
* @type {ol.source.State}
@@ -114,16 +101,6 @@ _ol_source_Source_.prototype.getAttributions = function() {
};
/**
* Get the logo of the source.
* @return {string|LogoOptions|undefined} Logo.
* @api
*/
_ol_source_Source_.prototype.getLogo = function() {
return this.logo_;
};
/**
* Get the projection of the source.
* @return {ol.proj.Projection} Projection.
@@ -181,15 +158,6 @@ _ol_source_Source_.prototype.setAttributions = function(attributions) {
};
/**
* Set the logo of the source.
* @param {string|LogoOptions|undefined} logo Logo.
*/
_ol_source_Source_.prototype.setLogo = function(logo) {
this.logo_ = logo;
};
/**
* Set the state of the source.
* @param {ol.source.State} state State.

View File

@@ -28,7 +28,6 @@ var _ol_source_Tile_ = function(options) {
_ol_source_Source_.call(this, {
attributions: options.attributions,
extent: options.extent,
logo: options.logo,
projection: options.projection,
state: options.state,
wrapX: options.wrapX

View File

@@ -32,7 +32,6 @@ var _ol_source_TileArcGISRest_ = function(opt_options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileGrid: options.tileGrid,

View File

@@ -30,7 +30,6 @@ var _ol_source_TileImage_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
logo: options.logo,
opaque: options.opaque,
projection: options.projection,
state: options.state,

View File

@@ -38,7 +38,6 @@ var _ol_source_TileWMS_ = function(opt_options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
opaque: !transparent,
projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,

View File

@@ -24,7 +24,6 @@ var _ol_source_UrlTile_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
logo: options.logo,
opaque: options.opaque,
projection: options.projection,
state: options.state,

View File

@@ -39,7 +39,6 @@ var _ol_source_Vector_ = function(opt_options) {
_ol_source_Source_.call(this, {
attributions: options.attributions,
logo: options.logo,
projection: undefined,
state: _ol_source_State_.READY,
wrapX: options.wrapX !== undefined ? options.wrapX : true

View File

@@ -42,7 +42,6 @@ var _ol_source_VectorTile_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128,
extent: extent,
logo: options.logo,
opaque: false,
projection: projection,
state: options.state,

View File

@@ -159,7 +159,6 @@ var _ol_source_WMTS_ = function(options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileClass: options.tileClass,

View File

@@ -44,7 +44,6 @@ var _ol_source_XYZ_ = function(opt_options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
opaque: options.opaque,
projection: projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,

View File

@@ -141,7 +141,6 @@ var _ol_source_Zoomify_ = function(opt_options) {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileClass: ZoomifyTileClass,

View File

@@ -440,7 +440,6 @@ ol.LRUCacheEntry;
* @typedef {{controls: (ol.Collection.<ol.control.Control>|undefined),
* interactions: (ol.Collection.<ol.interaction.Interaction>|undefined),
* keyboardEventTarget: (Element|Document),
* logos: (Object.<string, (string|Element)>),
* overlays: ol.Collection.<ol.Overlay>,
* mapRendererPlugin: olx.MapRendererPlugin,
* values: Object.<string, *>}}
@@ -616,7 +615,6 @@ ol.SnapSegmentDataType;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* extent: (null|ol.Extent|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.ProjectionLike,
* resolutions: (Array.<number>|undefined),
* state: (ol.source.State|undefined)}}
@@ -634,7 +632,6 @@ ol.SourceRasterRenderedState;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.ProjectionLike,
* state: (ol.source.State|undefined),
* wrapX: (boolean|undefined)}}
@@ -646,7 +643,6 @@ ol.SourceSourceOptions;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* extent: (ol.Extent|undefined),
* logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined),
* tilePixelRatio: (number|undefined),
* projection: ol.ProjectionLike,
@@ -662,7 +658,6 @@ ol.SourceTileOptions;
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* extent: (ol.Extent|undefined),
* logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined),
* projection: ol.ProjectionLike,
* state: (ol.source.State|undefined),

View File

@@ -70,7 +70,7 @@ describe('ol.control.Attribution', function() {
it('does not add duplicate attributions', function() {
map.renderSync();
var attribution = map.getTarget().querySelectorAll('.ol-attribution li');
expect(attribution.length).to.be(3); // first <li> is the logo
expect(attribution.length).to.be(2);
});
});