@pirireis/webglobeplugins 0.9.10 → 0.9.12

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/Math/methods.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.globe2Dcoordinates = exports.globe3Dcoordinates = exports.pixelXYLenghtToUnitVectorWithHeight = exports.wgs84ToMercator = exports.wgs84ToCartesian3d = exports.wgs84ToUnitVector = exports.sphericalLinearInterpolation_Cartesian3d = exports.sphericalLinearInterpolation_Mercator = exports.sphericalLinearInterpolation_UnitVector = exports.radianToCartesian3d = exports.radianToMercator = exports.cartesian3dToRadian = exports.length3 = exports.dot3 = exports.normalize3 = exports.RADIANS = void 0;
4
- const constants_ts_1 = require("./constants.ts");
4
+ const constants_1 = require("./constants");
5
5
  /**
6
6
  * @typedef {Array<number>} vec3 [x, y, z]
7
7
  * @typedef {Array<number>} vec2 [x, y]
@@ -62,7 +62,7 @@ exports.cartesian3dToRadian = cartesian3dToRadian;
62
62
  * @returns {vec2} long lat in mercator meters
63
63
  */
64
64
  const radianToMercator = (xy) => {
65
- return [constants_ts_1.WORLD_RADIUS_MERCATOR * xy[0], constants_ts_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
65
+ return [constants_1.WORLD_RADIUS_MERCATOR * xy[0], constants_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
66
66
  };
67
67
  exports.radianToMercator = radianToMercator;
68
68
  /**
@@ -147,7 +147,7 @@ const wgs84ToCartesian3d = (long, lat, height) => {
147
147
  const x = Math.cos(latRad) * Math.cos(longRad);
148
148
  const y = Math.cos(latRad) * Math.sin(longRad);
149
149
  const z = Math.sin(latRad);
150
- const radius = constants_ts_1.WORLD_RADIUS_3D + height;
150
+ const radius = constants_1.WORLD_RADIUS_3D + height;
151
151
  return [x * radius, y * radius, z * radius];
152
152
  };
153
153
  exports.wgs84ToCartesian3d = wgs84ToCartesian3d;
@@ -157,7 +157,7 @@ exports.wgs84ToCartesian3d = wgs84ToCartesian3d;
157
157
  * @returns {vec2} mercator
158
158
  */
159
159
  const wgs84ToMercator = (long, lat) => {
160
- return [constants_ts_1.WORLD_RADIUS_MERCATOR * long * RADIANS, constants_ts_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + lat * RADIANS / 2))];
160
+ return [constants_1.WORLD_RADIUS_MERCATOR * long * RADIANS, constants_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + lat * RADIANS / 2))];
161
161
  };
162
162
  exports.wgs84ToMercator = wgs84ToMercator;
