@pirireis/webglobeplugins 0.9.11 → 0.9.13
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 +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
package/wind/vectorfieldimage.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
function getVectorField(u, v, width, height, vMin, vMax, uMin, uMax, flip) {
|
|
4
|
-
|
|
5
|
-
for (
|
|
6
|
-
for (
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const data = new Uint8ClampedArray(width * height * 4);
|
|
3
|
+
for (let row = 0; row < height; row++) {
|
|
4
|
+
for (let col = 0; col < width; col++) {
|
|
5
|
+
let k = flip ? ((height - row - 1) * width + col) : row * width + col;
|
|
6
|
+
let idx = (width * row + col) << 2; // Multiply by 4 for RGBA
|
|
9
7
|
if (u[k] === null || v[k] === null || isNaN(u[k]) || !isFinite(u[k]) || isNaN(v[k]) || !isFinite(v[k])) {
|
|
10
8
|
data[idx] = 0; // R
|
|
11
9
|
data[idx + 1] = 0; // G
|
|
@@ -22,4 +20,4 @@ function getVectorField(u, v, width, height, vMin, vMax, uMin, uMax, flip) {
|
|
|
22
20
|
}
|
|
23
21
|
return data;
|
|
24
22
|
}
|
|
25
|
-
|
|
23
|
+
export default getVectorField;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AttachedTextWriter = void 0;
|
|
4
|
-
var webglobe_1 = require("@pirireis/webglobe");
|
|
5
|
-
var typecheck_1 = require("../util/check/typecheck");
|
|
1
|
+
import { CSZMode } from "@pirireis/webglobe";
|
|
2
|
+
import { isTextFont, opacityCheck } from "../util/check/typecheck";
|
|
6
3
|
/**
|
|
7
4
|
* Light wight version of context text writer.
|
|
8
5
|
* The parameters by text are calculated on user side and inserted as items. (ContextTextWriter3 constructs text data from items)
|
|
@@ -14,26 +11,25 @@ var typecheck_1 = require("../util/check/typecheck");
|
|
|
14
11
|
* With AttachedTextWriter the glue is created by user.
|
|
15
12
|
* I observed that the users generally uses a wrapper around the plugin logic anyway. This wrapper can be used as the glue for plugin and attacked writer.
|
|
16
13
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}; } : _f;
|
|
14
|
+
export class AttachedTextWriter {
|
|
15
|
+
constructor(globe, { style = {
|
|
16
|
+
textFont: {
|
|
17
|
+
name: 'Arial',
|
|
18
|
+
textColor: '#FFFFFF', // beyaz
|
|
19
|
+
hollowColor: '#000000', // siyah
|
|
20
|
+
size: 12, // piksel
|
|
21
|
+
hollow: true,
|
|
22
|
+
bold: true,
|
|
23
|
+
italic: false,
|
|
24
|
+
},
|
|
25
|
+
opacity: 1.0,
|
|
26
|
+
zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
27
|
+
}, doDraw = true, angleOnSphere = false, zoomLevelAdaptor = (zoomLevel) => (item) => {
|
|
28
|
+
return {
|
|
29
|
+
opacityMultiplier: 1,
|
|
30
|
+
sizeMultiplier: 1
|
|
31
|
+
};
|
|
32
|
+
}, } = {}) {
|
|
37
33
|
this.globe = globe;
|
|
38
34
|
this._itemMap = new Map();
|
|
39
35
|
this.doDraw = doDraw;
|
|
@@ -41,53 +37,51 @@ var AttachedTextWriter = /** @class */ (function () {
|
|
|
41
37
|
this.zoomLevelAdaptor = zoomLevelAdaptor;
|
|
42
38
|
this.setStyle(style);
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
setOpacity(opacity) {
|
|
41
|
+
opacityCheck(opacity);
|
|
46
42
|
this._style.opacity = opacity;
|
|
47
43
|
this.globe.DrawRender();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
}
|
|
45
|
+
setStyle(style) {
|
|
46
|
+
isTextFont(style.textFont);
|
|
51
47
|
this._style = style;
|
|
52
48
|
this.globe.DrawRender();
|
|
53
|
-
}
|
|
49
|
+
}
|
|
54
50
|
/**
|
|
55
51
|
*
|
|
56
52
|
* @param {{text, long, lat, z = 0, xOffset = 0, yOffset = 0, isAngleOn = false, Angle = 0 }} item
|
|
57
53
|
* @returns
|
|
58
54
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
insertItem(item) {
|
|
56
|
+
const key = this.keyAdaptor ? this.keyAdaptor(item) : item;
|
|
61
57
|
this._itemMap.set(key, item);
|
|
62
58
|
this.globe.DrawRender();
|
|
63
|
-
}
|
|
59
|
+
}
|
|
64
60
|
// TODO: use item style
|
|
65
|
-
|
|
61
|
+
draw() {
|
|
66
62
|
if (!this.doDraw) {
|
|
67
63
|
return;
|
|
68
64
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_itemMap.forEach(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
long
|
|
80
|
-
lat
|
|
81
|
-
z
|
|
82
|
-
}, zMode)
|
|
83
|
-
|
|
65
|
+
const { globe, _itemMap, _style } = this;
|
|
66
|
+
const { zMode, textFont, opacity } = _style;
|
|
67
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
68
|
+
const angleIsOn = is3D ? true : this.angleOnSphere;
|
|
69
|
+
const zoomLevel = globe.api_GetCurrentLODWithDecimal();
|
|
70
|
+
const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
|
|
71
|
+
const theSize = textFont.size;
|
|
72
|
+
_itemMap.forEach((item, key) => {
|
|
73
|
+
const { text, long, lat, z = 0, xOffset = 0, yOffset = 0, isAngleOn = false, angle = 0 } = item;
|
|
74
|
+
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
75
|
+
long,
|
|
76
|
+
lat,
|
|
77
|
+
z
|
|
78
|
+
}, zMode);
|
|
79
|
+
const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(item);
|
|
84
80
|
textFont.size = sizeMultiplier * theSize;
|
|
85
81
|
if (x !== null && y !== null) {
|
|
86
82
|
globe.api_DrawContextText(text, textFont, opacityMultiplier * opacity, { x: x + xOffset, y: y - yOffset }, (isAngleOn && angleIsOn), angle);
|
|
87
83
|
}
|
|
88
84
|
});
|
|
89
85
|
textFont.size = theSize;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
}());
|
|
93
|
-
exports.AttachedTextWriter = AttachedTextWriter;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ContextTextWriter = void 0;
|
|
4
|
-
var webglobe_1 = require("@pirireis/webglobe");
|
|
5
|
-
var defaultStyle = {
|
|
1
|
+
import { CSZMode } from "@pirireis/webglobe";
|
|
2
|
+
const defaultStyle = {
|
|
6
3
|
textFont: {
|
|
7
4
|
name: 'Arial',
|
|
8
5
|
textColor: '#FFFFFF', // beyaz
|
|
@@ -13,93 +10,85 @@ var defaultStyle = {
|
|
|
13
10
|
italic: false,
|
|
14
11
|
},
|
|
15
12
|
opacity: 1.0,
|
|
16
|
-
zMode:
|
|
13
|
+
zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.style, style = _c === void 0 ? null : _c, _d = _b.doDraw, doDraw = _d === void 0 ? true : _d;
|
|
15
|
+
export class ContextTextWriter {
|
|
16
|
+
constructor(globe, { style = null, doDraw = true } = {}) {
|
|
21
17
|
this.globe = globe;
|
|
22
18
|
this.itemMap = new Map();
|
|
23
19
|
this.style = style || defaultStyle;
|
|
24
20
|
this.doDraw = doDraw;
|
|
25
21
|
}
|
|
26
|
-
|
|
22
|
+
setDoDraw(bool) {
|
|
27
23
|
this.doDraw = bool;
|
|
28
|
-
}
|
|
29
|
-
|
|
24
|
+
}
|
|
25
|
+
setStyle(style) {
|
|
30
26
|
this.style = style;
|
|
31
|
-
}
|
|
32
|
-
|
|
27
|
+
}
|
|
28
|
+
setOpacity(opacity) {
|
|
33
29
|
this.style.opacity = opacity;
|
|
34
|
-
}
|
|
30
|
+
}
|
|
35
31
|
// Clean this ask Front dev
|
|
36
|
-
|
|
32
|
+
doDraw(boolean) {
|
|
37
33
|
this.doDraw = boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
34
|
+
}
|
|
35
|
+
draw() {
|
|
40
36
|
if (!this.doDraw)
|
|
41
37
|
return;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
for (
|
|
45
|
-
|
|
46
|
-
var _e = globe.api_GetScreenPointFromGeo({
|
|
38
|
+
const { globe, style, itemMap } = this;
|
|
39
|
+
const { textFont, opacity: opacity_ } = style;
|
|
40
|
+
for (const [key, { lat, long, text, opacity = null }] of itemMap) {
|
|
41
|
+
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
47
42
|
long: long,
|
|
48
43
|
lat: lat,
|
|
49
44
|
z: 0,
|
|
50
|
-
}, style.zMode ===
|
|
51
|
-
|
|
45
|
+
}, style.zMode === CSZMode.Z_MSL);
|
|
46
|
+
const o = opacity === null ? opacity_ : opacity * opacity_;
|
|
52
47
|
if (x !== null && y !== null)
|
|
53
|
-
globe.api_DrawContextTextMultiLine(text, textFont, o, { x
|
|
48
|
+
globe.api_DrawContextTextMultiLine(text, textFont, o, { x, y });
|
|
54
49
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.itemMap.set(key, { lat
|
|
58
|
-
}
|
|
59
|
-
|
|
50
|
+
}
|
|
51
|
+
insertText(key, lat, long, text) {
|
|
52
|
+
this.itemMap.set(key, { lat, long, text });
|
|
53
|
+
}
|
|
54
|
+
updateOpacityOfItem(key, opacity) {
|
|
60
55
|
this.itemMap.get(key).opacity = opacity;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
for (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var data = this.itemMap.get(key);
|
|
56
|
+
}
|
|
57
|
+
updateOpacityBulk(items, keyAdaptor, valueAdaptor) {
|
|
58
|
+
for (const item of items) {
|
|
59
|
+
const key = keyAdaptor(item);
|
|
60
|
+
const opacity = valueAdaptor(item);
|
|
61
|
+
const data = this.itemMap.get(key);
|
|
68
62
|
data.opacity = opacity;
|
|
69
63
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
}
|
|
65
|
+
updateText(key, text) {
|
|
66
|
+
const item = this.itemMap.get(key);
|
|
73
67
|
item.text = text;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
}
|
|
69
|
+
updateCoords(key, lat, long) {
|
|
70
|
+
const item = this.itemMap.get(key);
|
|
77
71
|
item.lat = lat;
|
|
78
72
|
item.long = long;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
for (
|
|
82
|
-
var item = items_2[_i];
|
|
73
|
+
}
|
|
74
|
+
insertTextBulk(items) {
|
|
75
|
+
for (const item of items) {
|
|
83
76
|
this.itemMap.set(item.key, item);
|
|
84
77
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
for (
|
|
88
|
-
|
|
89
|
-
var item = this.itemMap.get(key);
|
|
78
|
+
}
|
|
79
|
+
updateTextCoordsBulk(items) {
|
|
80
|
+
for (const { key, lat, long } of items) {
|
|
81
|
+
const item = this.itemMap.get(key);
|
|
90
82
|
item.lat = lat;
|
|
91
83
|
item.long = long;
|
|
92
84
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
for (
|
|
96
|
-
var key = keys_1[_i];
|
|
85
|
+
}
|
|
86
|
+
deleteTextBulk(keys) {
|
|
87
|
+
for (const key of keys) {
|
|
97
88
|
this.itemMap.delete(key);
|
|
98
89
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
90
|
+
}
|
|
91
|
+
clear() {
|
|
101
92
|
this.itemMap.clear();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}());
|
|
105
|
-
exports.ContextTextWriter = ContextTextWriter;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ContextTextWriter3 = void 0;
|
|
4
|
-
var webglobe_1 = require("@pirireis/webglobe");
|
|
5
|
-
var typecheck_1 = require("../util/check/typecheck");
|
|
1
|
+
import { CSZMode } from "@pirireis/webglobe";
|
|
2
|
+
import { isTextFont, opacityCheck } from "../util/check/typecheck";
|
|
6
3
|
/**
|
|
7
4
|
* TODOs:
|
|
8
5
|
* 1) update all if initials change (propably need a context and a callback to iterate over zPayload)
|
|
@@ -11,26 +8,25 @@ var typecheck_1 = require("../util/check/typecheck");
|
|
|
11
8
|
*
|
|
12
9
|
* TODO: key check and raise error if doesnt exist
|
|
13
10
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}; } : _p;
|
|
11
|
+
export class ContextTextWriter3 {
|
|
12
|
+
constructor(globe, { style = {
|
|
13
|
+
textFont: {
|
|
14
|
+
name: 'Arial',
|
|
15
|
+
textColor: '#FFFFFF', // beyaz
|
|
16
|
+
hollowColor: '#000000', // siyah
|
|
17
|
+
size: 12, // piksel
|
|
18
|
+
hollow: true,
|
|
19
|
+
bold: true,
|
|
20
|
+
italic: false,
|
|
21
|
+
},
|
|
22
|
+
opacity: 1.0,
|
|
23
|
+
zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
24
|
+
}, xOffset = 0, yOffset = 0, doDraw = true, textAdaptor = null, coordinatesAdaptor = null, keyAdaptor = null, opacityAdaptor = null, angleAdaptor = null, angleOnSphere = false, positionAdaptor = (item, i, container, properties) => "left", zoomLevelAdaptor = (zoomLevel) => (item) => {
|
|
25
|
+
return {
|
|
26
|
+
opacityMultiplier: 1,
|
|
27
|
+
sizeMultiplier: 1
|
|
28
|
+
};
|
|
29
|
+
} } = {}) {
|
|
34
30
|
this.globe = globe;
|
|
35
31
|
this.itemMap = new Map();
|
|
36
32
|
this.setStyle(style);
|
|
@@ -41,20 +37,20 @@ var ContextTextWriter3 = /** @class */ (function () {
|
|
|
41
37
|
this.keyAdaptor = keyAdaptor;
|
|
42
38
|
this.zoomLevelAdaptor = zoomLevelAdaptor;
|
|
43
39
|
this.positionAdaptor = positionAdaptor;
|
|
44
|
-
this.opacityAdaptor = opacityAdaptor ? opacityAdaptor :
|
|
40
|
+
this.opacityAdaptor = opacityAdaptor ? opacityAdaptor : () => 1;
|
|
45
41
|
this.angleOnSphere = angleOnSphere;
|
|
46
42
|
if (angleAdaptor) {
|
|
47
43
|
this.angleAdaptor = angleAdaptor;
|
|
48
44
|
this.angleAdaptorIsOn = true;
|
|
49
45
|
}
|
|
50
46
|
else {
|
|
51
|
-
this.angleAdaptor =
|
|
47
|
+
this.angleAdaptor = () => null;
|
|
52
48
|
this.angleAdaptorIsOn = false;
|
|
53
49
|
}
|
|
54
50
|
this.xOffset = xOffset;
|
|
55
51
|
this.yOffset = yOffset;
|
|
56
52
|
}
|
|
57
|
-
|
|
53
|
+
_checkParameterTypes(textAdaptor, coordinatesAdaptor, keyAdaptor, opacityAdaptor, angleAdaptor, xOffset, yOffset) {
|
|
58
54
|
if (textAdaptor !== null)
|
|
59
55
|
if (!(textAdaptor instanceof Function))
|
|
60
56
|
throw new Error("textAdaptor is not an instance of a Function");
|
|
@@ -74,87 +70,82 @@ var ContextTextWriter3 = /** @class */ (function () {
|
|
|
74
70
|
throw new Error("xOffset type is not a number");
|
|
75
71
|
if (typeof yOffset !== "number")
|
|
76
72
|
throw new Error("yOffset type is not a number");
|
|
77
|
-
}
|
|
78
|
-
|
|
73
|
+
}
|
|
74
|
+
setKeyAdaptor(adaptor) {
|
|
79
75
|
this.keyAdaptor = adaptor;
|
|
80
|
-
}
|
|
81
|
-
|
|
76
|
+
}
|
|
77
|
+
setDoDraw(bool) {
|
|
82
78
|
this.doDraw = bool;
|
|
83
79
|
this.globe.DrawRender();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
}
|
|
81
|
+
setStyle(style) {
|
|
82
|
+
isTextFont(style.textFont);
|
|
83
|
+
opacityCheck(style.opacity); //TODO: use shallow copy
|
|
88
84
|
this.style = style;
|
|
89
85
|
this.globe.DrawRender();
|
|
90
|
-
}
|
|
91
|
-
|
|
86
|
+
}
|
|
87
|
+
setOpacity(opacity) {
|
|
92
88
|
this.style.opacity = opacity;
|
|
93
89
|
this.globe.DrawRender();
|
|
94
|
-
}
|
|
95
|
-
|
|
90
|
+
}
|
|
91
|
+
draw() {
|
|
96
92
|
if (!this.doDraw)
|
|
97
93
|
return;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
for (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var _e = globe.api_GetScreenPointFromGeo({
|
|
94
|
+
const { globe, style, itemMap, xOffset, yOffset } = this;
|
|
95
|
+
const { textFont, opacity: opacity_ } = style;
|
|
96
|
+
const textSize = textFont.size;
|
|
97
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
98
|
+
const angleIsOn = is3D ? (this.angleAdaptorIsOn && this.angleOnSphere) : (this.angleAdaptorIsOn);
|
|
99
|
+
const zoomLevel = globe.api_GetCurrentLODWithDecimal();
|
|
100
|
+
const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
|
|
101
|
+
for (const item of itemMap.values()) {
|
|
102
|
+
const { lat, long, text, opacity = null, angle = null, zPayload, position } = item;
|
|
103
|
+
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
109
104
|
long: long,
|
|
110
105
|
lat: lat,
|
|
111
106
|
z: 0,
|
|
112
|
-
}, style.zMode ===
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
}, style.zMode === CSZMode.Z_MSL);
|
|
108
|
+
const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(zPayload);
|
|
109
|
+
const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
|
|
115
110
|
textFont.size = sizeMultiplier * textSize;
|
|
116
111
|
textFont.position = position;
|
|
117
112
|
if (x !== null && y !== null)
|
|
118
113
|
globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffset, y: y - yOffset }, angleIsOn, angle);
|
|
119
114
|
}
|
|
120
115
|
textFont.size = textSize;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
_this.insertText(v, i, c, properties);
|
|
116
|
+
}
|
|
117
|
+
insertTextBulk(container, properties) {
|
|
118
|
+
container.forEach((v, i, c) => {
|
|
119
|
+
this.insertText(v, i, c, properties);
|
|
126
120
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
for (
|
|
130
|
-
var key = keys_1[_i];
|
|
121
|
+
}
|
|
122
|
+
deleteTextBulk(keys) {
|
|
123
|
+
for (const key of keys) {
|
|
131
124
|
this.itemMap.delete(key);
|
|
132
125
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
126
|
+
}
|
|
127
|
+
insertText(item, id, container, properties) {
|
|
128
|
+
const key = this.keyAdaptor(item, id, container, properties);
|
|
129
|
+
const coords = this.coordinatesAdaptor(item, id, container, properties);
|
|
137
130
|
if (coords == null) {
|
|
138
131
|
this.itemMap.delete(key);
|
|
139
132
|
return;
|
|
140
133
|
}
|
|
141
|
-
|
|
134
|
+
const text = this.textAdaptor(item, id, container, properties);
|
|
142
135
|
if (text == null) {
|
|
143
136
|
this.itemMap.delete(key);
|
|
144
137
|
return;
|
|
145
138
|
}
|
|
146
139
|
;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.itemMap.set(key, { long: coords.long, lat: coords.lat, text
|
|
151
|
-
}
|
|
152
|
-
|
|
140
|
+
const opacity = this.opacityAdaptor(item, id, container, properties);
|
|
141
|
+
const angle = this.angleAdaptor(item, id, container, properties);
|
|
142
|
+
const position = this.positionAdaptor(item, id, container, properties);
|
|
143
|
+
this.itemMap.set(key, { long: coords.long, lat: coords.lat, text, opacity, angle, zPayload: item, position });
|
|
144
|
+
}
|
|
145
|
+
clear() {
|
|
153
146
|
this.itemMap.clear();
|
|
154
|
-
}
|
|
155
|
-
|
|
147
|
+
}
|
|
148
|
+
free() {
|
|
156
149
|
this.itemMap = null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
}());
|
|
160
|
-
exports.ContextTextWriter3 = ContextTextWriter3;
|
|
150
|
+
}
|
|
151
|
+
}
|
package/write-text/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextTextWriter = void 0;
|
|
4
|
-
var context_text_1 = require("./context-text");
|
|
5
|
-
Object.defineProperty(exports, "ContextTextWriter", { enumerable: true, get: function () { return context_text_1.ContextTextWriter; } });
|
|
1
|
+
export { ContextTextWriter } from "./context-text";
|