@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.
Files changed (166) hide show
  1. package/Math/angle-calculation.js +8 -8
  2. package/Math/arc.js +18 -18
  3. package/Math/bounds/line-bbox.js +78 -80
  4. package/Math/constants.js +3 -3
  5. package/Math/juction/arc-plane.js +23 -23
  6. package/Math/juction/line-sphere.js +11 -11
  7. package/Math/juction/plane-plane.js +11 -11
  8. package/Math/line.js +14 -16
  9. package/Math/methods.js +65 -70
  10. package/Math/plane.js +16 -18
  11. package/Math/quaternion.js +45 -49
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +42 -45
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +7 -8
  16. package/altitude-locator/plugin.js +98 -114
  17. package/arrowfield/adaptor.js +3 -4
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +62 -65
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +200 -226
  22. package/circle-line-chain/chain-list-map.js +82 -88
  23. package/circle-line-chain/plugin.js +134 -165
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +108 -133
  26. package/compass-rose/compass-text-writer.js +62 -70
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +46 -50
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +44 -48
  32. package/heatwave/isobar/plugin.js +104 -123
  33. package/heatwave/isobar/quadtreecontours.js +76 -92
  34. package/heatwave/plugins/heatwaveglobeshell.js +69 -87
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +32 -64
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +48 -84
  40. package/partialrings/program.js +136 -47
  41. package/pin/pin-object-array.js +83 -86
  42. package/pin/pin-point-totem.js +21 -22
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +40 -45
  45. package/point-heat-map/point-to-heat-map-flow.js +40 -42
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +137 -162
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +170 -62
  50. package/programs/arrowfield/object.js +33 -35
  51. package/programs/data2legend/density-to-legend.js +45 -21
  52. package/programs/data2legend/point-to-density-texture.js +52 -27
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +88 -42
  55. package/programs/float2legendwithratio/object.js +43 -46
  56. package/programs/globe-util/is-globe-moved.js +10 -11
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +191 -98
  60. package/programs/globeshell/wiggle/object.js +33 -35
  61. package/programs/helpers/blender/program.js +36 -19
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +35 -13
  64. package/programs/helpers/fadeaway/object.js +9 -10
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +91 -32
  68. package/programs/line-on-globe/circle-accurate-3d.js +82 -32
  69. package/programs/line-on-globe/circle-accurate-flat.js +108 -50
  70. package/programs/line-on-globe/circle-accurate.js +103 -33
  71. package/programs/line-on-globe/circle.js +97 -32
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
  74. package/programs/line-on-globe/linestrip.js +111 -45
  75. package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
  76. package/programs/line-on-globe/to-the-surface.js +58 -29
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +117 -33
  79. package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
  80. package/programs/point-on-globe/element-point-glow.js +103 -35
  81. package/programs/point-on-globe/square-pixel-point.js +76 -27
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +63 -21
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +73 -20
  88. package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
  89. package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
  90. package/programs/rings/partial-ring/piece-of-pie.js +137 -35
  91. package/programs/totems/camerauniformblock.js +64 -51
  92. package/programs/totems/canvas-webglobe-info.js +48 -40
  93. package/programs/totems/gpu-selection-uniform-block.js +44 -40
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +90 -29
  96. package/programs/util.js +6 -7
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +91 -35
  101. package/programs/vectorfields/logics/ubo.js +31 -25
  102. package/programs/vectorfields/pingpongbuffermanager.js +30 -34
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +202 -258
  105. package/rangerings/rangeringangletext.js +108 -120
  106. package/rangerings/ring-account.js +52 -69
  107. package/shaders/fragment-toy/firework.js +55 -1
  108. package/shaders/fragment-toy/singularity.js +55 -1
  109. package/timetracks/adaptors-line-strip.js +26 -37
  110. package/timetracks/adaptors.js +47 -61
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -71
  113. package/timetracks/plugin.js +69 -77
  114. package/timetracks/program-line-strip.js +296 -103
  115. package/timetracks/program.js +419 -113
  116. package/timetracks/programpoint-line-strip.js +97 -44
  117. package/timetracks/programpoint.js +90 -44
  118. package/util/account/bufferoffsetmanager.js +72 -95
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +29 -30
  124. package/util/account/util.js +2 -4
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +13 -15
  128. package/util/geometry/index.js +9 -11
  129. package/util/gl-util/buffer/attribute-loader.js +8 -20
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +8 -9
  132. package/util/gl-util/uniform-block/manager.js +67 -67
  133. package/util/heatwavedatamanager/datamanager.js +56 -116
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
  140. package/util/interpolation/timetrack/web-worker-str.js +179 -1
  141. package/util/interpolation/timetrack/web-worker.js +4 -4
  142. package/util/jshelpers/data-filler.js +7 -7
  143. package/util/jshelpers/timefilters.js +7 -7
  144. package/util/picking/fence.js +7 -7
  145. package/util/picking/picker-displayer.js +46 -52
  146. package/util/programs/draw-texture-on-canvas.js +39 -21
  147. package/util/programs/shapesonglobe.js +104 -64
  148. package/util/programs/supersampletotextures.js +45 -39
  149. package/util/programs/texturetoglobe.js +98 -48
  150. package/util/shaderfunctions/geometrytransformations.js +322 -27
  151. package/util/shaderfunctions/nodata.js +7 -1
  152. package/util/shaderfunctions/noisefunctions.js +39 -9
  153. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  154. package/util/webglobe/rasteroverlay.js +35 -37
  155. package/util/webglobjectbuilders.js +55 -60
  156. package/util/webglobjectbuilders1.js +48 -49
  157. package/waveparticles/adaptor.js +6 -7
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +79 -84
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +453 -251
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +46 -48
  165. package/write-text/context-text.js +51 -58
  166. 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
