@pirireis/webglobeplugins 0.15.2-3.alpha → 0.15.3-alpha

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.
Files changed (45) hide show
  1. package/Math/arc-generate-points copy.js +366 -0
  2. package/Math/arc.js +2 -1
  3. package/Math/circle-cdf-points.js +170 -1
  4. package/Math/circle.js +25 -0
  5. package/Math/globe-util/horizon-plane.js +112 -0
  6. package/Math/methods.js +2 -2
  7. package/Math/vec3.js +2 -6
  8. package/altitude-locator/draw-subset-obj.js +16 -0
  9. package/altitude-locator/plugin.js +1 -1
  10. package/bearing-line/plugin.js +2 -3
  11. package/package.json +1 -1
  12. package/point-tracks/plugin.js +22 -82
  13. package/programs/line-on-globe/lines-color-instanced-flat.js +1 -0
  14. package/programs/line-on-globe/linestrip/linestrip.js +28 -2
  15. package/programs/line-on-globe/paddings/paddings.js +1 -0
  16. package/programs/point-on-globe/element-globe-surface-glow.js +1 -0
  17. package/programs/rings/partial-ring/piece-of-pie copy.js +286 -0
  18. package/programs/totems/camerauniformblock.js +0 -7
  19. package/programs/totems/canvas-webglobe-info.js +9 -9
  20. package/range-tools-on-terrain/bearing-line/adapters.js +5 -8
  21. package/range-tools-on-terrain/bearing-line/plugin.js +20 -95
  22. package/range-tools-on-terrain/circle-line-chain/adapters.js +8 -15
  23. package/range-tools-on-terrain/circle-line-chain/chain-list-map.js +12 -16
  24. package/range-tools-on-terrain/circle-line-chain/plugin.js +11 -67
  25. package/range-tools-on-terrain/range-ring/adapters.js +6 -74
  26. package/range-tools-on-terrain/range-ring/plugin.js +7 -222
  27. package/range-tools-on-terrain/range-ring/types.js +1 -9
  28. package/semiplugins/lightweight/line-plugin.js +47 -65
  29. package/semiplugins/lightweight/piece-of-pie-plugin.js +18 -44
  30. package/semiplugins/shape-on-terrain/arc-plugin.js +100 -197
  31. package/semiplugins/shape-on-terrain/circle-plugin.js +90 -209
  32. package/semiplugins/shape-on-terrain/derived/padding-plugin.js +101 -0
  33. package/semiplugins/shape-on-terrain/one-degree-padding.js +85 -0
  34. package/util/account/single-attribute-buffer-management/buffer-manager.js +0 -10
  35. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +8 -145
  36. package/util/account/single-attribute-buffer-management/object-store.js +0 -7
  37. package/util/build-strategy/static-dynamic.js +1 -11
  38. package/util/check/typecheck.js +0 -12
  39. package/util/geometry/index.js +1 -2
  40. package/programs/totems/globe-changes.js +0 -59
  41. package/semiplugins/interface.js +0 -1
  42. package/semiplugins/shape-on-terrain/padding-1-degree.js +0 -538
  43. package/util/account/single-attribute-buffer-management/buffer-orchestrator1.js +0 -159
  44. package/util/frame-counter-trigger.js +0 -84
  45. package/write-text/context-text4.js +0 -140
