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