@openglobus/og 0.15.5 → 0.16.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 (122) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +1 -1
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +13 -14
  9. package/src/og/Globe.js +5 -2
  10. package/src/og/LonLat.js +18 -1
  11. package/src/og/Object3d.js +21 -2
  12. package/src/og/bv/index.js +2 -2
  13. package/src/og/camera/PlanetCamera.js +4 -10
  14. package/src/og/control/RulerSwitcher.js +2 -2
  15. package/src/og/control/ZoomControl.js +2 -2
  16. package/src/og/control/heightRuler/HeightRulerScene.js +6 -2
  17. package/src/og/control/index.js +5 -2
  18. package/src/og/control/ruler/RulerScene.js +11 -8
  19. package/src/og/control/timeline/TimelineControl.js +5 -3
  20. package/src/og/control/timeline/TimelineModel.js +4 -0
  21. package/src/og/control/timeline/TimelineView.js +10 -3
  22. package/src/og/control/visibleExtent/Segment.js +36 -42
  23. package/src/og/ellipsoid/Ellipsoid.js +23 -10
  24. package/src/og/entity/Entity.js +3 -3
  25. package/src/og/entity/EntityCollection.js +2 -2
  26. package/src/og/entity/Label.js +1 -1
  27. package/src/og/entity/Polyline.js +4 -2
  28. package/src/og/index.js +4 -7
  29. package/src/og/layer/CanvasTiles.js +70 -23
  30. package/src/og/layer/GeoImage.js +40 -18
  31. package/src/og/layer/Vector.js +14 -11
  32. package/src/og/layer/WMS.js +2 -2
  33. package/src/og/math.js +2 -1
  34. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +26 -0
  35. package/src/og/quadTree/Node.js +44 -50
  36. package/src/og/quadTree/index.js +2 -0
  37. package/src/og/renderer/Renderer.js +13 -1
  38. package/src/og/scene/Planet.js +4 -4
  39. package/src/og/scene/index.js +3 -3
  40. package/src/og/segment/Segment.js +88 -76
  41. package/src/og/terrain/EmptyTerrain.js +19 -7
  42. package/src/og/terrain/GlobusTerrain.js +23 -18
  43. package/src/og/terrain/MapboxTerrain.js +7 -8
  44. package/src/og/terrain/index.js +4 -4
  45. package/src/og/utils/objParser.js +227 -0
  46. package/src/og/utils/shared.js +9 -0
  47. package/src/og/webgl/Handler.js +1 -3
  48. package/types/Globe.d.ts +2 -0
  49. package/types/LonLat.d.ts +12 -1
  50. package/types/Object3d.d.ts +2 -0
  51. package/types/Popup.d.ts +1 -1
  52. package/types/bv/index.d.ts +2 -2
  53. package/types/camera/PlanetCamera.d.ts +0 -7
  54. package/types/camera/index.d.ts +2 -2
  55. package/types/control/GeoImageDragControl.d.ts +1 -1
  56. package/types/control/LayerAnimation.d.ts +1 -1
  57. package/types/control/Lighting.d.ts +2 -2
  58. package/types/control/heightRuler/HeightRulerScene.d.ts +1 -1
  59. package/types/control/index.d.ts +3 -2
  60. package/types/control/ruler/RulerScene.d.ts +5 -4
  61. package/types/control/selection/SelectionScene.d.ts +3 -3
  62. package/types/control/timeline/TimelineControl.d.ts +10 -0
  63. package/types/control/timeline/TimelineModel.d.ts +33 -0
  64. package/types/control/timeline/TimelineView.d.ts +57 -0
  65. package/types/control/timeline/timelineUtils.d.ts +9 -0
  66. package/types/ellipsoid/Ellipsoid.d.ts +16 -9
  67. package/types/ellipsoid/index.d.ts +2 -2
  68. package/types/entity/Entity.d.ts +3 -3
  69. package/types/entity/EntityCollection.d.ts +2 -2
  70. package/types/entity/Label.d.ts +1 -1
  71. package/types/entity/Polyline.d.ts +1 -0
  72. package/types/index.d.ts +45 -46
  73. package/types/layer/CanvasTiles.d.ts +2 -1
  74. package/types/layer/GeoImage.d.ts +7 -1
  75. package/types/layer/GeoTexture2d.d.ts +1 -1
  76. package/types/layer/Vector.d.ts +3 -3
  77. package/types/layer/index.d.ts +9 -9
  78. package/types/math/Line2.d.ts +1 -1
  79. package/types/math/Line3.d.ts +1 -1
  80. package/types/math/index.d.ts +10 -10
  81. package/types/mercator.d.ts +1 -1
  82. package/types/quadTree/EPSG4326QuadTreeStrategy.d.ts +3 -0
  83. package/types/quadTree/EntityCollectionNode.d.ts +1 -1
  84. package/types/quadTree/index.d.ts +2 -0
  85. package/types/renderer/Renderer.d.ts +2 -2
  86. package/types/scene/Axes.d.ts +1 -1
  87. package/types/scene/SkyBox.d.ts +1 -1
  88. package/types/scene/index.d.ts +3 -3
  89. package/types/segment/Segment.d.ts +9 -11
  90. package/types/shaders/atmos.d.ts +1 -1
  91. package/types/shaders/billboard.d.ts +1 -1
  92. package/types/shaders/depth.d.ts +1 -1
  93. package/types/shaders/label.d.ts +1 -1
  94. package/types/shaders/pickingMask.d.ts +1 -1
  95. package/types/shaders/pointCloud.d.ts +1 -1
  96. package/types/shaders/polyline.d.ts +1 -1
  97. package/types/shaders/ray.d.ts +1 -1
  98. package/types/shaders/screenFrame.d.ts +1 -1
  99. package/types/shaders/skybox.d.ts +1 -1
  100. package/types/shaders/toneMapping.d.ts +1 -1
  101. package/types/terrain/BilTerrain.d.ts +1 -0
  102. package/types/terrain/EmptyTerrain.d.ts +13 -2
  103. package/types/terrain/GlobusTerrain.d.ts +2 -1
  104. package/types/terrain/MapboxTerrain.d.ts +1 -3
  105. package/types/terrain/index.d.ts +4 -4
  106. package/types/ui/Button.d.ts +1 -1
  107. package/types/ui/ButtonGroup.d.ts +12 -0
  108. package/types/ui/Dialog.d.ts +2 -2
  109. package/types/ui/Slider.d.ts +1 -1
  110. package/types/ui/ToggleButton.d.ts +1 -1
  111. package/types/ui/View.d.ts +1 -1
  112. package/types/utils/GeoImageCreator.d.ts +2 -2
  113. package/types/utils/ImagesCacheManager.d.ts +1 -1
  114. package/types/utils/Loader.d.ts +1 -1
  115. package/types/utils/VectorTileCreator.d.ts +1 -1
  116. package/types/utils/objParser.d.ts +8 -0
  117. package/types/utils/shared.d.ts +6 -0
  118. package/types/webgl/Handler.d.ts +2 -2
  119. package/src/og/index.core.js +0 -116
  120. package/src/og/index.webgl.js +0 -17
  121. package/types/index.core.d.ts +0 -65
  122. package/types/index.webgl.d.ts +0 -7
