Use union instead of enum for geometry type

This commit is contained in:
Tim Schaub
2021-09-04 17:39:54 -06:00
committed by Andreas Hocevar
parent 04ad0e0c5a
commit 9a6f8493fb
35 changed files with 296 additions and 378 deletions
+4 -5
View File
@@ -3,7 +3,6 @@
*/
import Feature from '../Feature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js';
import {
LineString,
MultiLineString,
@@ -45,7 +44,7 @@ const tmpTransform = createTransform();
*/
class RenderFeature {
/**
* @param {import("../geom/GeometryType.js").default} type Geometry type.
* @param {import("../geom/Geometry.js").Type} type Geometry type.
* @param {Array<number>} flatCoordinates Flat coordinates. These always need
* to be right-handed for polygons.
* @param {Array<number>|Array<Array<number>>} ends Ends or Endss.
@@ -72,7 +71,7 @@ class RenderFeature {
/**
* @private
* @type {import("../geom/GeometryType.js").default}
* @type {import("../geom/Geometry.js").Type}
*/
this.type_ = type;
@@ -125,7 +124,7 @@ class RenderFeature {
getExtent() {
if (!this.extent_) {
this.extent_ =
this.type_ === GeometryType.POINT
this.type_ === 'Point'
? createOrUpdateFromCoordinate(this.flatCoordinates_)
: createOrUpdateFromFlatCoordinates(
this.flatCoordinates_,
@@ -283,7 +282,7 @@ class RenderFeature {
/**
* Get the type of this feature's geometry.
* @return {import("../geom/GeometryType.js").default} Geometry type.
* @return {import("../geom/Geometry.js").Type} Geometry type.
* @api
*/
getType() {