@pirireis/webglobeplugins 1.2.13 → 1.2.16

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.
@@ -388,13 +388,16 @@ export function partialTessellation(triangleMeta, limits, innerCuts, calculateRe
388
388
  // If this clipped segment is valid, generate points
389
389
  if (segMinLon < segMaxLon - 1e-9) {
390
390
  // Add the exact start and end points of the clipped segment
391
- addPoint(p0.longLat, p0.vec, p0.arcIndex);
392
- addPoint(p1.longLat, p1.vec, p1.arcIndex);
391
+ if (inBBOX(p0.longLat, workBBox) || triangleMeta.arcs[p0.arcIndex].realEdge)
392
+ addPoint(p0.longLat, p0.vec, p0.arcIndex);
393
+ if (inBBOX(p1.longLat, workBBox) || triangleMeta.arcs[p1.arcIndex].realEdge)
394
+ addPoint(p1.longLat, p1.vec, p1.arcIndex);
393
395
  // Add fill points *between* them
394
- let currentLon = Math.ceil(segMinLon / lonStep) * lonStep;
395
- if (currentLon < segMinLon - 1e-9)
396
- currentLon += lonStep;
396
+ let currentLon = Math.max(Math.ceil(segMinLon / lonStep) * lonStep, segMinLon);
397
+ // if (currentLon < segMinLon - 1e-9) currentLon += lonStep;
397
398
  while (currentLon < segMaxLon - 1e-9) {
399
+ const longLat = [currentLon, lat];
400
+ addPoint(longLat, undefined, undefined);
398
401
  addPoint([currentLon, lat], undefined, undefined);
399
402
  currentLon += lonStep;
400
403
  }
@@ -420,7 +423,8 @@ export function partialTessellation(triangleMeta, limits, innerCuts, calculateRe
420
423
  // Check if this point is inside the *workBBox*
421
424
  if (pLongLat[1] >= workBBox.min[1] - 1e-9 &&
422
425
  pLongLat[1] <= workBBox.max[1] + 1e-9) {
423
- addPoint(pLongLat, p.vec, p.arcIndex);
426
+ if (inBBOX(pLongLat, workBBox))
427
+ addPoint(pLongLat, p.vec, p.arcIndex);
424
428
  }
425
429
  }
426
430
  currentLon += lonStep;
@@ -484,3 +488,7 @@ function orderIndcecesAlongArc(triangleMeta, edgePointIndexSets, allLongLats) {
484
488
  }
485
489
  return finalResult;
486
490
  }
491
+ function inBBOX(longlat, bbox) {
492
+ return longlat[0] >= bbox.min[0] && longlat[0] <= bbox.max[0] &&
493
+ longlat[1] >= bbox.min[1] && longlat[1] <= bbox.max[1];
494
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "1.2.13",
3
+ "version": "1.2.16",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -78,26 +78,24 @@ export class WorkerContact {
78
78
  });
79
79
  }
80
80
  }
81
+ // TODO: DELETE
81
82
  function fineTuneBboxZooms(bboxZooms, tilt) {
82
- if (bboxZooms.length >= 3 && tilt > 55) {
83
- const first = bboxZooms.shift();
84
- bboxZooms[0].minX = Math.min(first.minX, bboxZooms[0].minX);
85
- bboxZooms[0].minY = Math.min(first.minY, bboxZooms[0].minY);
86
- bboxZooms[0].maxX = Math.max(first.maxX, bboxZooms[0].maxX);
87
- bboxZooms[0].maxY = Math.max(first.maxY, bboxZooms[0].maxY);
83
+ return;
84
+ if (bboxZooms.length < 3)
85
+ return;
86
+ if (tilt > 45 && bboxZooms[0].zoom > 15) {
88
87
  bboxZooms[1].zoom = bboxZooms[0].zoom;
89
- if (tilt > 65) {
90
- bboxZooms[2].zoom = bboxZooms[0].zoom;
88
+ bboxZooms[2].zoom = bboxZooms[0].zoom;
89
+ if (tilt > 65 && bboxZooms.length >= 4 && bboxZooms[0].zoom > 17) {
90
+ bboxZooms[3].zoom = bboxZooms[0].zoom;
91
91
  }
92
92
  }
93
- else if (bboxZooms.length >= 3 && bboxZooms[0].zoom > 12) {
94
- const first = bboxZooms.shift();
95
- bboxZooms[0].zoom = first.zoom;
96
- bboxZooms[0].minX = Math.min(first.minX, bboxZooms[0].minX);
97
- bboxZooms[0].minY = Math.min(first.minY, bboxZooms[0].minY);
98
- bboxZooms[0].maxX = Math.max(first.maxX, bboxZooms[0].maxX);
99
- bboxZooms[0].maxY = Math.max(first.maxY, bboxZooms[0].maxY);
100
- }
93
+ // else if (bboxZooms[0].zoom > 12) {
94
+ // bboxZooms[1].zoom = bboxZooms[0].zoom;
95
+ // } else if (bboxZooms[0].zoom > 8 && bboxZooms[0].zoom <= 12) {
96
+ // bboxZooms[2].zoom = bboxZooms[1].zoom;
97
+ // bboxZooms[0].zoom = bboxZooms[1].zoom;
98
+ // }
101
99
  while (bboxZooms.length > 6) {
102
100
  bboxZooms.pop();
103
101
  }