@pirireis/webglobeplugins 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -27,9 +27,9 @@ out vec4 v_color;
27
27
  out vec2 v_limp;
28
28
 
29
29
  void main() {
30
- if( flag == 1.0 || radius == 0.0) return; // 1.0 is hide
30
+ if( flag == 1.0 || radius == 0.0) return; // flag 1.0 is hide
31
31
  v_color = color;
32
- gl_PointSize = 2.0;
32
+ if ( gl_VertexID == 270 ) v_color.rgb += 0.2;
33
33
  float angle = 3.1415926535897932384626433832795 * 2.0 * (float(gl_VertexID) / circle_edge_count);
34
34
  if ( is3D ){
35
35
  gl_Position = projection * view * vec4(
@@ -14,7 +14,6 @@ const vertexShader = `#version 300 es ` +
14
14
  shaderfunctions.longLatRadToCartesian3D +
15
15
  shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
16
16
  shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
17
- shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
18
17
  shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
19
18
 
20
19
  in vec2 center;
@@ -51,7 +50,6 @@ void main() {
51
50
  if ( compass == 1 ){
52
51
  limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
53
52
  } else {
54
- // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
55
53
  limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
56
54
  }
57
55
  v_limp = limp;
@@ -120,7 +120,8 @@ export default class RangeRingAngleText {
120
120
  this._fillDeleteBucket(centerID, stepAngle, deleteBucket);
121
121
  }
122
122
  const maxRadius = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
123
- this._appendCircle(x, y, maxRadius, stepAngle, centerID, addBucket);
123
+ const show = hide !== ENUM_HIDE.HIDE && textHide === ENUM_TEXT_HIDE.SHOW;
124
+ if (show) this._appendCircle(x, y, maxRadius, stepAngle, centerID, addBucket);
124
125
  this._centerCollection.set(centerID,
125
126
  new Map([
126
127
  ["stepAngle", stepAngle],
@@ -208,7 +209,7 @@ export default class RangeRingAngleText {
208
209
 
209
210
 
210
211
  // TODO : Implement this
211
- deleteCenters(centerIDs) {
212
+ removeCenters(centerIDs) {
212
213
  const deleteBucket = {
213
214
  coords: [],
214
215
  coordsZ: [],
@@ -57,16 +57,6 @@ export default class {
57
57
 
58
58
 
59
59
 
60
- // // TODO: Client should reinsert all data to be able to see numbers. Think Better Solution.
61
- // setShowNumbers(showNumbers) {
62
- // this._showNumbers = showNumbers;
63
- // if (this._showNumbers) {
64
- // this._textPlugin = new RangeRingAngleText(this.globe);
65
- // } else {
66
- // this._textPlugin?.free();
67
- // this._textPlugin = null;
68
- // }
69
- // }
70
60
 
71
61
  setGeometry() {
72
62
  this._textPlugin?.setGeometry();
@@ -116,6 +106,9 @@ export default class {
116
106
  const insertData = ringItemsToCircleBufferInsertDataAdaptor(items);
117
107
 
118
108
  this.bufferManager.insertBulk(insertData);
109
+ for (const item of items) {
110
+ item.paddingAngles = angleToPaddingAngles(item.stepAngle, 0);
111
+ }
119
112
  this.paddingBufferManager.insertBulk(items);
120
113
  this._textPlugin?.insertBulk(items);
121
114
  this.globe.DrawRender();
@@ -162,7 +155,7 @@ export default class {
162
155
  const ringItemsToCircleBufferInsertDataAdaptor = (ringItems) => {
163
156
 
164
157
  const result = [];
165
- for (const { centerID, x, y, paddingAngles, rgba, rings, hide = 0 } of ringItems) {
158
+ for (const { centerID, x, y, rgba, rings, hide = 0, textHide = 0 } of ringItems) {
166
159
  const resultRings = [];
167
160
  for (const { ringID, radius, padding } of rings) {
168
161
  resultRings.push({
@@ -178,8 +171,12 @@ const ringItemsToCircleBufferInsertDataAdaptor = (ringItems) => {
178
171
  x,
179
172
  y,
180
173
  rings: resultRings,
181
- hide
174
+ hide,
175
+ textHide
182
176
  });
183
177
  }
184
178
  return result;
185
- };
179
+ };
180
+
181
+ const angleToPaddingAngles = (gapDegree, offsetDegree = 0) => Array.from({ length: Math.ceil(360 / gapDegree) }, (_, i) => (i * gapDegree + offsetDegree) * Math.PI / 180);
182
+