@pirireis/webglobeplugins 0.6.45-a → 0.6.46-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.46-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();
@@ -290,42 +275,15 @@ export default class RangeRingAngleText {
290
275
  this.ObjectArray.SetData(this.object, data);
291
276
  }
292
277
 
293
- //------------------GLOBE EVENTS------------------//
294
-
295
- setGeometry() {
296
- this.__onCompassChange();
297
- }
298
278
 
299
279
 
300
280
  //------------------PRIVATE METHODS------------------//
301
281
 
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
282
 
318
283
 
319
284
 
320
- // TODO: compass ve gercek mesafeye gore farkli hesaplamalar yapilacak __implicitCompassMode
321
285
  _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
- }
286
+ this.__realCoords(long, lat, radius, step, centerID, outBucket);
329
287
 
330
288
  }
331
289
 
@@ -344,7 +302,10 @@ export default class RangeRingAngleText {
344
302
  "aci": "K"
345
303
  });
346
304
  }
347
- let aci = stepAngle;
305
+
306
+ const _stepAngle = this.globe.Units.AngleUtoDeg(stepAngle)
307
+ let aci = _stepAngle;
308
+
348
309
  for (let i = 1; i < coords_.length; i++) {
349
310
  if (aci >= 360) break;
350
311
  const { long, lat } = coords_[i];
@@ -354,51 +315,13 @@ export default class RangeRingAngleText {
354
315
  // fidkey is the key
355
316
  attribs.push({
356
317
  "__fid__": key,
357
- "aci": (360 - aci).toString().padStart(3, '0')
318
+ "aci": (360 - aci).toFixed(0).toString().padStart(3, '0')
358
319
  })
359
- aci += stepAngle;
320
+ aci += _stepAngle;
360
321
  }
361
322
  }
362
323
 
363
324
 
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
325
 
403
326
 
404
327
  _updateData(bucket, mode) {
@@ -416,7 +339,8 @@ export default class RangeRingAngleText {
416
339
  const stepAngle = centerMap.get("stepAngle");
417
340
  const { coords, coordsZ, attribs } = outDeleteBucket;
418
341
  let i = 0;
419
- for (let aci = 0; aci < 360; aci += stepAngle) {
342
+ const _stepAngle = this.globe.Units.AngleUtoDeg(stepAngle)
343
+ for (let aci = 0; aci < 360; aci += _stepAngle) {
420
344
  const key = this._key(centerID, i++);
421
345
  coords.push(0, 0);
422
346
  coordsZ.push(0);
@@ -447,19 +371,6 @@ export default class RangeRingAngleText {
447
371
  }
448
372
 
449
373
 
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
374
 
464
375
  const realCircle = (globe, longitude, latitude, radius, stepAngle) => {
465
376
  const pointsLongLat = globe.Math.GetEllipseGeo(