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