@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.
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 +80 -78
  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 +16 -14
  9. package/Math/methods.js +72 -67
  10. package/Math/plane.js +18 -16
  11. package/Math/quaternion.js +49 -45
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +45 -42
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +8 -7
  16. package/altitude-locator/plugin.js +113 -97
  17. package/arrowfield/adaptor.js +4 -3
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +65 -62
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +225 -200
  22. package/circle-line-chain/chain-list-map.js +88 -82
  23. package/circle-line-chain/plugin.js +154 -129
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +126 -104
  26. package/compass-rose/compass-text-writer.js +70 -62
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +50 -46
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +48 -44
  32. package/heatwave/isobar/plugin.js +123 -104
  33. package/heatwave/isobar/quadtreecontours.js +92 -76
  34. package/heatwave/plugins/heatwaveglobeshell.js +87 -69
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +64 -32
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +84 -48
  40. package/partialrings/program.js +47 -136
  41. package/pin/pin-object-array.js +86 -83
  42. package/pin/pin-point-totem.js +22 -21
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +45 -40
  45. package/point-heat-map/point-to-heat-map-flow.js +42 -40
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +142 -127
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +62 -170
  50. package/programs/arrowfield/object.js +35 -33
  51. package/programs/data2legend/density-to-legend.js +21 -45
  52. package/programs/data2legend/point-to-density-texture.js +27 -52
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +42 -88
  55. package/programs/float2legendwithratio/object.js +46 -43
  56. package/programs/globe-util/is-globe-moved.js +11 -10
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +98 -191
  60. package/programs/globeshell/wiggle/object.js +35 -33
  61. package/programs/helpers/blender/program.js +19 -36
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +13 -35
  64. package/programs/helpers/fadeaway/object.js +10 -9
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +32 -91
  68. package/programs/line-on-globe/circle-accurate-3d.js +32 -82
  69. package/programs/line-on-globe/circle-accurate-flat.js +50 -108
  70. package/programs/line-on-globe/circle-accurate.js +33 -103
  71. package/programs/line-on-globe/circle.js +32 -97
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
  74. package/programs/line-on-globe/linestrip.js +39 -100
  75. package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
  76. package/programs/line-on-globe/to-the-surface.js +29 -58
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +33 -117
  79. package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
  80. package/programs/point-on-globe/element-point-glow.js +35 -103
  81. package/programs/point-on-globe/square-pixel-point.js +27 -76
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +21 -63
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +20 -73
  88. package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
  89. package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
  90. package/programs/rings/partial-ring/piece-of-pie.js +35 -137
  91. package/programs/totems/camerauniformblock.js +51 -64
  92. package/programs/totems/canvas-webglobe-info.js +40 -48
  93. package/programs/totems/gpu-selection-uniform-block.js +40 -44
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +29 -90
  96. package/programs/util.js +7 -6
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +35 -91
  101. package/programs/vectorfields/logics/ubo.js +25 -31
  102. package/programs/vectorfields/pingpongbuffermanager.js +34 -30
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +252 -202
  105. package/rangerings/rangeringangletext.js +120 -108
  106. package/rangerings/ring-account.js +69 -52
  107. package/shaders/fragment-toy/firework.js +1 -55
  108. package/shaders/fragment-toy/singularity.js +1 -55
  109. package/timetracks/adaptors-line-strip.js +37 -26
  110. package/timetracks/adaptors.js +61 -47
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -59
  113. package/timetracks/plugin.js +69 -65
  114. package/timetracks/program-line-strip.js +103 -296
  115. package/timetracks/program.js +113 -419
  116. package/timetracks/programpoint-line-strip.js +44 -97
  117. package/timetracks/programpoint.js +44 -90
  118. package/util/account/bufferoffsetmanager.js +95 -72
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +30 -28
  124. package/util/account/util.js +4 -2
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +15 -13
  128. package/util/geometry/index.js +11 -9
  129. package/util/gl-util/buffer/attribute-loader.js +20 -8
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +7 -7
  132. package/util/gl-util/uniform-block/manager.js +67 -55
  133. package/util/heatwavedatamanager/datamanager.js +116 -56
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
  140. package/util/interpolation/timetrack/web-worker-str.js +1 -179
  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 +52 -46
  146. package/util/programs/draw-texture-on-canvas.js +21 -39
  147. package/util/programs/shapesonglobe.js +64 -104
  148. package/util/programs/supersampletotextures.js +39 -45
  149. package/util/programs/texturetoglobe.js +48 -98
  150. package/util/shaderfunctions/geometrytransformations.js +27 -322
  151. package/util/shaderfunctions/nodata.js +1 -7
  152. package/util/shaderfunctions/noisefunctions.js +9 -39
  153. package/util/surface-line-data/arcs-to-cuts.js +23 -20
  154. package/util/webglobe/rasteroverlay.js +37 -35
  155. package/util/webglobjectbuilders.js +60 -55
  156. package/util/webglobjectbuilders1.js +49 -48
  157. package/waveparticles/adaptor.js +7 -6
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +84 -79
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +251 -453
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +48 -46
  165. package/write-text/context-text.js +58 -51
  166. 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
