New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

three-geojson-geometry

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

three-geojson-geometry - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

407

dist/three-geojson-geometry.common.js

@@ -13,2 +13,87 @@ 'use strict';

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {

@@ -23,10 +108,13 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
var _s, _e;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);

@@ -72,5 +160,5 @@

function _createForOfIteratorHelper(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {

@@ -108,3 +196,3 @@ if (it) o = it;

s: function () {
it = o[Symbol.iterator]();
it = it.call(o);
},

@@ -164,185 +252,196 @@ n: function () {

function GeoJsonGeometry(geoJson) {
var _this = this;
var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
_inherits(GeoJsonGeometry, _THREE$BufferGeometry);
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
THREE.BufferGeometry.call(this);
this.type = 'GeoJsonGeometry';
this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
var _super = _createSuper(GeoJsonGeometry);
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function GeoJsonGeometry(geoJson) {
var _this;
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
_classCallCheck(this, GeoJsonGeometry);
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
_this = _super.call(this);
_this.type = 'GeoJsonGeometry';
_this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
indices.length && this.setIndex(indices);
vertices.length && this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
concatGroup(result, newPnt);
});
return [result];
}
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
indices.length && _this.setIndex(indices);
vertices.length && _this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
return polar2Cartesian(lat, lng, r);
});
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
var _earcut$flatten = earcut__default['default'].flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
concatGroup(result, newPnt);
});
return [result];
}
return [{
vertices: vertices,
indices: indices
}];
}
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
return polar2Cartesian(lat, lng, r);
});
concatGroup(result, newLine);
});
return [result];
}
var _earcut$flatten = earcut__default['default'].flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
return polar2Cartesian(lat, lng, r);
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
}
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
concatGroup(result, newLine);
});
}); // Each point generates 3 vertice items (x,y,z).
return [result];
}
var _earcut$flatten2 = earcut__default['default'].flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
return polar2Cartesian(lat, lng, r);
});
}); // Each point generates 3 vertice items (x,y,z).
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
var _earcut$flatten2 = earcut__default['default'].flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
}
}
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
});
}
return groups;
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
return groups;
return _this;
}
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
return GeoJsonGeometry;
}(THREE.BufferGeometry); //
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
}
GeoJsonGeometry.prototype = Object.create(THREE.BufferGeometry.prototype);
GeoJsonGeometry.prototype.constructor = GeoJsonGeometry; //
function concatGroup(main, extra) {

@@ -349,0 +448,0 @@ var prevVertCnt = Math.round(main.vertices.length / 3);

@@ -1,2 +0,2 @@

// Version 1.1.2 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
// Version 1.1.3 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
(function (global, factory) {

@@ -8,2 +8,87 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three')) :

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {

@@ -18,10 +103,13 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
var _s, _e;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);

@@ -67,5 +155,5 @@

function _createForOfIteratorHelper(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {

@@ -103,3 +191,3 @@ if (it) o = it;

s: function () {
it = o[Symbol.iterator]();
it = it.call(o);
},

@@ -1065,185 +1153,196 @@ n: function () {

function GeoJsonGeometry(geoJson) {
var _this = this;
var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
_inherits(GeoJsonGeometry, _THREE$BufferGeometry);
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
THREE.BufferGeometry.call(this);
this.type = 'GeoJsonGeometry';
this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
var _super = _createSuper(GeoJsonGeometry);
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function GeoJsonGeometry(geoJson) {
var _this;
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
_classCallCheck(this, GeoJsonGeometry);
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
_this = _super.call(this);
_this.type = 'GeoJsonGeometry';
_this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
indices.length && this.setIndex(indices);
vertices.length && this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
concatGroup(result, newPnt);
});
return [result];
}
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
indices.length && _this.setIndex(indices);
vertices.length && _this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
return polar2Cartesian(lat, lng, r);
});
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
var _earcut$flatten = earcut_1.flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
concatGroup(result, newPnt);
});
return [result];
}
return [{
vertices: vertices,
indices: indices
}];
}
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
return polar2Cartesian(lat, lng, r);
});
concatGroup(result, newLine);
});
return [result];
}
var _earcut$flatten = earcut_1.flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
return polar2Cartesian(lat, lng, r);
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
}
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
concatGroup(result, newLine);
});
}); // Each point generates 3 vertice items (x,y,z).
return [result];
}
var _earcut$flatten2 = earcut_1.flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
return polar2Cartesian(lat, lng, r);
});
}); // Each point generates 3 vertice items (x,y,z).
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
var _earcut$flatten2 = earcut_1.flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
}
}
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
});
}
return groups;
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
return groups;
return _this;
}
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
return GeoJsonGeometry;
}(THREE.BufferGeometry); //
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
}
GeoJsonGeometry.prototype = Object.create(THREE.BufferGeometry.prototype);
GeoJsonGeometry.prototype.constructor = GeoJsonGeometry; //
function concatGroup(main, extra) {

@@ -1250,0 +1349,0 @@ var prevVertCnt = Math.round(main.vertices.length / 3);

@@ -1,2 +0,2 @@

// Version 1.1.2 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).THREE=t.THREE||{},t.THREE)}(this,(function(t,n){"use strict";function e(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return e}(t,n)||r(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,n){if(t){if("string"==typeof t)return i(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,n):void 0}}function i(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var o=a,u=a;function a(t,n,e){e=e||2;var r,i,o,u,a,l,v,s=n&&n.length,h=s?n[0]*e:t.length,d=f(t,0,h,e,!0),g=[];if(!d||d.next===d.prev)return g;if(s&&(d=function(t,n,e,r){var i,o,u,a=[];for(i=0,o=n.length;i<o;i++)(u=f(t,n[i]*r,i<o-1?n[i+1]*r:t.length,r,!1))===u.next&&(u.steiner=!0),a.push(m(u));for(a.sort(y),i=0;i<a.length;i++)p(a[i],e),e=x(e,e.next);return e}(t,n,d,e)),t.length>80*e){r=o=t[0],i=u=t[1];for(var b=e;b<h;b+=e)(a=t[b])<r&&(r=a),(l=t[b+1])<i&&(i=l),a>o&&(o=a),l>u&&(u=l);v=0!==(v=Math.max(o-r,u-i))?1/v:0}return c(d,g,e,r,i,v),g}function f(t,n,e,r,i){var o,u;if(i===_(t,n,e,r)>0)for(o=n;o<e;o+=r)u=I(o,t[o],t[o+1],u);else for(o=e-r;o>=n;o-=r)u=I(o,t[o],t[o+1],u);return u&&Z(u,u.next)&&(z(u),u=u.next),u}function x(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!Z(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(z(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function c(t,n,e,r,i,o,u){if(t){!u&&o&&function(t,n,e,r){var i=t;do{null===i.z&&(i.z=g(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,o,u,a,f,x=1;do{for(e=t,t=null,o=null,u=0;e;){for(u++,r=e,a=0,n=0;n<x&&(a++,r=r.nextZ);n++);for(f=x;a>0||f>0&&r;)0!==a&&(0===f||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,f--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;e=r}o.nextZ=null,x*=2}while(u>1)}(i)}(t,r,i,o);for(var a,f,y=t;t.prev!==t.next;)if(a=t.prev,f=t.next,o?v(t,r,i,o):l(t))n.push(a.i/e),n.push(t.i/e),n.push(f.i/e),z(t),t=f.next,y=f.next;else if((t=f)===y){u?1===u?c(t=s(x(t),n,e),n,e,r,i,o,2):2===u&&h(t,n,e,r,i,o):c(x(t),n,e,r,i,o,1);break}}}function l(t){var n=t.prev,e=t,r=t.next;if(w(n,e,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(b(n.x,n.y,e.x,e.y,r.x,r.y,i.x,i.y)&&w(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function v(t,n,e,r){var i=t.prev,o=t,u=t.next;if(w(i,o,u)>=0)return!1;for(var a=i.x<o.x?i.x<u.x?i.x:u.x:o.x<u.x?o.x:u.x,f=i.y<o.y?i.y<u.y?i.y:u.y:o.y<u.y?o.y:u.y,x=i.x>o.x?i.x>u.x?i.x:u.x:o.x>u.x?o.x:u.x,c=i.y>o.y?i.y>u.y?i.y:u.y:o.y>u.y?o.y:u.y,l=g(a,f,n,e,r),v=g(x,c,n,e,r),s=t.prevZ,h=t.nextZ;s&&s.z>=l&&h&&h.z<=v;){if(s!==t.prev&&s!==t.next&&b(i.x,i.y,o.x,o.y,u.x,u.y,s.x,s.y)&&w(s.prev,s,s.next)>=0)return!1;if(s=s.prevZ,h!==t.prev&&h!==t.next&&b(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&w(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;s&&s.z>=l;){if(s!==t.prev&&s!==t.next&&b(i.x,i.y,o.x,o.y,u.x,u.y,s.x,s.y)&&w(s.prev,s,s.next)>=0)return!1;s=s.prevZ}for(;h&&h.z<=v;){if(h!==t.prev&&h!==t.next&&b(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&w(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function s(t,n,e){var r=t;do{var i=r.prev,o=r.next.next;!Z(i,o)&&E(i,r,r.next,o)&&P(i,o)&&P(o,i)&&(n.push(i.i/e),n.push(r.i/e),n.push(o.i/e),z(r),z(r.next),r=t=o),r=r.next}while(r!==t);return x(r)}function h(t,n,e,r,i,o){var u=t;do{for(var a=u.next.next;a!==u.prev;){if(u.i!==a.i&&M(u,a)){var f=G(u,a);return u=x(u,u.next),f=x(f,f.next),c(u,n,e,r,i,o),void c(f,n,e,r,i,o)}a=a.next}u=u.next}while(u!==t)}function y(t,n){return t.x-n.x}function p(t,n){if(n=function(t,n){var e,r=n,i=t.x,o=t.y,u=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>u){if(u=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}e=r.x<r.next.x?r:r.next}}r=r.next}while(r!==n);if(!e)return null;if(i===u)return e;var f,x=e,c=e.x,l=e.y,v=1/0;r=e;do{i>=r.x&&r.x>=c&&i!==r.x&&b(o<l?i:u,o,c,l,o<l?u:i,o,r.x,r.y)&&(f=Math.abs(o-r.y)/(i-r.x),P(r,t)&&(f<v||f===v&&(r.x>e.x||r.x===e.x&&d(e,r)))&&(e=r,v=f)),r=r.next}while(r!==x);return e}(t,n)){var e=G(n,t);x(n,n.next),x(e,e.next)}}function d(t,n){return w(t.prev,t,n.prev)<0&&w(n.next,t,t.next)<0}function g(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-e)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-r)*i)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function m(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function b(t,n,e,r,i,o,u,a){return(i-u)*(n-a)-(t-u)*(o-a)>=0&&(t-u)*(r-a)-(e-u)*(n-a)>=0&&(e-u)*(o-a)-(i-u)*(r-a)>=0}function M(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&E(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(P(t,n)&&P(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(w(t.prev,t,n.prev)||w(t,n.prev,n))||Z(t,n)&&w(t.prev,t,t.next)>0&&w(n.prev,n,n.next)>0)}function w(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function Z(t,n){return t.x===n.x&&t.y===n.y}function E(t,n,e,r){var i=A(w(t,n,e)),o=A(w(t,n,r)),u=A(w(e,r,t)),a=A(w(e,r,n));return i!==o&&u!==a||(!(0!==i||!S(t,e,n))||(!(0!==o||!S(t,r,n))||(!(0!==u||!S(e,t,r))||!(0!==a||!S(e,n,r)))))}function S(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function A(t){return t>0?1:t<0?-1:0}function P(t,n){return w(t.prev,t,t.next)<0?w(t,n,t.next)>=0&&w(t,t.prev,n)>=0:w(t,n,t.prev)<0||w(t,t.next,n)<0}function G(t,n){var e=new T(t.i,t.x,t.y),r=new T(n.i,n.x,n.y),i=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function I(t,n,e,r){var i=new T(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function z(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _(t,n,e,r){for(var i=0,o=n,u=e-r;o<e;o+=r)i+=(t[u]-t[o])*(t[o+1]+t[u+1]),u=o;return i}a.deviation=function(t,n,e,r){var i=n&&n.length,o=i?n[0]*e:t.length,u=Math.abs(_(t,0,o,e));if(i)for(var a=0,f=n.length;a<f;a++){var x=n[a]*e,c=a<f-1?n[a+1]*e:t.length;u-=Math.abs(_(t,x,c,e))}var l=0;for(a=0;a<r.length;a+=3){var v=r[a]*e,s=r[a+1]*e,h=r[a+2]*e;l+=Math.abs((t[v]-t[h])*(t[s+1]-t[v+1])-(t[v]-t[s])*(t[h+1]-t[v+1]))}return 0===u&&0===l?0:Math.abs((l-u)/u)},a.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var u=0;u<n;u++)e.vertices.push(t[i][o][u]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e},o.default=u;class j{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,u=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);u&&(n[e++]=u),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var B=Math.PI,O=B/2,F=180/B,H=B/180,L=Math.abs,R=Math.atan2,C=Math.cos,J=Math.sin,k=Math.sqrt;function q(t){return(t=J(t/2))*t}function U(){}function $(t,n){t&&W.hasOwnProperty(t.type)&&W[t.type](t,n)}var D,K,N,Q,V={Feature:function(t,n){$(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)$(e[r].geometry,n)}},W={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){X(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)X(e[r],n,0)},Polygon:function(t,n){Y(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Y(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)$(e[r],n)}};function X(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function Y(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)X(t[e],n,1);n.polygonEnd()}var tt={sphere:U,point:U,lineStart:function(){tt.point=et,tt.lineEnd=nt},lineEnd:U,polygonStart:U,polygonEnd:U};function nt(){tt.point=tt.lineEnd=U}function et(t,n){K=t*=H,N=J(n*=H),Q=C(n),tt.point=rt}function rt(t,n){t*=H;var e=J(n*=H),r=C(n),i=L(t-K),o=C(i),u=r*J(i),a=Q*e-N*r*o,f=N*e+Q*r*o;D.add(R(k(u*u+a*a),f)),K=t,N=e,Q=r}function it(t){return D=new j,function(t,n){t&&V.hasOwnProperty(t.type)?V[t.type](t,n):$(t,n)}(t,tt),+D}var ot=[null,null],ut={type:"LineString",coordinates:ot};function at(t,n){return ot[0]=t,ot[1]=n,it(ut)}function ft(t,n){var e,r=t[0]*H,i=t[1]*H,o=n[0]*H,u=n[1]*H,a=C(i),f=J(i),x=C(u),c=J(u),l=a*C(r),v=a*J(r),s=x*C(o),h=x*J(o),y=2*((e=k(q(u-i)+a*x*q(o-r)))>1?O:e<-1?-O:Math.asin(e)),p=J(y),d=y?function(t){var n=J(t*=y)/p,e=J(y-t)/p,r=e*l+n*s,i=e*v+n*h,o=e*f+n*c;return[R(i,r)*F,R(o,k(r*r+i*i))*F]}:function(){return[r*F,i*F]};return d.distance=y,d}var xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=[],r=null;return t.forEach((function(t){if(r){var i=180*at(t,r)/Math.PI;if(i>n)for(var o=ft(r,t),u=1/Math.ceil(i/n),a=u;a<1;)e.push(o(a)),a+=u}e.push(r=t)})),e},ct=window.THREE?window.THREE:{BufferGeometry:n.BufferGeometry,Float32BufferAttribute:n.Float32BufferAttribute},lt=(new ct.BufferGeometry).setAttribute?"setAttribute":"addAttribute";function vt(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;ct.BufferGeometry.call(this),this.type="GeoJsonGeometry",this.parameters={geoJson:t,radius:r,resolution:i};var u=({Point:c,MultiPoint:l,LineString:v,MultiLineString:s,Polygon:h,MultiPolygon:y}[t.type]||function(){return[]})(t.coordinates,r),a=[],f=[],x=0;function c(t,n){return[{vertices:yt(t[1],t[0],n),indices:[]}]}function l(t,n){var r={vertices:[],indices:[]};return t.map((function(t){return c(t,n)})).forEach((function(t){var n=e(t,1)[0];st(r,n)})),[r]}function v(t,n){for(var r=xt(t,i).map((function(t){var r=e(t,2),i=r[0];return yt(r[1],i,n)})),u=o.flatten([r]).vertices,a=Math.round(u.length/3),f=[],x=1;x<a;x++)f.push(x-1,x);return[{vertices:u,indices:f}]}function s(t,n){var r={vertices:[],indices:[]};return t.map((function(t){return v(t,n)})).forEach((function(t){var n=e(t,1)[0];st(r,n)})),[r]}function h(t,n){for(var r=t.map((function(t){return xt(t,i).map((function(t){var r=e(t,2),i=r[0];return yt(r[1],i,n)}))})),u=o.flatten(r),a=u.vertices,f=u.holes,x=f[0]||1/0,c=a.slice(0,x),l=a.slice(x),v=new Set(f),s=Math.round(a.length/3),h=[],y=[],p=1;p<s;p++)v.has(p)||(p<x?h.push(p-1,p):y.push(p-1-x,p-x));var d=[{indices:h,vertices:c}];return f.length&&d.push({indices:y,vertices:l}),d}function y(t,n){var r={vertices:[],indices:[]},i={vertices:[],indices:[]};t.map((function(t){return h(t,n)})).forEach((function(t){var n=e(t,2),o=n[0],u=n[1];st(r,o),u&&st(i,u)}));var o=[r];return i.vertices.length&&o.push(i),o}u.forEach((function(t){var e=a.length;st({indices:a,vertices:f},t),n.addGroup(e,a.length-e,x++)})),a.length&&this.setIndex(a),f.length&&this[lt]("position",new ct.Float32BufferAttribute(f,3))}function st(t,n){var e=Math.round(t.vertices.length/3);ht(t.vertices,n.vertices),ht(t.indices,n.indices.map((function(t){return t+e})))}function ht(t,n){var e,i=function(t,n){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=r(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,f=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return a=t.done,t},e:function(t){f=!0,u=t},f:function(){try{a||null==e.return||e.return()}finally{if(f)throw u}}}}(n);try{for(i.s();!(e=i.n()).done;){var o=e.value;t.push(o)}}catch(t){i.e(t)}finally{i.f()}}function yt(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,i=(90-n)*Math.PI/180;return[e*Math.sin(r)*Math.cos(i),e*Math.cos(r),e*Math.sin(r)*Math.sin(i)]}vt.prototype=Object.create(ct.BufferGeometry.prototype),vt.prototype.constructor=vt,t.GeoJsonGeometry=vt,Object.defineProperty(t,"__esModule",{value:!0})}));
// Version 1.1.3 three-geojson-geometry - https://github.com/vasturiano/three-geojson-geometry
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).THREE=t.THREE||{},t.THREE)}(this,(function(t,n){"use strict";function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,n){return(i=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function o(t,n){return!n||"object"!=typeof n&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function u(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,i=r(t);if(n){var u=r(this).constructor;e=Reflect.construct(i,arguments,u)}else e=i.apply(this,arguments);return o(this,e)}}function f(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==e)return;var r,i,o=[],u=!0,f=!1;try{for(e=e.call(t);!(u=(r=e.next()).done)&&(o.push(r.value),!n||o.length!==n);u=!0);}catch(t){f=!0,i=t}finally{try{u||null==e.return||e.return()}finally{if(f)throw i}}return o}(t,n)||a(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,n){if(t){if("string"==typeof t)return c(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?c(t,n):void 0}}function c(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var l=s,x=s;function s(t,n,e){e=e||2;var r,i,o,u,f,a,c,l=n&&n.length,x=l?n[0]*e:t.length,s=v(t,0,x,e,!0),p=[];if(!s||s.next===s.prev)return p;if(l&&(s=function(t,n,e,r){var i,o,u,f=[];for(i=0,o=n.length;i<o;i++)(u=v(t,n[i]*r,i<o-1?n[i+1]*r:t.length,r,!1))===u.next&&(u.steiner=!0),f.push(E(u));for(f.sort(m),i=0;i<f.length;i++)w(f[i],e),e=h(e,e.next);return e}(t,n,s,e)),t.length>80*e){r=o=t[0],i=u=t[1];for(var d=e;d<x;d+=e)(f=t[d])<r&&(r=f),(a=t[d+1])<i&&(i=a),f>o&&(o=f),a>u&&(u=a);c=0!==(c=Math.max(o-r,u-i))?1/c:0}return y(s,p,e,r,i,c),p}function v(t,n,e,r,i){var o,u;if(i===F(t,n,e,r)>0)for(o=n;o<e;o+=r)u=I(o,t[o],t[o+1],u);else for(o=e-r;o>=n;o-=r)u=I(o,t[o],t[o+1],u);return u&&O(u,u.next)&&(z(u),u=u.next),u}function h(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!O(r,r.next)&&0!==_(r.prev,r,r.next))r=r.next;else{if(z(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function y(t,n,e,r,i,o,u){if(t){!u&&o&&function(t,n,e,r){var i=t;do{null===i.z&&(i.z=Z(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,o,u,f,a,c=1;do{for(e=t,t=null,o=null,u=0;e;){for(u++,r=e,f=0,n=0;n<c&&(f++,r=r.nextZ);n++);for(a=c;f>0||a>0&&r;)0!==f&&(0===a||!r||e.z<=r.z)?(i=e,e=e.nextZ,f--):(i=r,r=r.nextZ,a--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;e=r}o.nextZ=null,c*=2}while(u>1)}(i)}(t,r,i,o);for(var f,a,c=t;t.prev!==t.next;)if(f=t.prev,a=t.next,o?d(t,r,i,o):p(t))n.push(f.i/e),n.push(t.i/e),n.push(a.i/e),z(t),t=a.next,c=a.next;else if((t=a)===c){u?1===u?y(t=g(h(t),n,e),n,e,r,i,o,2):2===u&&b(t,n,e,r,i,o):y(h(t),n,e,r,i,o,1);break}}}function p(t){var n=t.prev,e=t,r=t.next;if(_(n,e,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(P(n.x,n.y,e.x,e.y,r.x,r.y,i.x,i.y)&&_(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function d(t,n,e,r){var i=t.prev,o=t,u=t.next;if(_(i,o,u)>=0)return!1;for(var f=i.x<o.x?i.x<u.x?i.x:u.x:o.x<u.x?o.x:u.x,a=i.y<o.y?i.y<u.y?i.y:u.y:o.y<u.y?o.y:u.y,c=i.x>o.x?i.x>u.x?i.x:u.x:o.x>u.x?o.x:u.x,l=i.y>o.y?i.y>u.y?i.y:u.y:o.y>u.y?o.y:u.y,x=Z(f,a,n,e,r),s=Z(c,l,n,e,r),v=t.prevZ,h=t.nextZ;v&&v.z>=x&&h&&h.z<=s;){if(v!==t.prev&&v!==t.next&&P(i.x,i.y,o.x,o.y,u.x,u.y,v.x,v.y)&&_(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,h!==t.prev&&h!==t.next&&P(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&_(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;v&&v.z>=x;){if(v!==t.prev&&v!==t.next&&P(i.x,i.y,o.x,o.y,u.x,u.y,v.x,v.y)&&_(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;h&&h.z<=s;){if(h!==t.prev&&h!==t.next&&P(i.x,i.y,o.x,o.y,u.x,u.y,h.x,h.y)&&_(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function g(t,n,e){var r=t;do{var i=r.prev,o=r.next.next;!O(i,o)&&A(i,r,r.next,o)&&T(i,o)&&T(o,i)&&(n.push(i.i/e),n.push(r.i/e),n.push(o.i/e),z(r),z(r.next),r=t=o),r=r.next}while(r!==t);return h(r)}function b(t,n,e,r,i,o){var u=t;do{for(var f=u.next.next;f!==u.prev;){if(u.i!==f.i&&S(u,f)){var a=G(u,f);return u=h(u,u.next),a=h(a,a.next),y(u,n,e,r,i,o),void y(a,n,e,r,i,o)}f=f.next}u=u.next}while(u!==t)}function m(t,n){return t.x-n.x}function w(t,n){if(n=function(t,n){var e,r=n,i=t.x,o=t.y,u=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var f=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=i&&f>u){if(u=f,f===i){if(o===r.y)return r;if(o===r.next.y)return r.next}e=r.x<r.next.x?r:r.next}}r=r.next}while(r!==n);if(!e)return null;if(i===u)return e;var a,c=e,l=e.x,x=e.y,s=1/0;r=e;do{i>=r.x&&r.x>=l&&i!==r.x&&P(o<x?i:u,o,l,x,o<x?u:i,o,r.x,r.y)&&(a=Math.abs(o-r.y)/(i-r.x),T(r,t)&&(a<s||a===s&&(r.x>e.x||r.x===e.x&&M(e,r)))&&(e=r,s=a)),r=r.next}while(r!==c);return e}(t,n)){var e=G(n,t);h(n,n.next),h(e,e.next)}}function M(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function Z(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-e)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-r)*i)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function E(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function P(t,n,e,r,i,o,u,f){return(i-u)*(n-f)-(t-u)*(o-f)>=0&&(t-u)*(r-f)-(e-u)*(n-f)>=0&&(e-u)*(o-f)-(i-u)*(r-f)>=0}function S(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&A(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(T(t,n)&&T(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||O(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function O(t,n){return t.x===n.x&&t.y===n.y}function A(t,n,e,r){var i=R(_(t,n,e)),o=R(_(t,n,r)),u=R(_(e,r,t)),f=R(_(e,r,n));return i!==o&&u!==f||(!(0!==i||!j(t,e,n))||(!(0!==o||!j(t,r,n))||(!(0!==u||!j(e,t,r))||!(0!==f||!j(e,n,r)))))}function j(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function R(t){return t>0?1:t<0?-1:0}function T(t,n){return _(t.prev,t,t.next)<0?_(t,n,t.next)>=0&&_(t,t.prev,n)>=0:_(t,n,t.prev)<0||_(t,t.next,n)<0}function G(t,n){var e=new B(t.i,t.x,t.y),r=new B(n.i,n.x,n.y),i=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function I(t,n,e,r){var i=new B(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function z(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function B(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function F(t,n,e,r){for(var i=0,o=n,u=e-r;o<e;o+=r)i+=(t[u]-t[o])*(t[o+1]+t[u+1]),u=o;return i}s.deviation=function(t,n,e,r){var i=n&&n.length,o=i?n[0]*e:t.length,u=Math.abs(F(t,0,o,e));if(i)for(var f=0,a=n.length;f<a;f++){var c=n[f]*e,l=f<a-1?n[f+1]*e:t.length;u-=Math.abs(F(t,c,l,e))}var x=0;for(f=0;f<r.length;f+=3){var s=r[f]*e,v=r[f+1]*e,h=r[f+2]*e;x+=Math.abs((t[s]-t[h])*(t[v+1]-t[s+1])-(t[s]-t[v])*(t[h+1]-t[s+1]))}return 0===u&&0===x?0:Math.abs((x-u)/u)},s.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var u=0;u<n;u++)e.vertices.push(t[i][o][u]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e},l.default=x;class H{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,u=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);u&&(n[e++]=u),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var L=Math.PI,C=L/2,J=180/L,k=L/180,q=Math.abs,U=Math.atan2,$=Math.cos,D=Math.sin,K=Math.sqrt;function N(t){return(t=D(t/2))*t}function Q(){}function V(t,n){t&&et.hasOwnProperty(t.type)&&et[t.type](t,n)}var W,X,Y,tt,nt={Feature:function(t,n){V(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)V(e[r].geometry,n)}},et={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){rt(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)rt(e[r],n,0)},Polygon:function(t,n){it(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)it(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)V(e[r],n)}};function rt(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function it(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)rt(t[e],n,1);n.polygonEnd()}var ot={sphere:Q,point:Q,lineStart:function(){ot.point=ft,ot.lineEnd=ut},lineEnd:Q,polygonStart:Q,polygonEnd:Q};function ut(){ot.point=ot.lineEnd=Q}function ft(t,n){X=t*=k,Y=D(n*=k),tt=$(n),ot.point=at}function at(t,n){t*=k;var e=D(n*=k),r=$(n),i=q(t-X),o=$(i),u=r*D(i),f=tt*e-Y*r*o,a=Y*e+tt*r*o;W.add(U(K(u*u+f*f),a)),X=t,Y=e,tt=r}function ct(t){return W=new H,function(t,n){t&&nt.hasOwnProperty(t.type)?nt[t.type](t,n):V(t,n)}(t,ot),+W}var lt=[null,null],xt={type:"LineString",coordinates:lt};function st(t,n){return lt[0]=t,lt[1]=n,ct(xt)}function vt(t,n){var e,r=t[0]*k,i=t[1]*k,o=n[0]*k,u=n[1]*k,f=$(i),a=D(i),c=$(u),l=D(u),x=f*$(r),s=f*D(r),v=c*$(o),h=c*D(o),y=2*((e=K(N(u-i)+f*c*N(o-r)))>1?C:e<-1?-C:Math.asin(e)),p=D(y),d=y?function(t){var n=D(t*=y)/p,e=D(y-t)/p,r=e*x+n*v,i=e*s+n*h,o=e*a+n*l;return[U(i,r)*J,U(o,K(r*r+i*i))*J]}:function(){return[r*J,i*J]};return d.distance=y,d}var ht=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=[],r=null;return t.forEach((function(t){if(r){var i=180*st(t,r)/Math.PI;if(i>n)for(var o=vt(r,t),u=1/Math.ceil(i/n),f=u;f<1;)e.push(o(f)),f+=u}e.push(r=t)})),e},yt=window.THREE?window.THREE:{BufferGeometry:n.BufferGeometry,Float32BufferAttribute:n.Float32BufferAttribute},pt=(new yt.BufferGeometry).setAttribute?"setAttribute":"addAttribute",dt=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&i(t,n)}(r,t);var n=u(r);function r(t){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;e(this,r),(i=n.call(this)).type="GeoJsonGeometry",i.parameters={geoJson:t,radius:o,resolution:u};var a=({Point:v,MultiPoint:h,LineString:y,MultiLineString:p,Polygon:d,MultiPolygon:g}[t.type]||function(){return[]})(t.coordinates,o),c=[],x=[],s=0;function v(t,n){return[{vertices:mt(t[1],t[0],n),indices:[]}]}function h(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return v(t,n)})).forEach((function(t){var n=f(t,1)[0];gt(e,n)})),[e]}function y(t,n){for(var e=ht(t,u).map((function(t){var e=f(t,2),r=e[0];return mt(e[1],r,n)})),r=l.flatten([e]).vertices,i=Math.round(r.length/3),o=[],a=1;a<i;a++)o.push(a-1,a);return[{vertices:r,indices:o}]}function p(t,n){var e={vertices:[],indices:[]};return t.map((function(t){return y(t,n)})).forEach((function(t){var n=f(t,1)[0];gt(e,n)})),[e]}function d(t,n){for(var e=t.map((function(t){return ht(t,u).map((function(t){var e=f(t,2),r=e[0];return mt(e[1],r,n)}))})),r=l.flatten(e),i=r.vertices,o=r.holes,a=o[0]||1/0,c=i.slice(0,a),x=i.slice(a),s=new Set(o),v=Math.round(i.length/3),h=[],y=[],p=1;p<v;p++)s.has(p)||(p<a?h.push(p-1,p):y.push(p-1-a,p-a));var d=[{indices:h,vertices:c}];return o.length&&d.push({indices:y,vertices:x}),d}function g(t,n){var e={vertices:[],indices:[]},r={vertices:[],indices:[]};t.map((function(t){return d(t,n)})).forEach((function(t){var n=f(t,2),i=n[0],o=n[1];gt(e,i),o&&gt(r,o)}));var i=[e];return r.vertices.length&&i.push(r),i}return a.forEach((function(t){var n=c.length;gt({indices:c,vertices:x},t),i.addGroup(n,c.length-n,s++)})),c.length&&i.setIndex(c),x.length&&i[pt]("position",new yt.Float32BufferAttribute(x,3)),i}return r}(yt.BufferGeometry);function gt(t,n){var e=Math.round(t.vertices.length/3);bt(t.vertices,n.vertices),bt(t.indices,n.indices.map((function(t){return t+e})))}function bt(t,n){var e,r=function(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=a(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,f=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){f=!0,o=t},f:function(){try{u||null==e.return||e.return()}finally{if(f)throw o}}}}(n);try{for(r.s();!(e=r.n()).done;){var i=e.value;t.push(i)}}catch(t){r.e(t)}finally{r.f()}}function mt(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,i=(90-n)*Math.PI/180;return[e*Math.sin(r)*Math.cos(i),e*Math.cos(r),e*Math.sin(r)*Math.sin(i)]}t.GeoJsonGeometry=dt,Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -5,2 +5,87 @@ import { BufferGeometry, Float32BufferAttribute } from 'three';

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {

@@ -15,10 +100,13 @@ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();

function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
var _s, _e;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);

@@ -64,5 +152,5 @@

function _createForOfIteratorHelper(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {

@@ -100,3 +188,3 @@ if (it) o = it;

s: function () {
it = o[Symbol.iterator]();
it = it.call(o);
},

@@ -156,185 +244,196 @@ n: function () {

function GeoJsonGeometry(geoJson) {
var _this = this;
var GeoJsonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
_inherits(GeoJsonGeometry, _THREE$BufferGeometry);
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
THREE.BufferGeometry.call(this);
this.type = 'GeoJsonGeometry';
this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
var _super = _createSuper(GeoJsonGeometry);
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function GeoJsonGeometry(geoJson) {
var _this;
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
_classCallCheck(this, GeoJsonGeometry);
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
_this = _super.call(this);
_this.type = 'GeoJsonGeometry';
_this.parameters = {
geoJson: geoJson,
radius: radius,
resolution: resolution
}; // process various geometry types
indices.length && this.setIndex(indices);
vertices.length && this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
var groups = ({
Point: genPoint,
MultiPoint: genMultiPoint,
LineString: genLineString,
MultiLineString: genMultiLineString,
Polygon: genPolygon,
MultiPolygon: genMultiPolygon
}[geoJson.type] || function () {
return [];
})(geoJson.coordinates, radius); // concat groups
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var indices = [],
vertices = [];
var groupCnt = 0;
groups.forEach(function (newG) {
var prevIndCnt = indices.length;
concatGroup({
indices: indices,
vertices: vertices
}, newG);
concatGroup(result, newPnt);
});
return [result];
}
_this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
}); // build geometry
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
indices.length && _this.setIndex(indices);
vertices.length && _this[setAttributeFn]('position', new THREE.Float32BufferAttribute(vertices, 3)); //
return polar2Cartesian(lat, lng, r);
});
function genPoint(coords, r) {
var vertices = polar2Cartesian(coords[1], coords[0], r);
var indices = [];
return [{
vertices: vertices,
indices: indices
}];
}
var _earcut$flatten = earcut.flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genMultiPoint(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPoint(c, r);
}).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 1),
newPnt = _ref2[0];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
concatGroup(result, newPnt);
});
return [result];
}
return [{
vertices: vertices,
indices: indices
}];
}
function genLineString(coords, r) {
var coords3d = interpolateLine(coords, resolution).map(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
lng = _ref4[0],
lat = _ref4[1];
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
return polar2Cartesian(lat, lng, r);
});
concatGroup(result, newLine);
});
return [result];
}
var _earcut$flatten = earcut.flatten([coords3d]),
vertices = _earcut$flatten.vertices;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var numPoints = Math.round(vertices.length / 3);
var indices = [];
return polar2Cartesian(lat, lng, r);
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
indices.push(vIdx - 1, vIdx);
}
return [{
vertices: vertices,
indices: indices
}];
}
function genMultiLineString(coords, r) {
var result = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genLineString(c, r);
}).forEach(function (_ref5) {
var _ref6 = _slicedToArray(_ref5, 1),
newLine = _ref6[0];
concatGroup(result, newLine);
});
}); // Each point generates 3 vertice items (x,y,z).
return [result];
}
var _earcut$flatten2 = earcut.flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
function genPolygon(coords, r) {
var coords3d = coords.map(function (coordsSegment) {
return interpolateLine(coordsSegment, resolution).map(function (_ref7) {
var _ref8 = _slicedToArray(_ref7, 2),
lng = _ref8[0],
lat = _ref8[1];
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
return polar2Cartesian(lat, lng, r);
});
}); // Each point generates 3 vertice items (x,y,z).
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
var _earcut$flatten2 = earcut.flatten(coords3d),
vertices = _earcut$flatten2.vertices,
holes = _earcut$flatten2.holes;
var firstHoleIdx = holes[0] || Infinity;
var outerVertices = vertices.slice(0, firstHoleIdx);
var holeVertices = vertices.slice(firstHoleIdx);
var holesIdx = new Set(holes);
var numPoints = Math.round(vertices.length / 3);
var outerIndices = [],
holeIndices = [];
for (var vIdx = 1; vIdx < numPoints; vIdx++) {
if (!holesIdx.has(vIdx)) {
if (vIdx < firstHoleIdx) {
outerIndices.push(vIdx - 1, vIdx);
} else {
holeIndices.push(vIdx - 1 - firstHoleIdx, vIdx - firstHoleIdx);
}
}
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
});
}
return groups;
}
var groups = [{
indices: outerIndices,
vertices: outerVertices
}];
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
if (holes.length) {
groups.push({
indices: holeIndices,
vertices: holeVertices
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
return groups;
return _this;
}
function genMultiPolygon(coords, r) {
var outer = {
vertices: [],
indices: []
};
var holes = {
vertices: [],
indices: []
};
coords.map(function (c) {
return genPolygon(c, r);
}).forEach(function (_ref9) {
var _ref10 = _slicedToArray(_ref9, 2),
newOuter = _ref10[0],
newHoles = _ref10[1];
return GeoJsonGeometry;
}(THREE.BufferGeometry); //
concatGroup(outer, newOuter);
newHoles && concatGroup(holes, newHoles);
});
var groups = [outer];
holes.vertices.length && groups.push(holes);
return groups;
}
}
GeoJsonGeometry.prototype = Object.create(THREE.BufferGeometry.prototype);
GeoJsonGeometry.prototype.constructor = GeoJsonGeometry; //
function concatGroup(main, extra) {

@@ -341,0 +440,0 @@ var prevVertCnt = Math.round(main.vertices.length / 3);

{
"name": "three-geojson-geometry",
"version": "1.1.2",
"version": "1.1.3",
"description": "ThreeJS geometry for stroking GeoJSON objects on a sphere",

@@ -48,16 +48,16 @@ "unpkg": "dist/three-geojson-geometry.min.js",

"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/preset-env": "^7.12.11",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.1.0",
"@babel/core": "^7.13.16",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/preset-env": "^7.13.15",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/three": ">=0.72.0",
"rimraf": "^3.0.2",
"rollup": "^2.38.0",
"rollup-plugin-dts": "^2.0.1",
"rollup": "^2.45.2",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.1.3"
"typescript": "^4.2.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc