@pirireis/webglobeplugins 0.9.9 → 0.9.11
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.js +15 -0
- package/Math/arc.js +65 -0
- package/Math/bounds/line-bbox.js +190 -0
- package/Math/constants.js +9 -0
- package/Math/frustum/camera.js +24 -0
- package/Math/frustum/from-globeinfo.js +48 -0
- package/Math/frustum/types.js +2 -0
- package/Math/globe-util/horizon-plane.js +112 -0
- package/Math/index.js +1 -0
- package/Math/juction/arc-plane.js +83 -0
- package/Math/juction/line-sphere.js +25 -0
- package/Math/juction/plane-plane.js +58 -0
- package/Math/line.js +58 -0
- package/Math/matrix4.js +1 -0
- package/Math/methods.js +206 -0
- package/Math/plane.js +62 -0
- package/Math/quaternion.js +108 -0
- package/Math/types.js +2 -0
- package/Math/utils.js +4 -0
- package/Math/vec3.js +129 -0
- package/algorithms/search-binary.js +19 -0
- package/altitude-locator/adaptors.js +1 -0
- package/altitude-locator/draw-subset-obj.js +19 -0
- package/altitude-locator/keymethod.js +1 -0
- package/altitude-locator/plugin.js +357 -0
- package/altitude-locator/types.js +23 -0
- package/arrowfield/adaptor.js +15 -0
- package/arrowfield/index.js +10 -0
- package/arrowfield/plugin.js +89 -0
- package/bearing-line/index.js +8 -0
- package/bearing-line/plugin.js +474 -0
- package/circle-line-chain/chain-list-map.js +211 -0
- package/circle-line-chain/init.js +1 -0
- package/circle-line-chain/plugin.js +449 -0
- package/circle-line-chain/util.js +5 -0
- package/compass-rose/compass-rose-padding-flat.js +247 -0
- package/compass-rose/compass-text-writer.js +161 -0
- package/compass-rose/index.js +7 -0
- package/compassrose/compassrose.js +300 -0
- package/compassrose/index.js +8 -0
- package/globe-types.js +1 -0
- package/heatwave/index.js +10 -0
- package/heatwave/isobar/objectarraylabels.js +206 -0
- package/heatwave/isobar/plugin.js +362 -0
- package/heatwave/isobar/quadtreecontours.js +316 -0
- package/heatwave/plugins/heatwaveglobeshell.js +224 -0
- package/index.js +11 -11
- package/jest.config.js +7 -0
- package/package.json +4 -4
- package/partialrings/buffer-manager.js +113 -0
- package/partialrings/index.js +41 -0
- package/partialrings/plugin.js +171 -0
- package/partialrings/program.js +197 -0
- package/pin/pin-object-array.js +308 -0
- package/pin/pin-point-totem.js +61 -0
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +66 -0
- package/point-heat-map/index.js +1 -0
- package/point-heat-map/plugin-webworker.js +131 -0
- package/point-heat-map/point-to-heat-map-flow.js +129 -0
- package/point-tracks/key-methods.js +5 -0
- package/point-tracks/plugin.js +353 -0
- package/programs/arrowfield/index.js +7 -0
- package/programs/arrowfield/logic.js +149 -0
- package/programs/arrowfield/object.js +68 -0
- package/programs/data2legend/density-to-legend.js +77 -0
- package/programs/data2legend/point-to-density-texture.js +75 -0
- package/programs/float2legendwithratio/index.js +8 -0
- package/programs/float2legendwithratio/logic.js +125 -0
- package/programs/float2legendwithratio/object.js +113 -0
- package/programs/globe-util/is-globe-moved.js +22 -0
- package/programs/globeshell/index.js +8 -0
- package/programs/globeshell/noise/noises.js +1 -0
- package/programs/globeshell/wiggle/index.js +8 -0
- package/programs/globeshell/wiggle/logic.js +252 -0
- package/programs/globeshell/wiggle/object.js +74 -0
- package/programs/helpers/blender/index.js +1 -0
- package/programs/helpers/blender/program.js +62 -0
- package/programs/helpers/fadeaway/index.js +7 -0
- package/programs/helpers/fadeaway/logic.js +50 -0
- package/programs/helpers/fadeaway/object.js +21 -0
- package/programs/helpers/index.js +8 -0
- package/programs/index.js +58 -0
- package/programs/interface.js +1 -0
- package/programs/line-on-globe/angled-line.js +117 -0
- package/programs/line-on-globe/circle-accurate-3d.js +91 -0
- package/programs/line-on-globe/circle-accurate-flat.js +158 -0
- package/programs/line-on-globe/circle-accurate.js +108 -0
- package/programs/line-on-globe/circle.js +102 -0
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +109 -0
- package/programs/line-on-globe/index.js +1 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +91 -0
- package/programs/line-on-globe/linestrip.js +110 -0
- package/programs/line-on-globe/naive-accurate-flexible.js +125 -0
- package/programs/line-on-globe/to-the-surface.js +82 -0
- package/programs/line-on-globe/util.js +8 -0
- package/programs/picking/pickable-renderer.js +104 -0
- package/programs/point-on-globe/element-globe-surface-glow.js +102 -0
- package/programs/point-on-globe/element-point-glow.js +85 -0
- package/programs/point-on-globe/square-pixel-point.js +125 -0
- package/programs/programcache.js +131 -0
- package/programs/rings/distancering/circleflatprogram.js +114 -0
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +358 -0
- package/programs/rings/distancering/circlepaddysharedbuffer.js +433 -0
- package/programs/rings/distancering/index.js +14 -0
- package/programs/rings/distancering/paddyflatprogram.js +119 -0
- package/programs/rings/distancering/paddyflatprogram2d.js +121 -0
- package/programs/rings/distancering/paddyflatprogram3d.js +119 -0
- package/programs/rings/distancering/shader.js +1 -0
- package/programs/rings/index.js +17 -0
- package/programs/rings/partial-ring/piece-of-pie.js +173 -0
- package/programs/totems/camerauniformblock.js +147 -0
- package/programs/totems/canvas-webglobe-info.js +102 -0
- package/programs/totems/gpu-selection-uniform-block.js +104 -0
- package/programs/totems/index.js +40 -0
- package/programs/two-d/pixel-circle.js +1 -0
- package/programs/two-d/pixel-padding-for-compass.js +101 -0
- package/programs/util.js +18 -0
- package/programs/vectorfields/index.js +23 -0
- package/programs/vectorfields/logics/drawrectangleparticles.js +66 -0
- package/programs/vectorfields/logics/index.js +12 -0
- package/programs/vectorfields/logics/pixelbased.js +86 -0
- package/programs/vectorfields/logics/ubo.js +57 -0
- package/programs/vectorfields/pingpongbuffermanager.js +80 -0
- package/rangerings/enum.js +5 -0
- package/rangerings/index.js +15 -0
- package/rangerings/plugin.js +610 -0
- package/rangerings/rangeringangletext.js +341 -0
- package/rangerings/ring-account.js +134 -0
- package/shaders/fragment-toy/firework.js +4 -0
- package/shaders/fragment-toy/singularity.js +5 -0
- package/shape-on-terrain/arc/naive/plugin.js +252 -0
- package/timetracks/adaptors-line-strip.js +82 -0
- package/timetracks/adaptors.js +136 -0
- package/timetracks/index.js +19 -0
- package/timetracks/plugin-line-strip.js +254 -0
- package/timetracks/plugin.js +262 -0
- package/timetracks/program-line-strip.js +418 -0
- package/timetracks/program.js +466 -0
- package/timetracks/programpoint-line-strip.js +101 -0
- package/timetracks/programpoint.js +101 -0
- package/types.js +15 -0
- package/util/account/bufferoffsetmanager.js +202 -0
- package/util/account/index.js +23 -0
- package/util/account/single-attribute-buffer-management/buffer-manager.js +112 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +180 -0
- package/util/account/single-attribute-buffer-management/index.js +9 -0
- package/util/account/single-attribute-buffer-management/object-store.js +53 -0
- package/util/account/single-attribute-buffer-management/types.js +2 -0
- package/util/account/util.js +24 -0
- package/util/algorithms/index.js +1 -0
- package/util/algorithms/search-binary.js +28 -0
- package/util/check/get.js +18 -0
- package/util/check/index.js +1 -0
- package/util/check/typecheck.js +51 -0
- package/util/geometry/index.js +53 -0
- package/util/gl-util/buffer/attribute-loader.js +81 -0
- package/util/gl-util/buffer/index.js +6 -0
- package/util/gl-util/buffer/types.js +1 -0
- package/util/gl-util/draw-options/methods.js +38 -0
- package/util/gl-util/draw-options/types.js +15 -0
- package/util/gl-util/uniform-block/manager.js +168 -0
- package/util/gl-util/uniform-block/shader.js +1 -0
- package/util/gl-util/uniform-block/types.js +8 -0
- package/util/heatwavedatamanager/datamanager.js +212 -0
- package/util/heatwavedatamanager/index.js +10 -0
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +125 -0
- package/util/heatwavedatamanager/pointcoordsmeta.js +21 -0
- package/util/index.js +57 -0
- package/util/interpolation/index.js +1 -0
- package/util/interpolation/timetrack/index.js +5 -0
- package/util/interpolation/timetrack/timetrack-interpolator.js +81 -0
- package/util/interpolation/timetrack/web-worker-str.js +5 -0
- package/util/interpolation/timetrack/web-worker.js +48 -0
- package/util/jshelpers/data-filler.js +20 -0
- package/util/jshelpers/equality.js +20 -0
- package/util/jshelpers/index.js +37 -0
- package/util/jshelpers/timefilters.js +32 -0
- package/util/picking/fence.js +46 -0
- package/util/picking/picker-displayer.js +145 -0
- package/util/programs/draw-texture-on-canvas.js +71 -0
- package/util/programs/index.js +17 -0
- package/util/programs/shapesonglobe.js +174 -0
- package/util/programs/supersampletotextures.js +107 -0
- package/util/programs/texturetoglobe.js +132 -0
- package/util/shaderfunctions/geometrytransformations.js +45 -0
- package/util/shaderfunctions/index.js +18 -0
- package/util/shaderfunctions/nodata.js +5 -0
- package/util/shaderfunctions/noisefunctions.js +13 -0
- package/util/surface-line-data/arc-bboxes.js +25 -0
- package/util/surface-line-data/arcs-to-cuts.js +53 -0
- package/util/surface-line-data/cut-arc.js +1 -0
- package/util/surface-line-data/flow.js +28 -0
- package/util/surface-line-data/rbush-manager.js +1 -0
- package/util/surface-line-data/types.js +1 -0
- package/util/surface-line-data/web-worker.js +1 -0
- package/util/webglobe/gldefaultstates.js +7 -0
- package/util/webglobe/index.js +18 -0
- package/util/webglobe/rasteroverlay.js +80 -0
- package/util/webglobjectbuilders.js +393 -0
- package/util/webglobjectbuilders1.js +238 -0
- package/waveparticles/adaptor.js +18 -0
- package/waveparticles/index.js +10 -0
- package/waveparticles/plugin.js +271 -0
- package/wind/imagetovectorfieldandmagnitude.js +35 -0
- package/wind/index.js +14 -0
- package/wind/plugin.js +724 -0
- package/wind/vectorfieldimage.js +25 -0
- package/write-text/attached-text-writer.js +93 -0
- package/write-text/context-text.js +105 -0
- package/write-text/context-text3.js +160 -0
- package/write-text/index.js +5 -0
- package/write-text/writer-plugin.js +8 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.RINGPARTIAL_DRAW_MODE = void 0;
|
|
15
|
+
var piece_of_pie_1 = require("../programs/rings/partial-ring/piece-of-pie");
|
|
16
|
+
var naive_accurate_flexible_1 = require("../programs/line-on-globe/naive-accurate-flexible");
|
|
17
|
+
var circle_accurate_3d_1 = require("../programs/line-on-globe/circle-accurate-3d");
|
|
18
|
+
var circle_accurate_flat_1 = require("../programs/line-on-globe/circle-accurate-flat");
|
|
19
|
+
var account_1 = require("../util/account");
|
|
20
|
+
var get_1 = require("../util/check/get");
|
|
21
|
+
var data_filler_1 = require("../util/jshelpers/data-filler");
|
|
22
|
+
var context_text3_1 = require("../write-text/context-text3");
|
|
23
|
+
var typecheck_1 = require("../util/check/typecheck");
|
|
24
|
+
var geometry_1 = require("../util/geometry");
|
|
25
|
+
var attribute_loader_1 = require("../util/gl-util/buffer/attribute-loader");
|
|
26
|
+
exports.RINGPARTIAL_DRAW_MODE = Object.freeze({
|
|
27
|
+
LINE_STRIP: "LINE_STRIP",
|
|
28
|
+
TRIANGLE_FAN: "TRIANGLE_FAN",
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {{key, long, lat, endLong, endLat, bearingAngle, radius, rgba:[4numbers], rgbaMode, bigRadius, dashRatio, dashOpacity, circleDashAngle}} BearingLineItem
|
|
32
|
+
* @property {string} key
|
|
33
|
+
* @property {number} long
|
|
34
|
+
* @property {number} lat
|
|
35
|
+
* @property {number} endLong
|
|
36
|
+
* @property {number} endLat
|
|
37
|
+
* @property {number} bearingAngle 0-360
|
|
38
|
+
* @property {number} radius angle ring radius
|
|
39
|
+
* @property {number} altitude in meters effects all parts of the item
|
|
40
|
+
* @property {Array<numbers>} rgba [r,g,b,a] 0-1
|
|
41
|
+
* @property {number} rgbaMode 0 constant, 1 fading, 2 hides angle ring
|
|
42
|
+
* @property {number} bigRadius undefined means it will be calculated from long, lat, endLong, endLat
|
|
43
|
+
* @property {number} dashRatio 0-1
|
|
44
|
+
* @property {number} dashOpacity 0-1
|
|
45
|
+
* @property {number} circleDashAngle 0-360
|
|
46
|
+
*/
|
|
47
|
+
var textWriterGetOrThrow = (0, get_1.mapGetOrThrow)("BearingLine textContextInjection id does not exist in map");
|
|
48
|
+
var radian = function (degree) { return degree * Math.PI / 180; };
|
|
49
|
+
var integralSec = function (angle) {
|
|
50
|
+
return Math.log(Math.tan(angle / 2 + Math.PI / 4));
|
|
51
|
+
};
|
|
52
|
+
var calculateStartAngle = function (long, lat, endLong, endLat) {
|
|
53
|
+
var dLat = (integralSec(endLat) - integralSec(lat)); // Because lines are strectes toward poles.
|
|
54
|
+
var dLong = endLong - long;
|
|
55
|
+
var angle = -Math.atan2(dLat, dLong);
|
|
56
|
+
return angle;
|
|
57
|
+
};
|
|
58
|
+
var BearingLinePlugin = /** @class */ (function () {
|
|
59
|
+
/**
|
|
60
|
+
* @param {*} id
|
|
61
|
+
* @param {Map<[key, ContextTextWriter3]>} textWritersMap
|
|
62
|
+
*/
|
|
63
|
+
function BearingLinePlugin(id, _a) {
|
|
64
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1 : _c, _d = _b.textWritersMap, textWritersMap = _d === void 0 ? new Map() : _d, _e = _b.textDataPreAdaptor, textDataPreAdaptor = _e === void 0 ? function (x) { return x; } : _e, _f = _b.drawVRM, drawVRM = _f === void 0 ? true : _f, _g = _b.drawBearingLine, drawBearingLine = _g === void 0 ? true : _g, _h = _b.drawAngleRing, drawAngleRing = _h === void 0 ? true : _h, _j = _b.drawText, drawText = _j === void 0 ? true : _j, _k = _b.circleFlatEdgeCount, circleFlatEdgeCount = _k === void 0 ? circle_accurate_flat_1.EDGE_COUNT - 2 : _k;
|
|
65
|
+
this.id = id;
|
|
66
|
+
this._opacity = opacity;
|
|
67
|
+
this.bufferOrchestrator = new account_1.BufferOrchestrator({ capacity: 10 });
|
|
68
|
+
this._checkTextContextWriterInjectionMap(textWritersMap);
|
|
69
|
+
this._textWritersMap = textWritersMap;
|
|
70
|
+
this._textWritersMap.forEach(function (writer) { return writer.keyAdaptor = function (item) { return item.key; }; });
|
|
71
|
+
this.drawVRM = drawVRM;
|
|
72
|
+
this.drawBearingLine = drawBearingLine;
|
|
73
|
+
this.drawAngleRing = drawAngleRing;
|
|
74
|
+
this._textDataPreAdaptor = textDataPreAdaptor;
|
|
75
|
+
this.drawText = drawText;
|
|
76
|
+
this._memoryForText = new Map();
|
|
77
|
+
this.circleFlatEdgeCount = circleFlatEdgeCount + 2;
|
|
78
|
+
}
|
|
79
|
+
BearingLinePlugin.prototype.setDoDrawVRM = function (bool) {
|
|
80
|
+
(0, typecheck_1.isBoolean)(bool);
|
|
81
|
+
if (bool === this.drawVRM)
|
|
82
|
+
return;
|
|
83
|
+
this.drawVRM = bool;
|
|
84
|
+
this.globe.DrawRender();
|
|
85
|
+
};
|
|
86
|
+
BearingLinePlugin.prototype.setDoDrawText = function (bool) {
|
|
87
|
+
(0, typecheck_1.isBoolean)(bool);
|
|
88
|
+
if (bool === this.drawText)
|
|
89
|
+
return;
|
|
90
|
+
this.drawText = bool;
|
|
91
|
+
this.globe.DrawRender();
|
|
92
|
+
};
|
|
93
|
+
BearingLinePlugin.prototype.setDoDrawText = function (bool) {
|
|
94
|
+
(0, typecheck_1.isBoolean)(bool);
|
|
95
|
+
if (bool === this.drawText)
|
|
96
|
+
return;
|
|
97
|
+
this.drawText = bool;
|
|
98
|
+
this.globe.DrawRender();
|
|
99
|
+
};
|
|
100
|
+
BearingLinePlugin.prototype.setDoDrawAngleRing = function (bool) {
|
|
101
|
+
(0, typecheck_1.isBoolean)(bool);
|
|
102
|
+
if (bool === this.drawAngleRing)
|
|
103
|
+
return;
|
|
104
|
+
this.drawAngleRing = bool;
|
|
105
|
+
this.globe.DrawRender();
|
|
106
|
+
};
|
|
107
|
+
BearingLinePlugin.prototype.setOpacity = function (opacity) {
|
|
108
|
+
(0, typecheck_1.constraintFloat)(opacity, 0, 1);
|
|
109
|
+
this._opacity = opacity;
|
|
110
|
+
this._textWritersMap.forEach(function (writer) { return writer.setOpacity(opacity); });
|
|
111
|
+
this.globe.DrawRender();
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
|
|
115
|
+
* @param {Array<BearingLineItem>} items
|
|
116
|
+
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
117
|
+
*/
|
|
118
|
+
BearingLinePlugin.prototype.insertBulk = function (items, _a) {
|
|
119
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.textWriterIDs, textWriterIDs = _c === void 0 ? [] : _c;
|
|
120
|
+
var _d = this, globe = _d.globe, bufferOrchestrator = _d.bufferOrchestrator, bufferManagersCompMap = _d.bufferManagersCompMap; // angleTextContext, distanceTextContext,
|
|
121
|
+
var data = [];
|
|
122
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
123
|
+
var item = items_1[_i];
|
|
124
|
+
data.push(this.__insertAdaptor(item));
|
|
125
|
+
}
|
|
126
|
+
bufferOrchestrator.insertBulk(data, bufferManagersCompMap);
|
|
127
|
+
this.__insertTexts(items, textWriterIDs);
|
|
128
|
+
globe.DrawRender();
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
132
|
+
* @param {Array<string>} itemKeys | if empty, all texts will be updated.
|
|
133
|
+
*/
|
|
134
|
+
BearingLinePlugin.prototype.updateText = function (textWriterIDs, itemKeys) {
|
|
135
|
+
var _this = this;
|
|
136
|
+
if (textWriterIDs === void 0) { textWriterIDs = []; }
|
|
137
|
+
if (itemKeys === void 0) { itemKeys = null; }
|
|
138
|
+
var textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
|
|
139
|
+
if (itemKeys === null) {
|
|
140
|
+
this._memoryForText.forEach(function (item) {
|
|
141
|
+
var _item = _this._textDataPreAdaptor(item);
|
|
142
|
+
textWritersMap.forEach(function (writer) { return writer.insertText(_item); });
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
itemKeys.forEach(function (key) {
|
|
147
|
+
var item = _this._memoryForText.get(key);
|
|
148
|
+
if (item === undefined)
|
|
149
|
+
return;
|
|
150
|
+
var _item = _this._textDataPreAdaptor(item);
|
|
151
|
+
textWritersMap.forEach(function (writer) { return writer.insertText(_item); });
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
this.globe.DrawRender();
|
|
155
|
+
};
|
|
156
|
+
BearingLinePlugin.prototype.deleteBulk = function (keys) {
|
|
157
|
+
this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap);
|
|
158
|
+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
159
|
+
var key = keys_1[_i];
|
|
160
|
+
this._memoryForText.delete(key);
|
|
161
|
+
}
|
|
162
|
+
this._deleteTexts(keys);
|
|
163
|
+
this.globe.DrawRender();
|
|
164
|
+
};
|
|
165
|
+
BearingLinePlugin.prototype.defrag = function () {
|
|
166
|
+
this.bufferOrchestrator.defrag(this.bufferManagersCompMap);
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* @param {Array<{key, long, lat, endLong, endLat, bearingAngle}>} items
|
|
170
|
+
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
171
|
+
*/
|
|
172
|
+
BearingLinePlugin.prototype.updateCoordinatesBulk = function (items, _a) {
|
|
173
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.textWriterIDs, textWriterIDs = _c === void 0 ? [] : _c;
|
|
174
|
+
var _d = this, globe = _d.globe, bufferOrchestrator = _d.bufferOrchestrator, bufferManagersCompMap = _d.bufferManagersCompMap;
|
|
175
|
+
var data = [];
|
|
176
|
+
for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
|
|
177
|
+
var item = items_2[_i];
|
|
178
|
+
data.push(this.__updateCoordsAdaptor(item));
|
|
179
|
+
}
|
|
180
|
+
this.__insertTexts(items, textWriterIDs);
|
|
181
|
+
bufferOrchestrator.updateBulk(data, bufferManagersCompMap, ["centerCoords2d", "centerCoords3d", "targetCoords2d", "targetCoords3d",
|
|
182
|
+
"startAngle2d", "tailAngle2d", "startAngle3d", "tailAngle3d", "bearingTargetCoords2d", "bearingTargetCoords3d", "centerCoords2dflat",
|
|
183
|
+
"bigRadius", "radius"]);
|
|
184
|
+
globe.DrawRender();
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
*
|
|
188
|
+
* @param {Array<BearingLineItem>} items some colums EXCEPT positional ones
|
|
189
|
+
* @param {string} propertyIDs
|
|
190
|
+
* @param {string} textWriterIDs
|
|
191
|
+
* Do NOT send empty data if property ID of this data is entered or NaN is loaded to the buffer, resulting in an unwanted behaviour.
|
|
192
|
+
*{ textWriterIDs = []}
|
|
193
|
+
*/
|
|
194
|
+
BearingLinePlugin.prototype.updatePartial = function (items, propertyIDs, _a) {
|
|
195
|
+
if (propertyIDs === void 0) { propertyIDs = []; }
|
|
196
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.textWriterIDs, textWriterIDs = _c === void 0 ? [] : _c;
|
|
197
|
+
if (propertyIDs.length === 0)
|
|
198
|
+
console.warn("updatePartial is called with no target propertyIDs");
|
|
199
|
+
var fixedPropertyIDs = this.__fixPartialProperties(propertyIDs);
|
|
200
|
+
var _d = this, bufferOrchestrator = _d.bufferOrchestrator, bufferManagersCompMap = _d.bufferManagersCompMap;
|
|
201
|
+
bufferOrchestrator.updateBulk(items, bufferManagersCompMap, fixedPropertyIDs);
|
|
202
|
+
// patch to update text opacity
|
|
203
|
+
this.__insertTexts(items, textWriterIDs);
|
|
204
|
+
this.globe.DrawRender();
|
|
205
|
+
};
|
|
206
|
+
// Private methods
|
|
207
|
+
BearingLinePlugin.prototype._checkTextContextWriterInjectionMap = function (textContextWriterInjectionMap) {
|
|
208
|
+
if (!(textContextWriterInjectionMap instanceof Map))
|
|
209
|
+
throw new Error("textContextWriterInjectionMap is not an instance of Map");
|
|
210
|
+
textContextWriterInjectionMap.forEach(function (v) {
|
|
211
|
+
if (!(v instanceof context_text3_1.ContextTextWriter3))
|
|
212
|
+
throw new Error("textContextWriterInjectionMap element is not an instance of ContextTextWriter3");
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
BearingLinePlugin.prototype.__insertTexts = function (items, textWriterIDs) {
|
|
216
|
+
var textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
|
|
217
|
+
var _loop_1 = function (item) {
|
|
218
|
+
var oldItem = this_1._memoryForText.get(item.key);
|
|
219
|
+
var _item = oldItem !== undefined ? __assign(__assign({}, oldItem), item) : item;
|
|
220
|
+
this_1._memoryForText.set(item.key, _item);
|
|
221
|
+
if (this_1._textDataPreAdaptor !== null)
|
|
222
|
+
_item = this_1._textDataPreAdaptor(_item);
|
|
223
|
+
textWritersMap.forEach(function (writer) { return writer.insertText(_item); });
|
|
224
|
+
};
|
|
225
|
+
var this_1 = this;
|
|
226
|
+
for (var _i = 0, items_3 = items; _i < items_3.length; _i++) {
|
|
227
|
+
var item = items_3[_i];
|
|
228
|
+
_loop_1(item);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
BearingLinePlugin.prototype.__insertAdaptor = function (item) {
|
|
232
|
+
var rgba = item.rgba !== undefined ? item.rgba : [0, 0, 0, 0];
|
|
233
|
+
var rgbaMode = item.rgbaMode !== undefined ? item.rgbaMode : 0;
|
|
234
|
+
var dashRatio = item.dashRatio !== undefined ? item.dashRatio : 1.0;
|
|
235
|
+
var dashOpacity = item.dashOpacity !== undefined ? item.dashOpacity : 0.9;
|
|
236
|
+
var circleDashAngle = item.circleDashAngle !== undefined ? item.circleDashAngle : 360;
|
|
237
|
+
var coordsData = this.__updateCoordsAdaptor(item);
|
|
238
|
+
return __assign(__assign({}, coordsData), { rgba: rgba, dashRatio: dashRatio, dashOpacity: dashOpacity, circleDashAngle: circleDashAngle, rgbaMode: rgbaMode });
|
|
239
|
+
};
|
|
240
|
+
BearingLinePlugin.prototype.__updateCoordsAdaptor = function (item) {
|
|
241
|
+
var _a, _b;
|
|
242
|
+
var globe = this.globe;
|
|
243
|
+
var lat = radian(item.lat);
|
|
244
|
+
var long = radian(item.long);
|
|
245
|
+
var endLat = radian(item.endLat);
|
|
246
|
+
var endLong = radian(item.endLong);
|
|
247
|
+
var altitude = ((_a = item.altitude) !== null && _a !== void 0 ? _a : 0) / 1000;
|
|
248
|
+
var bigRadius = (_b = item.bigRadius) !== null && _b !== void 0 ? _b : globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
|
|
249
|
+
var radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
|
|
250
|
+
var _c = globe.Math.FindPointByPolar(item.long, item.lat, bigRadius, item.bearingAngle), bearingLong = _c.long, bearingLat = _c.lat;
|
|
251
|
+
var startAngle2d = calculateStartAngle(long, lat, endLong, endLat);
|
|
252
|
+
var bearingAngle2d = calculateStartAngle(long, lat, radian(bearingLong), radian(bearingLat));
|
|
253
|
+
var tailAngle2d = bearingAngle2d - startAngle2d;
|
|
254
|
+
if (tailAngle2d > 0) {
|
|
255
|
+
tailAngle2d -= Math.PI * 2;
|
|
256
|
+
}
|
|
257
|
+
var bearingAngle = radian(item.bearingAngle - 90);
|
|
258
|
+
var startAngleOfCircle = globe.Math.GetAzimuthAngle(item.long, item.lat, item.endLong, item.endLat); //startAngle2d * 180 / Math.PI;
|
|
259
|
+
var startAngle3d = radian(startAngleOfCircle) - radian(90);
|
|
260
|
+
var tailAngle3d = bearingAngle - startAngle3d;
|
|
261
|
+
if (tailAngle3d > 0) {
|
|
262
|
+
tailAngle3d -= Math.PI * 2;
|
|
263
|
+
}
|
|
264
|
+
var centerCoords2dflat = (0, circle_accurate_flat_1.centerCoords2dflatDataCreator)(globe, item.long, item.lat, item.endLong, item.endLat, { startAngleOfCircle: startAngleOfCircle, edgeCount: this.circleFlatEdgeCount });
|
|
265
|
+
return {
|
|
266
|
+
key: item.key,
|
|
267
|
+
lat: item.lat,
|
|
268
|
+
long: item.long,
|
|
269
|
+
endLat: item.endLat,
|
|
270
|
+
endLong: item.endLong,
|
|
271
|
+
altitude: altitude,
|
|
272
|
+
bearingAngle: bearingAngle,
|
|
273
|
+
radius: radius,
|
|
274
|
+
bigRadius: bigRadius,
|
|
275
|
+
startAngle2d: startAngle2d,
|
|
276
|
+
tailAngle2d: tailAngle2d,
|
|
277
|
+
startAngle3d: startAngle3d,
|
|
278
|
+
tailAngle3d: tailAngle3d,
|
|
279
|
+
bearingLong: bearingLong,
|
|
280
|
+
bearingLat: bearingLat,
|
|
281
|
+
centerCoords2dflat: centerCoords2dflat
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
BearingLinePlugin.prototype.__fixPartialProperties = function (propertyIDs) {
|
|
285
|
+
var s = new Set(["rgba", "dashOpacity", "circleDashAngle"]);
|
|
286
|
+
var result = [];
|
|
287
|
+
for (var _i = 0, propertyIDs_1 = propertyIDs; _i < propertyIDs_1.length; _i++) {
|
|
288
|
+
var item = propertyIDs_1[_i];
|
|
289
|
+
result.push(item);
|
|
290
|
+
if (s.has(item)) {
|
|
291
|
+
result.push(item + "Mercator");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
};
|
|
296
|
+
// Globe API
|
|
297
|
+
BearingLinePlugin.prototype.init = function (globe, gl) {
|
|
298
|
+
var _a, _b, _c, _d, _e;
|
|
299
|
+
var _this = this;
|
|
300
|
+
this.gl = gl;
|
|
301
|
+
this.globe = globe;
|
|
302
|
+
this.lineProgram = naive_accurate_flexible_1.LineOnGlobeCache.get(globe);
|
|
303
|
+
this.pieceOfPieProgram = piece_of_pie_1.PieceOfPieProgramCache.get(globe);
|
|
304
|
+
this.circleProgram = circle_accurate_flat_1.CircleCache.get(globe);
|
|
305
|
+
this.circle3DProgram = circle_accurate_3d_1.CircleCache.get(globe);
|
|
306
|
+
var circleFlatEdgeCount = this.circleFlatEdgeCount;
|
|
307
|
+
{
|
|
308
|
+
// createBuffers
|
|
309
|
+
var bufferType = "DYNAMIC_DRAW";
|
|
310
|
+
var initialCapacity = this.bufferOrchestrator.capacity;
|
|
311
|
+
this.bufferManagersCompMap = new Map([
|
|
312
|
+
["centerCoords2d", {
|
|
313
|
+
'bufferManager': new account_1.BufferManager(gl, 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
314
|
+
'adaptor': function (item) { return new Float32Array(globe.api_GetMercator2DPoint(item.long, item.lat)); },
|
|
315
|
+
}],
|
|
316
|
+
["centerCoords2dflat", {
|
|
317
|
+
'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount * 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
318
|
+
'adaptor': function (item) { return item.centerCoords2dflat; },
|
|
319
|
+
}],
|
|
320
|
+
["centerCoords3d", {
|
|
321
|
+
'bufferManager': new account_1.BufferManager(gl, 3, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
322
|
+
'adaptor': function (item) { return (0, geometry_1.sphereCoord)(item.long, item.lat, globe, item.altitude); },
|
|
323
|
+
}],
|
|
324
|
+
["targetCoords2d", {
|
|
325
|
+
'bufferManager': new account_1.BufferManager(gl, 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
326
|
+
'adaptor': function (item) { return new Float32Array(globe.api_GetMercator2DPoint(item.endLong, item.endLat)); }
|
|
327
|
+
}],
|
|
328
|
+
["targetCoords3d", {
|
|
329
|
+
'bufferManager': new account_1.BufferManager(gl, 3, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
330
|
+
'adaptor': function (item) { return (0, geometry_1.sphereCoord)(item.endLong, item.endLat, globe, item.altitude); }
|
|
331
|
+
}],
|
|
332
|
+
["bearingTargetCoords2d", {
|
|
333
|
+
'bufferManager': new account_1.BufferManager(gl, 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
334
|
+
'adaptor': function (item) { return new Float32Array(globe.api_GetMercator2DPoint(item.bearingLong, item.bearingLat)); }
|
|
335
|
+
}],
|
|
336
|
+
["bearingTargetCoords3d", {
|
|
337
|
+
'bufferManager': new account_1.BufferManager(gl, 3, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
338
|
+
'adaptor': function (item) { return (0, geometry_1.sphereCoord)(item.bearingLong, item.bearingLat, globe, item.altitude); }
|
|
339
|
+
}],
|
|
340
|
+
["startAngle2d", {
|
|
341
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
342
|
+
'adaptor': function (item) { return new Float32Array([item.startAngle2d]); }
|
|
343
|
+
}],
|
|
344
|
+
["tailAngle2d", {
|
|
345
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
346
|
+
'adaptor': function (item) { return new Float32Array([item.tailAngle2d]); }
|
|
347
|
+
}],
|
|
348
|
+
["startAngle3d", {
|
|
349
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
350
|
+
'adaptor': function (item) { return new Float32Array([item.startAngle3d]); }
|
|
351
|
+
}],
|
|
352
|
+
["tailAngle3d", {
|
|
353
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
354
|
+
'adaptor': function (item) { return new Float32Array([item.tailAngle3d]); }
|
|
355
|
+
}],
|
|
356
|
+
["bearingDashRatio", {
|
|
357
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
358
|
+
'adaptor': function (item) { return new Float32Array([0]); }
|
|
359
|
+
}],
|
|
360
|
+
["rgba", {
|
|
361
|
+
'bufferManager': new account_1.BufferManager(gl, 4, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
362
|
+
'adaptor': function (item) { return new Float32Array(item.rgba); }
|
|
363
|
+
}],
|
|
364
|
+
["radius", {
|
|
365
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
366
|
+
'adaptor': function (item) { return new Float32Array([item.radius]); }
|
|
367
|
+
}],
|
|
368
|
+
["rgbaMode", {
|
|
369
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
370
|
+
'adaptor': function (item) { return new Float32Array([item.rgbaMode]); }
|
|
371
|
+
}],
|
|
372
|
+
["dashRatio", {
|
|
373
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
374
|
+
'adaptor': function (item) { return new Float32Array([item.dashRatio]); }
|
|
375
|
+
}],
|
|
376
|
+
["bigRadius", {
|
|
377
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
378
|
+
'adaptor': function (item) { return new Float32Array([item.bigRadius]); }
|
|
379
|
+
}],
|
|
380
|
+
["dashOpacity", {
|
|
381
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
382
|
+
'adaptor': function (item) { return new Float32Array([item.dashOpacity]); },
|
|
383
|
+
}],
|
|
384
|
+
["circleDashAngle", {
|
|
385
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
386
|
+
'adaptor': function (item) { return new Float32Array([item.circleDashAngle / 360]); },
|
|
387
|
+
}],
|
|
388
|
+
// Mercator circle properties are duplicated for the sake of performance.
|
|
389
|
+
["rgbaMercator", {
|
|
390
|
+
'bufferManager': new account_1.BufferManager(gl, 4 * circleFlatEdgeCount, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
391
|
+
'adaptor': function (item) { return data_filler_1.populateFloat32Array.fillWithListData(circleFlatEdgeCount, item.rgba); },
|
|
392
|
+
}],
|
|
393
|
+
["circleDashAngleMercator", {
|
|
394
|
+
'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
395
|
+
'adaptor': function (item) { return data_filler_1.populateFloat32Array.fillFloat32Array(circleFlatEdgeCount, item.circleDashAngle / 360); },
|
|
396
|
+
}],
|
|
397
|
+
["dashOpacityMercator", {
|
|
398
|
+
'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
399
|
+
'adaptor': function (item) { return data_filler_1.populateFloat32Array.fillFloat32Array(circleFlatEdgeCount, item.dashOpacity); },
|
|
400
|
+
}],
|
|
401
|
+
]);
|
|
402
|
+
}
|
|
403
|
+
var vaoOBJ = function (key) { return (0, attribute_loader_1.createBufferAndReadInfo)(_this.bufferManagersCompMap.get(key).bufferManager.buffer); };
|
|
404
|
+
this.lineVao = (_a = this.lineProgram).createVAO.apply(_a, ['centerCoords2d', 'centerCoords3d', 'targetCoords2d', 'targetCoords3d', 'dashOpacity', 'dashOpacity', 'rgba'].map(function (key) { return vaoOBJ(key); }));
|
|
405
|
+
this.ringVao = (_b = this.pieceOfPieProgram).createVAO.apply(_b, ['centerCoords2d',
|
|
406
|
+
'centerCoords3d',
|
|
407
|
+
'startAngle2d',
|
|
408
|
+
'tailAngle2d',
|
|
409
|
+
'startAngle3d',
|
|
410
|
+
'tailAngle3d',
|
|
411
|
+
'rgba',
|
|
412
|
+
'radius',
|
|
413
|
+
'rgbaMode'].map(function (key) { return vaoOBJ(key); }));
|
|
414
|
+
this.bearingLineVAO = (_c = this.lineProgram).createVAO.apply(_c, ['centerCoords2d', 'centerCoords3d', 'bearingTargetCoords2d', 'bearingTargetCoords3d', 'bearingDashRatio', 'dashOpacity', 'rgba'
|
|
415
|
+
].map(function (key) { return vaoOBJ(key); }));
|
|
416
|
+
this.circleVao = (_d = this.circleProgram).createVAO.apply(_d, ["centerCoords2dflat", "rgbaMercator", "circleDashAngleMercator", "dashOpacityMercator"
|
|
417
|
+
].map(function (key) { return vaoOBJ(key); }));
|
|
418
|
+
this.circle3DVao = (_e = this.circle3DProgram).createVAO.apply(_e, ["centerCoords3d", "targetCoords3d", "rgba", "circleDashAngle", "dashOpacity"
|
|
419
|
+
].map(function (key) { return vaoOBJ(key); }));
|
|
420
|
+
};
|
|
421
|
+
BearingLinePlugin.prototype.draw3D = function () {
|
|
422
|
+
var gl = this.gl;
|
|
423
|
+
gl.disable(gl.DEPTH_TEST);
|
|
424
|
+
var is3D = this.globe.api_GetCurrentGeometry() === 0;
|
|
425
|
+
var drawRange = { first: 0, count: this.bufferOrchestrator.length };
|
|
426
|
+
this.lineProgram.draw(this.lineVao, { drawRange: drawRange }, this._opacity);
|
|
427
|
+
if (this.drawAngleRing) {
|
|
428
|
+
this.pieceOfPieProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity * 0.8, exports.RINGPARTIAL_DRAW_MODE.TRIANGLE_FAN);
|
|
429
|
+
this.pieceOfPieProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity * 0.8, exports.RINGPARTIAL_DRAW_MODE.LINE_STRIP);
|
|
430
|
+
}
|
|
431
|
+
if (this.drawBearingLine) {
|
|
432
|
+
// this.lineProgram.draw(this.bearingLineVAO, this.bufferOrchestrator.length, this._opacity );
|
|
433
|
+
this.lineProgram.draw(this.bearingLineVAO, { drawRange: drawRange }, this._opacity);
|
|
434
|
+
}
|
|
435
|
+
if (this.drawVRM) {
|
|
436
|
+
if (is3D) {
|
|
437
|
+
this.circle3DProgram.draw(this.circle3DVao, this.bufferOrchestrator.length, this._opacity);
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this.circleFlatEdgeCount, this._opacity);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (this.drawText) {
|
|
444
|
+
this._textWritersMap.forEach(function (writer) { return writer.draw(); });
|
|
445
|
+
}
|
|
446
|
+
gl.enable(gl.DEPTH_TEST);
|
|
447
|
+
};
|
|
448
|
+
BearingLinePlugin.prototype.free = function () {
|
|
449
|
+
if (this.isFreed)
|
|
450
|
+
return;
|
|
451
|
+
this.bufferManagersCompMap.forEach(function (_a) {
|
|
452
|
+
var bufferManager = _a.bufferManager, adaptor = _a.adaptor;
|
|
453
|
+
bufferManager.free();
|
|
454
|
+
});
|
|
455
|
+
var _a = this, gl = _a.gl, globe = _a.globe;
|
|
456
|
+
gl.deleteVertexArray(this.lineVao);
|
|
457
|
+
gl.deleteVertexArray(this.ringVao);
|
|
458
|
+
gl.deleteVertexArray(this.bearingLineVAO);
|
|
459
|
+
gl.deleteVertexArray(this.circleVao);
|
|
460
|
+
gl.deleteVertexArray(this.circle3DVao);
|
|
461
|
+
naive_accurate_flexible_1.LineOnGlobeCache.release(globe);
|
|
462
|
+
piece_of_pie_1.PieceOfPieProgramCache.release(globe);
|
|
463
|
+
circle_accurate_flat_1.CircleCache.release(globe);
|
|
464
|
+
circle_accurate_3d_1.CircleCache.release(globe);
|
|
465
|
+
this.isFreed = true;
|
|
466
|
+
};
|
|
467
|
+
BearingLinePlugin.prototype._deleteTexts = function (keys) {
|
|
468
|
+
this._textWritersMap.forEach(function (writer) {
|
|
469
|
+
writer.deleteTextBulk(keys);
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
return BearingLinePlugin;
|
|
473
|
+
}());
|
|
474
|
+
exports.default = BearingLinePlugin;
|