@pirireis/webglobeplugins 0.3.4 → 0.3.5
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/bearing-line/plugin.js +28 -15
- package/package.json +1 -1
package/bearing-line/plugin.js
CHANGED
|
@@ -146,9 +146,10 @@ export default class Plugin {
|
|
|
146
146
|
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
147
147
|
'adaptor': (item) => new Float32Array([item.dashOpacity])
|
|
148
148
|
}],
|
|
149
|
-
["
|
|
149
|
+
["circleDashAngle", {
|
|
150
|
+
|
|
150
151
|
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
151
|
-
'adaptor': (item) => new Float32Array([item.
|
|
152
|
+
'adaptor': (item) => new Float32Array([item.circleDashAngle / 360])
|
|
152
153
|
}]
|
|
153
154
|
]
|
|
154
155
|
);
|
|
@@ -174,7 +175,7 @@ export default class Plugin {
|
|
|
174
175
|
}
|
|
175
176
|
// centerObj, startAngleObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj
|
|
176
177
|
this.circleVao = this.circleProgram.createVAO(
|
|
177
|
-
...["centerCoords", "startAngle", "bigRadius", "rgba", "
|
|
178
|
+
...["centerCoords", "startAngle", "bigRadius", "rgba", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
|
|
@@ -215,11 +216,9 @@ export default class Plugin {
|
|
|
215
216
|
* @property {number} dashRatio 0-1
|
|
216
217
|
* @property {number} dashOpacity 0-1
|
|
217
218
|
* @property {number} circleDashAngle 0-360
|
|
218
|
-
*
|
|
219
219
|
* @param {Array<item>} items
|
|
220
220
|
* @param {Array<string>} injectionsSubSetIDs | textContextInjectionMap keys to be used for writing text.
|
|
221
221
|
*/
|
|
222
|
-
|
|
223
222
|
insertBulk(items, injectionsSubSetIDs = []) {
|
|
224
223
|
const { globe, bufferOrchestrator, bufferManagersCompMap } = this;// angleTextContext, distanceTextContext,
|
|
225
224
|
const injectionsSubSet = injectionsSubSetIDs.map((id) => this._textContextInjectionMap.get(id));
|
|
@@ -237,7 +236,6 @@ export default class Plugin {
|
|
|
237
236
|
|
|
238
237
|
deleteBulk(keys) {
|
|
239
238
|
this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap, ["radius", "centerCoords", "targetCoords", "rgba"]);
|
|
240
|
-
|
|
241
239
|
this._deleteTexts(keys);
|
|
242
240
|
this.globe.DrawRender();
|
|
243
241
|
}
|
|
@@ -245,16 +243,15 @@ export default class Plugin {
|
|
|
245
243
|
|
|
246
244
|
defrag() {
|
|
247
245
|
this.bufferOrchestrator.defrag(this.bufferManagersCompMap);
|
|
248
|
-
// this.globe.DrawRender();
|
|
249
246
|
}
|
|
250
247
|
|
|
251
248
|
/**
|
|
252
249
|
*
|
|
253
250
|
* @param {Array<{key, long, lat, endLong, endLat, bearingAngle}>} items
|
|
254
|
-
* @param {Array<string>}
|
|
251
|
+
* @param {Array<string>} textWriterInjectionSubSetIDs | textContextInjectionMap keys to be used for writing text.
|
|
255
252
|
*/
|
|
256
|
-
updateCoordinatesBulk(items,
|
|
257
|
-
const injectionsSubSet =
|
|
253
|
+
updateCoordinatesBulk(items, textWriterInjectionSubSetIDs = []) { //TODO
|
|
254
|
+
const injectionsSubSet = textWriterInjectionSubSetIDs.map((id) => this._textContextInjectionMap.get(id));
|
|
258
255
|
const { globe, bufferOrchestrator, bufferManagersCompMap, angleTextContext, distanceTextContext } = this;
|
|
259
256
|
const data = []
|
|
260
257
|
for (let item of items) {
|
|
@@ -267,6 +264,22 @@ export default class Plugin {
|
|
|
267
264
|
}
|
|
268
265
|
|
|
269
266
|
|
|
267
|
+
/**
|
|
268
|
+
*
|
|
269
|
+
* @param {*} items some colums EXCEPT positional ones
|
|
270
|
+
* @param {*} propertyIDs
|
|
271
|
+
* @param {*} textWriterInjectionSubSetIDs
|
|
272
|
+
* Do NOT send empty data if property ID of this data is entered or NaN is loaded to the buffer, resulting in an unwanted behaviour.
|
|
273
|
+
*/
|
|
274
|
+
updatePartial(items, propertyIDs = [], textWriterInjectionSubSetIDs = []) {
|
|
275
|
+
if (propertyIDs.length === 0) console.warn("updatePartial is called with no target propertyIDs");
|
|
276
|
+
const { _textContextInjectionMap, bufferOrchestrator, bufferManagersCompMap } = this;
|
|
277
|
+
const writers = textWriterInjectionSubSetIDs.map((x) => _textContextInjectionMap.get(x));
|
|
278
|
+
for (let item of items) { this._insertTexts(item, writers) }
|
|
279
|
+
bufferOrchestrator.updateBulk(items, bufferManagersCompMap, propertyIDs);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
|
|
270
283
|
__insertAdaptor(item) {
|
|
271
284
|
const lat = radian(item.lat)
|
|
272
285
|
const long = radian(item.long)
|
|
@@ -276,7 +289,7 @@ export default class Plugin {
|
|
|
276
289
|
const rgbaMode = item.rgbaMode !== undefined ? item.rgbaMode : 0;
|
|
277
290
|
const dashRatio = item.dashRatio !== undefined ? item.dashRatio : 1.0;
|
|
278
291
|
const dashOpacity = item.dashOpacity !== undefined ? item.dashOpacity : 0.9;
|
|
279
|
-
const
|
|
292
|
+
const circleDashAngle = item.circleDashAngle !== undefined ? item.circleDashAngle : 360;
|
|
280
293
|
const bigRadius = item.bigRadius !== undefined ? item.bigRadius : this.globe.Math.GetDist3D(item.long, item.lat, item.endLong, item.endLat);
|
|
281
294
|
const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
|
|
282
295
|
const startAngle = calculateStartAngle(long, lat, endLong, endLat);
|
|
@@ -299,7 +312,7 @@ export default class Plugin {
|
|
|
299
312
|
rgba,
|
|
300
313
|
dashRatio,
|
|
301
314
|
dashOpacity,
|
|
302
|
-
|
|
315
|
+
circleDashAngle,
|
|
303
316
|
rgbaMode
|
|
304
317
|
};
|
|
305
318
|
}
|
|
@@ -309,7 +322,6 @@ export default class Plugin {
|
|
|
309
322
|
const long = radian(item.long)
|
|
310
323
|
const endLat = radian(item.endLat)
|
|
311
324
|
const endLong = radian(item.endLong)
|
|
312
|
-
|
|
313
325
|
const bigRadius = item.bigRadius !== undefined ? item.bigRadius : this.globe.Math.GetDist3D(item.long, item.lat, item.endLong, item.endLat);
|
|
314
326
|
const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
|
|
315
327
|
const startAngle = calculateStartAngle(long, lat, endLong, endLat);
|
|
@@ -348,8 +360,9 @@ export default class Plugin {
|
|
|
348
360
|
|
|
349
361
|
|
|
350
362
|
|
|
351
|
-
_insertTexts(item,
|
|
352
|
-
|
|
363
|
+
_insertTexts(item, textWriterInjectionSubSet) {
|
|
364
|
+
//TODO This method can be more performant if it works horizontally, tabular
|
|
365
|
+
textWriterInjectionSubSet.forEach((v) => {
|
|
353
366
|
const { coordsAdaptor, textAdaptor, writer } = v
|
|
354
367
|
const { lat, long } = coordsAdaptor(item);
|
|
355
368
|
const text = textAdaptor(item);
|