@pirireis/webglobeplugins 0.0.1

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 (82) hide show
  1. package/arrowfield/adaptor.js +11 -0
  2. package/arrowfield/index.js +4 -0
  3. package/arrowfield/plugin.js +128 -0
  4. package/compassrose/compassrose.js +394 -0
  5. package/compassrose/index.js +2 -0
  6. package/heatwavemaps/index.js +4 -0
  7. package/heatwavemaps/isobar/objectarraylabels.js +247 -0
  8. package/heatwavemaps/isobar/plugin.js +337 -0
  9. package/heatwavemaps/isobar/quadtreecontours.js +338 -0
  10. package/heatwavemaps/plugins/heatwaveglobeshell.js +257 -0
  11. package/index.js +8 -0
  12. package/package.json +7 -0
  13. package/programs/arrowfield/index.js +2 -0
  14. package/programs/arrowfield/logic.js +284 -0
  15. package/programs/arrowfield/object.js +89 -0
  16. package/programs/float2legendwithratio/index.js +3 -0
  17. package/programs/float2legendwithratio/logic.js +189 -0
  18. package/programs/float2legendwithratio/object.js +132 -0
  19. package/programs/globeshell/index.js +2 -0
  20. package/programs/globeshell/noise/noises.js +0 -0
  21. package/programs/globeshell/wiggle/index.js +6 -0
  22. package/programs/globeshell/wiggle/logic.js +374 -0
  23. package/programs/globeshell/wiggle/object.js +94 -0
  24. package/programs/helpers/blender/index.js +0 -0
  25. package/programs/helpers/blender/program.js +91 -0
  26. package/programs/helpers/fadeaway/index.js +3 -0
  27. package/programs/helpers/fadeaway/logic.js +76 -0
  28. package/programs/helpers/fadeaway/object.js +20 -0
  29. package/programs/helpers/index.js +2 -0
  30. package/programs/index.js +21 -0
  31. package/programs/programcache.js +119 -0
  32. package/programs/rings/distancering/circleflatprogram.js +135 -0
  33. package/programs/rings/distancering/circlepaddysharedbuffer.js +502 -0
  34. package/programs/rings/distancering/index.js +5 -0
  35. package/programs/rings/distancering/paddyflatprogram.js +131 -0
  36. package/programs/rings/distancering/shader.js +0 -0
  37. package/programs/rings/index.js +9 -0
  38. package/programs/totems/camerauniformblock.js +129 -0
  39. package/programs/totems/index.js +2 -0
  40. package/programs/util.js +17 -0
  41. package/programs/vectorfields/index.js +3 -0
  42. package/programs/vectorfields/logics/drawrectangleparticles.js +125 -0
  43. package/programs/vectorfields/logics/index.js +5 -0
  44. package/programs/vectorfields/logics/pixelbased.js +161 -0
  45. package/programs/vectorfields/logics/ubo.js +64 -0
  46. package/programs/vectorfields/pingpongbuffermanager.js +80 -0
  47. package/rangerings/index.js +3 -0
  48. package/rangerings/rangerings.js +88 -0
  49. package/timetracks/adaptors.js +133 -0
  50. package/timetracks/index.js +3 -0
  51. package/timetracks/plugin.js +304 -0
  52. package/timetracks/program.js +850 -0
  53. package/timetracks/programpoint.js +168 -0
  54. package/util/datamanager/datamanager.js +168 -0
  55. package/util/datamanager/index.js +3 -0
  56. package/util/datamanager/pointcoordinatesdatacalculator.js +133 -0
  57. package/util/datamanager/pointcoordsmeta.js +22 -0
  58. package/util/geometry/geodatafromtexture.js +52 -0
  59. package/util/geometry/index.js +44 -0
  60. package/util/index.js +13 -0
  61. package/util/jshelpers/index.js +1 -0
  62. package/util/jshelpers/timefilters.js +32 -0
  63. package/util/jshelpers/timemethods.js +19 -0
  64. package/util/programs/index.js +2 -0
  65. package/util/programs/shapesonglobe.js +248 -0
  66. package/util/programs/supersampletotextures.js +142 -0
  67. package/util/programs/texturetoglobe.js +203 -0
  68. package/util/shaderfunctions/geometrytransformations.js +129 -0
  69. package/util/shaderfunctions/index.js +2 -0
  70. package/util/shaderfunctions/nodata.js +10 -0
  71. package/util/shaderfunctions/noisefunctions.js +44 -0
  72. package/util/webglobe/gldefaultstates.js +4 -0
  73. package/util/webglobe/index.js +2 -0
  74. package/util/webglobe/rasteroverlay.js +96 -0
  75. package/util/webglobjectbuilders.js +256 -0
  76. package/waveparticles/adaptor.js +16 -0
  77. package/waveparticles/index.js +4 -0
  78. package/waveparticles/plugin.js +281 -0
  79. package/wind/imagetovectorfieldandmagnitude.js +39 -0
  80. package/wind/index.js +7 -0
  81. package/wind/plugin.js +1032 -0
  82. package/wind/vectorfieldimage.js +27 -0
