@pirireis/webglobeplugins 0.6.45-a → 0.6.47-a

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.
@@ -50,6 +50,7 @@ export default class Plugin {
50
50
  const gl = this.gl;
51
51
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
52
52
  gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._coloredHeatTexture, 0);
53
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
53
54
  const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
54
55
  const currentWidth = gl.canvas.width;
55
56
  const currentHeight = gl.canvas.height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.6.45-a",
3
+ "version": "0.6.47-a",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -1,7 +1,3 @@
1
1
 
2
2
  export const ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
3
3
  export const ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
4
- export const COMPASS_MODES = Object.freeze({
5
- COMPASS: 1,
6
- REAL: 0,
7
- });
@@ -1,5 +1,5 @@
1
1
  import { RangeRings } from "./plugin";
2
2
  import { ringKeyMethod } from "./ring-account";
3
3
  import RangeRingAngleText from './rangeringangletext';
4
- import { ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES } from './enum';
5
- export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES, RangeRingAngleText, ringKeyMethod };
4
+ import { ENUM_HIDE, ENUM_TEXT_HIDE } from './enum';
5
+ export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, RangeRingAngleText, ringKeyMethod };
@@ -41,7 +41,6 @@
41
41
  * @method setOpacity @param {number} opacity
42
42
  *
43
43
  * @method setOneDegreePaddingOn // performance consuming, might be removed
44
- * @method setCompass // removed
45
44
  *
46
45
  */
47
46
 
@@ -110,7 +109,7 @@ class RangeRings {
110
109
  const paddingDatas = this.__reconstructCentralRingsBigPaddings(centerID);
111
110
  paddingBufferOrchestrator.updateBulk(paddingDatas, bufferManagersCompMapPadding, ["circlePoint", "paddingPoint", "circlePoint3d", "paddingPoint3d"]);
112
111
  }
113
- this.textPlugin?.updateCentersXY(items);
112
+ this.paddingTextPlugin?.updateCentersXY(items);
114
113
 
115
114
  this.__contextTextWriterUpdate(items.map(({ centerID }) => centerID), textWriterIDs);
116
115
  globe.DrawRender();
@@ -148,7 +147,7 @@ class RangeRings {
148
147
  const paddingDatas = this.__reconstructCentralRingsBigPaddings(item.centerID);
149
148
  paddingBufferOrchestrator.insertBulk(paddingDatas, bufferManagersCompMapPadding);
150
149
  }
151
- this.textPlugin?.insertBulk(items);
150
+ this.paddingTextPlugin?.insertBulk(items);
152
151
  this.__contextTextWriterUpdate(items.map(({ centerID }) => centerID), textWriterIDs);
153
152
  globe.DrawRender();
154
153
  }
@@ -208,7 +207,7 @@ class RangeRings {
208
207
  const paddingDatas = this.__reconstructCentralPaddingProperties(centerID)
209
208
  paddingBufferOrchestrator.updateBulk(paddingDatas, bufferManagersCompMapPadding, ["rgba"]);
210
209
  }
211
- this.textPlugin?.updateCentersHide(centerHides);
210
+ this.paddingTextPlugin?.updateCentersHide(centerHides);
212
211
  this.__contextTextWriterUpdate(centerHides.map(({ centerID }) => centerID), textWriterIDs);
213
212
  globe.DrawRender();
