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

maptalks.three

Package Overview
Dependencies
Maintainers
2
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maptalks.three - npm Package Compare versions

Comparing version 0.17.1 to 0.17.2

dist/util/GeometryUtil.d.ts

6

dist/Bars.d.ts

@@ -33,3 +33,3 @@ import * as maptalks from 'maptalks';

object3d: import("three").Object3D;
options: import("./type/BaseOption").BaseObjectOptionType;
options: import("./type").BaseObjectOptionType;
toolTip: maptalks.ui.ToolTip;

@@ -53,3 +53,3 @@ infoWindow: maptalks.ui.InfoWindow;

getType(): string;
getOptions(): import("./type/BaseOption").BaseObjectOptionType;
getOptions(): import("./type").BaseObjectOptionType;
getProperties(): object;

@@ -84,3 +84,3 @@ setProperties(property: object): any;

setPickObject3d(object3d: import("three").Object3D): any;
_initOptions(options: import("./type/BaseOption").BaseObjectOptionType): any;
_initOptions(options: import("./type").BaseObjectOptionType): any;
_createMesh(geometry: import("three").BufferGeometry, material: import("three").Material): any;

@@ -87,0 +87,0 @@ _createGroup(): any;

@@ -34,3 +34,3 @@ import * as maptalks from 'maptalks';

object3d: THREE.Object3D;
options: import("./type/BaseOption").BaseObjectOptionType;
options: import("./type").BaseObjectOptionType;
toolTip: maptalks.ui.ToolTip;

@@ -54,3 +54,3 @@ infoWindow: maptalks.ui.InfoWindow;

getType(): string;
getOptions(): import("./type/BaseOption").BaseObjectOptionType;
getOptions(): import("./type").BaseObjectOptionType;
getProperties(): object;

@@ -85,3 +85,3 @@ setProperties(property: object): any;

setPickObject3d(object3d: THREE.Object3D): any;
_initOptions(options: import("./type/BaseOption").BaseObjectOptionType): any;
_initOptions(options: import("./type").BaseObjectOptionType): any;
_createMesh(geometry: THREE.BufferGeometry, material: THREE.Material): any;

@@ -88,0 +88,0 @@ _createGroup(): any;

@@ -34,3 +34,3 @@ import * as maptalks from 'maptalks';

object3d: THREE.Object3D;
options: import("./type/BaseOption").BaseObjectOptionType;
options: import("./type").BaseObjectOptionType;
toolTip: maptalks.ui.ToolTip;

@@ -54,3 +54,3 @@ infoWindow: maptalks.ui.InfoWindow;

getType(): string;
getOptions(): import("./type/BaseOption").BaseObjectOptionType;
getOptions(): import("./type").BaseObjectOptionType;
getProperties(): object;

@@ -85,3 +85,3 @@ setProperties(property: object): any;

setPickObject3d(object3d: THREE.Object3D): any;
_initOptions(options: import("./type/BaseOption").BaseObjectOptionType): any;
_initOptions(options: import("./type").BaseObjectOptionType): any;
_createMesh(geometry: THREE.BufferGeometry, material: THREE.Material): any;

@@ -88,0 +88,0 @@ _createGroup(): any;

import * as maptalks from 'maptalks';
import * as THREE from 'three';
import BaseObject from './BaseObject';
import { getLinePosition, LineStringSplit } from './util/LineUtil';
import { getLinePosition, LineStringSplit, setLineSegmentPosition } from './util/LineUtil';
import LineGeometry from './util/fatline/LineGeometry';

@@ -24,9 +24,3 @@ import Line2 from './util/fatline/Line2';

setBottomHeight(positionsV, options.bottomHeight, layer, cache);
for (let i = 0, len = positionsV.length; i < len; i++) {
const v = positionsV[i];
if (i > 0 && i < len - 1) {
ps.push(v.x, v.y, v.z);
}
ps.push(v.x, v.y, v.z);
}
setLineSegmentPosition(ps, positionsV);
}

@@ -33,0 +27,0 @@ const geometry = new LineGeometry();

import * as maptalks from 'maptalks';
import * as THREE from 'three';
import BaseObject from './BaseObject';
import { getLinePosition, LineStringSplit } from './util/LineUtil';
import { getLinePosition, LineStringSplit, setLineSegmentPosition } from './util/LineUtil';
import MergedMixin from './MergedMixin';

@@ -11,3 +11,3 @@ import FatLine from './FatLine';

import LineMaterial from './util/fatline/LineMaterial';
import { getCenterOfPoints, setBottomHeight } from './util';
import { getCenterOfPoints, getGeometriesColorArray, setBottomHeight } from './util';
import { getVertexColors } from './util/ThreeAdaptUtil';

@@ -48,9 +48,3 @@ const OPTIONS = {

psCount += (positionsV.length * 2 - 2);
for (let j = 0, len1 = positionsV.length; j < len1; j++) {
const v = positionsV[j];
if (j > 0 && j < len1 - 1) {
ps.push(v.x, v.y, v.z);
}
ps.push(v.x, v.y, v.z);
}
setLineSegmentPosition(ps, positionsV);
}

@@ -117,3 +111,4 @@ // const psCount = positionsV.length + positionsV.length - 2;

const { _geometriesAttributes } = this;
const colors = [];
const colors = getGeometriesColorArray(_geometriesAttributes);
let cIndex = 0;
for (let i = 0, len = _geometriesAttributes.length; i < len; i++) {

@@ -126,3 +121,6 @@ const color = pick.getColor();

for (let j = 0; j < count; j++) {
colors.push(color.r, color.g, color.b);
colors[cIndex] = color.r;
colors[cIndex + 1] = color.g;
colors[cIndex + 2] = color.b;
cIndex += 3;
}

@@ -129,0 +127,0 @@ }

@@ -8,2 +8,3 @@ import * as maptalks from 'maptalks';

import { addAttribute, getVertexColors } from './util/ThreeAdaptUtil';
import { getPlaneGeometry } from './util/GeometryUtil';
const OPTIONS = {

@@ -77,7 +78,7 @@ altitude: 0,

let maxAlpha = -Infinity;
const blackps = {}, alphas = [];
const blackps = new Float32Array(colored.data.length / 4), alphas = new Float32Array(colored.data.length / 4);
for (let i = 3, len = colored.data.length, j = 0; i < len; i += 4) {
const alpha = colored.data[i];
maxAlpha = Math.max(maxAlpha, alpha);
alphas.push(alpha);
alphas[j] = alpha;
//Points that do not need to be drawn

@@ -95,9 +96,11 @@ if (alpha <= 0) {

shadowContext = null;
const geometry = new THREE.PlaneBufferGeometry(offsetX, offsetY, canvasWidth - 1, canvasHeight - 1);
// const geometry = new THREE.PlaneBufferGeometry(offsetX, offsetY, canvasWidth - 1, canvasHeight - 1);
const geometry = getPlaneGeometry(offsetX, offsetY, canvasWidth - 1, canvasHeight - 1);
const index = geometry.getIndex().array;
const position = geometry.attributes.position.array;
// Index of the points that really need to be drawn
const filterIndex = [];
const colors = [];
const colors = new Float32Array(position.length);
const tempIndex = new Uint32Array(position.length * 6);
const color = new THREE.Color();
let iIndex = 0;
for (let i = 0, len = position.length, j = 0, len1 = index.length, m = 0, len2 = colored.data.length, n = 0; i < Math.max(len, len1, len2); i += 3) {

@@ -113,3 +116,6 @@ if (i < len) {

if ((!blackps[a]) || (!blackps[b]) || (!blackps[c])) {
filterIndex.push(a, b, c);
tempIndex[iIndex] = a;
tempIndex[iIndex + 1] = b;
tempIndex[iIndex + 2] = c;
iIndex += 3;
}

@@ -121,3 +127,5 @@ }

color.setStyle(rgb);
colors.push(color.r, color.g, color.b);
colors[j] = color.r;
colors[j + 1] = color.g;
colors[j + 2] = color.b;
}

@@ -128,4 +136,8 @@ j += 3;

}
geometry.setIndex(new THREE.Uint32BufferAttribute(filterIndex, 1));
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
const filterIndex = new Uint32Array(iIndex);
for (let i = 0; i < iIndex; i++) {
filterIndex[i] = tempIndex[i];
}
geometry.setIndex(new THREE.BufferAttribute(filterIndex, 1));
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
material.vertexColors = getVertexColors();

@@ -132,0 +144,0 @@ super();

@@ -5,3 +5,3 @@ import * as maptalks from 'maptalks';

import { setBottomHeight } from './util';
import { getLinePosition, LineStringSplit } from './util/LineUtil';
import { getLinePosition, LineStringSplit, setLineSegmentPosition } from './util/LineUtil';
import { addAttribute, getVertexColors } from './util/ThreeAdaptUtil';

@@ -36,9 +36,3 @@ function initColors(cs) {

const { positionsV } = getLinePosition(lineString, layer, center);
for (let j = 0, len1 = positionsV.length; j < len1; j++) {
const v = positionsV[j];
if (j > 0 && j < len1 - 1) {
ps.push(v.x, v.y, v.z);
}
ps.push(v.x, v.y, v.z);
}
setLineSegmentPosition(ps, positionsV);
}

@@ -45,0 +39,0 @@ const geometry = new THREE.BufferGeometry();

@@ -34,3 +34,3 @@ import * as maptalks from 'maptalks';

object3d: THREE.Object3D;
options: import("./type/BaseOption").BaseObjectOptionType;
options: import("./type").BaseObjectOptionType;
toolTip: maptalks.ui.ToolTip;

@@ -54,3 +54,3 @@ infoWindow: maptalks.ui.InfoWindow;

getType(): string;
getOptions(): import("./type/BaseOption").BaseObjectOptionType;
getOptions(): import("./type").BaseObjectOptionType;
getProperties(): object;

@@ -85,9 +85,9 @@ setProperties(property: object): any;

setPickObject3d(object3d: THREE.Object3D): any;
_initOptions(options: import("./type/BaseOption").BaseObjectOptionType): any;
_initOptions(options: import("./type").BaseObjectOptionType): any;
_createMesh(geometry: THREE.BufferGeometry, material: THREE.Material): any;
_createGroup(): any;
_createLine(geometry: THREE.BufferGeometry, material: THREE.LineBasicMaterial | THREE.LineDashedMaterial): any;
_createLine(geometry: THREE.BufferGeometry, material: LineMaterialType): any;
_createLine2(geometry: any, material: any): any;
_createPoints(geometry: THREE.BufferGeometry, material: THREE.PointsMaterial): any;
_createLineSegments(geometry: THREE.BufferGeometry, material: THREE.LineBasicMaterial | THREE.LineDashedMaterial): any;
_createLineSegments(geometry: THREE.BufferGeometry, material: LineMaterialType): any;
};

@@ -94,0 +94,0 @@ } & typeof BaseObject;

