@pirireis/webglobeplugins 0.16.4 → 0.17.0

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 (168) hide show
  1. package/Math/angle-calculation.js +1 -0
  2. package/Math/arc.js +92 -2
  3. package/Math/circle-cdf-points.js +2 -2
  4. package/Math/circle.js +2 -2
  5. package/Math/contour/quadtreecontours.js +300 -0
  6. package/Math/finite-line-2d.js +58 -0
  7. package/Math/juction/arc-plane.js +67 -12
  8. package/Math/juction/line-sphere.js +6 -6
  9. package/Math/juction/plane-plane.js +4 -6
  10. package/Math/methods.js +5 -5
  11. package/Math/templete-shapes/grid-visually-equal.js +0 -1
  12. package/Math/tessellation/earcut/adapters.js +37 -0
  13. package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
  14. package/Math/tessellation/methods.js +46 -0
  15. package/Math/tessellation/shred-input.js +18 -0
  16. package/Math/tessellation/tile-merger.js +56 -0
  17. package/Math/tessellation/tiler.js +50 -0
  18. package/Math/tessellation/triangle-tessellation-meta.js +516 -0
  19. package/Math/tessellation/triangle-tessellation.js +14 -0
  20. package/Math/tessellation/zoom-catch.js +1 -0
  21. package/Math/vec3.js +26 -1
  22. package/compass-rose/compass-text-writer.js +39 -33
  23. package/constants.js +3 -0
  24. package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
  25. package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
  26. package/heatwave/index.js +5 -3
  27. package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
  28. package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
  29. package/package.json +7 -3
  30. package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
  31. package/programs/arrowfield/logic.js +1 -1
  32. package/programs/data2legend/density-to-legend.js +24 -29
  33. package/programs/data2legend/point-to-density-texture.js +14 -17
  34. package/programs/float2legendwithratio/logic.js +2 -2
  35. package/programs/float2legendwithratio/object.js +1 -1
  36. package/programs/helpers/{blender/program.js → blender.js} +1 -1
  37. package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
  38. package/programs/index.js +20 -9
  39. package/programs/line-on-globe/circle-accurate-3d.js +12 -14
  40. package/programs/line-on-globe/circle-accurate-flat.js +0 -1
  41. package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
  42. package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
  43. package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
  44. package/programs/picking/pickable-polygon-renderer.js +1 -1
  45. package/programs/picking/pickable-renderer.js +2 -2
  46. package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
  47. package/programs/point-on-globe/element-point-glow.js +1 -1
  48. package/programs/point-on-globe/square-pixel-point.js +1 -1
  49. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +204 -0
  50. package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +31 -10
  51. package/programs/polygon-on-globe/texture-dem-triangles.js +81 -12
  52. package/programs/rings/partial-ring/piece-of-pie.js +26 -29
  53. package/programs/totems/camerauniformblock.js +34 -45
  54. package/programs/two-d/pixel-padding-for-compass.js +14 -24
  55. package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
  56. package/programs/vectorfields/logics/pixelbased.js +1 -2
  57. package/programs/vectorfields/pingpongbuffermanager.js +1 -1
  58. package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
  59. package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
  60. package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
  61. package/range-tools-on-terrain/range-ring/plugin.js +4 -6
  62. package/semiplugins/lightweight/line-plugin.js +0 -1
  63. package/semiplugins/shape-on-terrain/arc-plugin.js +5 -7
  64. package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
  65. package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -2
  66. package/semiplugins/shell/bbox-renderer/index.js +2 -0
  67. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
  68. package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
  69. package/semiplugins/utility/container-plugin.js +94 -0
  70. package/semiplugins/utility/object-pass-container-plugin.js +80 -0
  71. package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
  72. package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
  73. package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
  74. package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
  75. package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
  76. package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
  77. package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
  78. package/types.js +6 -0
  79. package/util/account/bufferoffsetmanager.js +1 -1
  80. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
  81. package/util/gl-util/uniform-block/manager.js +4 -5
  82. package/util/gl-util/uniform-block/types.js +0 -7
  83. package/util/index.js +10 -13
  84. package/util/picking/fence.js +16 -18
  85. package/util/picking/picker-displayer.js +4 -6
  86. package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
  87. package/util/programs/draw-texture-on-canvas.js +1 -1
  88. package/util/programs/texturetoglobe.js +3 -3
  89. package/util/shaderfunctions/geometrytransformations.js +6 -0
  90. package/util/webglobe/rasteroverlay.js +1 -0
  91. package/vectorfield/arrowfield/index.js +3 -0
  92. package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
  93. package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
  94. package/{wind → vectorfield/wind}/index.js +1 -1
  95. package/{wind → vectorfield/wind}/plugin.js +32 -32
  96. package/write-text/attached-text-writer.js +9 -1
  97. package/write-text/context-text3.js +0 -1
  98. package/write-text/objectarraylabels/index.js +2 -0
  99. package/Math/mesh/mapbox-delaunay.js +0 -544
  100. package/arrowfield/index.js +0 -3
  101. package/bearing-line/index.js +0 -2
  102. package/bearing-line/plugin.js +0 -444
  103. package/circle-line-chain/chain-list-map.js +0 -201
  104. package/circle-line-chain/plugin.js +0 -411
  105. package/circle-line-chain/util.js +0 -1
  106. package/compassrose/compassrose.js +0 -293
  107. package/compassrose/index.js +0 -2
  108. package/index.js +0 -12
  109. package/partialrings/buffer-manager.js +0 -75
  110. package/partialrings/index.js +0 -2
  111. package/partialrings/plugin.js +0 -128
  112. package/partialrings/program.js +0 -279
  113. package/programs/arrowfield/index.js +0 -2
  114. package/programs/globe-util/is-globe-moved.js +0 -19
  115. package/programs/globeshell/index.js +0 -2
  116. package/programs/globeshell/wiggle/index.js +0 -2
  117. package/programs/helpers/blender/index.js +0 -1
  118. package/programs/helpers/fadeaway/index.js +0 -2
  119. package/programs/helpers/fadeaway/object.js +0 -14
  120. package/programs/helpers/index.js +0 -2
  121. package/programs/rings/distancering/circleflatprogram.js +0 -116
  122. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
  123. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
  124. package/programs/rings/distancering/index.js +0 -6
  125. package/programs/rings/distancering/paddyflatprogram.js +0 -127
  126. package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
  127. package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
  128. package/programs/two-d/pixel-circle.js +0 -1
  129. package/programs/vectorfields/index.js +0 -3
  130. package/rangerings/enum.js +0 -2
  131. package/rangerings/index.js +0 -5
  132. package/rangerings/plugin.js +0 -543
  133. package/rangerings/rangeringangletext.js +0 -326
  134. package/rangerings/ring-account.js +0 -112
  135. package/timetracks/index.js +0 -1
  136. package/util/build-strategy/general-strategy.js +0 -62
  137. package/util/gl-util/uniform-block/shader.js +0 -1
  138. package/util/heatwavedatamanager/index.js +0 -2
  139. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  140. package/util/jshelpers/data-filler.js +0 -17
  141. package/util/jshelpers/equality.js +0 -18
  142. package/util/jshelpers/index.js +0 -2
  143. package/util/jshelpers/timefilters.js +0 -30
  144. package/util/programs/index.js +0 -1
  145. package/util/surface-line-data/arc-bboxes.js +0 -25
  146. package/util/surface-line-data/arcs-to-cuts.js +0 -50
  147. package/util/surface-line-data/cut-arc.js +0 -1
  148. package/util/surface-line-data/flow.js +0 -28
  149. package/util/surface-line-data/rbush-manager.js +0 -1
  150. package/util/surface-line-data/web-worker.js +0 -1
  151. package/write-text/context-text3old.js +0 -152
  152. package/write-text/index.js +0 -1
  153. package/write-text/writer-plugin.js +0 -8
  154. /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
  155. /package/{util/surface-line-data → Math/tessellation}/types.js +0 -0
  156. /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
  157. /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
  158. /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
  159. /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
  160. /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
  161. /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
  162. /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
  163. /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
  164. /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
  165. /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
  166. /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
  167. /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
  168. /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
