@openglobus/og 0.10.6 → 0.11.1

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 (163) hide show
  1. package/package.json +10 -7
  2. package/src/og/Extent.js +1 -1
  3. package/src/og/LonLat.js +7 -2
  4. package/src/og/Popup.js +2 -1
  5. package/src/og/camera/PlanetCamera.js +4 -2
  6. package/src/og/entity/EntityCollection.js +1 -1
  7. package/src/og/entity/LabelHandler.js +366 -74
  8. package/src/og/entity/Polyline.js +3 -2
  9. package/src/og/layer/KML.js +7 -5
  10. package/src/og/layer/Vector.js +5 -0
  11. package/src/og/layer/index.js +2 -1
  12. package/src/og/math/Vec2.js +448 -448
  13. package/src/og/math/Vec3.js +759 -757
  14. package/src/og/math/Vec4.js +216 -215
  15. package/src/og/scene/Planet.js +14 -4
  16. package/src/og/segment/SegmentLonLat.js +7 -0
  17. package/src/og/terrain/GlobusTerrain.js +4 -0
  18. package/src/og/utils/GeoImageCreator.js +123 -121
  19. package/src/og/utils/Loader.js +81 -80
  20. package/src/og/utils/NormalMapCreator.js +320 -318
  21. package/src/og/utils/VectorTileCreator.js +251 -250
  22. package/src/og/webgl/Framebuffer.js +265 -264
  23. package/src/og/webgl/Handler.js +1022 -1022
  24. package/src/og/webgl/Multisample.js +169 -168
  25. package/src/og/webgl/ProgramController.js +113 -112
  26. package/types/Clock.d.ts +90 -0
  27. package/types/Deferred.d.ts +6 -0
  28. package/types/Events.d.ts +73 -0
  29. package/types/Extent.d.ts +162 -0
  30. package/types/Globe.d.ts +80 -0
  31. package/types/ImageCanvas.d.ts +121 -0
  32. package/types/Lock.d.ts +12 -0
  33. package/types/LonLat.d.ts +108 -0
  34. package/types/Popup.d.ts +38 -0
  35. package/types/QueueArray.d.ts +15 -0
  36. package/types/Rectangle.d.ts +74 -0
  37. package/types/Stack.d.ts +15 -0
  38. package/types/ajax.d.ts +24 -0
  39. package/types/arial.d.ts +48 -0
  40. package/types/astro/astro.d.ts +38 -0
  41. package/types/astro/earth.d.ts +6 -0
  42. package/types/astro/jd.d.ts +254 -0
  43. package/types/bv/Box.d.ts +25 -0
  44. package/types/bv/Sphere.d.ts +32 -0
  45. package/types/bv/index.d.ts +3 -0
  46. package/types/camera/Camera.d.ts +303 -0
  47. package/types/camera/Frustum.d.ts +129 -0
  48. package/types/camera/PlanetCamera.d.ts +222 -0
  49. package/types/camera/index.d.ts +3 -0
  50. package/types/cons.d.ts +40 -0
  51. package/types/control/CompassButton.d.ts +17 -0
  52. package/types/control/Control.d.ts +101 -0
  53. package/types/control/DebugInfo.d.ts +16 -0
  54. package/types/control/EarthCoordinates.d.ts +47 -0
  55. package/types/control/GeoImageDragControl.d.ts +6 -0
  56. package/types/control/KeyboardNavigation.d.ts +22 -0
  57. package/types/control/LayerSwitcher.d.ts +23 -0
  58. package/types/control/Lighting.d.ts +16 -0
  59. package/types/control/ScaleControl.d.ts +22 -0
  60. package/types/control/ShowFps.d.ts +12 -0
  61. package/types/control/SimpleNavigation.d.ts +28 -0
  62. package/types/control/Sun.d.ts +52 -0
  63. package/types/control/ToggleWireframe.d.ts +12 -0
  64. package/types/control/ZoomControl.d.ts +28 -0
  65. package/types/control/index.d.ts +15 -0
  66. package/types/ellipsoid/Ellipsoid.d.ts +142 -0
  67. package/types/ellipsoid/index.d.ts +3 -0
  68. package/types/ellipsoid/wgs84.d.ts +5 -0
  69. package/types/entity/BaseBillboard.d.ts +208 -0
  70. package/types/entity/Billboard.d.ts +94 -0
  71. package/types/entity/BillboardHandler.d.ts +74 -0
  72. package/types/entity/Entity.d.ts +330 -0
  73. package/types/entity/EntityCollection.d.ts +303 -0
  74. package/types/entity/Geometry.d.ts +72 -0
  75. package/types/entity/GeometryHandler.d.ts +76 -0
  76. package/types/entity/Label.d.ts +194 -0
  77. package/types/entity/LabelHandler.d.ts +24 -0
  78. package/types/entity/PointCloud.d.ts +174 -0
  79. package/types/entity/PointCloudHandler.d.ts +38 -0
  80. package/types/entity/Polyline.d.ts +303 -0
  81. package/types/entity/PolylineHandler.d.ts +18 -0
  82. package/types/entity/Ray.d.ts +123 -0
  83. package/types/entity/RayHandler.d.ts +67 -0
  84. package/types/entity/ShapeHandler.d.ts +22 -0
  85. package/types/entity/Strip.d.ts +118 -0
  86. package/types/entity/StripHandler.d.ts +38 -0
  87. package/types/entity/index.d.ts +8 -0
  88. package/types/index.core.d.ts +65 -0
  89. package/types/index.d.ts +45 -0
  90. package/types/index.webgl.d.ts +7 -0
  91. package/types/inherits.d.ts +4 -0
  92. package/types/input/input.d.ts +34 -0
  93. package/types/layer/BaseGeoImage.d.ts +106 -0
  94. package/types/layer/CanvasTiles.d.ts +75 -0
  95. package/types/layer/GeoImage.d.ts +65 -0
  96. package/types/layer/GeoTexture2d.d.ts +8 -0
  97. package/types/layer/GeoVideo.d.ts +80 -0
  98. package/types/layer/KML.d.ts +58 -0
  99. package/types/layer/WMS.d.ts +66 -0
  100. package/types/layer/XYZ.d.ts +126 -0
  101. package/types/layer/index.d.ts +10 -0
  102. package/types/light/LightSource.d.ts +177 -0
  103. package/types/math/Mat3.d.ts +53 -0
  104. package/types/math/Mat4.d.ts +157 -0
  105. package/types/math/Plane.d.ts +17 -0
  106. package/types/math/Vec2.d.ts +308 -0
  107. package/types/math/Vec3.d.ts +459 -0
  108. package/types/math/Vec4.d.ts +161 -0
  109. package/types/math/coder.d.ts +42 -0
  110. package/types/math/index.d.ts +11 -0
  111. package/types/math.d.ts +261 -0
  112. package/types/mercator.d.ts +92 -0
  113. package/types/proj/EPSG3857.d.ts +5 -0
  114. package/types/proj/EPSG4326.d.ts +5 -0
  115. package/types/quadTree/quadTree.d.ts +40 -0
  116. package/types/renderer/RendererEvents.d.ts +230 -0
  117. package/types/res/images.d.ts +3 -0
  118. package/types/scene/Axes.d.ts +11 -0
  119. package/types/scene/BaseNode.d.ts +60 -0
  120. package/types/scene/Planet.d.ts +572 -0
  121. package/types/scene/RenderNode.d.ts +143 -0
  122. package/types/scene/SkyBox.d.ts +10 -0
  123. package/types/scene/index.d.ts +4 -0
  124. package/types/segment/segmentHelper.d.ts +13 -0
  125. package/types/shaders/billboard.d.ts +3 -0
  126. package/types/shaders/depth.d.ts +2 -0
  127. package/types/shaders/drawnode.d.ts +7 -0
  128. package/types/shaders/label.d.ts +4 -0
  129. package/types/shaders/pointCloud.d.ts +2 -0
  130. package/types/shaders/polyline.d.ts +3 -0
  131. package/types/shaders/ray.d.ts +2 -0
  132. package/types/shaders/screenFrame.d.ts +2 -0
  133. package/types/shaders/shape.d.ts +4 -0
  134. package/types/shaders/skybox.d.ts +2 -0
  135. package/types/shaders/toneMapping.d.ts +2 -0
  136. package/types/shapes/BaseShape.d.ts +247 -0
  137. package/types/shapes/Sphere.d.ts +41 -0
  138. package/types/terrain/BilTerrain.d.ts +8 -0
  139. package/types/terrain/EmptyTerrain.d.ts +72 -0
  140. package/types/terrain/Geoid.d.ts +26 -0
  141. package/types/terrain/GlobusTerrain.d.ts +153 -0
  142. package/types/terrain/MapboxTerrain.d.ts +8 -0
  143. package/types/terrain/index.d.ts +5 -0
  144. package/types/utils/FontAtlas.d.ts +14 -0
  145. package/types/utils/GeoImageCreator.d.ts +29 -0
  146. package/types/utils/ImagesCacheManager.d.ts +10 -0
  147. package/types/utils/Loader.d.ts +25 -0
  148. package/types/utils/NormalMapCreator.d.ts +39 -0
  149. package/types/utils/PlainSegmentWorker.d.ts +10 -0
  150. package/types/utils/TerrainWorker.d.ts +9 -0
  151. package/types/utils/TextureAtlas.d.ts +111 -0
  152. package/types/utils/VectorTileCreator.d.ts +16 -0
  153. package/types/utils/colorTable.d.ts +143 -0
  154. package/types/utils/earcut.d.ts +6 -0
  155. package/types/utils/shared.d.ts +230 -0
  156. package/types/webgl/Framebuffer.d.ts +135 -0
  157. package/types/webgl/Handler.d.ts +372 -0
  158. package/types/webgl/Multisample.d.ts +89 -0
  159. package/types/webgl/Program.d.ts +155 -0
  160. package/types/webgl/ProgramController.d.ts +84 -0
  161. package/types/webgl/callbacks.d.ts +1 -0
  162. package/types/webgl/index.d.ts +6 -0
  163. package/types/webgl/types.d.ts +2 -0