import * as maptalks from 'maptalks';
import * as THREE from 'three';
import BaseObject from './BaseObject';
import { getLinePosition, LineStringSplit } from './util/LineUtil';
import { getLinePosition, LineStringSplit, setLineSegmentPosition } from './util/LineUtil';
import MergedMixin from './MergedMixin';

@@ -9,3 +9,3 @@ import Line from './Line';

import { addAttribute, getVertexColors } from './util/ThreeAdaptUtil';
import { getCenterOfPoints, setBottomHeight } from './util/index';
import { getCenterOfPoints, getGeometriesColorArray, setBottomHeight } from './util/index';
const OPTIONS = {

@@ -44,9 +44,3 @@ altitude: 0,

psCount += (positionsV.length * 2 - 2);
for (let j = 0, len1 = positionsV.length; j < len1; j++) {
const v = positionsV[j];
if (j > 0 && j < len1 - 1) {
ps.push(v.x, v.y, v.z);
}
ps.push(v.x, v.y, v.z);
}
setLineSegmentPosition(ps, positionsV);
}

@@ -112,4 +106,6 @@ // const line = new Line(lineString, opts, material, layer);

const { _geometriesAttributes } = this;
const colors = [];
for (let i = 0, len = _geometriesAttributes.length; i < len; i++) {
const len = _geometriesAttributes.length;
const colors = getGeometriesColorArray(_geometriesAttributes);
let cIndex = 0;
for (let i = 0; i < len; i++) {
const color = pick.getColor();

@@ -121,6 +117,9 @@ const colorIndex = color.getHex();

for (let j = 0; j < count; j++) {
colors.push(color.r, color.g, color.b);
colors[cIndex] = color.r;
colors[cIndex + 1] = color.g;
colors[cIndex + 2] = color.b;
cIndex += 3;
}
}
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
const material = this.getObject3d().material.clone();

@@ -127,0 +126,0 @@ material.color.set('#fff');

@@ -60,2 +60,5 @@ import * as THREE from 'three';

isAdd: boolean;
object3d: THREE.Object3D;
options: import("./type").BaseObjectOptionType;
toolTip: import("../types/maptalks").ui.ToolTip;
/**

@@ -65,6 +68,6 @@ *

*/
object3d: THREE.Object3D;
options: import("./type").BaseObjectOptionType;
toolTip: import("../types/maptalks").ui.ToolTip;
infoWindow: import("../types/maptalks").ui.InfoWindow;
infoWindow: import("../types/maptalks").ui.InfoWindow; /**
*
* @param {*} baseObjects
*/
_mouseover: boolean;

@@ -71,0 +74,0 @@ _showPlayer: any;

import * as THREE from 'three';
import { getGeometriesColorArray } from './util';
import { addAttribute, getVertexColors } from './util/ThreeAdaptUtil';

@@ -160,4 +161,6 @@ const EVENTS = ['click', 'mousemove', 'mousedown', 'mouseup', 'dblclick', 'contextmenu'].join(' ').toString();

const { _geometriesAttributes } = this;
const colors = [];
for (let i = 0, len = _geometriesAttributes.length; i < len; i++) {
const len = _geometriesAttributes.length;
const colors = getGeometriesColorArray(_geometriesAttributes);
let cIndex = 0;
for (let i = 0; i < len; i++) {
const color = pick.getColor();

@@ -169,6 +172,9 @@ const colorIndex = color.getHex();

for (let j = 0; j < count; j++) {
colors.push(color.r, color.g, color.b);
colors[cIndex] = color.r;
colors[cIndex + 1] = color.g;
colors[cIndex + 2] = color.b;
cIndex += 3;
}
}
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
// const material = new THREE.MeshBasicMaterial();

@@ -175,0 +181,0 @@ // material.vertexColors = THREE.VertexColors;

@@ -14,2 +14,6 @@ import * as maptalks from 'maptalks';

const vector = new THREE.Vector3();
function roundFun(value, n) {
const tempValue = Math.pow(10, n);
return Math.round(value * tempValue) / tempValue;
}
/**

@@ -36,2 +40,3 @@ *points

}
points[i].coords = [x, y];
minX = Math.min(minX, x);

@@ -43,15 +48,22 @@ minY = Math.min(minY, y);

const centerPt = layer.coordinateToVector3([(minX + maxX) / 2, (minY + maxY) / 2]);
const grids = BBox.initGrids(minX, minY, maxX, maxY);
const { grids, averageX, averageY, ROWS, COLS } = BBox.initGrids(minX, minY, maxX, maxY);
const gridslen = grids.length;
const vs = [], vectors = [], colors = [], sizes = [], pointMeshes = [], geometriesAttributes = [];
const vs = new Float32Array(points.length * 3), vectors = [], colors = new Float32Array(points.length * 3), sizes = new Float32Array(points.length), pointMeshes = [], geometriesAttributes = [];
const cache = {};
let maxSize = 0;
let hasColor = false, hasSize = false;
const TEMP_VECTOR = new THREE.Vector3(0, 0, 0);
for (let i = 0, len = points.length; i < len; i++) {
let { coordinate, height, color, size } = points[i];
let { coordinate, height, color, size, coords } = points[i];
const idx = i * 3;
if (color) {
hasColor = true;
color = (color instanceof THREE.Color ? color : new THREE.Color(color));
colors.push(color.r, color.g, color.b);
colors[idx] = color.r;
colors[idx + 1] = color.g;
colors[idx + 2] = color.b;
}
if (size) {
sizes.push(size);
hasSize = true;
sizes[i] = size;
maxSize = Math.max(maxSize, size);

@@ -61,4 +73,10 @@ }

const v = layer.coordinateToVector3(coordinate, z);
const v1 = v.clone().sub(centerPt);
vs.push(v1.x, v1.y, v1.z);
TEMP_VECTOR.x = v.x;
TEMP_VECTOR.y = v.y;
TEMP_VECTOR.z = v.z;
TEMP_VECTOR.sub(centerPt);
// const v1 = v.clone().sub(centerPt);
vs[idx] = TEMP_VECTOR.x;
vs[idx + 1] = TEMP_VECTOR.y;
vs[idx + 2] = TEMP_VECTOR.z;
vectors.push(v);

@@ -73,18 +91,32 @@ geometriesAttributes[i] = {

};
for (let j = 0; j < gridslen; j++) {
if (grids[j].containsCoordinate(coordinate)) {
// grids[j].coordinates.push(coordinate);
grids[j].positions.push(v);
grids[j].indexs.push(i);
break;
}
let row = roundFun(((coords[1] - minY) / averageY), 4);
let col = roundFun(((coords[0] - minX) / averageX), 4);
row -= 1;
col -= 1;
row = Math.max(0, row);
col = Math.max(0, col);
row = Math.ceil(row);
col = Math.ceil(col);
const gridIndex = col * ROWS + row;
if (grids[gridIndex]) {
grids[gridIndex].positions.push(v);
grids[gridIndex].indexs.push(i);
}
// for (let j = 0; j < gridslen; j++) {
// if (grids[j].containsCoordinate(coordinate)) {
// // grids[j].coordinates.push(coordinate);
// grids[j].positions.push(v);
// grids[j].indexs.push(i);
// console.log(j, gridIndex);
// break;
// }
// }
}
const geometry = new THREE.BufferGeometry();
addAttribute(geometry, 'position', new THREE.Float32BufferAttribute(vs, 3, true));
if (colors.length) {
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(geometry, 'position', new THREE.BufferAttribute(vs, 3, true));
if (hasColor) {
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
}
if (sizes.length) {
addAttribute(geometry, 'size', new THREE.Float32BufferAttribute(sizes, 1, true));
if (hasSize) {
addAttribute(geometry, 'size', new THREE.BufferAttribute(sizes, 1, true));
}

@@ -91,0 +123,0 @@ //for identify

@@ -5,2 +5,3 @@ import * as maptalks from 'maptalks';

import { distanceToVector3 } from './util';
import { getPlaneGeometry } from './util/GeometryUtil';
// import { addAttribute } from './util/ThreeAdaptUtil';

@@ -78,3 +79,4 @@ const textureLoader = new THREE.TextureLoader();

const rgbImg = generateImage(image), img = generateImage(texture);
const geometry = new THREE.PlaneBufferGeometry(w, h, imageWidth - 1, imageHeight - 1);
// const geometry = new THREE.PlaneBufferGeometry(w, h, imageWidth - 1, imageHeight - 1);
const geometry = getPlaneGeometry(w, h, imageWidth - 1, imageHeight - 1);
super();

@@ -81,0 +83,0 @@ this._initOptions(options);

@@ -67,2 +67,3 @@ import * as maptalks from 'maptalks';

size?: number;
coords?: number[];
};

@@ -69,0 +70,0 @@ export declare type HeatMapDataType = {

@@ -13,4 +13,4 @@ import * as THREE from 'three';

*/
export declare function initVertexColors(geometry: THREE.BufferGeometry, color: string, _topColor: string, key?: string, v?: number): Array<number>;
export declare function initVertexColors(geometry: THREE.BufferGeometry, color: string, _topColor: string, key?: string, v?: number): Float32Array;
export declare function mergeBarGeometry(geometries: Array<THREE.BufferGeometry>): THREE.BufferGeometry;
export declare function getDefaultBoxGeometry(): THREE.BufferGeometry;

@@ -47,17 +47,33 @@ import * as THREE from 'three';

topColor.setStyle(_topColor);
const colors = [];
const colors = new Float32Array(len);
for (let i = 0; i < len; i += 3) {
const y = position[i + offset];
if (y > v) {
colors.push(topColor.r, topColor.g, topColor.b);
colors[i] = topColor.r;
colors[i + 1] = topColor.g;
colors[i + 2] = topColor.b;
// colors.push(topColor.r, topColor.g, topColor.b);
}
else {
colors.push(bottomColor.r, bottomColor.g, bottomColor.b);
colors[i] = bottomColor.r;
colors[i + 1] = bottomColor.g;
colors[i + 2] = bottomColor.b;
// colors.push(bottomColor.r, bottomColor.g, bottomColor.b);
}
}
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
return colors;
}
export function mergeBarGeometry(geometries) {
const attributes = [], colors = [];
const attributes = [];
const len = geometries.length;
let colorLen = 0;
for (let i = 0; i < len; i++) {
const { color } = geometries[i].attributes;
if (color) {
colorLen += color.array.length;
}
}
const colors = new Float32Array(colorLen);
let offset = 0;
for (let i = 0, len = geometries.length; i < len; i++) {

@@ -67,5 +83,7 @@ const { color, normal, position, uv } = geometries[i].attributes;

if (color) {
for (let j = 0, len1 = color.array.length; j < len1; j++) {
colors.push(color.array[j]);
}
colors.set(color.array, offset);
offset += color.array.length;
// for (let j = 0, len1 = color.array.length; j < len1; j++) {
// colors.push(color.array[j]);
// }
}

@@ -82,3 +100,3 @@ attributes.push({

if (colors.length) {
addAttribute(bufferGeometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(bufferGeometry, 'color', new THREE.BufferAttribute(colors, 3, true));
// for (let i = 0, len = colors.length; i < len; i++) {

@@ -85,0 +103,0 @@ // bufferGeometry.attributes.color.array[i] = colors[i];

import * as maptalks from 'maptalks';
declare type Grids = {
grids: BBox[];
averageX: number;
averageY: number;
ROWS: number;
COLS: number;
};
declare class BBox {

@@ -39,4 +46,4 @@ minlng: number;

*/
static initGrids(minlng: number, minlat: number, maxlng: number, maxlat: number): BBox[];
static initGrids(minlng: number, minlat: number, maxlng: number, maxlat: number): Grids;
}
export default BBox;

@@ -117,3 +117,3 @@ import * as maptalks from 'maptalks';

}
return grids;
return { grids, averageX, averageY, ROWS: ROW, COLS: COL };
}

@@ -120,0 +120,0 @@ }

@@ -27,3 +27,3 @@ import * as THREE from 'three';

*/
export declare function initVertexColors(geometry: THREE.BufferGeometry, color: string, _topColor: string, minZ: number | Array<any>): Array<number>;
export declare function initVertexColors(geometry: THREE.BufferGeometry, color: string, _topColor: string, minZ: number | Array<any>): Float32Array;
/**

@@ -30,0 +30,0 @@ *

@@ -84,5 +84,16 @@ import * as THREE from 'three';

topColor.setStyle(_topColor);
const colors = [];
let colors;
if (Array.isArray(minZ)) {
let colorLen = 0;
for (let i = 0, len = minZ.length; i < len; i++) {
const { count } = minZ[i].position;
colorLen += count * 3;
}
colors = new Float32Array(colorLen);
}
else {
colors = new Float32Array(position.length);
}
if (Array.isArray(minZ)) {
for (let i = 0, len = minZ.length; i < len; i++) {
const { middleZ, start, end } = minZ[i].position;

@@ -108,10 +119,14 @@ for (let j = start; j < end; j += 3) {

if (z > minZ) {
colors.push(topColor.r, topColor.g, topColor.b);
colors[i] = topColor.r;
colors[i + 1] = topColor.g;
colors[i + 2] = topColor.b;
}
else {
colors.push(bottomColor.r, bottomColor.g, bottomColor.b);
colors[i] = bottomColor.r;
colors[i + 1] = bottomColor.g;
colors[i + 2] = bottomColor.b;
}
}
}
addAttribute(geometry, 'color', new THREE.Float32BufferAttribute(colors, 3, true));
addAttribute(geometry, 'color', new THREE.BufferAttribute(colors, 3, true));
return colors;

@@ -118,0 +133,0 @@ }

@@ -16,1 +16,2 @@ import * as maptalks from 'maptalks';

}): number;
export declare function getGeometriesColorArray(geometriesAttributes: any): Float32Array;

@@ -73,2 +73,11 @@ import * as maptalks from 'maptalks';

}
export function getGeometriesColorArray(geometriesAttributes) {
const len = geometriesAttributes.length;
let colorsLen = 0;
for (let i = 0; i < len; i++) {
const { count } = geometriesAttributes[i].position;
colorsLen += count;
}
return new Float32Array(colorsLen * 3);
}
//# sourceMappingURL=index.js.map

@@ -11,3 +11,4 @@ import * as THREE from 'three';

export declare function getLinePosition(lineString: SingleLineStringType | Array<THREE.Vector3>, layer: ThreeLayer, center: maptalks.Coordinate): {
positions: number[];
positions2d: Float32Array;
positions: Float32Array;
positionsV: THREE.Vector3[];

@@ -47,1 +48,2 @@ };

};
export declare function setLineSegmentPosition(position: Array<number>, positionsV: Array<THREE.Vector3>): void;

@@ -13,3 +13,2 @@ import * as THREE from 'three';

export function getLinePosition(lineString, layer, center) {
const positions = [];
const positionsV = [];

@@ -19,3 +18,2 @@ if (Array.isArray(lineString) && lineString[0] instanceof THREE.Vector3) {

const v = lineString[i];
positions.push(v.x, v.y, v.z);
positionsV.push(v);

@@ -33,22 +31,36 @@ }

coordinates = getGeoJSONCoordinates(lineString);
cent = getGeoJSONCenter(lineString);
if (!center) {
cent = getGeoJSONCenter(lineString);
}
}
else if (lineString instanceof maptalks.LineString) {
coordinates = lineString.getCoordinates();
cent = lineString.getCenter();
if (!center) {
cent = lineString.getCenter();
}
}
const centerPt = layer.coordinateToVector3(center || cent);
for (let i = 0, len = coordinates.length; i < len; i++) {
let coordinate = coordinates[i];
if (Array.isArray(coordinate)) {
coordinate = new maptalks.Coordinate(coordinate);
}
const coordinate = coordinates[i];
const v = layer.coordinateToVector3(coordinate, z).sub(centerPt);
positions.push(v.x, v.y, v.z);
// positions.push(v.x, v.y, v.z);
positionsV.push(v);
}
}
const positions = new Float32Array(positionsV.length * 3);
const positions2d = new Float32Array(positionsV.length * 2);
for (let i = 0, len = positionsV.length; i < len; i++) {
const idx = i * 3;
const v = positionsV[i];
positions[idx] = v.x;
positions[idx + 1] = v.y;
positions[idx + 2] = v.z;
const idx1 = i * 2;
positions2d[idx1] = v.x;
positions2d[idx1 + 1] = v.y;
}
return {
positions: positions,
positionsV: positionsV
positions,
positionsV,
positions2d
};

@@ -64,17 +76,8 @@ }

export function getExtrudeLineGeometry(lineString, lineWidth = 1, depth = 1, layer, center) {
const positions = getLinePosition(lineString, layer, center).positionsV;
const ps = [];
for (let i = 0, len = positions.length; i < len; i++) {
const p = positions[i];
ps.push([p.x, p.y]);
}
const { indices, position, normal, uv } = extrudePolyline([ps], {
lineWidth,
depth
});
const { indices, position, normal, uv } = getExtrudeLineParams(lineString, lineWidth, depth, layer, center);
const geometry = new THREE.BufferGeometry();
addAttribute(geometry, 'position', new THREE.Float32BufferAttribute(position, 3));
addAttribute(geometry, 'normal', new THREE.Float32BufferAttribute(normal, 3));
addAttribute(geometry, 'uv', new THREE.Float32BufferAttribute(uv, 2));
geometry.setIndex(new THREE.Uint32BufferAttribute(indices, 1));
addAttribute(geometry, 'position', new THREE.BufferAttribute(position, 3));
addAttribute(geometry, 'normal', new THREE.BufferAttribute(normal, 3));
addAttribute(geometry, 'uv', new THREE.BufferAttribute(uv, 2));
geometry.setIndex(new THREE.BufferAttribute(indices, 1));
return geometry;

@@ -174,2 +177,11 @@ }

}
export function setLineSegmentPosition(position, positionsV) {
for (let i = 0, len = positionsV.length; i < len; i++) {
const v = positionsV[i];
if (i > 0 && i < len - 1) {
position.push(v.x, v.y, v.z);
}
position.push(v.x, v.y, v.z);
}
}
//# sourceMappingURL=LineUtil.js.map

@@ -33,10 +33,13 @@ import * as THREE from 'three';

let indexOffset = 0;
const mergedIndex = [];
const mergedIndex = new Uint32Array(attributesLen['indices']);
for (const name in attributes) {
if (name === 'indices') {
const indices = attributes[name];
let iIndex = 0;
for (let i = 0, len = indices.length; i < len; i++) {
const index = indices[i];
for (let j = 0, len1 = index.length; j < len1; j++) {
mergedIndex.push(index[j] + indexOffset);
mergedIndex[iIndex] = index[j] + indexOffset;
iIndex++;
// mergedIndex.push(index[j] + indexOffset);
}

@@ -53,3 +56,3 @@ indexOffset += attributes['position'][i].length / 3;

}
mergedGeometry['indices'] = new Uint32Array(mergedIndex);
mergedGeometry['indices'] = mergedIndex;
return mergedGeometry;

@@ -56,0 +59,0 @@ }

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

define(["exports"],function(e){"use strict";var y=n,t=n;function n(e,t,n){n=n||2;var r,i,o,a,v,h=t&&t.length,l=h?t[0]*n:e.length,u=p(e,0,l,n,!0),x=[];if(!u||u.next===u.prev)return x;if(h&&(u=function(e,t,n,r){var i,o,a,v,h=[];for(i=0,o=t.length;i<o;i++)a=t[i]*r,v=i<o-1?t[i+1]*r:e.length,(v=p(e,a,v,r,!1))===v.next&&(v.steiner=!0),h.push(function(e){var t=e,n=e;for(;(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next,t!==e;);return n}(v));for(h.sort(m),i=0;i<h.length;i++)!function(e,t){(t=function(e,t){var n,r=t,i=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var v=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(v<=i&&a<v){if((a=v)===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}}while(r=r.next,r!==t);if(!n)return null;if(i===a)return n;var h,l=n,u=n.x,x=n.y,f=1/0;r=n;for(;i>=r.x&&r.x>=u&&i!==r.x&&b(o<x?i:a,o,u,x,o<x?a:i,o,r.x,r.y)&&(h=Math.abs(o-r.y)/(i-r.x),Z(r,e)&&(h<f||h===f&&(r.x>n.x||r.x===n.x&&function(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}(n,r)))&&(n=r,f=h)),r=r.next,r!==l;);return n}(e,t))&&(e=S(t,e),g(t,t.next),g(e,e.next))}(h[i],n),n=g(n,n.next);return n}(e,t,u,n)),e.length>80*n){for(var f=r=e[0],s=i=e[1],c=n;c<l;c+=n)(o=e[c])<f&&(f=o),(a=e[c+1])<s&&(s=a),r<o&&(r=o),i<a&&(i=a);v=0!==(v=Math.max(r-f,i-s))?1/v:0}return d(u,x,n,f,s,v),x}function p(e,t,n,r,i){var o,a;if(i===0<z(e,t,n,r))for(o=t;o<n;o+=r)a=v(o,e[o],e[o+1],a);else for(o=n-r;t<=o;o-=r)a=v(o,e[o],e[o+1],a);return a&&u(a,a.next)&&(f(a),a=a.next),a}function g(e,t){if(!e)return e;t=t||e;var n,r=e;do{if(n=!1,r.steiner||!u(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(f(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function d(e,t,n,r,i,o,a){if(e){!a&&o&&function(e,t,n,r){var i=e;for(;null===i.z&&(i.z=M(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,o,a,v,h,l=1;do{for(n=e,o=e=null,a=0;n;){for(a++,r=n,t=v=0;t<l&&(v++,r=r.nextZ);t++);for(h=l;0<v||0<h&&r;)0!==v&&(0===h||!r||n.z<=r.z)?(n=(i=n).nextZ,v--):(r=(i=r).nextZ,h--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}}while(o.nextZ=null,l*=2,1<a)}(i)}(e,r,i,o);for(var v,h,l=e;e.prev!==e.next;)if(v=e.prev,h=e.next,o?function(e,t,n,r){var i=e.prev,o=e,a=e.next;if(0<=w(i,o,a))return!1;var v=(i.x<o.x?i.x<a.x?i:a:o.x<a.x?o:a).x,h=(i.y<o.y?i.y<a.y?i:a:o.y<a.y?o:a).y,l=(i.x>o.x?i.x>a.x?i:a:o.x>a.x?o:a).x,u=(i.y>o.y?i.y>a.y?i:a:o.y>a.y?o:a).y,x=M(v,h,t,n,r),f=M(l,u,t,n,r),s=e.prevZ,c=e.nextZ;for(;s&&s.z>=x&&c&&c.z<=f;){if(s!==e.prev&&s!==e.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;if(s=s.prevZ,c!==e.prev&&c!==e.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,c.x,c.y)&&0<=w(c.prev,c,c.next))return!1;c=c.nextZ}for(;s&&s.z>=x;){if(s!==e.prev&&s!==e.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.prevZ}for(;c&&c.z<=f;){if(c!==e.prev&&c!==e.next&&b(i.x,i.y,o.x,o.y,a.x,a.y,c.x,c.y)&&0<=w(c.prev,c,c.next))return!1;c=c.nextZ}return!0}(e,r,i,o):function(e){var t=e.prev,n=e,r=e.next;if(0<=w(t,n,r))return!1;var i=e.next.next;for(;i!==e.prev;){if(b(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=w(i.prev,i,i.next))return!1;i=i.next}return!0}(e))t.push(v.i/n),t.push(e.i/n),t.push(h.i/n),f(e),e=h.next,l=h.next;else if((e=h)===l){a?1===a?d(e=function(e,t,n){var r=e;do{var i=r.prev,o=r.next.next}while(!u(i,o)&&x(i,r,r.next,o)&&Z(i,o)&&Z(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),f(r),f(r.next),r=e=o),r=r.next,r!==e);return g(r)}(g(e),t,n),t,n,r,i,o,2):2===a&&function(e,t,n,r,i,o){var a=e;do{for(var v=a.next.next;v!==a.prev;){if(a.i!==v.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&x(n,n.next,e,t))return!0}while(n=n.next,n!==e);return!1}(e,t)&&(Z(e,t)&&Z(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==e;);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||u(e,t)&&0<w(e.prev,e,e.next)&&0<w(t.prev,t,t.next))}(a,v)){var h=S(a,v);return a=g(a,a.next),h=g(h,h.next),d(a,t,n,r,i,o),d(h,t,n,r,i,o)}v=v.next}}while(a=a.next,a!==e)}(e,t,n,r,i,o):d(g(e),t,n,r,i,o,1);break}}}function m(e,t){return e.x-t.x}function M(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function b(e,t,n,r,i,o,a,v){return 0<=(i-a)*(t-v)-(e-a)*(o-v)&&0<=(e-a)*(r-v)-(n-a)*(t-v)&&0<=(n-a)*(o-v)-(i-a)*(r-v)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function u(e,t){return e.x===t.x&&e.y===t.y}function x(e,t,n,r){var i=l(w(e,t,n)),o=l(w(e,t,r)),a=l(w(n,r,e)),v=l(w(n,r,t));return i!==o&&a!==v||(0===i&&h(e,n,t)||(0===o&&h(e,r,t)||(0===a&&h(n,e,r)||!(0!==v||!h(n,t,r)))))}function h(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function l(e){return 0<e?1:e<0?-1:0}function Z(e,t){return w(e.prev,e,e.next)<0?0<=w(e,t,e.next)&&0<=w(e,e.prev,t):w(e,t,e.prev)<0||w(e,e.next,t)<0}function S(e,t){var n=new a(e.i,e.x,e.y),r=new a(t.i,t.x,t.y),i=e.next,o=t.prev;return(e.next=t).prev=e,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function v(e,t,n,r){n=new a(e,t,n);return r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function f(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function a(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function z(e,t,n,r){for(var i=0,o=t,a=n-r;o<n;o+=r)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}function r(e,t){var n=e.length-1,r=[e[0]];return function e(t,n,r,i,o){for(var a,v,h,l,u,x,f,s=i,c=n+1;c<r;c++){var p=(v=t[c],h=t[n],l=t[r],p=f=x=u=void 0,u=h[0],x=h[1],f=l[0]-u,p=l[1]-x,0===f&&0===p||(1<(h=((v[0]-u)*f+(v[1]-x)*p)/(f*f+p*p))?(u=l[0],x=l[1]):0<h&&(u+=f*h,x+=p*h)),(f=v[0]-u)*f+(p=v[1]-x)*p);s<p&&(a=c,s=p)}i<s&&(1<a-n&&e(t,n,a,i,o),o.push(t[a]),1<r-a&&e(t,a,r,i,o))}(e,0,n,t,r),r.push(e[n]),r}function A(e,t,n){if(e.length<=2)return e;t=void 0!==t?t*t:1;return e=r(e=n?e:function(e,t){for(var n,r,i,o=e[0],a=[o],v=1,h=e.length;v<h;v++)n=e[v],r=o,i=void 0,i=n[0]-r[0],r=n[1]-r[1],t<i*i+r*r&&(a.push(n),o=n);return o!==n&&a.push(n),a}(e,t),t)}function R(e,t){var n=t[0],r=t[1],t=Math.sqrt(n*n+r*r);return e[0]=n/t,e[1]=r/t,e}function s(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function F(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}n.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,a=Math.abs(z(e,0,o,n));if(i)for(var v=0,h=t.length;v<h;v++){var l=t[v]*n,u=v<h-1?t[v+1]*n:e.length;a-=Math.abs(z(e,l,u,n))}for(var x=0,v=0;v<r.length;v+=3){var f=r[v]*n,s=r[v+1]*n,c=r[v+2]*n;x+=Math.abs((e[f]-e[c])*(e[1+s]-e[1+f])-(e[f]-e[s])*(e[1+c]-e[1+f]))}return 0===a&&0===x?0:Math.abs((x-a)/a)},n.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)n.vertices.push(e[i][o][a]);0<i&&(r+=e[i-1].length,n.holes.push(r))}return n},y.default=t;var c=[];function ee(e,t,n,r){var i,o,a=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],v=Math.acos(a)*r;return s(c,n,t,-a),r=(o=i=c)[0],n=o[1],a=o[2],o=Math.sqrt(r*r+n*n+a*a),i[0]=r/o,i[1]=n/o,i[2]=a/o,a=e,o=t,t=Math.cos(v),a[0]=o[0]*t,a[1]=o[1]*t,a[2]=o[2]*t,s(e,e,c,Math.sin(v)),e}function q(e,t,n){if(n-t<3)return 0;for(var r=0,i=2*(n-1),o=2*t;o<2*n;){var a=e[i],v=e[i+1],h=e[o],l=e[o+1],i=o;o+=2,r+=a*l-h*v}return r}var B=[],U=[],L=[];function O(e,t,n,r,i,o,a,v){var h=null!=a,l=i,u=null;h&&(u=new Uint32Array(r-n));for(var x=n;x<r;x++){var f=x===r-1?n:x+1,s=x===n?r-1:x-1,c=e[2*s],p=e[2*s+1],g=e[2*x],d=e[2*x+1],s=e[2*f],f=e[2*f+1];B[0]=g-c,B[1]=d-p,U[0]=s-g,U[1]=f-d,R(B,B),R(U,U),h&&(u[x]=l),v||x!==n?v||x!==r-1?(c=U,p=B,(s=L)[0]=c[0]+p[0],s[1]=c[1]+p[1],f=L[1],L[1]=-L[0],L[0]=f,R(L,L),s=L[0]*U[0]+L[1]*U[1],c=Math.sqrt(1-s*s),p=o*Math.min(10,1/c),h&&a<1/c&&o*s<0?(f=g+L[0]*o,s=d+L[1]*o,c=Math.acos(c)/2,c=Math.tan(c)*Math.abs(o),t[2*l]=f+L[1]*c,t[2*l+1]=s-L[0]*c,t[2*++l]=f-L[1]*c,t[2*l+1]=s+L[0]*c):(t[2*l]=g+L[0]*p,t[2*l+1]=d+L[1]*p)):(L[0]=B[1],L[1]=-B[0],R(L,L),t[2*l]=g+L[0]*o,t[2*l+1]=d+L[1]*o):(L[0]=U[1],L[1]=-U[0],R(L,L),t[2*l]=g+L[0]*o,t[2*l+1]=d+L[1]*o),l++}return u}function P(e,t,n,r,i){var o=null!=r?[]:new Float32Array(e.length);if(O(e,o,0,t&&t.length?t[0]:e.length/2,0,n,r,i),t)for(var a=0;a<t.length;a++){var v=t[a];O(e,o,v,t[a+1]||e.length/2,null!=r?o.length/2:v,n,r,i)}return o}function V(e,t,n,r){for(var i=0;i<Math.floor((r-n)/2);i++)for(var o=0;o<t;o++){var a=(i+n)*t+o,v=(r-i-1)*t+o,h=e[a];e[a]=e[v],e[v]=h}return e}function W(e){e.depth=e.depth||1,e.bevelSize=e.bevelSize||0,e.bevelSegments=null==e.bevelSegments?2:e.bevelSegments,e.smoothSide=e.smoothSide||!1,e.smoothBevel=e.smoothBevel||!1,e.simplify=e.simplify||0,"number"==typeof e.depth&&(e.bevelSize=Math.min(0<e.bevelSegments?e.bevelSize:0,e.depth/2)),0<e.bevelSize||(e.bevelSegments=0),e.bevelSegments=Math.round(e.bevelSegments);var t,n,r,i,o=e.boundingRect;e.translate=e.translate||[0,0],e.scale=e.scale||[1,1],e.fitRect&&(t=null==e.fitRect.x?o.x||0:e.fitRect.x,n=null==e.fitRect.y?o.y||0:e.fitRect.y,r=e.fitRect.width,i=e.fitRect.height,null==r?null!=i?r=i/o.height*o.width:(r=o.width,i=o.height):null==i&&(i=r/o.width*o.height),e.scale=[r/o.width,i/o.height],e.translate=[(t-o.x)*e.scale[0],(n-o.y)*e.scale[1]])}function j(e,t){function n(e,t,n,r){e[0]=t,e[1]=n,e[2]=r}for(var r,i,o,a,v,h,l,u=[],x=[],f=[],s=[],c=[],p=[],g=e.length,d=new Float32Array(t.length),y=0;y<g;){var m=3*e[y++],M=3*e[y++],b=3*e[y++];n(u,t[m],t[1+m],t[2+m]),n(x,t[M],t[1+M],t[2+M]),n(f,t[b],t[1+b],t[2+b]),F(s,u,x),F(c,x,f),r=p,o=c,l=h=v=a=void 0,a=(i=s)[0],v=i[1],h=i[2],l=o[0],i=o[1],o=o[2],r[0]=v*o-h*i,r[1]=h*l-a*o,r[2]=a*i-v*l;for(var w=0;w<3;w++)d[m+w]=d[m+w]+p[w],d[M+w]=d[M+w]+p[w],d[b+w]=d[b+w]+p[w]}for(var Z,S,z,A,R,q=0;q<d.length;)n(p,d[q],d[q+1],d[q+2]),R=A=z=void 0,z=(S=Z=p)[0],A=S[1],R=S[2],S=Math.sqrt(z*z+A*A+R*R),Z[0]=z/S,Z[1]=A/S,Z[2]=R/S,d[q++]=p[0],d[q++]=p[1],d[q++]=p[2];return d}var te=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function H(e,t,n,r,i,o){var a=t.vertices,v=t.topVertices,h=t.depth,t=t.rect,l=r-n,u=o.smoothSide?1:2,x=l*u,f=o.smoothBevel?1:2,s=Math.min(h/2,o.bevelSize),c=o.bevelSegments,p=i.vertex,g=Math.max(t.width,t.height,h);if(0<s)for(var d=[0,0,1],y=[],m=[0,0,-1],M=[],b=0,w=new Float32Array(l),Z=0;Z<2;Z++)for(var S=0===Z?h-s:s,z=0;z<=c*f;z++){for(var A=0,R=void 0,q=void 0,F=0;F<l;F++){for(var B=0;B<u;B++){var U=2*((F+B)%l+n);y[0]=a[U]-v[U],y[1]=a[1+U]-v[1+U],y[2]=0;var L=Math.sqrt(y[0]*y[0]+y[1]*y[1]);y[0]/=L,y[1]/=L;var O=(Math.floor(z/f)+z%f)/c;0===Z?ee(M,d,y,O):ee(M,y,m,O);var P=0===Z?O:1-O,V=s*Math.sin(P*Math.PI/2),W=L*Math.cos(P*Math.PI/2),O=s*L/Math.sqrt(V*V+W*W),P=M[0]*O+v[U],L=M[1]*O+v[1+U],V=M[2]*O+S;e.position[3*i.vertex]=P,e.position[3*i.vertex+1]=L,e.position[3*i.vertex+2]=V,(0<F||0<B)&&(A+=Math.sqrt((R-P)*(R-P)+(q-L)*(q-L))),(0<z||0<Z)&&(W=3*(i.vertex-x),U=e.position[W],O=e.position[1+W],W=e.position[2+W],w[F]+=Math.sqrt((U-P)*(U-P)+(O-L)*(O-L)+(W-V)*(W-V))),e.uv[2*i.vertex]=A/g,e.uv[2*i.vertex+1]=w[F]/g,R=P,q=L,i.vertex++}if(1<f&&z%f||1==f&&1<=z)for(var j=0;j<6;j++){var H=(te[j][0]+F*u)%x,k=te[j][1]+b;e.indices[i.index++]=(k-1)*x+H+p}}b++}else for(var I=0;I<2;I++)for(var _=0===I?h-s:s,D=0,E=void 0,C=void 0,G=0;G<l;G++)for(var J=0;J<u;J++){var K=2*((G+J)%l+n),N=a[K],K=a[1+K];e.position[3*i.vertex]=N,e.position[3*i.vertex+1]=K,e.position[3*i.vertex+2]=_,(0<G||0<J)&&(D+=Math.sqrt((E-N)*(E-N)+(C-K)*(C-K))),e.uv[2*i.vertex]=D/g,e.uv[2*i.vertex+1]=_/g,E=N,C=K,i.vertex++}for(var Q=0<s?c*f+1:1,T=0;T<l;T++)for(var X=0;X<6;X++){var Y=(te[X][0]+T*u)%x,$=te[X][1]+Q;e.indices[i.index++]=($-1)*x+Y+p}}function k(e,t){for(var n=0,r=0,i=0;i<e.length;i++){var o=e[i],a=o.indices,v=o.vertices,h=o.holes,o=o.depth,l=v.length/2,u=0<Math.min(o/2,t.bevelSize)?t.bevelSegments:0;n+=a.length*(t.excludeBottom?1:2),r+=l*(t.excludeBottom?1:2);for(var x=2+2*u,f=0,s=0,c=0;c<(h?h.length:0)+1;c++){n+=6*((s=0===c?h&&h.length?h[0]:l:(f=h[c-1],h[c]||l))-f)*(x-1);var p=(s-f)*(t.smoothSide?1:2);r+=p*x+(t.smoothBevel?0:u*p*2)}}for(var g={position:new Float32Array(3*r),indices:new(65535<r?Uint32Array:Uint16Array)(n),uv:new Float32Array(2*r)},d={vertex:0,index:0},y=0;y<e.length;y++)!function(e,t,n,r){var i=e.indices,o=e.vertices,a=e.topVertices,v=e.rect,h=e.depth;if(!(o.length<=4)){for(var l=n.vertex,u=i.length,x=0;x<u;x++)t.indices[n.index++]=l+i[x];for(var f=Math.max(v.width,v.height),s=0;s<(r.excludeBottom?1:2);s++)for(var c=0;c<a.length;c+=2){var p=a[c],g=a[c+1];t.position[3*n.vertex]=p,t.position[3*n.vertex+1]=g,t.position[3*n.vertex+2]=(1-s)*h,t.uv[2*n.vertex]=(p-v.x)/f,t.uv[2*n.vertex+1]=(g-v.y)/f,n.vertex++}if(!r.excludeBottom)for(var d=o.length/2,y=0;y<u;y+=3)for(var m=0;m<3;m++)t.indices[n.index++]=l+d+i[y+2-m]}}(e[y],g,d,t);for(var m=0;m<e.length;m++){var M,b=e[m],w=b.holes,Z=b.vertices.length/2,S=w&&w.length?w[0]:Z;if(H(g,e[m],0,S,d,t),w)for(var z=0;z<w.length;z++)M=w[z],S=w[z+1]||Z,H(g,e[m],M,S,d,t)}for(var A=0;A<g.uv.length;A++){var R=g.uv[A];0<R&&Math.round(R)===R?g.uv[A]=1:g.uv[A]=R%1}return g.normal=j(g.indices,g.position),g.boundingRect=e[0]&&e[0].rect,g}function I(e,t){t=Object.assign({},t);for(var n=[1/0,1/0],r=[-1/0,-1/0],i=0;i<e.length;i++)D(e[i][0],n,r);t.boundingRect=t.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},W(t);for(var o=[],a=t.translate||[0,0],v=t.scale||[1,1],h=t.boundingRect,l={x:h.x*v[0]+a[0],y:h.y*v[1]+a[1],width:h.width*v[0],height:h.height*v[1]},u=Math.min(h.width,h.height)/1e5,x=0;x<e.length;x++){var f=function(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r],o=[],a=i.length,v=i[a-1][0],h=i[a-1][1],l=0,u=0;u<a;u++){var x=i[u][0],f=i[u][1],s=x-v,c=f-h;t<(l+=Math.sqrt(s*s+c*c))&&(o.push(i[u]),l=0),v=x,h=f}3<=o.length&&n.push(o)}return 0<n.length?n:null}(e[x],u);if(f){var s=t.simplify/Math.max(v[0],v[1]);if(f=0<s?function(e,t){for(var n,r=[],i=0;i<e.length;i++)3<=(n=A(n=e[i],t,!0)).length&&r.push(n);return 0<r.length?r:null}(f,s):f){for(var c=y.flatten(f),p=c.vertices,g=c.holes,s=c.dimensions,d=0;d<p.length;)p[d]=p[d++]*v[0]+a[0],p[d]=p[d++]*v[1]+a[1];if(!function(e,t){var n=e.length/2,r=0,i=t&&t.length?t[0]:n;0<q(e,r,i)&&V(e,2,r,i);for(var o=1;o<(t?t.length:0)+1;o++)q(e,r=t[o-1],i=t[o]||n)<0&&V(e,2,r,i)}(p,g),2!==s)throw new Error("Only 2D polygon points are supported");f=0<t.bevelSize?P(p,g,t.bevelSize,null,!0):p,c=(c=s,y(f,g,c=void 0===s?2:c));o.push({indices:c,vertices:p,topVertices:f,holes:g,rect:l,depth:"function"==typeof t.depth?t.depth(x):t.depth})}}}return k(o,t)}function _(e,t){t=Object.assign({},t);for(var n=[1/0,1/0],r=[-1/0,-1/0],i=0;i<e.length;i++)D(e[i],n,r);t.boundingRect=t.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},W(t);var o=t.scale||[1,1];null==t.lineWidth&&(t.lineWidth=1),null==t.miterLimit&&(t.miterLimit=2);for(var a=[],v=0;v<e.length;v++){var h=e[v],l=t.simplify/Math.max(o[0],o[1]);0<l&&(h=A(h,l,!0)),a.push(function(e,t,n){for(var r=n.lineWidth,i=e.length,o=new Float32Array(2*i),a=n.translate||[0,0],v=n.scale||[1,1],h=0,l=0;h<i;h++)o[l++]=e[h][0]*v[0]+a[0],o[l++]=e[h][1]*v[1]+a[1];q(o,0,i)<0&&V(o,2,0,i);var u=[],x=[],f=n.miterLimit,s=O(o,x,0,i,0,-r/2,f,!1);V(o,2,0,i);for(var c=O(o,u,0,i,0,-r/2,f,!1),r=(u.length+x.length)/2,p=new Float32Array(2*r),g=0,d=x.length/2,y=0;y<x.length;y++)p[g++]=x[y];for(var m=0;m<u.length;m++)p[g++]=u[m];for(var M=new(65535<r?Uint32Array:Uint16Array)(3*(2*(i-1)+(r-2*i))),b=0,w=0;w<i-1;w++){var Z=w+1;M[b++]=d-1-s[w],M[b++]=d-1-s[w]-1,M[b++]=c[w]+1+d,M[b++]=d-1-s[w],M[b++]=c[w]+1+d,M[b++]=c[w]+d,c[Z]-c[w]==2?(M[b++]=c[w]+2+d,M[b++]=c[w]+1+d,M[b++]=d-s[Z]-1):s[Z]-s[w]==2&&(M[b++]=c[Z]+d,M[b++]=d-1-(s[w]+1),M[b++]=d-1-(s[w]+2))}return f=0<n.bevelSize?P(p,[],n.bevelSize,null,!0):p,r=n.boundingRect,{vertices:p,indices:M,topVertices:f,rect:{x:r.x*v[0]+a[0],y:r.y*v[1]+a[1],width:r.width*v[0],height:r.height*v[1]},depth:"function"==typeof n.depth?n.depth(t):n.depth,holes:[]}}(h,v,t))}return k(a,t)}function D(e,t,n){for(var r=0;r<e.length;r++)t[0]=Math.min(e[r][0],t[0]),t[1]=Math.min(e[r][1],t[1]),n[0]=Math.max(e[r][0],n[0]),n[1]=Math.max(e[r][1],n[1])}function E(e){for(var t=new Float32Array(e),n=[],r=0,i=t.length;r<i;r+=2){var o=t[r],a=t[r+1];n.push([o,a])}return n}function C(e,t){void 0===t&&(t=!1);for(var n,r,i,o,a,v=e.length,h=[],l=[],u=[],x=0,f=0,s=0,c=0,p=0,g=0;g<v;g++){var d=t?(n=e[g],i=o=r=a=o=i=r=void 0,r=n.data,i=n.height,o=n.width,a=n.bottomHeight,n=_(r,{lineWidth:o,depth:i}),r=n.position,o=n.normal,i=n.uv,n=n.indices,G(r,a),{position:r,normal:o,uv:i,indices:n}):(y=e[g],b=M=m=b=d=M=m=void 0,m=y.data,M=y.height,d=y.bottomHeight,b=I(m,{depth:M}),y=b.position,m=b.normal,M=b.uv,b=b.indices,G(y,d),{position:y,normal:m,uv:M,indices:b}),p=Math.min(p,e[g].bottomHeight||0),y=d.position,m=d.normal,M=d.uv,b=d.indices;l.push(d);b=b.length/3;u[g]=[x+1,x+b],x+=b;y=y.length/3,m=m.length/3,M=M.length/2;h[g]={position:{count:y,start:f,end:f+3*y},normal:{count:m,start:s,end:s+3*m},uv:{count:M,start:c,end:c+2*M},hide:!1},f+=3*y,s+=3*m,c+=2*M}var w=function(e){for(var t={},n={},r=0;r<e.length;++r){var i,o=e[r];for(i in o)void 0===t[i]&&(t[i]=[],n[i]=0),t[i].push(o[i]),n[i]+=o[i].length}var a,v={},h=0,l=[];for(a in t)if("indices"===a)for(var u=t[a],x=0,f=u.length;x<f;x++){for(var s=u[x],c=0,p=s.length;c<p;c++)l.push(s[c]+h);h+=t.position[x].length/3}else{var g=function(e,t){for(var n=new Float32Array(t),r=0,i=0;i<e.length;++i)n.set(e[i],r),r+=e[i].length;return n}(t[a],n[a]);if(!g)return null;v[a]=g}return v.indices=new Uint32Array(l),v}(l),Z=w.position,S=w.normal,z=w.uv,w=w.indices;return{position:Z.buffer,normal:S.buffer,uv:z.buffer,indices:w.buffer,faceMap:u,geometriesAttributes:h,minZ:p}}function G(e,t){if(void 0!==t&&"number"==typeof t&&0!==t)for(var n=0,r=e.length;n<r;n+=3)e[n+2]+=t}e.initialize=function(){},e.onmessage=function(e,t){var n=e.data,e=n.type,r=n.datas;if("Polygon"===e){!function(e){for(var t=e.length,n=0;n<t;n++)for(var r=e[n].data,i=0,o=r.length;i<o;i++)for(var a=r[i],v=0,h=a.length;v<h;v++)e[n].data[i][v]=E(a[v])}(r);n=C(r);t(null,n,[n.position,n.normal,n.uv,n.indices])}else if("LineString"===e){for(var i=0,o=r.length;i<o;i++)for(var a=0,v=r[i].data.length;a<v;a++)r[i].data[a]=E(r[i].data[a]);e=C(r,!0);t(null,e,[e.position,e.normal,e.uv,e.indices])}},Object.defineProperty(e,"__esModule",{value:!0})});
define(["exports"],function(e){"use strict";var d=n,t=n;function n(e,t,n){n=n||2;var r,i,o,a,v,h=t&&t.length,l=h?t[0]*n:e.length,u=p(e,0,l,n,!0),x=[];if(!u||u.next===u.prev)return x;if(h&&(u=function(e,t,n,r){var i,o,a,v,h=[];for(i=0,o=t.length;i<o;i++)a=t[i]*r,v=i<o-1?t[i+1]*r:e.length,(v=p(e,a,v,r,!1))===v.next&&(v.steiner=!0),h.push(function(e){var t=e,n=e;for(;(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next,t!==e;);return n}(v));for(h.sort(m),i=0;i<h.length;i++)!function(e,t){(t=function(e,t){var n,r=t,i=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var v=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(v<=i&&a<v){if((a=v)===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}}while(r=r.next,r!==t);if(!n)return null;if(i===a)return n;var h,l=n,u=n.x,x=n.y,f=1/0;r=n;for(;i>=r.x&&r.x>=u&&i!==r.x&&M(o<x?i:a,o,u,x,o<x?a:i,o,r.x,r.y)&&(h=Math.abs(o-r.y)/(i-r.x),Z(r,e)&&(h<f||h===f&&(r.x>n.x||r.x===n.x&&function(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}(n,r)))&&(n=r,f=h)),r=r.next,r!==l;);return n}(e,t))&&(e=S(t,e),g(t,t.next),g(e,e.next))}(h[i],n),n=g(n,n.next);return n}(e,t,u,n)),e.length>80*n){for(var f=r=e[0],s=i=e[1],c=n;c<l;c+=n)(o=e[c])<f&&(f=o),(a=e[c+1])<s&&(s=a),r<o&&(r=o),i<a&&(i=a);v=0!==(v=Math.max(r-f,i-s))?1/v:0}return y(u,x,n,f,s,v),x}function p(e,t,n,r,i){var o,a;if(i===0<z(e,t,n,r))for(o=t;o<n;o+=r)a=v(o,e[o],e[o+1],a);else for(o=n-r;t<=o;o-=r)a=v(o,e[o],e[o+1],a);return a&&u(a,a.next)&&(f(a),a=a.next),a}function g(e,t){if(!e)return e;t=t||e;var n,r=e;do{if(n=!1,r.steiner||!u(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(f(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function y(e,t,n,r,i,o,a){if(e){!a&&o&&function(e,t,n,r){for(var i=e;null===i.z&&(i.z=b(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,o,a,v,h,l=1;do{for(n=e,o=e=null,a=0;n;){for(a++,r=n,t=v=0;t<l&&(v++,r=r.nextZ);t++);for(h=l;0<v||0<h&&r;)0!==v&&(0===h||!r||n.z<=r.z)?(n=(i=n).nextZ,v--):(r=(i=r).nextZ,h--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}}while(o.nextZ=null,l*=2,1<a)}(i)}(e,r,i,o);for(var v,h,l=e;e.prev!==e.next;)if(v=e.prev,h=e.next,o?function(e,t,n,r){var i=e.prev,o=e,a=e.next;if(0<=w(i,o,a))return!1;var v=(i.x<o.x?i.x<a.x?i:a:o.x<a.x?o:a).x,h=(i.y<o.y?i.y<a.y?i:a:o.y<a.y?o:a).y,l=(i.x>o.x?i.x>a.x?i:a:o.x>a.x?o:a).x,u=(i.y>o.y?i.y>a.y?i:a:o.y>a.y?o:a).y,x=b(v,h,t,n,r),f=b(l,u,t,n,r),s=e.prevZ,c=e.nextZ;for(;s&&s.z>=x&&c&&c.z<=f;){if(s!==e.prev&&s!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;if(s=s.prevZ,c!==e.prev&&c!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,c.x,c.y)&&0<=w(c.prev,c,c.next))return!1;c=c.nextZ}for(;s&&s.z>=x;){if(s!==e.prev&&s!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,s.x,s.y)&&0<=w(s.prev,s,s.next))return!1;s=s.prevZ}for(;c&&c.z<=f;){if(c!==e.prev&&c!==e.next&&M(i.x,i.y,o.x,o.y,a.x,a.y,c.x,c.y)&&0<=w(c.prev,c,c.next))return!1;c=c.nextZ}return!0}(e,r,i,o):function(e){var t=e.prev,n=e,r=e.next;if(0<=w(t,n,r))return!1;var i=e.next.next;for(;i!==e.prev;){if(M(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=w(i.prev,i,i.next))return!1;i=i.next}return!0}(e))t.push(v.i/n),t.push(e.i/n),t.push(h.i/n),f(e),e=h.next,l=h.next;else if((e=h)===l){a?1===a?y(e=function(e,t,n){var r=e;do{var i=r.prev,o=r.next.next}while(!u(i,o)&&x(i,r,r.next,o)&&Z(i,o)&&Z(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),f(r),f(r.next),r=e=o),r=r.next,r!==e);return g(r)}(g(e),t,n),t,n,r,i,o,2):2===a&&function(e,t,n,r,i,o){var a=e;do{for(var v=a.next.next;v!==a.prev;){if(a.i!==v.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&x(n,n.next,e,t))return!0}while(n=n.next,n!==e);return!1}(e,t)&&(Z(e,t)&&Z(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==e;);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||u(e,t)&&0<w(e.prev,e,e.next)&&0<w(t.prev,t,t.next))}(a,v)){var h=S(a,v);return a=g(a,a.next),h=g(h,h.next),y(a,t,n,r,i,o),y(h,t,n,r,i,o)}v=v.next}}while((a=a.next)!==e)}(e,t,n,r,i,o):y(g(e),t,n,r,i,o,1);break}}}function m(e,t){return e.x-t.x}function b(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function M(e,t,n,r,i,o,a,v){return 0<=(i-a)*(t-v)-(e-a)*(o-v)&&0<=(e-a)*(r-v)-(n-a)*(t-v)&&0<=(n-a)*(o-v)-(i-a)*(r-v)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function u(e,t){return e.x===t.x&&e.y===t.y}function x(e,t,n,r){var i=l(w(e,t,n)),o=l(w(e,t,r)),a=l(w(n,r,e)),v=l(w(n,r,t));return i!==o&&a!==v||(0===i&&h(e,n,t)||(0===o&&h(e,r,t)||(0===a&&h(n,e,r)||!(0!==v||!h(n,t,r)))))}function h(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function l(e){return 0<e?1:e<0?-1:0}function Z(e,t){return w(e.prev,e,e.next)<0?0<=w(e,t,e.next)&&0<=w(e,e.prev,t):w(e,t,e.prev)<0||w(e,e.next,t)<0}function S(e,t){var n=new a(e.i,e.x,e.y),r=new a(t.i,t.x,t.y),i=e.next,o=t.prev;return(e.next=t).prev=e,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function v(e,t,n,r){n=new a(e,t,n);return r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function f(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function a(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function z(e,t,n,r){for(var i=0,o=t,a=n-r;o<n;o+=r)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}function r(e,t){var n=e.length-1,r=[e[0]];return function e(t,n,r,i,o){for(var a,v,h,l,u,x,f,s=i,c=n+1;c<r;c++){var p=(v=t[c],h=t[n],l=t[r],p=f=x=u=void 0,u=h[0],x=h[1],f=l[0]-u,p=l[1]-x,0===f&&0===p||(1<(h=((v[0]-u)*f+(v[1]-x)*p)/(f*f+p*p))?(u=l[0],x=l[1]):0<h&&(u+=f*h,x+=p*h)),(f=v[0]-u)*f+(p=v[1]-x)*p);s<p&&(a=c,s=p)}i<s&&(1<a-n&&e(t,n,a,i,o),o.push(t[a]),1<r-a&&e(t,a,r,i,o))}(e,0,n,t,r),r.push(e[n]),r}function A(e,t,n){if(e.length<=2)return e;t=void 0!==t?t*t:1;return e=r(e=n?e:function(e,t){for(var n,r,i,o,a=e[0],v=[a],h=1,l=e.length;h<l;h++)n=e[h],i=a,o=void 0,o=(r=n)[0]-i[0],i=r[1]-i[1],t<o*o+i*i&&(v.push(n),a=n);return a!==n&&v.push(n),v}(e,t),t)}function R(e,t){var n=t[0],r=t[1],t=Math.sqrt(n*n+r*r);return e[0]=n/t,e[1]=r/t,e}function s(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function F(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}n.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,a=Math.abs(z(e,0,o,n));if(i)for(var v=0,h=t.length;v<h;v++){var l=t[v]*n,u=v<h-1?t[v+1]*n:e.length;a-=Math.abs(z(e,l,u,n))}for(var x=0,v=0;v<r.length;v+=3){var f=r[v]*n,s=r[v+1]*n,c=r[v+2]*n;x+=Math.abs((e[f]-e[c])*(e[1+s]-e[1+f])-(e[f]-e[s])*(e[1+c]-e[1+f]))}return 0===a&&0===x?0:Math.abs((x-a)/a)},n.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)n.vertices.push(e[i][o][a]);0<i&&(r+=e[i-1].length,n.holes.push(r))}return n},d.default=t;var c=[];function ee(e,t,n,r){var i,o,a=(o=n,(i=t)[0]*o[0]+i[1]*o[1]+i[2]*o[2]),v=Math.acos(a)*r;return s(c,n,t,-a),r=(o=i=c)[0],n=o[1],a=o[2],o=Math.sqrt(r*r+n*n+a*a),i[0]=r/o,i[1]=n/o,i[2]=a/o,a=e,o=t,t=Math.cos(v),a[0]=o[0]*t,a[1]=o[1]*t,a[2]=o[2]*t,s(e,e,c,Math.sin(v)),e}function q(e,t,n){if(n-t<3)return 0;for(var r=0,i=2*(n-1),o=2*t;o<2*n;){var a=e[i],v=e[i+1],h=e[o],l=e[o+1],i=o;o+=2,r+=a*l-h*v}return r}var B=[],U=[],L=[];function O(e,t,n,r,i,o,a,v){var h=null!=a,l=i,u=null;h&&(u=new Uint32Array(r-n));for(var x=n;x<r;x++){var f=x===r-1?n:x+1,s=x===n?r-1:x-1,c=e[2*s],p=e[2*s+1],g=e[2*x],d=e[2*x+1],s=e[2*f],f=e[2*f+1];B[0]=g-c,B[1]=d-p,U[0]=s-g,U[1]=f-d,R(B,B),R(U,U),h&&(u[x]=l),v||x!==n?v||x!==r-1?(c=U,p=B,(s=L)[0]=c[0]+p[0],s[1]=c[1]+p[1],f=L[1],L[1]=-L[0],L[0]=f,R(L,L),s=U,p=(c=L)[0]*s[0]+c[1]*s[1],f=Math.sqrt(1-p*p),c=o*Math.min(10,1/f),h&&a<1/f&&o*p<0?(s=g+L[0]*o,p=d+L[1]*o,f=Math.acos(f)/2,f=Math.tan(f)*Math.abs(o),t[2*l]=s+L[1]*f,t[2*l+1]=p-L[0]*f,t[2*++l]=s-L[1]*f,t[2*l+1]=p+L[0]*f):(t[2*l]=g+L[0]*c,t[2*l+1]=d+L[1]*c)):(L[0]=B[1],L[1]=-B[0],R(L,L),t[2*l]=g+L[0]*o,t[2*l+1]=d+L[1]*o):(L[0]=U[1],L[1]=-U[0],R(L,L),t[2*l]=g+L[0]*o,t[2*l+1]=d+L[1]*o),l++}return u}function P(e,t,n,r,i){var o=null!=r?[]:new Float32Array(e.length);if(O(e,o,0,t&&t.length?t[0]:e.length/2,0,n,r,i),t)for(var a=0;a<t.length;a++){var v=t[a];O(e,o,v,t[a+1]||e.length/2,null!=r?o.length/2:v,n,r,i)}return o}function V(e,t,n,r){for(var i=0;i<Math.floor((r-n)/2);i++)for(var o=0;o<t;o++){var a=(i+n)*t+o,v=(r-i-1)*t+o,h=e[a];e[a]=e[v],e[v]=h}return e}function W(e){e.depth=e.depth||1,e.bevelSize=e.bevelSize||0,e.bevelSegments=null==e.bevelSegments?2:e.bevelSegments,e.smoothSide=e.smoothSide||!1,e.smoothBevel=e.smoothBevel||!1,e.simplify=e.simplify||0,"number"==typeof e.depth&&(e.bevelSize=Math.min(0<e.bevelSegments?e.bevelSize:0,e.depth/2)),0<e.bevelSize||(e.bevelSegments=0),e.bevelSegments=Math.round(e.bevelSegments);var t,n,r,i,o=e.boundingRect;e.translate=e.translate||[0,0],e.scale=e.scale||[1,1],e.fitRect&&(t=null==e.fitRect.x?o.x||0:e.fitRect.x,n=null==e.fitRect.y?o.y||0:e.fitRect.y,r=e.fitRect.width,i=e.fitRect.height,null==r?null!=i?r=i/o.height*o.width:(r=o.width,i=o.height):null==i&&(i=r/o.width*o.height),e.scale=[r/o.width,i/o.height],e.translate=[(t-o.x)*e.scale[0],(n-o.y)*e.scale[1]])}function j(e,t){function n(e,t,n,r){e[0]=t,e[1]=n,e[2]=r}for(var r,i,o,a,v,h,l,u=[],x=[],f=[],s=[],c=[],p=[],g=e.length,d=new Float32Array(t.length),y=0;y<g;){var m=3*e[y++],b=3*e[y++],M=3*e[y++];n(u,t[m],t[1+m],t[2+m]),n(x,t[b],t[1+b],t[2+b]),n(f,t[M],t[1+M],t[2+M]),F(s,u,x),F(c,x,f),r=p,o=c,l=h=v=a=void 0,a=(i=s)[0],v=i[1],h=i[2],l=o[0],i=o[1],o=o[2],r[0]=v*o-h*i,r[1]=h*l-a*o,r[2]=a*i-v*l;for(var w=0;w<3;w++)d[m+w]=d[m+w]+p[w],d[b+w]=d[b+w]+p[w],d[M+w]=d[M+w]+p[w]}for(var Z,S,z,A,R,q=0;q<d.length;)n(p,d[q],d[q+1],d[q+2]),R=A=z=void 0,z=(S=Z=p)[0],A=S[1],R=S[2],S=Math.sqrt(z*z+A*A+R*R),Z[0]=z/S,Z[1]=A/S,Z[2]=R/S,d[q++]=p[0],d[q++]=p[1],d[q++]=p[2];return d}var te=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function H(e,t,n,r,i,o){var a=t.vertices,v=t.topVertices,h=t.depth,t=t.rect,l=r-n,u=o.smoothSide?1:2,x=l*u,f=o.smoothBevel?1:2,s=Math.min(h/2,o.bevelSize),c=o.bevelSegments,p=i.vertex,g=Math.max(t.width,t.height,h);if(0<s)for(var d=[0,0,1],y=[],m=[0,0,-1],b=[],M=0,w=new Float32Array(l),Z=0;Z<2;Z++)for(var S=0===Z?h-s:s,z=0;z<=c*f;z++){for(var A=0,R=void 0,q=void 0,F=0;F<l;F++){for(var B=0;B<u;B++){var U=2*((F+B)%l+n);y[0]=a[U]-v[U],y[1]=a[1+U]-v[1+U],y[2]=0;var L=Math.sqrt(y[0]*y[0]+y[1]*y[1]);y[0]/=L,y[1]/=L;var O=(Math.floor(z/f)+z%f)/c;0===Z?ee(b,d,y,O):ee(b,y,m,O);var P=0===Z?O:1-O,V=s*Math.sin(P*Math.PI/2),W=L*Math.cos(P*Math.PI/2),O=s*L/Math.sqrt(V*V+W*W),P=b[0]*O+v[U],L=b[1]*O+v[1+U],V=b[2]*O+S;e.position[3*i.vertex]=P,e.position[3*i.vertex+1]=L,e.position[3*i.vertex+2]=V,(0<F||0<B)&&(A+=Math.sqrt((R-P)*(R-P)+(q-L)*(q-L))),(0<z||0<Z)&&(W=3*(i.vertex-x),U=e.position[W],O=e.position[1+W],W=e.position[2+W],w[F]+=Math.sqrt((U-P)*(U-P)+(O-L)*(O-L)+(W-V)*(W-V))),e.uv[2*i.vertex]=A/g,e.uv[2*i.vertex+1]=w[F]/g,R=P,q=L,i.vertex++}if(1<f&&z%f||1==f&&1<=z)for(var j=0;j<6;j++){var H=(te[j][0]+F*u)%x,k=te[j][1]+M;e.indices[i.index++]=(k-1)*x+H+p}}M++}else for(var I=0;I<2;I++)for(var _=0===I?h-s:s,D=0,E=void 0,C=void 0,G=0;G<l;G++)for(var J=0;J<u;J++){var K=2*((G+J)%l+n),N=a[K],K=a[1+K];e.position[3*i.vertex]=N,e.position[3*i.vertex+1]=K,e.position[3*i.vertex+2]=_,(0<G||0<J)&&(D+=Math.sqrt((E-N)*(E-N)+(C-K)*(C-K))),e.uv[2*i.vertex]=D/g,e.uv[2*i.vertex+1]=_/g,E=N,C=K,i.vertex++}for(var Q=0<s?c*f+1:1,T=0;T<l;T++)for(var X=0;X<6;X++){var Y=(te[X][0]+T*u)%x,$=te[X][1]+Q;e.indices[i.index++]=($-1)*x+Y+p}}function k(e,t){for(var n=0,r=0,i=0;i<e.length;i++){var o=e[i],a=o.indices,v=o.vertices,h=o.holes,o=o.depth,l=v.length/2,u=0<Math.min(o/2,t.bevelSize)?t.bevelSegments:0;n+=a.length*(t.excludeBottom?1:2),r+=l*(t.excludeBottom?1:2);for(var x=2+2*u,f=0,s=0,c=0;c<(h?h.length:0)+1;c++){n+=6*((s=0===c?h&&h.length?h[0]:l:(f=h[c-1],h[c]||l))-f)*(x-1);var p=(s-f)*(t.smoothSide?1:2);r+=p*x+(t.smoothBevel?0:u*p*2)}}for(var g={position:new Float32Array(3*r),indices:new(65535<r?Uint32Array:Uint16Array)(n),uv:new Float32Array(2*r)},d={vertex:0,index:0},y=0;y<e.length;y++)!function(e,t,n,r){var i=e.indices,o=e.vertices,a=e.topVertices,v=e.rect,h=e.depth;if(!(o.length<=4)){for(var l=n.vertex,u=i.length,x=0;x<u;x++)t.indices[n.index++]=l+i[x];for(var f=Math.max(v.width,v.height),s=0;s<(r.excludeBottom?1:2);s++)for(var c=0;c<a.length;c+=2){var p=a[c],g=a[c+1];t.position[3*n.vertex]=p,t.position[3*n.vertex+1]=g,t.position[3*n.vertex+2]=(1-s)*h,t.uv[2*n.vertex]=(p-v.x)/f,t.uv[2*n.vertex+1]=(g-v.y)/f,n.vertex++}if(!r.excludeBottom)for(var d=o.length/2,y=0;y<u;y+=3)for(var m=0;m<3;m++)t.indices[n.index++]=l+d+i[y+2-m]}}(e[y],g,d,t);for(var m=0;m<e.length;m++){var b,M=e[m],w=M.holes,Z=M.vertices.length/2,S=w&&w.length?w[0]:Z;if(H(g,e[m],0,S,d,t),w)for(var z=0;z<w.length;z++)b=w[z],S=w[z+1]||Z,H(g,e[m],b,S,d,t)}for(var A=0;A<g.uv.length;A++){var R=g.uv[A];0<R&&Math.round(R)===R?g.uv[A]=1:g.uv[A]=R%1}return g.normal=j(g.indices,g.position),g.boundingRect=e[0]&&e[0].rect,g}function I(e,t){t=Object.assign({},t);for(var n=[1/0,1/0],r=[-1/0,-1/0],i=0;i<e.length;i++)D(e[i][0],n,r);t.boundingRect=t.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},W(t);for(var o=[],a=t.translate||[0,0],v=t.scale||[1,1],h=t.boundingRect,l={x:h.x*v[0]+a[0],y:h.y*v[1]+a[1],width:h.width*v[0],height:h.height*v[1]},u=Math.min(h.width,h.height)/1e5,x=0;x<e.length;x++){var f=function(e,t){for(var n=[],r=0;r<e.length;r++){for(var i=e[r],o=[],a=i.length,v=i[a-1][0],h=i[a-1][1],l=0,u=0;u<a;u++){var x=i[u][0],f=i[u][1],s=x-v,c=f-h;t<(l+=Math.sqrt(s*s+c*c))&&(o.push(i[u]),l=0),v=x,h=f}3<=o.length&&n.push(o)}return 0<n.length?n:null}(e[x],u);if(f){var s=t.simplify/Math.max(v[0],v[1]);if(f=0<s?function(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];3<=(i=A(i,t,!0)).length&&n.push(i)}return 0<n.length?n:null}(f,s):f){for(var c=d.flatten(f),p=c.vertices,s=c.holes,f=c.dimensions,g=0;g<p.length;)p[g]=p[g++]*v[0]+a[0],p[g]=p[g++]*v[1]+a[1];if(!function(e,t){var n=e.length/2,r=0,i=t&&t.length?t[0]:n;0<q(e,r,i)&&V(e,2,r,i);for(var o=1;o<(t?t.length:0)+1;o++)q(e,r=t[o-1],i=t[o]||n)<0&&V(e,2,r,i)}(p,s),2!==f)throw new Error("Only 2D polygon points are supported");c=0<t.bevelSize?P(p,s,t.bevelSize,null,!0):p,f=d(c,s,f=void 0===(f=f)?2:f);o.push({indices:f,vertices:p,topVertices:c,holes:s,rect:l,depth:"function"==typeof t.depth?t.depth(x):t.depth})}}}return k(o,t)}function _(e,t){t=Object.assign({},t);for(var n=[1/0,1/0],r=[-1/0,-1/0],i=0;i<e.length;i++)D(e[i],n,r);t.boundingRect=t.boundingRect||{x:n[0],y:n[1],width:r[0]-n[0],height:r[1]-n[1]},W(t);var o=t.scale||[1,1];null==t.lineWidth&&(t.lineWidth=1),null==t.miterLimit&&(t.miterLimit=2);for(var a=[],v=0;v<e.length;v++){var h=e[v],l=t.simplify/Math.max(o[0],o[1]);0<l&&(h=A(h,l,!0)),a.push(function(e,t,n){for(var r=n.lineWidth,i=e.length,o=new Float32Array(2*i),a=n.translate||[0,0],v=n.scale||[1,1],h=0,l=0;h<i;h++)o[l++]=e[h][0]*v[0]+a[0],o[l++]=e[h][1]*v[1]+a[1];q(o,0,i)<0&&V(o,2,0,i);var u=[],x=[],f=n.miterLimit,s=O(o,x,0,i,0,-r/2,f,!1);V(o,2,0,i);for(var c=O(o,u,0,i,0,-r/2,f,!1),r=(u.length+x.length)/2,p=new Float32Array(2*r),g=0,d=x.length/2,y=0;y<x.length;y++)p[g++]=x[y];for(var m=0;m<u.length;m++)p[g++]=u[m];for(var b=new(65535<r?Uint32Array:Uint16Array)(3*(2*(i-1)+(r-2*i))),M=0,w=0;w<i-1;w++){var Z=w+1;b[M++]=d-1-s[w],b[M++]=d-1-s[w]-1,b[M++]=c[w]+1+d,b[M++]=d-1-s[w],b[M++]=c[w]+1+d,b[M++]=c[w]+d,c[Z]-c[w]==2?(b[M++]=c[w]+2+d,b[M++]=c[w]+1+d,b[M++]=d-s[Z]-1):s[Z]-s[w]==2&&(b[M++]=c[Z]+d,b[M++]=d-1-(s[w]+1),b[M++]=d-1-(s[w]+2))}return f=0<n.bevelSize?P(p,[],n.bevelSize,null,!0):p,r=n.boundingRect,{vertices:p,indices:b,topVertices:f,rect:{x:r.x*v[0]+a[0],y:r.y*v[1]+a[1],width:r.width*v[0],height:r.height*v[1]},depth:"function"==typeof n.depth?n.depth(t):n.depth,holes:[]}}(h,v,t))}return k(a,t)}function D(e,t,n){for(var r=0;r<e.length;r++)t[0]=Math.min(e[r][0],t[0]),t[1]=Math.min(e[r][1],t[1]),n[0]=Math.max(e[r][0],n[0]),n[1]=Math.max(e[r][1],n[1])}function E(e){for(var t=new Float32Array(e),n=[],r=0,i=t.length;r<i;r+=2){var o=t[r],a=t[r+1];n.push([o,a])}return n}function C(e,t){void 0===t&&(t=!1);for(var n,r,i,o,a=e.length,v=[],h=[],l=[],u=0,x=0,f=0,s=0,c=0;c<a;c++){var p=t?(p=e[c],r=i=n=o=i=r=n=void 0,n=p.data,r=p.height,i=p.width,o=p.bottomHeight,p=_(n,{lineWidth:i,depth:r}),n=p.position,i=p.normal,r=p.uv,p=p.indices,G(n,o),{position:n,normal:i,uv:r,indices:p}):(d=e[c],b=m=y=b=g=m=y=void 0,y=d.data,m=d.height,g=d.bottomHeight,b=I(y,{depth:m}),d=b.position,y=b.normal,m=b.uv,b=b.indices,G(d,g),{position:d,normal:y,uv:m,indices:b}),g=e[c].bottomHeight||0,d=p.position,y=p.normal,m=p.uv,b=p.indices;h.push(p);b=b.length/3;l[c]=[u+1,u+b],u+=b;d=d.length/3,y=y.length/3,m=m.length/2;v[c]={position:{middleZ:g+(e[c].height||0)/2,count:d,start:x,end:x+3*d},normal:{count:y,start:f,end:f+3*y},uv:{count:m,start:s,end:s+2*m},hide:!1},x+=3*d,f+=3*y,s+=2*m}var M=function(e){for(var t={},n={},r=0;r<e.length;++r){var i,o=e[r];for(i in o)void 0===t[i]&&(t[i]=[],n[i]=0),t[i].push(o[i]),n[i]+=o[i].length}var a,v={},h=0,l=[];for(a in t)if("indices"===a)for(var u=t[a],x=0,f=u.length;x<f;x++){for(var s=u[x],c=0,p=s.length;c<p;c++)l.push(s[c]+h);h+=t.position[x].length/3}else{var g=function(e,t){for(var n=new Float32Array(t),r=0,i=0;i<e.length;++i)n.set(e[i],r),r+=e[i].length;return n}(t[a],n[a]);if(!g)return null;v[a]=g}return v.indices=new Uint32Array(l),v}(h),w=M.position,Z=M.normal,S=M.uv,M=M.indices;return{position:w.buffer,normal:Z.buffer,uv:S.buffer,indices:M.buffer,faceMap:l,geometriesAttributes:v}}function G(e,t){if(void 0!==t&&"number"==typeof t&&0!==t)for(var n=0,r=e.length;n<r;n+=3)e[n+2]+=t}e.initialize=function(){},e.onmessage=function(e,t){var n=e.data,e=n.type,r=n.datas;if("Polygon"===e){!function(e){for(var t=e.length,n=0;n<t;n++)for(var r=e[n].data,i=0,o=r.length;i<o;i++)for(var a=r[i],v=0,h=a.length;v<h;v++)e[n].data[i][v]=E(a[v])}(r);n=C(r);t(null,n,[n.position,n.normal,n.uv,n.indices])}else if("LineString"===e){for(var i=0,o=r.length;i<o;i++)for(var a=0,v=r[i].data.length;a<v;a++)r[i].data[a]=E(r[i].data[a]);e=C(r,!0);t(null,e,[e.position,e.normal,e.uv,e.indices])}},Object.defineProperty(e,"__esModule",{value:!0})});

@@ -120,10 +120,5 @@ import * as maptalks from 'maptalks';

const lineString = multiLineString[j];
const positionsV = getLinePosition(lineString, layer, center).positionsV;
const array = new Float32Array(positionsV.length * 2);
for (let j = 0, len1 = positionsV.length; j < len1; j++) {
array[j * 2] = positionsV[j].x;
array[j * 2 + 1] = positionsV[j].y;
}
transfer.push(array);
data.push(array);
const positions2d = getLinePosition(lineString, layer, center).positions2d;
transfer.push(positions2d);
data.push(positions2d);
}

@@ -130,0 +125,0 @@ datas.push({

{
"name": "maptalks.three",
"version": "0.17.1",
"version": "0.17.2",
"description": "A maptalks Layer to render with THREE.js.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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