@openglobus/og 0.14.10 → 0.15.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/css/og.css +378 -275
- 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 +18 -17
- package/src/og/Clock.js +218 -194
- package/src/og/Globe.js +5 -5
- package/src/og/Object3d.js +104 -145
- package/src/og/camera/Camera.js +31 -27
- package/src/og/camera/PlanetCamera.js +22 -14
- package/src/og/cons.js +107 -107
- package/src/og/control/Atmosphere.js +396 -0
- package/src/og/control/CompassButton.js +11 -18
- package/src/og/control/Control.js +197 -188
- package/src/og/control/GeoImageDragControl.js +84 -66
- package/src/og/control/LayerSwitcher.js +56 -138
- package/src/og/control/Lighting.js +314 -186
- package/src/og/control/MouseNavigation.js +2 -2
- package/src/og/control/RulerSwitcher.js +24 -19
- package/src/og/control/ScaleControl.js +30 -10
- package/src/og/control/SimpleSkyBackground.js +210 -0
- package/src/og/control/Sun.js +3 -1
- package/src/og/control/ZoomControl.js +30 -42
- package/src/og/control/index.js +6 -0
- package/src/og/control/ruler/RulerScene.js +5 -23
- package/src/og/control/selection/Selection.js +99 -0
- package/src/og/control/selection/SelectionScene.js +350 -0
- package/src/og/control/timeline/TimelineControl.js +99 -0
- package/src/og/control/timeline/TimelineModel.js +133 -0
- package/src/og/control/timeline/TimelineView.js +449 -0
- package/src/og/control/timeline/timelineUtils.js +132 -0
- package/src/og/ellipsoid/Ellipsoid.js +120 -93
- package/src/og/ellipsoid/wgs84.js +13 -13
- package/src/og/entity/Entity.js +36 -9
- package/src/og/entity/EntityCollection.js +0 -2
- package/src/og/entity/GeoObject.js +72 -56
- package/src/og/entity/GeoObjectHandler.js +487 -656
- package/src/og/entity/GeometryHandler.js +1341 -1337
- package/src/og/entity/Polyline.js +0 -16
- package/src/og/entity/Ray.js +0 -10
- package/src/og/entity/RayHandler.js +3 -44
- package/src/og/entity/Strip.js +1 -6
- package/src/og/index.js +13 -7
- package/src/og/input/input.js +3 -1
- package/src/og/layer/CanvasTiles.js +39 -34
- package/src/og/layer/Layer.js +69 -9
- package/src/og/layer/Material.js +1 -8
- package/src/og/layer/WMS.js +16 -5
- package/src/og/light/LightSource.js +2 -0
- package/src/og/math/Line3.js +140 -139
- package/src/og/math/Plane.js +118 -117
- package/src/og/math/Ray.js +242 -239
- package/src/og/math/Vec3.js +56 -37
- package/src/og/math/Vec4.js +3 -4
- package/src/og/math.js +21 -21
- package/src/og/quadTree/Node.js +5 -4
- package/src/og/quadTree/index.js +12 -0
- package/src/og/renderer/Renderer.js +64 -37
- package/src/og/renderer/RendererEvents.js +1071 -1065
- package/src/og/scene/Planet.js +354 -174
- package/src/og/scene/RenderNode.js +27 -12
- package/src/og/segment/Segment.js +0 -5
- package/src/og/shaders/atmos.js +332 -0
- package/src/og/shaders/drawnode.js +475 -109
- package/src/og/shaders/geoObject.js +96 -51
- package/src/og/shaders/polyline.js +212 -17
- package/src/og/shaders/ray.js +13 -6
- package/src/og/shaders/toneMapping.js +5 -5
- package/src/og/shaders/utils.js +88 -0
- package/src/og/terrain/GlobusTerrain.js +5 -4
- package/src/og/terrain/MapboxTerrain.js +231 -52
- package/src/og/ui/Button.js +106 -0
- package/src/og/ui/ButtonGroup.js +57 -0
- package/src/og/ui/Dialog.js +242 -0
- package/src/og/ui/Slider.js +144 -0
- package/src/og/ui/ToggleButton.js +51 -0
- package/src/og/{control → ui}/UIhelpers.js +11 -2
- package/src/og/ui/View.js +190 -0
- package/src/og/utils/shared.js +960 -942
- package/src/og/webgl/Framebuffer.js +308 -387
- package/src/og/webgl/Handler.js +90 -30
- package/src/og/webgl/Multisample.js +8 -0
- package/types/Clock.d.ts +7 -2
- package/types/Object3d.d.ts +14 -3
- package/types/camera/Camera.d.ts +18 -17
- package/types/camera/PlanetCamera.d.ts +3 -1
- package/types/control/Atmosphere.d.ts +15 -0
- package/types/control/CompassButton.d.ts +1 -2
- package/types/control/GeoImageDragControl.d.ts +7 -1
- package/types/control/LayerSwitcher.d.ts +5 -6
- package/types/control/Lighting.d.ts +32 -7
- package/types/control/ScaleControl.d.ts +2 -1
- package/types/control/SimpleSkyBackground.d.ts +15 -0
- package/types/control/ZoomControl.d.ts +0 -1
- package/types/control/index.d.ts +4 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/Selection.d.ts +49 -0
- package/types/control/selection/SelectionScene.d.ts +34 -0
- package/types/ellipsoid/Ellipsoid.d.ts +3 -2
- package/types/entity/Entity.d.ts +8 -0
- package/types/entity/GeoObject.d.ts +28 -22
- package/types/entity/GeoObjectHandler.d.ts +16 -56
- package/types/entity/Ray.d.ts +0 -3
- package/types/entity/RayHandler.d.ts +0 -4
- package/types/index.d.ts +9 -6
- package/types/input/input.d.ts +2 -0
- package/types/layer/CanvasTiles.d.ts +1 -0
- package/types/layer/Layer.d.ts +9 -0
- package/types/layer/WMS.d.ts +7 -3
- package/types/math/Plane.d.ts +1 -1
- package/types/math/Vec3.d.ts +19 -16
- package/types/math/Vec4.d.ts +2 -3
- package/types/math.d.ts +20 -20
- package/types/quadTree/index.d.ts +10 -0
- package/types/renderer/Renderer.d.ts +11 -37
- package/types/scene/Planet.d.ts +27 -1
- package/types/scene/RenderNode.d.ts +2 -1
- package/types/segment/Segment.d.ts +1 -1
- package/types/shaders/atmos.d.ts +4 -0
- package/types/shaders/drawnode.d.ts +3 -2
- package/types/shaders/utils.d.ts +1 -0
- package/types/terrain/GlobusTerrain.d.ts +1 -1
- package/types/terrain/MapboxTerrain.d.ts +2 -1
- package/types/ui/Button.d.ts +21 -0
- package/types/ui/Dialog.d.ts +41 -0
- package/types/ui/Slider.d.ts +30 -0
- package/types/ui/ToggleButton.d.ts +10 -0
- package/types/{control → ui}/UIhelpers.d.ts +1 -1
- package/types/ui/View.d.ts +32 -0
- package/types/utils/shared.d.ts +16 -14
- package/types/webgl/Framebuffer.d.ts +2 -5
- package/types/webgl/Handler.d.ts +15 -10
- package/types/webgl/Multisample.d.ts +2 -0
- package/src/og/ajax.js +0 -204
- package/src/og/entity/Object3d.js +0 -504
- package/src/og/utils/quadTreeType.js +0 -11
- package/types/ajax.d.ts +0 -24
- package/types/utils/quadTreeType.d.ts +0 -8
|
@@ -1,188 +1,197 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/control/Control
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Base control class for implementing renderer controls.
|
|
9
|
-
* All other controls extend from this class.
|
|
10
|
-
* @class
|
|
11
|
-
* @param {Object} [options] - Control activation options:
|
|
12
|
-
* @param {Boolean} [options.autoActivated=true] - If true - calls initialize function after the renderer assigning.
|
|
13
|
-
*/
|
|
14
|
-
class Control {
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} [options] - Control activation options:
|
|
17
|
-
*/
|
|
18
|
-
constructor(options) {
|
|
19
|
-
options = options || {};
|
|
20
|
-
|
|
21
|
-
this._id = Control.__staticCounter++;
|
|
22
|
-
|
|
23
|
-
this._name = options.name || "_control_" + this._id;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Control initialized.
|
|
27
|
-
* @protected
|
|
28
|
-
* @type {Boolean}
|
|
29
|
-
*/
|
|
30
|
-
this._initialized = false;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Assigned renderer.
|
|
34
|
-
* @public
|
|
35
|
-
* @type {Renderer}
|
|
36
|
-
*/
|
|
37
|
-
this.renderer = null;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Auto activation flag.
|
|
41
|
-
* @public
|
|
42
|
-
* @type {Boolean}
|
|
43
|
-
*/
|
|
44
|
-
this.autoActivate = options.autoActivate
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Control activity.
|
|
48
|
-
* @protected
|
|
49
|
-
* @type {Boolean}
|
|
50
|
-
*/
|
|
51
|
-
this._active = false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static get __staticCounter() {
|
|
55
|
-
if (!this.__counter && this.__counter !== 0) {
|
|
56
|
-
this.__counter = 0;
|
|
57
|
-
}
|
|
58
|
-
return this.__counter;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static set __staticCounter(n) {
|
|
62
|
-
this.__counter = n;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Returns control name.
|
|
67
|
-
* @public
|
|
68
|
-
* @virtual
|
|
69
|
-
*/
|
|
70
|
-
get name() {
|
|
71
|
-
return this._name;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Control initialization function have to be overriden.
|
|
76
|
-
* @public
|
|
77
|
-
* @virtual
|
|
78
|
-
*/
|
|
79
|
-
oninit() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module og/control/Control
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Base control class for implementing renderer controls.
|
|
9
|
+
* All other controls extend from this class.
|
|
10
|
+
* @class
|
|
11
|
+
* @param {Object} [options] - Control activation options:
|
|
12
|
+
* @param {Boolean} [options.autoActivated=true] - If true - calls initialize function after the renderer assigning.
|
|
13
|
+
*/
|
|
14
|
+
class Control {
|
|
15
|
+
/**
|
|
16
|
+
* @param {Object} [options] - Control activation options:
|
|
17
|
+
*/
|
|
18
|
+
constructor(options) {
|
|
19
|
+
options = options || {};
|
|
20
|
+
|
|
21
|
+
this._id = Control.__staticCounter++;
|
|
22
|
+
|
|
23
|
+
this._name = options.name || "_control_" + this._id;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Control initialized.
|
|
27
|
+
* @protected
|
|
28
|
+
* @type {Boolean}
|
|
29
|
+
*/
|
|
30
|
+
this._initialized = false;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Assigned renderer.
|
|
34
|
+
* @public
|
|
35
|
+
* @type {Renderer}
|
|
36
|
+
*/
|
|
37
|
+
this.renderer = null;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Auto activation flag.
|
|
41
|
+
* @public
|
|
42
|
+
* @type {Boolean}
|
|
43
|
+
*/
|
|
44
|
+
this.autoActivate = options.autoActivate || false;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Control activity.
|
|
48
|
+
* @protected
|
|
49
|
+
* @type {Boolean}
|
|
50
|
+
*/
|
|
51
|
+
this._active = false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get __staticCounter() {
|
|
55
|
+
if (!this.__counter && this.__counter !== 0) {
|
|
56
|
+
this.__counter = 0;
|
|
57
|
+
}
|
|
58
|
+
return this.__counter;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static set __staticCounter(n) {
|
|
62
|
+
this.__counter = n;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns control name.
|
|
67
|
+
* @public
|
|
68
|
+
* @virtual
|
|
69
|
+
*/
|
|
70
|
+
get name() {
|
|
71
|
+
return this._name;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Control initialization function have to be overriden.
|
|
76
|
+
* @public
|
|
77
|
+
* @virtual
|
|
78
|
+
*/
|
|
79
|
+
oninit() {
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Control renderer assigning function have to be overriden.
|
|
84
|
+
* @public
|
|
85
|
+
* @virtual
|
|
86
|
+
*/
|
|
87
|
+
onadd() {
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Control remove function have to be overriden.
|
|
92
|
+
* @public
|
|
93
|
+
* @virtual
|
|
94
|
+
*/
|
|
95
|
+
onremove() {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Control activation function have to be overriden.
|
|
100
|
+
* @public
|
|
101
|
+
* @virtual
|
|
102
|
+
*/
|
|
103
|
+
onactivate() {
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Control deactivation function have to be overriden.
|
|
108
|
+
* @public
|
|
109
|
+
* @virtual
|
|
110
|
+
*/
|
|
111
|
+
ondeactivate() {
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Assign renderer to the control.
|
|
116
|
+
* @public
|
|
117
|
+
* @type {Renderer}
|
|
118
|
+
*/
|
|
119
|
+
addTo(renderer) {
|
|
120
|
+
if (renderer) {
|
|
121
|
+
this.renderer = renderer;
|
|
122
|
+
renderer.controls[this.name] = this;
|
|
123
|
+
this.onadd && this.onadd();
|
|
124
|
+
this._initialized = true;
|
|
125
|
+
this.oninit && this.oninit();
|
|
126
|
+
if (this.autoActivate) {
|
|
127
|
+
this.activate();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Assign renderer to the control.
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
remove() {
|
|
137
|
+
this.onremove && this.onremove();
|
|
138
|
+
|
|
139
|
+
let r = this.renderer,
|
|
140
|
+
n = this.name;
|
|
141
|
+
|
|
142
|
+
if (!r) return;
|
|
143
|
+
|
|
144
|
+
let c = r.controls[n];
|
|
145
|
+
|
|
146
|
+
if (c) {
|
|
147
|
+
if (this.isEqual(c)) {
|
|
148
|
+
r.controls[n] = null;
|
|
149
|
+
delete r.controls[n];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.renderer = null;
|
|
154
|
+
this._active = false;
|
|
155
|
+
this._initialized = false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Activate control.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
activate() {
|
|
163
|
+
if (!this._active) {
|
|
164
|
+
if (!this._initialized) {
|
|
165
|
+
this._initialized = true;
|
|
166
|
+
this.oninit && this.oninit();
|
|
167
|
+
}
|
|
168
|
+
this._active = true;
|
|
169
|
+
this.onactivate && this.onactivate();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Deactivate control.
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
deactivate() {
|
|
178
|
+
if (this._active) {
|
|
179
|
+
this._active = false;
|
|
180
|
+
this.ondeactivate && this.ondeactivate();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Is control active.
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
isActive() {
|
|
189
|
+
return this._active;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
isEqual(control) {
|
|
193
|
+
return control._id === this._id;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export { Control };
|
|
@@ -6,96 +6,114 @@
|
|
|
6
6
|
|
|
7
7
|
import { Control } from './Control.js';
|
|
8
8
|
import { BaseGeoImage } from '../layer/BaseGeoImage.js';
|
|
9
|
-
import {
|
|
9
|
+
import { ToggleButton } from "../ui/ToggleButton.js";
|
|
10
|
+
|
|
11
|
+
const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M16 13l6.964 4.062-2.973.85 2.125 3.681-1.732 1-2.125-3.68-2.223 2.15L16 13zm-2-7h2v2h5a1 1 0 0 1 1 1v4h-2v-3H10v10h4v2H9a1 1 0 0 1-1-1v-5H6v-2h2V9a1 1 0 0 1 1-1h5V6zM4 14v2H2v-2h2zm0-4v2H2v-2h2zm0-4v2H2V6h2zm0-4v2H2V2h2zm4 0v2H6V2h2zm4 0v2h-2V2h2zm4 0v2h-2V2h2z" fill="#000"/></svg>`;
|
|
10
12
|
|
|
11
13
|
class GeoImageDragControl extends Control {
|
|
12
14
|
constructor(options = {}) {
|
|
13
15
|
super(options);
|
|
16
|
+
|
|
14
17
|
this._cornerIndex = -1;
|
|
15
18
|
this._catchCorner = false;
|
|
19
|
+
|
|
20
|
+
this._toggleBtn = new ToggleButton({
|
|
21
|
+
classList: ["og-map-button", "og-geoimagegrag_button"],
|
|
22
|
+
icon: ICON_BUTTON_SVG
|
|
23
|
+
});
|
|
24
|
+
|
|
16
25
|
}
|
|
17
26
|
|
|
18
27
|
oninit() {
|
|
19
|
-
|
|
20
|
-
this.createDraggerButton();
|
|
28
|
+
this._toggleBtn.appendTo(this.renderer.div);
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
this.
|
|
30
|
+
this.planet.events.on('layeradd', function (e) {
|
|
31
|
+
if (this.isActive()) {
|
|
32
|
+
this._bindLayer(e);
|
|
33
|
+
}
|
|
24
34
|
}, this);
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
this.
|
|
36
|
+
this._toggleBtn.on("change", (isActive) => {
|
|
37
|
+
if (isActive) {
|
|
38
|
+
this.activate();
|
|
39
|
+
} else {
|
|
40
|
+
this.deactivate();
|
|
29
41
|
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
onactivate() {
|
|
46
|
+
super.onactivate();
|
|
47
|
+
|
|
48
|
+
let p = this.planet;
|
|
49
|
+
for (let i = 0; i < p.layers.length; i++) {
|
|
50
|
+
this._bindLayer(p.layers[i]);
|
|
30
51
|
}
|
|
31
|
-
btnClickHandler('og-geo-image-dragger-menu-btn', null, null, '#og-geo-image-dragger-menu-icon'); // btn_id, dialog_id, dialog_selector, icon_id
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
elementFactory('div', { id: 'og-geo-image-dragger-menu-icon', class: 'og-icon-holder' }));
|
|
41
|
-
this.renderer.div.appendChild(btn);
|
|
54
|
+
ondeactivate() {
|
|
55
|
+
super.ondeactivate();
|
|
56
|
+
let p = this.planet;
|
|
57
|
+
for (let i = 0; i < p.layers.length; i++) {
|
|
58
|
+
this._unbindLayer(p.layers[i]);
|
|
59
|
+
}
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
_bindLayer(layer) {
|
|
45
|
-
if (layer instanceof BaseGeoImage) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
layer.events.on('
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (this._active && !btn_off) { // active layer and button ON
|
|
53
|
-
if (this._catchCorner) {// mouse is catching a corner
|
|
54
|
-
var corners = layer.getCornersLonLat();
|
|
55
|
-
corners[this._cornerIndex] = p.getLonLatFromPixelTerrain(ms, true);
|
|
56
|
-
layer.setCornersLonLat(corners);
|
|
57
|
-
} else { // mouse isn't catching
|
|
58
|
-
this._cornerIndex = -1;
|
|
59
|
-
for (var i = 0; i < layer._cornersWgs84.length; i++) {
|
|
60
|
-
var ground = p.getLonLatFromPixelTerrain(ms, true);
|
|
61
|
-
// mouse is near
|
|
62
|
-
if (ground && p.ellipsoid.getGreatCircleDistance(layer._cornersWgs84[i], ground) / p.getDistanceFromPixel(ms, true) <= 0.05) {
|
|
63
|
-
this._cornerIndex = i;
|
|
64
|
-
document.body.style.cursor = 'move';
|
|
65
|
-
break;
|
|
66
|
-
// mouse is far
|
|
67
|
-
} else {
|
|
68
|
-
document.body.style.cursor = 'auto';
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
layer.events.on("mouseleave", function () {
|
|
76
|
-
document.body.style.cursor = 'auto';
|
|
77
|
-
});
|
|
63
|
+
if (layer instanceof BaseGeoImage) {
|
|
64
|
+
layer.events.on('mousemove', this._onMouseMove, this);
|
|
65
|
+
layer.events.on("mouseleave", this._onMouseLeave, this);
|
|
66
|
+
layer.events.on('ldown', this._onLDown, this);
|
|
67
|
+
layer.events.on('lup', this._onLUp, this);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
78
70
|
|
|
79
|
-
|
|
71
|
+
_unbindLayer(layer) {
|
|
72
|
+
if (layer instanceof BaseGeoImage) {
|
|
73
|
+
layer.events.off('mousemove', this._onMouseMove);
|
|
74
|
+
layer.events.off("mouseleave", this._onMouseLeave);
|
|
75
|
+
layer.events.off('ldown', this._onLDown);
|
|
76
|
+
layer.events.off('lup', this._onLUp);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}, this);
|
|
80
|
+
_onLUp(ms) {
|
|
81
|
+
this._catchCorner = false;
|
|
82
|
+
ms.renderer.controls.mouseNavigation.activate();
|
|
83
|
+
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
_onLDown(ms) {
|
|
86
|
+
if (this._cornerIndex !== -1) {
|
|
87
|
+
this._catchCorner = true;
|
|
88
|
+
ms.renderer.controls.mouseNavigation.deactivate();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
94
91
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
_onMouseLeave() {
|
|
93
|
+
document.body.style.cursor = 'auto';
|
|
94
|
+
}
|
|
98
95
|
|
|
96
|
+
_onMouseMove(ms) {
|
|
97
|
+
let layer = ms.pickingObject,
|
|
98
|
+
p = this.planet;
|
|
99
|
+
if (this._catchCorner) {// mouse is catching a corner
|
|
100
|
+
let corners = layer.getCornersLonLat();
|
|
101
|
+
corners[this._cornerIndex] = p.getLonLatFromPixelTerrain(ms, true);
|
|
102
|
+
layer.setCornersLonLat(corners);
|
|
103
|
+
} else { // mouse isn't catching
|
|
104
|
+
this._cornerIndex = -1;
|
|
105
|
+
for (let i = 0; i < layer._cornersWgs84.length; i++) {
|
|
106
|
+
let ground = p.getLonLatFromPixelTerrain(ms, true);
|
|
107
|
+
// mouse is near
|
|
108
|
+
if (ground && p.ellipsoid.getGreatCircleDistance(layer._cornersWgs84[i], ground) / p.getDistanceFromPixel(ms, true) <= 0.05) {
|
|
109
|
+
this._cornerIndex = i;
|
|
110
|
+
document.body.style.cursor = 'move';
|
|
111
|
+
break;
|
|
112
|
+
// mouse is far
|
|
113
|
+
} else {
|
|
114
|
+
document.body.style.cursor = 'auto';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
}
|