- 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;
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: font, northFont: northFont };
35
+ this._font_hold = { font, northFont };
48
36
  this.compassMap = new CompassMap(this);
49
37
  this._opacity = opacity;
50
38
  }
51
- PixelPaddingCompassPlugin.prototype.init = function (globe, gl) {
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
- 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 });
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
- PixelPaddingCompassPlugin.prototype.delete = function (key) {
66
+ delete(key) {
80
67
  this.compassMap.delete(key);
81
68
  this.globe.DrawRender();
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;
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
- PixelPaddingCompassPlugin.prototype.setOpacity = function (opacity) {
92
- var _a;
76
+ }
77
+ setOpacity(opacity) {
93
78
  this._opacity = opacity;
94
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.setOpacity(opacity);
79
+ this.writer?.setOpacity(opacity);
95
80
  this.globe.DrawRender();
96
- };
97
- PixelPaddingCompassPlugin.prototype.getTextWriter = function () {
81
+ }
82
+ getTextWriter() {
98
83
  return this.writer;
99
- };
100
- PixelPaddingCompassPlugin.prototype._initOrchestrations = function () {
101
- var _a;
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
- var bufferType = "DYNAMIC_DRAW";
108
- var initialCapacity = this.bufferOrchestrator.capacity;
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: bufferType, initialCapacity: initialCapacity }),
112
- 'adaptor': function (item) { return new Float32Array([item.x, item.y]); }
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: bufferType, initialCapacity: initialCapacity }),
116
- 'adaptor': function (item) { return new Float32Array([item.properties.pixelRadiusRatioSmall]); }
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: bufferType, initialCapacity: initialCapacity }),
120
- 'adaptor': function (item) { return new Float32Array([item.properties.pixelRadiusRatioBig]); }
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: bufferType, initialCapacity: initialCapacity }),
124
- 'adaptor': function (item) { return new Float32Array(item.properties.rgba); }
106
+ 'bufferManager': new account_1.BufferManager(gl, 4, { bufferType, initialCapacity }),
107
+ 'adaptor': (item) => new Float32Array(item.properties.rgba)
125
108
  }],
126
109
  ]);