package/package.json CHANGED
@@ -1,20 +1,22 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.10.6",
3
+ "version": "0.11.1",
4
4
  "description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"
7
7
  },
8
8
  "main": "./src/og/index.js",
9
9
  "style": "./css/og.css",
10
+ "types": "./types/index.d.ts",
10
11
  "scripts": {
11
- "api": ".jsdoc -t ./jsdoc -r ./src/ -c ./jsdoc/conf.json -d ./api",
12
+ "api": "jsdoc -t ./jsdoc -r ./src/ -c ./jsdoc/conf.json -d ./api",
12
13
  "serve": "ws",
13
14
  "build": "rollup -c",
14
15
  "webgl": "rollup -c --environment entry:webgl",
15
16
  "core": "rollup -c --environment entry:core",
16
- "test": "jest --coverage",
17
+ "test": "jest --env=jsdom",
17
18
  "lint": "eslint src/og",
19
+ "generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types; exit 0",
18
20
  "prepare": "husky install"
19
21
  },
20
22
  "repository": {
@@ -48,11 +50,10 @@
48
50
  "eslint-plugin-import": "^2.22.1",
49
51
  "eslint-plugin-node": "^11.1.0",
50
52
  "eslint-plugin-promise": "^4.3.1",
51
- "eslint-plugin-react": "^7.21.5",
52
53
  "eslint-plugin-standard": "^4.1.0",
53
54
  "husky": "^6.0.0",
54
55
  "jaguarjs-jsdoc": "^1.1.0",
55
- "jest": "^26.6.3",
56
+ "jest": "^27.2.3",
56
57
  "jsdoc": "^3.6.7",
57
58
  "lint-staged": "^11.0.0",
58
59
  "local-web-server": "^5.1.1",
@@ -61,7 +62,8 @@
61
62
  "prettier": "^2.3.0",
62
63
  "rollup": "^1.32.1",
63
64
  "rollup-plugin-postcss": "^4.0.0",
64
- "rollup-plugin-terser": "^5.3.1"
65
+ "rollup-plugin-terser": "^5.3.1",
66
+ "typescript": "^4.4.3"
65
67
  },
