Remove unneeded type cast in examples
This commit is contained in:
@@ -141,13 +141,13 @@ const map = new Map({
|
|||||||
features: [pointFeature, lineFeature, polygonFeature]
|
features: [pointFeature, lineFeature, polygonFeature]
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
anchor: [0.5, 46],
|
anchor: [0.5, 46],
|
||||||
anchorXUnits: 'fraction',
|
anchorXUnits: 'fraction',
|
||||||
anchorYUnits: 'pixels',
|
anchorYUnits: 'pixels',
|
||||||
opacity: 0.95,
|
opacity: 0.95,
|
||||||
src: 'data/icon.png'
|
src: 'data/icon.png'
|
||||||
})),
|
}),
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
width: 3,
|
width: 3,
|
||||||
color: [255, 0, 0, 1]
|
color: [255, 0, 0, 1]
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ map.addOverlay(marker);
|
|||||||
// LineString to store the different geolocation positions. This LineString
|
// LineString to store the different geolocation positions. This LineString
|
||||||
// is time aware.
|
// is time aware.
|
||||||
// The Z dimension is actually used to store the rotation (heading).
|
// The Z dimension is actually used to store the rotation (heading).
|
||||||
const positions = new LineString([], /** @type {module:ol/geom/GeometryLayout} */ ('XYZM'));
|
const positions = new LineString([], 'XYZM');
|
||||||
|
|
||||||
// Geolocation Control
|
// Geolocation Control
|
||||||
const geolocation = new Geolocation({
|
const geolocation = new Geolocation({
|
||||||
|
|||||||
@@ -22,27 +22,27 @@ const madrid = new Feature({
|
|||||||
});
|
});
|
||||||
|
|
||||||
rome.setStyle(new Style({
|
rome.setStyle(new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
color: '#8959A8',
|
color: '#8959A8',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
src: 'data/dot.png'
|
src: 'data/dot.png'
|
||||||
}))
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
london.setStyle(new Style({
|
london.setStyle(new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
color: '#4271AE',
|
color: '#4271AE',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
src: 'data/dot.png'
|
src: 'data/dot.png'
|
||||||
}))
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
madrid.setStyle(new Style({
|
madrid.setStyle(new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
color: [113, 140, 0],
|
color: [113, 140, 0],
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
src: 'data/dot.png'
|
src: 'data/dot.png'
|
||||||
}))
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import {Icon, Style} from '../src/ol/style.js';
|
|||||||
|
|
||||||
function createStyle(src, img) {
|
function createStyle(src, img) {
|
||||||
return new Style({
|
return new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
anchor: [0.5, 0.96],
|
anchor: [0.5, 0.96],
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
src: src,
|
src: src,
|
||||||
img: img,
|
img: img,
|
||||||
imgSize: img ? [img.width, img.height] : undefined
|
imgSize: img ? [img.width, img.height] : undefined
|
||||||
}))
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ const iconFeature = new Feature({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const iconStyle = new Style({
|
const iconStyle = new Style({
|
||||||
image: new Icon(/** @type {module:ol/style/Icon~Options} */ ({
|
image: new Icon({
|
||||||
anchor: [0.5, 46],
|
anchor: [0.5, 46],
|
||||||
anchorXUnits: 'fraction',
|
anchorXUnits: 'fraction',
|
||||||
anchorYUnits: 'pixels',
|
anchorYUnits: 'pixels',
|
||||||
src: 'data/icon.png'
|
src: 'data/icon.png'
|
||||||
}))
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
iconFeature.setStyle(iconStyle);
|
iconFeature.setStyle(iconStyle);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ fetch(url).then(function(response) {
|
|||||||
options.projection = 'EPSG:3413';
|
options.projection = 'EPSG:3413';
|
||||||
options.wrapX = false;
|
options.wrapX = false;
|
||||||
layers['wmts3413'] = new TileLayer({
|
layers['wmts3413'] = new TileLayer({
|
||||||
source: new WMTS(/** @type {!module:ol/source/WMTS~Options} */ (options))
|
source: new WMTS(options)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,6 @@ fetch(capabilitiesUrl).then(function(response) {
|
|||||||
});
|
});
|
||||||
options.tilePixelRatio = tilePixelRatio;
|
options.tilePixelRatio = tilePixelRatio;
|
||||||
map.addLayer(new TileLayer({
|
map.addLayer(new TileLayer({
|
||||||
source: new WMTS(/** @type {!module:ol/source/WMTS~Options} */ (options))
|
source: new WMTS(options)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
|
|||||||
}),
|
}),
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
source: new WMTS(/** @type {!module:ol/source/WMTS~Options} */ (options))
|
source: new WMTS(options)
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
|
|||||||
Reference in New Issue
Block a user