@pirireis/webglobeplugins 0.3.9 → 0.4.1-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,26 @@ 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;
32
+ this._textContextWriterInjectionMap.forEach((writer) => writer.keyAdaptor = (v, i, c, probs) => keyMethod(probs.chainKey, v.key));
50
33
  this._opacity = 1;
51
34
  this._chainListMap = new ChainListMap();
52
35
  this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
53
- this._chainListMap
54
36
  }
55
37
 
56
38
  // init
@@ -63,6 +45,7 @@ export class CircleLineChainPlugin {
63
45
 
64
46
 
65
47
  _initOrchestrations() {
48
+ const { gl, globe } = this;
66
49
  this.lineProgram = LineOnGlobeCache.get(globe);
67
50
  this.circleProgram = CircleCache.get(globe);
68
51
  {
@@ -87,10 +70,6 @@ export class CircleLineChainPlugin {
87
70
  'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
88
71
  'adaptor': (item) => new Float32Array([item.bigRadius])
89
72
  }],
90
- ["rgbaMode", {
91
- 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
92
- 'adaptor': (item) => new Float32Array([item.rgbaMode])
93
- }],
94
73
  ["dashRatio", {
95
74
  'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
96
75
  'adaptor': (item) => new Float32Array([item.dashRatio])
@@ -107,6 +86,9 @@ export class CircleLineChainPlugin {
107
86
  ]
108
87
  );
109
88
  // (startPotisionBufferObj, endPositionBufferObj, dashRatioBufferObj, colorBufferObj)
89
+ const obj = function (bufferManagerComp) {
90
+ return { 'buffer': bufferManagerComp.bufferManager.buffer, 'stride': 0, 'offset': 0 }
91
+ };
110
92
  this.lineVao = this.lineProgram.createVAO(
111
93
  ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
112
94
  this.circleVao = this.circleProgram.createVAO(
@@ -131,14 +113,33 @@ export class CircleLineChainPlugin {
131
113
  * @property {number} long
132
114
  * @property {number} lat
133
115
  */
134
- updateCoordinatesBulk(data, textWriterInjectionSubSetIDs = []) {
116
+ updateCoordinatesBulk(data, { textWriterIDs = [] } = {}) {
135
117
  // update implicit data structure
136
118
  // find keys to update.. (inserted data and the radius of "from")
137
119
  // updateBuffers
138
120
  // update text
121
+ const chainKeys = [];
122
+ for (const chain of data) {
123
+ chainKeys.push(chain.chainKey);
124
+ chain.nodes.forEach((node) => {
125
+ this._chainListMap.updateNode(node, chain.chainKey);
126
+ });
127
+ }
128
+ this._reconstructChains(chainKeys);
129
+ this._insertTexts(chainKeys, textWriterIDs);
139
130
  }
140
131
 
141
132
 
133
+ /**
134
+ *
135
+ * @param {*} chainKey
136
+ * @param {Map<propertyName ,value} propertyMap
137
+ */
138
+ updateChainProperties(chainKey, propertyMap, { textWriterIDs = [] } = {}) {
139
+ this._chainListMap.updateChainProperties(chainKey, propertyMap);
140
+ this._reconstructChains([chainKey]);
141
+ if (textWriterIDs) this._insertTexts([chainKey], textWriterIDs);
142
+ }
142
143
 
143
144
  // ---- insertBulk family
144
145
  /**
@@ -157,7 +158,7 @@ export class CircleLineChainPlugin {
157
158
  * @property {number} long
158
159
  * @property {number} lat
159
160
  */
160
- insertBulk(data) {
161
+ insertBulk(data, { textWriterIDs = [] } = []) {
161
162
  // first insert everything to implicit structure,
162
163
  // then iterate over data again to update text
163
164
  // let _reconstractChainBufferData method interact with data and bufferOrchestrator.
@@ -165,39 +166,36 @@ export class CircleLineChainPlugin {
165
166
 
166
167
  for (const { chainKey, rgba, dashOpacity, dashRatio, circleDashAngle, nodes } of data) {
167
168
  this._chainListMap.setChain(chainKey, nodes);
168
- this._chainListMap.setChainInfo(chainKey, {
169
- rgba, dashOpacity, dashRatio, circleDashAngle
169
+ this._chainListMap.setChainProperties(chainKey, {
170
+ rgba, dashOpacity, dashRatio, circleDashAngle, chainKey
170
171
  });
171
172
  chainKeysToConstruct.push(chainKey);
172
173
  }
173
174
  this._reconstructChains(chainKeysToConstruct);
175
+ if (textWriterIDs) this._insertTexts(chainKeysToConstruct, textWriterIDs);
174
176
  }
175
177
 
176
178
  /**
177
179
  *
180
+ * @param {{key, long, lat}} node
178
181
  * @param {*} chainKey
179
- * @param {*} key // node key
180
- * @param {*} long
181
- * @param {*} lat
182
182
  * @param {*} theNodeKeyFront | node key of the next node, null places to the last
183
183
  */
184
- addNode(chainKey, key, long, lat, theNodeKeyFront = null) {
184
+ addNode(node, chainKey, { theNodeKeyFront = null, textContextIDs = [] } = {}) {
185
185
  // TODO: if before object is null update the last two elements of the chain only.
186
- this._chainListMap.addNode({ lat, long, key }, chainKey, theNodeKeyFront);
186
+ console.log("addNode", node, chainKey, theNodeKeyFront);
187
+ this._chainListMap.addNode(node, chainKey, theNodeKeyFront);
188
+ if (textContextIDs) this._insertTexts([chainKey], textContextIDs);
187
189
  this._reconstructChains([chainKey]);
188
190
 
189
191
  }
190
192
 
191
193
 
192
194
 
193
- updateNodeCoordinates(node, chainKey, textContextIDs) {
195
+ updateNodeCoordinates(node, chainKey, { textContextIDs = [] } = {}) {
194
196
  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
-
197
+ if (textContextIDs) this._insertTexts([chainKey], textContextIDs);
198
+ this._reconstructChains([chainKey]);
201
199
  }
202
200
 
203
201
 
@@ -214,71 +212,60 @@ export class CircleLineChainPlugin {
214
212
 
215
213
  /**
216
214
  *
217
- * @param {*} chainKey
218
- * @param {*} nodeKeys
215
+ * @param {*} chainKeys
219
216
  */
220
- deleteChain(chainKey) {
221
- const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey)
222
- this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap)
217
+ deleteChains(chainKeys) {
218
+ const bufferKeys = [];
219
+ for (const chainKey of chainKeys) {
220
+ bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey));
221
+ }
222
+ console.log("delete chain keys", chainKeys);
223
+ console.log("deletechains bufferKeys", bufferKeys);
224
+ this._insertTexts(chainKeys, this._textContextWriterInjectionMap.keys());
225
+ this._textContextWriterInjectionMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
226
+ this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
223
227
  }
224
228
 
225
229
 
226
230
  /**
227
231
  *
228
- * @param {Map<keys, [nodeKeys]} keysAndNodes
232
+ * @param {Array<{key, nodeKeys:[]} keysAndNodes
229
233
  */
230
234
  deleteNodes(keysAndNodes) {
231
235
  const bufferKeys = [];
232
236
  const chainKeysToReconstuct = [];
233
- keysAndNodes.forEach((nodeList, chainKey, m) => {
234
- bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey, nodeList));
237
+ keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
238
+ bufferKeys.push(...this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys));
235
239
  chainKeysToReconstuct.push(chainKey);
236
- })
240
+ });
237
241
  this._reconstructChains(chainKeysToReconstuct);
242
+ this._textContextWriterInjectionMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
238
243
  this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
239
244
  }
240
245
 
241
246
 
242
- deleteNode(chainKey, nodeKey) {
243
- this._chainListMap.deleteNode(chainKey, nodeKey);
244
-
245
- }
246
-
247
247
  // implicit
248
248
 
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
- });
249
+ _insertTexts(chainKeys, textWriterIDs) {
250
+ const textWriters = textWriterIDs.map((v) => this._textContextWriterInjectionMap.get(v));
251
+ chainKeys.forEach((chainKey) => {
252
+ this._chainListMap.textUpdate(chainKey, textWriters);
253
+ })
269
254
  }
270
255
 
271
256
 
272
257
 
273
258
  _reconstructChains(chainKeys) {
274
- const { globe } = globe;
259
+ const { globe } = this;
275
260
  // this.lineVao = this.lineProgram.createVAO(
276
261
  // ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
277
262
  // this.circleVao = this.circleProgram.createVAO(
278
263
  // ...["centerCoords", "bigRadius", "rgba", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
279
- // }
264
+ // }
265
+
280
266
  const radiusM = radiusMethod(globe);
281
267
  const callback = (v, i, array, probs) => {
268
+ if (i == array.length - 1) return null;
282
269
  return {
283
270
  rgba: probs.rgba,
284
271
  bigRadius: radiusM(v, i, array),
@@ -303,6 +290,7 @@ export class CircleLineChainPlugin {
303
290
 
304
291
  _insertBulk(bulkData) {
305
292
  this.bufferOrchestrator.insertBulk(bulkData, this.bufferManagersCompMap);
293
+ this.globe.DrawRender();
306
294
  }
307
295
 
308
296
 
@@ -315,17 +303,23 @@ export class CircleLineChainPlugin {
315
303
  })
316
304
  LineOnGlobeCache.release(this.globe);
317
305
  CircleCache.release(this.globe);
306
+ this.lineProgram = null;
307
+ this.circleProgram = null;
318
308
  this.isFreed = true;
319
309
  }
320
310
 
321
311
  draw3D() {
322
312
  const { gl } = this;
313
+ gl.disable(gl.DEPTH_TEST);
323
314
  this.lineProgram.draw(this.lineVao, this.bufferOrchestrator.length, this._opacity);
315
+ this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this._opacity);
316
+ this._textContextWriterInjectionMap.forEach((writer) => writer.draw());
317
+ gl.enable(gl.DEPTH_TEST);
324
318
  }
325
319
  }
326
320
 
327
321
 
328
322
 
329
323
  const radiusMethod = (globe) => (v, i, array) => {
330
- return globe.Math.GetDist2D(v.long, v.lat, array[i + 1].endLong, array[i + 1].endLat)
324
+ return globe.Math.GetDist3D(v.long, v.lat, array[i + 1].long, array[i + 1].lat)
331
325
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.3.9",
3
+ "version": "0.4.1-a",
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