@pirireis/webglobeplugins 0.15.26 → 0.15.27

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.15.26",
3
+ "version": "0.15.27",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -0,0 +1,2 @@
1
+ export const ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
2
+ export const ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
@@ -2,6 +2,8 @@ import { CircleOnTerrainPlugin } from "../../semiplugins/shape-on-terrain/circle
2
2
  import { ArcOnTerrainPlugin } from "../../semiplugins/shape-on-terrain/arc-plugin";
3
3
  import { Padding1DegreePlugin } from '../../semiplugins/shape-on-terrain/padding-1-degree';
4
4
  import { padding1DegreeInputAdapter, rangeRingToArcInputAdapter, rangeRingToCircleInputAdapter, allCircleKeysAdapter, allArcKeysAdapter, createColorRatios } from "./adapters";
5
+ import RangeRingAngleText from "./rangeringangletext";
6
+ import { opacityCheck } from "../../util/check/typecheck";
5
7
  export var ENUM_HIDE;
6
8
  (function (ENUM_HIDE) {
7
9
  ENUM_HIDE[ENUM_HIDE["SHOW"] = 0] = "SHOW";
@@ -24,40 +26,47 @@ export class RangeRingPlugin {
24
26
  _memory = new Map();
25
27
  _freed = false;
26
28
  textWritersMap = new Map();
29
+ rangeRingAngleText = null;
30
+ _opacity = 1;
31
+ _numbersStyle = null;
32
+ draw1degrePadding = true;
27
33
  _semiPluginOptions = {
28
34
  circleOnTerrainOptions: {
29
- variativeColorsOn: false,
35
+ variativeColorsOn: true,
30
36
  defaultColor: [1, 1, 1, 1],
31
37
  defaultHeightFromGroundIn3D: 30,
32
38
  },
33
39
  arcOnTerrainOptions: {
34
40
  flatViewOn: true,
35
41
  globeViewOn: true,
36
- variativeColorsOn: false,
42
+ variativeColorsOn: true,
37
43
  defaultColor: [1, 1, 1, 1],
38
44
  defaultHeightFromGroundIn3D: 0,
39
45
  vertexCount: 32,
40
46
  cameraAttractionIsOn: true // If true, camera attraction is enabled else evenly distributed arc points are used
41
47
  },
42
48
  paddingOptions: {
43
- variativeColorsOn: false,
49
+ variativeColorsOn: true,
44
50
  defaultColor: [1, 1, 1, 1],
45
51
  defaultHeightFromGroundIn3D: 0,
52
+ adativePaddingSize: true,
46
53
  },
47
54
  };
48
55
  constructor(id, { textDataPreAdaptor = (center) => center, textWritersMap = new Map(), }) {
49
56
  this.id = id;
50
57
  this.circlePlugin = new CircleOnTerrainPlugin(this.id + "-circle", {
51
58
  variativeColorsOn: true,
59
+ ...this._semiPluginOptions.circleOnTerrainOptions
52
60
  });
53
61
  this.arcPlugin = new ArcOnTerrainPlugin(this.id + "-arc", {
54
62
  variativeColorsOn: true,
55
- vertexCount: 20,
63
+ ...this._semiPluginOptions.arcOnTerrainOptions
56
64
  });
57
65
  this.paddingPlugin = new Padding1DegreePlugin(this.id + "-padding", {
58
66
  variativeColorsOn: true,
59
67
  defaultColor: [1, 1, 1, 1],
60
68
  defaultHeightFromGroundIn3D: 0,
69
+ ...this._semiPluginOptions.paddingOptions
61
70
  });
62
71
  if (textWritersMap) {
63
72
  this.textWritersMap = textWritersMap;
@@ -87,6 +96,7 @@ export class RangeRingPlugin {
87
96
  this.updateText([item.centerID]);
88
97
  }
89
98
  }
99
+ this.rangeRingAngleText?.insertBulk(items);
90
100
  }
91
101
  removeCenters(centers) {
92
102
  if (this._freed) {
@@ -103,16 +113,20 @@ export class RangeRingPlugin {
103
113
  console.warn(`No data found for centerID: ${centers[i]}`);
104
114
  continue;
105
115
  }
116
+ this._memory.delete(centers[i]);
117
+ if (rangeRingInput.hide === ENUM_HIDE.HIDE) {
118
+ continue;
119
+ }
106
120
  const circleKeys = allCircleKeysAdapter(rangeRingInput);
107
121
  this.circlePlugin.deleteBulk(circleKeys);
108
- this.paddingPlugin?.deleteBulk(circleKeys);
109
122
  const allArcKeys = allArcKeysAdapter(rangeRingInput);
110
123
  this.arcPlugin.deleteBulk(allArcKeys);
111
- this._memory.delete(centers[i]);
124
+ if (rangeRingInput.hide !== ENUM_HIDE.HIDE_1_DEGREE_PADDINGS) {
125
+ this.paddingPlugin?.deleteBulk(circleKeys);
126
+ }
112
127
  }
113
128
  this.globe.DrawRender();
114
- }
115
- updateCenters() {
129
+ this.rangeRingAngleText?.removeCenters(centers);
116
130
  }
117
131
  updateCentersCoordinate(items) {
118
132
  if (this._freed) {
@@ -130,14 +144,20 @@ export class RangeRingPlugin {
130
144
  if (rangeRingInput) {
131
145
  rangeRingInput.long = long;
132
146
  rangeRingInput.lat = lat;
147
+ if (rangeRingInput.hide === ENUM_HIDE.HIDE) {
148
+ continue;
149
+ }
133
150
  const arcData = rangeRingToArcInputAdapter(globe, rangeRingInput);
134
151
  this.arcPlugin.updateCoordinates(arcData);
135
152
  const circleData = rangeRingToCircleInputAdapter(rangeRingInput);
136
153
  this.circlePlugin.updateCoordinates(circleData);
137
- this.paddingPlugin?.updateCoordinates(circleData);
154
+ if (rangeRingInput.hide !== ENUM_HIDE.HIDE_1_DEGREE_PADDINGS) {
155
+ this.paddingPlugin?.updateCoordinates(circleData);
156
+ }
138
157
  this.updateText([centerID]);
139
158
  }
140
159
  }
160
+ this.rangeRingAngleText?.updateCentersXY(items);
141
161
  }
142
162
  updateCentersColor(items) {
143
163
  if (this._freed) {
@@ -156,12 +176,15 @@ export class RangeRingPlugin {
156
176
  continue;
157
177
  }
158
178
  data.rgba = item.rgba;
179
+ if (data.hide === ENUM_HIDE.HIDE) {
180
+ continue;
181
+ }
159
182
  // update arc Colors
160
183
  const arcColors = allArcKeysAdapter(data).map(key => ({ key, color: data.rgba }));
161
184
  this.arcPlugin.updateColors(arcColors, false);
162
185
  const circleColors = allCircleKeysAdapter(data).map(key => ({ key, color: data.rgba }));
163
186
  this.circlePlugin.updateColors(circleColors);
164
- if (this.paddingPlugin) {
187
+ if (this.paddingPlugin && data.hide !== ENUM_HIDE.HIDE_1_DEGREE_PADDINGS) {
165
188
  const colorRatios = createColorRatios(data.rgba, data.stepAngle, 0.5);
166
189
  for (const { key } of circleColors) {
167
190
  this.paddingPlugin?.updateColorRatios(key, colorRatios, false);
@@ -171,7 +194,100 @@ export class RangeRingPlugin {
171
194
  }
172
195
  this.globe.DrawRender();
173
196
  }
174
- updateCentersHide() {
197
+ updateCentersHide(items) {
198
+ if (this._freed) {
199
+ console.warn("Plugin is freed, cannot update centers hide");
200
+ return;
201
+ }
202
+ if (this.globe === null || this.gl === null) {
203
+ console.warn("Globe or WebGL context is not initialized, cannot update centers hide");
204
+ return;
205
+ }
206
+ console.log("updateCentersHide", items);
207
+ const globe = this.globe;
208
+ for (const item of items) {
209
+ const { centerID, hide, textHide } = item;
210
+ const rangeRingInput = this._memory.get(centerID);
211
+ if (!rangeRingInput) {
212
+ console.warn(`No data found for centerID: ${centerID}`);
213
+ continue;
214
+ }
215
+ if (textHide !== undefined) {
216
+ rangeRingInput.textHide = textHide;
217
+ }
218
+ // Update hide state first
219
+ if (hide !== undefined) {
220
+ if (rangeRingInput.hide !== hide) {
221
+ if (hide === ENUM_HIDE.HIDE) {
222
+ const circleKeys = allCircleKeysAdapter(rangeRingInput);
223
+ this.circlePlugin.deleteBulk(circleKeys);
224
+ if (rangeRingInput.hide !== ENUM_HIDE.HIDE_1_DEGREE_PADDINGS) {
225
+ this.paddingPlugin?.deleteBulk(circleKeys);
226
+ }
227
+ const allArcKeys = allArcKeysAdapter(rangeRingInput);
228
+ this.arcPlugin.deleteBulk(allArcKeys);
229
+ }
230
+ else {
231
+ if (rangeRingInput.hide === ENUM_HIDE.SHOW && hide === ENUM_HIDE.HIDE_1_DEGREE_PADDINGS) {
232
+ const paddingKeys = allCircleKeysAdapter(rangeRingInput);
233
+ this.paddingPlugin?.deleteBulk(paddingKeys);
234
+ }
235
+ else if (rangeRingInput.hide !== ENUM_HIDE.SHOW && hide === ENUM_HIDE.SHOW) {
236
+ const paddingData = padding1DegreeInputAdapter(rangeRingInput);
237
+ this.paddingPlugin?.insertBulk(paddingData);
238
+ }
239
+ if (rangeRingInput.hide === ENUM_HIDE.HIDE) {
240
+ const circleInputs = rangeRingToCircleInputAdapter(rangeRingInput);
241
+ this.circlePlugin?.insertBulk(circleInputs);
242
+ const arcInputs = rangeRingToArcInputAdapter(globe, rangeRingInput);
243
+ this.arcPlugin?.insertBulk(arcInputs);
244
+ }
245
+ }
246
+ rangeRingInput.hide = hide;
247
+ }
248
+ }
249
+ if (rangeRingInput.textHide === ENUM_TEXT_HIDE.HIDE || rangeRingInput.hide === ENUM_HIDE.HIDE) {
250
+ this.textWritersMap.forEach((writer) => writer.deleteText(rangeRingInput));
251
+ }
252
+ else if (rangeRingInput.textHide === ENUM_TEXT_HIDE.SHOW) {
253
+ this.textWritersMap.forEach((writer) => writer.insertText(rangeRingInput));
254
+ }
255
+ }
256
+ this.rangeRingAngleText?.updateCentersHide(items);
257
+ this.globe.DrawRender();
258
+ }
259
+ setOpacity(opacity) {
260
+ if (this._freed) {
261
+ console.warn("Plugin is freed, cannot set opacity");
262
+ return;
263
+ }
264
+ opacityCheck(opacity);
265
+ if (this._opacity === opacity) {
266
+ return;
267
+ }
268
+ this._opacity = opacity;
269
+ this.arcPlugin?.setPluginOpacity(opacity);
270
+ this.circlePlugin?.setPluginOpacity(opacity);
271
+ this.paddingPlugin?.setPluginOpacity(opacity);
272
+ this.textWritersMap.forEach((writer) => writer.setOpacity(opacity));
273
+ this.rangeRingAngleText?.setOpacity(opacity);
274
+ this.globe?.DrawRender();
275
+ }
276
+ setOneDegreePaddingOn(state) {
277
+ if (this._freed) {
278
+ console.warn("Plugin is freed, cannot set padding on");
279
+ return;
280
+ }
281
+ if (this.paddingPlugin === null) {
282
+ console.warn("Padding plugin is not initialized");
283
+ return;
284
+ }
285
+ if (typeof state !== "boolean") {
286
+ console.warn("Invalid state type, expected boolean");
287
+ return;
288
+ }
289
+ this.draw1degrePadding = state;
290
+ this.globe?.DrawRender();
175
291
  }
176
292
  init(globe, gl) {
177
293
  this.globe = globe;
@@ -179,6 +295,7 @@ export class RangeRingPlugin {
179
295
  this.circlePlugin.init(globe, gl);
180
296
  this.arcPlugin.init(globe, gl);
181
297
  this.paddingPlugin?.init(globe, gl);
298
+ this.rangeRingAngleText = new RangeRingAngleText(globe, this.id + "text", { style: this._numbersStyle, opacity: this._opacity });
182
299
  }
183
300
  draw3D() {
184
301
  if (this._freed) {
@@ -186,12 +303,17 @@ export class RangeRingPlugin {
186
303
  return;
187
304
  }
188
305
  this.arcPlugin.draw3D();
189
- this.paddingPlugin?.draw3D();
190
306
  this.circlePlugin.draw3D();
307
+ if (this.draw1degrePadding) {
308
+ this.paddingPlugin?.draw3D();
309
+ }
191
310
  for (const [key, writer] of this.textWritersMap) {
192
311
  writer.draw();
193
312
  }
194
313
  }
314
+ setZAlphaOnDegreePadding(zAlphaOnDegreePadding) {
315
+ throw new Error("setZAlphaOnDegreePadding is deprecated");
316
+ }
195
317
  free() {
196
318
  if (this._freed) {
197
319
  console.warn("RangeRing Plugin is already freed");
@@ -201,6 +323,7 @@ export class RangeRingPlugin {
201
323
  this.circlePlugin.free();
202
324
  this.arcPlugin.free();
203
325
  this.paddingPlugin?.free();
326
+ this.rangeRingAngleText?.free();
204
327
  }
205
328
  updateText(centerIDs = null) {
206
329
  if (this._freed) {
@@ -218,6 +341,12 @@ export class RangeRingPlugin {
218
341
  const rangeRingData = this._memory.get(centerID);
219
342
  if (!rangeRingData)
220
343
  continue;
344
+ if (rangeRingData.hide === ENUM_HIDE.HIDE) {
345
+ continue;
346
+ }
347
+ if (rangeRingData.textHide === ENUM_TEXT_HIDE.HIDE) {
348
+ continue;
349
+ }
221
350
  for (const [key, writer] of textWritersMap) {
222
351
  writer.insertText(rangeRingData);
223
352
  }
@@ -0,0 +1,331 @@
1
+ // @ts-ignore
2
+ import { CSObjectArrayUpdateTypes } from "@pirireis/webglobe";
3
+ import { ENUM_HIDE, ENUM_TEXT_HIDE } from "./enum";
4
+ const fidKey = "__fid__";
5
+ const object = {
6
+ "displayName": "RangeRingAngleText",
7
+ "layerType": 3,
8
+ "wkbGeom": null,
9
+ "wfsLayerName": null,
10
+ "objectType": "point",
11
+ "bbox": null,
12
+ "startLod": 2,
13
+ "endLod": 30,
14
+ "continuousLOD": true,
15
+ "MVTXYZName": "hd_seyp",
16
+ "rasterize": false,
17
+ };
18
+ export default class RangeRingAngleText {
19
+ globe;
20
+ ObjectArray;
21
+ id;
22
+ _hideAll;
23
+ _opacity;
24
+ object;
25
+ _centerCollection;
26
+ constructor(globe, id, { style = null, hideAll = false, opacity = 1 } = {}) {
27
+ this.globe = globe;
28
+ this.ObjectArray = globe.ObjectArray;
29
+ this.id = id;
30
+ this._hideAll = hideAll;
31
+ this._opacity = opacity;
32
+ const style_ = style !== null ? style : this.getDefaultStyle();
33
+ this.object = Object.assign({}, object, { style: style_, id: this.id });
34
+ this._centerCollection = new Map();
35
+ // new inner MAP params
36
+ // hide
37
+ // textHide
38
+ this.ObjectArray.Add(this.object);
39
+ }
40
+ getDefaultStyle() {
41
+ const style = this.ObjectArray.GetDefaultStyle();
42
+ style.fidKey = fidKey;
43
+ const { labels } = style;
44
+ const label = labels[0];
45
+ label.offset = { x: 0, y: 0 };
46
+ label.fontFamily.hollowWidth = 1;
47
+ label.vAlignment = 2;
48
+ label.hAlignment = 2;
49
+ label.size = 17;
50
+ // eslint-disable-next-line
51
+ label.text = "`${aci}`";
52
+ return style;
53
+ }
54
+ setStyle(style) {
55
+ if (style === null)
56
+ return;
57
+ style.opacity = this._opacity;
58
+ this.object.style = style;
59
+ this.ObjectArray.StyleChanged(this.object);
60
+ }
61
+ setOpacity(opacity) {
62
+ this._opacity = opacity;
63
+ const { style } = this.object;
64
+ style.opacity = opacity;
65
+ this.ObjectArray.StyleChanged(this.object);
66
+ }
67
+ free() {
68
+ this.flush();
69
+ this.ObjectArray.Delete(this.id);
70
+ }
71
+ /**
72
+ * @param ringDatas Array of ring data objects
73
+ * centerID: string | ObjectArray fidKey de kullanilir
74
+ * stepAngle: number | 0-360 arasinda
75
+ * long,lat: number | merkez koordinatlari lat long radian. Globe icin dereceye iceride cevrilir
76
+ * rings: Array<{radius: number}> | En buyuk halkaya centik acilari yazilir, Sonraki adim yaricaplarin uzunlugunu yazdirmak
77
+ *
78
+ * eger bir centerID zaten var ise: Onceki noktalar dusurulur ve yeniden eklenir
79
+ */
80
+ insertBulk(ringDatas) {
81
+ const { _hideAll } = this;
82
+ const addBucket = {
83
+ coords: [],
84
+ coordsZ: [],
85
+ attribs: []
86
+ };
87
+ const deleteBucket = {
88
+ coords: [],
89
+ coordsZ: [],
90
+ attribs: []
91
+ };
92
+ for (const { centerID, long, lat, rings, stepAngle, hide = ENUM_HIDE.SHOW, textHide = ENUM_TEXT_HIDE.SHOW } of ringDatas) {
93
+ if (this._centerCollection.has(centerID)) {
94
+ this._fillDeleteBucket(centerID, deleteBucket);
95
+ }
96
+ const maxRadius = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
97
+ const textHide_ = _hideAll ? ENUM_TEXT_HIDE.HIDE : textHide;
98
+ const show = hide !== ENUM_HIDE.HIDE && textHide_ === ENUM_TEXT_HIDE.SHOW;
99
+ if (show)
100
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
101
+ this._centerCollection.set(centerID, new Map([
102
+ ["stepAngle", stepAngle],
103
+ ["maxRadius", maxRadius],
104
+ ["long", long],
105
+ ["lat", lat],
106
+ ["hide", hide],
107
+ ["textHide", textHide_]
108
+ ]));
109
+ }
110
+ if (this._hideAll)
111
+ return;
112
+ if (deleteBucket.coords.length > 0)
113
+ this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
114
+ if (addBucket.coords.length > 0)
115
+ this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
116
+ }
117
+ /**
118
+ * @param centerDatas Array of center data objects
119
+ * aci ve radiuslarin tutulmasi gereklidir.
120
+ */
121
+ updateCentersXY(centerDatas) {
122
+ const updateBucket = {
123
+ coords: [],
124
+ coordsZ: [],
125
+ attribs: []
126
+ };
127
+ for (const { centerID, long, lat } of centerDatas) {
128
+ if (this._centerCollection.has(centerID)) {
129
+ const centerMap = this._centerCollection.get(centerID);
130
+ centerMap.set("long", long);
131
+ centerMap.set("lat", lat);
132
+ const hide = centerMap.get("hide");
133
+ const textHide = centerMap.get("textHide");
134
+ const isHidden = hide === ENUM_HIDE.HIDE || textHide === ENUM_TEXT_HIDE.HIDE;
135
+ if (isHidden)
136
+ continue;
137
+ const maxRadius = centerMap.get("maxRadius");
138
+ const stepAngle = centerMap.get("stepAngle");
139
+ // long, lat, radius, step, centerID, outBucket
140
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
141
+ }
142
+ }
143
+ // for (const attribs of updateBucket.attribs) {
144
+ // delete attribs["aci"];
145
+ // }
146
+ if (updateBucket.coords.length > 0) {
147
+ this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
148
+ }
149
+ }
150
+ /**
151
+ * @param centerHides Array of center hide data
152
+ */
153
+ updateCentersHide(centerHides) {
154
+ if (this._hideAll) {
155
+ console.warn("Tum mesafe halkasi yazilari gizli durum. Islem yapilamaz");
156
+ return;
157
+ }
158
+ ;
159
+ const addBucket = {
160
+ coords: [],
161
+ coordsZ: [],
162
+ attribs: []
163
+ };
164
+ const deleteBucket = {
165
+ coords: [],
166
+ coordsZ: [],
167
+ attribs: []
168
+ };
169
+ for (const { centerID, textHide = null, hide = null } of centerHides) {
170
+ if (!this._centerCollection.has(centerID))
171
+ continue;
172
+ const centerMap = this._centerCollection.get(centerID);
173
+ const isHidden = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
174
+ const _hide = hide !== null ? hide : centerMap.get("hide");
175
+ const _textHide = textHide !== null ? textHide : centerMap.get("textHide");
176
+ const show = (_hide !== ENUM_HIDE.HIDE) && (_textHide === ENUM_TEXT_HIDE.SHOW);
177
+ if (!isHidden && !show) {
178
+ this._fillDeleteBucket(centerID, deleteBucket);
179
+ }
180
+ else if (isHidden && show) {
181
+ this._appendCircle(centerMap.get("long"), centerMap.get("lat"), centerMap.get("maxRadius"), centerMap.get("stepAngle"), centerID, addBucket);
182
+ }
183
+ if (hide !== null)
184
+ centerMap.set("hide", hide);
185
+ if (textHide !== null)
186
+ centerMap.set("textHide", textHide);
187
+ }
188
+ if (deleteBucket.coords.length > 0)
189
+ this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
190
+ if (addBucket.coords.length > 0)
191
+ this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
192
+ }
193
+ // TODO : Implement this
194
+ removeCenters(centerIDs) {
195
+ const deleteBucket = {
196
+ coords: [],
197
+ coordsZ: [],
198
+ attribs: []
199
+ };
200
+ for (const centerID of centerIDs) {
201
+ if (this._centerCollection.has(centerID)) {
202
+ this._fillDeleteBucket(centerID, deleteBucket);
203
+ this._centerCollection.delete(centerID);
204
+ }
205
+ }
206
+ this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
207
+ }
208
+ hideAll() {
209
+ this._hideAll = true;
210
+ const deleteBucket = {
211
+ coords: [],
212
+ coordsZ: [],
213
+ attribs: []
214
+ };
215
+ for (const [centerID, centerMap] of this._centerCollection) {
216
+ const hide = centerMap.get("hide");
217
+ const hideText = centerMap.get("textHide");
218
+ centerMap.set("textHide", ENUM_TEXT_HIDE.HIDE);
219
+ if (hide === ENUM_HIDE.HIDE)
220
+ continue;
221
+ const isHidden = hideText === ENUM_TEXT_HIDE.HIDE;
222
+ if (!isHidden)
223
+ this._fillDeleteBucket(centerID, deleteBucket);
224
+ }
225
+ this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
226
+ }
227
+ showAll() {
228
+ this._hideAll = false;
229
+ const addBucket = {
230
+ coords: [],
231
+ coordsZ: [],
232
+ attribs: []
233
+ };
234
+ for (const [centerID, centerMap] of this._centerCollection) {
235
+ const hide = centerMap.get("hide");
236
+ if (hide === ENUM_HIDE.HIDE)
237
+ continue;
238
+ const hideText = centerMap.get("textHide");
239
+ const isHidden = hideText === ENUM_TEXT_HIDE.HIDE;
240
+ if (isHidden) {
241
+ const long = centerMap.get("long");
242
+ const lat = centerMap.get("lat");
243
+ const maxRadius = centerMap.get("maxRadius");
244
+ const stepAngle = centerMap.get("stepAngle");
245
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
246
+ centerMap.set("hide", ENUM_HIDE.SHOW);
247
+ centerMap.set("textHide", ENUM_TEXT_HIDE.SHOW);
248
+ }
249
+ }
250
+ if (addBucket.coords.length)
251
+ this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
252
+ }
253
+ flush() {
254
+ const data = {
255
+ coords: [],
256
+ coordsZ: [],
257
+ attribs: []
258
+ };
259
+ this.ObjectArray.SetData(this.object, data);
260
+ }
261
+ //------------------PRIVATE METHODS------------------//
262
+ _appendCircle(long, lat, radius, step, centerID, outBucket) {
263
+ this.__realCoords(long, lat, radius, step, centerID, outBucket);
264
+ }
265
+ __realCoords(longCenter, latCenter, radius, stepAngle, centerID, outBucket) {
266
+ const { globe } = this;
267
+ const { coords, coordsZ, attribs } = outBucket;
268
+ let i = 1;
269
+ for (let aci = stepAngle; aci < 360; aci += stepAngle) {
270
+ const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, aci);
271
+ coords.push(long, lat);
272
+ coordsZ.push(0);
273
+ const key = this._key(centerID, i);
274
+ i++;
275
+ // fidkey is the key
276
+ attribs.push({
277
+ "__fid__": key,
278
+ "aci": (aci).toFixed(0).toString().padStart(3, '0')
279
+ });
280
+ }
281
+ { // add 0
282
+ const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, 0);
283
+ coords.push(long, lat);
284
+ coordsZ.push(0);
285
+ const key = this._key(centerID, 0);
286
+ // fidkey is the key
287
+ attribs.push({
288
+ "__fid__": key,
289
+ "aci": "K"
290
+ });
291
+ }
292
+ }
293
+ _updateData(bucket, mode) {
294
+ this.ObjectArray.UpdateData(this.object, mode, [bucket], { attribs: false, icon: false, text: false });
295
+ }
296
+ _key(centerRingKey, limpIndex) {
297
+ return `${centerRingKey}_${limpIndex}`;
298
+ }
299
+ _fillDeleteBucket(centerID, outDeleteBucket) {
300
+ const centerMap = this._centerCollection.get(centerID);
301
+ const stepAngle = centerMap.get("stepAngle");
302
+ const { coords, coordsZ, attribs } = outDeleteBucket;
303
+ let i = 0;
304
+ for (let aci = 0; aci < 360; aci += stepAngle) {
305
+ const key = this._key(centerID, i++);
306
+ coords.push(0, 0);
307
+ coordsZ.push(0);
308
+ attribs.push({
309
+ "__fid__": key,
310
+ });
311
+ }
312
+ }
313
+ _updateAll() {
314
+ const updateBucket = {
315
+ coords: [],
316
+ coordsZ: [],
317
+ attribs: []
318
+ };
319
+ for (const [centerID, centerMap] of this._centerCollection) {
320
+ const isHidden = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
321
+ if (isHidden)
322
+ continue;
323
+ const long = centerMap.get("long");
324
+ const lat = centerMap.get("lat");
325
+ const maxRadius = centerMap.get("maxRadius");
326
+ const stepAngle = centerMap.get("stepAngle");
327
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
328
+ }
329
+ this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
330
+ }
331
+ }
@@ -1,2 +1 @@
1
- export const ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
2
- export const ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
1
+ "use strict";
@@ -162,6 +162,9 @@ export class Padding1DegreePlugin {
162
162
  return;
163
163
  }
164
164
  this.bufferOrchestrator.deleteBulk(keys, this.bufferManagerMap);
165
+ for (const key of keys) {
166
+ this._dataMap.delete(key);
167
+ }
165
168
  this.globe?.DrawRender();
166
169
  }
167
170
  setPluginOpacity(opacity, drawRender = false) {
@@ -414,7 +417,6 @@ export class Padding1DegreePlugin {
414
417
  }
415
418
  __inner(subSetIDs = null) {
416
419
  // Implement inner circle padding logic
417
- console.log("innerCircle Level Update");
418
420
  const datas = this._dataMap;
419
421
  let keys;
420
422
  if (subSetIDs) {
@@ -90,7 +90,7 @@ export class ContextTextWriter4 {
90
90
  const zoomLevel = globe.api_GetCurrentLODWithDecimal();
91
91
  const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
92
92
  for (const item of itemMap.values()) {
93
- const { lat, long, text, opacity = null, angle = null, zPayload, position } = item;
93
+ const { lat, long, text, opacity = null, angle = null, zPayload, anchor } = item;
94
94
  const { x, y } = globe.api_GetScreenPointFromGeo({
95
95
  long: long,
96
96
  lat: lat,
@@ -99,7 +99,7 @@ export class ContextTextWriter4 {
99
99
  const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(zPayload);
100
100
  const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
101
101
  textFont.size = sizeMultiplier * textSize;
102
- textFont.position = position;
102
+ textFont.position = anchor;
103
103
  if (x !== null && y !== null)
104
104
  globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffset, y: y - yOffset }, angleIsOn, angle);
105
105
  }
@@ -117,9 +117,11 @@ export class ContextTextWriter4 {
117
117
  }
118
118
  }
119
119
  deleteText(data) {
120
- const key = this.deleteAdaptor ? this.deleteAdaptor(data) : data;
121
- if (this.itemMap.has(key)) {
122
- this.itemMap.delete(key);
120
+ const keys = this.deleteAdaptor(data);
121
+ for (const key of keys) {
122
+ if (this.itemMap.has(key)) {
123
+ this.itemMap.delete(key);
124
+ }
123
125
  }
124
126
  }
125
127
  deleteTextBulk(datas) {