@@ -0,0 +1,286 @@
1
+ import { createProgram } from "../../../util/webglobjectbuilders";
2
+ import { CameraUniformBlockTotem, CameraUniformBlockString } from "../../totems/index";
3
+ import { noRegisterGlobeProgramCache, globeProgramCache } from "../../programcache";
4
+ import { POLE, PI, longLatRadToMercator, mercatorXYToGLPosition, longLatRadToCartesian3D, circleLimpFromLongLatRadCenterCartesian3D_accurate, circleLimpFromLongLatRadCenterMercatorCompass_accurate,
5
+ //circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
6
+ cartesian3DToGLPosition } from "../../../util/shaderfunctions/geometrytransformations";
7
+ /**
8
+ * TODO:
9
+ * 1. Triangle face looks at screen. if rotation angle is positive the last vertex must be the faintest.
10
+ *
11
+ */
12
+ const drawModeMap = Object.freeze({
13
+ LINE_STRIP: 0,
14
+ TRIANGLE_FAN: 1,
15
+ });
16
+ //${ circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate }
17
+ const vertexShaderSource = `#version 300 es
18
+
19
+ ${CameraUniformBlockString}
20
+ ${PI}
21
+ ${longLatRadToMercator}
22
+ ${mercatorXYToGLPosition}
23
+ ${longLatRadToCartesian3D}
24
+ ${circleLimpFromLongLatRadCenterCartesian3D_accurate}
25
+ ${circleLimpFromLongLatRadCenterMercatorCompass_accurate}
26
+ ${cartesian3DToGLPosition}
27
+
28
+ uniform float edge_count;
29
+ uniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN
30
+ uniform float plugin_alpha_multiplier;
31
+ //, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
32
+ // in vec2 center; // long, lat in radian
33
+ in vec2 center2d;
34
+ in vec3 center3d;
35
+ in float start_angle2d;
36
+ in float tail_angle2d;
37
+
38
+ in float start_angle3d;
39
+ in float tail_angle3d;
40
+
41
+ in vec4 color;
42
+ in float radius; // in meter
43
+ in float filling_mode; // 0.0: constant, 1.0: fading, 2.0: hide
44
+ // flat out int vid;
45
+ // flat out float v_phase;
46
+ out vec2 v_pos;
47
+ out vec4 v_color;
48
+ // flat out float v_angle;
49
+
50
+ void main() {
51
+ // vid = gl_VertexID;
52
+ if (filling_mode == 2.0 || radius == 0.0) { return; }
53
+ float start_angle, tail_angle;
54
+ if (is3D) {
55
+ start_angle = start_angle3d;
56
+ tail_angle = tail_angle3d;
57
+ } else {
58
+ start_angle = start_angle2d;
59
+ tail_angle = tail_angle2d;
60
+ }
61
+ float filling_mode_ = filling_mode;
62
+ if ( draw_mode == 0 && filling_mode == 1.0) {filling_mode_ = 0.0;}
63
+ float vertexID = float(gl_VertexID);
64
+ float radius_ = radius;
65
+ float alpha = plugin_alpha_multiplier;
66
+ if (draw_mode == 1) { // TRIANGLE_FAN
67
+ if (gl_VertexID == 0) {
68
+ radius_ = 0.0;
69
+ if ( filling_mode == 1.0 ) { alpha = 0.0; }
70
+ }
71
+ vertexID -= 1.0;
72
+ }
73
+ float phase = ( vertexID / (edge_count - 1.0) );
74
+ // v_angle = tail_angle;
75
+
76
+ if ( filling_mode_ == 1.0 ) {
77
+ if ( tail_angle < 0.0 ) {
78
+ v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );
79
+ } else {
80
+ v_color = vec4( color.rgb , color.a * phase * alpha );
81
+ }
82
+ } else {
83
+ v_color = vec4( color.rgb , color.a * alpha );
84
+ }
85
+ if ( filling_mode == 0.0 && draw_mode == 1 ) {
86
+ v_color.a /= 2.0;
87
+ }
88
+ float angle;
89
+ if ( tail_angle > 0.0 ) {
90
+ angle = tail_angle * (-phase + 1.0) + start_angle;
91
+ } else {
92
+ angle = tail_angle * phase + start_angle;
93
+ }
94
+ if (is3D) {
95
+ vec3 pos = circleLimpFromLongLatRadCenterCartesian3D_accurate(center3d, radius_, angle);
96
+ v_pos = vec2(0.0, 0.0);
97
+ gl_Position = cartesian3DToGLPosition(pos);
98
+ }
99
+ else {
100
+ vec2 pos2 = circleLimpFromLongLatRadCenterMercatorCompass_accurate(center2d, radius_, angle);
101
+ v_pos = pos2;
102
+ gl_Position = mercatorXYToGLPosition(pos2);
103
+ }
104
+
105
+ gl_PointSize = 10.0;
106
+ }`;
107
+ const fragmentShaderSource = `#version 300 es` + POLE + PI + `
108
+ precision highp float;
109
+ // flat in int vid;
110
+ in vec4 v_color;
111
+ in vec2 v_pos;
112
+ // flat in float v_phase;
113
+ // in float v_angle;
114
+ out vec4 outColor;
115
+ void main() {
116
+ // if( vid % 2 == 0 ) { discard; }
117
+ // if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }
118
+ // if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }
119
+ if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }
120
+ outColor = v_color;
121
+ }`;
122
+ export const ITEM_SIZE = 10;
123
+ export class Logic {
124
+ globe;
125
+ gl;
126
+ _lastMode;
127
+ _lastEdgeCount;
128
+ _lastAlphaMultiplier;
129
+ program;
130
+ _edgeCountLocation;
131
+ _draw_modeLocation;
132
+ _plugin_alpha_multiplierLocation;
133
+ cameraBlockBindingPoint;
134
+ cameraBlockTotem; // Type this based on your CameraUniformBlockTotem implementation
135
+ constructor(globe) {
136
+ this.globe = globe;
137
+ this.gl = globe.gl;
138
+ this._lastMode = 0;
139
+ this._lastEdgeCount = 64;
140
+ this._lastAlphaMultiplier = 1.0;
141
+ this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
142
+ const { gl, program } = this;
143
+ { // set attributes locations
144
+ gl.bindAttribLocation(program, 0, 'center2d');
145
+ gl.bindAttribLocation(program, 1, 'center3d');
146
+ gl.bindAttribLocation(program, 2, 'start_angle2d');
147
+ gl.bindAttribLocation(program, 3, 'tail_angle2d');
148
+ gl.bindAttribLocation(program, 4, 'start_angle3d');
149
+ gl.bindAttribLocation(program, 5, 'tail_angle3d');
150
+ gl.bindAttribLocation(program, 6, 'color');
151
+ gl.bindAttribLocation(program, 7, 'radius');
152
+ gl.bindAttribLocation(program, 8, 'filling_mode');
153
+ // vao
154
+ // instanced draw read 1
155
+ }
156
+ { // Uniforms
157
+ this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
158
+ this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
159
+ this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
160
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
161
+ gl.useProgram(program);
162
+ gl.uniform1i(this._draw_modeLocation, this._lastMode);
163
+ gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
164
+ gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
165
+ this.cameraBlockBindingPoint = 0;
166
+ this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
167
+ const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
168
+ gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
169
+ gl.useProgram(currentProgram);
170
+ }
171
+ }
172
+ draw(length, vao, edgeCount, alphaMultiplier, drawMode) {
173
+ const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
174
+ // gl.disable(gl.DEPTH_TEST);
175
+ gl.useProgram(program);
176
+ if (drawModeMap[drawMode] !== this._lastMode) {
177
+ gl.uniform1i(this._draw_modeLocation, drawModeMap[drawMode]);
178
+ this._lastMode = drawModeMap[drawMode];
179
+ }
180
+ if (edgeCount !== this._lastEdgeCount) {
181
+ gl.uniform1f(this._edgeCountLocation, edgeCount);
182
+ this._lastEdgeCount = edgeCount;
183
+ }
184
+ if (alphaMultiplier !== this._lastAlphaMultiplier) {
185
+ gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
186
+ this._lastAlphaMultiplier = alphaMultiplier;
187
+ }
188
+ const overdraw = drawModeMap[drawMode];
189
+ cameraBlockTotem.bind(cameraBlockBindingPoint);
190
+ gl.bindVertexArray(vao);
191
+ gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
192
+ cameraBlockTotem.unbind(cameraBlockBindingPoint);
193
+ gl.bindVertexArray(null);
194
+ // gl.enable(gl.DEPTH_TEST);
195
+ }
196
+ free() {
197
+ noRegisterGlobeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
198
+ this.gl.deleteProgram(this.program);
199
+ this.program = null;
200
+ }
201
+ /**
202
+ * in vec2 center; // long, lat in radian
203
+ in float start_angle; // the start of partial circle from bearing point
204
+ in float tail_angle; // the rotation of the partial circle
205
+ in vec4 color;
206
+ in float radius; // in meter
207
+ in float filling_mode; // 0.0: constant, 1.0: fading, 2.0: hide
208
+ */
209
+ createVAO(center2dObj, center3dObj, startAngle2DObj, tailAngle2DObj, startAngle3DObj, tailAngle3DObj, colorObj, radiusObj, colorModeObj) {
210
+ const { gl } = this;
211
+ const vao = gl.createVertexArray();
212
+ gl.bindVertexArray(vao);
213
+ {
214
+ const { buffer, stride, offset } = center2dObj;
215
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
216
+ gl.enableVertexAttribArray(0);
217
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
218
+ gl.vertexAttribDivisor(0, 1);
219
+ }
220
+ {
221
+ const { buffer, stride, offset } = center3dObj;
222
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
223
+ gl.enableVertexAttribArray(1);
224
+ gl.vertexAttribPointer(1, 3, gl.FLOAT, false, stride, offset);
225
+ gl.vertexAttribDivisor(1, 1);
226
+ }
227
+ {
228
+ const { buffer, stride, offset } = startAngle2DObj;
229
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
230
+ gl.enableVertexAttribArray(2);
231
+ gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
232
+ gl.vertexAttribDivisor(2, 1);
233
+ }
234
+ {
235
+ const { buffer, stride, offset } = tailAngle2DObj;
236
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
237
+ gl.enableVertexAttribArray(3);
238
+ gl.vertexAttribPointer(3, 1, gl.FLOAT, false, stride, offset);
239
+ gl.vertexAttribDivisor(3, 1);
240
+ }
241
+ {
242
+ const { buffer, stride, offset } = startAngle3DObj;
243
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
244
+ gl.enableVertexAttribArray(4);
245
+ gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
246
+ gl.vertexAttribDivisor(4, 1);
247
+ }
248
+ {
249
+ const { buffer, stride, offset } = tailAngle3DObj;
250
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
251
+ gl.enableVertexAttribArray(5);
252
+ gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
253
+ gl.vertexAttribDivisor(5, 1);
254
+ }
255
+ {
256
+ const { buffer, stride, offset } = colorObj;
257
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
258
+ gl.enableVertexAttribArray(6);
259
+ gl.vertexAttribPointer(6, 4, gl.FLOAT, false, stride, offset);
260
+ gl.vertexAttribDivisor(6, 1);
261
+ }
262
+ {
263
+ const { buffer, stride, offset } = radiusObj;
264
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
265
+ gl.enableVertexAttribArray(7);
266
+ gl.vertexAttribPointer(7, 1, gl.FLOAT, false, stride, offset);
267
+ gl.vertexAttribDivisor(7, 1);
268
+ }
269
+ {
270
+ const { buffer, stride, offset } = colorModeObj;
271
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
272
+ gl.enableVertexAttribArray(8);
273
+ gl.vertexAttribPointer(8, 1, gl.FLOAT, false, stride, offset);
274
+ gl.vertexAttribDivisor(8, 1);
275
+ }
276
+ gl.bindVertexArray(null);
277
+ gl.bindBuffer(gl.ARRAY_BUFFER, null);
278
+ return vao;
279
+ }
280
+ createUBO() {
281
+ }
282
+ }
283
+ export const PieceOfPieProgramCache = Object.freeze({
284
+ get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
285
+ release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
286
+ });
@@ -1,7 +1,6 @@
1
1
  import { globeProgramCache } from "../programcache";