66
68
  "lint-staged": {
67
69
  "*.{js,ts}": [
@@ -70,7 +72,8 @@
70
72
  },
71
73
  "files": [
72
74
  "src/**/*",
73
- "css/**/*"
75
+ "css/**/*",
76
+ "types/**/*"
74
77
  ],
75
78
  "keywords": [
76
79
  "map",
package/src/og/Extent.js CHANGED
@@ -48,7 +48,7 @@ export class Extent {
48
48
  /**
49
49
  * Creates extent instance from values in array.
50
50
  * @static
51
- * @param {Array.<number,number,number,number>} arr - South west and north east longitude and latidudes packed in array.
51
+ * @param {Array.<number>} arr - South west and north east longitude and latidudes packed in array. (exactly 4 entries)
52
52
  * @return {og.Extent} Extent object.
53
53
  */
54
54
  static createFromArray(arr) {
package/src/og/LonLat.js CHANGED
@@ -21,6 +21,11 @@ const INV_PI_BY_180_HALF_PI = INV_PI_BY_180 * HALF_PI;
21
21
  */
22
22
  export class LonLat {
23
23
 
24
+ /**
25
+ * @param {number} [lon]
26
+ * @param {number} [lat]
27
+ * @param {number} [height]
28
+ */
24
29
  constructor(lon, lat, height) {
25
30
 
26
31
  /**
@@ -52,7 +57,7 @@ export class LonLat {
52
57
  /**
53
58
  * Creates coordinates array.
54
59
  * @static
55
- * @param{Array.<Array<number,number,number>>} arr - Coordinates array data.
60
+ * @param{Array.<Array<number>>} arr - Coordinates array data. (exactly 3 entries)
56
61
  * @return{Array.<og.LonLat>} the same coordinates array but each element is LonLat instance.
57
62
  */
58
63
  static join(arr) {
@@ -67,7 +72,7 @@ export class LonLat {
67
72
  /**
68
73
  * Creates an object by coordinate array.
69
74
  * @static
70
- * @param {Array.<number,number,number>} arr - Coordiante array, where first is longitude, second is latitude and third is a height.
75
+ * @param {Array.<number>} arr - Coordiante array, where first is longitude, second is latitude and third is a height. (exactly 3 entries)
71
76
  * @returns {og.LonLat} -
72
77
  */
73
78
  static createFromArray(arr) {
package/src/og/Popup.js CHANGED
@@ -72,7 +72,7 @@ class Popup {
72
72
 
73
73
  setScreen(p) {
74
74
  if (this._planet) {
75
- this.el.style.transform = "translate(" + (p.x - this.clientWidth * 0.5) + "px, " + (p.y - this._planet.renderer.handler.canvas.height - this.clientHeight * 0.5) + "px)"
75
+ this.el.style.transform = "translate(" + (p.x - this.clientWidth * 0.5) + "px, " + (p.y - this._planet.renderer.handler.canvas.height - this._tipEl.clientHeight) + "px)"
76
76
  }
77
77
  }
78
78
 
@@ -98,6 +98,7 @@ class Popup {
98
98
  this.el = this._renderTemplate(params);
99
99
  this._contentEl = this.el.querySelector(".og-popup-content");
100
100
  this._titleEl = this.el.querySelector(".og-popup-title")
101
+ this._tipEl = this.el.querySelector(".og-popup-tip-container")
101
102
  this.setOffset(this._offset[0], this._offset[1]);
102
103
  this.setContent(this._content);
103
104
  this.setTitle(this._title);
@@ -297,6 +297,7 @@ class PlanetCamera extends Camera {
297
297
  * @param {Number} [ampl] - Altitude amplitude factor.
298
298
  * @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
299
299
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
300
+ * @param [frameCallback]
300
301
  */
301
302
  flyExtent(extent, height, up, ampl, completeCallback, startCallback, frameCallback) {
302
303
  this.flyCartesian(
@@ -361,6 +362,7 @@ class PlanetCamera extends Camera {
361
362
  * @param {Number} [ampl=1.0] - Altitude amplitude factor.
362
363
  * @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
363
364
  * @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
365
+ * @param [frameCallback]
364
366
  */
365
367
  flyCartesian(cartesian, look, up, ampl = 1.0, completeCallback, startCallback, frameCallback) {
366
368
  this.stopFlying();
@@ -551,9 +553,9 @@ class PlanetCamera extends Camera {
551
553
  let slope = n.dot(eyeNorm);
552
554
 
553
555
  if (minSlope) {
554
- //let dSlope = slope - this.slope;
556
+ let dSlope = slope - this.slope;
555
557
 
556
- //if (slope < minSlope && dSlope < 0) return;
558
+ if (slope < minSlope && dSlope < 0) return;
557
559
 
558
560
  if (
559
561
  (slope > 0.1 && v.dot(eyeNorm) > 0) ||
@@ -21,7 +21,7 @@ import { ShapeHandler } from './ShapeHandler.js';
21
21
  * @param {Object} [options] - Entity options:
22
22
  * @param {Array.<og.Entity>} [options.entities] - Entities array.
23
23
  * @param {boolean} [options.visibility=true] - Entity visibility.
24
- * @param {Array.<number,number,number>} [options.scaleByDistance] - Entity scale by distance parameters.
24
+ * @param {Array.<number>} [options.scaleByDistance] - Entity scale by distance parameters. (exactly 3 entries)
25
25
  * First index - near distance to the entity, after entity becomes full scale.
26
26
  * Second index - far distance to the entity, when entity becomes zero scale.
27
27
  * Third index - far distance to the entity, when entity becomes invisible.