@@ -0,0 +1,11 @@
1
+ export function centigradePlus90ToRadians(centigradeArray, noDataValue = -9999) {
2
+ const radiansArray = new Float32Array(centigradeArray.length);
3
+ for (let i = 0; i < centigradeArray.length; i++) {
4
+ if (centigradeArray[i] === noDataValue) {
5
+ radiansArray[i] = noDataValue;
6
+ continue;
7
+ }
8
+ radiansArray[i] = (centigradeArray[i] + 90.0) * Math.PI / 180;
9
+ }
10
+ return radiansArray;
11
+ }
@@ -0,0 +1,4 @@
1
+ import ArrowField from "./plugin";
2
+ import { centigradePlus90ToRadians } from "./adaptor";
3
+ export default ArrowField;
4
+ export { centigradePlus90ToRadians };
@@ -0,0 +1,128 @@
1
+
2
+ import { ArrowField } from '../programs';
3
+
4
+ export default class ArrowFieldPlugin {
5
+
6
+ constructor(id, {
7
+ minLon = -180,
8
+ maxLon = 180,
9
+ minLat = -90,
10
+ maxLat = 90,
11
+ height = 0,
12
+ opacity = 1,
13
+ tailLengthRatio = 1,
14
+ wingLengthRatio = 0.5,
15
+ color = [0.04, 0.2, 0.8],
16
+ targetWidth = 100,
17
+ targetHeight = 100,
18
+ data = null,
19
+ dataWidth = null,
20
+ dataHeight = null,
21
+ maxMagnitude = null,
22
+ noDataValue = null
23
+ } = {}) {
24
+ this.id = id;
25
+
26
+ this.options = {
27
+ minLon,
28
+ maxLon,
29
+ minLat,
30
+ maxLat,
31
+ height,
32
+ tailLengthRatio,
33
+ wingLengthRatio,
34
+ opacity,
35
+ color,
36
+ data,
37
+ targetHeight,
38
+ targetWidth,
39
+ dataWidth,
40
+ dataHeight,
41
+ maxMagnitude,
42
+ noDataValue
43
+ }
44
+
45
+ this.arrowFieldObj = null;
46
+ this._doDraw = true;
47
+ }
48
+
49
+ init(globe, gl) {
50
+ this.globe = globe;
51
+ this.gl = gl;
52
+ this.arrowFieldObj = new ArrowField(gl, globe, this.options);
53
+ }
54
+
55
+ draw3D() {
56
+ if (this._doDraw) {
57
+ const { gl, arrowFieldObj } = this;
58
+ gl.disable(gl.DEPTH_TEST);
59
+ arrowFieldObj.draw();
60
+ gl.enable(gl.DEPTH_TEST);
61
+ }
62
+ }
63
+
64
+ free() {
65
+ this.arrowFieldObj.free();
66
+ this.arrowFieldObj = null;
67
+ }
68
+
69
+
70
+ // user interaction methods
71
+
72
+ on() {
73
+ this._doDraw = true;
74
+ }
75
+
76
+
77
+ off() {
78
+ this._doDraw = false;
79
+ }
80
+
81
+ setBBox({ minLon = -180, maxLon = 180, minLat = -90, maxLat = 90 } = {}) {
82
+ this.arrowFieldObj.setBBox({ minLon, maxLon, minLat, maxLat });
83
+ }
84
+
85
+ setHeight(height) {
86
+ this.arrowFieldObj.update({ height });
87
+ }
88
+
89
+ setColor(color) {
90
+ this.arrowFieldObj.update({ color });
91
+ }
92
+
93
+ setOpacity(opacity) {
94
+ this.arrowFieldObj.update({ opacity });
95
+ }
96
+
97
+
98
+ setTailLengthRatio(tailLengthRatio) {
99
+ this.arrowFieldObj.update({ tailLengthRatio });
100
+ }
101
+
102
+
103
+ setWingLengthRatio(wingLengthRatio) {
104
+ this.arrowFieldObj.update({ wingLengthRatio });
105
+ }
106
+
107
+
108
+ setDataResolution(dataWidth, dataHeight) {
109
+ this.arrowFieldObj.update({ dataWidth, dataHeight });
110
+ }
111
+
112
+ setTargetResolution(targetWidth, targetHeight) {
113
+ this.arrowFieldObj.update({ resolution: [targetWidth, targetHeight] });
114
+ }
115
+
116
+
117
+ setMaxMagnitude(maxMagnitude) {
118
+ this.arrowFieldObj.update({ maxMagnitude });
119
+ }
120
+
121
+ setNoDataValue(noDataValue) {
122
+ this.arrowFieldObj.update({ noDataValue });
123
+ }
124
+
125
+ setData(rotationData) {
126
+ this.arrowFieldObj.setData(rotationData);
127
+ }
128
+ }
@@ -0,0 +1,394 @@
1
+ // pusula mip map yapilacak
2
+ // globa register edilecek
3
+ // icon yerlestirilecek.
4
+ // iconun acisi degisecek
5
+
6
+ // varsayilan stilin bulunmasi gerekiyor
7
+ // iconun acisi degisecek
8
+
9
+ import {
10
+ CSGlobe,
11
+ CSObjectTypes,
12
+ CSIconTypes,
13
+ CSObjectArrayUpdateTypes,
14
+ GlobeManager
15
+ } from "@pirireis/webglobe";
16
+
17
+
18
+
19
+
20
+
21
+ const object = {
22
+ "displayName": "rotaionalIcon",
23
+ "layerType": 3,
24
+ "objectParams": {
25
+ "Fid": null,
26
+ "sx": 10,
27
+ "sy": 10,
28
+ "sz": 10,
29
+ "rotXY": 0,
30
+ "rotZ": 0,
31
+ "rotRoll": 0,
32
+ "objUrl": "https://mhs.pirireis.com.tr/models/TB2.obj"
33
+ },
34
+ "wkbGeom": null,
35
+ "wfsLayerName": null,
36
+ "url": "https://servis.pirireis.com.tr/sqlpg254/GPbf/{z}/{x}/{y}.pbf?enc=DsTX5MTbGW7dp1PyxvvB8ij2DTP2ZPG3i5ZU2ZRrOu%2BwYra1uZp3LfP5V2lio19C54EiV69032fs1L9vfnl4O%2Bw4LLO39n8K%2BPfWW%2FNsQg0%3D",
37
+ "style": {
38
+ "labels": [
39
+ {
40
+ "startLod": 2,
41
+ "endLod": 25,
42
+ "position": 0,
43
+ "text": "'${title}'",
44
+ "textCallback": null,
45
+ "offset": {
46
+ "x": 16,
47
+ "y": -16
48
+ },
49
+ "vAlignment": 0,
50
+ "hAlignment": 0,
51
+ "size": 20,
52
+ "hollowColor": "#000",
53
+ "textColor": "#FFF",
54
+ "textOpacity": 1,
55
+ "transform": 0,
56
+ "fontFamily": {
57
+ "name": "arial",
58
+ "bold": true,
59
+ "italic": false,
60
+ "hollow": true,
61
+ "hollowWidth": 2,
62
+ "hollowBlur": 1,
63
+ "hollowOpacity": 0.75
64
+ },
65
+ "reductable": false,
66
+ "reduction": false,
67
+ "searchAvailablePlace": false,
68
+ "searchRadius": 3,
69
+ "forceToDraw": false,
70
+ "drawAlways": false,
71
+ "canMove": true,
72
+ "ignoreEmptyStrings": false,
73
+ "textStyle": null
74
+ }
75
+ ],
76
+ "iconType": 4,
77
+ "active": true,
78
+ "icon": {
79
+ "rotateByGlobe": true,
80
+ "integerPosition": false,
81
+ "mapName": "light",
82
+ "name": "lightning25",
83
+ "iconColor": "#ffffff",
84
+ "borderColor": "#0000ff",
85
+ "fillColor": "#ffffff",
86
+ "borderWidth": 2,
87
+ "radius": 70,
88
+ "sizeX": 140,
89
+ "sizeY": 140,
90
+ "rotDeg": 0
91
+ },
92
+ "iconReduction": {
93
+ "reduction": false,
94
+ "searchAvailablePlace": false,
95
+ "searchRadius": 3,
96
+ "forceToDraw": false
97
+ },
98
+ "mouseOverSymbolScale": 1,
99
+ "shape": null,
100
+ "filter": [],
101
+ "lineType": {
102
+ "cap": "round",
103
+ "join": "round",
104
+ "miterLimit": 2,
105
+ "dash": [],
106
+ "width": 2
107
+ },
108
+ "opacity": 1,
109
+ "border": true,
110
+ "borderColor": "#000000",
111
+ "filled": true,
112
+ "fillColor": "#ffff00",
113
+ "bottomFilled": false,
114
+ "bottomFillColor": "#ffff00",
115
+ "sideFilled": true,
116
+ "sideColor": "#ff00ff",
117
+ "cullFace": true,
118
+ "depthTest": false,
119
+ "zMode": 1,
120
+ "displayName": "",
121
+ "fidKey": "name_local",
122
+ "startLod": 2,
123
+ "endLod": 25,
124
+ "flashIcon": false,
125
+ "flashShape": false,
126
+ "flashLabels": false,
127
+ "flashGeo": false,
128
+ "lodDisplay": []
129
+ },
130
+ "objectType": "point",
131
+ "bbox": null,
132
+ "startLod": 2,
133
+ "endLod": 19,
134
+ "continuousLOD": true,
135
+ "MVTXYZName": "hd_seyp",
136
+ "rasterize": false,
137
+ "selectedStyle": {
138
+ "labels": [
139
+ {
140
+ "startLod": 2,
141
+ "endLod": 25,
142
+ "position": 0,
143
+ "text": "",
144
+ "textCallback": null,
145
+ "offset": {
146
+ "x": 16,
147
+ "y": -16
148
+ },
149
+ "vAlignment": 0,
150
+ "hAlignment": 0,
151
+ "size": 20,
152
+ "hollowColor": "#000",
153
+ "textColor": "#FFF",
154
+ "textOpacity": 1,
155
+ "transform": 0,
156
+ "fontFamily": {
157
+ "name": "arial",
158
+ "bold": true,
159
+ "italic": false,
160
+ "hollow": true,
161
+ "hollowWidth": 2,
162
+ "hollowBlur": 1,
163
+ "hollowOpacity": 0.75
164
+ },
165
+ "drawAlways": true,
166
+ "canMove": false,
167
+ "ignoreEmptyStrings": false,
168
+ "textStyle": null
169
+ }
170
+ ],
171
+ "icon": {
172
+ "iconColor": "#ffffff",
173
+ "borderColor": "#000000",
174
+ "fillColor": "#ff0000",
175
+ "borderWidth": 2,
176
+ "radius": 16,
177
+ "sizeX": 32,
178
+ "sizeY": 32,
179
+ "rotDeg": 0
180
+ },
181
+ "mouseOverSymbolScale": 1,
182
+ "shape": {
183
+ "type": 3
184
+ },
185
+ "filter": [],
186
+ "opacity": 0.75,
187
+ "borderColor": "#000000",
188
+ "fillColor": "#ff0000",
189
+ "bottomFillColor": "#ff00ff",
190
+ "sideColor": "#ffff00",
191
+ "flashIcon": false,
192
+ "flashShape": false,
193
+ "flashLabels": false,
194
+ "flashGeo": false
195
+ }
196
+ }
197
+
198
+ const setIconSize = (object, size) => {
199
+ object.style.icon.sizeX = size;
200
+ object.style.icon.sizeY = size;
201
+ object.style.icon.radius = Math.ceil(size / 2);
202
+ }
203
+
204
+ const setMapName = (object, mapName) => {
205
+ object.style.icon.mapName = mapName;
206
+ }
207
+
208
+ const setIconName = (object, name) => {
209
+ object.style.icon.name = name;
210
+ }
211
+
212
+ const setData = (object, data) => {
213
+ object.data = data;
214
+ }
215
+
216
+ const IMAGE_URL = "10494_1024px-compass-rose-simple.svg.png";
217
+
218
+ const addSingleImageIconMap = symbolSet => url => {
219
+ GlobeManager.api_AddIconMap(symbolSet, url, null);
220
+
221
+ }
222
+
223
+
224
+
225
+ export default class CompassRose {
226
+ constructor(id, globe, { size = 100, symbolSet = "compassRose", iconSet = null, imageURL = null, data = null }) {
227
+
228
+ this.id = id;
229
+ this.globe = globe;
230
+
231
+ this._idCollector = new Set();
232
+
233
+ this.primaryKey = "__key__";
234
+
235
+ this.object = Object.assign({}, object);
236
+
237
+ setIconSize(this.object, size);
238
+ if (imageURL) {
239
+ addSingleImageIconMap(symbolSet)(imageURL);
240
+ }
241
+
242
+ if (data) {
243
+ setData(this.object, data);
244
+ }
245
+
246
+ setMapName(this.object, symbolSet);
247
+ setIconName(this.object, iconSet | symbolSet);
248
+ globe.ObjectArray.Add(this.object);
249
+ }
250
+
251
+ setData(data) {
252
+ setData(this.object, data);
253
+ }
254
+
255
+ setIconSize(size) {
256
+ const { object, globe } = this;
257
+ setIconSize(object, size);
258
+
259
+ const canChange = {
260
+ attribs: false,
261
+ icon: true,
262
+ label: false,
263
+ heading: false,
264
+ }
265
+
266
+ globe.ObjectArray.UpdateData(object, CSObjectArrayUpdateTypes.UPDATE, [], canChange);
267
+ }
268
+
269
+
270
+ setMapName(mapName) {
271
+ const { object, globe } = this;
272
+ setMapName(object, mapName);
273
+
274
+ const canChange = {
275
+ attribs: false,
276
+ icon: true,
277
+ label: false,
278
+ heading: false,
279
+ }
280
+
281
+ globe.ObjectArray.UpdateData(object, CSObjectArrayUpdateTypes.UPDATE, canChange);
282
+ }
283
+
284
+
285
+ setData(data) {
286
+ const { globe, object } = this;
287
+ globe.ObjectArray.SetData(object, [data]);
288
+ }
289
+
290
+ /**
291
+ * @param {PointObjectArray} data
292
+ * @param {CSObjectArrayUpdateTypes} operation
293
+ * @param {CanChangeOptions} [canChange]
294
+ */
295
+ updateData(data, operation, canChange) {
296
+ // console.log( "updateData", operation, data);
297
+ const { globe, object } = this;
298
+ globe.ObjectArray.UpdateData(object, operation, [data], canChange);
299
+ }
300
+
301
+ setConrolledData(data) {
302
+
303
+ const paritalData = {
304
+ add: {
305
+ coords: [],
306
+ coordsZ: [],
307
+ attribs: [],
308
+ },
309
+ update: {
310
+ coords: [],
311
+ coordsZ: [],
312
+ attribs: [],
313
+ },
314
+ delete: {
315
+ coords: [],
316
+ coordsZ: [],
317
+ attribs: [],
318
+ },
319
+ canChange: {
320
+ // Tüm değişimler gözardı edilecek
321
+ attribs: false,
322
+ icon: false,
323
+ label: false,
324
+ heading: false,
325
+ },
326
+ };
327
+
328
+ // İlk toplu ekleme adımı
329
+ if (this._idCollector.size === 0) {
330
+ this.setData(data);
331
+ // Eklenen id'ler set edildi
332
+ for (let i = 0; i < data.attribs.length; i++) {
333
+ const currentPayload = data.attribs[i];
334
+ const id = currentPayload[this.primaryKey];
335
+
336
+ this._idCollector.add(id);
337
+ }
338
+ return;
339
+ }
340
+
341
+ /** @type {Set<string>} */
342
+ const dataIds = new Set();
343
+
344
+ for (let i = 0; i < data.attribs.length; i++) {
345
+ const currentPayload = data.attribs[i];
346
+ const id = currentPayload[this.primaryKey];
347
+
348
+ let bucket = paritalData.add;
349
+
350
+ dataIds.add(id);
351
+
352
+ if (this._idCollector.has(id)) {
353
+ bucket = paritalData.update;
354
+ } else {
355
+ this._idCollector.add(id);
356
+ }
357
+
358
+ bucket.coords.push(data.coords[2 * i], data.coords[2 * i + 1]);
359
+ bucket.coordsZ.push(data.coordsZ[i]);
360
+ bucket.attribs.push(currentPayload);
361
+ }
362
+
363
+ // Artık varolmayan elemenları sil
364
+ const deleteBucket = paritalData.delete;
365
+ this._idCollector.forEach(id => {
366
+ if (!dataIds.has(id)) {
367
+ this._idCollector.delete(id);
368
+
369
+ deleteBucket.coords.push(0, 0);
370
+ deleteBucket.coordsZ.push(0);
371
+ deleteBucket.attribs.push({
372
+ [this.primaryKey]: id,
373
+ });
374
+ }
375
+ });
376
+
377
+ if (paritalData.add.coords.length > 0) {
378
+ this.updateData(paritalData.add, CSObjectArrayUpdateTypes.ADD);
379
+ }
380
+
381
+ if (paritalData.update.coords.length > 0) {
382
+ this.updateData(
383
+ paritalData.update,
384
+ CSObjectArrayUpdateTypes.UPDATE,
385
+ paritalData.canChange,
386
+ );
387
+ }
388
+
389
+ if (paritalData.delete.coords.length > 0) {
390
+ this.updateData(paritalData.delete, CSObjectArrayUpdateTypes.DELETE);
391
+ }
392
+ }
393
+
394
+ }
@@ -0,0 +1,2 @@
1
+ import CompassRose from "./compassrose";
2
+ export { CompassRose };
@@ -0,0 +1,4 @@
1
+ import HeatWavePlugin from './plugins/heatwaveglobeshell';
2
+ import { IsobarRasterToVector } from './isobar/plugin';
3
+ export { HeatWavePlugin, IsobarRasterToVector };
4
+