@pirireis/webglobeplugins 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/{angle-calculation.ts → angle-calculation.js} +14 -18
- package/Math/{arc-cdf-points.ts → arc-cdf-points.js} +272 -329
- package/Math/{arc-generate-points-exponantial.ts → arc-generate-points-exponantial.js} +254 -299
- package/Math/{arc.ts → arc.js} +292 -421
- package/Math/bounds/line-bbox.js +186 -225
- package/Math/{circle-cdf-points.ts → circle-cdf-points.js} +78 -143
- package/Math/{circle.ts → circle.js} +33 -49
- package/Math/{constants.ts → constants.js} +4 -12
- package/Math/contour/{quadtreecontours.ts → quadtreecontours.js} +300 -371
- package/Math/contour/quadtreecontours1.js +298 -336
- package/Math/{finite-line-2d.ts → finite-line-2d.js} +58 -68
- package/Math/{haversine.ts → haversine.js} +22 -33
- package/Math/index.js +1 -0
- package/Math/juction/{arc-plane.ts → arc-plane.js} +143 -203
- package/Math/juction/{line-sphere.ts → line-sphere.js} +22 -32
- package/Math/juction/{plane-plane.ts → plane-plane.js} +53 -62
- package/Math/{line.ts → line.js} +52 -84
- package/Math/matrix4.js +1 -0
- package/Math/{methods.ts → methods.js} +126 -182
- package/Math/{plane.ts → plane.js} +56 -92
- package/Math/{quaternion.ts → quaternion.js} +106 -128
- package/Math/templete-shapes/{grid-visually-equal.ts → grid-visually-equal.js} +65 -118
- package/Math/tessellation/constants.js +1 -0
- package/Math/tessellation/{methods.ts → methods.js} +49 -79
- package/Math/tessellation/{nearest-value-padding.ts → nearest-value-padding.js} +112 -147
- package/Math/tessellation/{spherical-triangle-area.ts → spherical-triangle-area.js} +99 -127
- package/Math/tessellation/{tile-merger.ts → tile-merger.js} +429 -578
- package/Math/tessellation/{triangle-tessellation.ts → triangle-tessellation.js} +386 -533
- package/Math/tessellation/types.js +1 -0
- package/Math/types.js +1 -0
- package/Math/utils.js +2 -3
- package/Math/{vec3.ts → vec3.js} +155 -227
- package/Math/{xyz-tile.ts → xyz-tile.js} +18 -26
- package/algorithms/search-binary.js +16 -14
- package/altitude-locator/adaptors.js +1 -0
- package/altitude-locator/keymethod.js +1 -0
- package/altitude-locator/plugin.js +344 -445
- package/altitude-locator/types.js +21 -26
- package/compass-rose/compass-rose-padding-flat.js +230 -274
- package/compass-rose/{compass-text-writer.ts → compass-text-writer.js} +155 -210
- package/compass-rose/index.js +3 -3
- package/{constants.ts → constants.js} +6 -8
- package/heatwave/datamanager.js +149 -168
- package/heatwave/heatwave.js +206 -261
- package/heatwave/index.js +5 -5
- package/heatwave/isobar.js +303 -340
- package/heatwave/{texture-point-sampler.ts → texture-point-sampler.js} +187 -220
- package/investigation-tools/draw/tiles/adapters.js +67 -0
- package/investigation-tools/draw/tiles/{tiles.ts → tiles.js} +128 -162
- package/jest.config.js +7 -6
- package/package.json +1 -1
- package/pin/pin-object-array1.js +300 -381
- package/pin/pin-point-totem1.js +60 -77
- package/programs/arrowfield/arrow-field.js +60 -89
- package/programs/arrowfield/logic.js +141 -173
- package/programs/data2legend/density-to-legend.js +68 -86
- package/programs/data2legend/point-to-density-texture.js +67 -84
- package/programs/float2legendwithratio/index.js +2 -3
- package/programs/float2legendwithratio/logic.js +118 -144
- package/programs/float2legendwithratio/object.js +104 -141
- package/programs/helpers/blender.js +58 -73
- package/programs/helpers/{fadeaway.ts → fadeaway.js} +60 -73
- package/programs/index.js +20 -19
- package/programs/line-on-globe/circle-accurate-3d.js +85 -112
- package/programs/line-on-globe/circle-accurate-flat.js +148 -200
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +102 -134
- package/programs/line-on-globe/index.js +1 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +80 -99
- package/programs/line-on-globe/linestrip/data.js +4 -0
- package/programs/line-on-globe/linestrip/{linestrip.ts → linestrip.js} +93 -152
- package/programs/line-on-globe/{naive-accurate-flexible.ts → naive-accurate-flexible.js} +126 -175
- package/programs/line-on-globe/util.js +5 -8
- package/programs/picking/pickable-polygon-renderer.js +98 -129
- package/programs/picking/pickable-renderer.js +98 -130
- package/programs/point-on-globe/element-globe-surface-glow.js +93 -122
- package/programs/point-on-globe/element-point-glow.js +80 -114
- package/programs/point-on-globe/square-pixel-point.js +121 -139
- package/programs/polygon-on-globe/{texture-dem-triangles.ts → texture-dem-triangles.js} +163 -207
- package/programs/{programcache.ts → programcache.js} +126 -134
- package/programs/rings/index.js +1 -1
- package/programs/rings/partial-ring/{piece-of-pie.ts → piece-of-pie.js} +152 -222
- package/programs/totems/camera-totem-attactment-interface.js +1 -0
- package/programs/totems/{camerauniformblock.ts → camerauniformblock.js} +225 -310
- package/programs/totems/{canvas-webglobe-info.ts → canvas-webglobe-info.js} +132 -147
- package/programs/totems/{dem-textures-manager.ts → dem-textures-manager.js} +257 -360
- package/programs/totems/{globe-changes.ts → globe-changes.js} +59 -79
- package/programs/totems/gpu-selection-uniform-block.js +99 -127
- package/programs/totems/{index.ts → index.js} +2 -2
- package/programs/two-d/pixel-padding-for-compass.js +87 -101
- package/programs/util.js +14 -19
- package/programs/vectorfields/logics/{constants.ts → constants.js} +4 -5
- package/programs/vectorfields/logics/{drawrectangleparticles.ts → drawrectangleparticles.js} +80 -115
- package/programs/vectorfields/logics/index.js +2 -4
- package/programs/vectorfields/logics/particle-ubo.js +16 -0
- package/programs/vectorfields/logics/{pixelbased.ts → pixelbased.js} +86 -115
- package/programs/vectorfields/logics/ubo.js +51 -57
- package/programs/vectorfields/{pingpongbuffermanager.ts → pingpongbuffermanager.js} +99 -113
- package/range-tools-on-terrain/bearing-line/{adapters.ts → adapters.js} +114 -154
- package/range-tools-on-terrain/bearing-line/{plugin.ts → plugin.js} +457 -569
- package/range-tools-on-terrain/bearing-line/types.js +1 -0
- package/range-tools-on-terrain/circle-line-chain/{adapters.ts → adapters.js} +85 -104
- package/range-tools-on-terrain/circle-line-chain/{chain-list-map.ts → chain-list-map.js} +382 -446
- package/range-tools-on-terrain/circle-line-chain/{plugin.ts → plugin.js} +464 -607
- package/range-tools-on-terrain/circle-line-chain/types.js +1 -0
- package/range-tools-on-terrain/range-ring/{adapters.ts → adapters.js} +93 -114
- package/range-tools-on-terrain/range-ring/{enum.ts → enum.js} +2 -2
- package/range-tools-on-terrain/range-ring/{plugin.ts → plugin.js} +377 -444
- package/range-tools-on-terrain/range-ring/rangeringangletext.js +331 -0
- package/range-tools-on-terrain/range-ring/types.js +9 -0
- package/semiplugins/interface.js +1 -0
- package/semiplugins/lightweight/{line-plugin.ts → line-plugin.js} +221 -342
- package/semiplugins/lightweight/{piece-of-pie-plugin.ts → piece-of-pie-plugin.js} +200 -275
- package/semiplugins/shape-on-terrain/{arc-plugin.ts → arc-plugin.js} +481 -616
- package/semiplugins/shape-on-terrain/{circle-plugin.ts → circle-plugin.js} +444 -588
- package/semiplugins/shape-on-terrain/{padding-1-degree.ts → padding-1-degree.js} +539 -713
- package/semiplugins/shape-on-terrain/terrain-polygon/{adapters.ts → adapters.js} +55 -69
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{cache.ts → cache.js} +102 -149
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{index-polygon-map.ts → index-polygon-map.js} +45 -58
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{manager.ts → manager.js} +4 -4
- package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.js +177 -196
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{polygon-to-triangles.ts → polygon-to-triangles.js} +100 -144
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{random.ts → random.js} +121 -165
- package/semiplugins/shape-on-terrain/terrain-polygon/data/types.js +1 -0
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{worker-contact.ts → worker-contact.js} +63 -81
- package/semiplugins/shape-on-terrain/terrain-polygon/data/worker.js +125 -146
- package/semiplugins/shape-on-terrain/terrain-polygon/{terrain-polygon.ts → terrain-polygon.js} +219 -265
- package/semiplugins/shape-on-terrain/terrain-polygon/types.js +8 -0
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/semiplugins/shell/bbox-renderer/{logic.ts → logic.js} +209 -273
- package/semiplugins/shell/bbox-renderer/object.js +75 -0
- package/semiplugins/type.js +1 -0
- package/semiplugins/utility/{container-plugin.ts → container-plugin.js} +94 -126
- package/semiplugins/utility/{object-pass-container-plugin.ts → object-pass-container-plugin.js} +80 -101
- package/shaders/fragment-toy/firework.js +1 -1
- package/shaders/fragment-toy/singularity.js +2 -5
- package/tracks/point-heat-map/adaptors/timetracksplugin-format-to-this.js +63 -78
- package/tracks/point-heat-map/index.js +1 -0
- package/tracks/point-heat-map/plugin-webworker.js +121 -148
- package/tracks/point-heat-map/point-to-heat-map-flow.js +121 -150
- package/tracks/point-tracks/key-methods.js +2 -3
- package/tracks/point-tracks/plugin.js +401 -487
- package/tracks/timetracks/adaptors-line-strip.js +65 -79
- package/tracks/timetracks/plugin-line-strip.js +240 -295
- package/tracks/timetracks/program-line-strip.js +411 -495
- package/tracks/timetracks/programpoint-line-strip.js +109 -137
- package/types.js +19 -0
- package/util/account/bufferoffsetmanager.js +176 -209
- package/util/account/create-buffermap-orchastration.js +39 -0
- package/util/account/index.js +3 -6
- package/util/account/single-attribute-buffer-management/{buffer-manager.ts → buffer-manager.js} +119 -151
- package/util/account/single-attribute-buffer-management/{buffer-orchestrator.ts → buffer-orchestrator.js} +212 -238
- package/util/account/single-attribute-buffer-management/{buffer-orchestrator1.ts → buffer-orchestrator1.js} +159 -184
- package/util/account/single-attribute-buffer-management/{index.ts → index.js} +4 -11
- package/util/account/single-attribute-buffer-management/{object-store.ts → object-store.js} +55 -76
- package/util/account/single-attribute-buffer-management/types.js +1 -0
- package/util/account/util.js +18 -22
- package/util/algorithms/index.js +1 -0
- package/util/algorithms/search-binary.js +25 -26
- package/util/build-strategy/{static-dynamic.ts → static-dynamic.js} +41 -50
- package/util/check/index.js +1 -0
- package/util/check/typecheck.js +66 -0
- package/util/{frame-counter-trigger.ts → frame-counter-trigger.js} +84 -99
- package/util/geometry/{index.ts → index.js} +121 -155
- package/util/gl-util/buffer/{attribute-loader.ts → attribute-loader.js} +62 -84
- package/util/gl-util/buffer/{index.ts → index.js} +3 -6
- package/util/gl-util/draw-options/{methods.ts → methods.js} +32 -47
- package/util/gl-util/uniform-block/{manager.ts → manager.js} +200 -232
- package/util/{globe-default-gl-states.ts → globe-default-gl-states.js} +4 -5
- package/util/{helper-methods.ts → helper-methods.js} +8 -9
- package/util/index.js +10 -9
- package/util/interpolation/index.js +1 -0
- package/util/interpolation/timetrack/index.js +2 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +79 -94
- package/util/interpolation/timetrack/web-worker.js +46 -51
- package/util/picking/{fence.ts → fence.js} +43 -47
- package/util/picking/{picker-displayer.ts → picker-displayer.js} +176 -226
- package/util/programs/draw-from-pixel-coords.js +164 -201
- package/util/programs/{draw-texture-on-canvas.ts → draw-texture-on-canvas.js} +69 -91
- package/util/programs/supersampletotextures.js +97 -130
- package/util/programs/texturetoglobe.js +128 -153
- package/util/shaderfunctions/{geometrytransformations.ts → geometrytransformations.js} +44 -106
- package/util/shaderfunctions/index.js +2 -2
- package/util/shaderfunctions/nodata.js +2 -4
- package/util/shaderfunctions/noisefunctions.js +7 -10
- package/util/{webglobjectbuilders.ts → webglobjectbuilders.js} +358 -446
- package/vectorfield/arrowfield/adaptor.js +11 -11
- package/vectorfield/arrowfield/index.js +3 -3
- package/vectorfield/arrowfield/plugin.js +83 -128
- package/vectorfield/waveparticles/adaptor.js +15 -16
- package/vectorfield/waveparticles/index.js +3 -3
- package/vectorfield/waveparticles/{plugin.ts → plugin.js} +415 -506
- package/vectorfield/wind/adapters/{image-to-fields.ts → image-to-fields.js} +61 -74
- package/vectorfield/wind/adapters/types.js +1 -0
- package/vectorfield/wind/{imagetovectorfieldandmagnitude.ts → imagetovectorfieldandmagnitude.js} +53 -78
- package/vectorfield/wind/index.js +5 -5
- package/vectorfield/wind/{plugin-persistant copy.ts → plugin-persistant copy.js } +364 -461
- package/vectorfield/wind/{plugin-persistant.ts → plugin-persistant.js} +375 -483
- package/vectorfield/wind/plugin.js +685 -883
- package/vectorfield/wind/vectorfieldimage.js +23 -27
- package/write-text/{context-text-bulk.ts → context-text-bulk.js} +200 -285
- package/write-text/context-text3.js +167 -0
- package/write-text/{context-text4.ts → context-text4.js} +146 -231
- package/write-text/context-textDELETE.js +94 -125
- package/write-text/objectarraylabels/{index.ts → index.js} +2 -2
- package/write-text/objectarraylabels/objectarraylabels.js +200 -247
- package/Math/matrix4.ts +0 -0
- package/Math/mesh/mapbox-delaunay.d.ts +0 -74
- package/Math/roadmap.md +0 -10
- package/Math/tessellation/constants.ts +0 -1
- package/Math/tessellation/roadmap.md +0 -48
- package/Math/tessellation/types.ts +0 -1
- package/Math/types.ts +0 -68
- package/investigation-tools/draw/tiles/adapters.ts +0 -133
- package/programs/line-on-globe/linestrip/data.ts +0 -29
- package/programs/polygon-on-globe/roadmap.md +0 -8
- package/programs/totems/camera-totem-attactment-interface.ts +0 -4
- package/programs/vectorfields/logics/particle-ubo.ts +0 -23
- package/publish.bat +0 -62
- package/range-tools-on-terrain/bearing-line/types.ts +0 -65
- package/range-tools-on-terrain/circle-line-chain/types.ts +0 -43
- package/range-tools-on-terrain/range-ring/rangeringangletext.ts +0 -396
- package/range-tools-on-terrain/range-ring/types.ts +0 -30
- package/semiplugins/interface.ts +0 -14
- package/semiplugins/shape-on-terrain/goal.md +0 -12
- package/semiplugins/shape-on-terrain/terrain-polygon/data/cache-shortcuts.md +0 -20
- package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.ts +0 -209
- package/semiplugins/shape-on-terrain/terrain-polygon/data/readme.md +0 -5
- package/semiplugins/shape-on-terrain/terrain-polygon/data/types.ts +0 -37
- package/semiplugins/shape-on-terrain/terrain-polygon/notes.md +0 -90
- package/semiplugins/shape-on-terrain/terrain-polygon/types.ts +0 -69
- package/semiplugins/shell/bbox-renderer/index.ts +0 -2
- package/semiplugins/shell/bbox-renderer/object.ts +0 -129
- package/semiplugins/type.ts +0 -8
- package/terrain-plugin.mmd +0 -83
- package/tests/Math/arc-sampling-test.js +0 -367
- package/tests/Math/arc-sampling-test.ts +0 -429
- package/tests/Math/arc.test.ts +0 -77
- package/tests/Math/junction/arc-limit.test.ts +0 -7
- package/tests/Math/junction/arc-plane-points.test.ts +0 -196
- package/tests/Math/junction/arc-plane.test.ts +0 -172
- package/tests/Math/junction/line-sphere.test.ts +0 -127
- package/tests/Math/junction/plane-plane.test.ts +0 -91
- package/tests/Math/plane-test.ts +0 -17
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -33
- package/tracks/point-heat-map/readme.md +0 -15
- package/tracks/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types/@pirireis/webglobe.d.ts +0 -102
- package/types/delaunator.d.ts +0 -40
- package/types/earcut.d.ts +0 -11
- package/types/rbush.d.ts +0 -57
- package/types.ts +0 -319
- package/util/account/create-buffermap-orchastration.ts +0 -85
- package/util/account/single-attribute-buffer-management/types.ts +0 -43
- package/util/check/typecheck.ts +0 -74
- package/vectorfield/wind/adapters/types.ts +0 -12
- package/write-text/context-text3.ts +0 -252
- package/write-text/objectarraylabels/objectarraylabels.d.ts +0 -72
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import {CSObjectArrayUpdateTypes} from "@pirireis/webglobe";
|
|
3
|
-
import { ENUM_HIDE, ENUM_TEXT_HIDE } from "./enum";
|
|
4
|
-
import {Globe,
|
|
5
|
-
ObjectArray,
|
|
6
|
-
DataBucketObjectArray as DataBucket,
|
|
7
|
-
StyleObjectArray as Style,
|
|
8
|
-
LabelObjectArray as Label,
|
|
9
|
-
LayerObjectObjectArray as LayerObject
|
|
10
|
-
} from "../../types";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// Type definitions for enum values
|
|
14
|
-
type EnumHideType = typeof ENUM_HIDE[keyof typeof ENUM_HIDE];
|
|
15
|
-
type EnumTextHideType = typeof ENUM_TEXT_HIDE[keyof typeof ENUM_TEXT_HIDE];
|
|
16
|
-
|
|
17
|
-
const fidKey = "__fid__";
|
|
18
|
-
|
|
19
|
-
// Type definitions
|
|
20
|
-
|
|
21
|
-
interface RingData {
|
|
22
|
-
centerID: string;
|
|
23
|
-
stepAngle: number;
|
|
24
|
-
long: number;
|
|
25
|
-
lat: number;
|
|
26
|
-
rings: { radius: number }[];
|
|
27
|
-
hide?: EnumHideType;
|
|
28
|
-
textHide?: EnumTextHideType;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface CenterData {
|
|
32
|
-
centerID: string;
|
|
33
|
-
long: number;
|
|
34
|
-
lat: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface CenterHide {
|
|
38
|
-
centerID: string;
|
|
39
|
-
hide?: EnumHideType | null;
|
|
40
|
-
textHide?: EnumTextHideType | null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface ConstructorOptions {
|
|
44
|
-
style?: Style | null;
|
|
45
|
-
hideAll?: boolean;
|
|
46
|
-
opacity?: number;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface CenterMapData {
|
|
50
|
-
stepAngle: number;
|
|
51
|
-
maxRadius: number;
|
|
52
|
-
long: number;
|
|
53
|
-
lat: number;
|
|
54
|
-
hide: EnumHideType;
|
|
55
|
-
textHide: EnumTextHideType;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const object: Omit<LayerObject, 'style' | 'id'> = {
|
|
59
|
-
"displayName": "RangeRingAngleText",
|
|
60
|
-
"layerType": 3,
|
|
61
|
-
"wkbGeom": null,
|
|
62
|
-
"wfsLayerName": null,
|
|
63
|
-
"objectType": "point",
|
|
64
|
-
"bbox": null,
|
|
65
|
-
"startLod": 2,
|
|
66
|
-
"endLod": 30,
|
|
67
|
-
"continuousLOD": true,
|
|
68
|
-
"MVTXYZName": "hd_seyp",
|
|
69
|
-
"rasterize": false,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default class RangeRingAngleText {
|
|
73
|
-
private globe: Globe;
|
|
74
|
-
private ObjectArray: ObjectArray;
|
|
75
|
-
private id: string;
|
|
76
|
-
private _hideAll: boolean;
|
|
77
|
-
private _opacity: number;
|
|
78
|
-
private object: LayerObject;
|
|
79
|
-
private _centerCollection: Map<string, Map<keyof CenterMapData, any>>;
|
|
80
|
-
|
|
81
|
-
constructor(globe: Globe, id: string, { style = null, hideAll = false, opacity = 1 }: ConstructorOptions = {}) {
|
|
82
|
-
this.globe = globe;
|
|
83
|
-
this.ObjectArray = globe.ObjectArray;
|
|
84
|
-
this.id = id;
|
|
85
|
-
|
|
86
|
-
this._hideAll = hideAll;
|
|
87
|
-
this._opacity = opacity;
|
|
88
|
-
const style_: Style = style !== null ? style : this.getDefaultStyle();
|
|
89
|
-
this.object = Object.assign({}, object, { style: style_, id: this.id }) as LayerObject;
|
|
90
|
-
|
|
91
|
-
this._centerCollection = new Map();
|
|
92
|
-
// new inner MAP params
|
|
93
|
-
// hide
|
|
94
|
-
// textHide
|
|
95
|
-
this.ObjectArray.Add(this.object);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getDefaultStyle(): Style {
|
|
99
|
-
const style: Style = this.ObjectArray.GetDefaultStyle();
|
|
100
|
-
style.fidKey = fidKey;
|
|
101
|
-
const { labels } = style;
|
|
102
|
-
const label: Label = labels[0];
|
|
103
|
-
label.offset = { x: 0, y: 0 };
|
|
104
|
-
label.fontFamily.hollowWidth = 1;
|
|
105
|
-
label.vAlignment = 2;
|
|
106
|
-
label.hAlignment = 2;
|
|
107
|
-
label.size = 17;
|
|
108
|
-
// eslint-disable-next-line
|
|
109
|
-
label.text = "`${aci}`"
|
|
110
|
-
|
|
111
|
-
return style;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
setStyle(style: Style | null): void {
|
|
115
|
-
if (style === null) return;
|
|
116
|
-
style.opacity = this._opacity;
|
|
117
|
-
this.object.style = style;
|
|
118
|
-
this.ObjectArray.StyleChanged(this.object);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
setOpacity(opacity: number): void {
|
|
122
|
-
this._opacity = opacity;
|
|
123
|
-
const { style } = this.object;
|
|
124
|
-
style.opacity = opacity;
|
|
125
|
-
this.ObjectArray.StyleChanged(this.object);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
free(): void {
|
|
129
|
-
this.flush();
|
|
130
|
-
this.ObjectArray.Delete(this.id);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @param ringDatas Array of ring data objects
|
|
135
|
-
* centerID: string | ObjectArray fidKey de kullanilir
|
|
136
|
-
* stepAngle: number | 0-360 arasinda
|
|
137
|
-
* long,lat: number | merkez koordinatlari lat long radian. Globe icin dereceye iceride cevrilir
|
|
138
|
-
* rings: Array<{radius: number}> | En buyuk halkaya centik acilari yazilir, Sonraki adim yaricaplarin uzunlugunu yazdirmak
|
|
139
|
-
*
|
|
140
|
-
* eger bir centerID zaten var ise: Onceki noktalar dusurulur ve yeniden eklenir
|
|
141
|
-
*/
|
|
142
|
-
insertBulk(ringDatas: RingData[]): void {
|
|
143
|
-
const { _hideAll } = this;
|
|
144
|
-
const addBucket: DataBucket = {
|
|
145
|
-
coords: [],
|
|
146
|
-
coordsZ: [],
|
|
147
|
-
attribs: []
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const deleteBucket: DataBucket = {
|
|
151
|
-
coords: [],
|
|
152
|
-
coordsZ: [],
|
|
153
|
-
attribs: []
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
for (const { centerID, long, lat, rings, stepAngle, hide = ENUM_HIDE.SHOW, textHide = ENUM_TEXT_HIDE.SHOW } of ringDatas) {
|
|
157
|
-
if (this._centerCollection.has(centerID)) {
|
|
158
|
-
this._fillDeleteBucket(centerID, deleteBucket);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const maxRadius: number = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
|
|
162
|
-
const textHide_: EnumTextHideType = _hideAll ? ENUM_TEXT_HIDE.HIDE : textHide;
|
|
163
|
-
const show: boolean = hide !== ENUM_HIDE.HIDE && textHide_ === ENUM_TEXT_HIDE.SHOW;
|
|
164
|
-
if (show) this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
|
|
165
|
-
this._centerCollection.set(centerID,
|
|
166
|
-
new Map([
|
|
167
|
-
["stepAngle", stepAngle],
|
|
168
|
-
["maxRadius", maxRadius],
|
|
169
|
-
["long", long],
|
|
170
|
-
["lat", lat],
|
|
171
|
-
["hide", hide],
|
|
172
|
-
["textHide", textHide_]
|
|
173
|
-
]));
|
|
174
|
-
}
|
|
175
|
-
if (this._hideAll) return;
|
|
176
|
-
if (deleteBucket.coords.length > 0) this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
|
|
177
|
-
if (addBucket.coords.length > 0) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* @param centerDatas Array of center data objects
|
|
182
|
-
* aci ve radiuslarin tutulmasi gereklidir.
|
|
183
|
-
*/
|
|
184
|
-
updateCentersXY(centerDatas: CenterData[]): void {
|
|
185
|
-
const updateBucket: DataBucket = {
|
|
186
|
-
coords: [],
|
|
187
|
-
coordsZ: [],
|
|
188
|
-
attribs: []
|
|
189
|
-
}
|
|
190
|
-
for (const { centerID, long, lat } of centerDatas) {
|
|
191
|
-
if (this._centerCollection.has(centerID)) {
|
|
192
|
-
const centerMap = this._centerCollection.get(centerID)!;
|
|
193
|
-
centerMap.set("long", long);
|
|
194
|
-
centerMap.set("lat", lat);
|
|
195
|
-
const hide: EnumHideType = centerMap.get("hide");
|
|
196
|
-
const textHide: EnumTextHideType = centerMap.get("textHide");
|
|
197
|
-
const isHidden: boolean = hide === ENUM_HIDE.HIDE || textHide === ENUM_TEXT_HIDE.HIDE;
|
|
198
|
-
if (isHidden) continue;
|
|
199
|
-
const maxRadius: number = centerMap.get("maxRadius");
|
|
200
|
-
const stepAngle: number = centerMap.get("stepAngle");
|
|
201
|
-
// long, lat, radius, step, centerID, outBucket
|
|
202
|
-
this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// for (const attribs of updateBucket.attribs) {
|
|
206
|
-
// delete attribs["aci"];
|
|
207
|
-
// }
|
|
208
|
-
if (updateBucket.coords.length > 0) {
|
|
209
|
-
this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* @param centerHides Array of center hide data
|
|
215
|
-
*/
|
|
216
|
-
updateCentersHide(centerHides: CenterHide[]): void {
|
|
217
|
-
if (this._hideAll) {
|
|
218
|
-
console.warn("Tum mesafe halkasi yazilari gizli durum. Islem yapilamaz");
|
|
219
|
-
return;
|
|
220
|
-
};
|
|
221
|
-
const addBucket: DataBucket = {
|
|
222
|
-
coords: [],
|
|
223
|
-
coordsZ: [],
|
|
224
|
-
attribs: []
|
|
225
|
-
};
|
|
226
|
-
const deleteBucket: DataBucket = {
|
|
227
|
-
coords: [],
|
|
228
|
-
coordsZ: [],
|
|
229
|
-
attribs: []
|
|
230
|
-
};
|
|
231
|
-
for (const { centerID, textHide = null, hide = null } of centerHides) {
|
|
232
|
-
if (!this._centerCollection.has(centerID)) continue;
|
|
233
|
-
const centerMap = this._centerCollection.get(centerID)!;
|
|
234
|
-
|
|
235
|
-
const isHidden: boolean = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
|
|
236
|
-
|
|
237
|
-
const _hide: EnumHideType = hide !== null ? hide : centerMap.get("hide");
|
|
238
|
-
const _textHide: EnumTextHideType = textHide !== null ? textHide : centerMap.get("textHide");
|
|
239
|
-
|
|
240
|
-
const show: boolean = (_hide !== ENUM_HIDE.HIDE) && (_textHide === ENUM_TEXT_HIDE.SHOW);
|
|
241
|
-
if (!isHidden && !show) {
|
|
242
|
-
this._fillDeleteBucket(centerID, deleteBucket);
|
|
243
|
-
} else if (isHidden && show) {
|
|
244
|
-
this._appendCircle(centerMap.get("long"), centerMap.get("lat"), centerMap.get("maxRadius"), centerMap.get("stepAngle"), centerID, addBucket);
|
|
245
|
-
}
|
|
246
|
-
if (hide !== null) centerMap.set("hide", hide);
|
|
247
|
-
if (textHide !== null) centerMap.set("textHide", textHide);
|
|
248
|
-
}
|
|
249
|
-
if (deleteBucket.coords.length > 0) this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
|
|
250
|
-
if (addBucket.coords.length > 0) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// TODO : Implement this
|
|
254
|
-
removeCenters(centerIDs: string[]): void {
|
|
255
|
-
const deleteBucket: DataBucket = {
|
|
256
|
-
coords: [],
|
|
257
|
-
coordsZ: [],
|
|
258
|
-
attribs: []
|
|
259
|
-
}
|
|
260
|
-
for (const centerID of centerIDs) {
|
|
261
|
-
if (this._centerCollection.has(centerID)) {
|
|
262
|
-
this._fillDeleteBucket(centerID, deleteBucket);
|
|
263
|
-
this._centerCollection.delete(centerID);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
hideAll(): void {
|
|
270
|
-
this._hideAll = true;
|
|
271
|
-
const deleteBucket: DataBucket = {
|
|
272
|
-
coords: [],
|
|
273
|
-
coordsZ: [],
|
|
274
|
-
attribs: []
|
|
275
|
-
}
|
|
276
|
-
for (const [centerID, centerMap] of this._centerCollection) {
|
|
277
|
-
const hide: EnumHideType = centerMap.get("hide");
|
|
278
|
-
const hideText: EnumTextHideType = centerMap.get("textHide");
|
|
279
|
-
centerMap.set("textHide", ENUM_TEXT_HIDE.HIDE);
|
|
280
|
-
if (hide === ENUM_HIDE.HIDE) continue;
|
|
281
|
-
const isHidden: boolean = hideText === ENUM_TEXT_HIDE.HIDE;
|
|
282
|
-
if (!isHidden) this._fillDeleteBucket(centerID, deleteBucket);
|
|
283
|
-
}
|
|
284
|
-
this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
showAll(): void {
|
|
288
|
-
this._hideAll = false;
|
|
289
|
-
const addBucket: DataBucket = {
|
|
290
|
-
coords: [],
|
|
291
|
-
coordsZ: [],
|
|
292
|
-
attribs: []
|
|
293
|
-
}
|
|
294
|
-
for (const [centerID, centerMap] of this._centerCollection) {
|
|
295
|
-
const hide: EnumHideType = centerMap.get("hide");
|
|
296
|
-
if (hide === ENUM_HIDE.HIDE) continue;
|
|
297
|
-
const hideText: EnumTextHideType = centerMap.get("textHide");
|
|
298
|
-
const isHidden: boolean = hideText === ENUM_TEXT_HIDE.HIDE;
|
|
299
|
-
if (isHidden) {
|
|
300
|
-
const long: number = centerMap.get("long");
|
|
301
|
-
const lat: number = centerMap.get("lat");
|
|
302
|
-
const maxRadius: number = centerMap.get("maxRadius");
|
|
303
|
-
const stepAngle: number = centerMap.get("stepAngle");
|
|
304
|
-
this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
|
|
305
|
-
centerMap.set("hide", ENUM_HIDE.SHOW);
|
|
306
|
-
centerMap.set("textHide", ENUM_TEXT_HIDE.SHOW);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (addBucket.coords.length) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
flush(): void {
|
|
313
|
-
const data: DataBucket = {
|
|
314
|
-
coords: [],
|
|
315
|
-
coordsZ: [],
|
|
316
|
-
attribs: []
|
|
317
|
-
};
|
|
318
|
-
this.ObjectArray.SetData(this.object, data);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
//------------------PRIVATE METHODS------------------//
|
|
322
|
-
|
|
323
|
-
private _appendCircle(long: number, lat: number, radius: number, step: number, centerID: string, outBucket: DataBucket): void {
|
|
324
|
-
this.__realCoords(long, lat, radius, step, centerID, outBucket);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
private __realCoords(longCenter: number, latCenter: number, radius: number, stepAngle: number, centerID: string, outBucket: DataBucket): void {
|
|
328
|
-
const { globe } = this;
|
|
329
|
-
const { coords, coordsZ, attribs } = outBucket;
|
|
330
|
-
let i = 1;
|
|
331
|
-
for (let aci = stepAngle; aci < 360; aci += stepAngle) {
|
|
332
|
-
const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, aci);
|
|
333
|
-
coords.push(long, lat);
|
|
334
|
-
coordsZ.push(0);
|
|
335
|
-
const key: string = this._key(centerID, i); i++;
|
|
336
|
-
// fidkey is the key
|
|
337
|
-
attribs.push({
|
|
338
|
-
"__fid__": key,
|
|
339
|
-
"aci": (aci).toFixed(0).toString().padStart(3, '0')
|
|
340
|
-
})
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
{ // add 0
|
|
344
|
-
const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, 0);
|
|
345
|
-
coords.push(long, lat);
|
|
346
|
-
coordsZ.push(0);
|
|
347
|
-
const key: string = this._key(centerID, 0);
|
|
348
|
-
// fidkey is the key
|
|
349
|
-
attribs.push({
|
|
350
|
-
"__fid__": key,
|
|
351
|
-
"aci": "K"
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
private _updateData(bucket: DataBucket, mode: any): void {
|
|
357
|
-
this.ObjectArray.UpdateData(this.object, mode, [bucket], { attribs: false, icon: false, text: false });
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
private _key(centerRingKey: string, limpIndex: number): string {
|
|
361
|
-
return `${centerRingKey}_${limpIndex}`;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private _fillDeleteBucket(centerID: string, outDeleteBucket: DataBucket): void {
|
|
365
|
-
const centerMap = this._centerCollection.get(centerID)!;
|
|
366
|
-
const stepAngle: number = centerMap.get("stepAngle");
|
|
367
|
-
const { coords, coordsZ, attribs } = outDeleteBucket;
|
|
368
|
-
let i = 0;
|
|
369
|
-
for (let aci = 0; aci < 360; aci += stepAngle) {
|
|
370
|
-
const key: string = this._key(centerID, i++);
|
|
371
|
-
coords.push(0, 0);
|
|
372
|
-
coordsZ.push(0);
|
|
373
|
-
attribs.push({
|
|
374
|
-
"__fid__": key,
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
private _updateAll(): void {
|
|
380
|
-
const updateBucket: DataBucket = {
|
|
381
|
-
coords: [],
|
|
382
|
-
coordsZ: [],
|
|
383
|
-
attribs: []
|
|
384
|
-
}
|
|
385
|
-
for (const [centerID, centerMap] of this._centerCollection) {
|
|
386
|
-
const isHidden: boolean = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
|
|
387
|
-
if (isHidden) continue;
|
|
388
|
-
const long: number = centerMap.get("long");
|
|
389
|
-
const lat: number = centerMap.get("lat");
|
|
390
|
-
const maxRadius: number = centerMap.get("maxRadius");
|
|
391
|
-
const stepAngle: number = centerMap.get("stepAngle");
|
|
392
|
-
this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
|
|
393
|
-
}
|
|
394
|
-
this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Color, Meter } from "../../types";
|
|
2
|
-
|
|
3
|
-
export type RangeRing = {
|
|
4
|
-
ringID: string;
|
|
5
|
-
radius: Meter;
|
|
6
|
-
padding: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const ENUM_HIDE = Object.freeze({
|
|
10
|
-
SHOW: 0,
|
|
11
|
-
HIDE: 1,
|
|
12
|
-
HIDE_1_DEGREE_PADDINGS: 2
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const ENUM_TEXT_HIDE = Object.freeze({
|
|
16
|
-
SHOW: 0,
|
|
17
|
-
HIDE: 1
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export type RangeRingInput = {
|
|
21
|
-
centerID: string;
|
|
22
|
-
long: number;
|
|
23
|
-
lat: number;
|
|
24
|
-
stepAngle: number;
|
|
25
|
-
altitude: number; // TODO: probably not needed anymore
|
|
26
|
-
hide: 0 | 1 | 2; // 0 - show, 1 - hide // TODO: create a type or enum for this
|
|
27
|
-
rgba: Color; // [r, g, b, a] 0-1
|
|
28
|
-
textHide: 0 | 1; // 0 - show, 1 - hide // TODO: create a type or enum for this
|
|
29
|
-
rings: RangeRing[];
|
|
30
|
-
}
|
package/semiplugins/interface.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Globe, Color } from "../types";
|
|
2
|
-
|
|
3
|
-
export interface SemiPluginInterface {
|
|
4
|
-
id: string;
|
|
5
|
-
init(globe: Globe, gl: WebGL2RenderingContext): void;
|
|
6
|
-
setPluginOpacity(opacity: number, drawRender: boolean): void;
|
|
7
|
-
insertBulk(data: any[]): void;
|
|
8
|
-
deleteBulk(keys: string[]): void;
|
|
9
|
-
setDefaultColor(color: Color, drawRender: boolean): void;
|
|
10
|
-
increaseSpace(amount: number): void;
|
|
11
|
-
updateCoordinates(items: any[]): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
The fact that a straight line have two points, lacks the ability to cover elevation data on higher zoom levels.
|
|
2
|
-
|
|
3
|
-
The purpose of this subplugin is to adapt the straight line to the terrain.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Steps
|
|
7
|
-
|
|
8
|
-
- filter by bbox with tree -> indexes
|
|
9
|
-
- find intersaction. Also filters in a more precise way then bbox. -> index and 2 points. 3d carteasian so it can be used on slerp.
|
|
10
|
-
- Populate the line points -> Array<lat long>
|
|
11
|
-
- 3d cartesian coords with globe api
|
|
12
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
1) Tüm üçgenlerin özetini bufferlarda tutmak zoom 0 göre partition
|
|
2
|
-
1 problem 1) eğer üçgen çok büyükse, 3d de küre oturmaz, 2d de gerekli alanı kaplamaz
|
|
3
|
-
1 problem 2) Cachelenmiş hızlı yüklenen çıktılar main threaddemi, tüm işlemleri yapan webworkerda mı yoksa yeni bir workerdamı tutulacak?
|
|
4
|
-
|
|
5
|
-
Webworker problemi: Şu an webworkera bir aracı ile veri gönderilip alınıyor. Aracı webworker işlemdeyken gelen yazma silme işlemlerini istifliyor, tile işlemlerinin ise üzerine yazıyor. Webworker cevap gönderdiğinde onun boşaldığını anlıyor. Biriktirdiği tüm işlemleri tek seferde yolluyor.
|
|
6
|
-
|
|
7
|
-
MessageChannel API (Doğrudan İletişim): Araştıracağım!!!!
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
2) Görünmüyorsa, hesaplarken O an ekrandaki en derin zoom seviyesindeki parkenin bile kenarından 100 kat küçükse üçgen atlanabilir.
|
|
12
|
-
|
|
13
|
-
Bu hesaplamada üçgenin uzun kenarı ile parkenin kenarı kıyaslanır. polygonlar çok ince ama uzun üçgenler içerebiliyor.
|
|
14
|
-
Alan hesaplandığında bu kenarlar eleniyor. Ancak kenar uzunluğu kullanıldığında polygon biraz küçültülerek basitleştirilmiş gibi gözüküyor
|
|
15
|
-
|
|
16
|
-
2 problemi) Küçücük üçgenelere bölünmüş büyük polygonlar düşük zoom seviyelerinde çok fazla budanıyor.
|
|
17
|
-
|
|
18
|
-
2 avantajı) gözükmeyen üçgenler gpu bufferda yer tutmuyor ve işlemci zamanı harcamıyor
|
|
19
|
-
|
|
20
|
-
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/// <reference lib="webworker" />
|
|
2
|
-
|
|
3
|
-
import { PolygonInput, WorkerInput, WorkerOutput, BBOXZOOMDATA } from "../types";
|
|
4
|
-
|
|
5
|
-
interface WorkerWrapper {
|
|
6
|
-
worker: Worker;
|
|
7
|
-
inProgress: boolean;
|
|
8
|
-
insertDeleteQueue: (PolygonInput | string)[];
|
|
9
|
-
lastBBOXData: BBOXZOOMDATA | null;
|
|
10
|
-
itemCount: number;
|
|
11
|
-
lastOutput: WorkerOutput | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const _workers: WorkerWrapper[] = [];
|
|
15
|
-
const _workerMap: Map<string, number> = new Map();
|
|
16
|
-
let _maxWorkers = 4; // Default, updated in init
|
|
17
|
-
let _nextWorkerIndex = 0;
|
|
18
|
-
|
|
19
|
-
// Configuration state to pass to new workers or re-broadcast
|
|
20
|
-
let _pickableState: boolean | undefined;
|
|
21
|
-
let _variativeColorsOn: boolean | undefined;
|
|
22
|
-
|
|
23
|
-
// Initialize workers
|
|
24
|
-
function initWorkers() {
|
|
25
|
-
_maxWorkers = Math.max(1, (navigator.hardwareConcurrency || 4) - 1);
|
|
26
|
-
for (let i = 0; i < _maxWorkers; i++) {
|
|
27
|
-
addWorker();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function addWorker() {
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
const worker = new Worker(new URL("./worker.js", import.meta.url), { type: 'module' });
|
|
34
|
-
|
|
35
|
-
const wrapper: WorkerWrapper = {
|
|
36
|
-
worker,
|
|
37
|
-
inProgress: false,
|
|
38
|
-
insertDeleteQueue: [],
|
|
39
|
-
lastBBOXData: null,
|
|
40
|
-
itemCount: 0,
|
|
41
|
-
lastOutput: null
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
worker.onmessage = (event: MessageEvent<WorkerOutput>) => {
|
|
45
|
-
wrapper.inProgress = false;
|
|
46
|
-
wrapper.lastOutput = event.data;
|
|
47
|
-
mergeAndSendResults();
|
|
48
|
-
sendToSubWorker(wrapper);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Initialize sub-worker with current global state
|
|
52
|
-
worker.postMessage({
|
|
53
|
-
pickableState: _pickableState,
|
|
54
|
-
variativeColorsOn: _variativeColorsOn,
|
|
55
|
-
insertDeleteQueue: [],
|
|
56
|
-
bboxes: null,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
_workers.push(wrapper);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function mergeAndSendResults() {
|
|
63
|
-
let totalVec3s = 0;
|
|
64
|
-
let totalIndices = 0;
|
|
65
|
-
let totalLongLats = 0;
|
|
66
|
-
let totalPickIndices = 0;
|
|
67
|
-
let totalVariativeColors = 0;
|
|
68
|
-
|
|
69
|
-
const validOutputs: WorkerOutput[] = [];
|
|
70
|
-
|
|
71
|
-
for (const w of _workers) {
|
|
72
|
-
if (w.lastOutput) {
|
|
73
|
-
validOutputs.push(w.lastOutput);
|
|
74
|
-
totalVec3s += w.lastOutput.vec3s.length;
|
|
75
|
-
totalIndices += w.lastOutput.indices.length;
|
|
76
|
-
totalLongLats += w.lastOutput.longLats.length;
|
|
77
|
-
if (w.lastOutput.pickIndices) totalPickIndices += w.lastOutput.pickIndices.length;
|
|
78
|
-
if (w.lastOutput.variativeColors) totalVariativeColors += w.lastOutput.variativeColors.length;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (validOutputs.length === 0) return;
|
|
83
|
-
|
|
84
|
-
const merged: WorkerOutput = {
|
|
85
|
-
vec3s: new Float32Array(totalVec3s),
|
|
86
|
-
indices: new Uint32Array(totalIndices),
|
|
87
|
-
longLats: new Float32Array(totalLongLats),
|
|
88
|
-
pickIndices: totalPickIndices > 0 ? new Float32Array(totalPickIndices) : null,
|
|
89
|
-
variativeColors: totalVariativeColors > 0 ? new Float32Array(totalVariativeColors) : null
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
let offsetVec3s = 0;
|
|
93
|
-
let offsetIndices = 0;
|
|
94
|
-
let offsetLongLats = 0;
|
|
95
|
-
let offsetPickIndices = 0;
|
|
96
|
-
let offsetVariativeColors = 0;
|
|
97
|
-
let vertexOffset = 0;
|
|
98
|
-
|
|
99
|
-
for (const out of validOutputs) {
|
|
100
|
-
merged.vec3s.set(out.vec3s, offsetVec3s);
|
|
101
|
-
offsetVec3s += out.vec3s.length;
|
|
102
|
-
|
|
103
|
-
for (let i = 0; i < out.indices.length; i++) {
|
|
104
|
-
merged.indices[offsetIndices + i] = out.indices[i] + vertexOffset;
|
|
105
|
-
}
|
|
106
|
-
offsetIndices += out.indices.length;
|
|
107
|
-
vertexOffset += out.vec3s.length / 3;
|
|
108
|
-
|
|
109
|
-
merged.longLats.set(out.longLats, offsetLongLats);
|
|
110
|
-
offsetLongLats += out.longLats.length;
|
|
111
|
-
|
|
112
|
-
if (merged.pickIndices && out.pickIndices) {
|
|
113
|
-
merged.pickIndices.set(out.pickIndices, offsetPickIndices);
|
|
114
|
-
offsetPickIndices += out.pickIndices.length;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (merged.variativeColors && out.variativeColors) {
|
|
118
|
-
merged.variativeColors.set(out.variativeColors, offsetVariativeColors);
|
|
119
|
-
offsetVariativeColors += out.variativeColors.length;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Send merged result to Main Thread
|
|
124
|
-
self.postMessage(merged, [
|
|
125
|
-
merged.vec3s.buffer,
|
|
126
|
-
merged.indices.buffer,
|
|
127
|
-
merged.longLats.buffer,
|
|
128
|
-
...(merged.pickIndices ? [merged.pickIndices.buffer] : []),
|
|
129
|
-
...(merged.variativeColors ? [merged.variativeColors.buffer] : [])
|
|
130
|
-
]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function sendToSubWorker(wrapper: WorkerWrapper) {
|
|
134
|
-
if (wrapper.inProgress) return;
|
|
135
|
-
if (wrapper.insertDeleteQueue.length === 0 && wrapper.lastBBOXData === null) return;
|
|
136
|
-
|
|
137
|
-
wrapper.inProgress = true;
|
|
138
|
-
wrapper.worker.postMessage({
|
|
139
|
-
pickableState: undefined, // State is set on init, only send updates if needed
|
|
140
|
-
variativeColorsOn: undefined,
|
|
141
|
-
bboxes: wrapper.lastBBOXData,
|
|
142
|
-
insertDeleteQueue: wrapper.insertDeleteQueue,
|
|
143
|
-
} as WorkerInput);
|
|
144
|
-
|
|
145
|
-
wrapper.lastBBOXData = null;
|
|
146
|
-
wrapper.insertDeleteQueue = [];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function triggerAllWorkers() {
|
|
150
|
-
for (const w of _workers) {
|
|
151
|
-
sendToSubWorker(w);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Handle messages from Main Thread
|
|
156
|
-
self.onmessage = (event: MessageEvent<WorkerInput>) => {
|
|
157
|
-
const { bboxes, insertDeleteQueue, pickableState, variativeColorsOn } = event.data;
|
|
158
|
-
|
|
159
|
-
// Initialize if not already done
|
|
160
|
-
if (_workers.length === 0) {
|
|
161
|
-
_pickableState = pickableState;
|
|
162
|
-
_variativeColorsOn = variativeColorsOn;
|
|
163
|
-
initWorkers();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Handle BBOX updates
|
|
167
|
-
if (bboxes) {
|
|
168
|
-
for (const w of _workers) {
|
|
169
|
-
w.lastBBOXData = bboxes;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Handle Insert/Delete
|
|
174
|
-
if (insertDeleteQueue && insertDeleteQueue.length > 0) {
|
|
175
|
-
if (insertDeleteQueue[0] === "__CLEAR_ALL_ITEMS__") {
|
|
176
|
-
_workerMap.clear();
|
|
177
|
-
for (const w of _workers) {
|
|
178
|
-
w.insertDeleteQueue = ["__CLEAR_ALL_ITEMS__"];
|
|
179
|
-
w.itemCount = 0;
|
|
180
|
-
w.lastOutput = null;
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
for (const item of insertDeleteQueue) {
|
|
184
|
-
if (typeof item === 'string') {
|
|
185
|
-
// Delete
|
|
186
|
-
const workerIdx = _workerMap.get(item);
|
|
187
|
-
if (workerIdx !== undefined) {
|
|
188
|
-
_workers[workerIdx].insertDeleteQueue.push(item);
|
|
189
|
-
_workers[workerIdx].itemCount--;
|
|
190
|
-
_workerMap.delete(item);
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
// Insert
|
|
194
|
-
let workerIdx = _workerMap.get(item.key);
|
|
195
|
-
if (workerIdx === undefined) {
|
|
196
|
-
workerIdx = _nextWorkerIndex;
|
|
197
|
-
_workerMap.set(item.key, workerIdx);
|
|
198
|
-
_workers[workerIdx].itemCount++;
|
|
199
|
-
_nextWorkerIndex = (_nextWorkerIndex + 1) % _workers.length;
|
|
200
|
-
}
|
|
201
|
-
_workers[workerIdx].insertDeleteQueue.push(item.key);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Trigger all workers to process the new data
|
|
208
|
-
triggerAllWorkers();
|
|
209
|
-
}
|