2
2
  import { fromLongLatToUnitVector } from "../../Math/vec3";
3
3
  import { RADIANS } from "../../Math/methods";
4
- import { GlobeChangeObserver } from "./globe-changes";
5
4
  export const CameraUniformBlockString = `
6
5
  layout(std140) uniform CameraUniformBlock {
7
6
  mat4 view; // 64 bytes 0
@@ -30,7 +29,6 @@ export class CameraUniformBlockTotem {
30
29
  _isMovedParams;
31
30
  _normalizedCameraVector = [0, 0, 0]; // Normalized camera vector
32
31
  // _frustumPlanes: any; // Uncomment and type if used
33
- _globeChangeObserver = null;
34
32
  constructor() {
35
33
  this.id = "CameraUniformBlockTotem";
36
34
  this.description =
@@ -53,7 +51,6 @@ export class CameraUniformBlockTotem {
53
51
  this.ubo = this._createUBO();
54
52
  this.traslateFloat32 = new Float32Array(3);
55
53
  this.mapWHFloat32 = new Float32Array(2);
56
- this._globeChangeObserver = new GlobeChangeObserver(globe);
57
54
  this.setGeometry();
58
55
  this.resize();
59
56
  }
@@ -89,7 +86,6 @@ export class CameraUniformBlockTotem {
89
86
  const ubo = this.ubo;
90
87
  const mapWHFloat32 = this.mapWHFloat32;
91
88
  const globe = this.globe;
92
- this._globeChangeObserver?.checkChanges();
93
89
  gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
94
90
  {
95
91
  // view, projection, translate
@@ -200,9 +196,6 @@ export class CameraUniformBlockTotem {
200
196
  fromLongLatToUnitVector(result, [CenterLong * RADIANS, CenterLat * RADIANS]);
201
197
  return result;
202
198
  }
203
- getGlobeChanges() {
204
- return this._globeChangeObserver?.getChanges();
205
- }
206
199
  free() {
207
200
  const gl = this.gl;
208
201
  const ubo = this.ubo;
@@ -1,13 +1,13 @@
1
1
  import { globeProgramCache } from "../programcache";
2
- export const WebGlobeInfoUniformBlockString = `
3
- layout(std140) uniform WebGlobeInfo {
4
- vec2 canvas_resolution;
5
- vec2 mouse_radian_long_lat;
6
- vec2 mouse_pixel_xy;
7
- float north_angle;
8
- float world_tilt;
9
- float earth_distance;
10
- };
2
+ export const WebGlobeInfoUniformBlockString = `
3
+ layout(std140) uniform WebGlobeInfo {
4
+ vec2 canvas_resolution;
5
+ vec2 mouse_radian_long_lat;
6
+ vec2 mouse_pixel_xy;
7
+ float north_angle;
8
+ float world_tilt;
9
+ float earth_distance;
10
+ };
11
11
  `;
