Module types for ol/geom

This commit is contained in:
Tim Schaub
2018-03-11 23:08:50 -06:00
parent 41d9a84a8f
commit ef70d71636
60 changed files with 482 additions and 482 deletions

View File

@@ -61,7 +61,7 @@ const map = new Map({
const zoomtoswitzerlandbest = document.getElementById('zoomtoswitzerlandbest');
zoomtoswitzerlandbest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], constrainResolution: false});
}, false);
@@ -69,7 +69,7 @@ const zoomtoswitzerlandconstrained =
document.getElementById('zoomtoswitzerlandconstrained');
zoomtoswitzerlandconstrained.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150]});
}, false);
@@ -77,21 +77,21 @@ const zoomtoswitzerlandnearest =
document.getElementById('zoomtoswitzerlandnearest');
zoomtoswitzerlandnearest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
const polygon = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], nearest: true});
}, false);
const zoomtolausanne = document.getElementById('zoomtolausanne');
zoomtolausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];
const point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
const point = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (feature.getGeometry());
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
}, false);
const centerlausanne = document.getElementById('centerlausanne');
centerlausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];
const point = /** @type {ol.geom.Point} */ (feature.getGeometry());
const point = /** @type {module:ol/geom/Point~Point} */ (feature.getGeometry());
const size = /** @type {ol.Size} */ (map.getSize());
view.centerOn(point.getCoordinates(), size, [570, 500]);
}, false);

View File

@@ -57,7 +57,7 @@ const polyline = [
'~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
].join('');
const route = /** @type {ol.geom.LineString} */ (new Polyline({
const route = /** @type {module:ol/geom/LineString~LineString} */ (new Polyline({
factor: 1e6
}).readGeometry(polyline, {
dataProjection: 'EPSG:4326',
@@ -197,7 +197,7 @@ function stopAnimation(ended) {
// if animation cancelled set the marker at the beginning
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
/** @type {ol.geom.Point} */ (geoMarker.getGeometry())
/** @type {module:ol/geom/Point~Point} */ (geoMarker.getGeometry())
.setCoordinates(coord);
//remove listener
map.un('postcompose', moveFeature);

View File

@@ -43,7 +43,7 @@ map.addOverlay(marker);
// is time aware.
// The Z dimension is actually used to store the rotation (heading).
const positions = new LineString([],
/** @type {ol.geom.GeometryLayout} */ ('XYZM'));
/** @type {module:ol/geom/GeometryLayout~GeometryLayout} */ ('XYZM'));
// Geolocation Control
const geolocation = new Geolocation({

View File

@@ -192,7 +192,7 @@ document.getElementById('time').addEventListener('input', function() {
const value = parseInt(this.value, 10) / 100;
const m = time.start + (time.duration * value);
vectorSource.forEachFeature(function(feature) {
const geometry = /** @type {ol.geom.LineString} */ (feature.getGeometry());
const geometry = /** @type {module:ol/geom/LineString~LineString} */ (feature.getGeometry());
const coordinate = geometry.getCoordinateAtM(m, true);
let highlight = feature.get('highlight');
if (highlight === undefined) {

View File

@@ -140,7 +140,7 @@ let draw; // global so we can remove it later
/**
* Format length output.
* @param {ol.geom.LineString} line The line.
* @param {module:ol/geom/LineString~LineString} line The line.
* @return {string} The formatted length.
*/
const formatLength = function(line) {
@@ -159,7 +159,7 @@ const formatLength = function(line) {
/**
* Format area output.
* @param {ol.geom.Polygon} polygon The polygon.
* @param {module:ol/geom/Polygon~Polygon} polygon The polygon.
* @return {string} Formatted area.
*/
const formatArea = function(polygon) {