@openglobus/og 0.11.5 → 0.11.6

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 (145) hide show
  1. package/package.json +5 -7
  2. package/src/og/Clock.js +6 -10
  3. package/src/og/Events.js +5 -7
  4. package/src/og/Extent.js +73 -32
  5. package/src/og/ImageCanvas.js +18 -15
  6. package/src/og/LonLat.js +13 -10
  7. package/src/og/Popup.js +18 -17
  8. package/src/og/QueueArray.js +3 -4
  9. package/src/og/Rectangle.js +4 -6
  10. package/src/og/Stack.js +2 -4
  11. package/src/og/ajax.js +20 -14
  12. package/src/og/astro/earth.js +21 -15
  13. package/src/og/bv/Box.js +2 -3
  14. package/src/og/bv/Sphere.js +10 -7
  15. package/src/og/camera/Frustum.js +19 -12
  16. package/src/og/camera/PlanetCamera.js +0 -1
  17. package/src/og/control/CompassButton.js +1 -2
  18. package/src/og/control/Control.js +7 -9
  19. package/src/og/control/DebugInfo.js +0 -1
  20. package/src/og/control/KeyboardNavigation.js +9 -9
  21. package/src/og/control/LayerSwitcher.js +21 -20
  22. package/src/og/control/SegmentBoundVisualization.js +5 -6
  23. package/src/og/control/ShowFps.js +12 -7
  24. package/src/og/control/SimpleNavigation.js +5 -7
  25. package/src/og/control/Sun.js +22 -12
  26. package/src/og/control/ToggleWireframe.js +3 -3
  27. package/src/og/control/TouchNavigation.js +43 -32
  28. package/src/og/control/ZoomControl.js +40 -24
  29. package/src/og/ellipsoid/Ellipsoid.js +148 -56
  30. package/src/og/ellipsoid/wgs84.js +3 -3
  31. package/src/og/entity/BaseBillboard.js +65 -14
  32. package/src/og/entity/Billboard.js +9 -5
  33. package/src/og/entity/BillboardHandler.js +310 -64
  34. package/src/og/entity/Entity.js +39 -1
  35. package/src/og/entity/EntityCollection.js +47 -24
  36. package/src/og/entity/GeoObject.js +228 -0
  37. package/src/og/entity/GeoObjectHandler.js +910 -0
  38. package/src/og/entity/GeometryHandler.js +595 -123
  39. package/src/og/entity/Label.js +53 -18
  40. package/src/og/entity/LabelHandler.js +42 -244
  41. package/src/og/entity/LabelWorker.js +213 -0
  42. package/src/og/entity/Object3d.js +504 -0
  43. package/src/og/entity/PointCloud.js +76 -28
  44. package/src/og/entity/PointCloudHandler.js +5 -5
  45. package/src/og/entity/Ray.js +49 -16
  46. package/src/og/entity/Strip.js +72 -43
  47. package/src/og/entity/StripHandler.js +23 -23
  48. package/src/og/layer/BaseGeoImage.js +50 -19
  49. package/src/og/layer/CanvasTiles.js +16 -16
  50. package/src/og/layer/GeoImage.js +6 -6
  51. package/src/og/layer/KML.js +55 -33
  52. package/src/og/layer/Layer.js +3 -3
  53. package/src/og/layer/Vector.js +94 -48
  54. package/src/og/layer/WMS.js +33 -16
  55. package/src/og/light/LightSource.js +19 -12
  56. package/src/og/math/Mat3.js +24 -12
  57. package/src/og/math/Mat4.js +603 -603
  58. package/src/og/math/Plane.js +19 -18
  59. package/src/og/math/Ray.js +17 -12
  60. package/src/og/math/Vec2.js +24 -14
  61. package/src/og/math/Vec3.js +60 -30
  62. package/src/og/math/coder.js +7 -7
  63. package/src/og/proj/EPSG3857.js +3 -3
  64. package/src/og/proj/EPSG4326.js +3 -3
  65. package/src/og/proj/Proj.js +2 -4
  66. package/src/og/quadTree/Node.js +31 -17
  67. package/src/og/renderer/Renderer.js +23 -6
  68. package/src/og/renderer/RendererEvents.js +1 -1
  69. package/src/og/scene/BaseNode.js +2 -3
  70. package/src/og/scene/Planet.js +2 -2
  71. package/src/og/scene/RenderNode.js +15 -8
  72. package/src/og/shaders/geoObject.js +211 -0
  73. package/src/og/shaders/pointCloud.js +41 -41
  74. package/src/og/shaders/shape.js +12 -18
  75. package/src/og/shaders/skybox.js +36 -36
  76. package/src/og/shapes/BaseShape.js +107 -35
  77. package/src/og/shapes/Icosphere.js +25 -10
  78. package/src/og/shapes/Sphere.js +8 -11
  79. package/src/og/utils/TextureAtlas.js +16 -18
  80. package/src/og/utils/shared.js +1 -1
  81. package/src/og/webgl/Handler.js +68 -49
  82. package/src/og/webgl/Multisample.js +44 -16
  83. package/src/og/webgl/Program.js +78 -33
  84. package/src/og/webgl/callbacks.js +3 -3
  85. package/types/Deferred.d.ts +1 -1
  86. package/types/Events.d.ts +2 -2
  87. package/types/Extent.d.ts +1 -1
  88. package/types/Rectangle.d.ts +1 -1
  89. package/types/ajax.d.ts +1 -1
  90. package/types/bv/Box.d.ts +1 -1
  91. package/types/bv/Sphere.d.ts +1 -1
  92. package/types/camera/Camera.d.ts +5 -5
  93. package/types/camera/Frustum.d.ts +6 -6
  94. package/types/camera/PlanetCamera.d.ts +8 -8
  95. package/types/control/Control.d.ts +1 -1
  96. package/types/control/EarthCoordinates.d.ts +1 -1
  97. package/types/control/Sun.d.ts +1 -1
  98. package/types/entity/BaseBillboard.d.ts +15 -8
  99. package/types/entity/Entity.d.ts +24 -9
  100. package/types/entity/EntityCollection.d.ts +15 -9
  101. package/types/entity/GeoObject.d.ts +111 -0
  102. package/types/entity/GeoObjectHandler.d.ts +77 -0
  103. package/types/entity/Geometry.d.ts +1 -1
  104. package/types/entity/GeometryHandler.d.ts +1 -1
  105. package/types/entity/Label.d.ts +3 -3
  106. package/types/entity/LabelHandler.d.ts +2 -0
  107. package/types/entity/LabelWorker.d.ts +9 -0
  108. package/types/entity/PointCloud.d.ts +1 -1
  109. package/types/entity/Polyline.d.ts +5 -5
  110. package/types/entity/Ray.d.ts +1 -1
  111. package/types/entity/Strip.d.ts +1 -1
  112. package/types/layer/BaseGeoImage.d.ts +3 -3
  113. package/types/layer/CanvasTiles.d.ts +5 -5
  114. package/types/layer/GeoImage.d.ts +1 -1
  115. package/types/layer/GeoVideo.d.ts +1 -1
  116. package/types/layer/Layer.d.ts +5 -5
  117. package/types/layer/Vector.d.ts +9 -9
  118. package/types/layer/XYZ.d.ts +3 -3
  119. package/types/light/LightSource.d.ts +7 -7
  120. package/types/math/Plane.d.ts +1 -1
  121. package/types/math/Ray.d.ts +1 -1
  122. package/types/math/Vec2.d.ts +34 -34
  123. package/types/math/Vec3.d.ts +1 -1
  124. package/types/math/Vec4.d.ts +1 -1
  125. package/types/math/coder.d.ts +1 -1
  126. package/types/math.d.ts +1 -1
  127. package/types/proj/Proj.d.ts +2 -2
  128. package/types/quadTree/Node.d.ts +1 -1
  129. package/types/renderer/Renderer.d.ts +12 -10
  130. package/types/renderer/RendererEvents.d.ts +1 -1
  131. package/types/scene/BaseNode.d.ts +4 -4
  132. package/types/scene/Planet.d.ts +40 -40
  133. package/types/scene/RenderNode.d.ts +9 -9
  134. package/types/segment/Segment.d.ts +9 -9
  135. package/types/shaders/geoObject.d.ts +3 -0
  136. package/types/shapes/BaseShape.d.ts +5 -5
  137. package/types/terrain/EmptyTerrain.d.ts +2 -2
  138. package/types/terrain/GlobusTerrain.d.ts +4 -4
  139. package/types/utils/TextureAtlas.d.ts +4 -4
  140. package/types/utils/shared.d.ts +9 -9
  141. package/types/webgl/Framebuffer.d.ts +1 -1
  142. package/types/webgl/Handler.d.ts +16 -7
  143. package/types/webgl/Multisample.d.ts +2 -2
  144. package/types/webgl/Program.d.ts +6 -0
  145. package/types/webgl/ProgramController.d.ts +1 -1