12
12
  export default class CanvasWebGlobeInfo {
13
13
  id;
@@ -18,7 +18,7 @@ export const flatLinesInputAdapter = (bearingLine) => {
18
18
  };
19
19
  };
20
20
  export const flatLinesBearingInputAdapter = (bearingLine) => {
21
- const { long, lat, rgba, key, bearingLat = 0, bearingLong = 0, msl } = bearingLine;
21
+ const { long, lat, rgba, key, bearingLat = 0, bearingLong = 0 } = bearingLine;
22
22
  return {
23
23
  key: key,
24
24
  start: [long, lat],
@@ -27,7 +27,7 @@ export const flatLinesBearingInputAdapter = (bearingLine) => {
27
27
  };
28
28
  };
29
29
  export const bearingLineToCircleInputAdapter = (globe) => (bearingLine) => {
30
- const { long, lat, endLong, endLat, rgba, altitude = 0, msl = null } = bearingLine;
30
+ const { long, lat, endLong, endLat, rgba, altitude = 0 } = bearingLine;
31
31
  if (bearingLine.radius === undefined || bearingLine.radius === null) {
32
32
  const radius = globe.Math.GetDist2D(long, lat, endLong, endLat);
33
33
  bearingLine.radius = radius;
@@ -38,22 +38,20 @@ export const bearingLineToCircleInputAdapter = (globe) => (bearingLine) => {
38
38
  radius: bearingLine.radius,
39
39
  height: altitude,
40
40
  color: rgba,
41
- msl
42
41
  };
43
42
  };
44
43
  export const bearingLineToArcInputAdapter = (bearingLine) => {
45
- const { long, lat, endLong, endLat, rgba, altitude = 0, msl } = bearingLine;
44
+ const { long, lat, endLong, endLat, rgba, altitude = 0 } = bearingLine;
46
45
  return {
47
46
  key: bearingLine.key,
48
47
  start: [long, lat],
49
48
  end: [endLong, endLat],
50
49
  height: altitude,
51
50
  color: rgba,
52
- msl: msl
53
51
  };
54
52
  };
55
53
  export const bearingLineToBearingArcInputAdapter = (globe, bearingLine) => {
56
- const { long, lat, bearingAngle, rgba, altitude = 0, key, msl } = bearingLine;
54
+ const { long, lat, bearingAngle, rgba, altitude = 0, key } = bearingLine;
57
55
  if (bearingLine.radius === undefined || bearingLine.radius === null) {
58
56
  throw new Error("Bearing line radius is not defined. Please calculate it before converting to ArcInput.");
59
57
  }
@@ -66,7 +64,6 @@ export const bearingLineToBearingArcInputAdapter = (globe, bearingLine) => {
66
64
  end: [endLong, endLat],
67
65
  height: altitude,
68
66
  color: rgba,
69
- msl,
70
67
  };
71
68
  };
72
69
  export const bearingLineToPieceOfPieInputAdapter = (globe, item) => {
@@ -74,7 +71,7 @@ export const bearingLineToPieceOfPieInputAdapter = (globe, item) => {
74
71
  const long = radian(item.long);
75
72
  const endLat = radian(item.endLat);
76
73
  const endLong = radian(item.endLong);
77
- const altitude = (item.altitude ?? 0);
74
+ const altitude = (item.altitude ?? 0) / 1000;
78
75
  const radius = item.radius ? item.radius * 0.2 : 10;
79
76
  // @ts-ignore
80
77
  const { long: bearingLong, lat: bearingLat } = globe.Math.FindPointByPolar(item.long, item.lat, item.radius, item.bearingAngle);
@@ -34,18 +34,13 @@ export class BearingLinePlugin {
34
34
  _memory = new Map();
35
35
  _semiPluginsOptions = {
36
36
  circleOnTerrainOptions: {
37
- defaultColor: [1, 1, 1, 0.5],
37
+ defaultColor: [0.1, 0.1, 1, 0.5],
38
38
  defaultHeightFromGroundIn3D: 30.0,
39
39
  variativeColorsOn: false,
40
- isMSL: false
41
40
  },
42
41
  arcOnTerrainOptions: {
43
42
  defaultHeightFromGroundIn3D: 30.0,
44
43
  variativeColorsOn: false,
45
- defaultColor: [1, 1, 1, 0.5],
46
- globeViewOn: true,
47
- flatViewOn: false,
48
- isMSL: false
49
44
  },
50
45
  lineOptions: {
51
46
  flatViewOn: true,
@@ -55,30 +50,11 @@ export class BearingLinePlugin {
55
50
  },
56
51
  pieceOfPieOptions: {
57
52
  defaultColor: [1, 1, 1, 0.5],
53
+ defaultHeightFromGroundIn3D: 30.0,
58
54
  variativeColorsOn: false,
59
- defaultHeightFromGroundIn3D: 1000.0,
60
55
  }
61
56
  };
62
- constructor(id, { textWritersMap, textDataPreAdaptor, opacities, drawOptions, circleOnTerrainOptions = {
63
- defaultColor: [1, 1, 1, 0.5],
64
- defaultHeightFromGroundIn3D: 30.0,
65
- variativeColorsOn: false,
66
- }, arcOnTerrainOptions = {
67
- globeViewOn: true,
68
- flatViewOn: false,
69
- defaultColor: [1, 1, 1, 0.5],
70
- defaultHeightFromGroundIn3D: 30.0,
71
- variativeColorsOn: false,
72
- }, lineOptions = {
73
- flatViewOn: true,
74
- globeViewOn: false,
75
- variativeColorsOn: false,
76
- defaultColor: [1, 1, 1, 0.5],
77
- }, pieceOfPieOptions = {
78
- defaultColor: [1, 1, 1, 0.5],
79
- variativeColorsOn: false,
80
- defaultHeightFromGroundIn3D: 1000.0,
81
- } } = {}) {
57
+ constructor(id, { textWritersMap, textDataPreAdaptor, opacities, drawOptions, } = {}) {
82
58
  this.id = id;
83
59
  if (!(textWritersMap instanceof Map))
84
60
  throw new Error("textWritersMap is not an instance of Map");
@@ -86,49 +62,28 @@ export class BearingLinePlugin {
86
62
  if (!(v instanceof ContextTextWriter3))
87
63
  throw new Error("textWritersMap element is not an instance of ContextTextWriter3");
88
64
  });
89
- if (circleOnTerrainOptions) {
90
- this._semiPluginsOptions.circleOnTerrainOptions = {
91
- ...this._semiPluginsOptions.circleOnTerrainOptions,
92
- ...circleOnTerrainOptions
93
- };
94
- }
95
- if (arcOnTerrainOptions) {
96
- this._semiPluginsOptions.arcOnTerrainOptions = {
97
- ...this._semiPluginsOptions.arcOnTerrainOptions,
98
- ...arcOnTerrainOptions
99
- };
100
- }
101
- if (lineOptions) {
102
- this._semiPluginsOptions.lineOptions = {
103
- ...this._semiPluginsOptions.lineOptions,
104
- ...lineOptions
105
- };
106
- }
107
- if (pieceOfPieOptions)
108
- this._semiPluginsOptions.pieceOfPieOptions = {
109
- ...this._semiPluginsOptions.pieceOfPieOptions,
110
- ...pieceOfPieOptions
111
- };
112
65
  this._textWritersMap = textWritersMap || new Map();
113
66
  this._textWritersMap.forEach((writer) => writer.setKeyAdaptor((item) => item.key));
114
67
  this._textDataPreAdaptor = textDataPreAdaptor || ((item) => item);
115
- this.circlePlugin = new CircleOnTerrainPlugin(id + "_circle", this._semiPluginsOptions.circleOnTerrainOptions);
68
+ this.circlePlugin = new CircleOnTerrainPlugin(id + "_circle", {
69
+ variativeColorsOn: true,
70
+ });
116
71
  this.arcPlugin = new ArcOnTerrainPlugin(id + "_arc", {
117
- ...this._semiPluginsOptions.arcOnTerrainOptions,
72
+ variativeColorsOn: true,
118
73
  });
119
74
  this.arcPluginBL = new ArcOnTerrainPlugin(id + "_arcBL", {
120
- ...this._semiPluginsOptions.arcOnTerrainOptions,
75
+ variativeColorsOn: true,
121
76
  });
122
77
  this.pieceOfPiePlugin = new PieceOfPiePlugin(id + "_pieceOfPie", {
123
78
  bufferType: "DYNAMIC_DRAW",
124
- ...this._semiPluginsOptions.pieceOfPieOptions
125
79
  });
126
80
  this.linePlugin = new LinePlugin(id + "_line", {
81
+ variativeColorsOn: true,
127
82
  bufferType: "DYNAMIC_DRAW",
128
- ...this._semiPluginsOptions.lineOptions
129
83
  });
130
84
  this.linePluginBL = new LinePlugin(id + "_lineBL", {
131
- ...this._semiPluginsOptions.lineOptions // flatViewOn: true,
85
+ variativeColorsOn: true,
86
+ bufferType: "DYNAMIC_DRAW",
132
87
  });
133
88
  if (opacities) {
134
89
  this._opacities = {
@@ -143,39 +98,6 @@ export class BearingLinePlugin {
143
98
  };
144
99
  }
145
100
  }
146
- setDefaultSemiPluginColor(semiPluginName, color) {
147
- if (this._freed) {
148
- throw new Error("Plugin has been freed, cannot set default semi plugin color.");
149
- }
150
- if (!this.globe) {
151
- throw new Error("Globe is not set, cannot set default semi plugin color.");
152
- }
153
- if (semiPluginName === "ALL") {
154
- this.circlePlugin.setDefaultColor(color);
155
- this.arcPlugin.setDefaultColor(color);
156
- this.arcPluginBL.setDefaultColor(color);
157
- this.linePlugin.setDefaultColor(color);
158
- this.linePluginBL.setDefaultColor(color);
159
- this.pieceOfPiePlugin.setDefaultColor(color);
160
- return;
161
- }
162
- switch (semiPluginName) {
163
- case "circleOnTerrain":
164
- this.circlePlugin.setDefaultColor(color);
165
- break;
166
- case "arcOnTerrain":
167
- this.arcPlugin.setDefaultColor(color);
168
- break;
169
- case "line":
170
- this.linePlugin.setDefaultColor(color);
171
- break;
172
- case "pieceOfPie":
173
- this.pieceOfPiePlugin.setDefaultColor(color);
174
- break;
175
- default:
176
- throw new Error(`Unknown semi plugin name: ${semiPluginName}`);
177
- }
178
- }
179
101
  setDoDrawVRM(drawVRM) {
180
102
  if (this._freed) {
181
103
  throw new Error("Plugin has been freed, cannot set draw VRM.");
@@ -216,6 +138,7 @@ export class BearingLinePlugin {
216
138
  this.drawOptions.drawAngleRing = drawAngleRing;
217
139
  this.globe.DrawRender();
218
140
  }
141
+ // TODO:
219
142
  updatePartial(items, { textWriterIDs } = {}) {
220
143
  if (this._freed) {
221
144
  throw new Error("Plugin has been freed, cannot update item.");
@@ -412,11 +335,11 @@ export class BearingLinePlugin {
412
335
  throw new Error("Circle and Arc plugins are not initialized.");
413
336
  }
414
337
  if (this.drawOptions.drawVRM) {
415
- this.circlePlugin.setPluginOpacity(this._opacities.circle ?? this._opacities.general, false);
338
+ this.circlePlugin.setPluginOpacity(this._opacities.circle ?? this._opacities.general);
416
339
  this.circlePlugin.draw3D();
417
340
  }
418
341
  if (this.drawOptions.drawBearingLine) {
419
- this.arcPluginBL.setPluginOpacity(this._opacities.bearing ?? this._opacities.general, false);
342
+ this.arcPluginBL.setPluginOpacity(this._opacities.arc ?? this._opacities.general);
420
343
  this.arcPluginBL.draw3D();
421
344
  }
422
345
  if (this.drawOptions.drawAngleRing) {
@@ -424,19 +347,21 @@ export class BearingLinePlugin {
424
347
  const tiltAngle = this.globe.api_GetCurrentLookInfo().Tilt;
425
348
  const opacity = pieceOfPieOpacityAdaptor(currentLOD, tiltAngle) * (this._opacities.general ?? 1);
426
349
  if (opacity > 0) {
427
- this.pieceOfPiePlugin.setPluginOpacity(opacity, false);
350
+ this.pieceOfPiePlugin.setPluginOpacity(opacity);
428
351
  this.pieceOfPiePlugin.draw3D();
429
352
  }
430
353
  }
431
354
  const currentGeometry = this.globe.api_GetCurrentGeometry();
432
- this.arcPlugin.setPluginOpacity(this._opacities.arc ?? this._opacities.general, false);
355
+ this.arcPlugin.setPluginOpacity(this._opacities.arc ?? this._opacities.general);
433
356
  this.arcPlugin.draw3D();
434
357
  if (currentGeometry === 1) {
435
358
  this.linePlugin.draw3D();
436
359
  this.linePluginBL.draw3D();
437
360
  }
438
- for (const textWriter of this._textWritersMap.values()) {
439
- textWriter.draw();
361
+ if (this.drawOptions.drawAngleRing) {
362
+ for (const textWriter of this._textWritersMap.values()) {
363
+ textWriter.draw();
364
+ }
440
365
  }
441
366
  }
442
367
  free() {
@@ -9,11 +9,12 @@ export const circleDataAdaptor = (globe, chain) => {
9
9
  const { chainKey, chainProperties, nodes } = chain;
10
10
  for (let i = 0; i < nodes.length - 1; i++) {
11
11
  const node = nodes[i];
12
- // const circleOn = nodes[i + 1]?.circleOn ?? true; // Default to true if not specified
13
- const { key, long, lat, circleProperties, circleOn = true } = node;
14
- if (!circleOn)
15
- continue; // Skip if circle is not enabled for this node
16
- const color = circleProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specifie
12
+ const { key, long, lat, circleProperties } = node;
13
+ const color = circleProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified
14
+ if (key === "Sakarya") {
15
+ console.log("circleProperties", circleProperties, "chainProperties", chainProperties);
16
+ console.log("Sakarya color", color);
17
+ }
17
18
  const radius = globe.Math.GetDist2D(long, lat, nodes[i + 1].long, nodes[i + 1].lat);
18
19
  const nodeKey = keyMethod(chainKey, key);
19
20
  circleInputs.push({
@@ -22,7 +23,6 @@ export const circleDataAdaptor = (globe, chain) => {
22
23
  radius,
23
24
  height: chainProperties.altitude ?? 0,
24
25
  color: color,
25
- msl: chainProperties.msl ?? null
26
26
  });
27
27
  }
28
28
  return circleInputs;
@@ -32,11 +32,8 @@ export function arcDataAdaptor(chain) {
32
32
  const { chainKey, chainProperties, nodes } = chain;
33
33
  for (let i = 0; i < nodes.length - 1; i++) {
34
34
  const node = nodes[i];
35
- // const arcOn = nodes[i + 1]?.arcOn ?? true; // Default to true if not specified
36
35
  const nextNode = nodes[i + 1];
37
- const { key, long, lat, lineProperties, arcOn = true } = node;
38
- if (!arcOn)
39
- continue; // Skip if arc is not enabled for this node
36
+ const { key, long, lat, lineProperties } = node;
40
37
  const nodeKey = keyMethod(chainKey, key);
41
38
  const { long: nextLong, lat: nextLat } = nextNode;
42
39
  const color = lineProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified
@@ -46,7 +43,6 @@ export function arcDataAdaptor(chain) {
46
43
  end: [nextLong, nextLat],
47
44
  height: chainProperties.altitude ?? 0,
48
45
  color: color,
49
- msl: chainProperties.msl ?? null
50
46
  });
51
47
  }
52
48
  return arcInputs;
@@ -57,10 +53,7 @@ export function lineDataAdaptor(chain) {
57
53
  for (let i = 0; i < nodes.length - 1; i++) {
58
54
  const node = nodes[i];
59
55
  const nextNode = nodes[i + 1];
60
- // const lineOn = nextNode?.lineOn ?? true; // Default to true if not specified
61
- const { key, long, lat, lineProperties, lineOn = true } = node;
62
- if (!lineOn)
63
- continue; // Skip if line is not enabled for this node
56
+ const { key, long, lat, lineProperties } = node;
64
57
  const nodeKey = keyMethod(chainKey, key);
65
58
  const { long: nextLong, lat: nextLat } = nextNode;
66
59
  const color = lineProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified