@openglobus/og 0.11.4 → 0.11.8
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/css/og.css +3 -2
- package/package.json +12 -14
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/Globe.js +8 -5
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +19 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +9 -5
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +0 -1
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/Lighting.js +74 -64
- package/src/og/control/MouseNavigation.js +21 -18
- package/src/og/control/MouseWheelZoomControl.js +257 -0
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +22 -12
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/control/index.js +2 -0
- package/src/og/control/visibleExtent/Segment.js +1862 -0
- package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
- package/src/og/control/visibleExtent/drawnode.js +751 -0
- package/src/og/ellipsoid/Ellipsoid.js +149 -57
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +72 -30
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +315 -62
- package/src/og/entity/Entity.js +39 -1
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +62 -30
- package/src/og/entity/LabelHandler.js +40 -242
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -17
- package/src/og/layer/GeoImage.js +8 -16
- package/src/og/layer/GeoTexture2d.js +2 -10
- package/src/og/layer/GeoVideo.js +2 -10
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +24 -32
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -18
- package/src/og/layer/XYZ.js +4 -5
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +60 -30
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +3 -3
- package/src/og/renderer/Renderer.js +106 -124
- package/src/og/renderer/RendererEvents.js +45 -23
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +51 -90
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/segment/Segment.js +60 -156
- package/src/og/segment/Slice.js +45 -0
- package/src/og/shaders/drawnode.js +245 -342
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +108 -36
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/GeoImageCreator.js +5 -1
- package/src/og/utils/TextureAtlas.js +18 -20
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +2 -2
- package/src/og/webgl/Handler.js +215 -162
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Clock.d.ts +0 -94
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -77
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -82
- package/types/ImageCanvas.d.ts +0 -123
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -42
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -312
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -218
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -17
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -15
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -21
- package/types/control/LayerSwitcher.d.ts +0 -21
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -47
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -25
- package/types/control/Sun.d.ts +0 -50
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -48
- package/types/control/ZoomControl.d.ts +0 -27
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -146
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -78
- package/types/entity/Entity.d.ts +0 -333
- package/types/entity/EntityCollection.d.ts +0 -311
- package/types/entity/Geometry.d.ts +0 -74
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -189
- package/types/entity/LabelHandler.d.ts +0 -29
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -306
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -124
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -94
- package/types/layer/CanvasTiles.d.ts +0 -68
- package/types/layer/GeoImage.d.ts +0 -52
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -55
- package/types/layer/KML.d.ts +0 -63
- package/types/layer/Layer.d.ts +0 -325
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -208
- package/types/layer/WMS.d.ts +0 -63
- package/types/layer/XYZ.d.ts +0 -120
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -460
- package/types/math/Vec4.d.ts +0 -162
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -298
- package/types/renderer/RendererEvents.d.ts +0 -233
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -577
- package/types/scene/RenderNode.d.ts +0 -142
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -279
- package/types/segment/SegmentLonLat.d.ts +0 -16
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -7
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -116
- package/types/terrain/MapboxTerrain.d.ts +0 -7
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -231
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -388
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
package/css/og.css
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
height: 19px;
|
|
51
51
|
position: absolute;
|
|
52
52
|
background-color: rgba(22, 76, 155, 1) !important;
|
|
53
|
-
z-index:
|
|
53
|
+
z-index: 35000;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.ogAttribution {
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
right: 0px;
|
|
154
154
|
width: 17em;
|
|
155
155
|
background-color: rgba(22, 76, 155, 0.4);
|
|
156
|
-
z-index:
|
|
156
|
+
z-index: 25000;
|
|
157
157
|
padding: 0 0 0 10px;
|
|
158
158
|
font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
|
|
159
159
|
border-radius: 2px;
|
|
@@ -448,6 +448,7 @@
|
|
|
448
448
|
|
|
449
449
|
.og-lighing .og-value {
|
|
450
450
|
float: left;
|
|
451
|
+
width: 50px;
|
|
451
452
|
}
|
|
452
453
|
|
|
453
454
|
.og-lighing #layers {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.8",
|
|
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"
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
"test": "jest --env=jsdom",
|
|
18
18
|
"test_watch": "jest --env=jsdom --watch",
|
|
19
19
|
"lint": "eslint src/og",
|
|
20
|
-
"generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types
|
|
21
|
-
"compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/"
|
|
22
|
-
"prepare": "husky install"
|
|
20
|
+
"generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
|
21
|
+
"compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/"
|
|
23
22
|
},
|
|
24
23
|
"repository": {
|
|
25
24
|
"type": "git",
|
|
@@ -44,25 +43,24 @@
|
|
|
44
43
|
"./css/og.css": "./css/og.css"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
46
|
+
"@babel/preset-env": "^7.16.4",
|
|
48
47
|
"@rollup/plugin-json": "^4.1.0",
|
|
49
|
-
"@types/jest": "^27.0.
|
|
50
|
-
"eslint": "^8.
|
|
51
|
-
"husky": "^7.0.4",
|
|
48
|
+
"@types/jest": "^27.0.3",
|
|
49
|
+
"eslint": "^8.3.0",
|
|
52
50
|
"jaguarjs-jsdoc": "^1.1.0",
|
|
53
51
|
"jest": "^27.3.1",
|
|
54
52
|
"jest-canvas-mock": "^2.3.1",
|
|
55
53
|
"jest-webgl-canvas-mock": "^0.2.3",
|
|
56
54
|
"jsdoc": "^3.6.7",
|
|
57
|
-
"lint-staged": "^
|
|
55
|
+
"lint-staged": "^12.1.2",
|
|
58
56
|
"local-web-server": "^5.1.1",
|
|
59
57
|
"msdf-bmfont-xml": "^2.5.4",
|
|
60
|
-
"postcss": "^8.
|
|
61
|
-
"prettier": "^2.
|
|
62
|
-
"rollup": "^2.
|
|
63
|
-
"rollup-plugin-postcss": "^4.0.
|
|
58
|
+
"postcss": "^8.4.1",
|
|
59
|
+
"prettier": "^2.5.0",
|
|
60
|
+
"rollup": "^2.60.1",
|
|
61
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
64
62
|
"rollup-plugin-terser": "^7.0.2",
|
|
65
|
-
"typescript": "^4.
|
|
63
|
+
"typescript": "^4.5.2"
|
|
66
64
|
},
|
|
67
65
|
"lint-staged": {
|
|
68
66
|
"*.{js,ts}": [
|
package/src/og/Clock.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module og/Clock
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Events } from
|
|
8
|
-
import * as jd from
|
|
7
|
+
import { Events } from "./Events.js";
|
|
8
|
+
import * as jd from "./astro/jd.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Class represents application timer that stores custom current julian datetime, and time speed multiplier.
|
|
@@ -17,7 +17,6 @@ import * as jd from './astro/jd.js';
|
|
|
17
17
|
* @param {number} [params.multiplier=1.0] - Time speed multiolier.
|
|
18
18
|
*/
|
|
19
19
|
class Clock {
|
|
20
|
-
|
|
21
20
|
static get _staticCounter() {
|
|
22
21
|
if (!this._counter && this._counter !== 0) {
|
|
23
22
|
this._counter = 0;
|
|
@@ -30,7 +29,7 @@ class Clock {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
32
|
+
*
|
|
34
33
|
* @param {Object} [params] - Clock parameters:
|
|
35
34
|
*/
|
|
36
35
|
constructor(params) {
|
|
@@ -50,10 +49,7 @@ class Clock {
|
|
|
50
49
|
* @public
|
|
51
50
|
* @type {Events}
|
|
52
51
|
*/
|
|
53
|
-
this.events = new Events([
|
|
54
|
-
"tick",
|
|
55
|
-
"end"
|
|
56
|
-
], this);
|
|
52
|
+
this.events = new Events(["tick", "end"], this);
|
|
57
53
|
|
|
58
54
|
/**
|
|
59
55
|
* Start julian date clock loop.
|
|
@@ -195,4 +191,4 @@ class Clock {
|
|
|
195
191
|
}
|
|
196
192
|
}
|
|
197
193
|
|
|
198
|
-
export { Clock };
|
|
194
|
+
export { Clock };
|
package/src/og/Events.js
CHANGED
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
* @module og/Events
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { stamp, binaryInsert } from
|
|
7
|
+
import { stamp, binaryInsert } from "./utils/shared.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Base events class to handle custom events.
|
|
11
11
|
* @class
|
|
12
12
|
*/
|
|
13
13
|
class Events {
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
*
|
|
17
16
|
* @param {Array.<string>} [eventNames] - Event names that could be dispatched.
|
|
18
|
-
* @param {*} [sender]
|
|
17
|
+
* @param {*} [sender]
|
|
19
18
|
*/
|
|
20
19
|
constructor(eventNames, sender) {
|
|
21
20
|
/**
|
|
@@ -80,7 +79,6 @@ class Events {
|
|
|
80
79
|
* @return {boolean} -
|
|
81
80
|
*/
|
|
82
81
|
_stamp(name, obj) {
|
|
83
|
-
|
|
84
82
|
var ogid = stamp(obj);
|
|
85
83
|
|
|
86
84
|
var st = this._getStamp(name, this.__id, ogid);
|
|
@@ -187,4 +185,4 @@ class Events {
|
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
|
|
190
|
-
export { Events };
|
|
188
|
+
export { Events };
|
package/src/og/Extent.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @module og/Extent
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as math from
|
|
8
|
-
import * as mercator from
|
|
9
|
-
import { LonLat } from
|
|
7
|
+
import * as math from "./math.js";
|
|
8
|
+
import * as mercator from "./mercator.js";
|
|
9
|
+
import { LonLat } from "./LonLat.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Represents geographical coordinates extent.
|
|
@@ -15,7 +15,6 @@ import { LonLat } from './LonLat.js';
|
|
|
15
15
|
* @param {LonLat} [ne] - North East extent corner coordiantes.
|
|
16
16
|
*/
|
|
17
17
|
export class Extent {
|
|
18
|
-
|
|
19
18
|
/**
|
|
20
19
|
* @param {LonLat} [sw] - South West extent corner coordiantes.
|
|
21
20
|
* @param {LonLat} [ne] - North East extent corner coordiantes.
|
|
@@ -35,19 +34,25 @@ export class Extent {
|
|
|
35
34
|
* Whole mercator extent.
|
|
36
35
|
* @const
|
|
37
36
|
*/
|
|
38
|
-
static get FULL_MERC() {
|
|
37
|
+
static get FULL_MERC() {
|
|
38
|
+
return new Extent(LonLat.SW_MERC, LonLat.NE_MERC);
|
|
39
|
+
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Degrees extent from north mercator limit to north pole.
|
|
42
43
|
* @const
|
|
43
44
|
*/
|
|
44
|
-
static get NORTH_POLE_DEG() {
|
|
45
|
+
static get NORTH_POLE_DEG() {
|
|
46
|
+
return new Extent(LonLat.NW_MERC_DEG, new LonLat(180.0, 90.0));
|
|
47
|
+
}
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
50
|
* Degrees extent from south pole to south mercator limit.
|
|
48
51
|
* @const
|
|
49
52
|
*/
|
|
50
|
-
static get SOUTH_POLE_DEG() {
|
|
53
|
+
static get SOUTH_POLE_DEG() {
|
|
54
|
+
return new Extent(new LonLat(-180.0, -90.0), LonLat.SE_MERC_DEG);
|
|
55
|
+
}
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
* Creates extent instance from values in array.
|
|
@@ -66,8 +71,10 @@ export class Extent {
|
|
|
66
71
|
* @return {Extent} Extent object.
|
|
67
72
|
*/
|
|
68
73
|
static createByCoordinates(arr) {
|
|
69
|
-
let lonmin = math.MAX,
|
|
70
|
-
|
|
74
|
+
let lonmin = math.MAX,
|
|
75
|
+
lonmax = math.MIN,
|
|
76
|
+
latmin = math.MAX,
|
|
77
|
+
latmax = math.MIN;
|
|
71
78
|
for (let i = 0; i < arr.length; i++) {
|
|
72
79
|
const vi = arr[i];
|
|
73
80
|
if (vi.lon < lonmin) lonmin = vi.lon;
|
|
@@ -85,8 +92,10 @@ export class Extent {
|
|
|
85
92
|
* @return {Extent} Extent object.
|
|
86
93
|
*/
|
|
87
94
|
static createByCoordinatesArr(arr) {
|
|
88
|
-
let lonmin = math.MAX,
|
|
89
|
-
|
|
95
|
+
let lonmin = math.MAX,
|
|
96
|
+
lonmax = math.MIN,
|
|
97
|
+
latmin = math.MAX,
|
|
98
|
+
latmax = math.MIN;
|
|
90
99
|
for (let i = 0; i < arr.length; i++) {
|
|
91
100
|
const vi = arr[i];
|
|
92
101
|
if (vi[0] < lonmin) lonmin = vi[0];
|
|
@@ -130,8 +139,10 @@ export class Extent {
|
|
|
130
139
|
* @return {Extent} Current extent.
|
|
131
140
|
*/
|
|
132
141
|
setByCoordinates(arr) {
|
|
133
|
-
let lonmin = math.MAX,
|
|
134
|
-
|
|
142
|
+
let lonmin = math.MAX,
|
|
143
|
+
lonmax = math.MIN,
|
|
144
|
+
latmin = math.MAX,
|
|
145
|
+
latmax = math.MIN;
|
|
135
146
|
for (let i = 0; i < arr.length; i++) {
|
|
136
147
|
const vi = arr[i];
|
|
137
148
|
if (vi.lon < lonmin) lonmin = vi.lon;
|
|
@@ -155,8 +166,12 @@ export class Extent {
|
|
|
155
166
|
isInside(lonlat) {
|
|
156
167
|
const sw = this.southWest,
|
|
157
168
|
ne = this.northEast;
|
|
158
|
-
return
|
|
159
|
-
lonlat.
|
|
169
|
+
return (
|
|
170
|
+
lonlat.lon >= sw.lon &&
|
|
171
|
+
lonlat.lon <= ne.lon &&
|
|
172
|
+
lonlat.lat >= sw.lat &&
|
|
173
|
+
lonlat.lat <= ne.lat
|
|
174
|
+
);
|
|
160
175
|
}
|
|
161
176
|
|
|
162
177
|
/**
|
|
@@ -168,8 +183,12 @@ export class Extent {
|
|
|
168
183
|
overlaps(e) {
|
|
169
184
|
const sw = this.southWest,
|
|
170
185
|
ne = this.northEast;
|
|
171
|
-
return
|
|
172
|
-
sw.
|
|
186
|
+
return (
|
|
187
|
+
sw.lon <= e.northEast.lon &&
|
|
188
|
+
ne.lon >= e.southWest.lon &&
|
|
189
|
+
sw.lat <= e.northEast.lat &&
|
|
190
|
+
ne.lat >= e.southWest.lat
|
|
191
|
+
);
|
|
173
192
|
}
|
|
174
193
|
|
|
175
194
|
/**
|
|
@@ -205,7 +224,8 @@ export class Extent {
|
|
|
205
224
|
* @return {number} Center coordinate.
|
|
206
225
|
*/
|
|
207
226
|
getCenter() {
|
|
208
|
-
const sw = this.southWest,
|
|
227
|
+
const sw = this.southWest,
|
|
228
|
+
ne = this.northEast;
|
|
209
229
|
return new LonLat(sw.lon + (ne.lon - sw.lon) * 0.5, sw.lat + (ne.lat - sw.lat) * 0.5);
|
|
210
230
|
}
|
|
211
231
|
|
|
@@ -265,8 +285,12 @@ export class Extent {
|
|
|
265
285
|
* @returns {boolean} -
|
|
266
286
|
*/
|
|
267
287
|
equals(extent) {
|
|
268
|
-
return
|
|
269
|
-
this.
|
|
288
|
+
return (
|
|
289
|
+
this.southWest.lon === extent.southWest.lon &&
|
|
290
|
+
this.southWest.lat === extent.southWest.lat &&
|
|
291
|
+
this.northEast.lon === extent.northEast.lon &&
|
|
292
|
+
this.northEast.lat === extent.northEast.lat
|
|
293
|
+
);
|
|
270
294
|
}
|
|
271
295
|
|
|
272
296
|
/**
|
|
@@ -294,17 +318,25 @@ export class Extent {
|
|
|
294
318
|
* @return {Array.<number>} Cartesian 3d coordinate array. (exactly 6 entries)
|
|
295
319
|
*/
|
|
296
320
|
getCartesianBounds(ellipsoid) {
|
|
297
|
-
let xmin = math.MAX,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
321
|
+
let xmin = math.MAX,
|
|
322
|
+
xmax = math.MIN,
|
|
323
|
+
ymin = math.MAX,
|
|
324
|
+
ymax = math.MIN,
|
|
325
|
+
zmin = math.MAX,
|
|
326
|
+
zmax = math.MIN;
|
|
327
|
+
|
|
328
|
+
const v = [
|
|
329
|
+
new LonLat(this.southWest.lon, this.southWest.lat),
|
|
330
|
+
new LonLat(this.southWest.lon, this.northEast.lat),
|
|
331
|
+
new LonLat(this.northEast.lon, this.northEast.lat),
|
|
332
|
+
new LonLat(this.northEast.lon, this.southWest.lat)
|
|
333
|
+
];
|
|
304
334
|
|
|
305
335
|
for (let i = 0; i < v.length; i++) {
|
|
306
336
|
const coord = ellipsoid.lonLatToCartesian(v[i]);
|
|
307
|
-
const x = coord.x,
|
|
337
|
+
const x = coord.x,
|
|
338
|
+
y = coord.y,
|
|
339
|
+
z = coord.z;
|
|
308
340
|
if (x < xmin) xmin = x;
|
|
309
341
|
if (x > xmax) xmax = x;
|
|
310
342
|
if (y < ymin) ymin = y;
|
|
@@ -317,7 +349,16 @@ export class Extent {
|
|
|
317
349
|
}
|
|
318
350
|
|
|
319
351
|
toString() {
|
|
320
|
-
return
|
|
352
|
+
return (
|
|
353
|
+
"[" +
|
|
354
|
+
this.southWest.lon +
|
|
355
|
+
", " +
|
|
356
|
+
this.southWest.lat +
|
|
357
|
+
", " +
|
|
358
|
+
this.northEast.lon +
|
|
359
|
+
", " +
|
|
360
|
+
this.northEast.lat +
|
|
361
|
+
"]"
|
|
362
|
+
);
|
|
321
363
|
}
|
|
322
|
-
|
|
323
|
-
}
|
|
364
|
+
}
|
package/src/og/Globe.js
CHANGED
|
@@ -16,7 +16,7 @@ import { Renderer } from "./renderer/Renderer.js";
|
|
|
16
16
|
import { Planet } from "./scene/Planet.js";
|
|
17
17
|
import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
|
|
18
18
|
import { isEmpty } from "./utils/shared.js";
|
|
19
|
-
import { Handler } from "./webgl/Handler.js";
|
|
19
|
+
import { Handler } from "./webgl/Handler.js";
|
|
20
20
|
|
|
21
21
|
/** @const {string} */
|
|
22
22
|
const CANVAS_ID_PREFIX = "globus_viewport_";
|
|
@@ -60,8 +60,10 @@ const PLANET_NAME_PREFIX = "globus_planet_";
|
|
|
60
60
|
* @param {DOMElement} [options.attributionContainer] - Container for attribution list.
|
|
61
61
|
* @param {Number} [options.maxGridSize] = Maximal segment grid size. 128 is default
|
|
62
62
|
* @param {boolean} [options.useSpecularTexture] - use specular water mask
|
|
63
|
-
* @param {boolean} [options.useNightTexture] - show night cities
|
|
64
|
-
* @param {Number} [options.
|
|
63
|
+
* @param {boolean} [options.useNightTexture] - show night cities
|
|
64
|
+
* @param {Number} [options.maxAltitude=15000000.0] - Maximal camera altitude above terrain
|
|
65
|
+
* @param {Number} [options.minAltitude=1.0] - Minimal camera altitude above terrain
|
|
66
|
+
* @param {Number} [options.maxEqualZoomAltitude=15000000.0] - Maximal altitude since segments on the screen bacame the same zoom level
|
|
65
67
|
* @param {Number} [options.minEqualZoomAltitude=10000.0] - Minimal altitude since segments on the screen bacame the same zoom level
|
|
66
68
|
* @param {Number} [options.minEqualZoomCameraSlope=0.8] - Minimal camera slope above te globe where segments on the screen bacame the same zoom level
|
|
67
69
|
*/
|
|
@@ -117,7 +119,8 @@ class Globe {
|
|
|
117
119
|
* @type {Renderer}
|
|
118
120
|
*/
|
|
119
121
|
this.renderer = new Renderer(
|
|
120
|
-
new Handler(_canvasId, {
|
|
122
|
+
new Handler(_canvasId, {
|
|
123
|
+
pixelRatio: window.devicePixelRatio,
|
|
121
124
|
context: {
|
|
122
125
|
alpha: false,
|
|
123
126
|
antialias: false,
|
|
@@ -165,7 +168,7 @@ class Globe {
|
|
|
165
168
|
useNightTexture: options.useNightTexture,
|
|
166
169
|
useSpecularTexture: options.useSpecularTexture,
|
|
167
170
|
minAltitude: options.minAltitude,
|
|
168
|
-
maxAltitude: options.maxAltitude,
|
|
171
|
+
maxAltitude: options.maxAltitude || 15000000,
|
|
169
172
|
maxEqualZoomAltitude: options.maxEqualZoomAltitude,
|
|
170
173
|
minEqualZoomAltitude: options.minEqualZoomAltitude,
|
|
171
174
|
minEqualZoomCameraSlope: options.minEqualZoomCameraSlope
|
package/src/og/ImageCanvas.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* @module og/ImageCanvas
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Usefull class for working with JS canvas object.
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
11
|
class ImageCanvas {
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* @param {number} [width] - Canvas width. Default 256.
|
|
15
14
|
* @param {number} [height] - Canvas height. Default 256.
|
|
@@ -29,7 +28,7 @@ class ImageCanvas {
|
|
|
29
28
|
* @protected
|
|
30
29
|
* @type {Object}
|
|
31
30
|
*/
|
|
32
|
-
this._context = this._canvas.getContext(
|
|
31
|
+
this._context = this._canvas.getContext("2d");
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
/**
|
|
@@ -103,7 +102,7 @@ class ImageCanvas {
|
|
|
103
102
|
resize(width, height) {
|
|
104
103
|
this._canvas.width = width;
|
|
105
104
|
this._canvas.height = height;
|
|
106
|
-
this._context = this._canvas.getContext(
|
|
105
|
+
this._context = this._canvas.getContext("2d");
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
/**
|
|
@@ -116,7 +115,7 @@ class ImageCanvas {
|
|
|
116
115
|
* @param {number} [height] - Image height slice. Image height is default.
|
|
117
116
|
*/
|
|
118
117
|
drawImage(img, x, y, width, height) {
|
|
119
|
-
this._context = this._canvas.getContext(
|
|
118
|
+
this._context = this._canvas.getContext("2d");
|
|
120
119
|
this._context.drawImage(img, x || 0, y || 0, width || img.width, height || img.height);
|
|
121
120
|
}
|
|
122
121
|
|
|
@@ -154,8 +153,8 @@ class ImageCanvas {
|
|
|
154
153
|
* @param {string} [color] - Css font color.
|
|
155
154
|
*/
|
|
156
155
|
drawText(text, x, y, font, color) {
|
|
157
|
-
this._context.fillStyle = color ||
|
|
158
|
-
this._context.font = font ||
|
|
156
|
+
this._context.fillStyle = color || "black";
|
|
157
|
+
this._context.font = font || "normal 14px Verdana";
|
|
159
158
|
this._context.fillText(text, x || 0, y || 14);
|
|
160
159
|
}
|
|
161
160
|
|
|
@@ -201,14 +200,18 @@ class ImageCanvas {
|
|
|
201
200
|
openImage() {
|
|
202
201
|
var img = this.getImage();
|
|
203
202
|
var dataUrl = img.src;
|
|
204
|
-
var windowContent =
|
|
205
|
-
windowContent +=
|
|
206
|
-
windowContent +=
|
|
207
|
-
windowContent +=
|
|
203
|
+
var windowContent = "<!DOCTYPE html>";
|
|
204
|
+
windowContent += "<html>";
|
|
205
|
+
windowContent += "<head><title>Print</title></head>";
|
|
206
|
+
windowContent += "<body>";
|
|
208
207
|
windowContent += '<img src="' + dataUrl + '">';
|
|
209
|
-
windowContent +=
|
|
210
|
-
windowContent +=
|
|
211
|
-
var printWin = window.open(
|
|
208
|
+
windowContent += "</body>";
|
|
209
|
+
windowContent += "</html>";
|
|
210
|
+
var printWin = window.open(
|
|
211
|
+
"",
|
|
212
|
+
"",
|
|
213
|
+
"width=" + img.width + "px ,height=" + img.height + "px"
|
|
214
|
+
);
|
|
212
215
|
printWin.document.open();
|
|
213
216
|
printWin.document.write(windowContent);
|
|
214
217
|
printWin.document.close();
|
|
@@ -223,4 +226,4 @@ class ImageCanvas {
|
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
|
|
226
|
-
export { ImageCanvas };
|
|
229
|
+
export { ImageCanvas };
|
package/src/og/LonLat.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module og/LonLat
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as mercator from
|
|
7
|
+
import * as mercator from "./mercator.js";
|
|
8
8
|
|
|
9
9
|
const HALF_PI = Math.PI * 0.5;
|
|
10
10
|
const INV_PI_BY_180 = 180.0 / Math.PI;
|
|
@@ -20,14 +20,12 @@ const INV_PI_BY_180_HALF_PI = INV_PI_BY_180 * HALF_PI;
|
|
|
20
20
|
* @param {number} [height] - Height over the surface.
|
|
21
21
|
*/
|
|
22
22
|
export class LonLat {
|
|
23
|
-
|
|
24
23
|
/**
|
|
25
24
|
* @param {number} [lon] - Longitude.
|
|
26
25
|
* @param {number} [lat] - Latitude.
|
|
27
26
|
* @param {number} [height] - Height over the surface.
|
|
28
27
|
*/
|
|
29
28
|
constructor(lon, lat, height) {
|
|
30
|
-
|
|
31
29
|
/**
|
|
32
30
|
* Longitude.
|
|
33
31
|
* @public
|
|
@@ -88,9 +86,11 @@ export class LonLat {
|
|
|
88
86
|
* @returns {LonLat} -
|
|
89
87
|
*/
|
|
90
88
|
static forwardMercator(lon, lat, height) {
|
|
91
|
-
return new LonLat(
|
|
89
|
+
return new LonLat(
|
|
90
|
+
lon * mercator.POLE_BY_180,
|
|
92
91
|
Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI,
|
|
93
|
-
height
|
|
92
|
+
height
|
|
93
|
+
);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
@@ -102,9 +102,11 @@ export class LonLat {
|
|
|
102
102
|
* @returns {LonLat} -
|
|
103
103
|
*/
|
|
104
104
|
static inverseMercator(x, y, height) {
|
|
105
|
-
return new LonLat(
|
|
105
|
+
return new LonLat(
|
|
106
|
+
x * mercator.INV_POLE_BY_180,
|
|
106
107
|
INV_PI_BY_360 * Math.atan(Math.exp(y * mercator.PI_BY_POLE)) - INV_PI_BY_180_HALF_PI,
|
|
107
|
-
height
|
|
108
|
+
height
|
|
109
|
+
);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
@@ -162,7 +164,8 @@ export class LonLat {
|
|
|
162
164
|
}
|
|
163
165
|
return new LonLat(
|
|
164
166
|
this.lon * mercator.POLE_BY_180,
|
|
165
|
-
Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI
|
|
167
|
+
Math.log(Math.tan((90.0 + lat) * PI_BY_360)) * mercator.POLE_BY_PI
|
|
168
|
+
);
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
/**
|
|
@@ -187,4 +190,4 @@ export class LonLat {
|
|
|
187
190
|
return this.lon === b.lon && this.lat === b.lat;
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
|
-
}
|
|
193
|
+
}
|
package/src/og/Popup.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Events } from
|
|
4
|
-
import { Vec3 } from
|
|
5
|
-
import { getHTML, parseHTML, createLonLat } from
|
|
3
|
+
import { Events } from "./Events.js";
|
|
4
|
+
import { Vec3 } from "./math/Vec3.js";
|
|
5
|
+
import { getHTML, parseHTML, createLonLat } from "./utils/shared.js";
|
|
6
6
|
|
|
7
|
-
const TEMPLATE =
|
|
8
|
-
`<div class="og-popup {className}">
|
|
7
|
+
const TEMPLATE = `<div class="og-popup {className}">
|
|
9
8
|
<div class="og-popup-content-wrapper">
|
|
10
9
|
<div class="og-popup-content"></div>
|
|
11
10
|
</div>
|
|
@@ -20,13 +19,11 @@ const TEMPLATE =
|
|
|
20
19
|
</div>`;
|
|
21
20
|
|
|
22
21
|
class Popup {
|
|
23
|
-
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {*} options
|
|
23
|
+
*
|
|
24
|
+
* @param {*} options
|
|
27
25
|
*/
|
|
28
26
|
constructor(options) {
|
|
29
|
-
|
|
30
27
|
this._id = Popup._staticCounter++;
|
|
31
28
|
|
|
32
29
|
this.events = new Events(["open", "close"]);
|
|
@@ -77,7 +74,13 @@ class Popup {
|
|
|
77
74
|
|
|
78
75
|
setScreen(p) {
|
|
79
76
|
if (this._planet) {
|
|
80
|
-
|
|
77
|
+
let r = this._planet.renderer.handler.pixelRatio;
|
|
78
|
+
this.el.style.transform =
|
|
79
|
+
"translate(" +
|
|
80
|
+
(p.x / r - this.clientWidth * 0.5) +
|
|
81
|
+
"px, " +
|
|
82
|
+
(p.y / r - this._planet.renderer.handler.canvas.clientHeight - this._tipEl.clientHeight) +
|
|
83
|
+
"px)";
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -102,8 +105,8 @@ class Popup {
|
|
|
102
105
|
render(params) {
|
|
103
106
|
this.el = this._renderTemplate(params);
|
|
104
107
|
this._contentEl = this.el.querySelector(".og-popup-content");
|
|
105
|
-
this._titleEl = this.el.querySelector(".og-popup-title")
|
|
106
|
-
this._tipEl = this.el.querySelector(".og-popup-tip-container")
|
|
108
|
+
this._titleEl = this.el.querySelector(".og-popup-title");
|
|
109
|
+
this._tipEl = this.el.querySelector(".og-popup-tip-container");
|
|
107
110
|
this.setOffset(this._offset[0], this._offset[1]);
|
|
108
111
|
this.setContent(this._content);
|
|
109
112
|
this.setTitle(this._title);
|
|
@@ -153,7 +156,6 @@ class Popup {
|
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
setCartesian3v(cart, height = 0) {
|
|
156
|
-
|
|
157
159
|
this._cartPos = cart;
|
|
158
160
|
|
|
159
161
|
if (this._planet) {
|
|
@@ -192,10 +194,10 @@ class Popup {
|
|
|
192
194
|
if (content) {
|
|
193
195
|
this.clear();
|
|
194
196
|
this._content = content;
|
|
195
|
-
if (typeof content ===
|
|
197
|
+
if (typeof content === "string") {
|
|
196
198
|
this._contentEl.innerHTML = content;
|
|
197
199
|
} else {
|
|
198
|
-
this._contentEl.appendChild(content)
|
|
200
|
+
this._contentEl.appendChild(content);
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
return this;
|
|
@@ -207,4 +209,4 @@ class Popup {
|
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
|
|
210
|
-
export { Popup };
|
|
212
|
+
export { Popup };
|
package/src/og/QueueArray.js
CHANGED