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