@openglobus/og 0.13.7 → 0.13.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/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/Object3d.js +384 -0
- package/src/og/arial.js +1705 -1703
- package/src/og/camera/Camera.js +640 -640
- package/src/og/control/EarthCoordinates.js +1 -1
- package/src/og/control/LayerAnimation.js +115 -0
- package/src/og/control/MouseNavigation.js +460 -460
- package/src/og/control/Sun.js +170 -170
- package/src/og/control/ZoomControl.js +0 -2
- package/src/og/control/index.js +3 -1
- package/src/og/control/ruler/Ruler.js +43 -0
- package/src/og/control/ruler/RulerScene.js +370 -0
- package/src/og/control/visibleExtent/Segment.js +1 -4
- package/src/og/ellipsoid/Ellipsoid.js +19 -0
- package/src/og/entity/Entity.js +1 -1
- package/src/og/entity/GeoObject.js +1 -1
- package/src/og/entity/LabelHandler.js +1 -0
- package/src/og/layer/Layer.js +23 -40
- package/src/og/layer/Vector.js +80 -14
- package/src/og/layer/XYZ.js +4 -0
- package/src/og/math/Vec3.js +1 -1
- package/src/og/math.js +4 -4
- package/src/og/quadTree/Node.js +1 -1
- package/src/og/renderer/Renderer.js +1 -2
- package/src/og/res/images.js +0 -2
- package/src/og/scene/Planet.js +3 -2
- package/src/og/segment/Segment.js +0 -8
- package/src/og/shaders/label.js +30 -42
- package/src/og/utils/FontAtlas.js +1 -2
- package/src/og/utils/Loader.js +160 -153
- package/src/og/utils/VectorTileCreator.js +1 -1
- package/src/og/webgl/ProgramController.js +143 -143
- package/types/Object3d.d.ts +21 -0
- package/types/arial.d.ts +1 -0
- package/types/control/Sun.d.ts +1 -1
- package/types/control/index.d.ts +2 -1
- package/types/control/ruler/Ruler.d.ts +13 -0
- package/types/control/ruler/RulerScene.d.ts +48 -0
- package/types/ellipsoid/Ellipsoid.d.ts +8 -0
- package/types/layer/Layer.d.ts +23 -31
- package/types/layer/Vector.d.ts +2 -0
- package/types/layer/XYZ.d.ts +1 -0
- package/types/math.d.ts +1 -1
- package/types/res/images.d.ts +0 -1
- package/types/scene/Planet.d.ts +2 -2
- package/types/utils/Loader.d.ts +1 -0
|
@@ -183,12 +183,12 @@ class EarthCoordinates extends Control {
|
|
|
183
183
|
|
|
184
184
|
_grabCoordinates(px) {
|
|
185
185
|
let scrPx;
|
|
186
|
+
let r = this.renderer;
|
|
186
187
|
if (this._centerMode) {
|
|
187
188
|
scrPx = r.handler.getCenter();
|
|
188
189
|
} else {
|
|
189
190
|
scrPx = px;
|
|
190
191
|
}
|
|
191
|
-
let r = this.renderer;
|
|
192
192
|
this._lonLat = this.planet.getLonLatFromPixelTerrain(scrPx);
|
|
193
193
|
this._showFn(this._lonLat);
|
|
194
194
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module og/control/LayerAnimation
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
import { Control } from "./Control.js";
|
|
8
|
+
import { Events } from '../Events.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
* @extends {Control}
|
|
14
|
+
* @param {Object} [options] - Control options.
|
|
15
|
+
*/
|
|
16
|
+
class LayerAnimation extends Control {
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
super(options);
|
|
19
|
+
|
|
20
|
+
this.events = new Events(["change"])
|
|
21
|
+
|
|
22
|
+
this._name = `layerAnimation ${this._id}`;
|
|
23
|
+
|
|
24
|
+
this._layersArr = options.layers || [];
|
|
25
|
+
this._layersIndexesArr = this._layersArr.map((l) => l._id);
|
|
26
|
+
|
|
27
|
+
this._currentIndex = -1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
oninit() {
|
|
31
|
+
super.oninit();
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < this._layersArr.length; i++) {
|
|
34
|
+
let li = this._layersArr[i];
|
|
35
|
+
li.setVisibility(false);
|
|
36
|
+
li.opacity = 0.0;
|
|
37
|
+
this.planet.addLayer(li);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
this._onLayerLoadend_ = this._onLayerLoadend.bind(this);
|
|
42
|
+
this.planet._tileLoader.events.on("layerloadend", this._onLayerLoadend_, this);
|
|
43
|
+
|
|
44
|
+
this.setCurrentIndex(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onactivate() {
|
|
48
|
+
super.onactivate();
|
|
49
|
+
//...
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
ondeactivate() {
|
|
53
|
+
super.ondeactivate();
|
|
54
|
+
|
|
55
|
+
for (let i = 0; i < this._layersArr.length; i++) {
|
|
56
|
+
this._layersArr[i].setVisibility(false);
|
|
57
|
+
this._layersArr[i].opacity = 1.0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.planet._tileLoader.events.off("layerloadend", this._onLayerLoadend_);
|
|
61
|
+
this._onLayerLoadend_ = null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_onLayerLoadend(layer) {
|
|
65
|
+
let currLayer = this._layersArr[this._currentIndex];
|
|
66
|
+
if (currLayer.isEqual(layer)) {
|
|
67
|
+
console.log("current layer is visible now");
|
|
68
|
+
currLayer.opacity = 1.0;
|
|
69
|
+
let prevLayer = this._layersArr[this._prevIndex];
|
|
70
|
+
if (prevLayer) {
|
|
71
|
+
prevLayer.setVisibility(false);
|
|
72
|
+
prevLayer.opacity = 0.0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setLayers(layers) {
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
appendLayer(layer) {
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setCurrentIndex(index) {
|
|
86
|
+
if (index != this._currentIndex && index >= 0 && index < this._layersArr.length) {
|
|
87
|
+
this._prevIndex = this._currentIndex;
|
|
88
|
+
this._currentIndex = index;
|
|
89
|
+
|
|
90
|
+
let prevLayer = this._layersArr[this._prevIndex],
|
|
91
|
+
currLayer = this._layersArr[index];
|
|
92
|
+
|
|
93
|
+
if (currLayer) {
|
|
94
|
+
currLayer.opacity = 0.0;
|
|
95
|
+
currLayer.setVisibility(true);
|
|
96
|
+
requestAnimationFrame(() => {
|
|
97
|
+
if (currLayer.isIdle) {
|
|
98
|
+
currLayer.opacity = 1.0;
|
|
99
|
+
if (prevLayer) {
|
|
100
|
+
prevLayer.setVisibility(false);
|
|
101
|
+
prevLayer.opacity = 0.0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
this.events.dispatch(this.events.change, this._currentIndex, this._prevIndex);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function layerAnimation(options) {
|
|
112
|
+
return LayerAnimation(options);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { LayerAnimation };
|