@openglobus/og 0.18.5 → 0.19.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.
- package/README.md +17 -69
- package/css/og.css +59 -44
- package/lib/@openglobus/og.css +1 -1
- package/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/js/Globe.d.ts +2 -0
- package/lib/js/Globe.js +3 -1
- package/lib/js/control/DebugInfo.js +5 -0
- package/lib/js/control/LayerSwitcher.d.ts +18 -3
- package/lib/js/control/LayerSwitcher.js +111 -11
- package/lib/js/control/MouseNavigation.d.ts +2 -0
- package/lib/js/control/MouseNavigation.js +15 -15
- package/lib/js/control/elevationProfile/ElevationProfile.js +3 -1
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +7 -7
- package/lib/js/control/heightRuler/HeightRulerScene.js +1 -1
- package/lib/js/control/ruler/RulerScene.js +3 -3
- package/lib/js/control/selection/SelectionScene.js +2 -2
- package/lib/js/entity/Entity.js +5 -1
- package/lib/js/layer/Layer.d.ts +18 -4
- package/lib/js/layer/Layer.js +25 -4
- package/lib/js/layer/XYZ.d.ts +0 -1
- package/lib/js/quadTree/Node.d.ts +21 -3
- package/lib/js/quadTree/Node.js +161 -62
- package/lib/js/renderer/Renderer.js +19 -16
- package/lib/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/js/renderer/RendererEvents.js +5 -0
- package/lib/js/scene/Planet.d.ts +29 -4
- package/lib/js/scene/Planet.js +207 -85
- package/lib/js/segment/Segment.d.ts +7 -1
- package/lib/js/segment/Segment.js +57 -12
- package/lib/js/shaders/drawnode.js +21 -2
- package/lib/js/shaders/geoObject.js +30 -24
- package/lib/js/terrain/GlobusTerrain.js +1 -1
- package/lib/js/utils/shared.d.ts +1 -0
- package/lib/js/utils/shared.js +1 -0
- package/package.json +2 -2
package/lib/js/Globe.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ interface IGlobeParams {
|
|
|
29
29
|
quadTreeStrategyPrototype?: any;
|
|
30
30
|
maxLoadingRequests?: number;
|
|
31
31
|
atmosphereEnabled?: boolean;
|
|
32
|
+
transitionOpacityEnabled?: boolean;
|
|
32
33
|
terrain?: EmptyTerrain;
|
|
33
34
|
controls?: Control[];
|
|
34
35
|
useEarthNavigation?: boolean;
|
|
@@ -92,6 +93,7 @@ interface IGlobeParams {
|
|
|
92
93
|
* @param {number} [options.msaa=0] - MSAA antialiasing parameter: 2,4,8,16. Default is 0.
|
|
93
94
|
* @param {number} [options.dpi] - Device pixel ratio. Default is current screen DPI.
|
|
94
95
|
* @param {boolean} [options.atmosphereEnabled] - Enables atmosphere effect.
|
|
96
|
+
* @param {boolean} [options.transtitionOpacityEnabled] - Enables terrain smooth opacity transition effect.
|
|
95
97
|
*/
|
|
96
98
|
declare class Globe {
|
|
97
99
|
static __counter__: number;
|
package/lib/js/Globe.js
CHANGED
|
@@ -66,6 +66,7 @@ const PLANET_NAME_PREFIX = "globus_planet_";
|
|
|
66
66
|
* @param {number} [options.msaa=0] - MSAA antialiasing parameter: 2,4,8,16. Default is 0.
|
|
67
67
|
* @param {number} [options.dpi] - Device pixel ratio. Default is current screen DPI.
|
|
68
68
|
* @param {boolean} [options.atmosphereEnabled] - Enables atmosphere effect.
|
|
69
|
+
* @param {boolean} [options.transtitionOpacityEnabled] - Enables terrain smooth opacity transition effect.
|
|
69
70
|
*/
|
|
70
71
|
class Globe {
|
|
71
72
|
constructor(options) {
|
|
@@ -146,7 +147,8 @@ class Globe {
|
|
|
146
147
|
minEqualZoomCameraSlope: options.minEqualZoomCameraSlope,
|
|
147
148
|
quadTreeStrategyPrototype: options.quadTreeStrategyPrototype,
|
|
148
149
|
maxLoadingRequests: options.maxLoadingRequests,
|
|
149
|
-
atmosphereEnabled: options.atmosphereEnabled
|
|
150
|
+
atmosphereEnabled: options.atmosphereEnabled,
|
|
151
|
+
transitionOpacityEnabled: options.transitionOpacityEnabled
|
|
150
152
|
});
|
|
151
153
|
// Attach terrain provider (can be one object or array)
|
|
152
154
|
if (options.terrain) {
|
|
@@ -78,6 +78,7 @@ export class DebugInfo extends Control {
|
|
|
78
78
|
this._canvasTiles = new CanvasTiles("Tile grid", {
|
|
79
79
|
visibility: true,
|
|
80
80
|
isBaseLayer: false,
|
|
81
|
+
hideInLayerSwitcher: true,
|
|
81
82
|
drawTile: function (material, applyCanvas) {
|
|
82
83
|
//
|
|
83
84
|
// This is important create canvas here!
|
|
@@ -159,6 +160,10 @@ export class DebugInfo extends Control {
|
|
|
159
160
|
label: "Nodes count",
|
|
160
161
|
frame: () => p._renderedNodes.length
|
|
161
162
|
},
|
|
163
|
+
{
|
|
164
|
+
label: "Planet._fadingNodes",
|
|
165
|
+
frame: () => p._fadingNodes.size
|
|
166
|
+
},
|
|
162
167
|
{
|
|
163
168
|
label: "createdNodes",
|
|
164
169
|
frame: () => p._createdNodesCount
|
|
@@ -2,18 +2,33 @@ import { Control, IControlParams } from "./Control";
|
|
|
2
2
|
import { Dialog } from "../ui/Dialog";
|
|
3
3
|
import { Layer } from "../layer/Layer";
|
|
4
4
|
import { ToggleButton } from "../ui/ToggleButton";
|
|
5
|
+
import { IViewParams, View } from "../ui/View";
|
|
5
6
|
interface ILayerSwitcherParams extends IControlParams {
|
|
6
7
|
}
|
|
8
|
+
declare class LayerButtonView extends View<Layer> {
|
|
9
|
+
constructor(params: IViewParams);
|
|
10
|
+
render(params?: any): this;
|
|
11
|
+
protected _onVisibilityChange: (layer: Layer) => void;
|
|
12
|
+
protected _onClick: () => void;
|
|
13
|
+
protected _onDblClick: () => void;
|
|
14
|
+
remove(): void;
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
17
|
* Advanced :) layer switcher, includes base layers, overlays, geo images etc. groups.
|
|
9
18
|
* Double click for zoom, drag-and-drop to change zIndex
|
|
10
19
|
*/
|
|
11
20
|
export declare class LayerSwitcher extends Control {
|
|
12
|
-
|
|
13
|
-
protected
|
|
21
|
+
protected _dialog: Dialog<null>;
|
|
22
|
+
protected _toggleBtn: ToggleButton;
|
|
23
|
+
protected _panel: View<null>;
|
|
24
|
+
$baseLayers: HTMLElement | null;
|
|
25
|
+
$overlays: HTMLElement | null;
|
|
26
|
+
_layerViews: LayerButtonView[];
|
|
14
27
|
constructor(options?: ILayerSwitcherParams);
|
|
15
28
|
oninit(): void;
|
|
16
|
-
|
|
29
|
+
protected _initLayers(): void;
|
|
30
|
+
protected _createLayerButton(layer: Layer): LayerButtonView;
|
|
31
|
+
addLayer: (layer: Layer) => void;
|
|
17
32
|
removeLayer: (layer: Layer) => void;
|
|
18
33
|
onactivate(): void;
|
|
19
34
|
ondeactivate(): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Control } from "./Control";
|
|
2
2
|
import { Dialog } from "../ui/Dialog";
|
|
3
3
|
import { ToggleButton } from "../ui/ToggleButton";
|
|
4
|
+
import { View } from "../ui/View";
|
|
5
|
+
import { stringTemplate } from "../utils/shared";
|
|
4
6
|
const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="utf-8"?>
|
|
5
7
|
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
|
|
6
8
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
@@ -8,6 +10,60 @@ const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="utf-8"?>
|
|
|
8
10
|
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
|
9
11
|
<g><path d="M500,573.5c-3.2,0-6.5-0.6-9.5-1.9L25,375.6c-9.1-3.8-15-12.7-15-22.6s5.9-18.8,15-22.6l465.5-196c6.1-2.5,12.9-2.5,19,0l465.5,196c9.1,3.8,15,12.7,15,22.6s-5.9,18.8-15,22.6l-465.5,196C506.5,572.9,503.2,573.5,500,573.5L500,573.5z M97.6,353L500,522.4L902.4,353L500,183.6L97.6,353L97.6,353z"/><path d="M500,720.5c-3.2,0-6.5-0.6-9.5-1.9L25,522.6c-12.4-5.2-18.3-19.6-13.1-32.1c5.2-12.5,19.6-18.3,32.1-13.1l456,192l456-192c12.4-5.2,26.9,0.6,32.1,13.1s-0.6,26.9-13.1,32.1l-465.5,196C506.5,719.9,503.2,720.5,500,720.5L500,720.5z"/><path d="M500,867.5c-3.2,0-6.5-0.6-9.5-1.9L25,669.6c-12.4-5.2-18.3-19.6-13.1-32.1c5.2-12.5,19.6-18.3,32.1-13.1l456,192l456-192c12.4-5.2,26.9,0.6,32.1,13.1c5.2,12.5-0.6,26.8-13.1,32.1l-465.5,196C506.5,866.9,503.2,867.5,500,867.5L500,867.5z"/></g>
|
|
10
12
|
</svg>`;
|
|
13
|
+
const TEMPLATE = `<div class="og-layerSwitcher">
|
|
14
|
+
<div class="og-layerSwitcher__title">Base Layers</div>
|
|
15
|
+
<div class="og-layerSwitcher__list og-layerSwitcher__baseLayers"></div>
|
|
16
|
+
|
|
17
|
+
<div class="og-layerSwitcher__title">Overlays</div>
|
|
18
|
+
<div class="og-layerSwitcher__list og-layerSwitcher__overlays"></div>
|
|
19
|
+
|
|
20
|
+
</div>`;
|
|
21
|
+
const LAYER_BUTTON_TEMPLATE = `<button title={title} class="og-layerSwitcher__layerButton">{icon}<div class="og-layerSwitcher__name">{name}</div></button>`;
|
|
22
|
+
class LayerButtonView extends View {
|
|
23
|
+
constructor(params) {
|
|
24
|
+
super({
|
|
25
|
+
template: stringTemplate(LAYER_BUTTON_TEMPLATE, {
|
|
26
|
+
title: params.model.name,
|
|
27
|
+
name: params.model.name,
|
|
28
|
+
icon: params.model.iconSrc ? `<img src="${params.model.iconSrc}" />` : ""
|
|
29
|
+
}),
|
|
30
|
+
...params
|
|
31
|
+
});
|
|
32
|
+
this._onVisibilityChange = (layer) => {
|
|
33
|
+
if (this.el) {
|
|
34
|
+
if (this.model.getVisibility()) {
|
|
35
|
+
this.el.classList.add("og-layerSwitcher__visible");
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.el.classList.remove("og-layerSwitcher__visible");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this._onClick = () => {
|
|
43
|
+
if (this.model.isBaseLayer()) {
|
|
44
|
+
this.model.setVisibility(true);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.model.setVisibility(!this.model.getVisibility());
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this._onDblClick = () => {
|
|
51
|
+
this.model.flyExtent();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
render(params) {
|
|
55
|
+
super.render(params);
|
|
56
|
+
this.model.events.on("visibilitychange", this._onVisibilityChange);
|
|
57
|
+
this._onVisibilityChange(this.model);
|
|
58
|
+
this.el.addEventListener("click", this._onClick);
|
|
59
|
+
this.el.addEventListener("dblclick", this._onDblClick);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
remove() {
|
|
63
|
+
super.remove();
|
|
64
|
+
this.model.events.off("visibilitychange", this._onVisibilityChange);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
11
67
|
/**
|
|
12
68
|
* Advanced :) layer switcher, includes base layers, overlays, geo images etc. groups.
|
|
13
69
|
* Double click for zoom, drag-and-drop to change zIndex
|
|
@@ -18,34 +74,78 @@ export class LayerSwitcher extends Control {
|
|
|
18
74
|
name: "LayerSwitcher",
|
|
19
75
|
...options
|
|
20
76
|
});
|
|
21
|
-
this.
|
|
77
|
+
this.addLayer = (layer) => {
|
|
78
|
+
if (!layer.hideInLayerSwitcher) {
|
|
79
|
+
let layerView = this._createLayerButton(layer);
|
|
80
|
+
this._layerViews.push(layerView);
|
|
81
|
+
if (layer.isBaseLayer()) {
|
|
82
|
+
layerView.appendTo(this.$baseLayers);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
layerView.appendTo(this.$overlays);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
22
88
|
};
|
|
23
89
|
this.removeLayer = (layer) => {
|
|
90
|
+
for (let i = 0; i < this._layerViews.length; i++) {
|
|
91
|
+
let li = this._layerViews[i];
|
|
92
|
+
if (li.model.isEqual(layer)) {
|
|
93
|
+
li.remove();
|
|
94
|
+
this._layerViews.splice(i, 1);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
24
98
|
};
|
|
25
|
-
this.
|
|
99
|
+
this._dialog = new Dialog({
|
|
26
100
|
title: "Layer Switcher",
|
|
27
101
|
top: 15,
|
|
28
102
|
useHide: true,
|
|
29
103
|
visible: false,
|
|
30
|
-
width:
|
|
104
|
+
width: 300,
|
|
105
|
+
maxHeight: 500
|
|
31
106
|
});
|
|
32
|
-
this.
|
|
33
|
-
|
|
107
|
+
this._panel = new View({
|
|
108
|
+
template: TEMPLATE
|
|
109
|
+
});
|
|
110
|
+
this._toggleBtn = new ToggleButton({
|
|
111
|
+
classList: ["og-map-button", "og-layerSwitcher_button"],
|
|
34
112
|
icon: ICON_BUTTON_SVG
|
|
35
113
|
});
|
|
114
|
+
this.$baseLayers = null;
|
|
115
|
+
this.$overlays = null;
|
|
116
|
+
this._layerViews = [];
|
|
36
117
|
}
|
|
37
118
|
oninit() {
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
|
|
119
|
+
this._toggleBtn.appendTo(this.renderer.div);
|
|
120
|
+
this._dialog.appendTo(this.planet.renderer.div);
|
|
121
|
+
this._panel.appendTo(this._dialog.container);
|
|
122
|
+
this.$baseLayers = this._panel.el.querySelector(".og-layerSwitcher__baseLayers");
|
|
123
|
+
this.$overlays = this._panel.el.querySelector(".og-layerSwitcher__overlays");
|
|
124
|
+
this._dialog.setPosition(this.planet.renderer.div.clientWidth - this._dialog.width - 67);
|
|
125
|
+
this._dialog.events.on("visibility", (v) => {
|
|
126
|
+
this._toggleBtn.setActive(v);
|
|
127
|
+
});
|
|
128
|
+
this._toggleBtn.events.on("change", (isActive) => {
|
|
129
|
+
this._dialog.setVisibility(isActive);
|
|
42
130
|
});
|
|
43
|
-
this.planet.events.on("layeradd", this.
|
|
131
|
+
this.planet.events.on("layeradd", this.addLayer, this);
|
|
44
132
|
this.planet.events.on("layerremove", this.removeLayer, this);
|
|
133
|
+
this._initLayers();
|
|
134
|
+
}
|
|
135
|
+
_initLayers() {
|
|
136
|
+
let layers = this.planet.layers;
|
|
137
|
+
for (let i = 0; i < layers.length; i++) {
|
|
138
|
+
this.addLayer(layers[i]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
_createLayerButton(layer) {
|
|
142
|
+
return new LayerButtonView({
|
|
143
|
+
model: layer
|
|
144
|
+
});
|
|
45
145
|
}
|
|
46
146
|
onactivate() {
|
|
47
147
|
}
|
|
48
148
|
ondeactivate() {
|
|
49
|
-
this.
|
|
149
|
+
this._dialog.hide();
|
|
50
150
|
}
|
|
51
151
|
}
|
|
@@ -176,9 +176,7 @@ export class MouseNavigation extends Control {
|
|
|
176
176
|
this.planet.stopFlying();
|
|
177
177
|
this.stopRotation();
|
|
178
178
|
this._deactivate = true;
|
|
179
|
-
this.
|
|
180
|
-
//this.planet!.terrainLock.lock(this._keyLock);
|
|
181
|
-
this.planet._normalMapCreator.lock(this._keyLock);
|
|
179
|
+
this.lockPlanet(true);
|
|
182
180
|
this.stepsForward = MouseNavigation.getMovePointsFromPixelTerrain(this.planet.camera, this.planet, this.stepsCount, this.distDiff, e.pos, e.wheelDelta > 0, e.direction) || null;
|
|
183
181
|
this._wheelDirection = e.wheelDelta;
|
|
184
182
|
if (this.stepsForward) {
|
|
@@ -227,9 +225,7 @@ export class MouseNavigation extends Control {
|
|
|
227
225
|
}
|
|
228
226
|
stopRotation() {
|
|
229
227
|
this.qRot.clear();
|
|
230
|
-
this.
|
|
231
|
-
this.planet.terrainLock.free(this._keyLock);
|
|
232
|
-
this.planet._normalMapCreator.free(this._keyLock);
|
|
228
|
+
this.freePlanet();
|
|
233
229
|
}
|
|
234
230
|
onMouseLeftButtonUp(e) {
|
|
235
231
|
this.renderer.handler.canvas.classList.remove("ogGrabbingPoiner");
|
|
@@ -322,9 +318,7 @@ export class MouseNavigation extends Control {
|
|
|
322
318
|
else {
|
|
323
319
|
if (this._deactivate) {
|
|
324
320
|
this._deactivate = false;
|
|
325
|
-
this.
|
|
326
|
-
this.planet.terrainLock.free(this._keyLock);
|
|
327
|
-
this.planet._normalMapCreator.free(this._keyLock);
|
|
321
|
+
this.freePlanet();
|
|
328
322
|
}
|
|
329
323
|
}
|
|
330
324
|
if (r.events.mouseState.leftButtonDown || !this.scaleRot) {
|
|
@@ -348,15 +342,21 @@ export class MouseNavigation extends Control {
|
|
|
348
342
|
cam._b = rot.mulVec3(cam._b);
|
|
349
343
|
}
|
|
350
344
|
if (cam.eye.distance(prevEye) / cam.getAltitude() > 0.01) {
|
|
351
|
-
this.
|
|
352
|
-
this.planet.terrainLock.lock(this._keyLock);
|
|
353
|
-
this.planet._normalMapCreator.lock(this._keyLock);
|
|
345
|
+
this.lockPlanet();
|
|
354
346
|
}
|
|
355
347
|
else {
|
|
356
|
-
this.
|
|
357
|
-
this.planet.terrainLock.free(this._keyLock);
|
|
358
|
-
this.planet._normalMapCreator.free(this._keyLock);
|
|
348
|
+
this.freePlanet();
|
|
359
349
|
}
|
|
360
350
|
}
|
|
361
351
|
}
|
|
352
|
+
lockPlanet(skipTerrain) {
|
|
353
|
+
this.planet.layerLock.lock(this._keyLock);
|
|
354
|
+
!skipTerrain && this.planet.terrainLock.lock(this._keyLock);
|
|
355
|
+
this.planet._normalMapCreator.lock(this._keyLock);
|
|
356
|
+
}
|
|
357
|
+
freePlanet() {
|
|
358
|
+
this.planet.layerLock.free(this._keyLock);
|
|
359
|
+
this.planet.terrainLock.free(this._keyLock);
|
|
360
|
+
this.planet._normalMapCreator.free(this._keyLock);
|
|
361
|
+
}
|
|
362
362
|
}
|
|
@@ -187,8 +187,10 @@ export class ElevationProfile {
|
|
|
187
187
|
def.reject();
|
|
188
188
|
this._pointsReady = false;
|
|
189
189
|
this._isWarning = false;
|
|
190
|
-
if (!pointsLonLat || !pointsLonLat.length)
|
|
190
|
+
if (!pointsLonLat || !pointsLonLat.length) {
|
|
191
191
|
def.reject();
|
|
192
|
+
return def.promise;
|
|
193
|
+
}
|
|
192
194
|
this.events.dispatch(this.events.startcollecting, this);
|
|
193
195
|
this._promiseCounter++;
|
|
194
196
|
((counter) => {
|
|
@@ -132,26 +132,26 @@ class ElevationProfileScene extends RenderNode {
|
|
|
132
132
|
pickingEnabled: false,
|
|
133
133
|
polygonOffsetUnits: -1.0,
|
|
134
134
|
relativeToGround: true,
|
|
135
|
-
|
|
135
|
+
hideInLayerSwitcher: true
|
|
136
136
|
});
|
|
137
137
|
this._groundPointersLayer = new Vector("ground-pointers", {
|
|
138
138
|
entities: [],
|
|
139
139
|
pickingEnabled: true,
|
|
140
|
-
|
|
140
|
+
hideInLayerSwitcher: true,
|
|
141
141
|
scaleByDistance: [1, 5000, 0.02],
|
|
142
142
|
pickingScale: 1.5
|
|
143
143
|
});
|
|
144
144
|
this._headPointersLayer = new Vector("head-pointers", {
|
|
145
145
|
entities: [],
|
|
146
146
|
pickingEnabled: true,
|
|
147
|
-
|
|
147
|
+
hideInLayerSwitcher: true,
|
|
148
148
|
scaleByDistance: [1, 10000, 0.02],
|
|
149
149
|
pickingScale: 1
|
|
150
150
|
});
|
|
151
151
|
this._columnPointersLayer = new Vector("column-pointers", {
|
|
152
152
|
entities: [],
|
|
153
153
|
pickingEnabled: false,
|
|
154
|
-
|
|
154
|
+
hideInLayerSwitcher: true
|
|
155
155
|
});
|
|
156
156
|
this._trackEntity = new Entity({
|
|
157
157
|
polyline: {
|
|
@@ -164,12 +164,12 @@ class ElevationProfileScene extends RenderNode {
|
|
|
164
164
|
this._trackLayer = new Vector("column-pointers", {
|
|
165
165
|
entities: [this._trackEntity],
|
|
166
166
|
pickingEnabled: false,
|
|
167
|
-
|
|
167
|
+
hideInLayerSwitcher: true
|
|
168
168
|
});
|
|
169
169
|
this._heightsLayer = new Vector("heights-labels", {
|
|
170
170
|
entities: [],
|
|
171
171
|
pickingEnabled: false,
|
|
172
|
-
|
|
172
|
+
hideInLayerSwitcher: true
|
|
173
173
|
});
|
|
174
174
|
this._pointerHeadEntity = new Entity({
|
|
175
175
|
cartesian: new Vec3(),
|
|
@@ -186,7 +186,7 @@ class ElevationProfileScene extends RenderNode {
|
|
|
186
186
|
this._pointerLayer = new Vector("pointer", {
|
|
187
187
|
entities: [this._pointerHeadEntity, this._pointerLabelEntity, this._pointerRayEntity],
|
|
188
188
|
pickingEnabled: false,
|
|
189
|
-
|
|
189
|
+
hideInLayerSwitcher: true
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
flyExtent() {
|
|
@@ -129,19 +129,19 @@ class RulerScene extends RenderNode {
|
|
|
129
129
|
pickingEnabled: false,
|
|
130
130
|
polygonOffsetUnits: -1.0,
|
|
131
131
|
relativeToGround: true,
|
|
132
|
-
|
|
132
|
+
hideInLayerSwitcher: true
|
|
133
133
|
});
|
|
134
134
|
this._labelLayer = new Vector("ruler-label", {
|
|
135
135
|
entities: [],
|
|
136
136
|
pickingEnabled: false,
|
|
137
137
|
polygonOffsetUnits: -100.0,
|
|
138
138
|
relativeToGround: true,
|
|
139
|
-
|
|
139
|
+
hideInLayerSwitcher: true
|
|
140
140
|
});
|
|
141
141
|
this._cornersLayer = new Vector("corners", {
|
|
142
142
|
entities: [],
|
|
143
143
|
pickingEnabled: true,
|
|
144
|
-
|
|
144
|
+
hideInLayerSwitcher: true,
|
|
145
145
|
scaleByDistance: [100, 4000000, 1.0],
|
|
146
146
|
pickingScale: 2
|
|
147
147
|
});
|
|
@@ -85,12 +85,12 @@ class SelectionScene extends RenderNode {
|
|
|
85
85
|
pickingEnabled: false,
|
|
86
86
|
polygonOffsetUnits: -1.0,
|
|
87
87
|
relativeToGround: true,
|
|
88
|
-
|
|
88
|
+
hideInLayerSwitcher: false
|
|
89
89
|
});
|
|
90
90
|
this._cornersLayer = new Vector("corners", {
|
|
91
91
|
entities: [this._cornerEntity[0], this._cornerEntity[1]],
|
|
92
92
|
pickingEnabled: true,
|
|
93
|
-
|
|
93
|
+
hideInLayerSwitcher: true,
|
|
94
94
|
scaleByDistance: [1.0, 4000000, 0.01],
|
|
95
95
|
pickingScale: 2
|
|
96
96
|
});
|
package/lib/js/entity/Entity.js
CHANGED
|
@@ -384,7 +384,11 @@ class Entity {
|
|
|
384
384
|
this.geometry = geometry;
|
|
385
385
|
this.geometry._entity = this;
|
|
386
386
|
this.geometry.setVisibility(this._visibility);
|
|
387
|
-
|
|
387
|
+
let layer = this._layer;
|
|
388
|
+
if (this._layer) {
|
|
389
|
+
this._layer.removeEntity(this);
|
|
390
|
+
}
|
|
391
|
+
layer && layer.add(this);
|
|
388
392
|
return geometry;
|
|
389
393
|
}
|
|
390
394
|
/**
|
package/lib/js/layer/Layer.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { IDefaultTextureParams } from "../webgl/Handler";
|
|
|
10
10
|
export interface ILayerParams {
|
|
11
11
|
properties?: any;
|
|
12
12
|
labelMaxLetters?: number;
|
|
13
|
-
|
|
13
|
+
hideInLayerSwitcher?: boolean;
|
|
14
14
|
opacity?: number;
|
|
15
15
|
minZoom?: number;
|
|
16
16
|
maxZoom?: number;
|
|
@@ -31,6 +31,7 @@ export interface ILayerParams {
|
|
|
31
31
|
specular?: string | NumberArray3 | Vec3;
|
|
32
32
|
shininess?: number;
|
|
33
33
|
nightTextureCoefficient?: number;
|
|
34
|
+
iconSrc?: string | null;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* @class
|
|
@@ -45,11 +46,11 @@ export interface ILayerParams {
|
|
|
45
46
|
* @param {string} [options.attribution] - Layer attribution that displayed in the attribution area on the screen.
|
|
46
47
|
* @param {boolean} [options.isBaseLayer=false] - This is a base layer.
|
|
47
48
|
* @param {boolean} [options.visibility=true] - Layer visibility.
|
|
48
|
-
* @param {boolean} [options.
|
|
49
|
+
* @param {boolean} [options.hideInLayerSwitcher=false] - Presence of layer in dialog window of LayerSwitcher control.
|
|
49
50
|
* @param {boolean} [options.isSRGB=false] - Layer image webgl internal format.
|
|
50
51
|
* @param {Extent} [options.extent=[[-180.0, -90.0], [180.0, 90.0]]] - Visible extent.
|
|
51
52
|
* @param {string} [options.textureFilter="anisotropic"] - Image texture filter. Available values: "nearest", "linear", "mipmap" and "anisotropic".
|
|
52
|
-
*
|
|
53
|
+
* @param {string} [options.icon] - Icon for LayerSwitcher
|
|
53
54
|
* @fires EventsHandler<LayerEventsList>#visibilitychange
|
|
54
55
|
* @fires EventsHandler<LayerEventsList>#add
|
|
55
56
|
* @fires EventsHandler<LayerEventsList>#remove
|
|
@@ -98,7 +99,7 @@ declare class Layer {
|
|
|
98
99
|
*/
|
|
99
100
|
name: string;
|
|
100
101
|
properties: any;
|
|
101
|
-
|
|
102
|
+
hideInLayerSwitcher: boolean;
|
|
102
103
|
/**
|
|
103
104
|
* Minimal zoom level when layer is visible.
|
|
104
105
|
* @public
|
|
@@ -188,7 +189,10 @@ declare class Layer {
|
|
|
188
189
|
_diffuse: Float32Array | null;
|
|
189
190
|
_specular: Float32Array | null;
|
|
190
191
|
isVector: boolean;
|
|
192
|
+
protected _iconSrc: string | null;
|
|
191
193
|
constructor(name?: string | null, options?: ILayerParams);
|
|
194
|
+
get iconSrc(): string | null;
|
|
195
|
+
set iconSrc(src: string | null);
|
|
192
196
|
set diffuse(rgb: string | NumberArray3 | Vec3 | null | undefined);
|
|
193
197
|
set ambient(rgb: string | NumberArray3 | Vec3 | null | undefined);
|
|
194
198
|
set specular(rgb: string | NumberArray3 | Vec3 | null | undefined);
|
|
@@ -354,6 +358,16 @@ declare class Layer {
|
|
|
354
358
|
* @return {Extent} - Layer extent.
|
|
355
359
|
*/
|
|
356
360
|
getExtentMerc(): Extent;
|
|
361
|
+
/**
|
|
362
|
+
* Fly extent.
|
|
363
|
+
* @public
|
|
364
|
+
*/
|
|
365
|
+
flyExtent(): void;
|
|
366
|
+
/**
|
|
367
|
+
* View extent.
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
viewExtent(): void;
|
|
357
371
|
/**
|
|
358
372
|
* Special correction of the whole globe extent.
|
|
359
373
|
* @protected
|
package/lib/js/layer/Layer.js
CHANGED
|
@@ -20,11 +20,11 @@ const FADING_RATIO = 15.8;
|
|
|
20
20
|
* @param {string} [options.attribution] - Layer attribution that displayed in the attribution area on the screen.
|
|
21
21
|
* @param {boolean} [options.isBaseLayer=false] - This is a base layer.
|
|
22
22
|
* @param {boolean} [options.visibility=true] - Layer visibility.
|
|
23
|
-
* @param {boolean} [options.
|
|
23
|
+
* @param {boolean} [options.hideInLayerSwitcher=false] - Presence of layer in dialog window of LayerSwitcher control.
|
|
24
24
|
* @param {boolean} [options.isSRGB=false] - Layer image webgl internal format.
|
|
25
25
|
* @param {Extent} [options.extent=[[-180.0, -90.0], [180.0, 90.0]]] - Visible extent.
|
|
26
26
|
* @param {string} [options.textureFilter="anisotropic"] - Image texture filter. Available values: "nearest", "linear", "mipmap" and "anisotropic".
|
|
27
|
-
*
|
|
27
|
+
* @param {string} [options.icon] - Icon for LayerSwitcher
|
|
28
28
|
* @fires EventsHandler<LayerEventsList>#visibilitychange
|
|
29
29
|
* @fires EventsHandler<LayerEventsList>#add
|
|
30
30
|
* @fires EventsHandler<LayerEventsList>#remove
|
|
@@ -56,11 +56,11 @@ class Layer {
|
|
|
56
56
|
constructor(name, options = {}) {
|
|
57
57
|
this.isVector = false;
|
|
58
58
|
this.__id = Layer.__counter__++;
|
|
59
|
+
this._iconSrc = options.iconSrc || null;
|
|
59
60
|
this.events = createEvents(LAYER_EVENTS, this);
|
|
60
61
|
this.name = name || "noname";
|
|
61
62
|
this.properties = options.properties || {};
|
|
62
|
-
this.
|
|
63
|
-
options.displayInLayerSwitcher !== undefined ? options.displayInLayerSwitcher : true;
|
|
63
|
+
this.hideInLayerSwitcher = options.hideInLayerSwitcher || false;
|
|
64
64
|
this._hasImageryTiles = true;
|
|
65
65
|
this._opacity = options.opacity || 1.0;
|
|
66
66
|
this.minZoom = options.minZoom || 0;
|
|
@@ -116,6 +116,13 @@ class Layer {
|
|
|
116
116
|
}
|
|
117
117
|
this.nightTextureCoefficient = options.nightTextureCoefficient || 1.0;
|
|
118
118
|
}
|
|
119
|
+
get iconSrc() {
|
|
120
|
+
return this._iconSrc;
|
|
121
|
+
}
|
|
122
|
+
set iconSrc(src) {
|
|
123
|
+
// @todo: add event
|
|
124
|
+
this._iconSrc = src;
|
|
125
|
+
}
|
|
119
126
|
set diffuse(rgb) {
|
|
120
127
|
if (rgb) {
|
|
121
128
|
let vec = createColorRGB(rgb);
|
|
@@ -508,6 +515,20 @@ class Layer {
|
|
|
508
515
|
getExtentMerc() {
|
|
509
516
|
return this._extentMerc;
|
|
510
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Fly extent.
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
522
|
+
flyExtent() {
|
|
523
|
+
this._planet?.flyExtent(this.getExtent());
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* View extent.
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
viewExtent() {
|
|
530
|
+
this._planet?.viewExtent(this.getExtent());
|
|
531
|
+
}
|
|
511
532
|
/**
|
|
512
533
|
* Special correction of the whole globe extent.
|
|
513
534
|
* @protected
|
package/lib/js/layer/XYZ.d.ts
CHANGED
|
@@ -73,7 +73,6 @@ export declare class XYZ extends Layer {
|
|
|
73
73
|
/**
|
|
74
74
|
* Rewrites imagery tile url query.
|
|
75
75
|
* @private
|
|
76
|
-
* @callback og.layer.XYZ~_urlRewriteCallback
|
|
77
76
|
* @param {Segment} segment - Segment to load.
|
|
78
77
|
* @param {string} url - Created url.
|
|
79
78
|
* @returns {string} - Url query string.
|
|
@@ -20,6 +20,7 @@ declare class Node {
|
|
|
20
20
|
partId: number;
|
|
21
21
|
nodeId: number;
|
|
22
22
|
state: number | null;
|
|
23
|
+
prevState: number | null;
|
|
23
24
|
appliedTerrainNodeId: number;
|
|
24
25
|
sideSizeLog2: [number, number, number, number];
|
|
25
26
|
ready: boolean;
|
|
@@ -29,6 +30,7 @@ declare class Node {
|
|
|
29
30
|
segment: Segment;
|
|
30
31
|
_cameraInside: boolean;
|
|
31
32
|
inFrustum: number;
|
|
33
|
+
_fadingNodes: Node[];
|
|
32
34
|
constructor(SegmentPrototype: typeof Segment, planet: Planet, partId: number, parent: Node | null, id: number, tileZoom: number, extent: Extent);
|
|
33
35
|
createChildrenNodes(): void;
|
|
34
36
|
createBounds(): void;
|
|
@@ -40,14 +42,30 @@ declare class Node {
|
|
|
40
42
|
* @returns {Node} -
|
|
41
43
|
*/
|
|
42
44
|
getEqualNeighbor(side: number): Node | undefined;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
traverseNodes(cam: PlanetCamera, maxZoom?: number | null, terrainReadySegment?: Segment | null, stopLoading?: boolean, zoomPassNode?: Node): void;
|
|
46
|
+
renderTree(cam: PlanetCamera, maxZoom?: number | null, terrainReadySegment?: Segment | null, stopLoading?: boolean, zoomPassNode?: Node): void;
|
|
45
47
|
renderNode(inFrustum: number, onlyTerrain?: boolean, terrainReadySegment?: Segment | null, stopLoading?: boolean): void;
|
|
48
|
+
childrenPrevStateEquals(state: number): boolean;
|
|
49
|
+
isFading(): boolean;
|
|
50
|
+
_collectFadingNodes(): void;
|
|
51
|
+
clearNeighbors(): void;
|
|
52
|
+
_refreshTransitionOpacity(): void;
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
54
|
+
* Picking up current node to render processing.
|
|
48
55
|
* @public
|
|
49
56
|
*/
|
|
50
57
|
addToRender(inFrustum: number): void;
|
|
58
|
+
applyNeighbor(node: Node, side: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Searching current node for its neighbours.
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
getRenderedNodesNeighbors(nodes: Node[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Checking if current node has a common side with input node and return side index N, E, S or W. Otherwise returns -1.
|
|
66
|
+
* @param {Node} node - Input node
|
|
67
|
+
* @returns {number} - Node side index
|
|
68
|
+
*/
|
|
51
69
|
getCommonSide(node: Node): number;
|
|
52
70
|
whileNormalMapCreating(): void;
|
|
53
71
|
whileTerrainLoading(terrainReadySegment?: Segment | null): void;
|