@pirireis/webglobeplugins 0.9.11 → 0.9.12
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 +8 -8
- package/Math/arc.js +18 -18
- package/Math/bounds/line-bbox.js +78 -80
- package/Math/constants.js +3 -3
- package/Math/juction/arc-plane.js +23 -23
- package/Math/juction/line-sphere.js +11 -11
- package/Math/juction/plane-plane.js +11 -11
- package/Math/line.js +14 -16
- package/Math/methods.js +65 -70
- package/Math/plane.js +16 -18
- package/Math/quaternion.js +45 -49
- package/Math/utils.js +2 -2
- package/Math/vec3.js +42 -45
- package/algorithms/search-binary.js +4 -4
- package/altitude-locator/draw-subset-obj.js +7 -8
- package/altitude-locator/plugin.js +98 -114
- package/arrowfield/adaptor.js +3 -4
- package/arrowfield/index.js +2 -2
- package/arrowfield/plugin.js +62 -65
- package/bearing-line/index.js +1 -1
- package/bearing-line/plugin.js +200 -226
- package/circle-line-chain/chain-list-map.js +82 -88
- package/circle-line-chain/plugin.js +134 -165
- package/circle-line-chain/util.js +1 -1
- package/compass-rose/compass-rose-padding-flat.js +108 -133
- package/compass-rose/compass-text-writer.js +62 -70
- package/compass-rose/index.js +2 -2
- package/compassrose/compassrose.js +46 -50
- package/compassrose/index.js +1 -1
- package/heatwave/index.js +2 -2
- package/heatwave/isobar/objectarraylabels.js +44 -48
- package/heatwave/isobar/plugin.js +104 -123
- package/heatwave/isobar/quadtreecontours.js +76 -92
- package/heatwave/plugins/heatwaveglobeshell.js +69 -87
- package/index.js +11 -11
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -64
- package/partialrings/index.js +1 -1
- package/partialrings/plugin.js +48 -84
- package/partialrings/program.js +136 -47
- package/pin/pin-object-array.js +83 -86
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
- package/point-heat-map/plugin-webworker.js +40 -45
- package/point-heat-map/point-to-heat-map-flow.js +40 -42
- package/point-tracks/key-methods.js +1 -1
- package/point-tracks/plugin.js +137 -162
- package/programs/arrowfield/index.js +1 -1
- package/programs/arrowfield/logic.js +170 -62
- package/programs/arrowfield/object.js +33 -35
- package/programs/data2legend/density-to-legend.js +45 -21
- package/programs/data2legend/point-to-density-texture.js +52 -27
- package/programs/float2legendwithratio/index.js +1 -1
- package/programs/float2legendwithratio/logic.js +88 -42
- package/programs/float2legendwithratio/object.js +43 -46
- package/programs/globe-util/is-globe-moved.js +10 -11
- package/programs/globeshell/index.js +1 -1
- package/programs/globeshell/wiggle/index.js +1 -1
- package/programs/globeshell/wiggle/logic.js +191 -98
- package/programs/globeshell/wiggle/object.js +33 -35
- package/programs/helpers/blender/program.js +36 -19
- package/programs/helpers/fadeaway/index.js +1 -1
- package/programs/helpers/fadeaway/logic.js +35 -13
- package/programs/helpers/fadeaway/object.js +9 -10
- package/programs/helpers/index.js +1 -1
- package/programs/index.js +8 -8
- package/programs/line-on-globe/angled-line.js +91 -32
- package/programs/line-on-globe/circle-accurate-3d.js +82 -32
- package/programs/line-on-globe/circle-accurate-flat.js +108 -50
- package/programs/line-on-globe/circle-accurate.js +103 -33
- package/programs/line-on-globe/circle.js +97 -32
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
- package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
- package/programs/line-on-globe/linestrip.js +111 -45
- package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
- package/programs/line-on-globe/to-the-surface.js +58 -29
- package/programs/line-on-globe/util.js +1 -1
- package/programs/picking/pickable-renderer.js +117 -33
- package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
- package/programs/point-on-globe/element-point-glow.js +103 -35
- package/programs/point-on-globe/square-pixel-point.js +76 -27
- package/programs/programcache.js +13 -13
- package/programs/rings/distancering/circleflatprogram.js +63 -21
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
- package/programs/rings/distancering/index.js +4 -4
- package/programs/rings/distancering/paddyflatprogram.js +73 -20
- package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
- package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
- package/programs/rings/partial-ring/piece-of-pie.js +137 -35
- package/programs/totems/camerauniformblock.js +64 -51
- package/programs/totems/canvas-webglobe-info.js +48 -40
- package/programs/totems/gpu-selection-uniform-block.js +44 -40
- package/programs/totems/index.js +1 -1
- package/programs/two-d/pixel-padding-for-compass.js +90 -29
- package/programs/util.js +6 -7
- package/programs/vectorfields/index.js +1 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
- package/programs/vectorfields/logics/index.js +3 -3
- package/programs/vectorfields/logics/pixelbased.js +91 -35
- package/programs/vectorfields/logics/ubo.js +31 -25
- package/programs/vectorfields/pingpongbuffermanager.js +30 -34
- package/rangerings/index.js +4 -4
- package/rangerings/plugin.js +202 -258
- package/rangerings/rangeringangletext.js +108 -120
- package/rangerings/ring-account.js +52 -69
- package/shaders/fragment-toy/firework.js +55 -1
- package/shaders/fragment-toy/singularity.js +55 -1
- package/timetracks/adaptors-line-strip.js +26 -37
- package/timetracks/adaptors.js +47 -61
- package/timetracks/index.js +4 -4
- package/timetracks/plugin-line-strip.js +63 -71
- package/timetracks/plugin.js +69 -77
- package/timetracks/program-line-strip.js +296 -103
- package/timetracks/program.js +419 -113
- package/timetracks/programpoint-line-strip.js +97 -44
- package/timetracks/programpoint.js +90 -44
- package/util/account/bufferoffsetmanager.js +72 -95
- package/util/account/index.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
- package/util/account/single-attribute-buffer-management/index.js +3 -3
- package/util/account/single-attribute-buffer-management/object-store.js +29 -30
- package/util/account/util.js +2 -4
- package/util/algorithms/search-binary.js +4 -4
- package/util/check/get.js +5 -5
- package/util/check/typecheck.js +13 -15
- package/util/geometry/index.js +9 -11
- package/util/gl-util/buffer/attribute-loader.js +8 -20
- package/util/gl-util/buffer/index.js +1 -1
- package/util/gl-util/draw-options/methods.js +8 -9
- package/util/gl-util/uniform-block/manager.js +67 -67
- package/util/heatwavedatamanager/datamanager.js +56 -116
- package/util/heatwavedatamanager/index.js +2 -2
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
- package/util/index.js +6 -6
- package/util/interpolation/timetrack/index.js +1 -1
- package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
- package/util/interpolation/timetrack/web-worker-str.js +179 -1
- package/util/interpolation/timetrack/web-worker.js +4 -4
- package/util/jshelpers/data-filler.js +7 -7
- package/util/jshelpers/timefilters.js +7 -7
- package/util/picking/fence.js +7 -7
- package/util/picking/picker-displayer.js +46 -52
- package/util/programs/draw-texture-on-canvas.js +39 -21
- package/util/programs/shapesonglobe.js +104 -64
- package/util/programs/supersampletotextures.js +45 -39
- package/util/programs/texturetoglobe.js +98 -48
- package/util/shaderfunctions/geometrytransformations.js +322 -27
- package/util/shaderfunctions/nodata.js +7 -1
- package/util/shaderfunctions/noisefunctions.js +39 -9
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/rasteroverlay.js +35 -37
- package/util/webglobjectbuilders.js +55 -60
- package/util/webglobjectbuilders1.js +48 -49
- package/waveparticles/adaptor.js +6 -7
- package/waveparticles/index.js +2 -2
- package/waveparticles/plugin.js +79 -84
- package/wind/imagetovectorfieldandmagnitude.js +15 -15
- package/wind/index.js +4 -4
- package/wind/plugin.js +453 -251
- package/wind/vectorfieldimage.js +5 -5
- package/write-text/attached-text-writer.js +46 -48
- package/write-text/context-text.js +51 -58
- package/write-text/context-text3.js +69 -74
|
@@ -1,54 +1,42 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.PixelPaddingCompassPlugin = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} : _g;
|
|
4
|
+
const pixel_padding_for_compass_1 = require("../programs/two-d/pixel-padding-for-compass");
|
|
5
|
+
const account_1 = require("../util/account");
|
|
6
|
+
const compass_text_writer_1 = require("./compass-text-writer");
|
|
7
|
+
const PaddingAngle = 30;
|
|
8
|
+
const textGapFit = 10;
|
|
9
|
+
class PixelPaddingCompassPlugin {
|
|
10
|
+
constructor(id, { opacity = 1, textAngleOn = true, defaultProperties = {
|
|
11
|
+
rgba: [1, 1, 1, 1],
|
|
12
|
+
pixelRadiusRatioBig: 0.8,
|
|
13
|
+
pixelRadiusRatioSmall: 0.6,
|
|
14
|
+
}, font = {
|
|
15
|
+
name: 'Arial',
|
|
16
|
+
textColor: '#FFFFFF',
|
|
17
|
+
hollowColor: '#000000',
|
|
18
|
+
size: 12, // piksel
|
|
19
|
+
hollow: true,
|
|
20
|
+
bold: true,
|
|
21
|
+
italic: false,
|
|
22
|
+
}, northFont = {
|
|
23
|
+
name: 'Arial',
|
|
24
|
+
textColor: '#BBAA00',
|
|
25
|
+
hollowColor: '#000000',
|
|
26
|
+
size: 14, // piksel
|
|
27
|
+
hollow: true,
|
|
28
|
+
bold: true,
|
|
29
|
+
italic: false,
|
|
30
|
+
} } = {}) {
|
|
43
31
|
this.id = id;
|
|
44
32
|
this.textAngleOn = textAngleOn;
|
|
45
33
|
this.defaultProperties = defaultProperties;
|
|
46
34
|
this.bufferOrchestrator = new account_1.BufferOrchestrator({ capacity: 10 });
|
|
47
|
-
this._font_hold = { font
|
|
35
|
+
this._font_hold = { font, northFont };
|
|
48
36
|
this.compassMap = new CompassMap(this);
|
|
49
37
|
this._opacity = opacity;
|
|
50
38
|
}
|
|
51
|
-
|
|
39
|
+
init(globe, gl) {
|
|
52
40
|
this.globe = globe;
|
|
53
41
|
this.resize();
|
|
54
42
|
this.gl = gl;
|
|
@@ -56,7 +44,7 @@ var PixelPaddingCompassPlugin = /** @class */ (function () {
|
|
|
56
44
|
this._createTextWriter();
|
|
57
45
|
}
|
|
58
46
|
this._initOrchestrations();
|
|
59
|
-
}
|
|
47
|
+
}
|
|
60
48
|
/**
|
|
61
49
|
* @param {string} key
|
|
62
50
|
* @param {number} long
|
|
@@ -66,83 +54,76 @@ var PixelPaddingCompassPlugin = /** @class */ (function () {
|
|
|
66
54
|
* @property {number} pixelRadiusRatioSmall
|
|
67
55
|
* @property {[4 numbers between 0-1]} rgba
|
|
68
56
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.__insertText(key, null, null, { properties: properties, update: true });
|
|
57
|
+
insert(key, long, lat, properties = null) {
|
|
58
|
+
this.__insertText(key, null, null, { properties, update: true });
|
|
72
59
|
this.compassMap.insert(key, long, lat, properties);
|
|
73
60
|
this.globe.DrawRender();
|
|
74
|
-
}
|
|
61
|
+
}
|
|
75
62
|
/**
|
|
76
63
|
*
|
|
77
64
|
* @param {string} key
|
|
78
65
|
*/
|
|
79
|
-
|
|
66
|
+
delete(key) {
|
|
80
67
|
this.compassMap.delete(key);
|
|
81
68
|
this.globe.DrawRender();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.textFont, textFont = _c === void 0 ? null : _c, _d = _b.northFont, northFont = _d === void 0 ? null : _d;
|
|
69
|
+
}
|
|
70
|
+
setFont({ textFont = null, northFont = null } = {}) {
|
|
85
71
|
if (textFont)
|
|
86
72
|
this.writer.setFont(textFont);
|
|
87
73
|
if (northFont)
|
|
88
74
|
this.writer.setNorthFont(northFont);
|
|
89
75
|
this.globe.DrawRender();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var _a;
|
|
76
|
+
}
|
|
77
|
+
setOpacity(opacity) {
|
|
93
78
|
this._opacity = opacity;
|
|
94
|
-
|
|
79
|
+
this.writer?.setOpacity(opacity);
|
|
95
80
|
this.globe.DrawRender();
|
|
96
|
-
}
|
|
97
|
-
|
|
81
|
+
}
|
|
82
|
+
getTextWriter() {
|
|
98
83
|
return this.writer;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var _this = this;
|
|
103
|
-
var _b = this, gl = _b.gl, globe = _b.globe;
|
|
84
|
+
}
|
|
85
|
+
_initOrchestrations() {
|
|
86
|
+
const { gl, globe } = this;
|
|
104
87
|
this.paddingProgram = pixel_padding_for_compass_1.PixelPaddingForFlatCompassCache.get(globe);
|
|
105
88
|
{
|
|
106
89
|
// createBuffers
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
const bufferType = "DYNAMIC_DRAW";
|
|
91
|
+
const initialCapacity = this.bufferOrchestrator.capacity;
|
|
109
92
|
this.bufferManagersCompMap = new Map([
|
|
110
93
|
["screenCoordinates", {
|
|
111
|
-
'bufferManager': new account_1.BufferManager(gl, 2, { bufferType
|
|
112
|
-
'adaptor':
|
|
94
|
+
'bufferManager': new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
95
|
+
'adaptor': (item) => new Float32Array([item.x, item.y])
|
|
113
96
|
}],
|
|
114
97
|
["pixelRadiusRatioSmall", {
|
|
115
|
-
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType
|
|
116
|
-
'adaptor':
|
|
98
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
99
|
+
'adaptor': (item) => new Float32Array([item.properties.pixelRadiusRatioSmall])
|
|
117
100
|
}],
|
|
118
101
|
["pixelRadiusRatioBig", {
|
|
119
|
-
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType
|
|
120
|
-
'adaptor':
|
|
102
|
+
'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
103
|
+
'adaptor': (item) => new Float32Array([item.properties.pixelRadiusRatioBig])
|
|
121
104
|
}],
|
|
122
105
|
["rgba", {
|
|
123
|
-
'bufferManager': new account_1.BufferManager(gl, 4, { bufferType
|
|
124
|
-
'adaptor':
|
|
106
|
+
'bufferManager': new account_1.BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
107
|
+
'adaptor': (item) => new Float32Array(item.properties.rgba)
|
|
125
108
|
}],
|
|
126
109
|
]);
|
|
127
|
-
|
|
110
|
+
const obj = function (bufferManagerComp) {
|
|
128
111
|
return { 'buffer': bufferManagerComp.bufferManager.buffer, 'stride': 0, 'offset': 0 };
|
|
129
112
|
};
|
|
130
|
-
this.paddingVao =
|
|
113
|
+
this.paddingVao = this.paddingProgram.createVAO(...['screenCoordinates', 'pixelRadiusRatioSmall', 'pixelRadiusRatioBig', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
|
|
131
114
|
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
this.writer = new compass_text_writer_1.PixelPaddingCompassTextWriter(this.globe,
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
PixelPaddingCompassPlugin.prototype.__insertText = function (key, x, y, _a) {
|
|
141
|
-
var _b = _a === void 0 ? {} : _a, properties = _b.properties, _c = _b.update, update = _c === void 0 ? false : _c;
|
|
115
|
+
}
|
|
116
|
+
_createTextWriter() {
|
|
117
|
+
this.writer = new compass_text_writer_1.PixelPaddingCompassTextWriter(this.globe, { angle: PaddingAngle, ...this._font_hold });
|
|
118
|
+
}
|
|
119
|
+
resize() {
|
|
120
|
+
this.writer?.resize();
|
|
121
|
+
}
|
|
122
|
+
__insertText(key, x, y, { properties, update = false } = {}) {
|
|
142
123
|
if (!this.writer)
|
|
143
124
|
return;
|
|
144
125
|
if (update) {
|
|
145
|
-
|
|
126
|
+
let radius;
|
|
146
127
|
if (properties != null && properties.pixelRadiusRatioBig) {
|
|
147
128
|
radius = properties.pixelRadiusRatioBig * this.radiusMultiplier;
|
|
148
129
|
}
|
|
@@ -154,94 +135,88 @@ var PixelPaddingCompassPlugin = /** @class */ (function () {
|
|
|
154
135
|
else {
|
|
155
136
|
this.writer.insertTextItem(key, x, y);
|
|
156
137
|
}
|
|
157
|
-
}
|
|
138
|
+
}
|
|
158
139
|
// Globe API interface methods
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var _b = this, gl = _b.gl, globe = _b.globe, paddingProgram = _b.paddingProgram, paddingVao = _b.paddingVao, bufferOrchestrator = _b.bufferOrchestrator, bufferManagersCompMap = _b.bufferManagersCompMap;
|
|
163
|
-
var is3D = globe.api_GetCurrentGeometry() === 0;
|
|
140
|
+
draw2D() {
|
|
141
|
+
const { gl, globe, paddingProgram, paddingVao, bufferOrchestrator, bufferManagersCompMap } = this;
|
|
142
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
164
143
|
if (is3D)
|
|
165
144
|
return;
|
|
166
|
-
|
|
145
|
+
const items = this.compassMap.query(globe, this.writer);
|
|
167
146
|
if (items.length === 0)
|
|
168
147
|
return;
|
|
169
148
|
bufferOrchestrator.flush();
|
|
170
149
|
bufferOrchestrator.insertBulk(items, bufferManagersCompMap);
|
|
171
|
-
items.forEach(
|
|
172
|
-
|
|
150
|
+
items.forEach((v) => {
|
|
151
|
+
this.__insertText(v.key, v.x, v.y);
|
|
173
152
|
});
|
|
174
153
|
gl.disable(gl.DEPTH_TEST);
|
|
175
154
|
paddingProgram.draw(paddingVao, bufferOrchestrator.length, this._opacity);
|
|
176
155
|
gl.enable(gl.DEPTH_TEST);
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
156
|
+
this.writer?.draw();
|
|
157
|
+
}
|
|
158
|
+
free() {
|
|
180
159
|
this.compassMap.free();
|
|
181
|
-
|
|
160
|
+
const { globe, gl, paddingVao } = this;
|
|
182
161
|
gl.deleteVertexArray(paddingVao);
|
|
183
162
|
pixel_padding_for_compass_1.PixelPaddingForFlatCompassCache.release(globe);
|
|
184
|
-
this.bufferManagersCompMap.forEach(
|
|
163
|
+
this.bufferManagersCompMap.forEach(v => {
|
|
185
164
|
v.bufferManager.free();
|
|
186
165
|
});
|
|
187
|
-
}
|
|
188
|
-
|
|
166
|
+
}
|
|
167
|
+
resize() {
|
|
189
168
|
this.radiusMultiplier = this._shorterDimension() * 0.5;
|
|
190
169
|
this._reinsertAllText();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
_this.__insertText(v.key, v.x, v.y, { properties: v.properties, update: true });
|
|
170
|
+
}
|
|
171
|
+
_reinsertAllText() {
|
|
172
|
+
this.compassMap.query(this.globe, this.writer).forEach((v) => {
|
|
173
|
+
this.__insertText(v.key, v.x, v.y, { properties: v.properties, update: true });
|
|
196
174
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
175
|
+
}
|
|
176
|
+
_shorterDimension() {
|
|
177
|
+
const globe = this.globe;
|
|
200
178
|
return Math.min(globe.api_ScrW(), globe.api_ScrH());
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}());
|
|
179
|
+
}
|
|
180
|
+
}
|
|
204
181
|
exports.PixelPaddingCompassPlugin = PixelPaddingCompassPlugin;
|
|
205
|
-
|
|
206
|
-
|
|
182
|
+
class CompassMap {
|
|
183
|
+
constructor(parent) {
|
|
207
184
|
this.coordsMemory = new Map();
|
|
208
185
|
this.propertyMemory = new Map();
|
|
209
186
|
this.parent = parent;
|
|
210
187
|
}
|
|
211
|
-
|
|
212
|
-
if (properties === void 0) { properties = null; }
|
|
188
|
+
insert(key, long, lat, properties = null) {
|
|
213
189
|
this.coordsMemory.set(key, [long, lat]);
|
|
214
190
|
if (properties)
|
|
215
191
|
this.propertyMemory.set(key, properties);
|
|
216
|
-
}
|
|
217
|
-
|
|
192
|
+
}
|
|
193
|
+
delete(key) {
|
|
218
194
|
this.coordsMemory.delete(key);
|
|
219
195
|
this.propertyMemory.delete(key);
|
|
220
|
-
}
|
|
221
|
-
|
|
196
|
+
}
|
|
197
|
+
free() {
|
|
222
198
|
this.coordsMemory.clear();
|
|
223
199
|
this.propertyMemory.clear();
|
|
224
200
|
this.coordsMemory = null;
|
|
225
201
|
this.propertyMemory = null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
coordsMemory.forEach(
|
|
232
|
-
|
|
202
|
+
}
|
|
203
|
+
query(globe, writer) {
|
|
204
|
+
const { coordsMemory, propertyMemory } = this;
|
|
205
|
+
const defaultProperties = this.parent.defaultProperties;
|
|
206
|
+
const result = [];
|
|
207
|
+
coordsMemory.forEach((v, k, c) => {
|
|
208
|
+
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
233
209
|
long: v[0],
|
|
234
210
|
lat: v[1],
|
|
235
211
|
z: 0,
|
|
236
|
-
})
|
|
237
|
-
writer
|
|
212
|
+
});
|
|
213
|
+
writer?.insertTextItem(k, x, y);
|
|
238
214
|
if (x !== null) {
|
|
239
|
-
|
|
240
|
-
result.push({ key: k, x
|
|
215
|
+
const properties = { ...defaultProperties, ...propertyMemory.get(k) };
|
|
216
|
+
result.push({ key: k, x, y, properties });
|
|
241
217
|
}
|
|
242
218
|
});
|
|
243
219
|
return result;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
}());
|
|
220
|
+
}
|
|
221
|
+
}
|
|
247
222
|
function isOnTheScreen(globe, points) { }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PixelPaddingCompassTextWriter = void 0;
|
|
4
|
-
|
|
4
|
+
const webglobe_1 = require("@pirireis/webglobe");
|
|
5
5
|
// const defaultStyle = {
|
|
6
6
|
// textFont: {
|
|
7
7
|
// name: 'Arial',
|
|
@@ -21,27 +21,26 @@ var webglobe_1 = require("@pirireis/webglobe");
|
|
|
21
21
|
* 2) expose a mechanic to update text on zoom change
|
|
22
22
|
* 3) extend the mechanic on 2 to other events
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} : _d, _e = _b.doDraw, doDraw = _e === void 0 ? true : _e, _f = _b.angle, angle = _f === void 0 ? 30 : _f;
|
|
24
|
+
const yGapFit = -2;
|
|
25
|
+
const xGapFit = -5;
|
|
26
|
+
class PixelPaddingCompassTextWriter {
|
|
27
|
+
constructor(globe, { font = {
|
|
28
|
+
name: 'Arial',
|
|
29
|
+
textColor: '#FFFFFF', // beyaz
|
|
30
|
+
hollowColor: '#000000', // siyah
|
|
31
|
+
size: 12, // piksel
|
|
32
|
+
hollow: true,
|
|
33
|
+
bold: true,
|
|
34
|
+
italic: false,
|
|
35
|
+
}, northFont = {
|
|
36
|
+
name: 'Arial',
|
|
37
|
+
textColor: '#BB0000', // beyaz
|
|
38
|
+
hollowColor: '#000000', // siyah
|
|
39
|
+
size: 14, // piksel
|
|
40
|
+
hollow: true,
|
|
41
|
+
bold: true,
|
|
42
|
+
italic: false,
|
|
43
|
+
}, doDraw = true, angle = 30, } = {}) {
|
|
45
44
|
this.globe = globe;
|
|
46
45
|
this.itemMap = new Map();
|
|
47
46
|
this.font = font;
|
|
@@ -51,7 +50,7 @@ var PixelPaddingCompassTextWriter = /** @class */ (function () {
|
|
|
51
50
|
this.angles = [];
|
|
52
51
|
this.texts = [];
|
|
53
52
|
this.positions = [];
|
|
54
|
-
|
|
53
|
+
let currentAngle = 0;
|
|
55
54
|
while (currentAngle < 360) {
|
|
56
55
|
if (currentAngle > 180) {
|
|
57
56
|
this.positions.push(webglobe_1.CSMeasureTextPositionTypes.CENTER);
|
|
@@ -72,43 +71,42 @@ var PixelPaddingCompassTextWriter = /** @class */ (function () {
|
|
|
72
71
|
this._lastNorthAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
|
|
73
72
|
this.offsets = this.__offset(this._lastNorthAngle);
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
setKeyAdaptor(adaptor) {
|
|
76
75
|
this.keyAdaptor = adaptor;
|
|
77
|
-
}
|
|
78
|
-
|
|
76
|
+
}
|
|
77
|
+
setDoDraw(bool) {
|
|
79
78
|
this.doDraw = bool;
|
|
80
|
-
}
|
|
81
|
-
|
|
79
|
+
}
|
|
80
|
+
setFont(font) {
|
|
82
81
|
this.font = font;
|
|
83
|
-
}
|
|
84
|
-
|
|
82
|
+
}
|
|
83
|
+
setNorthFont(font) {
|
|
85
84
|
this.northFont = font;
|
|
86
|
-
}
|
|
87
|
-
|
|
85
|
+
}
|
|
86
|
+
setOpacity(opacity) {
|
|
88
87
|
this.opacity = opacity;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
}
|
|
89
|
+
_checkSetOffsets() {
|
|
90
|
+
const { globe } = this;
|
|
91
|
+
const newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
|
|
93
92
|
;
|
|
94
93
|
if (newAngle !== this._lastNorthAngle) {
|
|
95
94
|
this._lastNorthAngle = newAngle;
|
|
96
95
|
this.offsets = this.__offset();
|
|
97
96
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
97
|
+
}
|
|
98
|
+
draw() {
|
|
100
99
|
if (!this.doDraw)
|
|
101
100
|
return;
|
|
102
|
-
|
|
101
|
+
const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
|
|
103
102
|
this._checkSetOffsets(); // zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const offsets = this.offsets;
|
|
104
|
+
for (const [key, { center, radius, opacity = null }] of itemMap) {
|
|
105
|
+
const o = opacity === null ? opacity_ : opacity * opacity_;
|
|
107
106
|
if (center.x !== null && center.y !== null) {
|
|
108
|
-
offsets.forEach(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var angle = angles[i];
|
|
107
|
+
offsets.forEach(({ offsetX, offsetY }, i) => {
|
|
108
|
+
const text = texts[i];
|
|
109
|
+
const angle = angles[i];
|
|
112
110
|
font.position = positions[i];
|
|
113
111
|
if (angle === 0) {
|
|
114
112
|
globe.api_DrawContextTextMultiLine(text, northFont, o, { x: center.x + offsetX * radius + xGapFit, y: center.y + offsetY * radius + yGapFit });
|
|
@@ -118,44 +116,38 @@ var PixelPaddingCompassTextWriter = /** @class */ (function () {
|
|
|
118
116
|
}
|
|
119
117
|
});
|
|
120
118
|
}
|
|
121
|
-
};
|
|
122
|
-
for (var _i = 0, itemMap_1 = itemMap; _i < itemMap_1.length; _i++) {
|
|
123
|
-
var _b = itemMap_1[_i], key = _b[0], _c = _b[1], center = _c.center, radius = _c.radius, _d = _c.opacity, opacity = _d === void 0 ? null : _d;
|
|
124
|
-
_loop_1(key, center, radius, opacity);
|
|
125
119
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
item.center = { x: x, y: y };
|
|
120
|
+
}
|
|
121
|
+
insertTextItem(key, x, y, radius = undefined) {
|
|
122
|
+
const item = this.getItem(key);
|
|
123
|
+
item.center = { x, y };
|
|
131
124
|
if (radius === undefined)
|
|
132
125
|
return;
|
|
133
126
|
if (item.radius != undefined && item.radius === radius)
|
|
134
127
|
return;
|
|
135
128
|
item.radius = radius;
|
|
136
|
-
}
|
|
137
|
-
|
|
129
|
+
}
|
|
130
|
+
getItem(key) {
|
|
138
131
|
if (!this.itemMap.has(key))
|
|
139
132
|
this.itemMap.set(key, {});
|
|
140
133
|
return this.itemMap.get(key);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
134
|
+
}
|
|
135
|
+
__calculateOffset(angle) {
|
|
136
|
+
const rAngle = (angle - 90) * (Math.PI / 180);
|
|
144
137
|
return { offsetX: Math.cos(rAngle + this._lastNorthAngle), offsetY: Math.sin(rAngle + this._lastNorthAngle) };
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
}
|
|
139
|
+
__offset() {
|
|
140
|
+
const angle = this.angle;
|
|
141
|
+
const offsets = [];
|
|
142
|
+
let currentAngle = 0;
|
|
150
143
|
while (currentAngle < 360) {
|
|
151
144
|
offsets.push(this.__calculateOffset(currentAngle));
|
|
152
145
|
currentAngle += angle;
|
|
153
146
|
}
|
|
154
147
|
return offsets;
|
|
155
|
-
}
|
|
156
|
-
|
|
148
|
+
}
|
|
149
|
+
clear() {
|
|
157
150
|
this.itemMap.clear();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
}());
|
|
151
|
+
}
|
|
152
|
+
}
|
|
161
153
|
exports.PixelPaddingCompassTextWriter = PixelPaddingCompassTextWriter;
|
package/compass-rose/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PixelPaddingCompassTextWriter = exports.PixelPaddingCompassPlugin = void 0;
|
|
4
|
-
|
|
4
|
+
const compass_text_writer_1 = require("./compass-text-writer");
|
|
5
5
|
Object.defineProperty(exports, "PixelPaddingCompassTextWriter", { enumerable: true, get: function () { return compass_text_writer_1.PixelPaddingCompassTextWriter; } });
|
|
6
|
-
|
|
6
|
+
const compass_rose_padding_flat_1 = require("./compass-rose-padding-flat");
|
|
7
7
|
Object.defineProperty(exports, "PixelPaddingCompassPlugin", { enumerable: true, get: function () { return compass_rose_padding_flat_1.PixelPaddingCompassPlugin; } });
|