163
163
  /**
@@ -171,7 +171,7 @@ const pixelXYToRadians = (pixelXY) => {
171
171
  };
172
172
  const pixelXYLenghtToUnitVectorWithHeight = (pixelXYHeight) => {
173
173
  const [long, lat] = pixelXYToRadians(pixelXYHeight);
174
- const radius = constants_ts_1.WORLD_RADIUS_3D + pixelXYHeight[2];
174
+ const radius = constants_1.WORLD_RADIUS_3D + pixelXYHeight[2];
175
175
  return radianToCartesian3d([long, lat]).concat(radius);
176
176
  };
177
177
  exports.pixelXYLenghtToUnitVectorWithHeight = pixelXYLenghtToUnitVectorWithHeight;
@@ -283,7 +283,7 @@ class PointGlowLineToEarthPlugin {
283
283
  const { _pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper } = this;
284
284
  [_pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper].forEach((item) => {
285
285
  const { vao, ubo } = item;
286
- ubo === null || ubo === void 0 ? void 0 : ubo.free();
286
+ ubo?.free();
287
287
  this.gl.deleteVertexArray(vao);
288
288
  });
289
289
  pickable_renderer_js_1.PickableRendererProgramCache.release(this.globe);
@@ -218,14 +218,13 @@ class BearingLinePlugin {
218
218
  };
219
219
  }
220
220
  __updateCoordsAdaptor(item) {
221
- var _a, _b;
222
221
  const { globe } = this;
223
222
  const lat = radian(item.lat);
224
223
  const long = radian(item.long);
225
224
  const endLat = radian(item.endLat);
226
225
  const endLong = radian(item.endLong);
227
- const altitude = ((_a = item.altitude) !== null && _a !== void 0 ? _a : 0) / 1000;
228
- const bigRadius = (_b = item.bigRadius) !== null && _b !== void 0 ? _b : globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
226
+ const altitude = (item.altitude ?? 0) / 1000;
227
+ const bigRadius = item.bigRadius ?? globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
229
228
  const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
230
229
  const { long: bearingLong, lat: bearingLat } = globe.Math.FindPointByPolar(item.long, item.lat, bigRadius, item.bearingAngle);
231
230
  const startAngle2d = calculateStartAngle(long, lat, endLong, endLat);
@@ -261,8 +261,7 @@ class CircleLineChainPlugin {
261
261
  ["rgba", {
262
262
  'bufferManager': new account_1.BufferManager(gl, 4, { bufferType, initialCapacity }),
263
263
  'adaptor': (item) => {
264
- var _a;
265
- if ((_a = item.lineProperties) === null || _a === void 0 ? void 0 : _a.rgba)
264
+ if (item.lineProperties?.rgba)
266
265
  return new Float32Array(item.lineProperties.rgba);
267
266
  return new Float32Array(item.chainProperties.rgba);
268
267
  }
@@ -282,8 +281,7 @@ class CircleLineChainPlugin {
282
281
  ["circleDashAngle", {
283
282
  'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
284
283
  'adaptor': (item) => {
285
- var _a;
286
- if ((_a = item.circleProperties) === null || _a === void 0 ? void 0 : _a.circleDashAngle)
284
+ if (item.circleProperties?.circleDashAngle)
287
285
  return new Float32Array([item.circleProperties.circleDashAngle / 360]);
288
286
  return new Float32Array([item.chainProperties.circleDashAngle / 360]);
289
287
  }
@@ -291,8 +289,7 @@ class CircleLineChainPlugin {
291
289
  ["rgbaCircle", {
292
290
  "bufferManager": new account_1.BufferManager(gl, 4, { bufferType, initialCapacity }),
293
291
  "adaptor": (item) => {
294
- var _a;
295
- if ((_a = item.circleProperties) === null || _a === void 0 ? void 0 : _a.rgba)
292
+ if (item.circleProperties?.rgba)
296
293
  return new Float32Array(item.circleProperties.rgba);
297
294
  return new Float32Array(item.chainProperties.rgba);
298
295
  }
@@ -301,8 +298,7 @@ class CircleLineChainPlugin {
301
298
  ["circleDashAngleMercator", {
302
299
  'bufferManager': new account_1.BufferManager(gl, 1 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
303
300
  'adaptor': (item) => {
304
- var _a;
305
- if ((_a = item.circleProperties) === null || _a === void 0 ? void 0 : _a.circleDashAngle)
301
+ if (item.circleProperties?.circleDashAngle)
306
302
  return new Float32Array([item.circleProperties.circleDashAngle / 360]);
307
303
  return data_filler_1.populateFloat32Array.fillFloat32Array(_circleFlatEdgeCount, item.chainProperties.circleDashAngle / 360);
308
304
  }
@@ -310,8 +306,7 @@ class CircleLineChainPlugin {
310
306
  ["rgbaCircleMercator", {
311
307
  "bufferManager": new account_1.BufferManager(gl, 4 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
312
308
  "adaptor": (item) => {
313
- var _a;
314
- if ((_a = item.circleProperties) === null || _a === void 0 ? void 0 : _a.rgba)
309
+ if (item.circleProperties?.rgba)
315
310
  return data_filler_1.populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.circleProperties.rgba);
316
311
  return data_filler_1.populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.chainProperties.rgba);
317
312
  }
@@ -346,11 +341,10 @@ class CircleLineChainPlugin {
346
341
  const { globe } = this;
347
342
  // const radiusM = radiusMethod(globe);
348
343
  const callback = (v, i, array, chainProperties) => {
349
- var _a, _b;
350
344
  if (i === array.length - 1)
351
345
  return null;
352
346
  const centerCoords2dflat = (0, circle_accurate_flat_1.centerCoords2dflatDataCreator)(globe, v.long, v.lat, array[i + 1].long, array[i + 1].lat, { edgeCount: this._circleFlatEdgeCount });
353
- const altitude = ((_b = (_a = v.altitude) !== null && _a !== void 0 ? _a : chainProperties.altitude) !== null && _b !== void 0 ? _b : 0) / 1000;
347
+ const altitude = (v.altitude ?? chainProperties.altitude ?? 0) / 1000;
354
348
  return {
355
349
  chainProperties: chainProperties,
356
350
  // bigRadius: radiusM(v, i, array),
@@ -75,9 +75,8 @@ class PixelPaddingCompassPlugin {
75
75
  this.globe.DrawRender();
76
76
  }
77
77
  setOpacity(opacity) {
78
- var _a;
79
78
  this._opacity = opacity;
80
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.setOpacity(opacity);
79
+ this.writer?.setOpacity(opacity);
81
80
  this.globe.DrawRender();
82
81
  }
83
82
  getTextWriter() {
@@ -118,8 +117,7 @@ class PixelPaddingCompassPlugin {
118
117
  this.writer = new compass_text_writer_1.PixelPaddingCompassTextWriter(this.globe, { angle: PaddingAngle, ...this._font_hold });
119
118
  }
120
119
  resize() {
121
- var _a;
122
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.resize();
120
+ this.writer?.resize();
123
121
  }
124
122
  __insertText(key, x, y, { properties, update = false } = {}) {
125
123
  if (!this.writer)
@@ -140,7 +138,6 @@ class PixelPaddingCompassPlugin {
140
138
  }
141
139
  // Globe API interface methods
142
140
  draw2D() {
143
- var _a;
144
141
  const { gl, globe, paddingProgram, paddingVao, bufferOrchestrator, bufferManagersCompMap } = this;
145
142
  const is3D = globe.api_GetCurrentGeometry() === 0;
146
143
  if (is3D)
@@ -156,7 +153,7 @@ class PixelPaddingCompassPlugin {
156
153
  gl.disable(gl.DEPTH_TEST);
157
154
  paddingProgram.draw(paddingVao, bufferOrchestrator.length, this._opacity);
158
155
  gl.enable(gl.DEPTH_TEST);
159
- (_a = this.writer) === null || _a === void 0 ? void 0 : _a.draw();
156
+ this.writer?.draw();
160
157
  }
161
158
  free() {
162
159
  this.compassMap.free();
@@ -213,7 +210,7 @@ class CompassMap {
213
210
  lat: v[1],
214
211
  z: 0,
215
212
  });
216
- writer === null || writer === void 0 ? void 0 : writer.insertTextItem(k, x, y);
213
+ writer?.insertTextItem(k, x, y);
217
214
  if (x !== null) {
218
215
  const properties = { ...defaultProperties, ...propertyMemory.get(k) };
219
216
  result.push({ key: k, x, y, properties });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -75,26 +75,22 @@ class PointTracksPlugin {
75
75
  this._vao = this._pointProgram.createVAO(this._bufferManagersMap.get("pos3D").bufferManager.buffer, this._bufferManagersMap.get("pos2D").bufferManager.buffer, this._bufferManagersMap.get("rgba").bufferManager.buffer);
76
76
  }
77
77
  setPointSize(size) {
78
- var _a;
79
78
  this.pointSizes.pointSize = size;
80
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
79
+ this.globe?.DrawRender();
81
80
  }
82
81
  setSelectionPointFilling(size) {
83
- var _a;
84
82
  this.pointSizes.selectionPointFilling = size;
85
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
83
+ this.globe?.DrawRender();
86
84
  }
87
85
  setHoveredPointSize(size) {
88
- var _a;
89
86
  this.pointSizes.hoveredPointSize = size;
90
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
87
+ this.globe?.DrawRender();
91
88
  }
92
89
  setOpacity(opacity) {
93
- var _a;
94
90
  if (opacity < 0 || opacity > 1)
95
91
  return;
96
92
  this._opacity = opacity;
97
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
93
+ this.globe?.DrawRender();
98
94
  }
99
95
  getCurrentSelection() {
100
96
  return this._selectedObj;
@@ -135,7 +131,6 @@ class PointTracksPlugin {
135
131
  * @returns
136
132
  */
