Merge pull request #4769 from fredj/osm_opaque

Add opaque option to olx.source.OSMOptions
This commit is contained in:
Frédéric Junod
2016-02-02 17:04:17 +01:00
4 changed files with 13 additions and 5 deletions

View File

@@ -3,8 +3,7 @@ layout: example.html
title: Localized OpenStreetMap
shortdesc: Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.
docs: >
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>. The OpenSeaMap tile server
does not support <a href="http://enable-cors.org/">CORS</a> headers.</p>
tags: "cors, localized-openstreetmap, openseamap, openstreetmap"
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>.
tags: "localized-openstreetmap, openseamap, openstreetmap"
---
<div id="map" class="map"></div>

View File

@@ -28,7 +28,7 @@ var openSeaMapLayer = new ol.layer.Tile({
}),
ol.source.OSM.ATTRIBUTION
],
crossOrigin: null,
opaque: false,
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
})
});

View File

@@ -4573,6 +4573,7 @@ olx.source.TileDebugOptions.prototype.wrapX;
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined),
* maxZoom: (number|undefined),
* opaque: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined),
@@ -4612,6 +4613,14 @@ olx.source.OSMOptions.prototype.crossOrigin;
olx.source.OSMOptions.prototype.maxZoom;
/**
* Whether the layer is opaque. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.source.OSMOptions.prototype.opaque;
/**
* Maximum allowed reprojection error (in pixels). Default is `0.5`.
* Higher values can increase reprojection performance, but decrease precision.

View File

@@ -33,7 +33,7 @@ ol.source.OSM = function(opt_options) {
goog.base(this, {
attributions: attributions,
crossOrigin: crossOrigin,
opaque: true,
opaque: options.opaque !== undefined ? options.opaque : true,
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction,