Use TopoJSON types from @types/topojson

This commit is contained in:
Frederic Junod
2018-09-11 08:10:18 +02:00
parent 84c689d456
commit abc3279752
2 changed files with 18 additions and 6 deletions
+1
View File
@@ -41,6 +41,7 @@
"devDependencies": { "devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.1", "@openlayers/eslint-plugin": "^4.0.0-beta.1",
"@types/geojson": "^7946.0.4", "@types/geojson": "^7946.0.4",
"@types/topojson-specification": "^1.0.0",
"buble": "^0.19.3", "buble": "^0.19.3",
"buble-loader": "^0.5.1", "buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4", "chaikin-smooth": "^1.0.4",
+17 -6
View File
@@ -12,6 +12,17 @@ import Point from '../geom/Point.js';
import Polygon from '../geom/Polygon.js'; import Polygon from '../geom/Polygon.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
/**
* @typedef {import("topojson-specification").Topology} TopoJSONTopology
* @typedef {import("topojson-specification").GeometryCollection} TopoJSONGeometryCollection
* @typedef {import("topojson-specification").GeometryObject} TopoJSONGeometry
* @typedef {import("topojson-specification").Point} TopoJSONPoint
* @typedef {import("topojson-specification").MultiPoint} TopoJSONMultiPoint
* @typedef {import("topojson-specification").LineString} TopoJSONLineString
* @typedef {import("topojson-specification").MultiLineString} TopoJSONMultiLineString
* @typedef {import("topojson-specification").Polygon} TopoJSONPolygon
* @typedef {import("topojson-specification").MultiPolygon} TopoJSONMultiPolygon
*/
/** /**
* @typedef {Object} Options * @typedef {Object} Options
@@ -178,7 +189,7 @@ function concatenateArcs(indices, arcs) {
/** /**
* Create a point from a TopoJSON geometry object. * Create a point from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONPoint} object TopoJSON object.
* @param {Array<number>} scale Scale for each dimension. * @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension. * @param {Array<number>} translate Translation for each dimension.
* @return {Point} Geometry. * @return {Point} Geometry.
@@ -195,7 +206,7 @@ function readPointGeometry(object, scale, translate) {
/** /**
* Create a multi-point from a TopoJSON geometry object. * Create a multi-point from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONMultiPoint} object TopoJSON object.
* @param {Array<number>} scale Scale for each dimension. * @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension. * @param {Array<number>} translate Translation for each dimension.
* @return {MultiPoint} Geometry. * @return {MultiPoint} Geometry.
@@ -214,7 +225,7 @@ function readMultiPointGeometry(object, scale, translate) {
/** /**
* Create a linestring from a TopoJSON geometry object. * Create a linestring from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONLineString} object TopoJSON object.
* @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs. * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
* @return {LineString} Geometry. * @return {LineString} Geometry.
*/ */
@@ -227,7 +238,7 @@ function readLineStringGeometry(object, arcs) {
/** /**
* Create a multi-linestring from a TopoJSON geometry object. * Create a multi-linestring from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONMultiLineString} object TopoJSON object.
* @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs. * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
* @return {MultiLineString} Geometry. * @return {MultiLineString} Geometry.
*/ */
@@ -243,7 +254,7 @@ function readMultiLineStringGeometry(object, arcs) {
/** /**
* Create a polygon from a TopoJSON geometry object. * Create a polygon from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONPolygon} object TopoJSON object.
* @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs. * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
* @return {Polygon} Geometry. * @return {Polygon} Geometry.
*/ */
@@ -259,7 +270,7 @@ function readPolygonGeometry(object, arcs) {
/** /**
* Create a multi-polygon from a TopoJSON geometry object. * Create a multi-polygon from a TopoJSON geometry object.
* *
* @param {TopoJSONGeometry} object TopoJSON object. * @param {TopoJSONMultiPolygon} object TopoJSON object.
* @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs. * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
* @return {MultiPolygon} Geometry. * @return {MultiPolygon} Geometry.
*/ */