Fix type notation in examples
This commit is contained in:
@@ -61,8 +61,8 @@ const style = new Style({
|
|||||||
* The styling function for the vector layer, will return an array of styles
|
* The styling function for the vector layer, will return an array of styles
|
||||||
* which either contains the aboove gradient or pattern.
|
* which either contains the aboove gradient or pattern.
|
||||||
*
|
*
|
||||||
* @param {module:ol/Feature~Feature} feature The feature to style.
|
* @param {import("../src/ol/Feature.js").default} feature The feature to style.
|
||||||
* @return {module:ol/style/Style} The style to use for the feature.
|
* @return {Style} The style to use for the feature.
|
||||||
*/
|
*/
|
||||||
const getStackedStyle = function(feature) {
|
const getStackedStyle = function(feature) {
|
||||||
const id = feature.getId();
|
const id = feature.getId();
|
||||||
|
|||||||
+6
-6
@@ -50,7 +50,7 @@ const map = new Map({
|
|||||||
const zoomtoswitzerlandbest = document.getElementById('zoomtoswitzerlandbest');
|
const zoomtoswitzerlandbest = document.getElementById('zoomtoswitzerlandbest');
|
||||||
zoomtoswitzerlandbest.addEventListener('click', function() {
|
zoomtoswitzerlandbest.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[0];
|
const feature = source.getFeatures()[0];
|
||||||
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
|
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(polygon, {padding: [170, 50, 30, 150], constrainResolution: false});
|
view.fit(polygon, {padding: [170, 50, 30, 150], constrainResolution: false});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ const zoomtoswitzerlandconstrained =
|
|||||||
document.getElementById('zoomtoswitzerlandconstrained');
|
document.getElementById('zoomtoswitzerlandconstrained');
|
||||||
zoomtoswitzerlandconstrained.addEventListener('click', function() {
|
zoomtoswitzerlandconstrained.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[0];
|
const feature = source.getFeatures()[0];
|
||||||
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
|
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(polygon, {padding: [170, 50, 30, 150]});
|
view.fit(polygon, {padding: [170, 50, 30, 150]});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
@@ -66,21 +66,21 @@ const zoomtoswitzerlandnearest =
|
|||||||
document.getElementById('zoomtoswitzerlandnearest');
|
document.getElementById('zoomtoswitzerlandnearest');
|
||||||
zoomtoswitzerlandnearest.addEventListener('click', function() {
|
zoomtoswitzerlandnearest.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[0];
|
const feature = source.getFeatures()[0];
|
||||||
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
|
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(polygon, {padding: [170, 50, 30, 150], nearest: true});
|
view.fit(polygon, {padding: [170, 50, 30, 150], nearest: true});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
const zoomtolausanne = document.getElementById('zoomtolausanne');
|
const zoomtolausanne = document.getElementById('zoomtolausanne');
|
||||||
zoomtolausanne.addEventListener('click', function() {
|
zoomtolausanne.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[1];
|
const feature = source.getFeatures()[1];
|
||||||
const point = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
|
const point = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
|
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
const centerlausanne = document.getElementById('centerlausanne');
|
const centerlausanne = document.getElementById('centerlausanne');
|
||||||
centerlausanne.addEventListener('click', function() {
|
centerlausanne.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[1];
|
const feature = source.getFeatures()[1];
|
||||||
const point = /** @type {module:ol/geom/Point~Point} */ (feature.getGeometry());
|
const point = /** @type {import("../src/ol/geom/Point.js").default} */ (feature.getGeometry());
|
||||||
const size = /** @type {module:ol/size~Size} */ (map.getSize());
|
const size = map.getSize();
|
||||||
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -9,14 +9,11 @@ import OSM from '../src/ol/source/OSM.js';
|
|||||||
// Define rotate to north control.
|
// Define rotate to north control.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @extends {module:ol/control/Control~Control}
|
|
||||||
* @param {Object=} opt_options Control options.
|
|
||||||
*/
|
|
||||||
class RotateNorthControl extends Control {
|
class RotateNorthControl extends Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object=} opt_options Control options.
|
||||||
|
*/
|
||||||
constructor(opt_options) {
|
constructor(opt_options) {
|
||||||
const options = opt_options || {};
|
const options = opt_options || {};
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ import {TileJSON, Vector as VectorSource} from '../src/ol/source.js';
|
|||||||
import {Fill, Icon, Stroke, Style} from '../src/ol/style.js';
|
import {Fill, Icon, Stroke, Style} from '../src/ol/style.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @extends {module:ol/interaction/Pointer}
|
|
||||||
*/
|
|
||||||
class Drag extends PointerInteraction {
|
class Drag extends PointerInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
@@ -22,7 +18,7 @@ class Drag extends PointerInteraction {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {module:ol/pixel~Pixel}
|
* @type {import("../src/ol/coordinate.js").Coordinate}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.coordinate_ = null;
|
this.coordinate_ = null;
|
||||||
@@ -34,7 +30,7 @@ class Drag extends PointerInteraction {
|
|||||||
this.cursor_ = 'pointer';
|
this.cursor_ = 'pointer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {module:ol/Feature~Feature}
|
* @type {Feature}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.feature_ = null;
|
this.feature_ = null;
|
||||||
@@ -49,7 +45,7 @@ class Drag extends PointerInteraction {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Map browser event.
|
* @param {import("../src/ol/MapBrowserEvent.js").default} evt Map browser event.
|
||||||
* @return {boolean} `true` to start the drag sequence.
|
* @return {boolean} `true` to start the drag sequence.
|
||||||
*/
|
*/
|
||||||
function handleDownEvent(evt) {
|
function handleDownEvent(evt) {
|
||||||
@@ -70,7 +66,7 @@ function handleDownEvent(evt) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Map browser event.
|
* @param {import("../src/ol/MapBrowserEvent.js").default} evt Map browser event.
|
||||||
*/
|
*/
|
||||||
function handleDragEvent(evt) {
|
function handleDragEvent(evt) {
|
||||||
const deltaX = evt.coordinate[0] - this.coordinate_[0];
|
const deltaX = evt.coordinate[0] - this.coordinate_[0];
|
||||||
@@ -85,7 +81,7 @@ function handleDragEvent(evt) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Event.
|
* @param {import("../src/ol/MapBrowserEvent.js").default} evt Event.
|
||||||
*/
|
*/
|
||||||
function handleMoveEvent(evt) {
|
function handleMoveEvent(evt) {
|
||||||
if (this.cursor_) {
|
if (this.cursor_) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ exportButton.addEventListener('click', function() {
|
|||||||
const dim = dims[format];
|
const dim = dims[format];
|
||||||
const width = Math.round(dim[0] * resolution / 25.4);
|
const width = Math.round(dim[0] * resolution / 25.4);
|
||||||
const height = Math.round(dim[1] * resolution / 25.4);
|
const height = Math.round(dim[1] * resolution / 25.4);
|
||||||
const size = /** @type {module:ol/size~Size} */ (map.getSize());
|
const size = map.getSize();
|
||||||
const extent = map.getView().calculateExtent(size);
|
const extent = map.getView().calculateExtent(size);
|
||||||
|
|
||||||
map.once('rendercomplete', function(event) {
|
map.once('rendercomplete', function(event) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ const polyline = [
|
|||||||
'~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
|
'~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
const route = /** @type {module:ol/geom/LineString~LineString} */ (new Polyline({
|
const route = /** @type {import("../src/ol/geom/LineString.js").default} */ (new Polyline({
|
||||||
factor: 1e6
|
factor: 1e6
|
||||||
}).readGeometry(polyline, {
|
}).readGeometry(polyline, {
|
||||||
dataProjection: 'EPSG:4326',
|
dataProjection: 'EPSG:4326',
|
||||||
@@ -192,8 +192,8 @@ function stopAnimation(ended) {
|
|||||||
|
|
||||||
// if animation cancelled set the marker at the beginning
|
// if animation cancelled set the marker at the beginning
|
||||||
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
||||||
/** @type {module:ol/geom/Point~Point} */ (geoMarker.getGeometry())
|
const geometry = /** @type {import("../src/ol/geom/Point").default} */ (geoMarker.getGeometry());
|
||||||
.setCoordinates(coord);
|
geometry.setCoordinates(coord);
|
||||||
//remove listener
|
//remove listener
|
||||||
vectorLayer.un('postrender', moveFeature);
|
vectorLayer.un('postrender', moveFeature);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -183,7 +183,7 @@ document.getElementById('time').addEventListener('input', function() {
|
|||||||
const value = parseInt(this.value, 10) / 100;
|
const value = parseInt(this.value, 10) / 100;
|
||||||
const m = time.start + (time.duration * value);
|
const m = time.start + (time.duration * value);
|
||||||
vectorSource.forEachFeature(function(feature) {
|
vectorSource.forEachFeature(function(feature) {
|
||||||
const geometry = /** @type {module:ol/geom/LineString~LineString} */ (feature.getGeometry());
|
const geometry = /** @type {import("../src/ol/geom/LineString.js").default} */ (feature.getGeometry());
|
||||||
const coordinate = geometry.getCoordinateAtM(m, true);
|
const coordinate = geometry.getCoordinateAtM(m, true);
|
||||||
let highlight = feature.get('highlight');
|
let highlight = feature.get('highlight');
|
||||||
if (highlight === undefined) {
|
if (highlight === undefined) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import ImageWMS from '../src/ol/source/ImageWMS.js';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a progress bar.
|
* Renders a progress bar.
|
||||||
* @param {Element} el The target element.
|
* @param {HTMLElement} el The target element.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Progress(el) {
|
function Progress(el) {
|
||||||
|
|||||||
+10
-10
@@ -38,35 +38,35 @@ const vector = new VectorLayer({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Currently drawn feature.
|
* Currently drawn feature.
|
||||||
* @type {module:ol/Feature~Feature}
|
* @type {import("../src/ol/Feature.js").default}
|
||||||
*/
|
*/
|
||||||
let sketch;
|
let sketch;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The help tooltip element.
|
* The help tooltip element.
|
||||||
* @type {Element}
|
* @type {HTMLElement}
|
||||||
*/
|
*/
|
||||||
let helpTooltipElement;
|
let helpTooltipElement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlay to show the help messages.
|
* Overlay to show the help messages.
|
||||||
* @type {module:ol/Overlay}
|
* @type {Overlay}
|
||||||
*/
|
*/
|
||||||
let helpTooltip;
|
let helpTooltip;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The measure tooltip element.
|
* The measure tooltip element.
|
||||||
* @type {Element}
|
* @type {HTMLElement}
|
||||||
*/
|
*/
|
||||||
let measureTooltipElement;
|
let measureTooltipElement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlay to show the measurement.
|
* Overlay to show the measurement.
|
||||||
* @type {module:ol/Overlay}
|
* @type {Overlay}
|
||||||
*/
|
*/
|
||||||
let measureTooltip;
|
let measureTooltip;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ const continueLineMsg = 'Click to continue drawing the line';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer move.
|
* Handle pointer move.
|
||||||
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt The event.
|
* @param {import("../src/ol/MapBrowserEvent").default} evt The event.
|
||||||
*/
|
*/
|
||||||
const pointerMoveHandler = function(evt) {
|
const pointerMoveHandler = function(evt) {
|
||||||
if (evt.dragging) {
|
if (evt.dragging) {
|
||||||
@@ -97,7 +97,7 @@ const pointerMoveHandler = function(evt) {
|
|||||||
let helpMsg = 'Click to start drawing';
|
let helpMsg = 'Click to start drawing';
|
||||||
|
|
||||||
if (sketch) {
|
if (sketch) {
|
||||||
const geom = (sketch.getGeometry());
|
const geom = sketch.getGeometry();
|
||||||
if (geom instanceof Polygon) {
|
if (geom instanceof Polygon) {
|
||||||
helpMsg = continuePolygonMsg;
|
helpMsg = continuePolygonMsg;
|
||||||
} else if (geom instanceof LineString) {
|
} else if (geom instanceof LineString) {
|
||||||
@@ -134,7 +134,7 @@ let draw; // global so we can remove it later
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format length output.
|
* Format length output.
|
||||||
* @param {module:ol/geom/LineString~LineString} line The line.
|
* @param {LineString} line The line.
|
||||||
* @return {string} The formatted length.
|
* @return {string} The formatted length.
|
||||||
*/
|
*/
|
||||||
const formatLength = function(line) {
|
const formatLength = function(line) {
|
||||||
@@ -153,7 +153,7 @@ const formatLength = function(line) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format area output.
|
* Format area output.
|
||||||
* @param {module:ol/geom/Polygon~Polygon} polygon The polygon.
|
* @param {Polygon} polygon The polygon.
|
||||||
* @return {string} Formatted area.
|
* @return {string} Formatted area.
|
||||||
*/
|
*/
|
||||||
const formatArea = function(polygon) {
|
const formatArea = function(polygon) {
|
||||||
@@ -205,7 +205,7 @@ function addInteraction() {
|
|||||||
// set sketch
|
// set sketch
|
||||||
sketch = evt.feature;
|
sketch = evt.feature;
|
||||||
|
|
||||||
/** @type {module:ol/coordinate~Coordinate|undefined} */
|
/** @type {import("../src/ol/coordinate.js").Coordinate|undefined} */
|
||||||
let tooltipCoord = evt.coordinate;
|
let tooltipCoord = evt.coordinate;
|
||||||
|
|
||||||
listener = sketch.getGeometry().on('change', function(evt) {
|
listener = sketch.getGeometry().on('change', function(evt) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import TileJSON from '../src/ol/source/TileJSON.js';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a progress bar.
|
* Renders a progress bar.
|
||||||
* @param {Element} el The target element.
|
* @param {HTMLElement} el The target element.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Progress(el) {
|
function Progress(el) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import OSM from '../src/ol/source/OSM.js';
|
|||||||
* Helper method for map-creation.
|
* Helper method for map-creation.
|
||||||
*
|
*
|
||||||
* @param {string} divId The id of the div for the map.
|
* @param {string} divId The id of the div for the map.
|
||||||
* @return {module:ol/PluggableMap} The map instance.
|
* @return {Map} The map instance.
|
||||||
*/
|
*/
|
||||||
function createMap(divId) {
|
function createMap(divId) {
|
||||||
const source = new OSM();
|
const source = new OSM();
|
||||||
|
|||||||
Reference in New Issue
Block a user