Merge pull request #8741 from schmidtk/ts-geom
Fix TypeScript errors in ol/geom/*
This commit is contained in:
@@ -194,7 +194,9 @@ class Circle extends SimpleGeometry {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
getCoordinates() {}
|
getCoordinates() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ class LineString extends SimpleGeometry {
|
|||||||
this.maxDeltaRevision_ = -1;
|
this.maxDeltaRevision_ = -1;
|
||||||
|
|
||||||
if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
|
if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
|
||||||
this.setFlatCoordinates(opt_layout, coordinates);
|
this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
|
||||||
} else {
|
} else {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(/** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ class LinearRing extends SimpleGeometry {
|
|||||||
this.maxDeltaRevision_ = -1;
|
this.maxDeltaRevision_ = -1;
|
||||||
|
|
||||||
if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
|
if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
|
||||||
this.setFlatCoordinates(opt_layout, coordinates);
|
this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
|
||||||
} else {
|
} else {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(/** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,9 @@ class LinearRing extends SimpleGeometry {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
intersectsExtent(extent) {}
|
intersectsExtent(extent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the coordinates of the linear ring.
|
* Set the coordinates of the linear ring.
|
||||||
|
|||||||
@@ -52,16 +52,17 @@ class MultiLineString extends SimpleGeometry {
|
|||||||
this.maxDeltaRevision_ = -1;
|
this.maxDeltaRevision_ = -1;
|
||||||
|
|
||||||
if (Array.isArray(coordinates[0])) {
|
if (Array.isArray(coordinates[0])) {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(/** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
|
||||||
} else if (opt_layout !== undefined && opt_ends) {
|
} else if (opt_layout !== undefined && opt_ends) {
|
||||||
this.setFlatCoordinates(opt_layout, coordinates);
|
this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
|
||||||
this.ends_ = opt_ends;
|
this.ends_ = opt_ends;
|
||||||
} else {
|
} else {
|
||||||
let layout = this.getLayout();
|
let layout = this.getLayout();
|
||||||
|
const lineStrings = /** @type {Array<import("../geom.js").MultiLineString>} */ (coordinates);
|
||||||
const flatCoordinates = [];
|
const flatCoordinates = [];
|
||||||
const ends = [];
|
const ends = [];
|
||||||
for (let i = 0, ii = coordinates.length; i < ii; ++i) {
|
for (let i = 0, ii = lineStrings.length; i < ii; ++i) {
|
||||||
const lineString = coordinates[i];
|
const lineString = lineStrings[i];
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
layout = lineString.getLayout();
|
layout = lineString.getLayout();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import {quantizeMultiArray} from '../geom/flat/simplify.js';
|
|||||||
class MultiPolygon extends SimpleGeometry {
|
class MultiPolygon extends SimpleGeometry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<Array<Array<import("../coordinate.js").Coordinate>>>|Array<number>} coordinates Coordinates.
|
* @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
|
||||||
* For internal use, flat coordinats in combination with `opt_layout` and `opt_endss` are also accepted.
|
* For internal use, flat coordinats in combination with `opt_layout` and `opt_endss` are also accepted.
|
||||||
* @param {GeometryLayout=} opt_layout Layout.
|
* @param {GeometryLayout=} opt_layout Layout.
|
||||||
* @param {Array<number>=} opt_endss Array of ends for internal use with flat coordinates.
|
* @param {Array<Array<number>>=} opt_endss Array of ends for internal use with flat coordinates.
|
||||||
*/
|
*/
|
||||||
constructor(coordinates, opt_layout, opt_endss) {
|
constructor(coordinates, opt_layout, opt_endss) {
|
||||||
|
|
||||||
@@ -81,10 +81,11 @@ class MultiPolygon extends SimpleGeometry {
|
|||||||
|
|
||||||
if (!opt_endss && !Array.isArray(coordinates[0])) {
|
if (!opt_endss && !Array.isArray(coordinates[0])) {
|
||||||
let layout = this.getLayout();
|
let layout = this.getLayout();
|
||||||
|
const polygons = /** @type {Array<Polygon>} */ (coordinates);
|
||||||
const flatCoordinates = [];
|
const flatCoordinates = [];
|
||||||
const endss = [];
|
const endss = [];
|
||||||
for (let i = 0, ii = coordinates.length; i < ii; ++i) {
|
for (let i = 0, ii = polygons.length; i < ii; ++i) {
|
||||||
const polygon = coordinates[i];
|
const polygon = polygons[i];
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
layout = polygon.getLayout();
|
layout = polygon.getLayout();
|
||||||
}
|
}
|
||||||
@@ -101,10 +102,11 @@ class MultiPolygon extends SimpleGeometry {
|
|||||||
opt_endss = endss;
|
opt_endss = endss;
|
||||||
}
|
}
|
||||||
if (opt_layout !== undefined && opt_endss) {
|
if (opt_layout !== undefined && opt_endss) {
|
||||||
this.setFlatCoordinates(opt_layout, coordinates);
|
this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
|
||||||
this.endss_ = opt_endss;
|
this.endss_ = opt_endss;
|
||||||
} else {
|
} else {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(/** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */ (coordinates),
|
||||||
|
opt_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ class Polygon extends SimpleGeometry {
|
|||||||
this.orientedFlatCoordinates_ = null;
|
this.orientedFlatCoordinates_ = null;
|
||||||
|
|
||||||
if (opt_layout !== undefined && opt_ends) {
|
if (opt_layout !== undefined && opt_ends) {
|
||||||
this.setFlatCoordinates(opt_layout, coordinates);
|
this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
|
||||||
this.ends_ = opt_ends;
|
this.ends_ = opt_ends;
|
||||||
} else {
|
} else {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(/** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user