@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
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { Vec3 } from "../../math/Vec3.js";
|
|
4
|
+
import { Deferred } from "../../Deferred.js";
|
|
5
|
+
import { Events } from '../../Events.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Point types
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
const SAFE = 0;
|
|
12
|
+
const WARNING = 1;
|
|
13
|
+
const COLLISION = 2;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* drawData index names
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
const TRACK = 0;
|
|
20
|
+
const GROUND = 1;
|
|
21
|
+
|
|
22
|
+
const SEGMMENT_LENGTH = 1.0; // Distance between query points on the ground
|
|
23
|
+
const GROUND_OFFSET = 1.0; // Ground level offset
|
|
24
|
+
const BOTTOM_PADDING = 0.1; // Range minY padding in percentage from the bottom
|
|
25
|
+
const TOP_PADDING = 0.1; // Range maxY padding in percentage from the top
|
|
26
|
+
|
|
27
|
+
const HEIGHT_EPS = 0.1; // Warning height level error
|
|
28
|
+
|
|
29
|
+
class ElevationProfile {
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.events = new Events(["profilecollected"]);
|
|
32
|
+
|
|
33
|
+
this.planet = options.planet;
|
|
34
|
+
|
|
35
|
+
this._warningHeightLevel = 50;
|
|
36
|
+
this._pointsReady = false;
|
|
37
|
+
this._isWarning = false;
|
|
38
|
+
|
|
39
|
+
this._minX = 0;
|
|
40
|
+
this._maxX = 1000;
|
|
41
|
+
this._minY = 0;
|
|
42
|
+
this._maxY = 200;
|
|
43
|
+
|
|
44
|
+
this._drawData = [][0];
|
|
45
|
+
|
|
46
|
+
this._promiseArr = [];
|
|
47
|
+
this._promiseCounter = 0;
|
|
48
|
+
this._pMaxY = 0;
|
|
49
|
+
this._pMinY = 0;
|
|
50
|
+
this._pDist = 0;
|
|
51
|
+
this._pTrackCoords = [[0, 0, SAFE]];
|
|
52
|
+
this._pGroundCoords = [[0, 0, SAFE]];
|
|
53
|
+
this._pIndex = 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setWarningHeightLevel(warningHeight = 0) {
|
|
57
|
+
this._warningHeightLevel = warningHeight;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setRange(minX, maxX, minY, maxY) {
|
|
61
|
+
this._minX = minX;
|
|
62
|
+
this._maxX = maxX;
|
|
63
|
+
this._minY = minY;
|
|
64
|
+
this._maxY = maxY;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_getHeightAsync(ll, pIndex) {
|
|
68
|
+
let def = new Deferred();
|
|
69
|
+
this.planet.terrain.getHeightAsync(ll, (elv) => {
|
|
70
|
+
elv += this.planet.terrain.geoid.getHeightLonLat(ll);
|
|
71
|
+
this._pGroundCoords[pIndex][1] = elv;
|
|
72
|
+
this._pGroundCoords[pIndex][2] = SAFE;
|
|
73
|
+
this._pGroundCoords[pIndex][3] = ll.height;
|
|
74
|
+
this._setPointType(pIndex);
|
|
75
|
+
def.resolve(elv);
|
|
76
|
+
});
|
|
77
|
+
return def.promise;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_collectCoordsBetweenTwoTrackPoints(internalPoints, scaleFactor, p0, trackDir) {
|
|
81
|
+
for (let j = 1; j <= internalPoints; j++) {
|
|
82
|
+
this._pDist += SEGMMENT_LENGTH;
|
|
83
|
+
this._pIndex++;
|
|
84
|
+
|
|
85
|
+
// Point on the track segment
|
|
86
|
+
let dirSegLen = j * scaleFactor;
|
|
87
|
+
let pjd = p0.add(trackDir.scaleTo(dirSegLen));
|
|
88
|
+
let llx = this.planet.ellipsoid.cartesianToLonLat(pjd);
|
|
89
|
+
|
|
90
|
+
this._pGroundCoords[this._pIndex] = [this._pDist, 0, SAFE];
|
|
91
|
+
|
|
92
|
+
((lonlat, index) => {
|
|
93
|
+
this._promiseArr.push(
|
|
94
|
+
this._getHeightAsync(lonlat, index)
|
|
95
|
+
.then((elv) => {
|
|
96
|
+
if (elv > this._pMaxY) this._pMaxY = elv;
|
|
97
|
+
if (elv < this._pMinY) this._pMinY = elv;
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
})(llx, this._pIndex);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_collectAllPoints(pointsLonLat) {
|
|
105
|
+
|
|
106
|
+
let p0 = new Vec3(),
|
|
107
|
+
p1 = new Vec3();
|
|
108
|
+
|
|
109
|
+
for (let i = 1, len = pointsLonLat.length; i < len; i++) {
|
|
110
|
+
let lonlat0 = pointsLonLat[i - 1],
|
|
111
|
+
lonlat1 = pointsLonLat[i];
|
|
112
|
+
|
|
113
|
+
this.planet.ellipsoid.lonLatToCartesianRes(lonlat0, p0);
|
|
114
|
+
this.planet.ellipsoid.lonLatToCartesianRes(lonlat1, p1);
|
|
115
|
+
|
|
116
|
+
let trackDir = p1.sub(p0);
|
|
117
|
+
let dirLength = trackDir.length();
|
|
118
|
+
let n0 = this.planet.ellipsoid.getSurfaceNormal3v(p0);
|
|
119
|
+
let proj = Vec3.proj_b_to_plane(trackDir, n0);
|
|
120
|
+
let projLen = proj.length();
|
|
121
|
+
let internalPoints = Math.floor(projLen / SEGMMENT_LENGTH);
|
|
122
|
+
let scaleFactor = SEGMMENT_LENGTH * dirLength / projLen;
|
|
123
|
+
|
|
124
|
+
this._getGroundElevation(lonlat0);
|
|
125
|
+
|
|
126
|
+
proj.normalize();
|
|
127
|
+
trackDir.normalize();
|
|
128
|
+
|
|
129
|
+
// Getting internal point elevations and looking for the collisions
|
|
130
|
+
this._collectCoordsBetweenTwoTrackPoints(internalPoints, scaleFactor, p0, trackDir);
|
|
131
|
+
|
|
132
|
+
this._pDist += projLen - internalPoints * SEGMMENT_LENGTH;
|
|
133
|
+
this._pIndex++;
|
|
134
|
+
|
|
135
|
+
let elv = lonlat1.height;
|
|
136
|
+
if (elv > this._pMaxY) this._pMaxY = elv;
|
|
137
|
+
if (elv < this._pMinY) this._pMinY = elv;
|
|
138
|
+
|
|
139
|
+
this._pTrackCoords[i] = [this._pDist, elv];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_getGroundElevation(lonLat) {
|
|
144
|
+
this._pGroundCoords[this._pIndex] = [this._pDist, 0, SAFE];
|
|
145
|
+
this._promiseArr.push(
|
|
146
|
+
this._getHeightAsync(lonLat, this._pIndex)
|
|
147
|
+
.then((elv) => {
|
|
148
|
+
if (typeof elv === 'number') {
|
|
149
|
+
if ((elv > this._pMaxY) && (elv)) this._pMaxY = elv;
|
|
150
|
+
if ((elv < this._pMinY) && (elv)) this._pMinY = elv;
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
_collectPromise(resolve) {
|
|
157
|
+
Promise.all(this._promiseArr).then(() => {
|
|
158
|
+
resolve({
|
|
159
|
+
dist: this._pDist,
|
|
160
|
+
minY: this._pMinY,
|
|
161
|
+
maxY: this._pMaxY,
|
|
162
|
+
trackCoords: this._pTrackCoords,
|
|
163
|
+
groundCoords: this._pGroundCoords
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
_calcPointsAsync(pointsLonLat) {
|
|
169
|
+
return new Promise((resolve, reject) => {
|
|
170
|
+
this._pTrackCoords = [[0, pointsLonLat[0].height]];
|
|
171
|
+
this._pMaxY = pointsLonLat[0].height;
|
|
172
|
+
this._pMinY = this._pMaxY;
|
|
173
|
+
this._pDist = 0;
|
|
174
|
+
this._pGroundCoords = [[0, 0, SAFE]];
|
|
175
|
+
this._pIndex = 0;
|
|
176
|
+
this._promiseArr = [];
|
|
177
|
+
|
|
178
|
+
this._collectAllPoints(pointsLonLat);
|
|
179
|
+
this._getGroundElevation(pointsLonLat[pointsLonLat.length - 1]);
|
|
180
|
+
this._collectPromise(resolve);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
get minX() {
|
|
185
|
+
return this._minX;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get maxX() {
|
|
189
|
+
return this._maxX;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
get minY() {
|
|
193
|
+
return this._minY;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
get maxY() {
|
|
197
|
+
return this._maxY;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
get pointsReady() {
|
|
201
|
+
return this._pointsReady;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get isWarningOrCollision() {
|
|
205
|
+
return this._isWarning;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
collectProfile(pointsLonLat) {
|
|
209
|
+
this._pointsReady = false;
|
|
210
|
+
this._isWarning = false;
|
|
211
|
+
|
|
212
|
+
if (!pointsLonLat || !pointsLonLat.length) return;
|
|
213
|
+
|
|
214
|
+
this._promiseCounter++;
|
|
215
|
+
|
|
216
|
+
((counter) => {
|
|
217
|
+
this._calcPointsAsync(pointsLonLat).then((p) => {
|
|
218
|
+
if (counter === this._promiseCounter) {
|
|
219
|
+
this.setRange(0, p.dist, p.minY - BOTTOM_PADDING * Math.abs(p.minY), p.maxY + Math.abs(p.maxY) * TOP_PADDING);
|
|
220
|
+
this._pointsReady = true;
|
|
221
|
+
this._drawData = [p.trackCoords, p.groundCoords];
|
|
222
|
+
this.events.dispatch(this.events.profilecollected, this._drawData, this);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
})(this._promiseCounter);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
_setPointType(pIndex) {
|
|
229
|
+
if ((this._pGroundCoords[pIndex][3] >= this._pGroundCoords[pIndex][1]) &&
|
|
230
|
+
(this._pGroundCoords[pIndex][3] < this._pGroundCoords[pIndex][1] + this._warningHeightLevel - HEIGHT_EPS)) {
|
|
231
|
+
this._pGroundCoords[pIndex][2] = WARNING;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (this._pGroundCoords[pIndex][3] <= this._pGroundCoords[pIndex][1] + GROUND_OFFSET) {
|
|
235
|
+
this._pGroundCoords[pIndex][2] = COLLISION;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (this._pGroundCoords[pIndex][2] == WARNING || this._pGroundCoords[pIndex][2] == COLLISION) {
|
|
239
|
+
this._isWarning = true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
_setPointsType() {
|
|
244
|
+
this._isWarning = false;
|
|
245
|
+
|
|
246
|
+
this._pTrackCoords = this._drawData[TRACK];
|
|
247
|
+
this._pGroundCoords = this._drawData[GROUND];
|
|
248
|
+
|
|
249
|
+
for (let i = 0; i < this._pGroundCoords.length; i++) {
|
|
250
|
+
this._setPointType(i);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this._drawData[GROUND] = this._pGroundCoords;
|
|
254
|
+
this.events.dispatch(this.events.profilecollected, this._drawData, this);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
clear() {
|
|
258
|
+
this._pointsReady = false;
|
|
259
|
+
this._isWarning = false;
|
|
260
|
+
this._drawData = [][0];
|
|
261
|
+
this._pMaxY = 0;
|
|
262
|
+
this._pMinY = 0;
|
|
263
|
+
this._pDist = 0;
|
|
264
|
+
this._pTrackCoords = [[0, 0, SAFE]];
|
|
265
|
+
this._pGroundCoords = [[0, 0, SAFE]];
|
|
266
|
+
this._pIndex = 0;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export {
|
|
271
|
+
SAFE,
|
|
272
|
+
COLLISION,
|
|
273
|
+
WARNING,
|
|
274
|
+
ElevationProfile
|
|
275
|
+
};
|
package/src/og/control/index.js
CHANGED
|
@@ -21,6 +21,8 @@ import { Sun } from "./Sun.js";
|
|
|
21
21
|
import { ToggleWireframe } from "./ToggleWireframe.js";
|
|
22
22
|
import { TouchNavigation } from "./TouchNavigation.js";
|
|
23
23
|
import { ZoomControl } from "./ZoomControl.js";
|
|
24
|
+
import { DrawingSwitcher } from "./DrawingSwitcher.js";
|
|
25
|
+
import { DrawingControl } from "./drawing/DrawingControl.js";
|
|
24
26
|
|
|
25
27
|
import { TimelineControl } from "./timeline/TimelineControl.js";
|
|
26
28
|
|
|
@@ -48,5 +50,7 @@ export {
|
|
|
48
50
|
SimpleSkyBackground,
|
|
49
51
|
Selection,
|
|
50
52
|
LayerAnimation,
|
|
51
|
-
TimelineControl
|
|
53
|
+
TimelineControl,
|
|
54
|
+
DrawingSwitcher,
|
|
55
|
+
DrawingControl
|
|
52
56
|
};
|
|
@@ -275,8 +275,9 @@ class RulerScene extends RenderNode {
|
|
|
275
275
|
|
|
276
276
|
let endPos = this._planet.ellipsoid.lonLatToCartesian(endLonLat);
|
|
277
277
|
|
|
278
|
-
let
|
|
279
|
-
|
|
278
|
+
let res = this._planet.ellipsoid.inverse(startLonLat, endLonLat);
|
|
279
|
+
let length = res.distance;
|
|
280
|
+
this._heading = res.initialAzimuth;
|
|
280
281
|
|
|
281
282
|
let path = [];
|
|
282
283
|
let dir = endPos.sub(startPos);
|
|
@@ -233,17 +233,15 @@ class SelectionScene extends RenderNode {
|
|
|
233
233
|
|
|
234
234
|
let endPos = this._planet.ellipsoid.lonLatToCartesian(endLonLat);
|
|
235
235
|
|
|
236
|
-
let
|
|
236
|
+
let res = this._planet.ellipsoid.direct(startLonLat, endLonLat);
|
|
237
237
|
|
|
238
|
-
this._heading =
|
|
238
|
+
this._heading = res.initialAzimuth;
|
|
239
239
|
|
|
240
240
|
let path = [];
|
|
241
241
|
|
|
242
|
-
|
|
243
242
|
this._cornerEntity[0].setCartesian3v(startPos);
|
|
244
243
|
this._cornerEntity[1].setCartesian3v(endPos);
|
|
245
244
|
|
|
246
|
-
|
|
247
245
|
let corners = [
|
|
248
246
|
startPos,
|
|
249
247
|
this._planet.ellipsoid.lonLatToCartesian(new LonLat(endLonLat.lon, startLonLat.lat, startLonLat.height)),
|
|
@@ -26,14 +26,14 @@ class TimelineControl extends Control {
|
|
|
26
26
|
}
|
|
27
27
|
super(options);
|
|
28
28
|
|
|
29
|
-
let currentDate = options.current ||
|
|
29
|
+
let currentDate = options.current || new Date();
|
|
30
30
|
let startDate = options.rangeStart || addHours(currentDate, -12);
|
|
31
|
-
let endDate = options.rangeEnd || addHours(currentDate, 12);
|
|
31
|
+
let endDate = options.rangeEnd || addHours(currentDate, 12);
|
|
32
32
|
|
|
33
33
|
this._timelineView = new TimelineView({
|
|
34
34
|
rangeStart: startDate,
|
|
35
35
|
rangeEnd: endDate,
|
|
36
|
-
|
|
36
|
+
currentDate: currentDate
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
this._toggleBtn = new ToggleButton({
|
|
@@ -83,7 +83,7 @@ class TimelineControl extends Control {
|
|
|
83
83
|
this.renderer.controls.mouseNavigation.deactivate();
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
this._timelineView.on("stopdrag", () => {
|
|
86
|
+
this._timelineView.on("stopdrag", (e) => {
|
|
87
87
|
this.renderer.controls.mouseNavigation.activate();
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -390,6 +390,7 @@ class TimelineView extends View {
|
|
|
390
390
|
this._canvasEl.height = this._frameEl.clientHeight * this._canvasScale;
|
|
391
391
|
this._canvasEl.style.width = `${this._frameEl.clientWidth}px`;
|
|
392
392
|
this._canvasEl.style.height = `${this._frameEl.clientHeight}px`;
|
|
393
|
+
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
396
|
|
|
@@ -269,11 +269,11 @@ class Segment {
|
|
|
269
269
|
* @returns {Vec3} -
|
|
270
270
|
*/
|
|
271
271
|
getEntityTerrainPoint(entity, res) {
|
|
272
|
-
return this.getTerrainPoint(entity._cartesian, entity.
|
|
272
|
+
return this.getTerrainPoint(entity._cartesian, entity._lonLatMerc, res);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
isEntityInside(e) {
|
|
276
|
-
return this._extent.isInside(e.
|
|
276
|
+
return this._extent.isInside(e._lonLatMerc);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
@@ -281,7 +281,7 @@ class Segment {
|
|
|
281
281
|
* @public
|
|
282
282
|
* @param {Vec3} xyz - Cartesian object position.
|
|
283
283
|
* @param {LonLat} insideSegmentPosition - Geodetic object position.
|
|
284
|
-
* @param {Vec3} [res] - Result cartesian
|
|
284
|
+
* @param {Vec3} [res] - Result cartesian coordinates on the terrain.
|
|
285
285
|
* @param {Vec3} [normal] - Terrain point normal.
|
|
286
286
|
* @returns {number} -
|
|
287
287
|
*/
|
|
@@ -363,8 +363,8 @@ class Segment {
|
|
|
363
363
|
* @param {LonLat} lonlat - Coordinates to project.
|
|
364
364
|
* @returns {LonLat} -
|
|
365
365
|
*/
|
|
366
|
-
projectNative(
|
|
367
|
-
return
|
|
366
|
+
projectNative(lonLat) {
|
|
367
|
+
return lonLat.forwardMercator();
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
/**
|