@@ -26,7 +26,7 @@ import { Strip } from "./Strip.js";
26
26
  * @param {Object} [options] - Entity options:
27
27
  * @param {string} [options.name] - A human readable name to display to users. It does not have to be unique.
28
28
  * @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label etc. cartesian position.
29
- * @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label etc.
29
+ * @param {LonLat} [options.lonlat] - Geodetic coordinates for an entities like billboard, label etc.
30
30
  * @param {boolean} [options.aground] - True for entities that have to be placed on the relief.
31
31
  * @param {boolean} [options.visibility] - Entity visibility.
32
32
  * @param {*} [options.billboard] - Billboard options(see {@link og.Billboard}).
@@ -86,7 +86,7 @@ class Entity {
86
86
  this._cartesian = utils.createVector3(options.cartesian);
87
87
 
88
88
  /**
89
- * Geodetic entity coordiantes.
89
+ * Geodetic entity coordinates.
90
90
  * @protected
91
91
  * @type {LonLat}
92
92
  */
@@ -474,7 +474,7 @@ class Entity {
474
474
  }
475
475
 
476
476
  /**
477
- * Returns carteain position.
477
+ * Returns cartesian position.
478
478
  * @public
479
479
  * @returns {Vec3} -
480
480
  */
@@ -506,7 +506,7 @@ class EntityCollection {
506
506
  }
507
507
 
508
508
  /**
509
- * Updates coordiantes all lonLat entities in collection after collecction attached to the planet node.
509
+ * Updates coordinates all lonLat entities in collection after collecction attached to the planet node.
510
510
  * @private
511
511
  * @param {Ellipsoid} ellipsoid - Globe ellipsoid.
512
512
  */
@@ -590,7 +590,7 @@ class EntityCollection {
590
590
  }
591
591
 
592
592
  /**
593
- * Removes all entities from colection and clear handlers.
593
+ * Removes all entities from collection and clear handlers.
594
594
  * @public
595
595
  */
596
596
  clear() {
@@ -32,7 +32,7 @@ const STR2ALIGN = {
32
32
  * @extends {BaseBillboard}
33
33
  * @param {Object} [options] - Label options:
34
34
  * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
35
- * @param {number} [options.rotation] - Screen angle rotaion.
35
+ * @param {number} [options.rotation] - Screen angle rotation.
36
36
  * @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
37
37
  * @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
38
38
  * @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
@@ -60,6 +60,8 @@ class Polyline {
60
60
  */
61
61
  this.thickness = options.thickness || 1.5;
62
62
 
63
+ this._opacity = options.opacity != undefined ? options.opacity : 1.0;
64
+
63
65
  /**
64
66
  * Polyline RGBA color.
65
67
  * @public
@@ -1708,7 +1710,7 @@ class Polyline {
1708
1710
  * @param {number} opacity - Opacity.
1709
1711
  */
1710
1712
  setOpacity(opacity) {
1711
- this.color.w = opacity;
1713
+ this._opacity = opacity;
1712
1714
  }
1713
1715
 
1714
1716
  /**
@@ -2010,7 +2012,7 @@ class Polyline {
2010
2012
  ]);
2011
2013
  gl.uniform2fv(shu.viewport, [r.handler.canvas.width, r.handler.canvas.height]);
2012
2014
  gl.uniform1f(shu.thickness, this.thickness * 0.5);
2013
- gl.uniform1f(shu.opacity, ec._fadingOpacity);
2015
+ gl.uniform1f(shu.opacity, this._opacity * ec._fadingOpacity);
2014
2016
 
2015
2017
  gl.bindBuffer(gl.ARRAY_BUFFER, this._colorsBuffer);
2016
2018
  gl.vertexAttribPointer(sha.color, this._colorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
package/src/og/index.js CHANGED
@@ -34,6 +34,7 @@ import { Events } from './Events.js';
34
34
  import { Extent } from './Extent.js';
35
35
  import { LonLat } from './LonLat.js';
36
36
  import { RenderNode } from './scene/RenderNode.js';
37
+ import { Planet } from './scene/Planet.js';
37
38
 
38
39
  import { Popup } from './Popup.js';
39
40
 
@@ -45,22 +46,16 @@ import {
45
46
  Wgs84QuadTreeStrategy
46
47
  } from './quadTree/index.js';
47
48
 
48
- import pkg from "../../package.json";
49
49
 
50
50
  import { Object3d } from './Object3d.js';
51
51
  const { Handler } = webgl, { Control } = control;
52
- const { Layer, Vector, XYZ} = layer;
52
+ const { Layer, Vector, XYZ, CanvasTiles} = layer;
53
53
  const {
54
54
  EntityCollection,
55
55
  Entity
56
56
  } = entity;
57
57
 
58
- const version = {
59
- version: pkg.version
60
- };
61
-
62
58
  export {
63
- version,
64
59
  bv,
65
60
  jd,
66
61
  math,
@@ -70,6 +65,7 @@ export {
70
65
  Layer,
71
66
  XYZ,
72
67
  Vector,
68
+ CanvasTiles,
73
69
  layer,
74
70
  terrain,
75
71
  Control,
@@ -78,6 +74,7 @@ export {
78
74
  wgs84,
79
75
  Camera,
80
76
  Ellipsoid,
77
+ Planet,
81
78
  PlanetCamera,
82
79
  Globe,
83
80
  LightSource,
@@ -51,6 +51,7 @@ class CanvasTiles extends Layer {
51
51
  this.animated = options.animated || false;
52
52
 
53
53
  this.minNativeZoom = options.minNativeZoom || 0;
54
+ this.maxNativeZoom = options.maxNativeZoom || 100;
54
55
  /**
55
56
  * Current creating tiles couter.
56
57
  * @protected
@@ -176,19 +177,21 @@ class CanvasTiles extends Layer {
176
177
  that.events.dispatch(e, material);
177
178
  }
178
179
  requestAnimationFrame(() => {
179
- that.drawTile(material, /**
180
- * Apply canvas.
181
- * @callback applyCanvasCallback
182
- * @param {Object} canvas -
183
- */
184
- function (canvas) {
185
- that._counter--;
186
- CanvasTiles.__requestsCounter--;
187
- if (material.isLoading) {
188
- material.applyImage(canvas);
189
- }
190
- that._dequeueRequest();
191
- });
180
+ that.drawTile(
181
+ material,
182
+ /**
183
+ * Apply canvas.
184
+ * @callback applyCanvasCallback
185
+ * @param {Object} canvas -
186
+ */
187
+ function (canvas) {
188
+ that._counter--;
189
+ CanvasTiles.__requestsCounter--;
190
+ if (material.isLoading) {
191
+ material.applyImage(canvas);
192
+ }
193
+ that._dequeueRequest();
194
+ });
192
195
  });
193
196
  } else {
194
197
  material.textureNotExists();
@@ -239,6 +242,12 @@ class CanvasTiles extends Layer {
239
242
 
240
243
  applyMaterial(material) {
241
244
  if (material.isReady) {
245
+
246
+ // IMPORTANT!
247
+ // Animated doesn't work withMaxNativeZoom
248
+ // It could be fixed with call drawTile method only for parent
249
+ // material (which is rendered on the current segment material),
250
+ // just for one renderer frame
242
251
  if (material.layer.animated) {
243
252
  requestAnimationFrame(() => {
244
253
  this.drawTile(material, function (canvas) {
@@ -246,15 +255,19 @@ class CanvasTiles extends Layer {
246
255
  });
247
256
  });
248
257
  }
249
- return [0, 0, 1, 1];
258
+
259
+ return material.texOffset;
260
+
250
261
  } else if (material.segment.tileZoom < this.minNativeZoom) {
251
262
  material.textureNotExists();
252
263
  } else {
253
264
 
254
265
  let segment = material.segment;
255
- let pn = segment.node, notEmpty = false;
266
+ let pn = segment.node,
267
+ parentTextureExists = false;
268
+ let maxNativeZoom = material.layer.maxNativeZoom;
256
269
 
257
- if (segment.passReady && !material.isLoading) {
270
+ if (segment.passReady && !material.isLoading && segment.tileZoom <= maxNativeZoom) {
258
271
  this.loadMaterial(material);
259
272
  }
260
273
 
@@ -263,14 +276,41 @@ class CanvasTiles extends Layer {
263
276
  while (pn.parentNode) {
264
277
  pn = pn.parentNode;
265
278
  psegm = pn.segment.materials[mId];
266
- if (psegm && psegm.isReady) {
267
- notEmpty = true;
279
+ if (psegm && psegm.textureExists) {
280
+ parentTextureExists = true;
268
281
  break;
269
282
  }
270
283
  }
271
284
 
272
- if (notEmpty) {
285
+ if (segment.passReady) {
286
+ if (pn.segment.tileZoom === maxNativeZoom) {
287
+ if (segment.tileZoom > maxNativeZoom) {
288
+ material.textureNotExists();
289
+ }
290
+ } else if (pn.segment.tileZoom < maxNativeZoom) {
291
+
292
+ let pn = segment.node;
293
+ while (pn.segment.tileZoom > maxNativeZoom) {
294
+ pn = pn.parentNode;
295
+ }
296
+
297
+ let pnm = pn.segment.materials[mId];
298
+ if (pnm) {
299
+ !pnm.isLoading && !pnm.isReady && this.loadMaterial(pnm);
300
+ } else {
301
+ pnm = pn.segment.materials[material.layer._id] = material.layer.createMaterial(
302
+ pn.segment
303
+ );
304
+ this.loadMaterial(pnm);
305
+ }
306
+ }
307
+ }
308
+
309
+ if (parentTextureExists) {
273
310
 
311
+ //
312
+ // Animated doesn't work withMaxNativeZoom
313
+ //
274
314
  if (material.layer.animated) {
275
315
  requestAnimationFrame(() => {
276
316
  this.drawTile(material, function (canvas) {
@@ -281,20 +321,27 @@ class CanvasTiles extends Layer {
281
321
 
282
322
  material.appliedNodeId = pn.nodeId;
283
323
  material.texture = psegm.texture;
284
-
285
324
  let dZ2 = 1.0 / (2 << (segment.tileZoom - pn.segment.tileZoom - 1));
286
- return [segment.tileX * dZ2 - pn.segment.tileX, segment.tileY * dZ2 - pn.segment.tileY, dZ2, dZ2];
325
+ material.texOffset[0] = segment.tileX * dZ2 - pn.segment.tileX;
326
+ material.texOffset[1] = segment.tileY * dZ2 - pn.segment.tileY;
327
+ material.texOffset[2] = dZ2;
328
+ material.texOffset[3] = dZ2;
287
329
  } else {
288
330
  material.texture = segment.planet.transparentTexture;
289
- return [0, 0, 1, 1];
331
+ material.texOffset[0] = 0.0;
332
+ material.texOffset[1] = 0.0;
333
+ material.texOffset[2] = 1.0;
334
+ material.texOffset[3] = 1.0;
290
335
  }
291
336
  }
337
+
338
+ return material.texOffset;
292
339
  }
293
340
 
294
341
  clearMaterial(material) {
295
342
  if (material.isReady) {
296
343
  material.isReady = false;
297
- if (material.texture && !material.texture.default) {
344
+ if (material.textureExists && material.texture && !material.texture.default) {
298
345
  material.segment.handler.gl.deleteTexture(material.texture);
299
346
  material.texture = null;
300
347
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { nextHighestPowerOfTwo } from "../math.js";
8
8
  import { BaseGeoImage } from "./BaseGeoImage.js";
9
+ import { isImageLoaded } from "../utils/shared.js";
9
10
 
10
11
  /**
11
12
  * Used to load and display a single image over specific corner coordinates on the globe, implements og.layer.BaseGeoImage interface.
@@ -48,6 +49,11 @@ class GeoImage extends BaseGeoImage {
48
49
  this._planet && this._planet._geoImageCreator.remove(this);
49
50
  this._src = src;
50
51
  this._sourceReady = false;
52
+ this._sourceCreated = false;
53
+ this._image = new Image();
54
+ this._onLoad_ = this._onLoad.bind(this);
55
+ this._image.addEventListener("load", this._onLoad_);
56
+ this._image.src = src;
51
57
  }
52
58
 
53
59
  /**
@@ -57,9 +63,16 @@ class GeoImage extends BaseGeoImage {
57
63
  */
58
64
  setImage(image) {
59
65
  this._planet && this._planet._geoImageCreator.remove(this);
66
+ this._sourceCreated = false;
67
+ this._sourceReady = false;
60
68
  this._image = image;
61
69
  this._src = image.src;
62
- this._sourceReady = false;
70
+ if (isImageLoaded(this._image)) {
71
+ this._applyImage(this._image);
72
+ } else {
73
+ this._onLoad_ = this._onLoad.bind(this);
74
+ this._image.addEventListener("load", this._onLoad_);
75
+ }
63
76
  }
64
77
 
65
78
  /**
@@ -76,15 +89,28 @@ class GeoImage extends BaseGeoImage {
76
89
 
77
90
  /**
78
91
  * @private
79
- * @param {Image} img
92
+ * @param {Image} [img]
93
+ */
94
+ _onLoad() {
95
+ this._applyImage(this._image);
96
+ this._image.removeEventListener("load", this._onLoad_);
97
+ this._onLoad_ = undefined;
98
+ }
99
+
100
+ /**
101
+ * @private
102
+ * @param {Image} [img]
80
103
  */
81
- _onLoad(img) {
82
- this._frameWidth = nextHighestPowerOfTwo(img.width * 2, 4096);
83
- this._frameHeight = nextHighestPowerOfTwo(img.height * 3, 4096);
84
- this._sourceReady = true;
85
- this._planet._geoImageCreator.add(this);
104
+ _applyImage(img) {
105
+ if (img) {
106
+ this._frameWidth = nextHighestPowerOfTwo(img.width * 2, 4096);
107
+ this._frameHeight = nextHighestPowerOfTwo(img.height * 3, 4096);
108
+ this._sourceReady = true;
109
+ this._planet._geoImageCreator.add(this);
110
+ }
86
111
  }
87
112
 
113
+
88
114
  /**
89
115
  * Loads planet segment material. In this case - GeoImage source image.
90
116
  * @virtual
@@ -96,20 +122,16 @@ class GeoImage extends BaseGeoImage {
96
122
  this._creationProceeding = true;
97
123
  if (!this._sourceReady && this._src) {
98
124
  if (this._image) {
99
- if (this._image.complete) {
100
- this._onLoad(this._image);
101
- } else if (this._image.src) {
102
- let that = this;
103
- this._image.addEventListener("load", function (e) {
104
- that._onLoad(this);
105
- });
125
+ if (isImageLoaded(this._image)) {
126
+ this._applyImage(this._image);
127
+ } else {
128
+ this._onLoad_ = this._onLoad.bind(this);
129
+ this._image.addEventListener("load", this._onLoad_);
106
130
  }
107
131
  } else {
108
- let that = this;
109
132
  this._image = new Image();
110
- this._image.addEventListener("load", function (e) {
111
- that._onLoad(this);
112
- });
133
+ this._onLoad_ = this._onLoad.bind(this);
134
+ this._image.addEventListener("load", this._onLoad_);
113
135
  this._image.src = this._src;
114
136
  }
115
137
  } else {
@@ -239,7 +239,7 @@ class Vector extends Layer {
239
239
  * Adds entity to the layer.
240
240
  * @public
241
241
  * @param {Entity} entity - Entity.
242
- * @param {boolean} [rightNow] - Entity insertion option. False is deafult.
242
+ * @param {boolean} [rightNow] - Entity insertion option. False is default.
243
243
  * @returns {layer.Vector} - Returns this layer.
244
244
  */
245
245
  add(entity, rightNow) {
@@ -258,7 +258,7 @@ class Vector extends Layer {
258
258
  * @public
259
259
  * @param {Entity} entity - Entity.
260
260
  * @param {Number} index - Index position.
261
- * @param {boolean} [rightNow] - Entity insertion option. False is deafult.
261
+ * @param {boolean} [rightNow] - Entity insertion option. False is default.
262
262
  * @returns {layer.Vector} - Returns this layer.
263
263
  */
264
264
  insert(entity, index, rightNow) {
@@ -336,7 +336,7 @@ class Vector extends Layer {
336
336
  * Adds entity array to the layer.
337
337
  * @public
338
338
  * @param {Array.<Entity>} entities - Entities array.
339
- * @param {boolean} [rightNow] - Entity insertion option. False is deafult.
339
+ * @param {boolean} [rightNow] - Entity insertion option. False is default.
340
340
  * @returns {layer.Vector} - Returns this layer.
341
341
  */
342
342
  addEntities(entities, rightNow) {
@@ -844,7 +844,8 @@ class Vector extends Layer {
844
844
 
845
845
  // Merc nodes
846
846
  this._secondPASS = [];
847
- this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
847
+ this._entityCollectionsTree &&
848
+ this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
848
849
  var i = this._secondPASS.length;
849
850
  while (i--) {
850
851
  this._secondPASS[i].collectRenderCollectionsPASS2(
@@ -856,9 +857,10 @@ class Vector extends Layer {
856
857
 
857
858
  // North nodes
858
859
  this._secondPASS = [];
859
- this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
860
- p._visibleNodesNorth,
861
- outArr
860
+ this._entityCollectionsTreeNorth &&
861
+ this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
862
+ p._visibleNodesNorth,
863
+ outArr
862
864
  );
863
865
  i = this._secondPASS.length;
864
866
  while (i--) {
@@ -871,10 +873,11 @@ class Vector extends Layer {
871
873
 
872
874
  // South nodes
873
875
  this._secondPASS = [];
874
- this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
875
- p._visibleNodesSouth,
876
- outArr
877
- );
876
+ this._entityCollectionsTreeSouth &&
877
+ this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
878
+ p._visibleNodesSouth,
879
+ outArr
880
+ );
878
881
  i = this._secondPASS.length;
879
882
  while (i--) {
880
883
  this._secondPASS[i].collectRenderCollectionsPASS2(
@@ -97,8 +97,8 @@ class WMS extends XYZ {
97
97
  extra
98
98
 
99
99
  ) {
100
- return `${url}/wms?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}
101
- &SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}&` + extra;
100
+ return `${url}/?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}&SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}` +
101
+ (extra ? `&${extra}` : "");
102
102
  }
103
103
 
104
104
  static get_bbox_v1_1_1(extent) {
package/src/og/math.js CHANGED
@@ -225,7 +225,8 @@ export function step(edge, x) {
225
225
  * @returns {number} -
226
226
  */
227
227
  export function frac(x) {
228
- return x - Math.floor(x);
228
+ const mx = Math.abs(x)
229
+ return mx - Math.floor(mx);
229
230
  }
230
231
 
231
232
  /**
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ import { Extent } from "../Extent.js";
3
+ import { EPSG4326 } from "../proj/EPSG4326.js";
4
+ import { Node } from "../quadTree/Node.js";
5
+ import * as quadTree from "../quadTree/quadTree.js";
6
+ import { SegmentLonLatWgs84 } from "../segment/SegmentLonLatWgs84.js";
7
+ import { QuadTreeStrategy } from "./QuadTreeStrategy.js";
8
+
9
+ export class EPSG4326QuadTreeStrategy extends QuadTreeStrategy {
10
+ constructor(options = {}) {
11
+ super(options);
12
+ this.name = "EPSG4326";
13
+ this.projection = EPSG4326;
14
+ }
15
+
16
+ init() {
17
+ let earthQuadTreeSouth = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0,
18
+ Extent.createFromArray([-180, -90, 0, 90])
19
+ );
20
+ let earthQuadTreeWest = new Node(SegmentLonLatWgs84, this.planet, quadTree.NW, null, 0, 0,
21
+ Extent.createFromArray([0, -90, 180, 90])
22
+ );
23
+ this._quadTreeList.push(earthQuadTreeSouth);
24
+ this._quadTreeList.push(earthQuadTreeWest);
25
+ }
26
+ }