@@ -1,17 +1,5 @@
1
- import { CSZMode, CSMeasureTextPositionTypes } from "@pirireis/webglobe";
2
- // const defaultStyle = {
3
- // textFont: {
4
- // name: 'Arial',
5
- // textColor: '#FFFFFF', // beyaz
6
- // hollowColor: '#000000', // siyah
7
- // size: 12, // piksel
8
- // hollow: true,
9
- // bold: true,
10
- // italic: false,
11
- // },
12
- // opacity: 1.0,
13
- // zMode: CSZMode.Z_GROUND_PERVERTEX,
14
- // }
1
+ // filepath: d:\webglobeplugins\webglobePlugin\src\webglobeplugins\compass-rose\compass-text-writer.ts
2
+ import { CSMeasureTextPositionTypes } from "@pirireis/webglobe";
15
3
  /**
16
4
  * TODOs:
17
5
  * 1) update all if initials change (propably need a context and a callback to iterate over data)
@@ -21,19 +9,32 @@ import { CSZMode, CSMeasureTextPositionTypes } from "@pirireis/webglobe";
21
9
  const yGapFit = -2;
22
10
  const xGapFit = -5;
23
11
  export class PixelPaddingCompassTextWriter {
12
+ globe;
13
+ itemMap;
14
+ font;
15
+ northFont;
16
+ doDraw;
17
+ angle;
18
+ angles;
19
+ texts;
20
+ positions;
21
+ _lastNorthAngle;
22
+ offsets;
23
+ keyAdaptor;
24
+ opacity;
24
25
  constructor(globe, { font = {
25
26
  name: 'Arial',
26
- textColor: '#FFFFFF', // beyaz
27
- hollowColor: '#000000', // siyah
28
- size: 12, // piksel
27
+ textColor: '#FFFFFF',
28
+ hollowColor: '#000000',
29
+ size: 12,
29
30
  hollow: true,
30
31
  bold: true,
31
32
  italic: false,
32
33
  }, northFont = {
33
34
  name: 'Arial',
34
- textColor: '#BB0000', // beyaz
35
- hollowColor: '#000000', // siyah
36
- size: 14, // piksel
35
+ textColor: '#BB0000',
36
+ hollowColor: '#000000',
37
+ size: 14,
37
38
  hollow: true,
38
39
  bold: true,
39
40
  italic: false,
@@ -56,17 +57,16 @@ export class PixelPaddingCompassTextWriter {
56
57
  this.positions.push(null);
57
58
  }
58
59
  this.angles.push(currentAngle);
59
- if (currentAngle == 0) {
60
+ if (currentAngle === 0) {
60
61
  this.texts.push("K");
61
62
  }
62
63
  else {
63
- // to string 3 chars fill left with 0
64
64
  this.texts.push(currentAngle.toString().padStart(3, '0'));
65
65
  }
66
66
  currentAngle += this.angle;
67
67
  }
68
68
  this._lastNorthAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
69
- this.offsets = this.__offset(this._lastNorthAngle);
69
+ this.offsets = this.__offset();
70
70
  }
71
71
  setKeyAdaptor(adaptor) {
72
72
  this.keyAdaptor = adaptor;
@@ -86,7 +86,6 @@ export class PixelPaddingCompassTextWriter {
86
86
  _checkSetOffsets() {
87
87
  const { globe } = this;
88
88
  const newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
89
- ;
90
89
  if (newAngle !== this._lastNorthAngle) {
91
90
  this._lastNorthAngle = newAngle;
92
91
  this.offsets = this.__offset();
@@ -96,42 +95,49 @@ export class PixelPaddingCompassTextWriter {
96
95
  if (!this.doDraw)
97
96
  return;
98
97
  const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
99
- this._checkSetOffsets(); // zMode: CSZMode.Z_GROUND_PERVERTEX,
98
+ this._checkSetOffsets();
100
99
  const offsets = this.offsets;
101
100
  for (const [key, { center, radius, opacity = null }] of itemMap) {
102
- const o = opacity === null ? opacity_ : opacity * opacity_;
103
- if (center.x !== null && center.y !== null) {
101
+ const o = opacity === null ? (opacity_ ?? 1.0) : opacity * (opacity_ ?? 1.0);
102
+ if (center && radius !== undefined) {
103
+ const { x, y } = center;
104
+ if (x === null || y === null)
105
+ continue;
104
106
  offsets.forEach(({ offsetX, offsetY }, i) => {
105
107
  const text = texts[i];
106
108
  const angle = angles[i];
107
109
  font.position = positions[i];
108
110
  if (angle === 0) {
109
- globe.api_DrawContextTextMultiLine(text, northFont, o, { x: center.x + offsetX * radius + xGapFit, y: center.y + offsetY * radius + yGapFit });
111
+ globe.api_DrawContextTextMultiLine(text, northFont, o, { x: x + offsetX * radius + xGapFit, y: y + offsetY * radius + yGapFit });
110
112
  }
111
113
  else {
112
- globe.api_DrawContextTextMultiLine(text, font, o, { x: center.x + offsetX * radius + xGapFit, y: center.y + offsetY * radius + yGapFit });
114
+ globe.api_DrawContextTextMultiLine(text, font, o, { x: x + offsetX * radius + xGapFit, y: y + offsetY * radius + yGapFit });
113
115
  }
114
116
  });
115
117
  }
116
118
  }
117
119
  }
118
- insertTextItem(key, x, y, radius = undefined) {
120
+ insertTextItem(key, x, y, radius) {
119
121
  const item = this.getItem(key);
120
122
  item.center = { x, y };
121
123
  if (radius === undefined)
122
124
  return;
123
- if (item.radius != undefined && item.radius === radius)
125
+ if (item.radius !== undefined && item.radius === radius)
124
126
  return;
125
127
  item.radius = radius;
126
128
  }
127
129
  getItem(key) {
128
- if (!this.itemMap.has(key))
130
+ if (!this.itemMap.has(key)) {
129
131
  this.itemMap.set(key, {});
132
+ }
130
133
  return this.itemMap.get(key);
131
134
  }
132
135
  __calculateOffset(angle) {
133
136
  const rAngle = (angle - 90) * (Math.PI / 180);
134
- return { offsetX: Math.cos(rAngle + this._lastNorthAngle), offsetY: Math.sin(rAngle + this._lastNorthAngle) };
137
+ return {
138
+ offsetX: Math.cos(rAngle + this._lastNorthAngle),
139
+ offsetY: Math.sin(rAngle + this._lastNorthAngle)
140
+ };
135
141
  }
136
142
  __offset() {
137
143
  const angle = this.angle;
package/constants.js CHANGED
@@ -1,3 +1,6 @@
1
+ export const CSRenderPassPluginKeys = ["supportNormalPass",
2
+ "supportSelectedPass",
3
+ "supportEditingPass"];
1
4
  export const GLOBE_DEFAULT_MIN_LOD = 2;
2
5
  export const GLOBE_DEFAULT_MAX_LOD = 25;
3
6
  export const POLE2 = 12756274.0;
@@ -2,7 +2,7 @@
2
2
  * todo:
3
3
  * data must be processed before being set to the cache
4
4
  */
