Lint removal

This commit is contained in:
Tim Schaub
2018-07-16 17:57:57 -06:00
parent f78d0d4cfa
commit d0ab8dce38
63 changed files with 2945 additions and 2917 deletions

View File

@@ -17,6 +17,19 @@ import Polygon from '../geom/Polygon.js';
import SimpleGeometry from '../geom/SimpleGeometry.js';
/**
* @enum {function (new:module:ol/geom/Geometry, Array, module:ol/geom/GeometryLayout)}
*/
const GeometryConstructor = {
'POINT': Point,
'LINESTRING': LineString,
'POLYGON': Polygon,
'MULTIPOINT': MultiPoint,
'MULTILINESTRING': MultiLineString,
'MULTIPOLYGON': MultiPolygon
};
/**
* @typedef {Object} Options
* @property {boolean} [splitCollection=false] Whether to split GeometryCollections into
@@ -521,12 +534,42 @@ class Parser {
const geometries = this.parseGeometryCollectionText_();
return new GeometryCollection(geometries);
} else {
const parser = GeometryParser[geomType];
const ctor = GeometryConstructor[geomType];
if (!parser || !ctor) {
if (!ctor) {
throw new Error('Invalid geometry type: ' + geomType);
}
let coordinates = parser.call(this);
let coordinates;
switch (geomType) {
case GeometryType.POINT: {
coordinates = this.parsePointText_();
break;
}
case GeometryType.LINESTRING: {
coordinates = this.parseLineStringText_();
break;
}
case GeometryType.POLYGON: {
coordinates = Parser.prototype.parsePolygonText_();
break;
}
case GeometryType.MULTIPOINT: {
coordinates = Parser.prototype.parseMultiPointText_();
break;
}
case GeometryType.MULTILINESTRING: {
coordinates = Parser.prototype.parseMultiLineStringText_();
break;
}
case GeometryType.MULTIPOLYGON: {
coordinates = Parser.prototype.parseMultiPolygonText_();
break;
}
default: {
throw new Error('Invalid geometry type: ' + geomType);
}
}
if (!coordinates) {
if (ctor === GeometryConstructor[GeometryType.POINT]) {
coordinates = [NaN, NaN];
@@ -541,6 +584,7 @@ class Parser {
}
}
/**
* @classdesc
* Geometry format for reading and writing data in the `WellKnownText` (WKT)
@@ -855,32 +899,6 @@ WKT.prototype.readFeatures;
WKT.prototype.readGeometry;
/**
* @enum {function (new:module:ol/geom/Geometry, Array, module:ol/geom/GeometryLayout)}
*/
const GeometryConstructor = {
'POINT': Point,
'LINESTRING': LineString,
'POLYGON': Polygon,
'MULTIPOINT': MultiPoint,
'MULTILINESTRING': MultiLineString,
'MULTIPOLYGON': MultiPolygon
};
/**
* @enum {(function(): Array)}
*/
const GeometryParser = {
'POINT': Parser.prototype.parsePointText_,
'LINESTRING': Parser.prototype.parseLineStringText_,
'POLYGON': Parser.prototype.parsePolygonText_,
'MULTIPOINT': Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': Parser.prototype.parseMultiPolygonText_
};
/**
* Encode a feature as a WKT string.
*