127
- var obj_1 = function (bufferManagerComp) {
110
+ const obj = function (bufferManagerComp) {
128
111
  return { 'buffer': bufferManagerComp.bufferManager.buffer, 'stride': 0, 'offset': 0 };
129
112
  };
130
- this.paddingVao = (_a = this.paddingProgram).createVAO.apply(_a, ['screenCoordinates', 'pixelRadiusRatioSmall', 'pixelRadiusRatioBig', 'rgba'].map(function (key) { return obj_1(_this.bufferManagersCompMap.get(key)); }));
113
+ this.paddingVao = this.paddingProgram.createVAO(...['screenCoordinates', 'pixelRadiusRatioSmall', 'pixelRadiusRatioBig', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
131
114
  }
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 () {
137
- var _a;
138
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.resize();
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
- var radius = void 0;
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
- PixelPaddingCompassPlugin.prototype.draw2D = function () {
160
- var _this = this;
161
- var _a;
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
- var items = this.compassMap.query(globe, this.writer);
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(function (v) {
172
- _this.__insertText(v.key, v.x, v.y);
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
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.draw();
178
- };
179
- PixelPaddingCompassPlugin.prototype.free = function () {
156
+ this.writer?.draw();
157
+ }
158
+ free() {
180
159
  this.compassMap.free();
181
- var _a = this, globe = _a.globe, gl = _a.gl, paddingVao = _a.paddingVao;
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(function (v) {
163
+ this.bufferManagersCompMap.forEach(v => {
185
164
  v.bufferManager.free();
186
165
  });
187
- };
188
- PixelPaddingCompassPlugin.prototype.resize = function () {
166
+ }
167
+ resize() {
189
168
  this.radiusMultiplier = this._shorterDimension() * 0.5;
190
169
  this._reinsertAllText();
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 });
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
- PixelPaddingCompassPlugin.prototype._shorterDimension = function () {
199
- var globe = this.globe;
175
+ }
176
+ _shorterDimension() {
177
+ const globe = this.globe;
200
178
  return Math.min(globe.api_ScrW(), globe.api_ScrH());
201
- };
202
- return PixelPaddingCompassPlugin;
203
- }());
179
+ }
180
+ }
204
181
  exports.PixelPaddingCompassPlugin = PixelPaddingCompassPlugin;
205
- var CompassMap = /** @class */ (function () {
206
- function CompassMap(parent) {
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
- CompassMap.prototype.insert = function (key, long, lat, properties) {
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
- CompassMap.prototype.delete = function (key) {
192
+ }
193
+ delete(key) {
218
194
  this.coordsMemory.delete(key);
219
195
  this.propertyMemory.delete(key);
220
- };
221
- CompassMap.prototype.free = function () {
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
- 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({
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
- }), x = _a.x, y = _a.y;
237
- writer === null || writer === void 0 ? void 0 : writer.insertTextItem(k, x, y);
212
+ });
213
+ writer?.insertTextItem(k, x, y);
238
214
  if (x !== null) {
239
- var properties = __assign(__assign({}, defaultProperties), propertyMemory.get(k));
240
- result.push({ key: k, x: x, y: y, properties: properties });
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
- return CompassMap;
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
- var webglobe_1 = require("@pirireis/webglobe");
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
- 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;
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
- var currentAngle = 0;
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
- PixelPaddingCompassTextWriter.prototype.setKeyAdaptor = function (adaptor) {
74
+ setKeyAdaptor(adaptor) {
76
75
  this.keyAdaptor = adaptor;
77
- };
78
- PixelPaddingCompassTextWriter.prototype.setDoDraw = function (bool) {
76
+ }
77
+ setDoDraw(bool) {
79
78
  this.doDraw = bool;
80
- };
81
- PixelPaddingCompassTextWriter.prototype.setFont = function (font) {
79
+ }
80
+ setFont(font) {
82
81
  this.font = font;
83
- };
84
- PixelPaddingCompassTextWriter.prototype.setNorthFont = function (font) {
82
+ }
83
+ setNorthFont(font) {
85
84
  this.northFont = font;
86
- };
87
- PixelPaddingCompassTextWriter.prototype.setOpacity = function (opacity) {
85
+ }
86
+ setOpacity(opacity) {
88
87
  this.opacity = opacity;
89
- };
90
- PixelPaddingCompassTextWriter.prototype._checkSetOffsets = function () {
91
- var globe = this.globe;
92
- var newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
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
- PixelPaddingCompassTextWriter.prototype.draw = function () {
97
+ }
98
+ draw() {
100
99
  if (!this.doDraw)
101
100
  return;
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;
101
+ const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
103
102
  this._checkSetOffsets(); // zMode: CSZMode.Z_GROUND_PERVERTEX,
104
- var offsets = this.offsets;
105
- var _loop_1 = function (key, center, radius, opacity) {
106
- var o = opacity === null ? opacity_ : opacity * opacity_;
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(function (_a, i) {
109
- var offsetX = _a.offsetX, offsetY = _a.offsetY;
110
- var text = texts[i];
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
- 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 };
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
- PixelPaddingCompassTextWriter.prototype.getItem = function (key) {
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
- PixelPaddingCompassTextWriter.prototype.__calculateOffset = function (angle) {
143
- var rAngle = (angle - 90) * (Math.PI / 180);
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
- PixelPaddingCompassTextWriter.prototype.__offset = function () {
147
- var angle = this.angle;
148
- var offsets = [];
149
- var currentAngle = 0;
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
- PixelPaddingCompassTextWriter.prototype.clear = function () {
148
+ }
149
+ clear() {
157
150
  this.itemMap.clear();
158
- };
159
- return PixelPaddingCompassTextWriter;
160
- }());
151
+ }
152
+ }
161
153
  exports.PixelPaddingCompassTextWriter = PixelPaddingCompassTextWriter;
@@ -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
- var compass_text_writer_1 = require("./compass-text-writer");
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
- var compass_rose_padding_flat_1 = require("./compass-rose-padding-flat");
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; } });