@@ -2,11 +2,11 @@
2
2
  * @module og/layer/KML
3
3
  */
4
4
 
5
- 'use strict';
6
- import { Entity } from '../entity/Entity.js';
7
- import { Extent } from '../Extent.js';
8
- import { LonLat } from '../LonLat.js';
9
- import { Vector } from './Vector.js';
5
+ "use strict";
6
+ import { Entity } from "../entity/Entity.js";
7
+ import { Extent } from "../Extent.js";
8
+ import { LonLat } from "../LonLat.js";
9
+ import { Vector } from "./Vector.js";
10
10
 
11
11
  /**
12
12
  * Layer to render KMLs files
@@ -14,32 +14,39 @@ import { Vector } from './Vector.js';
14
14
  * @extends {Vector}
15
15
  */
16
16
  export class KML extends Vector {
17
-
18
17
  /**
19
- *
20
- * @param {string} name
18
+ *
19
+ * @param {string} name
21
20
  * @param {*} [options]
22
21
  */
23
22
  constructor(name, options = {}) {
24
23
  super(name, options);
25
24
  this._extent = null;
26
- this._billboard = options.billboard || { src: 'https://openglobus.org/examples/billboards/carrot.png' };
25
+ this._billboard = options.billboard || {
26
+ src: "https://openglobus.org/examples/billboards/carrot.png"
27
+ };
27
28
  /**
28
29
  * @type {string}
29
30
  */
30
- this._color = options.color || '#6689db';
31
+ this._color = options.color || "#6689db";
31
32
  }
32
33
 
33
34
  get instanceName() {
34
- return 'KML';
35
+ return "KML";
35
36
  }
36
37
 
37
38
  /**
38
39
  * @private
39
40
  */
40
41
  _extractCoordonatesFromKml(xmlDoc) {
41
- const raw = Array.from(xmlDoc.getElementsByTagName('coordinates'));
42
- const coordinates = raw.map(item => item.textContent.trim().replace(/\n/g, ' ').split(' ').map(co => co.split(',').map(parseFloat)));
42
+ const raw = Array.from(xmlDoc.getElementsByTagName("coordinates"));
43
+ const coordinates = raw.map((item) =>
44
+ item.textContent
45
+ .trim()
46
+ .replace(/\n/g, " ")
47
+ .split(" ")
48
+ .map((co) => co.split(",").map(parseFloat))
49
+ );
43
50
  return coordinates;
44
51
  }
45
52
 
@@ -47,32 +54,35 @@ export class KML extends Vector {
47
54
  * Creates billboards or polylines from array of lonlat.
48
55
  * @private
49
56
  * @param {Array} coordonates
50
- * @param {string} color
57
+ * @param {string} color
51
58
  * @returns {Array<Entity>}
52
59
  */
53
60
  _convertCoordonatesIntoEntities(coordinates, color, billboard) {
54
61
  const extent = new Extent(new LonLat(180.0, 90.0), new LonLat(-180.0, -90.0));
55
62
  const addToExtent = (c) => {
56
- const lon = c[0], lat = c[1];
63
+ const lon = c[0],
64
+ lat = c[1];
57
65
  if (lon < extent.southWest.lon) extent.southWest.lon = lon;
58
66
  if (lat < extent.southWest.lat) extent.southWest.lat = lat;
59
67
  if (lon > extent.northEast.lon) extent.northEast.lon = lon;
60
68
  if (lat > extent.northEast.lat) extent.northEast.lat = lat;
61
69
  };
62
70
  const _pathes = [];
63
- coordinates.forEach(kmlFile => kmlFile.forEach(p => _pathes.push(p)));
64
- const entities = _pathes.map(path => {
71
+ coordinates.forEach((kmlFile) => kmlFile.forEach((p) => _pathes.push(p)));
72
+ const entities = _pathes.map((path) => {
65
73
  if (path.length === 1) {
66
74
  const lonlat = path[0];
67
75
  const _entity = new Entity({ lonlat, billboard });
68
76
  addToExtent(lonlat);
69
77
  return _entity;
70
78
  } else if (path.length > 1) {
71
- const pathLonLat = path.map(item => {
79
+ const pathLonLat = path.map((item) => {
72
80
  addToExtent(item);
73
81
  return new LonLat(item[0], item[1], item[2]);
74
82
  });
75
- const _entity = new Entity({ polyline: { pathLonLat: [pathLonLat], thickness: 3, color, isClosed: false } });
83
+ const _entity = new Entity({
84
+ polyline: { pathLonLat: [pathLonLat], thickness: 3, color, isClosed: false }
85
+ });
76
86
  return _entity;
77
87
  }
78
88
  });
@@ -84,9 +94,10 @@ export class KML extends Vector {
84
94
  * @returns {Document}
85
95
  */
86
96
  _getXmlContent(file) {
87
- return new Promise(resolve => {
97
+ return new Promise((resolve) => {
88
98
  const fileReader = new FileReader();
89
- fileReader.onload = async i => resolve((new DOMParser()).parseFromString(i.target.result, 'text/xml'));
99
+ fileReader.onload = async (i) =>
100
+ resolve(new DOMParser().parseFromString(i.target.result, "text/xml"));
90
101
  fileReader.readAsText(file);
91
102
  });
92
103
  }
@@ -96,10 +107,14 @@ export class KML extends Vector {
96
107
  */
97
108
  _expandExtents(extent1, extent2) {
98
109
  if (!extent1) return extent2;
99
- if (extent2.southWest.lon < extent1.southWest.lon) extent1.southWest.lon = extent2.southWest.lon;
100
- if (extent2.southWest.lat < extent1.southWest.lat) extent1.southWest.lat = extent2.southWest.lat;
101
- if (extent2.northEast.lon > extent1.northEast.lon) extent1.northEast.lon = extent2.northEast.lon;
102
- if (extent2.northEast.lat > extent1.northEast.lat) extent1.northEast.lat = extent2.northEast.lat;
110
+ if (extent2.southWest.lon < extent1.southWest.lon)
111
+ extent1.southWest.lon = extent2.southWest.lon;
112
+ if (extent2.southWest.lat < extent1.southWest.lat)
113
+ extent1.southWest.lat = extent2.southWest.lat;
114
+ if (extent2.northEast.lon > extent1.northEast.lon)
115
+ extent1.northEast.lon = extent2.northEast.lon;
116
+ if (extent2.northEast.lat > extent1.northEast.lat)
117
+ extent1.northEast.lat = extent2.northEast.lat;
103
118
  return extent1;
104
119
  }
105
120
 
@@ -111,14 +126,18 @@ export class KML extends Vector {
111
126
  async addKmlFromFiles(kmls) {
112
127
  const kmlObjs = await Promise.all(kmls.map(this._getXmlContent));
113
128
  const coordonates = kmlObjs.map(this._extractCoordonatesFromKml);
114
- const { entities, extent } = this._convertCoordonatesIntoEntities(coordonates, this._color, this._billboard);
129
+ const { entities, extent } = this._convertCoordonatesIntoEntities(
130
+ coordonates,
131
+ this._color,
132
+ this._billboard
133
+ );
115
134
  this._extent = this._expandExtents(this._extent, extent);
116
135
  entities.forEach(this.add.bind(this));
117
136
  return { entities, extent };
118
137
  }
119
138
 
120
139
  /**
121
- * @param {string} color
140
+ * @param {string} color
122
141
  * @public
123
142
  */
124
143
  setColor(color) {
@@ -132,14 +151,14 @@ export class KML extends Vector {
132
151
  _getKmlFromUrl(url) {
133
152
  return new Promise((resolve, reject) => {
134
153
  const request = new XMLHttpRequest();
135
- request.open('GET', url, true);
136
- request.responseType = 'document';
137
- request.overrideMimeType('text/xml');
154
+ request.open("GET", url, true);
155
+ request.responseType = "document";
156
+ request.overrideMimeType("text/xml");
138
157
  request.onload = () => {
139
158
  if (request.readyState === request.DONE && request.status === 200) {
140
159
  resolve(request.responseXML);
141
160
  } else {
142
- reject(new Error('no valid kml file'));
161
+ reject(new Error("no valid kml file"));
143
162
  }
144
163
  };
145
164
  request.send();
@@ -154,10 +173,13 @@ export class KML extends Vector {
154
173
  async addKmlFromUrl(url) {
155
174
  const kml = await this._getKmlFromUrl(url);
156
175
  const coordonates = this._extractCoordonatesFromKml(kml);
157
- const { entities, extent } = this._convertCoordonatesIntoEntities([coordonates], this._color, this._billboard);
176
+ const { entities, extent } = this._convertCoordonatesIntoEntities(
177
+ [coordonates],
178
+ this._color,
179
+ this._billboard
180
+ );
158
181
  this._extent = this._expandExtents(this._extent, extent);
159
182
  entities.forEach(this.add.bind(this));
160
183
  return { entities, extent };
161
184
  }
162
-
163
185
  }
@@ -33,7 +33,7 @@ export const FADING_FACTOR = 0.29;
33
33
  * @param {Vec3} [options.ambient=[0.1, 0.1, 0.21]] - Ambient RGB color.
34
34
  * @param {Vec3} [options.diffuse=[1.0, 1.0, 1.0]] - Diffuse RGB color.
35
35
  * @param {Vec3} [options.specular=[0.00025, 0.00015, 0.0001]] - Specular RGB color.
36
- * @param {string} [options.textureFilter=["anisotrophyc"]] - Image texture filter. Available values: "nearest", "linear", "mipmap" and "anisotrophic".
36
+ * @param {string} [options.textureFilter="anisotropic"] - Image texture filter. Available values: "nearest", "linear", "mipmap" and "anisotropic".
37
37
  * @param {Number} [options.shininess=100] - Shininess.
38
38
  *
39
39
  * @fires og.Layer#visibilitychange
@@ -188,9 +188,9 @@ class Layer {
188
188
  if (options.textureFilter) {
189
189
  this.createTexture =
190
190
  createTexture[options.textureFilter.trim().toUpperCase()] ||
191
- createTexture.ANISOTROPHIC;
191
+ createTexture.ANISOTROPIC;
192
192
  } else {
193
- this.createTexture = createTexture.ANISOTROPHIC;
193
+ this.createTexture = createTexture.ANISOTROPIC;
194
194
  }
195
195
 
196
196
  /**
@@ -2,19 +2,22 @@
2
2
  * @module og/layer/Vector
3
3
  */
4
4
 
5
- 'use strict';
6
-
7
- import * as math from '../math.js';
8
- import * as mercator from '../mercator.js';
9
- import * as quadTree from '../quadTree/quadTree.js';
10
- import { Entity } from '../entity/Entity.js';
11
- import { EntityCollection } from '../entity/EntityCollection.js';
12
- import { Extent } from '../Extent.js';
13
- import { EntityCollectionNode, EntityCollectionNodeWGS84 } from '../quadTree/EntityCollectionNode.js';
14
- import { GeometryHandler } from '../entity/GeometryHandler.js';
15
- import { Layer } from './Layer.js';
16
- import { QueueArray } from '../QueueArray.js';
17
- import { Vec3 } from '../math/Vec3.js';
5
+ "use strict";
6
+
7
+ import * as math from "../math.js";
8
+ import * as mercator from "../mercator.js";
9
+ import * as quadTree from "../quadTree/quadTree.js";
10
+ import { Entity } from "../entity/Entity.js";
11
+ import { EntityCollection } from "../entity/EntityCollection.js";
12
+ import { Extent } from "../Extent.js";
13
+ import {
14
+ EntityCollectionNode,
15
+ EntityCollectionNodeWGS84
16
+ } from "../quadTree/EntityCollectionNode.js";
17
+ import { GeometryHandler } from "../entity/GeometryHandler.js";
18
+ import { Layer } from "./Layer.js";
19
+ import { QueueArray } from "../QueueArray.js";
20
+ import { Vec3 } from "../math/Vec3.js";
18
21
 
19
22
  /**
20
23
  * Creates entity instance array.
@@ -68,13 +71,11 @@ function _entitiesConstructor(entities) {
68
71
  * @fires og.layer.Vector#visibilitychange
69
72
  */
70
73
  class Vector extends Layer {
71
-
72
74
  /**
73
- * @param {string} name
75
+ * @param {string} name
74
76
  * @param {*} [options]
75
77
  */
76
78
  constructor(name, options = {}) {
77
-
78
79
  super(name, options);
79
80
 
80
81
  this.events.registerNames(EVENT_NAMES);
@@ -160,14 +161,16 @@ class Vector extends Layer {
160
161
  * @public
161
162
  * @type {Number}
162
163
  */
163
- this.polygonOffsetFactor = options.polygonOffsetFactor != undefined ? options.polygonOffsetFactor : 0.0;
164
+ this.polygonOffsetFactor =
165
+ options.polygonOffsetFactor != undefined ? options.polygonOffsetFactor : 0.0;
164
166
 
165
167
  /**
166
168
  * Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.
167
169
  * @public
168
170
  * @type {Number}
169
171
  */
170
- this.polygonOffsetUnits = options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : -637000.0;
172
+ this.polygonOffsetUnits =
173
+ options.polygonOffsetUnits != undefined ? options.polygonOffsetUnits : -637000.0;
171
174
 
172
175
  this.pickingEnabled = this._pickingEnabled;
173
176
  }
@@ -277,7 +280,6 @@ class Vector extends Layer {
277
280
  }
278
281
 
279
282
  _proceedEntity(entity, rightNow) {
280
-
281
283
  let temp = this._hasImageryTiles;
282
284
 
283
285
  //
@@ -302,9 +304,10 @@ class Vector extends Layer {
302
304
 
303
305
  if (entity.billboard || entity.label) {
304
306
  if (this._planet) {
305
-
306
307
  if (entity._cartesian.isZero() && !entity._lonlat.isZero()) {
307
- entity._setCartesian3vSilent(this._planet.ellipsoid.lonLatToCartesian(entity._lonlat));
308
+ entity._setCartesian3vSilent(
309
+ this._planet.ellipsoid.lonLatToCartesian(entity._lonlat)
310
+ );
308
311
  } else {
309
312
  entity._lonlat = this._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
310
313
  }
@@ -367,15 +370,17 @@ class Vector extends Layer {
367
370
  node.count--;
368
371
  node = node.parentNode;
369
372
  }
370
- if (entity._nodePtr && entity._nodePtr.count === 0 &&
371
- entity._nodePtr.deferredEntities.length === 0) {
373
+ if (
374
+ entity._nodePtr &&
375
+ entity._nodePtr.count === 0 &&
376
+ entity._nodePtr.deferredEntities.length === 0
377
+ ) {
372
378
  entity._nodePtr.entityCollection = null;
373
379
  //
374
380
  // ...
375
381
  //
376
382
  }
377
- } else if (entity._nodePtr &&
378
- entity._nodePtr.deferredEntities.length) {
383
+ } else if (entity._nodePtr && entity._nodePtr.deferredEntities.length) {
379
384
  var defEntities = entity._nodePtr.deferredEntities;
380
385
  var j = defEntities.length;
381
386
  while (j--) {
@@ -478,7 +483,6 @@ class Vector extends Layer {
478
483
  * @public
479
484
  */
480
485
  clear() {
481
-
482
486
  let temp = new Array(this._entities.length);
483
487
 
484
488
  for (let i = 0; i < temp.length; i++) {
@@ -521,7 +525,6 @@ class Vector extends Layer {
521
525
  * @returns {layer.Vector} - Returns layer instance.
522
526
  */
523
527
  setEntities(entities) {
524
-
525
528
  let temp = new Array(entities.length);
526
529
  for (let i = 0, len = entities.length; i < len; i++) {
527
530
  temp[i] = entities[i];
@@ -573,12 +576,33 @@ class Vector extends Layer {
573
576
 
574
577
  _createEntityCollectionsTree(entitiesForTree) {
575
578
  if (this._planet) {
576
- this._entityCollectionsTree = new EntityCollectionNode(this, quadTree.NW, null, 0,
577
- Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34]), this._planet, 0);
578
- this._entityCollectionsTreeNorth = new EntityCollectionNodeWGS84(this, quadTree.NW, null, 0,
579
- Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90]), this._planet, 0);
580
- this._entityCollectionsTreeSouth = new EntityCollectionNodeWGS84(this, quadTree.NW, null, 0,
581
- Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]), this._planet, 0);
579
+ this._entityCollectionsTree = new EntityCollectionNode(
580
+ this,
581
+ quadTree.NW,
582
+ null,
583
+ 0,
584
+ Extent.createFromArray([-20037508.34, -20037508.34, 20037508.34, 20037508.34]),
585
+ this._planet,
586
+ 0
587
+ );
588
+ this._entityCollectionsTreeNorth = new EntityCollectionNodeWGS84(
589
+ this,
590
+ quadTree.NW,
591
+ null,
592
+ 0,
593
+ Extent.createFromArray([-180, mercator.MAX_LAT, 180, 90]),
594
+ this._planet,
595
+ 0
596
+ );
597
+ this._entityCollectionsTreeSouth = new EntityCollectionNodeWGS84(
598
+ this,
599
+ quadTree.NW,
600
+ null,
601
+ 0,
602
+ Extent.createFromArray([-180, -90, 180, mercator.MIN_LAT]),
603
+ this._planet,
604
+ 0
605
+ );
582
606
 
583
607
  for (let i = 0, len = entitiesForTree.length; i < len; i++) {
584
608
  let entity = entitiesForTree[i];
@@ -682,7 +706,6 @@ class Vector extends Layer {
682
706
  }
683
707
 
684
708
  _collectStripCollectionPASS(outArr) {
685
-
686
709
  var ec = this._stripEntityCollection;
687
710
 
688
711
  ec._fadingOpacity = this._fadingOpacity;
@@ -699,7 +722,6 @@ class Vector extends Layer {
699
722
  }
700
723
 
701
724
  _collectPolylineCollectionPASS(outArr) {
702
-
703
725
  var ec = this._polylineEntityCollection;
704
726
 
705
727
  ec._fadingOpacity = this._fadingOpacity;
@@ -737,7 +759,12 @@ class Vector extends Layer {
737
759
  if (seg._extent.isInside(ll)) {
738
760
  let cart = p._path3v[c_j][c_j_h];
739
761
  seg.getTerrainPoint(cart, ll, res);
740
- p.setPoint3v(res.addA(res.normal().scale((rtg && p.altitude) || 0.0)), c_j_h, c_j, true);
762
+ p.setPoint3v(
763
+ res.addA(res.normal().scale((rtg && p.altitude) || 0.0)),
764
+ c_j_h,
765
+ c_j,
766
+ true
767
+ );
741
768
  break;
742
769
  }
743
770
  }
@@ -751,9 +778,10 @@ class Vector extends Layer {
751
778
  collectVisibleCollections(outArr) {
752
779
  var p = this._planet;
753
780
 
754
- if ((this._fading && this._fadingOpacity > 0.0) ||
755
- (this.minZoom <= this._planet.maxCurrZoom && this.maxZoom >= p.maxCurrZoom)) {
756
-
781
+ if (
782
+ (this._fading && this._fadingOpacity > 0.0) ||
783
+ (this.minZoom <= this._planet.maxCurrZoom && this.maxZoom >= p.maxCurrZoom)
784
+ ) {
757
785
  this._renderingNodes = {};
758
786
  this._renderingNodesNorth = {};
759
787
  this._renderingNodesSouth = {};
@@ -768,23 +796,41 @@ class Vector extends Layer {
768
796
  this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
769
797
  var i = this._secondPASS.length;
770
798
  while (i--) {
771
- this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodes, outArr, this._secondPASS[i].nodeId);
799
+ this._secondPASS[i].collectRenderCollectionsPASS2(
800
+ p._visibleNodes,
801
+ outArr,
802
+ this._secondPASS[i].nodeId
803
+ );
772
804
  }
773
805
 
774
806
  // North nodes
775
807
  this._secondPASS = [];
776
- this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(p._visibleNodesNorth, outArr);
808
+ this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
809
+ p._visibleNodesNorth,
810
+ outArr
811
+ );
777
812
  i = this._secondPASS.length;
778
813
  while (i--) {
779
- this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodesNorth, outArr, this._secondPASS[i].nodeId);
814
+ this._secondPASS[i].collectRenderCollectionsPASS2(
815
+ p._visibleNodesNorth,
816
+ outArr,
817
+ this._secondPASS[i].nodeId
818
+ );
780
819
  }
781
820
 
782
821
  // South nodes
783
822
  this._secondPASS = [];
784
- this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(p._visibleNodesSouth, outArr);
823
+ this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
824
+ p._visibleNodesSouth,
825
+ outArr
826
+ );
785
827
  i = this._secondPASS.length;
786
828
  while (i--) {
787
- this._secondPASS[i].collectRenderCollectionsPASS2(p._visibleNodesSouth, outArr, this._secondPASS[i].nodeId);
829
+ this._secondPASS[i].collectRenderCollectionsPASS2(
830
+ p._visibleNodesSouth,
831
+ outArr,
832
+ this._secondPASS[i].nodeId
833
+ );
788
834
  }
789
835
  }
790
836
  }
@@ -826,11 +872,12 @@ class Vector extends Layer {
826
872
  * @param {Segment.Material} material - Current material.
827
873
  */
828
874
  loadMaterial(material) {
829
-
830
875
  var seg = material.segment;
831
876
 
832
877
  if (this._isBaseLayer) {
833
- material.texture = seg._isNorth ? seg.planet.solidTextureOne : seg.planet.solidTextureTwo;
878
+ material.texture = seg._isNorth
879
+ ? seg.planet.solidTextureOne
880
+ : seg.planet.solidTextureTwo;
834
881
  } else {
835
882
  material.texture = seg.planet.transparentTexture;
836
883
  }
@@ -856,7 +903,6 @@ class Vector extends Layer {
856
903
  if (material.isReady) {
857
904
  return [0, 0, 1, 1];
858
905
  } else {
859
-
860
906
  !material.isLoading && this.loadMaterial(material);
861
907
 
862
908
  var segment = material.segment;
@@ -961,4 +1007,4 @@ const EVENT_NAMES = [
961
1007
  "entityremove"
962
1008
  ];
963
1009
 
964
- export { Vector };
1010
+ export { Vector };
@@ -2,12 +2,12 @@
2
2
  * @module og/layer/WMS
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import * as mercator from '../mercator.js';
8
- import { Extent } from '../Extent.js';
9
- import { LonLat } from '../LonLat.js';
10
- import { XYZ } from './XYZ.js';
7
+ import * as mercator from "../mercator.js";
8
+ import { Extent } from "../Extent.js";
9
+ import { LonLat } from "../LonLat.js";
10
+ import { XYZ } from "./XYZ.js";
11
11
 
12
12
  /**
13
13
  * Used to display WMS services as tile layers on the globe.
@@ -29,20 +29,20 @@ import { XYZ } from './XYZ.js';
29
29
  * @param {string} options.layers - WMS layers string.
30
30
  * @param {string} [options.version="1.1.1"] - WMS version.
31
31
  * @example:
32
- * new og.layer.WMS("USA States", {
32
+ * new og.layer.WMS("USA States", {
33
33
  * isBaseLayer: false,
34
- * url: "http://openglobus.org/geoserver/",
35
- * layers: "topp:states",
36
- * opacity: 0.5,
37
- * zIndex: 50,
38
- * attribution: 'USA states - geoserver WMS example',
34
+ * url: "http://openglobus.org/geoserver/",
35
+ * layers: "topp:states",
36
+ * opacity: 0.5,
37
+ * zIndex: 50,
38
+ * attribution: 'USA states - geoserver WMS example',
39
39
  * transparentColor: [1.0, 1.0, 1.0],
40
40
  * version: "1.1.1",
41
41
  * visibility: false }
42
42
  * );
43
43
  *
44
44
  * @fires og.layer.XYZ#load
45
- * @fires og.layer.XYZ#loadend
45
+ * @fires og.layer.XYZ#loadend
46
46
  */
47
47
  class WMS extends XYZ {
48
48
  constructor(name, options) {
@@ -87,17 +87,34 @@ class WMS extends XYZ {
87
87
  srs,
88
88
  bbox,
89
89
  width = 256,
90
- height = 256) {
90
+ height = 256
91
+ ) {
91
92
  return `${url}/wms?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}
92
93
  &SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}`;
93
94
  }
94
95
 
95
96
  static get_bbox_v1_1_1(extent) {
96
- return extent.getWest() + "," + extent.getSouth() + "," + extent.getEast() + "," + extent.getNorth();
97
+ return (
98
+ extent.getWest() +
99
+ "," +
100
+ extent.getSouth() +
101
+ "," +
102
+ extent.getEast() +
103
+ "," +
104
+ extent.getNorth()
105
+ );
97
106
  }
98
107
 
99
108
  static get_bbox_v1_3_0(extent) {
100
- return extent.getSouth() + "," + extent.getWest() + "," + extent.getNorth() + "," + extent.getEast();
109
+ return (
110
+ extent.getSouth() +
111
+ "," +
112
+ extent.getWest() +
113
+ "," +
114
+ extent.getNorth() +
115
+ "," +
116
+ extent.getEast()
117
+ );
101
118
  }
102
119
 
103
120
  _checkSegment(segment) {
@@ -156,4 +173,4 @@ class WMS extends XYZ {
156
173
  }
157
174
  }
158
175
 
159
- export { WMS };
176
+ export { WMS };
@@ -2,9 +2,9 @@
2
2
  * @module og/light/LightSource
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Vec3 } from '../math/Vec3.js';
7
+ import { Vec3 } from "../math/Vec3.js";
8
8
 
9
9
  /**
10
10
  * Represents basic light source.
@@ -37,7 +37,7 @@ class LightSource {
37
37
  * @protected
38
38
  * @type {string}
39
39
  */
40
- this._name = name || ("light_" + LightSource._staticCounter++);
40
+ this._name = name || "light_" + LightSource._staticCounter++;
41
41
 
42
42
  /**
43
43
  * Render node where light is shines.
@@ -221,11 +221,11 @@ class LightSource {
221
221
  }
222
222
 
223
223
  /**
224
- * Set ambient color.
225
- * @public
226
- * @param {Vec3} rgb - Ambient color.
227
- * @returns {LightSource}
228
- */
224
+ * Set ambient color.
225
+ * @public
226
+ * @param {Vec3} rgb - Ambient color.
227
+ * @returns {LightSource}
228
+ */
229
229
  setAmbient(r, g, b) {
230
230
  this._ambient.set(r, g, b);
231
231
  var rn = this._renderNode;
@@ -309,9 +309,16 @@ class LightSource {
309
309
  if (rn) {
310
310
  var index = 9 * rn._lightsNames.indexOf(this._name);
311
311
  if (index != -1) {
312
- rn._lightsParamsv[index] = rn._lightsParamsv[index + 1] = rn._lightsParamsv[index + 2] =
313
- rn._lightsParamsv[index + 3] = rn._lightsParamsv[index + 4] = rn._lightsParamsv[index + 5] =
314
- rn._lightsParamsv[index + 6] = rn._lightsParamsv[index + 7] = rn._lightsParamsv[index + 8] = 0;
312
+ rn._lightsParamsv[index] =
313
+ rn._lightsParamsv[index + 1] =
314
+ rn._lightsParamsv[index + 2] =
315
+ rn._lightsParamsv[index + 3] =
316
+ rn._lightsParamsv[index + 4] =
317
+ rn._lightsParamsv[index + 5] =
318
+ rn._lightsParamsv[index + 6] =
319
+ rn._lightsParamsv[index + 7] =
320
+ rn._lightsParamsv[index + 8] =
321
+ 0;
315
322
  }
316
323
  }
317
324
  return this;
@@ -353,4 +360,4 @@ class LightSource {
353
360
  }
354
361
  }
355
362
 
356
- export { LightSource };
363
+ export { LightSource };