@openglobus/og 0.16.3 → 0.17.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.
- package/README.md +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +1 -0
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +50 -63
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +26 -24
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "[OpenGlobus](https://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"
|
package/src/og/Clock.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/Clock
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
import * as jd from "./astro/jd.js";
|
|
@@ -14,7 +10,7 @@ import { Events } from "./Events.js";
|
|
|
14
10
|
* @param {number} [params.startDate=0.0] - Julian start date.
|
|
15
11
|
* @param {number} [params.endDate=0.0] - Julian end date.
|
|
16
12
|
* @param {number} [params.currentDate] - Julian current date. Default: current date.
|
|
17
|
-
* @param {number} [params.multiplier=1.0] - Time speed
|
|
13
|
+
* @param {number} [params.multiplier=1.0] - Time speed multiplier.
|
|
18
14
|
*/
|
|
19
15
|
class Clock {
|
|
20
16
|
static get _staticCounter() {
|
package/src/og/Events.js
CHANGED
package/src/og/Extent.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/Extent
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
import { LonLat } from "./LonLat.js";
|
|
@@ -11,13 +7,13 @@ import * as mercator from "./mercator.js";
|
|
|
11
7
|
/**
|
|
12
8
|
* Represents geographical coordinates extent.
|
|
13
9
|
* @class
|
|
14
|
-
* @param {LonLat} [sw] - South West extent corner
|
|
15
|
-
* @param {LonLat} [ne] - North East extent corner
|
|
10
|
+
* @param {LonLat} [sw] - South West extent corner coordinates.
|
|
11
|
+
* @param {LonLat} [ne] - North East extent corner coordinates.
|
|
16
12
|
*/
|
|
17
13
|
export class Extent {
|
|
18
14
|
/**
|
|
19
|
-
* @param {LonLat} [sw] - South West extent corner
|
|
20
|
-
* @param {LonLat} [ne] - North East extent corner
|
|
15
|
+
* @param {LonLat} [sw] - South West extent corner coordinates.
|
|
16
|
+
* @param {LonLat} [ne] - North East extent corner coordinates.
|
|
21
17
|
*/
|
|
22
18
|
constructor(sw = new LonLat(), ne = new LonLat()) {
|
|
23
19
|
/**
|
|
@@ -86,7 +82,7 @@ export class Extent {
|
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
|
89
|
-
* Creates bound extent instance by
|
|
85
|
+
* Creates bound extent instance by coordinates array.
|
|
90
86
|
* @static
|
|
91
87
|
* @param {Array.<Array<number>>} arr - Coordinate array. (exactly 2 entries)
|
|
92
88
|
* @return {Extent} Extent object.
|
package/src/og/Globe.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// StandWithUkraine
|
|
1
|
+
// #StandWithUkraine
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module og/Globe
|
|
@@ -18,11 +18,9 @@ import { Vec3 } from "./math/Vec3.js";
|
|
|
18
18
|
import { Renderer } from "./renderer/Renderer.js";
|
|
19
19
|
import { Planet } from "./scene/Planet.js";
|
|
20
20
|
import { EmptyTerrain } from "./terrain/EmptyTerrain.js";
|
|
21
|
-
import { createColorRGB, isEmpty } from "./utils/shared.js";
|
|
21
|
+
import { createColorRGB, getUrlParam, isEmpty } from "./utils/shared.js";
|
|
22
22
|
import { Handler } from "./webgl/Handler.js";
|
|
23
23
|
|
|
24
|
-
/** @const {string} */
|
|
25
|
-
const CANVAS_ID_PREFIX = "globus_viewport_";
|
|
26
24
|
/** @const {string} */
|
|
27
25
|
const PLANET_NAME_PREFIX = "globus_planet_";
|
|
28
26
|
|
|
@@ -73,6 +71,7 @@ const PLANET_NAME_PREFIX = "globus_planet_";
|
|
|
73
71
|
* @param {Number} [options.quadTreeStrategyPrototype] - Prototype of quadTree. QuadTreeStrategy for Earth is default.
|
|
74
72
|
* @param {Number} [options.msaa] - MSAA antialiasing parameter: 2,4,8,16. Default is 4.
|
|
75
73
|
* @param {Number} [options.dpi] - Device pixel ratio. Default is current screen DPI.
|
|
74
|
+
* @param {Boolean} [options.atmosphereEnabled] - Enables atmosphere effect.
|
|
76
75
|
*/
|
|
77
76
|
|
|
78
77
|
class Globe {
|
|
@@ -80,45 +79,53 @@ class Globe {
|
|
|
80
79
|
* @param {*} options
|
|
81
80
|
*/
|
|
82
81
|
constructor(options) {
|
|
83
|
-
window.__globus__ = this;
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
this.$target = null;
|
|
84
|
+
|
|
85
|
+
this._instanceID = `__globus${Globe.__staticCounter++ ? Globe.__staticCounter : ""}__`;
|
|
86
|
+
window[this._instanceID] = this;
|
|
87
87
|
|
|
88
|
+
//
|
|
89
|
+
// Canvas creation
|
|
90
|
+
//
|
|
88
91
|
this._canvas = document.createElement("canvas");
|
|
89
|
-
this._canvas.id =
|
|
92
|
+
this._canvas.id = `canvas${this._instanceID}`;
|
|
90
93
|
this._canvas.style.width = "100%";
|
|
91
94
|
this._canvas.style.height = "100%";
|
|
92
95
|
this._canvas.style.display = "block";
|
|
93
96
|
this._canvas.style.opacity = "0.0";
|
|
94
|
-
this._canvas.style.transition = "opacity
|
|
97
|
+
this._canvas.style.transition = "opacity 150ms";
|
|
95
98
|
|
|
96
99
|
/**
|
|
97
100
|
* Dom element where WebGL canvas creates
|
|
98
101
|
* @public
|
|
99
102
|
* @type {Element}
|
|
100
103
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
this.$inner = document.createElement('div');
|
|
105
|
+
this.$inner.classList.add("og-inner");
|
|
106
|
+
this.$inner.appendChild(this._canvas);
|
|
107
|
+
|
|
108
|
+
this.$inner.attributions = document.createElement('div');
|
|
109
|
+
if (options.attributionContainer) {
|
|
110
|
+
options.attributionContainer.appendChild(this.$inner.attributions);
|
|
103
111
|
} else {
|
|
104
|
-
this.
|
|
105
|
-
|
|
112
|
+
this.$inner.attributions.classList.add("og-attribution");
|
|
113
|
+
this.$inner.appendChild(this.$inner.attributions);
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
this.
|
|
109
|
-
this.div.classList.add("ogViewport");
|
|
116
|
+
this.attachTo(options.target);
|
|
110
117
|
|
|
111
|
-
|
|
118
|
+
const _disableWheel = (e) => {
|
|
112
119
|
e.preventDefault();
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
this.
|
|
122
|
+
this._canvas.onmouseenter = function () {
|
|
116
123
|
document.addEventListener("mousewheel", _disableWheel, {
|
|
117
124
|
capture: false,
|
|
118
125
|
passive: false
|
|
119
126
|
});
|
|
120
127
|
};
|
|
121
|
-
this.
|
|
128
|
+
this._canvas.onmouseleave = function () {
|
|
122
129
|
document.removeEventListener("mousewheel", _disableWheel);
|
|
123
130
|
};
|
|
124
131
|
|
|
@@ -128,7 +135,8 @@ class Globe {
|
|
|
128
135
|
* @type {Renderer}
|
|
129
136
|
*/
|
|
130
137
|
this.renderer = new Renderer(
|
|
131
|
-
new Handler(
|
|
138
|
+
new Handler(this._canvas, {
|
|
139
|
+
autoActivate: false,
|
|
132
140
|
pixelRatio: options.dpi || (window.devicePixelRatio + 0.15),
|
|
133
141
|
context: {
|
|
134
142
|
alpha: false,
|
|
@@ -137,19 +145,11 @@ class Globe {
|
|
|
137
145
|
}
|
|
138
146
|
}), {
|
|
139
147
|
autoActivate: false,
|
|
140
|
-
backgroundColor: createColorRGB(options.backgroundColor, new Vec3(115 / 255, 203 / 255, 249 / 255)),
|
|
141
148
|
msaa: options.msaa
|
|
142
149
|
}
|
|
143
150
|
);
|
|
144
|
-
|
|
145
|
-
this.renderer.div = this
|
|
146
|
-
this.renderer.div.attributions = document.createElement("div");
|
|
147
|
-
if (options.attributionContainer) {
|
|
148
|
-
options.attributionContainer.appendChild(this.div.attributions);
|
|
149
|
-
} else {
|
|
150
|
-
this.div.attributions.classList.add("og-attribution");
|
|
151
|
-
this.div.appendChild(this.div.attributions);
|
|
152
|
-
}
|
|
151
|
+
|
|
152
|
+
this.renderer.div = this.$inner;
|
|
153
153
|
|
|
154
154
|
// Skybox
|
|
155
155
|
if (options.skybox) {
|
|
@@ -170,30 +170,22 @@ class Globe {
|
|
|
170
170
|
*/
|
|
171
171
|
this._quadTreeType = options.quadTreeType;
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
maxAltitude: options.maxAltitude || 15000000,
|
|
190
|
-
maxEqualZoomAltitude: options.maxEqualZoomAltitude,
|
|
191
|
-
minEqualZoomAltitude: options.minEqualZoomAltitude,
|
|
192
|
-
minEqualZoomCameraSlope: options.minEqualZoomCameraSlope,
|
|
193
|
-
quadTreeStrategyPrototype: options.quadTreeStrategyPrototype,
|
|
194
|
-
maxLoadingRequests: options.maxLoadingRequests
|
|
195
|
-
});
|
|
196
|
-
}
|
|
173
|
+
this.planet = new Planet({
|
|
174
|
+
name: this._planetName,
|
|
175
|
+
frustums: options.frustums,
|
|
176
|
+
ellipsoid: options.ellipsoid,
|
|
177
|
+
maxGridSize: options.maxGridSize,
|
|
178
|
+
useNightTexture: options.useNightTexture,
|
|
179
|
+
useSpecularTexture: options.useSpecularTexture,
|
|
180
|
+
minAltitude: options.minAltitude,
|
|
181
|
+
maxAltitude: options.maxAltitude || 15000000,
|
|
182
|
+
maxEqualZoomAltitude: options.maxEqualZoomAltitude,
|
|
183
|
+
minEqualZoomAltitude: options.minEqualZoomAltitude,
|
|
184
|
+
minEqualZoomCameraSlope: options.minEqualZoomCameraSlope,
|
|
185
|
+
quadTreeStrategyPrototype: options.quadTreeStrategyPrototype,
|
|
186
|
+
maxLoadingRequests: options.maxLoadingRequests,
|
|
187
|
+
atmosphereEnabled: options.atmosphereEnabled
|
|
188
|
+
});
|
|
197
189
|
|
|
198
190
|
// Attach terrain provider (can be one object or array)
|
|
199
191
|
if (options.terrain) {
|
|
@@ -268,9 +260,24 @@ class Globe {
|
|
|
268
260
|
|
|
269
261
|
// Run!
|
|
270
262
|
if (options.autoActivate || isEmpty(options.autoActivate)) {
|
|
271
|
-
this.
|
|
272
|
-
|
|
263
|
+
this.start();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
static get __staticCounter() {
|
|
268
|
+
if (!this.__counter && this.__counter !== 0) {
|
|
269
|
+
this.__counter = 0;
|
|
273
270
|
}
|
|
271
|
+
return this.__counter;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
static set __staticCounter(n) {
|
|
275
|
+
this.__counter = n;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
start() {
|
|
279
|
+
this.renderer.start();
|
|
280
|
+
this.fadeIn();
|
|
274
281
|
}
|
|
275
282
|
|
|
276
283
|
/**
|
|
@@ -290,6 +297,36 @@ class Globe {
|
|
|
290
297
|
this._canvas.style.opacity = 0.0;
|
|
291
298
|
}
|
|
292
299
|
|
|
300
|
+
attachTo(target) {
|
|
301
|
+
|
|
302
|
+
this.detach();
|
|
303
|
+
|
|
304
|
+
let t;
|
|
305
|
+
if (target instanceof HTMLElement) {
|
|
306
|
+
t = target;
|
|
307
|
+
} else {
|
|
308
|
+
t = document.getElementById(target) || document.querySelector(target);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (t) {
|
|
312
|
+
this.$target = t;
|
|
313
|
+
t.appendChild(this.$inner);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
detach() {
|
|
318
|
+
if (this.$target) {
|
|
319
|
+
// Remember that when container is zero
|
|
320
|
+
// sized(display none etc.) renderer frame will be stopped
|
|
321
|
+
this.$target.removeChild(this.$inner);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
destroy() {
|
|
326
|
+
this.detach();
|
|
327
|
+
this.renderer.destroy();
|
|
328
|
+
}
|
|
329
|
+
|
|
293
330
|
static get _staticCounter() {
|
|
294
331
|
if (!this._counter && this._counter !== 0) {
|
|
295
332
|
this._counter = 0;
|
package/src/og/ImageCanvas.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/ImageCanvas
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
/**
|
|
@@ -28,7 +24,9 @@ class ImageCanvas {
|
|
|
28
24
|
* @protected
|
|
29
25
|
* @type {Object}
|
|
30
26
|
*/
|
|
31
|
-
this._context = this._canvas.getContext("2d"
|
|
27
|
+
this._context = this._canvas.getContext("2d", {
|
|
28
|
+
willReadFrequently: true
|
|
29
|
+
});
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -62,6 +60,15 @@ class ImageCanvas {
|
|
|
62
60
|
this._context.putImageData(imgd, 0, 0);
|
|
63
61
|
}
|
|
64
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Fills canvas RGBA with color.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
fill(c) {
|
|
68
|
+
this._context.fillStyle = color
|
|
69
|
+
this._context.fill()
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
/**
|
|
66
73
|
* Gets canvas pixels RGBA data.
|
|
67
74
|
* @public
|
package/src/og/Lock.js
CHANGED
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this._lock
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this._lock
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this._lock
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return this._lock
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { Lock, Key };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class Lock {
|
|
4
|
+
|
|
5
|
+
constructor() {
|
|
6
|
+
this._lock = 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
lock(key) {
|
|
10
|
+
this._lock |= (1 << key._id);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
free(key) {
|
|
14
|
+
this._lock &= ~(1 << key._id);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
isFree() {
|
|
18
|
+
return this._lock === 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
isLocked() {
|
|
22
|
+
return this._lock !== 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class Key {
|
|
27
|
+
|
|
28
|
+
static get _staticCounter() {
|
|
29
|
+
if (!this._counter && this._counter !== 0) {
|
|
30
|
+
this._counter = 0;
|
|
31
|
+
}
|
|
32
|
+
return this._counter;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static set _staticCounter(n) {
|
|
36
|
+
this._counter = n;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
this._id = Key._staticCounter++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { Lock, Key };
|
package/src/og/LonLat.js
CHANGED
package/src/og/Object3d.js
CHANGED
|
@@ -379,7 +379,7 @@ class Object3d {
|
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
static async loadObj(src) {
|
|
382
|
-
const obj = await fetch(src)
|
|
382
|
+
const obj = await fetch(src, { mode: "cors", })
|
|
383
383
|
.then((response) => response.text())
|
|
384
384
|
.then((data) => transformLeftToRightCoordinateSystem(objParser(data)))
|
|
385
385
|
.catch(() => []);
|
package/src/og/Stack.js
CHANGED
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this._current
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this._current
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { Stack };
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class Node {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.next = null;
|
|
6
|
+
this.prev = null;
|
|
7
|
+
this.data = null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class Stack {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {number} [size]
|
|
15
|
+
*/
|
|
16
|
+
constructor(size = 256) {
|
|
17
|
+
this._current = new Node();
|
|
18
|
+
this._head = this._current;
|
|
19
|
+
|
|
20
|
+
for (var i = 0; i < size; i++) {
|
|
21
|
+
var n = new Node();
|
|
22
|
+
n.prev = this._current;
|
|
23
|
+
this._current.next = n;
|
|
24
|
+
this._current = n;
|
|
25
|
+
}
|
|
26
|
+
this._current = this._head;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
current() {
|
|
30
|
+
return this._current;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
push(data) {
|
|
34
|
+
this._current = this._current.next;
|
|
35
|
+
this._current.data = data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pop(data) {
|
|
39
|
+
this._current = this._current.prev;
|
|
40
|
+
return this._current.next.data;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
popPrev(data) {
|
|
44
|
+
this._current = this._current.prev;
|
|
45
|
+
return this._current.data;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { Stack };
|