@openglobus/og 0.22.2 → 0.24.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/css/og.css +137 -1
- package/lib/@openglobus/js/Globe.d.ts +0 -1
- package/lib/@openglobus/js/Object3d.d.ts +20 -10
- package/lib/@openglobus/js/camera/Camera.d.ts +57 -15
- package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
- package/lib/@openglobus/js/camera/PlanetCamera.d.ts +13 -0
- package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
- package/lib/@openglobus/js/control/MouseNavigation.d.ts +62 -51
- package/lib/@openglobus/js/control/OldMouseNavigation.d.ts +64 -0
- package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
- package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
- package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
- package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
- package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
- package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
- package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
- package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
- package/lib/@openglobus/js/control/index.d.ts +3 -2
- package/lib/@openglobus/js/entity/Entity.d.ts +282 -19
- package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
- package/lib/@openglobus/js/entity/GeoObject.d.ts +135 -39
- package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
- package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
- package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
- package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
- package/lib/@openglobus/js/index.d.ts +2 -1
- package/lib/@openglobus/js/input/MouseHandler.d.ts +1 -0
- package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
- package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
- package/lib/@openglobus/js/math/Mat3.d.ts +1 -1
- package/lib/@openglobus/js/math/Mat4.d.ts +10 -1
- package/lib/@openglobus/js/math/Plane.d.ts +3 -1
- package/lib/@openglobus/js/math/Quat.d.ts +47 -33
- package/lib/@openglobus/js/math/Ray.d.ts +10 -14
- package/lib/@openglobus/js/math/Vec2.d.ts +22 -0
- package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
- package/lib/@openglobus/js/math.d.ts +2 -2
- package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
- package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
- package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/@openglobus/js/renderer/Renderer.d.ts +63 -44
- package/lib/@openglobus/js/renderer/RendererEvents.d.ts +2 -0
- package/lib/@openglobus/js/scene/Planet.d.ts +15 -7
- package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
- package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
- package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
- package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
- package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
- package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
- package/lib/@openglobus/js/ui/Input.d.ts +32 -0
- package/lib/@openglobus/js/ui/View.d.ts +3 -1
- package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
- package/lib/@openglobus/js/utils/shared.d.ts +22 -0
- package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
- package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
- package/lib/@openglobus/js/webgl/Handler.d.ts +22 -12
- 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 +0 -1
- package/lib/js/Globe.js +4 -2
- package/lib/js/Object3d.d.ts +20 -10
- package/lib/js/Object3d.js +124 -48
- package/lib/js/Popup.js +1 -1
- package/lib/js/camera/Camera.d.ts +57 -15
- package/lib/js/camera/Camera.js +109 -29
- package/lib/js/camera/Frustum.d.ts +3 -0
- package/lib/js/camera/Frustum.js +7 -0
- package/lib/js/camera/PlanetCamera.d.ts +13 -0
- package/lib/js/camera/PlanetCamera.js +52 -5
- package/lib/js/control/Atmosphere.js +10 -6
- package/lib/js/control/CameraLock.d.ts +38 -0
- package/lib/js/control/CameraLock.js +216 -0
- package/lib/js/control/Control.js +1 -1
- package/lib/js/control/DebugInfo.js +38 -8
- package/lib/js/control/KeyboardNavigation.js +9 -9
- package/lib/js/control/MouseNavigation.d.ts +62 -51
- package/lib/js/control/MouseNavigation.js +361 -305
- package/lib/js/control/MouseWheelZoomControl.d.ts +0 -44
- package/lib/js/control/MouseWheelZoomControl.js +270 -181
- package/lib/js/control/OldMouseNavigation.d.ts +64 -0
- package/lib/js/control/OldMouseNavigation.js +368 -0
- package/lib/js/control/ScaleControl.js +11 -5
- package/lib/js/control/SimpleNavigation.d.ts +27 -10
- package/lib/js/control/SimpleNavigation.js +149 -49
- package/lib/js/control/Sun.js +6 -6
- package/lib/js/control/TouchNavigation.js +11 -8
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +6 -5
- package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
- package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
- package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
- package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +488 -0
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
- package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
- package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +107 -0
- package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
- package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +31 -0
- package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
- package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
- package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
- package/lib/js/control/geoObjectEditor/colors.js +8 -0
- package/lib/js/control/index.d.ts +3 -2
- package/lib/js/control/index.js +3 -2
- package/lib/js/control/timeline/TimelineControl.js +2 -0
- package/lib/js/control/visibleExtent/Segment.js +4 -4
- package/lib/js/entity/Entity.d.ts +282 -19
- package/lib/js/entity/Entity.js +497 -62
- package/lib/js/entity/EntityCollection.d.ts +8 -9
- package/lib/js/entity/EntityCollection.js +48 -45
- package/lib/js/entity/GeoObject.d.ts +135 -39
- package/lib/js/entity/GeoObject.js +150 -90
- package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
- package/lib/js/entity/GeoObjectHandler.js +198 -295
- package/lib/js/entity/InstanceData.d.ts +76 -0
- package/lib/js/entity/InstanceData.js +347 -0
- package/lib/js/entity/Polyline.d.ts +19 -6
- package/lib/js/entity/Polyline.js +76 -36
- package/lib/js/entity/PolylineHandler.d.ts +7 -0
- package/lib/js/entity/PolylineHandler.js +26 -1
- package/lib/js/index.d.ts +2 -1
- package/lib/js/index.js +2 -1
- package/lib/js/input/MouseHandler.d.ts +1 -0
- package/lib/js/input/MouseHandler.js +12 -1
- package/lib/js/layer/Bing.js +2 -2
- package/lib/js/layer/Vector.d.ts +4 -0
- package/lib/js/layer/Vector.js +16 -0
- package/lib/js/light/LightSource.d.ts +1 -139
- package/lib/js/light/LightSource.js +21 -227
- package/lib/js/math/Mat3.d.ts +1 -1
- package/lib/js/math/Mat3.js +1 -1
- package/lib/js/math/Mat4.d.ts +10 -1
- package/lib/js/math/Mat4.js +17 -1
- package/lib/js/math/Plane.d.ts +3 -1
- package/lib/js/math/Plane.js +11 -1
- package/lib/js/math/Quat.d.ts +47 -33
- package/lib/js/math/Quat.js +92 -90
- package/lib/js/math/Ray.d.ts +10 -14
- package/lib/js/math/Ray.js +56 -33
- package/lib/js/math/Vec2.d.ts +22 -0
- package/lib/js/math/Vec2.js +32 -0
- package/lib/js/math/Vec3.d.ts +15 -0
- package/lib/js/math/Vec3.js +30 -1
- package/lib/js/math.d.ts +2 -2
- package/lib/js/math.js +3 -3
- package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
- package/lib/js/quadTree/EntityCollectionNode.js +8 -8
- package/lib/js/quadTree/Node.d.ts +1 -1
- package/lib/js/quadTree/Node.js +2 -2
- package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
- package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
- package/lib/js/renderer/Renderer.d.ts +63 -44
- package/lib/js/renderer/Renderer.js +267 -266
- package/lib/js/renderer/RendererEvents.d.ts +2 -0
- package/lib/js/renderer/RendererEvents.js +5 -2
- package/lib/js/scene/Planet.d.ts +15 -7
- package/lib/js/scene/Planet.js +133 -90
- package/lib/js/scene/RenderNode.d.ts +10 -25
- package/lib/js/scene/RenderNode.js +70 -58
- package/lib/js/segment/Segment.js +4 -4
- package/lib/js/shaders/depth.js +2 -5
- package/lib/js/shaders/drawnode.d.ts +1 -0
- package/lib/js/shaders/drawnode.js +51 -52
- package/lib/js/shaders/geoObject.d.ts +1 -0
- package/lib/js/shaders/geoObject.js +154 -91
- package/lib/js/shaders/polyline.js +68 -51
- package/lib/js/shaders/utils.d.ts +1 -1
- package/lib/js/shaders/utils.js +11 -0
- package/lib/js/terrain/GlobusTerrain.js +2 -2
- package/lib/js/ui/Checkbox.d.ts +31 -0
- package/lib/js/ui/Checkbox.js +110 -0
- package/lib/js/ui/Color.js +2 -1
- package/lib/js/ui/Dialog.d.ts +3 -0
- package/lib/js/ui/Dialog.js +20 -0
- package/lib/js/ui/Input.d.ts +32 -0
- package/lib/js/ui/Input.js +107 -0
- package/lib/js/ui/View.d.ts +3 -1
- package/lib/js/ui/View.js +6 -0
- package/lib/js/utils/objParser.d.ts +44 -12
- package/lib/js/utils/objParser.js +241 -149
- package/lib/js/utils/shared.d.ts +22 -0
- package/lib/js/utils/shared.js +34 -0
- package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
- package/lib/js/webgl/Framebuffer.d.ts +35 -8
- package/lib/js/webgl/Framebuffer.js +136 -29
- package/lib/js/webgl/Handler.d.ts +22 -12
- package/lib/js/webgl/Handler.js +53 -34
- package/lib/js/webgl/Program.js +0 -8
- package/package.json +5 -3
- package/lib/@openglobus/js/control/EarthNavigation.d.ts +0 -50
- package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +0 -44
- package/lib/js/control/EarthNavigation.d.ts +0 -50
- package/lib/js/control/EarthNavigation.js +0 -202
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "[openglobus](https://www.openglobus.org/) is a javascript/typescript 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"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"docs": "jsdoc -r ./src/ -c ./jsdoc.conf.json -d ./docs",
|
|
13
13
|
"serve_docs": "cd docs; ws -p 8088",
|
|
14
|
-
"serve": "ws -p
|
|
14
|
+
"serve": "ws -p 8080",
|
|
15
15
|
"build": "rollup -c --bundleConfigAsCjs",
|
|
16
16
|
"clean": "rm -rf ./lib ./docs",
|
|
17
17
|
"prepublishOnly": "npm run build; npm run gen_js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"test_watch": "jest --env=jsdom --watch",
|
|
21
21
|
"lint": "eslint src/",
|
|
22
22
|
"gen_js": "tsc --build tsconfig.json --declaration",
|
|
23
|
-
"font": "node ./fonts/index.js"
|
|
23
|
+
"font": "node ./fonts/index.js",
|
|
24
|
+
"dev_serve": "npm-run-all --parallel --continue-on-error --race dev serve"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"jsdoc-babel": "^0.5.0",
|
|
56
57
|
"lint-staged": "^15.2.10",
|
|
57
58
|
"local-web-server": "^5.4.0",
|
|
59
|
+
"npm-run-all": "^4.1.5",
|
|
58
60
|
"postcss": "^8.4.45",
|
|
59
61
|
"prettier": "^3.3.3",
|
|
60
62
|
"rollup": "^4.22.4",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Control, IControlParams } from "./Control";
|
|
2
|
-
import { ITouchState } from "../renderer/RendererEvents";
|
|
3
|
-
import { IMouseState } from "../renderer/RendererEvents";
|
|
4
|
-
import { Quat } from "../math/Quat";
|
|
5
|
-
import { Sphere } from "../bv/Sphere";
|
|
6
|
-
import { Vec3 } from "../math/Vec3";
|
|
7
|
-
interface IEarthNavigationParams extends IControlParams {
|
|
8
|
-
}
|
|
9
|
-
declare class TouchExt {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
prev_x: number;
|
|
13
|
-
prev_y: number;
|
|
14
|
-
grabbedPoint: Vec3 | null;
|
|
15
|
-
grabbedSpheroid: Sphere;
|
|
16
|
-
constructor();
|
|
17
|
-
dX(): number;
|
|
18
|
-
dY(): number;
|
|
19
|
-
}
|
|
20
|
-
export declare class EarthNavigation extends Control {
|
|
21
|
-
protected grabbedPoint: Vec3 | null;
|
|
22
|
-
protected grabbedDir: Vec3;
|
|
23
|
-
inertia: number;
|
|
24
|
-
protected grabbedSpheroid: Sphere;
|
|
25
|
-
protected _vRot: Quat;
|
|
26
|
-
protected _hRot: Quat;
|
|
27
|
-
protected _a: number;
|
|
28
|
-
protected scaleRot: number;
|
|
29
|
-
protected currState: number;
|
|
30
|
-
protected positionState: {
|
|
31
|
-
h: number;
|
|
32
|
-
max: number;
|
|
33
|
-
min: number;
|
|
34
|
-
}[];
|
|
35
|
-
protected touches: TouchExt[];
|
|
36
|
-
constructor(options?: IEarthNavigationParams);
|
|
37
|
-
switchZoomState(wheelDelta: number): void;
|
|
38
|
-
protected onMouseWheel(event: IMouseState): void;
|
|
39
|
-
oninit(): void;
|
|
40
|
-
onactivate(): void;
|
|
41
|
-
protected onTouchStart(e: ITouchState): void;
|
|
42
|
-
protected onTouchEnd(e: ITouchState): void;
|
|
43
|
-
protected onTouchMove(e: ITouchState): void;
|
|
44
|
-
protected onMouseLeftButtonClick(e: IMouseState): void;
|
|
45
|
-
stopRotation(): void;
|
|
46
|
-
protected onMouseLeftButtonUp(e: IMouseState): void;
|
|
47
|
-
protected onMouseLeftButtonDown(e: IMouseState): void;
|
|
48
|
-
protected onDraw(): void;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Sphere } from "../bv/Sphere";
|
|
2
|
-
import { Key } from "../Lock";
|
|
3
|
-
import { Quat } from "../math/Quat";
|
|
4
|
-
import { Vec3 } from "../math/Vec3";
|
|
5
|
-
import { Control, IControlParams } from "./Control";
|
|
6
|
-
import { IStepForward } from "./MouseNavigation";
|
|
7
|
-
interface IMouseWheelZoomControl extends IControlParams {
|
|
8
|
-
minSlope?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class MouseWheelZoomControl extends Control {
|
|
11
|
-
protected grabbedPoint: Vec3;
|
|
12
|
-
protected _eye0: Vec3;
|
|
13
|
-
protected pointOnEarth: Vec3;
|
|
14
|
-
protected earthUp: Vec3;
|
|
15
|
-
inertia: number;
|
|
16
|
-
protected grabbedSpheroid: Sphere;
|
|
17
|
-
protected qRot: Quat;
|
|
18
|
-
protected scaleRot: number;
|
|
19
|
-
protected distDiff: number;
|
|
20
|
-
protected stepsCount: number;
|
|
21
|
-
protected stepsForward: IStepForward[] | null;
|
|
22
|
-
protected stepIndex: number;
|
|
23
|
-
protected _lmbDoubleClickActive: boolean;
|
|
24
|
-
protected minSlope: number;
|
|
25
|
-
protected _keyLock: Key;
|
|
26
|
-
protected _deactivate: boolean;
|
|
27
|
-
protected _move: number;
|
|
28
|
-
constructor(options?: IMouseWheelZoomControl);
|
|
29
|
-
oninit(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Planet zoom in.
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
zoomIn(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Planet zoom out.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
zoomOut(): void;
|
|
40
|
-
stopRotation(): void;
|
|
41
|
-
stopZoom(): void;
|
|
42
|
-
protected _draw(): void;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Control, IControlParams } from "./Control";
|
|
2
|
-
import { ITouchState } from "../renderer/RendererEvents";
|
|
3
|
-
import { IMouseState } from "../renderer/RendererEvents";
|
|
4
|
-
import { Quat } from "../math/Quat";
|
|
5
|
-
import { Sphere } from "../bv/Sphere";
|
|
6
|
-
import { Vec3 } from "../math/Vec3";
|
|
7
|
-
interface IEarthNavigationParams extends IControlParams {
|
|
8
|
-
}
|
|
9
|
-
declare class TouchExt {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
prev_x: number;
|
|
13
|
-
prev_y: number;
|
|
14
|
-
grabbedPoint: Vec3 | null;
|
|
15
|
-
grabbedSpheroid: Sphere;
|
|
16
|
-
constructor();
|
|
17
|
-
dX(): number;
|
|
18
|
-
dY(): number;
|
|
19
|
-
}
|
|
20
|
-
export declare class EarthNavigation extends Control {
|
|
21
|
-
protected grabbedPoint: Vec3 | null;
|
|
22
|
-
protected grabbedDir: Vec3;
|
|
23
|
-
inertia: number;
|
|
24
|
-
protected grabbedSpheroid: Sphere;
|
|
25
|
-
protected _vRot: Quat;
|
|
26
|
-
protected _hRot: Quat;
|
|
27
|
-
protected _a: number;
|
|
28
|
-
protected scaleRot: number;
|
|
29
|
-
protected currState: number;
|
|
30
|
-
protected positionState: {
|
|
31
|
-
h: number;
|
|
32
|
-
max: number;
|
|
33
|
-
min: number;
|
|
34
|
-
}[];
|
|
35
|
-
protected touches: TouchExt[];
|
|
36
|
-
constructor(options?: IEarthNavigationParams);
|
|
37
|
-
switchZoomState(wheelDelta: number): void;
|
|
38
|
-
protected onMouseWheel(event: IMouseState): void;
|
|
39
|
-
oninit(): void;
|
|
40
|
-
onactivate(): void;
|
|
41
|
-
protected onTouchStart(e: ITouchState): void;
|
|
42
|
-
protected onTouchEnd(e: ITouchState): void;
|
|
43
|
-
protected onTouchMove(e: ITouchState): void;
|
|
44
|
-
protected onMouseLeftButtonClick(e: IMouseState): void;
|
|
45
|
-
stopRotation(): void;
|
|
46
|
-
protected onMouseLeftButtonUp(e: IMouseState): void;
|
|
47
|
-
protected onMouseLeftButtonDown(e: IMouseState): void;
|
|
48
|
-
protected onDraw(): void;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { Control } from "./Control";
|
|
2
|
-
import { LonLat } from "../LonLat";
|
|
3
|
-
import { Quat } from "../math/Quat";
|
|
4
|
-
import { Ray } from "../math/Ray";
|
|
5
|
-
import { Sphere } from "../bv/Sphere";
|
|
6
|
-
import { Vec2 } from "../math/Vec2";
|
|
7
|
-
import { Vec3 } from "../math/Vec3";
|
|
8
|
-
class TouchExt {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.x = 0;
|
|
11
|
-
this.y = 0;
|
|
12
|
-
this.prev_x = 0;
|
|
13
|
-
this.prev_y = 0;
|
|
14
|
-
this.grabbedPoint = new Vec3();
|
|
15
|
-
this.grabbedSpheroid = new Sphere();
|
|
16
|
-
}
|
|
17
|
-
dX() {
|
|
18
|
-
return this.x - this.prev_x;
|
|
19
|
-
}
|
|
20
|
-
dY() {
|
|
21
|
-
return this.y - this.prev_y;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export class EarthNavigation extends Control {
|
|
25
|
-
constructor(options = {}) {
|
|
26
|
-
super(options);
|
|
27
|
-
this.grabbedPoint = new Vec3();
|
|
28
|
-
this.grabbedDir = new Vec3();
|
|
29
|
-
this.inertia = 0.007;
|
|
30
|
-
this.grabbedSpheroid = new Sphere();
|
|
31
|
-
this.planet = null;
|
|
32
|
-
this._vRot = new Quat();
|
|
33
|
-
this._hRot = new Quat();
|
|
34
|
-
this._a = 0.0;
|
|
35
|
-
this.scaleRot = 0;
|
|
36
|
-
this.currState = 0;
|
|
37
|
-
this.positionState = [
|
|
38
|
-
{ h: 17119745.303455353, max: 0.98, min: -0.98 },
|
|
39
|
-
{ h: 6866011, max: 0.98, min: -0.98 },
|
|
40
|
-
{ h: 3000000, max: 0.98, min: -0.98 },
|
|
41
|
-
{ h: 1000000, max: 0.98, min: -0.98 },
|
|
42
|
-
{ h: 500000, max: 0.98, min: -0.98 }
|
|
43
|
-
];
|
|
44
|
-
this.touches = [new TouchExt(), new TouchExt()];
|
|
45
|
-
}
|
|
46
|
-
switchZoomState(wheelDelta) {
|
|
47
|
-
this.stopRotation();
|
|
48
|
-
if (wheelDelta > 0) {
|
|
49
|
-
this.currState++;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.currState--;
|
|
53
|
-
}
|
|
54
|
-
if (this.currState <= 0)
|
|
55
|
-
this.currState = 0;
|
|
56
|
-
if (this.currState >= this.positionState.length) {
|
|
57
|
-
this.currState = this.positionState.length - 1;
|
|
58
|
-
}
|
|
59
|
-
this.planet.stopFlying();
|
|
60
|
-
const ll = this.planet.camera._lonLat;
|
|
61
|
-
this.planet.flyLonLat(new LonLat(ll.lon, ll.lat, this.positionState[this.currState].h));
|
|
62
|
-
}
|
|
63
|
-
onMouseWheel(event) {
|
|
64
|
-
this.switchZoomState(event.wheelDelta);
|
|
65
|
-
}
|
|
66
|
-
oninit() {
|
|
67
|
-
this.activate();
|
|
68
|
-
}
|
|
69
|
-
onactivate() {
|
|
70
|
-
let r = this.renderer;
|
|
71
|
-
r.events.on("mousewheel", this.onMouseWheel, this);
|
|
72
|
-
r.events.on("lhold", this.onMouseLeftButtonDown, this);
|
|
73
|
-
r.events.on("ldown", this.onMouseLeftButtonClick, this);
|
|
74
|
-
r.events.on("lup", this.onMouseLeftButtonUp, this);
|
|
75
|
-
r.events.on("touchstart", this.onTouchStart, this);
|
|
76
|
-
r.events.on("touchend", this.onTouchEnd, this);
|
|
77
|
-
r.events.on("touchmove", this.onTouchMove, this);
|
|
78
|
-
r.events.on("draw", this.onDraw, this);
|
|
79
|
-
}
|
|
80
|
-
onTouchStart(e) {
|
|
81
|
-
if (e.sys.touches.length == 1) {
|
|
82
|
-
const t = this.touches[0];
|
|
83
|
-
t.x = e.sys.touches.item(0).pageX - e.sys.offsetLeft;
|
|
84
|
-
t.y = e.sys.touches.item(0).pageY - e.sys.offsetTop;
|
|
85
|
-
t.prev_x = e.sys.touches.item(0).pageX - e.sys.offsetLeft;
|
|
86
|
-
t.prev_y = e.sys.touches.item(0).pageY - e.sys.offsetTop;
|
|
87
|
-
// t.grabbedPoint = this.planet!.getCartesianFromPixelTerrain(t, true);
|
|
88
|
-
t.grabbedPoint = this.planet.getCartesianFromPixelTerrain(new Vec2(t.x, t.y)) || null;
|
|
89
|
-
if (t.grabbedPoint) {
|
|
90
|
-
t.grabbedSpheroid.radius = t.grabbedPoint.length();
|
|
91
|
-
this.stopRotation();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
onTouchEnd(e) {
|
|
96
|
-
if (e.sys.touches.length == 0) {
|
|
97
|
-
this.scaleRot = 1;
|
|
98
|
-
if (Math.abs(this.touches[0].x - this.touches[0].prev_x) < 3 &&
|
|
99
|
-
Math.abs(this.touches[0].y - this.touches[0].prev_y) < 3)
|
|
100
|
-
this.stopRotation();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
onTouchMove(e) {
|
|
104
|
-
if (e.sys.touches.length == 1) {
|
|
105
|
-
let cam = this.planet.camera;
|
|
106
|
-
let t = this.touches[0];
|
|
107
|
-
t.prev_x = t.x;
|
|
108
|
-
t.prev_y = t.y;
|
|
109
|
-
t.x = e.sys.touches.item(0).pageX - e.sys.offsetLeft;
|
|
110
|
-
t.y = e.sys.touches.item(0).pageY - e.sys.offsetTop;
|
|
111
|
-
if (!t.grabbedPoint)
|
|
112
|
-
return;
|
|
113
|
-
let direction = cam.unproject(t.x, t.y);
|
|
114
|
-
let targetPoint = new Ray(cam.eye, direction).hitSphere(t.grabbedSpheroid);
|
|
115
|
-
if (targetPoint) {
|
|
116
|
-
this._a =
|
|
117
|
-
Math.acos(t.grabbedPoint.y / t.grabbedSpheroid.radius) -
|
|
118
|
-
Math.acos(targetPoint.y / t.grabbedSpheroid.radius);
|
|
119
|
-
this._vRot = Quat.axisAngleToQuat(cam._u, this._a);
|
|
120
|
-
this._hRot = Quat.getRotationBetweenVectors(new Vec3(targetPoint.x, 0.0, targetPoint.z).normal(), new Vec3(t.grabbedPoint.x, 0.0, t.grabbedPoint.z).normal());
|
|
121
|
-
let rot = this._hRot.mul(this._vRot);
|
|
122
|
-
let state = this.positionState[this.currState];
|
|
123
|
-
let lim = rot.mulVec3(cam.eye).normal().dot(Vec3.NORTH);
|
|
124
|
-
if (lim > state.max || lim < state.min) {
|
|
125
|
-
rot = Quat.yRotation(rot.getYaw());
|
|
126
|
-
}
|
|
127
|
-
cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.NORTH);
|
|
128
|
-
cam.update();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
onMouseLeftButtonClick(e) {
|
|
133
|
-
this.renderer.handler.canvas.classList.add("ogGrabbingPoiner");
|
|
134
|
-
this.grabbedPoint = this.planet.getCartesianFromMouseTerrain() || null;
|
|
135
|
-
this.grabbedDir.copy(e.direction);
|
|
136
|
-
if (this.grabbedPoint) {
|
|
137
|
-
this.grabbedSpheroid.radius = this.grabbedPoint.length();
|
|
138
|
-
this.stopRotation();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
stopRotation() {
|
|
142
|
-
this.scaleRot = 0.0;
|
|
143
|
-
this._a = 0.0;
|
|
144
|
-
this._vRot.clear();
|
|
145
|
-
this._hRot.clear();
|
|
146
|
-
}
|
|
147
|
-
onMouseLeftButtonUp(e) {
|
|
148
|
-
this.scaleRot = 1;
|
|
149
|
-
this.renderer.handler.canvas.classList.remove("ogGrabbingPoiner");
|
|
150
|
-
if (Math.abs(e.x - e.prev_x) < 3 && Math.abs(e.y - e.prev_y) < 3)
|
|
151
|
-
this.stopRotation();
|
|
152
|
-
}
|
|
153
|
-
onMouseLeftButtonDown(e) {
|
|
154
|
-
let cam = this.planet.camera;
|
|
155
|
-
if (!this.grabbedPoint || cam.isFlying())
|
|
156
|
-
return;
|
|
157
|
-
if (this.renderer.events.mouseState.moving) {
|
|
158
|
-
let targetPoint = new Ray(cam.eye, e.direction).hitSphere(this.grabbedSpheroid);
|
|
159
|
-
if (targetPoint) {
|
|
160
|
-
this._a = Math.acos(this.grabbedPoint.y / this.grabbedSpheroid.radius) -
|
|
161
|
-
Math.acos(targetPoint.y / this.grabbedSpheroid.radius);
|
|
162
|
-
let rot = this._vRot = Quat.axisAngleToQuat(cam._u, this._a);
|
|
163
|
-
cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, rot.mulVec3(cam.getUp()));
|
|
164
|
-
this._hRot = Quat.getRotationBetweenVectors(new Vec3(targetPoint.x, 0.0, targetPoint.z).normal(), new Vec3(this.grabbedPoint.x, 0.0, this.grabbedPoint.z).normal());
|
|
165
|
-
rot = this._hRot;
|
|
166
|
-
cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, rot.mulVec3(cam.getUp()));
|
|
167
|
-
cam.update();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
this.scaleRot = 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
onDraw() {
|
|
175
|
-
let r = this.renderer;
|
|
176
|
-
let cam = this.planet.camera;
|
|
177
|
-
if (r.events.mouseState.leftButtonDown || !this.scaleRot || cam.isFlying())
|
|
178
|
-
return;
|
|
179
|
-
this.scaleRot -= this.inertia;
|
|
180
|
-
if (this.scaleRot <= 0) {
|
|
181
|
-
this.scaleRot = 0;
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
this._vRot = Quat.axisAngleToQuat(cam._u, this._a);
|
|
185
|
-
let rot = this._vRot.mul(this._hRot);
|
|
186
|
-
let lim = rot.mulVec3(cam.eye).normal().dot(Vec3.NORTH);
|
|
187
|
-
let state = this.positionState[this.currState];
|
|
188
|
-
if (lim > state.max || lim < state.min) {
|
|
189
|
-
rot = Quat.yRotation(rot.getYaw());
|
|
190
|
-
}
|
|
191
|
-
r.controlsBag.scaleRot = this.scaleRot;
|
|
192
|
-
rot = rot
|
|
193
|
-
.slerp(Quat.IDENTITY, 1 - this.scaleRot * this.scaleRot * this.scaleRot)
|
|
194
|
-
.normalize();
|
|
195
|
-
if (!(rot.x || rot.y || rot.z)) {
|
|
196
|
-
this.scaleRot = 0;
|
|
197
|
-
}
|
|
198
|
-
cam.set(rot.mulVec3(cam.eye), Vec3.ZERO, Vec3.NORTH);
|
|
199
|
-
cam.update();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|