5
- export default class DataManager {
5
+ export class DataManager {
6
6
  /**
7
7
  *
8
8
  * @param {Array<number>} timeEpocs | array of time epocs
@@ -1,7 +1,9 @@
1
- import { getColorRampModed, DataManager, } from "../../util/index";
2
- import { TexturePointSampler } from "../../util/heatwavedatamanager/texture-point-sampler";
3
- import { GlobeShellWiggle, Float2LegendWithRatio } from "../../programs";
4
- import { opacityCheck } from "../../util/check/typecheck";
1
+ import { getColorRampModed } from "../util/webglobjectbuilders";
2
+ import { DataManager } from "./datamanager";
3
+ import { TexturePointSampler } from "./texture-point-sampler";
4
+ import { BBOXGlobeShell } from "../semiplugins/shell/bbox-renderer";
5
+ import { Float2LegendWithRatio } from "../programs/float2legendwithratio";
6
+ import { opacityCheck } from "../util/check/typecheck";
5
7
  /**
6
8
  * @param id : string
7
9
  * @param dataManager : DataManager
@@ -9,7 +11,7 @@ import { opacityCheck } from "../../util/check/typecheck";
9
11
  * @param dataWidthHeight : {width: number, height: number}
10
12
  * @param options : {bbox: number[], minMaxEdges: {min: number, max: number}, escapeValue: number, resolution: number[], meshPartition: number[]}
11
13
  */
12
- export default class HeatWaveGlobeShellPlugin {
14
+ export class HeatWavePlugin {
13
15
  constructor(id, dataManager, colorRampData, dataWidthHeight, { bbox = [-180, -90, 180, 90], minMaxEdges = { min: -99999, max: 99999 }, escapeValue = 99999, resolution = [2056, 2056], yFlip = true, } = {}) {
14
16
  this.id = id;
15
17
  this.dataManager = dataManager;
@@ -152,7 +154,7 @@ export default class HeatWaveGlobeShellPlugin {
152
154
  this.setEscapeValue(this._escapeValue);
153
155
  }
154
156
  _init(globe, gl) {
155
- this.globeShell = new GlobeShellWiggle(gl, globe, {
157
+ this.globeShell = new BBOXGlobeShell(gl, globe, {
156
158
  minLon: this._bbox[0],
157
159
  minLat: this._bbox[1],
158
160
  maxLon: this._bbox[2],
package/heatwave/index.js CHANGED
@@ -1,3 +1,5 @@
1
- import HeatWavePlugin from './plugins/heatwaveglobeshell';
2
- import { IsobarRasterToVector } from './isobar/plugin';
3
- export { HeatWavePlugin, IsobarRasterToVector };
1
+ import { DataManager } from "./datamanager.js";
2
+ import { HeatWavePlugin } from "./heatwave.js";
3
+ import { IsobarRasterToVector } from "./isobar.js";
4
+ import { TexturePointSampler } from "./texture-point-sampler";
5
+ export { DataManager, HeatWavePlugin, IsobarRasterToVector, TexturePointSampler };
@@ -1,7 +1,8 @@
1
- import { ShapesOnGlobeProgram, latLongToPixelXY } from "../../util";
2
- import ContourMipmap, { scaleParameters } from "./quadtreecontours";
3
- import ObjectArrayLabels from "./objectarraylabels";
4
- import { isBoolean, opacityCheck } from "../../util/check/typecheck";
1
+ import { DrawFromPixelCoords, } from "../util/programs/draw-from-pixel-coords";
2
+ import { latLongToPixelXY } from "../util/geometry/index";
3
+ import ContourMipmap, { scaleParameters } from "../Math/contour/quadtreecontours";
4
+ import ObjectArrayLabels from "../write-text/objectarraylabels";
5
+ import { isBoolean, opacityCheck } from "../util/check/typecheck";
5
6
  export class IsobarRasterToVector {
6
7
  /**
7
8
  * @typedef {Object} IsobarData
@@ -151,7 +152,7 @@ export class IsobarRasterToVector {
151
152
  init(globe, gl) {
152
153
  this.gl = gl;
153
154
  this.globe = globe;
154
- this.program = new ShapesOnGlobeProgram(gl, globe, 'line_strip');
155
+ this.program = new DrawFromPixelCoords(gl, globe, 'line_strip');
155
156
  if (this._isLabelsOn) {
156
157
  this._createLabelsLayer();
157
158
  this._labelsLayer.addToMap();
@@ -1,4 +1,25 @@
1
- import PointCoordsMeta from "./pointcoordsmeta";
1
+ class PointCoordsMeta {
2
+ _bbox;
3
+ _width;
4
+ _height;
5
+ _xRatio;
6
+ _yRatio;
7
+ constructor(bbox, width, height) {
8
+ this._bbox = bbox;
9
+ this._width = width;
10
+ this._height = height;
11
+ this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
12
+ this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
13
+ }
14
+ getFlooredIndex(long, lat) {
15
+ let x = (long - this._bbox[0]) * this._xRatio;
16
+ let y = (this._bbox[3] - lat) * this._yRatio;
17
+ x = x > 0 ? x - 1 : 0;
18
+ y = y > 0 ? y - 1 : 0;
19
+ const index = Math.floor(y) * this._width + Math.floor(x);
20
+ return index;
21
+ }
22
+ }
2
23
  const pointObject = (long, lat, posIndex, callback) => {
3
24
  return { long, lat, posIndex, callback };
4
25
  };
@@ -103,7 +124,7 @@ export class TexturePointSampler {
103
124
  }
104
125
  flush(callEmptyCallback = false) {
105
126
  if (callEmptyCallback) {
106
- for (const [key, { callback }] of this._pointObjects.entries()) {
127
+ for (const [, { callback }] of this._pointObjects.entries()) {
107
128
  callback(null, null, null);
108
129
  }
109
130
  }
@@ -141,7 +162,7 @@ export class TexturePointSampler {
141
162
  }
142
163
  }
143
164
  else {
144
- for (const [key, { callback }] of this._pointObjects.entries()) {
165
+ for (const [, { callback }] of this._pointObjects.entries()) {
145
166
  callback(null, null, null);
146
167
  }
147
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.16.4",
3
+ "version": "0.17.0",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -8,7 +8,11 @@
8
8
  "build": "tsc"
9
9
  },
10
10
  "dependencies": {
11
- "@pirireis/webglobe": "^6.2.22",
11
+ "delaunator": "^5.0.1",
12
+ "earcut": "^3.0.2",
12
13
  "rbush": "^4.0.1"
14
+ },
15
+ "peerDependencies": {
16
+ "@pirireis/webglobe": "^6.2.22"
13
17
  }
14
- }
18
+ }
@@ -4,7 +4,7 @@
4
4
  import Logic from './logic';
5
5
  import { globeProgramCache } from '../programcache';
6
6
  import { longlatbbox2normalbbox } from "../util";
7
- export default class ArrowField {
7
+ export class ArrowField {
8
8
  constructor(gl, globe, { minLon = -180, maxLon = 180, minLat = -90, maxLat = 90, height = 0, opacity = 1, color = [0.04, 0.2, 0.8], targetWidth = 100, targetHeight = 100, dataWidth = null, dataHeight = null, tailLengthRatio = 1, wingLengthRatio = 0.5, noDataValue = null,
9
9
  // maxMagnitude = null
10
10
  } = {}) {
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { globeProgramCache } from "../programcache";
3
3
  import { CameraUniformBlockTotem } from "../totems";
4
4
  const arrowVertexShader = `#version 300 es
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util/";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { noRegisterGlobeProgramCache } from "../programcache";
3
3
  const vs = `#version 300 es
4
4
  precision highp float;
@@ -38,34 +38,29 @@ class DensityToLegendProgram {
38
38
  legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
39
39
  opacity: gl.getUniformLocation(program, "u_opacity"),
40
40
  };
41
- { // assign attribute locations
42
- gl.bindAttribLocation(program, 0, "a_position");
43
- }
44
- {
45
- this.vao = gl.createVertexArray();
46
- const a_positionLocation = gl.getAttribLocation(program, "a_position");
47
- gl.bindVertexArray(this.vao);
48
- const buffer = gl.createBuffer();
49
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
50
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
51
- -1, -1,
52
- 1, -1,
53
- 1, 1,
54
- -1, 1,
55
- ]), gl.STATIC_DRAW);
56
- gl.enableVertexAttribArray(a_positionLocation);
57
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
58
- gl.bindVertexArray(null);
59
- // gl.bindBuffer(gl.ARRAY_BUFFER, null);
60
- this._buffer = buffer;
61
- }
62
- {
63
- this._lastOpacity = 1;
64
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
65
- gl.useProgram(program);
66
- gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
67
- gl.useProgram(currentProgram);
68
- }
41
+ // assign attribute locations
42
+ gl.bindAttribLocation(program, 0, "a_position");
43
+ this.vao = gl.createVertexArray();
44
+ const a_positionLocation = gl.getAttribLocation(program, "a_position");
45
+ gl.bindVertexArray(this.vao);
46
+ const buffer = gl.createBuffer();
47
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
48
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
49
+ -1, -1,
50
+ 1, -1,
51
+ 1, 1,
52
+ -1, 1,
53
+ ]), gl.STATIC_DRAW);
54
+ gl.enableVertexAttribArray(a_positionLocation);
55
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
56
+ gl.bindVertexArray(null);
57
+ // gl.bindBuffer(gl.ARRAY_BUFFER, null);
58
+ this._buffer = buffer;
59
+ this._lastOpacity = 1;
60
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
61
+ gl.useProgram(program);
62
+ gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
63
+ gl.useProgram(currentProgram);
69
64
  }
70
65
  draw(densityTexture, legendTexture, opacity) {
71
66
  const { gl, program, uniforms } = this;
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../../util/";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
2
  import { noRegisterGlobeProgramCache } from "../programcache";
3
3
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
4
4
  import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
@@ -41,22 +41,19 @@ class PointHeatmapProgram {
41
41
  this.uniforms = {
42
42
  pointSize: gl.getUniformLocation(this.program, "pointSize"),
43
43
  };
44
- { // assign attribute locations
45
- gl.bindAttribLocation(program, 0, "position");
46
- }
47
- { // arrange camera uniform block
48
- this.cameraBlockBingingPoint = 0;
49
- this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
50
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
51
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
52
- }
53
- { // last values
54
- this._lastPointSize = 0;
55
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
56
- gl.useProgram(program);
57
- gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
58
- gl.useProgram(currentProgram);
59
- }
44
+ // assign attribute locations
45
+ gl.bindAttribLocation(program, 0, "position");
46
+ // arrange camera uniform block
47
+ this.cameraBlockBingingPoint = 0;
48
+ this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
49
+ const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
50
+ gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
51
+ // last values
52
+ this._lastPointSize = 0;
53
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
54
+ gl.useProgram(program);
55
+ gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
56
+ gl.useProgram(currentProgram);
60
57
  }
61
58
  createVAO(positionBuffer, vectorSize) {
62
59
  const gl = this.gl;
@@ -1,5 +1,5 @@
1
- import { createProgram } from "../../util";
2
- export default class {
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
+ export class Float2LegentWithRatioProgram {
3
3
  constructor(gl) {
4
4
  this.gl = gl;
5
5
  this._width = 1;
@@ -1,4 +1,4 @@
1
- import Float2LegentWithRatioProgram from './logic';
1
+ import { Float2LegentWithRatioProgram } from './logic';
2
2
  import { glProgramCache } from '../programcache';
3
3
  // Uniform Buffer Objects use this
4
4
  export default class DataObject {
@@ -1,4 +1,4 @@
1
- import { createProgram } from "../util";
1
+ import { createProgram } from "../util/webglobeplugins";
2
2
  /**
3
3
  * Blends two float32textures with given ratio.
4
4
  */
@@ -1,4 +1,5 @@
1
- import { createProgram } from "../../../util";
1
+ import { createProgram } from "../../util/webglobjectbuilders";
2
+ import { glProgramCache } from "../programcache";
2
3
  const vertexShaderSource = `#version 300 es
3
4
  precision highp float;
4
5
  in vec2 a_position;
@@ -24,7 +25,7 @@ void main() {
24
25
  outColor = vec4(color.rgb, color.a * opacity);
25
26
  }
26
27
  `;
27
- export default class FadeAwayProgram {
28
+ class FadeAwayProgram {
28
29
  constructor(gl) {
29
30
  this.gl = gl;
30
31
  this.program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
@@ -67,3 +68,11 @@ export default class FadeAwayProgram {
67
68
  gl.deleteBuffer(_buffer);
68
69
  }
69
70
  }
71
+ export const FadeAwayProgramCache = Object.freeze({
72
+ get: (gl) => {
73
+ return glProgramCache.getProgram(gl, FadeAwayProgram);
74
+ },
75
+ release: (gl) => {
76
+ return glProgramCache.releaseProgram(gl, FadeAwayProgram);
77
+ }
78
+ });
package/programs/index.js CHANGED
@@ -1,9 +1,20 @@
1
- import { Float2LegendWithRatio } from "./float2legendwithratio";
2
- import { GlobeShellWiggle } from "./globeshell/wiggle";
3
- import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
4
- import ArrowField from "./arrowfield";
5
- import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
6
- import * as vectorfield from "./vectorfields/index";
7
- import { FadeAway } from "./helpers";
8
- import * as rings from "./rings";
9
- export { Float2LegendWithRatio, GlobeShellWiggle, ArrowField, CameraUniformBlockTotem, CameraUniformBlockString, glProgramCache, globeProgramCache, noRegisterGlobeProgramCache, vectorfield, FadeAway, rings };
1
+ "use strict";
2
+ // import { Float2LegendWithRatio } from "./float2legendwithratio";
3
+ // import { GlobeShellWiggle } from "./globeshell/wiggle";
4
+ // import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
5
+ // import ArrowField from "./arrowfield";
6
+ // import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
7
+ // import { FadeAway } from "./helpers";
8
+ // import * as rings from "./rings";
9
+ // export {
10
+ // Float2LegendWithRatio,
11
+ // GlobeShellWiggle,
12
+ // ArrowField,
13
+ // CameraUniformBlockTotem,
14
+ // CameraUniformBlockString,
15
+ // glProgramCache,
16
+ // globeProgramCache,
17
+ // noRegisterGlobeProgramCache,
18
+ // FadeAway,
19
+ // rings
20
+ // };
@@ -3,7 +3,7 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
4
  // import { vaoAttributeLoader } from "../../util/account/util";
5
5
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
6
- import { cartesian3DToGLPosition, circleLimpFromLongLatRadCenterCartesian3D_accurate, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
6
+ import { cartesian3DToGLPosition, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
7
7
  /**
8
8
  * TODO:
9
9
  * 1. integrate geometry functions for radius angle and center
@@ -77,19 +77,17 @@ class Logic {
77
77
  this.program.uniforms = {
78
78
  opacity: gl.getUniformLocation(program, "opacity")
79
79
  };
80
- { // initial uniform values
81
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
82
- gl.useProgram(program);
83
- gl.uniform1f(program.uniforms.opacity, 1.0);
84
- gl.useProgram(currentProgram);
85
- }
86
- { // assign attribute locations
87
- gl.bindAttribLocation(program, 0, "center_position3d");
88
- gl.bindAttribLocation(program, 1, "target_position3d");
89
- gl.bindAttribLocation(program, 2, "color");
90
- gl.bindAttribLocation(program, 3, "dash_ratio");
91
- gl.bindAttribLocation(program, 4, "dash_opacity");
92
- }
80
+ // initial uniform values
81
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
82
+ gl.useProgram(program);
83
+ gl.uniform1f(program.uniforms.opacity, 1.0);
84
+ gl.useProgram(currentProgram);
85
+ // assign attribute locations
86
+ gl.bindAttribLocation(program, 0, "center_position3d");
87
+ gl.bindAttribLocation(program, 1, "target_position3d");
88
+ gl.bindAttribLocation(program, 2, "color");
89
+ gl.bindAttribLocation(program, 3, "dash_ratio");
90
+ gl.bindAttribLocation(program, 4, "dash_opacity");
93
91
  this.cameraBindingPoint = 0;
94
92
  this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
95
93
  const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
@@ -3,7 +3,6 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
4
  import { vaoAttributeLoader } from "../../util/account/util";
5
5
  import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
6
- const Pole = 20037508.34;
7
6
  /**
8
7
  * Warning:
9
8
  * Insert the points from the second index and skip 1 point as you placed 361 points
@@ -84,21 +84,19 @@ class Logic {
84
84
  stepAngle: gl.getUniformLocation(program, "step_angle"),
85
85
  zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
86
86
  };
87
- { // initial uniform values
88
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
89
- gl.useProgram(program);
90
- gl.uniform1f(program.uniforms.opacity, 1.0);
91
- gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
92
- gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
93
- gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
94
- gl.useProgram(currentProgram);
95
- }
96
- { // assign attribute locations
97
- gl.bindAttribLocation(program, 0, "center_position3d");
98
- gl.bindAttribLocation(program, 1, "big_radius");
99
- gl.bindAttribLocation(program, 2, "small_radius");
100
- gl.bindAttribLocation(program, 3, "color");
101
- }
87
+ // initial uniform values
88
+ const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
89
+ gl.useProgram(program);
90
+ gl.uniform1f(program.uniforms.opacity, 1.0);
91
+ gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
92
+ gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
93
+ gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
94
+ gl.useProgram(currentProgram);
95
+ // assign attribute locations
96
+ gl.bindAttribLocation(program, 0, "center_position3d");
97
+ gl.bindAttribLocation(program, 1, "big_radius");
98
+ gl.bindAttribLocation(program, 2, "small_radius");
99
+ gl.bindAttribLocation(program, 3, "color");
102
100
  this.cameraBindingPoint = 0;
103
101
  this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
104
102
  const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
@@ -1,7 +1,7 @@
1
1
  import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
2
2
  import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
3
3
  import { noRegisterGlobeProgramCache } from "../programcache";
4
- import { createProgram } from "../../util";
4
+ import { createProgram } from "../../util/webglobjectbuilders";
5
5
  import { Z_ALPHA_MODE } from "./util";
6
6
  import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
7
7
  /**
@@ -68,23 +68,20 @@ class Logic {
68
68
  const { gl, program } = this;
69
69
  const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
70
70
  gl.useProgram(program);
71
- { // assign attribute locations
72
- gl.bindAttribLocation(program, 0, 'posA');
73
- gl.bindAttribLocation(program, 1, 'posB');
74
- gl.bindAttribLocation(program, 2, 'color');
75
- }
76
- { // uniform locations
77
- this._opacityLocation = gl.getUniformLocation(program, 'opacity');
78
- this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
79
- gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
80
- gl.uniform1f(this._opacityLocation, this._lastOpicity);
81
- }
82
- { // uniform block
83
- this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
84
- this._cameraBindingPoint = 0;
85
- const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
86
- gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
87
- }
71
+ // assign attribute locations
72
+ gl.bindAttribLocation(program, 0, 'posA');
73
+ gl.bindAttribLocation(program, 1, 'posB');
74
+ gl.bindAttribLocation(program, 2, 'color');
75
+ // uniform locations
76
+ this._opacityLocation = gl.getUniformLocation(program, 'opacity');
77
+ this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
78
+ gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
79
+ gl.uniform1f(this._opacityLocation, this._lastOpicity);
80
+ // uniform block
81
+ this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
82
+ this._cameraBindingPoint = 0;
83
+ const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
84
+ gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
88
85
  gl.useProgram(currentProgram);
89
86
  }
90
87
  createVAO(posAObj, posBObj, colorObj) {