214
213
  /**
@@ -265,7 +264,7 @@ class RangeRings {
265
264
  paddingBufferOrchestrator.deleteBulk(paddingKeys, bufferManagersCompMapPadding);
266
265
  }
267
266
  }
268
- this.textPlugin?.removeCenters(centerIDs);
267
+ this.paddingTextPlugin?.removeCenters(centerIDs);
269
268
  this._ringAccount.removeCenters(centerIDs);
270
269
  globe.DrawRender();
271
270
  }
@@ -276,7 +275,7 @@ class RangeRings {
276
275
  setOpacity(opacity) {
277
276
  if (typeof opacity !== "number" || opacity < 0 || opacity > 1) throw new Error("Invalid value for opacity");
278
277
  this._opacity = opacity;
279
- this.textPlugin?.setOpacity(opacity);
278
+ this.paddingTextPlugin?.setOpacity(opacity);
280
279
  this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
281
280
  this.globe.DrawRender();
282
281
  }
@@ -550,7 +549,7 @@ class RangeRings {
550
549
  this._initPrograms();
551
550
  this._initBufferManagers();
552
551
  if (this._showNumbers) {
553
- this.textPlugin = new RangeRingAngleText(globe, this.id + "text", { flatCompassMode: this.compass, style: this._numbersStyle, opacity: this._opacity });
552
+ this.paddingTextPlugin = new RangeRingAngleText(globe, this.id + "text", { style: this._numbersStyle, opacity: this._opacity });
554
553
  delete this._numbersStyle;
555
554
  }
556
555
  }
@@ -602,7 +601,7 @@ class RangeRings {
602
601
  this._padding2dProgram = null;
603
602
  this._padding3dProgram = null;
604
603
  this._bigPadding3dFlatProgram = null;
605
- this.textPlugin?.free();
604
+ this.paddingTextPlugin?.free();
606
605
  this._isFreed = true;
607
606
  }
608
607
 
@@ -1,17 +1,10 @@
1
-
2
1
  import {
3
2
  CSObjectArrayUpdateTypes,
4
3
  } from "@pirireis/webglobe";
5
- import { ENUM_HIDE, ENUM_TEXT_HIDE, COMPASS_MODES } from "./enum";
6
-
7
-
8
- const Degree = 180 / Math.PI;
9
-
10
-
4
+ import { ENUM_HIDE, ENUM_TEXT_HIDE } from "./enum";
11
5
 
12
6
  const fidKey = "__fid__";
13
7
 
14
-
15
8
  const object = {
16
9
  "displayName": "RangeRingAngleText",
17
10
  "layerType": 3,
@@ -28,12 +21,10 @@ const object = {
28
21
 
29
22
 
30
23
  export default class RangeRingAngleText {
31
- constructor(globe, id, { style = null, flatCompassMode = COMPASS_MODES.REAL, hideAll = false, opacity = 1 } = {}) {
24
+ constructor(globe, id, { style = null, hideAll = false, opacity = 1 } = {}) {
32
25
  this.globe = globe;
33
26
  this.ObjectArray = globe.ObjectArray;
34
27
  this.id = id;
35
- this._flatCompassMode = flatCompassMode;
36
- this._lastImplicitCompassMode = this.__implicitCompassMode();
37
28
 
38
29
  this._hideAll = hideAll;
39
30
  this._opacity = opacity;
@@ -78,12 +69,6 @@ export default class RangeRingAngleText {
78
69
  this.ObjectArray.StyleChanged(this.object);
79
70
  }
80
71
 
81
- setCompass(mode) {
82
- if (mode === this._flatCompassMode) return;
83
- this._flatCompassMode = mode;
84
- this.__onCompassChange();
85
- }
86
-
87
72
 
88
73
  free() {
89
74
  this.flush();
@@ -119,6 +104,7 @@ export default class RangeRingAngleText {
119
104
  if (this._centerCollection.has(centerID)) {
120
105
  this._fillDeleteBucket(centerID, deleteBucket);
121
106
  }
107
+
122
108
  const maxRadius = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
123
109
  const textHide_ = _hideAll ? ENUM_TEXT_HIDE.HIDE : textHide;
124
110
  const show = hide !== ENUM_HIDE.HIDE && textHide_ === ENUM_TEXT_HIDE.SHOW;
@@ -290,48 +276,20 @@ export default class RangeRingAngleText {
290
276
  this.ObjectArray.SetData(this.object, data);
291
277
  }
292
278
 
293
- //------------------GLOBE EVENTS------------------//
294
-
295
- setGeometry() {
296
- this.__onCompassChange();
297
- }
298
279
 
299
280
 
300
281
  //------------------PRIVATE METHODS------------------//
301
282
 
302
- __implicitCompassMode() {
303
- const is3D = this.globe.api_GetCurrentGeometry() === 0;
304
- if (is3D) {
305
- return COMPASS_MODES.REAL;
306
- } else {
307
- return this._flatCompassMode;
308
- }
309
- }
310
-
311
-
312
- __onCompassChange() {
313
- if (this._lastImplicitCompassMode === this.__implicitCompassMode()) return;
314
- this._lastImplicitCompassMode = this.__implicitCompassMode();
315
- this._updateAll();
316
- }
317
283
 
318
284
 
319
285
 
320
- // TODO: compass ve gercek mesafeye gore farkli hesaplamalar yapilacak __implicitCompassMode
321
286
  _appendCircle(long, lat, radius, step, centerID, outBucket) {
322
- const currentCompassMode = this.__implicitCompassMode();
323
- if (currentCompassMode == COMPASS_MODES.REAL) {
324
- this.__realCoords(long, lat, radius, step, centerID, outBucket);
325
- } else if (currentCompassMode == COMPASS_MODES.COMPASS) {
326
- // throw new Error("Not implemented yet");
327
- // this.__compassCoords(long, lat, radius, step, centerID, outBucket);
328
- }
287
+ this.__realCoords(long, lat, radius, step, centerID, outBucket);
329
288
 
330
289
  }
331
290
 
332
291
  __realCoords(long, lat, radius, stepAngle, centerID, outBucket) {
333
292
  const { coords, coordsZ, attribs } = outBucket;
334
-
335
293
  const coords_ = realCircle(this.globe, long, lat, radius, stepAngle);
336
294
  { // add 0
337
295
  const { long, lat } = coords_[0];
@@ -344,7 +302,9 @@ export default class RangeRingAngleText {
344
302
  "aci": "K"
345
303
  });
346
304
  }
305
+
347
306
  let aci = stepAngle;
307
+
348
308
  for (let i = 1; i < coords_.length; i++) {
349
309
  if (aci >= 360) break;
350
310
  const { long, lat } = coords_[i];
@@ -354,51 +314,13 @@ export default class RangeRingAngleText {
354
314
  // fidkey is the key
355
315
  attribs.push({
356
316
  "__fid__": key,
357
- "aci": (360 - aci).toString().padStart(3, '0')
317
+ "aci": (360 - aci).toFixed(0).toString().padStart(3, '0')
358
318
  })
359
319
  aci += stepAngle;
360
320
  }
361
321
  }
362
322
 
363
323
 
364
- __compassCoords(long, lat, radius, stepAngle, centerID, outBucket) {
365
-
366
- const Dlong = Degree * long;
367
- const Dlat = Degree * lat;
368
-
369
- const R = 6371.0 * 1000;
370
- const { coords, coordsZ, attribs } = outBucket;
371
- const { globe } = this;
372
- const radianRadius = radius / R;
373
- const scale = Math.cos(lat);
374
- { // add 0
375
- const x = Dlong + Degree * (radianRadius * Math.cos(Math.PI / 2));
376
- const y = Dlat + Degree * (radianRadius * Math.sin(Math.PI / 2) * scale);
377
- coords.push(long, lat);
378
- coordsZ.push(0);
379
- const key = this._key(centerID, 0);
380
- attribs.push({
381
- "__fid__": key,
382
- "aci": "K"
383
- })
384
- }
385
- let aci = stepAngle;
386
- let i = 1;
387
- const RStep = stepAngle / Degree;
388
- for (let cstep = Math.PI / 2 - RStep; cstep > -Math.PI * 1.5; cstep -= RStep) {
389
- if (aci >= 360) break;
390
- const x = Dlong + Degree * (radianRadius * Math.cos(cstep));
391
- const y = Dlat + Degree * (radianRadius * Math.sin(cstep) * scale);
392
- coords.push(long, lat);
393
- coordsZ.push(0);
394
- const key = this._key(centerID, i++);
395
- attribs.push({
396
- "__fid__": key,
397
- "aci": Math.floor(aci).toString()
398
- })
399
- aci += stepAngle;
400
- }
401
- }
402
324
 
403
325
 
404
326
  _updateData(bucket, mode) {
@@ -447,19 +369,6 @@ export default class RangeRingAngleText {
447
369
  }
448
370
 
449
371
 
450
- const readCoords = (long, lat, radius, stepAngle) => {
451
-
452
- const result = []
453
- const degree = radius / R;
454
-
455
- return result;
456
- }
457
-
458
-
459
-
460
-
461
- const R = 6371.0;
462
-
463
372
 
464
373
  const realCircle = (globe, longitude, latitude, radius, stepAngle) => {
465
374
  const pointsLongLat = globe.Math.GetEllipseGeo(
package/wind/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import WindPlugin from "./plugin";
2
2
  import createVectorFieldImage from "./vectorfieldimage";
3
3
  import imageToMagnitude from "./imagetovectorfieldandmagnitude";
4
-
5
- export { createVectorFieldImage, imageToMagnitude, WindPlugin };
4
+ import { createImageFromBase64 } from "../util/webglobjectbuilders";
5
+ export { createVectorFieldImage, imageToMagnitude, WindPlugin, createImageFromBase64 };
6
6
 
7
7
  // TODO: image resmindeki degerlerden ruzgar siddetinin magnitudunun hesaplanip float32array donderen bir fonksiyonun yazilmasi gerekiyor