137
133
  insertBulk(tracks) {
138
- var _a;
139
134
  this._fillTracksToPointsMap(tracks); // TODO error should be at the top
140
135
  const flattenedPoints = tracks.map(trackToFlatPoints).flat();
141
136
  const currentLoad = this._bufferOrchestrator.length;
@@ -145,22 +140,20 @@ class PointTracksPlugin {
145
140
  const { _bufferManagersMap, _bufferOrchestrator } = this;
146
141
  _bufferOrchestrator.insertBulk(flattenedPoints, _bufferManagersMap);
147
142
  this._refillFocus();
148
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
143
+ this.globe?.DrawRender();
149
144
  }
150
145
  flush() {
151
- var _a, _b;
152
146
  const capacity = 100;
153
- (_a = this._bufferOrchestrator) === null || _a === void 0 ? void 0 : _a.flush({ capacity });
147
+ this._bufferOrchestrator?.flush({ capacity });
154
148
  this._bufferManagersMap.forEach(({ bufferManager }) => bufferManager.resetWithCapacity(capacity));
155
149
  this._turnOffFocus();
156
150
  this._tracksToPointsMap.clear();
157
- (_b = this.globe) === null || _b === void 0 ? void 0 : _b.DrawRender();
151
+ this.globe?.DrawRender();
158
152
  }
159
153
  /**
160
154
  * @param {string} trackID
161
155
  */
162
156
  deleteTrack(trackID) {
163
- var _a;
164
157
  const pointSet = this._tracksToPointsMap.get(trackID);
165
158
  const points = Array.from(pointSet);
166
159
  const { _bufferOrchestrator, _bufferManagersMap } = this;
@@ -168,27 +161,25 @@ class PointTracksPlugin {
168
161
  this._tracksToPointsMap.delete(trackID);
169
162
  this._redraw = true;
170
163
  this._refillFocus();
171
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
164
+ this.globe?.DrawRender();
172
165
  }
173
166
  /**
174
167
  * @param {string} trackID
175
168
  * @param {Array<string>} pointIDs
176
169
  */
177
170
  deletePoints(trackID, pointIDs) {
178
- var _a;
179
171
  const { _bufferOrchestrator, _bufferManagersMap } = this;
180
172
  _bufferOrchestrator.deleteBulk(pointIDs.map((pointID) => keyMethod(trackID, pointID)), _bufferManagersMap);
181
173
  this._deletePointsFromTracksMap(trackID, pointIDs);
182
174
  this._refillFocus();
183
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
175
+ this.globe?.DrawRender();
184
176
  }
185
177
  focusTracks(trackIDs = null) {
186
- var _a;
187
178
  if (!this.globe)
188
179
  return;
189
180
  if (!trackIDs) {
190
181
  this._focusParams.on = false;
191
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
182
+ this.globe?.DrawRender();
192
183
  return;
193
184
  }
194
185
  this._focusParams.on = this._fillElementBuffer(trackIDs);
@@ -234,7 +225,6 @@ class PointTracksPlugin {
234
225
  this._selfSelect();
235
226
  }
236
227
  resize() {
237
- var _a;
238
228
  const w = this.globe.api_ScrW();
239
229
  const h = this.globe.api_ScrH();
240
230
  if (w === this._lastWH.w && h === this._lastWH.h)
@@ -242,7 +232,7 @@ class PointTracksPlugin {
242
232
  this._lastWH.w = w;
243
233
  this._lastWH.h = h;
244
234
  this._pickerDisplayer.resize();
245
- (_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
235
+ this.globe?.DrawRender();
246
236
  }
247
237
  // IMPLICIT METHODS
248
238
  _fillTracksToPointsMap(tracks) {
@@ -95,13 +95,18 @@ console.log("LineStripProgram");
95
95
  console.log(vertexShaderSource);
96
96
  console.log(fragmentShaderSource);
97
97
  class Logic {
98
+ _vaosPublished = [];
99
+ _ubosPublished = [];
100
+ program;
101
+ gl;
102
+ globe;
103
+ cameraBlockTotem;
104
+ _defaultFlexibleUBO;
105
+ _opacity = {
106
+ value: 1,
107
+ location: null
108
+ };
98
109
  constructor(globe) {
99
- this._vaosPublished = [];
100
- this._ubosPublished = [];
101
- this._opacity = {
102
- value: 1,
103
- location: null
104
- };
105
110
  console.log("LineStripProgram globe", globe);
106
111
  this.gl = globe.gl;
107
112
  this.globe = globe;
@@ -97,9 +97,9 @@ void main() {
97
97
  }
98
98
  `;
99
99
  class Logic {
100
+ vaosPublished = [];
101
+ isFreed = false;
100
102
  constructor(globe) {
101
- this.vaosPublished = [];
102
- this.isFreed = false;
103
103
  this.globe = globe;
104
104
  this.gl = globe.gl;
105
105
  this.program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
@@ -97,7 +97,6 @@ class RangeRings {
97
97
  * 2. update centers
98
98
  * 3. update buffer orchestators
99
99
  */
100
- var _a;
101
100
  this._ringAccount.updateCentersCoordinate(items);
102
101
  const { globe, bufferOrchestrator, bufferManagersCompMap, paddingBufferOrchestrator, bufferManagersCompMapPadding } = this;
103
102
  for (const { centerID } of items) {
@@ -106,7 +105,7 @@ class RangeRings {
106
105
  const paddingDatas = this.__reconstructCentralRingsBigPaddings(centerID);
107
106
  paddingBufferOrchestrator.updateBulk(paddingDatas, bufferManagersCompMapPadding, ["circlePoint2d", "paddingPoint2d", "circlePoint3d", "paddingPoint3d"]);
108
107
  }
109
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.updateCentersXY(items);
108
+ this.paddingTextPlugin?.updateCentersXY(items);
110
109
  this.__contextTextWriterUpdate(items.map(({ centerID }) => centerID), textWriterIDs);
111
110
  globe.DrawRender();
112
111
  }
@@ -115,7 +114,6 @@ class RangeRings {
115
114
  * @param { Array < RangeRingsItem> } items
116
115
  */
117
116
  insertBulk(items, { textWriterIDs = [] } = {}) {
118
- var _a;
119
117
  // Algorithm
120
118
  /**
121
119
  * 1 ask centerRingAccount for existing rings
@@ -141,7 +139,7 @@ class RangeRings {
141
139
  const paddingDatas = this.__reconstructCentralRingsBigPaddings(item.centerID);
142
140
  paddingBufferOrchestrator.insertBulk(paddingDatas, bufferManagersCompMapPadding);
143
141
  }
144
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.insertBulk(items);
142
+ this.paddingTextPlugin?.insertBulk(items);
145
143
  this.__contextTextWriterUpdate(items.map(({ centerID }) => centerID), textWriterIDs);
146
144
  globe.DrawRender();
147
145
  }
@@ -171,7 +169,6 @@ class RangeRings {
171
169
  * @method updateCentersHide @param { Array < { centerID, hide, textHide } >} centerHides
172
170
  */
173
171
  updateCentersHide(centerHides, { textWriterIDs = [] } = {}) {
174
- var _a;
175
172
  // Algorithm
176
173
  /**
177
174
  * Simple
@@ -189,7 +186,7 @@ class RangeRings {
189
186
  const paddingDatas = this.__reconstructCentralPaddingProperties(centerID);
190
187
  paddingBufferOrchestrator.updateBulk(paddingDatas, bufferManagersCompMapPadding, ["rgba"]);
191
188
  }
192
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.updateCentersHide(centerHides);
189
+ this.paddingTextPlugin?.updateCentersHide(centerHides);
193
190
  this.__contextTextWriterUpdate(centerHides.map(({ centerID }) => centerID), textWriterIDs);
194
191
  globe.DrawRender();
195
192
  /**
@@ -224,7 +221,6 @@ class RangeRings {
224
221
  * @method removeCenters @param { Array < { centerID } >} centerIDs
225
222
  */
226
223
  removeCenters(centerIDs) {
227
- var _a;
228
224
  const { globe, bufferOrchestrator, bufferManagersCompMap, paddingBufferOrchestrator, bufferManagersCompMapPadding, _ringAccount } = this;
229
225
  for (const centerID of centerIDs) {
230
226
  const existingKeys = _ringAccount.ringKeys(centerID);
@@ -239,7 +235,7 @@ class RangeRings {
239
235
  paddingBufferOrchestrator.deleteBulk(paddingKeys, bufferManagersCompMapPadding);
240
236
  }
241
237
  }
242
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.removeCenters(centerIDs);
238
+ this.paddingTextPlugin?.removeCenters(centerIDs);
243
239
  this._ringAccount.removeCenters(centerIDs);
244
240
  globe.DrawRender();
245
241
  }
@@ -247,10 +243,9 @@ class RangeRings {
247
243
  * @method setOpacity @param { number } opacity
248
244
  */
249
245
  setOpacity(opacity) {
250
- var _a;
251
246
  (0, typecheck_1.opacityCheck)(opacity);
252
247
  this._opacity = opacity;
253
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.setOpacity(opacity);
248
+ this.paddingTextPlugin?.setOpacity(opacity);
254
249
  this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
255
250
  this.globe.DrawRender();
256
251
  }
@@ -516,7 +511,6 @@ class RangeRings {
516
511
  gl.enable(gl.DEPTH_TEST);
517
512
  }
518
513
  free() {
519
- var _a;
520
514
  if (this._isFreed)
521
515
  return;
522
516
  const { globe } = this;
@@ -539,7 +533,7 @@ class RangeRings {
539
533
  this._padding2dProgram = null;
540
534
  this._padding3dProgram = null;
541
535
  this._lineOnGlobe_bigPadding = null;
542
- (_a = this.paddingTextPlugin) === null || _a === void 0 ? void 0 : _a.free();
536
+ this.paddingTextPlugin?.free();
543
537
  this._isFreed = true;
544
538
  }
545
539
  __contextTextWriterUpdate(centerIDs, textWriterIDs = null) {
@@ -72,11 +72,10 @@ class TimeTrackMultiColorPlugin {
72
72
  // --- user methods ---
73
73
  // ----------------------------------
74
74
  setHeadAndTailTime(headTime, tailTime) {
75
- var _a;
76
75
  this._headTime = headTime;
77
76
  this._tailTime = tailTime;
78
77
  // console.log("setHeadAndTailTime", headTime, tailTime);
79
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.setHeadTime(headTime);
78
+ this.pointProgram?.setHeadTime(headTime);
80
79
  this.globe.DrawRender();
81
80
  }
82
81
  setBlurWeights(weights) {
@@ -166,7 +165,6 @@ class TimeTrackMultiColorPlugin {
166
165
  * @param {number} totalSize | if not provided, it is calculated from float32Array.length / 9. Use if you want to draw first n points.
167
166
  */
168
167
  setDataAsFloat32Array(data, totalSize = null) {
169
- var _a;
170
168
  const { gl, _attrBuffer } = this;
171
169
  gl.bindBuffer(gl.ARRAY_BUFFER, _attrBuffer);
172
170
  gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
@@ -180,18 +178,17 @@ class TimeTrackMultiColorPlugin {
180
178
  this._totalSize = data.length / 9;
181
179
  }
182
180
  this.program.setTotalLength(this._totalSize);
183
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.setDrawCount(this._totalSize / 2);
181
+ this.pointProgram?.setDrawCount(this._totalSize / 2);
184
182
  this._ready = true;
185
183
  }
186
184
  // ------------------------------
187
185
  // --- globe Methods ---
188
186
  // ------------------------------
189
187
  draw3D(projMatrix, modelviewMatrix, transPos) {
190
- var _a;
191
188
  if (!this._ready)
192
189
  return;
193
190
  const { _headTime, _tailTime, program, _transporArr, globe } = this;
194
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.draw();
191
+ this.pointProgram?.draw();
195
192
  _transporArr.set([transPos.x, transPos.y, transPos.z], 0);
196
193
  const geomType = globe.api_GetCurrentGeometry();
197
194
  if (geomType === 0) {
@@ -212,12 +209,11 @@ class TimeTrackMultiColorPlugin {
212
209
  program.resize(width, height);
213
210
  }
214
211
  init(globe, gl) {
215
- var _a;
216
212
  this.globe = globe;
217
213
  this.gl = gl;
218
214
  this._attrBuffer = gl.createBuffer();
219
215
  this.program = new program_line_strip_1.default(gl, this._attrBuffer, globe.api_ScrW(), globe.api_ScrH(), this._options);
220
- if ((_a = this._pointOptions) === null || _a === void 0 ? void 0 : _a.isOn)
216
+ if (this._pointOptions?.isOn)
221
217
  this.pointProgram = new programpoint_line_strip_1.default(gl, globe, this._attrBuffer);
222
218
  // this.pointProgram.setAttrBuffer(_attrBuffer);
223
219
  this.setGeometry();
@@ -69,10 +69,9 @@ class TimeTrackMultiColorPlugin {
69
69
  // --- user methods ---
70
70
  // ----------------------------------
71
71
  setHeadAndTailTime(headTime, tailTime) {
72
- var _a;
73
72
  this._headTime = headTime;
74
73
  this._tailTime = tailTime;
75
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.setHeadTime(headTime);
74
+ this.pointProgram?.setHeadTime(headTime);
76
75
  this.globe.DrawRender();
77
76
  }
78
77
  setGlow(isGlow) {
@@ -174,7 +173,6 @@ class TimeTrackMultiColorPlugin {
174
173
  * @param {number} totalSize | if not provided, it is calculated from float32Array.length / 9. Use if you want to draw first n points.
175
174
  */
176
175
  setDataAsFloat32Array(data, totalSize = null) {
177
- var _a;
178
176
  const { gl, _attrBuffer } = this;
179
177
  gl.bindBuffer(gl.ARRAY_BUFFER, _attrBuffer);
180
178
  gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
@@ -188,18 +186,17 @@ class TimeTrackMultiColorPlugin {
188
186
  this._totalSize = data.length / 9;
189
187
  }
190
188
  this.program.setTotalLength(this._totalSize);
191
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.setDrawCount(this._totalSize / 2);
189
+ this.pointProgram?.setDrawCount(this._totalSize / 2);
192
190
  this._ready = true;
193
191
  }
194
192
  // ------------------------------
195
193
  // --- globe Methods ---
196
194
  // ------------------------------
197
195
  draw3D(projMatrix, modelviewMatrix, transPos) {
198
- var _a;
199
196
  if (!this._ready)
200
197
  return;
201
198
  const { _headTime, _tailTime, program, _transporArr, globe } = this;
202
- (_a = this.pointProgram) === null || _a === void 0 ? void 0 : _a.draw();
199
+ this.pointProgram?.draw();
203
200
  _transporArr.set([transPos.x, transPos.y, transPos.z], 0);
204
201
  const geomType = globe.api_GetCurrentGeometry();
205
202
  if (geomType === 0) {
@@ -220,12 +217,11 @@ class TimeTrackMultiColorPlugin {
220
217
  program.resize(width, height);
221
218
  }
222
219
  init(globe, gl) {
223
- var _a;
224
220
  this.globe = globe;
225
221
  this.gl = gl;
226
222
  this._attrBuffer = gl.createBuffer();
227
223
  this.program = new program_1.default(gl, this._attrBuffer, globe.api_ScrW(), globe.api_ScrH(), this._options);
228
- if ((_a = this._pointOptions) === null || _a === void 0 ? void 0 : _a.isOn)
224
+ if (this._pointOptions?.isOn)
229
225
  this.pointProgram = new programpoint_1.default(gl, globe, this._attrBuffer);
230
226
  // this.pointProgram.setAttrBuffer(_attrBuffer);
231
227
  this.setGeometry();
@@ -20,8 +20,12 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.BufferManager = void 0;
22
22
  class BufferManager {
23
+ gl;
24
+ buffer;
25
+ itemSize;
26
+ bufferType;
27
+ isFreed = false;
23
28
  constructor(gl, itemSize, { bufferType = "STATIC_DRAW", buffer = null, initialCapacity = null } = {}) {
24
- this.isFreed = false;
25
29
  this.gl = gl;
26
30
  this.itemSize = itemSize;
27
31
  this.bufferType = bufferType;
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BufferOrchestrator = void 0;
4
4
  const EXTRA_SIZE = 10;
5
5
  class BufferOrchestrator {
6
+ _capacity;
7
+ offsetMap;
8
+ tombstoneOffsets;
9
+ _length;
6
10
  constructor({ capacity = 10 } = {}) {
7
11
  this._capacity = capacity;
8
12
  this.offsetMap = new Map();
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectStore = void 0;
4
4
  class ObjectStore {
5
+ _container;
5
6
  constructor({ initialCapcity = 10 } = {}) {
6
7
  this._container = this._createEmptyList(initialCapcity);
7
8
  }
@@ -6,11 +6,10 @@ require("./types");
6
6
  * Draws instanced geometry using WebGL2.
7
7
  */
8
8
  const drawInstanced = (gl, mode, drawOptions, vertexCount) => {
9
- var _a;
10
9
  const { drawRange, elementBufferIndexType = gl.UNSIGNED_INT } = drawOptions;
11
10
  const { first = 0, count: instanceCount = 1 } = drawRange;
12
11
  if (first > 0 || drawOptions.elementBuffer) {
13
- gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, (_a = drawOptions.elementBuffer) !== null && _a !== void 0 ? _a : null);
12
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, drawOptions.elementBuffer ?? null);
14
13
  gl.drawElementsInstanced(mode, vertexCount, elementBufferIndexType, first, instanceCount);
15
14
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
16
15
  }
@@ -25,7 +24,7 @@ exports.drawInstanced = drawInstanced;
25
24
  const drawArrays = (gl, defaultMode, drawOptions) => {
26
25
  const { drawRange, elementBuffer, elementBufferIndexType = gl.UNSIGNED_INT, drawMode = null } = drawOptions;
27
26
  const { first = 0, count } = drawRange;
28
- const mode = drawMode !== null && drawMode !== void 0 ? drawMode : defaultMode;
27
+ const mode = drawMode ?? defaultMode;
29
28
  if (elementBuffer) {
30
29
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, elementBuffer);
31
30
  gl.drawElements(mode, count, elementBufferIndexType, first);
@@ -45,6 +45,18 @@ const typeArrayConstructors = {
45
45
  'bool': Float32Array
46
46
  };
47
47
  class UniformBlockManager {
48
+ /**
49
+ *
50
+ * @param {UniformBlockName} blockName
51
+ * @param {Array<UniformBlockMember} blockMembers
52
+ * @param {string} prefix usage name of block in the shader
53
+ */
54
+ blockName;
55
+ blockMembers;
56
+ bindingPoint;
57
+ prefix;
58
+ offsetMap;
59
+ size;
48
60
  constructor(blockName, blockMembers, bindingPoint, prefix = "") {
49
61
  this.blockName = blockName;
50
62
  this.blockMembers = blockMembers;