@pirireis/webglobeplugins 0.3.9 → 0.4.0-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.
@@ -24,17 +24,15 @@ export class ChainListMap {
24
24
  */
25
25
  addNode(node, chainKey, theNodeKeyFront = null) {
26
26
  const chain = this.getChain(chainKey);
27
-
28
27
  if (theNodeKeyFront == null) {
29
28
  chain.push(node);
30
29
  return;
31
30
  }
32
-
33
31
  for (let i = 0; i < chain.length; i++) {
34
32
  const n_ode = chain[i];
35
- if (n_ode == theNodeKeyFront) {
33
+ if (n_ode.key == theNodeKeyFront) {
36
34
  chain.splice(i, 0, node);
37
- return;
35
+ break;
38
36
  }
39
37
  }
40
38
  this._resetIndexChain(chainKey);
@@ -67,6 +65,7 @@ export class ChainListMap {
67
65
 
68
66
  deleteChainAndReturnChainKeys(chainKey) {
69
67
  const keys = this.getNodeKeysOfChain(chainKey);
68
+ console.log('chainKey', chainKey, "keys", keys);
70
69
  this._chainMap.delete(chainKey);
71
70
  for (const key of keys) this._indexMap.delete(key);
72
71
  return keys;
@@ -74,14 +73,14 @@ export class ChainListMap {
74
73
 
75
74
  updateNode(node, chainKey) {
76
75
  const index = this.getIndexOfNode(chainKey, node.key)
77
- const chain = this._chainMap.getChain(chainKey);
76
+ const chain = this._chainMap.get(chainKey);
78
77
  chain[index] = node;
79
78
  }
80
79
 
81
80
 
82
- setChain(chainKey, list) {
83
- if (this._chainMap.has(chain)) this._flushIndexMap();
84
- this._chainMap.set(chainKey, list);
81
+ setChain(chainKey, nodeList) {
82
+ if (this._chainMap.has(chainKey)) this._flushIndexMap();
83
+ this._chainMap.set(chainKey, nodeList);
85
84
  }
86
85
 
87
86
 
@@ -115,54 +114,37 @@ export class ChainListMap {
115
114
  * @param {*} callback | (value, index, array) => expexted output
116
115
  */
117
116
  calculateBufferPropertiesChain(chainKey, callback, result, nodeIndexes = null) {
118
- const nodes = this._chainMap(chainKey);
119
- const props = this._chainSideProperties(chainKey);
120
- const iterator = nodeIndexes !== null ? nodeIndexes : nodes.keys();
117
+ const chain = this._chainMap.get(chainKey);
118
+ const props = this._chainSideProperties.get(chainKey);
119
+ const iterator = nodeIndexes !== null ? nodeIndexes : chain.keys();
121
120
  for (const i of iterator) {
122
-
123
- result.push(callback(chain[i], i, chain, probs));
121
+ const node = callback(chain[i], i, chain, props);
122
+ if (node !== null) result.push(node);
124
123
  }
125
124
  }
126
125
 
127
126
 
128
127
  /**
129
- *
130
128
  * @param {*} chainKey
131
129
  * @param {*} textWriterObjs
132
130
  * @param {*} nodeKeys use nodeKeys on updateCoordinatesOnly
133
131
  */
134
132
  textUpdate(chainKey, textWriterObjs, nodeIndexes = null) {
135
- const chain = this.getChain(chainKey);
136
-
137
- if (nodeKeys) {
138
- textWriterObjs.forEach((v) => {
139
- const { coordsAdaptor, textAdaptor, writer } = v;
140
- for (const i in nodeIndexes) {
141
- const value = chain[i];
142
- const { long, lat } = coordsAdaptor(value, i, chain);
143
- const text = textAdaptor(value, i, chain);
144
- const opacity = opacityAdaptor(value, i, array);
145
-
146
- writer.insertText(
147
- keyMethod(chainKey, value.key),
148
- lat,
149
- long,
150
- text,
151
- opacity
152
- );
153
- }
133
+ const chain = this._chainMap.get(chainKey);
134
+ if (!chain) return;
135
+ const properties = this._chainSideProperties.get(chainKey);
136
+ if (nodeIndexes) {
137
+ textWriterObjs.forEach((writer) => {
138
+ nodeIndexes.forEach((i) => {
139
+ writer.insertText(chain[i], i, chain, properties);
140
+ });
154
141
  });
155
142
  return;
156
143
  }
157
-
158
- textWriterObjs.forEach((v) => {
159
- const { coordsAdaptor, textAdaptor, opacityAdaptor, writer } = v;
160
- chain.forEach((value, i, array) => {
161
- const { lat, long } = coordsAdaptor(value, i, array);
162
- const text = textAdaptor(value, i, array);
163
- const opacity = opacityAdaptor(value, i, array);
164
- writer.insertText(item.key, lat, long, text);
165
- });
144
+ textWriterObjs.forEach((writer) => {
145
+ const chain = this._chainMap.get(chainKey);
146
+ const properties = this._chainSideProperties.get(chainKey);
147
+ writer.insertTextBulk(chain, properties);
166
148
  });
167
149
 
168
150
  }
@@ -187,7 +169,7 @@ export class ChainListMap {
187
169
  }
188
170
 
189
171
  _resetIndexChain(chainKey) {
190
- const chain = this._chainMap.get(chain);
172
+ const chain = this._chainMap.get(chainKey);
191
173
  for (let i = 0; i < chain.length; i++) {
192
174
  const node = chain[i]
193
175
  this._indexMap.set(keyMethod(chainKey, node.key), i);
@@ -195,8 +177,12 @@ export class ChainListMap {
195
177
  }
196
178
 
197
179
  getNodeKeysOfChain(chainKey) {
198
- const chain = this._chainMap(chainKey);
199
- return chain.map((v) => keyMethod(chainKey, v.key));
180
+ const chain = this._chainMap.get(chainKey);
181
+ console.log("node keys", chain);
182
+ if (!chain) return [];
183
+ const result = chain.map((v) => keyMethod(chainKey, v.key));
184
+ console.log("buffer Keys", result);
185
+ return result
200
186
  }
201
187
 
202
188
 
@@ -1,33 +1,8 @@
1
- /**
2
- * import programs, buffer orchestrator
3
- *
4
- *
5
- * import dext managers
6
- *
7
- * Entities:
8
- * AcircleLine
9
- * - circle
10
- * - line
11
- *
12
- * Chain
13
- user data
14
- [ {
15
- chainKey: "Magrib",
16
- nodes: new Map([
17
- [ "Tanca", {long, lat, to:"Cebelitarik"}],
18
- [ "Cebelitarik", {long, lat, to: null}]
19
- ])
20
- }]
21
- implicitly add from keyword for simplicity;
22
- * # Mouse interations
23
- */
24
-
25
1
  import { LineOnGlobeCache } from '../programs/line-on-globe/naive';
26
2
  import { CircleCache } from '../programs/line-on-globe/circle';
27
- import { BufferOrchestrator } from "../util/account";
3
+ import { BufferOrchestrator, BufferManager } from "../util/account";
28
4
  import { ChainListMap } from "./chain-list-map";
29
5
  import { keyMethod } from "./util";
30
- import { buffer } from 'three/tsl';
31
6
 
32
7
  // TODO: Add update buffer and update text mehods on add, delete, update methods
33
8
 
@@ -38,19 +13,25 @@ import { buffer } from 'three/tsl';
38
13
  * ask chain list map for text data
39
14
  * ask chain list map for buffer data
40
15
  *
16
+ *
17
+ * addNode
18
+ * insertBulk
19
+ * deleteChain
20
+ * deleteNodes
21
+ * updateCoordinates()
22
+ * updateChainProperties
41
23
  */
42
24
 
43
25
  const radian = Math.PI / 180;
44
26
 
45
27
  export class CircleLineChainPlugin {
46
28
 
47
- constructor(id, { textContextInjectionMap = new Map() } = {}) {
29
+ constructor(id, { textContextWriterInjectionMap = new Map() } = {}) {
48
30
  this.id = id;
49
- this._textContextInjectionMap = textContextInjectionMap;
31
+ this._textContextWriterInjectionMap = textContextWriterInjectionMap;
50
32
  this._opacity = 1;
51
33
  this._chainListMap = new ChainListMap();
52
34
  this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
53
- this._chainListMap
54
35
  }
55
36
 
56
37
  // init
@@ -63,6 +44,7 @@ export class CircleLineChainPlugin {
63
44
 
64
45
 
65
46
  _initOrchestrations() {
47
+ const { gl, globe } = this;
66
48
  this.lineProgram = LineOnGlobeCache.get(globe);
67
49
  this.circleProgram = CircleCache.get(globe);
68
50
  {
@@ -87,10 +69,6 @@ export class CircleLineChainPlugin {
87
69
  'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
88
70
  'adaptor': (item) => new Float32Array([item.bigRadius])
89
71
  }],
90
- ["rgbaMode", {
91
- 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
92
- 'adaptor': (item) => new Float32Array([item.rgbaMode])
93
- }],
94
72
  ["dashRatio", {
95
73
  'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
96
74
  'adaptor': (item) => new Float32Array([item.dashRatio])
@@ -107,6 +85,9 @@ export class CircleLineChainPlugin {
107
85
  ]
108
86
  );
109
87
  // (startPotisionBufferObj, endPositionBufferObj, dashRatioBufferObj, colorBufferObj)
88
+ const obj = function (bufferManagerComp) {
89
+ return { 'buffer': bufferManagerComp.bufferManager.buffer, 'stride': 0, 'offset': 0 }
90
+ };
110
91
  this.lineVao = this.lineProgram.createVAO(
111
92
  ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
112
93
  this.circleVao = this.circleProgram.createVAO(
@@ -131,14 +112,33 @@ export class CircleLineChainPlugin {
131
112
  * @property {number} long
132
113
  * @property {number} lat
133
114
  */
134
- updateCoordinatesBulk(data, textWriterInjectionSubSetIDs = []) {
115
+ updateCoordinatesBulk(data, { textWriterIDs = [] } = {}) {
135
116
  // update implicit data structure
136
117
  // find keys to update.. (inserted data and the radius of "from")
137
118
  // updateBuffers
138
119
  // update text
120
+ const chainKeys = [];
121
+ for (const chain of data) {
122
+ chainKeys.push(chain.chainKey);
123
+ chain.nodes.forEach((node) => {
124
+ this._chainListMap.updateNode(node, chain.chainKey);
125
+ });
126
+ }
127
+ this._reconstructChains(chainKeys);
128
+ this._insertTexts(chainKeys, textWriterIDs);
139
129
  }
140
130
 
141
131
 
132
+ /**
133
+ *
134
+ * @param {*} chainKey
135
+ * @param {Map<propertyName ,value} propertyMap
136
+ */
137
+ updateChainProperties(chainKey, propertyMap, { textWriterIDs = [] } = {}) {
138
+ this._chainListMap.updateChainProperties(chainKey, propertyMap);
139
+ this._reconstructChains([chainKey]);
140
+ if (textWriterIDs) this._insertTexts([chainKey], textWriterIDs);
141
+ }
142
142
 
143
143
  // ---- insertBulk family
144
144
  /**
@@ -157,7 +157,7 @@ export class CircleLineChainPlugin {
157
157
  * @property {number} long
158
158
  * @property {number} lat
159
159
  */
160
- insertBulk(data) {
160
+ insertBulk(data, { textWriterIDs = [] } = []) {
161
161
  // first insert everything to implicit structure,
162
162
  // then iterate over data again to update text
163
163
  // let _reconstractChainBufferData method interact with data and bufferOrchestrator.
@@ -165,39 +165,36 @@ export class CircleLineChainPlugin {
165
165
 
166
166
  for (const { chainKey, rgba, dashOpacity, dashRatio, circleDashAngle, nodes } of data) {
167
167
  this._chainListMap.setChain(chainKey, nodes);
168
- this._chainListMap.setChainInfo(chainKey, {
169
- rgba, dashOpacity, dashRatio, circleDashAngle
168
+ this._chainListMap.setChainProperties(chainKey, {
169
+ rgba, dashOpacity, dashRatio, circleDashAngle, chainKey
170
170
  });
171
171
  chainKeysToConstruct.push(chainKey);
172
172
  }
173
173
  this._reconstructChains(chainKeysToConstruct);
174
+ if (textWriterIDs) this._insertTexts(chainKeysToConstruct, textWriterIDs);
174
175
  }
175
176
 
176
177
  /**
177
178
  *
179
+ * @param {{key, long, lat}} node
178
180
  * @param {*} chainKey
179
- * @param {*} key // node key
180
- * @param {*} long
181
- * @param {*} lat
182
181
  * @param {*} theNodeKeyFront | node key of the next node, null places to the last
183
182
  */
184
- addNode(chainKey, key, long, lat, theNodeKeyFront = null) {
183
+ addNode(node, chainKey, { theNodeKeyFront = null, textContextIDs = [] } = {}) {
185
184
  // TODO: if before object is null update the last two elements of the chain only.
186
- this._chainListMap.addNode({ lat, long, key }, chainKey, theNodeKeyFront);
185
+ console.log("addNode", node, chainKey, theNodeKeyFront);
186
+ this._chainListMap.addNode(node, chainKey, theNodeKeyFront);
187
+ if (textContextIDs) this._insertTexts([chainKey], textContextIDs);
187
188
  this._reconstructChains([chainKey]);
188
189
 
189
190
  }
190
191
 
191
192
 
192
193
 
193
- updateNodeCoordinates(node, chainKey, textContextIDs) {
194
+ updateNodeCoordinates(node, chainKey, { textContextIDs = [] } = {}) {
194
195
  this._chainListMap.updateNode(node, chainKey);
195
-
196
- {
197
- const textContexts = textContextIDs.map(v => this._textContextInjectionMap.get(v));
198
- this._chainListMap.textUpdate(chainKey, textContextIDs,)
199
- }
200
-
196
+ if (textContextIDs) this._insertTexts([chainKey], textContextIDs);
197
+ this._reconstructChains([chainKey]);
201
198
  }
202
199
 
203
200
 
@@ -214,71 +211,60 @@ export class CircleLineChainPlugin {
214
211
 
215
212
  /**
216
213
  *
217
- * @param {*} chainKey
218
- * @param {*} nodeKeys
214
+ * @param {*} chainKeys
219
215
  */
220
- deleteChain(chainKey) {
221
- const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey)
222
- this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap)
216
+ deleteChains(chainKeys) {
217
+ const bufferKeys = [];
218
+ for (const chainKey of chainKeys) {
219
+ bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey));
220
+ }
221
+ console.log("delete chain keys", chainKeys);
222
+ console.log("deletechains bufferKeys", bufferKeys);
223
+ this._insertTexts(chainKeys, this._textContextWriterInjectionMap.keys());
224
+ this._textContextWriterInjectionMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
225
+ this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
223
226
  }
224
227
 
225
228
 
226
229
  /**
227
230
  *
228
- * @param {Map<keys, [nodeKeys]} keysAndNodes
231
+ * @param {Array<{key, nodeKeys:[]} keysAndNodes
229
232
  */
230
233
  deleteNodes(keysAndNodes) {
231
234
  const bufferKeys = [];
232
235
  const chainKeysToReconstuct = [];
233
- keysAndNodes.forEach((nodeList, chainKey, m) => {
234
- bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey, nodeList));
236
+ keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
237
+ bufferKeys.push(...this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys));
235
238
  chainKeysToReconstuct.push(chainKey);
236
- })
239
+ });
237
240
  this._reconstructChains(chainKeysToReconstuct);
241
+ this._textContextWriterInjectionMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
238
242
  this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
239
243
  }
240
244
 
241
245
 
242
- deleteNode(chainKey, nodeKey) {
243
- this._chainListMap.deleteNode(chainKey, nodeKey);
244
-
245
- }
246
-
247
246
  // implicit
248
247
 
249
- _updateTextOpacityAll(items) {
250
- this._textContextInjectionMap.forEach((v) => {
251
- const { writer } = v
252
- for (const item of items) {
253
- if (item.rgba) {
254
- writer.updateOpacityOfItem(item.key, item.rgba[3])
255
- }
256
- }
257
- });
258
- }
259
-
260
-
261
- _insertTexts(item, textWriterInjectionSubSet) {
262
- //TODO This method can be more performant if it works horizontally, tabular
263
- textWriterInjectionSubSet.forEach((v) => {
264
- const { coordsAdaptor, textAdaptor, writer } = v
265
- const { lat, long } = coordsAdaptor(item);
266
- const text = textAdaptor(item);
267
- writer.insertText(item.key, lat, long, text);
268
- });
248
+ _insertTexts(chainKeys, textWriterIDs) {
249
+ const textWriters = textWriterIDs.map((v) => this._textContextWriterInjectionMap.get(v));
250
+ chainKeys.forEach((chainKey) => {
251
+ this._chainListMap.textUpdate(chainKey, textWriters);
252
+ })
269
253
  }
270
254
 
271
255
 
272
256
 
273
257
  _reconstructChains(chainKeys) {
274
- const { globe } = globe;
258
+ const { globe } = this;
275
259
  // this.lineVao = this.lineProgram.createVAO(
276
260
  // ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
277
261
  // this.circleVao = this.circleProgram.createVAO(
278
262
  // ...["centerCoords", "bigRadius", "rgba", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
279
- // }
263
+ // }
264
+
280
265
  const radiusM = radiusMethod(globe);
281
266
  const callback = (v, i, array, probs) => {
267
+ if (i == array.length - 1) return null;
282
268
  return {
283
269
  rgba: probs.rgba,
284
270
  bigRadius: radiusM(v, i, array),
@@ -303,6 +289,7 @@ export class CircleLineChainPlugin {
303
289
 
304
290
  _insertBulk(bulkData) {
305
291
  this.bufferOrchestrator.insertBulk(bulkData, this.bufferManagersCompMap);
292
+ this.globe.DrawRender();
306
293
  }
307
294
 
308
295
 
@@ -315,17 +302,23 @@ export class CircleLineChainPlugin {
315
302
  })
316
303
  LineOnGlobeCache.release(this.globe);
317
304
  CircleCache.release(this.globe);
305
+ this.lineProgram = null;
306
+ this.circleProgram = null;
318
307
  this.isFreed = true;
319
308
  }
320
309
 
321
310
  draw3D() {
322
311
  const { gl } = this;
312
+ gl.disable(gl.DEPTH_TEST);
323
313
  this.lineProgram.draw(this.lineVao, this.bufferOrchestrator.length, this._opacity);
314
+ this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this._opacity);
315
+ this._textContextWriterInjectionMap.forEach((writer) => writer.draw());
316
+ gl.enable(gl.DEPTH_TEST);
324
317
  }
325
318
  }
326
319
 
327
320
 
328
321
 
329
322
  const radiusMethod = (globe) => (v, i, array) => {
330
- return globe.Math.GetDist2D(v.long, v.lat, array[i + 1].endLong, array[i + 1].endLat)
323
+ return globe.Math.GetDist3D(v.long, v.lat, array[i + 1].long, array[i + 1].lat)
331
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.3.9",
3
+ "version": "0.4.0a",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -39,6 +39,7 @@ export default class {
39
39
 
40
40
  setOneDegreePaddingOn(oneDegreePadding) {
41
41
  this._onedegreepaddingOn = oneDegreePadding;
42
+ this.globe.DrawRender();
42
43
  }
43
44
 
44
45
  init(globe, gl) {
@@ -20,6 +20,9 @@ export class ContextTextWriter {
20
20
  this.itemMap = new Map();
21
21
  this.style = style || defaultStyle;
22
22
  this.doDraw = doDraw;
23
+
24
+
25
+
23
26
  }
24
27
 
25
28
 
@@ -35,6 +38,7 @@ export class ContextTextWriter {
35
38
  this.style.opacity = opacity;
36
39
  }
37
40
 
41
+ // Clean this ask Front dev
38
42
  doDraw(boolean) {
39
43
  this.doDraw = boolean;
40
44
  }
@@ -60,6 +64,8 @@ export class ContextTextWriter {
60
64
  }
61
65
 
62
66
 
67
+
68
+
63
69
  insertText(key, lat, long, text,) { // TODO: Make it more generic
64
70
  this.itemMap.set(key, { lat, long, text });
65
71
  }
@@ -0,0 +1,128 @@
1
+ import { CSZMode } from "@pirireis/webglobe";
2
+
3
+ const defaultStyle = {
4
+ textFont: {
5
+ name: 'Arial',
6
+ textColor: '#FFFFFF', // beyaz
7
+ hollowColor: '#000000', // siyah
8
+ size: 12, // piksel
9
+ hollow: true,
10
+ bold: true,
11
+ italic: false,
12
+ },
13
+ opacity: 1.0,
14
+ zMode: CSZMode.Z_GROUND_PERVERTEX,
15
+ }
16
+
17
+ export class ContextTextWriter2 {
18
+ constructor(globe, { style = null, doDraw = true, textAdaptor = null, coordinatesAdaptor = null, keyAdaptor = null, opacityAdaptor = null } = {}) {
19
+ this.globe = globe;
20
+ this.itemMap = new Map();
21
+ this.style = style || defaultStyle;
22
+ this.doDraw = doDraw;
23
+
24
+
25
+ this.textAdaptor = textAdaptor;
26
+ this.coordinatesAdaptor = coordinatesAdaptor;
27
+ this.keyAdaptor = keyAdaptor;
28
+ if (opacityAdaptor) {
29
+ this.opacityAdaptor = opacityAdaptor
30
+ } else {
31
+ this.opacityAdaptor = () => 1;
32
+ }
33
+ }
34
+
35
+
36
+ setDoDraw(bool) {
37
+ this.doDraw = bool;
38
+ }
39
+
40
+ setStyle(style) {
41
+ this.style = style;
42
+ }
43
+
44
+ setOpacity(opacity) {
45
+ this.style.opacity = opacity;
46
+ }
47
+
48
+
49
+
50
+ draw() {
51
+ if (!this.doDraw) return;
52
+ const { globe, style, itemMap } = this;
53
+ const { textFont, opacity: opacity_ } = style;
54
+
55
+ for (const [key, { lat, long, text, opacity = null }] of itemMap) {
56
+ const { x, y } = globe.api_GetScreenPointFromGeo(
57
+ {
58
+ long: long,
59
+ lat: lat,
60
+ z: 0,
61
+ },
62
+ style.zMode === CSZMode.Z_MSL,
63
+ );
64
+ const o = opacity === null ? opacity_ : opacity * opacity_;
65
+ if (x !== null && y !== null) globe.api_DrawContextTextMultiLine(text, textFont, o, { x, y });
66
+ }
67
+ }
68
+
69
+
70
+ updateOpacityOfItem(item, i, container, properties) {
71
+ const opacity = this.opacityAdaptor(item, i, container, properties);
72
+ if (opacity == null) return;
73
+ const key = this.keyAdaptor(item, i, container, properties);
74
+ const data = this.itemMap.get(key)
75
+ data.opacity = opacity;
76
+ }
77
+
78
+ updateOpacityContainer(container, properties) {
79
+ container.forEach((v, i, c) => {
80
+ this.updateOpacityOfItem(v, i, c, properties);
81
+ })
82
+ }
83
+
84
+
85
+ insertTextBulk(container, properties) {
86
+ container.forEach((v, i, c) => {
87
+ this.insertText(v, i, c, properties);
88
+ })
89
+ }
90
+
91
+ updateTextCoords(item, i, container, properties) {
92
+ const coords = this.coordinatesAdaptor(item, i, container, properties);
93
+ if (coords == null) return;
94
+ const key = this.keyAdaptor(item, i, container, properties);
95
+ const data = this.itemMap.get(key)
96
+ data.long = coords.long;
97
+ data.lat = coords.lat;
98
+ }
99
+
100
+ updateTextCoordsBulk(container, properties) {
101
+ container.forEach((v, i, c) => {
102
+ this.updateTextCoords(v, i, c, properties)
103
+ })
104
+ }
105
+
106
+ deleteTextBulk(keys) {
107
+ for (const key of keys) {
108
+ this.itemMap.delete(key);
109
+ }
110
+ }
111
+
112
+
113
+ insertText(item, id, container, properties) {
114
+ const coords = this.coordinatesAdaptor(item, id, container, properties)
115
+ if (coords == null) return;
116
+ const text = this.textAdaptor(item, id, container, properties)
117
+ if (text == null) return;
118
+ const opacity = this.opacityAdaptor(item, id, container, properties);
119
+ const key = this.keyAdaptor(item, id, container, properties)
120
+ this.itemMap.set(key, { long: coords.long, lat: coords.lat, text, opacity });
121
+ }
122
+
123
+ clear() {
124
+ this.itemMap.clear();
125
+ }
126
+ }
127
+
128
+
File without changes
File without changes
File without changes