- 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
- } } = {}) {
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 = null) {
58
- this.__insertText(key, null, null, { properties, update: true });
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({ textFont = null, northFont = null } = {}) {
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
- const { gl, globe } = this;
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
- const bufferType = "DYNAMIC_DRAW";
92
- const initialCapacity = this.bufferOrchestrator.capacity;
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) => new Float32Array([item.x, item.y])
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) => new Float32Array([item.properties.pixelRadiusRatioSmall])
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) => new Float32Array([item.properties.pixelRadiusRatioBig])
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) => new Float32Array(item.properties.rgba)
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
- const obj = function (bufferManagerComp) {
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(...['screenCoordinates', 'pixelRadiusRatioSmall', 'pixelRadiusRatioBig', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
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, ...this._font_hold });
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, { properties, update = false } = {}) {
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
- let radius;
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
- const { gl, globe, paddingProgram, paddingVao, bufferOrchestrator, bufferManagersCompMap } = this;
145
- const is3D = globe.api_GetCurrentGeometry() === 0;
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
- const items = this.compassMap.query(globe, this.writer);
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
- this.__insertText(v.key, v.x, v.y);
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
- const { globe, gl, paddingVao } = this;
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
- this.compassMap.query(this.globe, this.writer).forEach((v) => {
176
- this.__insertText(v.key, v.x, v.y, { properties: v.properties, update: true });
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
- const globe = this.globe;
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
- class CompassMap {
186
- constructor(parent) {
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 = null) {
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
- const { coordsMemory, propertyMemory } = this;
208
- const defaultProperties = this.parent.defaultProperties;
209
- const result = [];
210
- coordsMemory.forEach((v, k, c) => {
211
- const { x, y } = globe.api_GetScreenPointFromGeo({
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
- const properties = { ...defaultProperties, ...propertyMemory.get(k) };
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
- const webglobe_1 = require("@pirireis/webglobe");
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
- 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, } = {}) {
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
- let currentAngle = 0;
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
- const { globe } = this;
91
- const newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
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
- const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
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
- const offsets = this.offsets;
104
- for (const [key, { center, radius, opacity = null }] of itemMap) {
105
- const o = opacity === null ? opacity_ : opacity * opacity_;
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(({ offsetX, offsetY }, i) => {
108
- const text = texts[i];
109
- const angle = angles[i];
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 = undefined) {
122
- const item = this.getItem(key);
123
- item.center = { x, y };
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
- const rAngle = (angle - 90) * (Math.PI / 180);
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
- const angle = this.angle;
141
- const offsets = [];
142
- let currentAngle = 0;
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;
@@ -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
- const compass_text_writer_1 = require("./compass-text-writer");
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
- const compass_rose_padding_flat_1 = require("./compass-rose-padding-flat");
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; } });