@openglobus/og 0.26.2 → 0.26.3

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.
@@ -10,7 +10,7 @@ import type { NumberArray2 } from "../math/Vec2";
10
10
  import { Vec3 } from "../math/Vec3";
11
11
  import { Sphere } from "../bv/Sphere";
12
12
  import { Quat } from "../math/Quat";
13
- type CameraEvents = ["viewchange", "moveend"];
13
+ export type CameraEvents = ["viewchange", "moveend"];
14
14
  export interface ICameraParams {
15
15
  eye?: Vec3;
16
16
  viewAngle?: number;
@@ -1,20 +1,34 @@
1
- import { Camera, type ICameraParams } from "./Camera";
1
+ import { Camera, CameraEvents, type ICameraParams } from "./Camera";
2
2
  import { Key } from "../Lock";
3
3
  import { LonLat } from "../LonLat";
4
4
  import { Planet } from "../scene/Planet";
5
5
  import { Vec3 } from "../math/Vec3";
6
6
  import { Extent } from "../Extent";
7
7
  import { Segment } from "../segment/Segment";
8
+ import { EventsHandler } from "../Events";
9
+ import { EasingFunction } from "../utils/easing";
8
10
  export interface IPlanetCameraParams extends ICameraParams {
9
11
  minAltitude?: number;
10
12
  maxAltitude?: number;
11
13
  }
14
+ export type PlanetCameraEventsList = [
15
+ "flystart",
16
+ "flyend",
17
+ "flystop"
18
+ ];
19
+ export declare const DEFAULT_FLIGHT_DURATION = 800;
20
+ export declare const DEFAULT_EASING: EasingFunction;
12
21
  type CameraFrame = {
13
22
  eye: Vec3;
14
23
  n: Vec3;
15
24
  u: Vec3;
16
25
  v: Vec3;
17
26
  };
27
+ type CameraFlight = {
28
+ fly: (progress: number) => CameraFrame;
29
+ duration: number;
30
+ startedAt: number;
31
+ };
18
32
  /**
19
33
  * Planet camera.
20
34
  * @class
@@ -30,6 +44,11 @@ type CameraFrame = {
30
44
  * @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
31
45
  * @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
32
46
  * @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
47
+ * @fires og.Camera#viewchange
48
+ * @fires og.Camera#moveend
49
+ * @fires og.PlanetCamera#flystart
50
+ * @fires og.PlanetCamera#flyend
51
+ * @fires og.PlanetCamera#flystop
33
52
  */
34
53
  declare class PlanetCamera extends Camera {
35
54
  /**
@@ -38,6 +57,7 @@ declare class PlanetCamera extends Camera {
38
57
  * @type {Planet}
39
58
  */
40
59
  planet: Planet;
60
+ events: EventsHandler<PlanetCameraEventsList> & EventsHandler<CameraEvents>;
41
61
  /**
42
62
  * Minimal altitude that camera can reach over the terrain.
43
63
  * @public
@@ -82,9 +102,7 @@ declare class PlanetCamera extends Camera {
82
102
  _insideSegment: Segment | null;
83
103
  slope: number;
84
104
  protected _keyLock: Key;
85
- protected _framesArr: CameraFrame[];
86
- protected _framesCounter: number;
87
- protected _numFrames: number;
105
+ protected _flight: CameraFlight | null;
88
106
  protected _completeCallback: Function | null;
89
107
  protected _frameCallback: Function | null;
90
108
  protected _flying: boolean;
@@ -152,13 +170,15 @@ declare class PlanetCamera extends Camera {
152
170
  * @param {number} [height] - Destination height.
153
171
  * @param {Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
154
172
  * @param {Number} [ampl] - Altitude amplitude factor.
173
+ * @param {Number} [duration] - Animation duration
174
+ * @param {EasingFunction} [ease] - Animation easing
155
175
  * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
156
176
  * @param {Function} [startCallback] - Callback that calls before the flying begins.
157
177
  * @param {Function} [frameCallback] - Each frame callback
158
178
  */
159
- flyExtent(extent: Extent, height?: number | null, up?: Vec3 | null, ampl?: number | null, completeCallback?: Function | null, startCallback?: Function | null, frameCallback?: Function | null): void;
179
+ flyExtent(extent: Extent, height?: number | null, up?: Vec3 | null, ampl?: number | null, duration?: number, ease?: EasingFunction, completeCallback?: Function | null, startCallback?: Function | null, frameCallback?: Function | null): void;
160
180
  viewDistance(cartesian: Vec3, distance?: number): void;
161
- flyDistance(cartesian: Vec3, distance?: number, ampl?: number, completeCallback?: Function, startCallback?: Function, frameCallback?: Function): void;
181
+ flyDistance(cartesian: Vec3, distance?: number, ampl?: number, duration?: number, ease?: EasingFunction, completeCallback?: Function, startCallback?: Function, frameCallback?: Function): void;
162
182
  /**
163
183
  * Flies to the cartesian coordinates.
164
184
  * @public
@@ -166,11 +186,13 @@ declare class PlanetCamera extends Camera {
166
186
  * @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
167
187
  * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
168
188
  * @param {Number} [ampl=1.0] - Altitude amplitude factor.
189
+ * @param {Number} [duration] - Animation duration
190
+ * @param {EasingFunction} [ease] - Animation easing
169
191
  * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
170
192
  * @param {Function} [startCallback] - Callback that calls before the flying begins.
171
193
  * @param {Function} [frameCallback] - Each frame callback
172
194
  */
173
- flyCartesian(cartesian: Vec3, look?: Vec3 | LonLat | null, up?: Vec3 | null, ampl?: number, completeCallback?: Function | null, startCallback?: Function | null, frameCallback?: Function | null): void;
195
+ flyCartesian(cartesian: Vec3, look?: Vec3 | LonLat | null, up?: Vec3 | null, ampl?: number, duration?: number, ease?: EasingFunction, completeCallback?: Function | null, startCallback?: Function | null, frameCallback?: Function | null): void;
174
196
  /**
175
197
  * Flies to the geo coordinates.
176
198
  * @public
@@ -178,11 +200,13 @@ declare class PlanetCamera extends Camera {
178
200
  * @param {Vec3 | LonLat} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
179
201
  * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
180
202
  * @param {number} [ampl] - Altitude amplitude factor.
203
+ * @param {Number} [duration] - Animation duration
204
+ * @param {EasingFunction} [ease] - Animation easing
181
205
  * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
182
206
  * @param {Function} [startCallback] - Callback that calls befor the flying begins.
183
207
  * @param {Function} [frameCallback] - each frame callback
184
208
  */
185
- flyLonLat(lonlat: LonLat, look?: Vec3 | LonLat, up?: Vec3, ampl?: number, completeCallback?: Function, startCallback?: Function, frameCallbak?: Function): void;
209
+ flyLonLat(lonlat: LonLat, look?: Vec3 | LonLat, up?: Vec3, ampl?: number, duration?: number, ease?: EasingFunction, completeCallback?: Function, startCallback?: Function, frameCallback?: Function): void;
186
210
  /**
187
211
  * Breaks the flight.
188
212
  * @public
@@ -49,10 +49,13 @@ export declare class MouseNavigation extends Control {
49
49
  protected _dragInertia: number;
50
50
  constructor(options?: IEarthNavigationParams);
51
51
  oninit(): void;
52
+ onadd(): void;
53
+ onremove(): void;
52
54
  onactivate(): void;
53
55
  ondeactivate(): void;
54
56
  protected onDraw(): void;
55
57
  _onShiftFree: () => void;
58
+ private _onCameraFly;
56
59
  protected _onMouseMove: (e: IMouseState) => void;
57
60
  protected _onMouseEnter: (e: IMouseState) => void;
58
61
  protected _onMouseLeave: () => void;
@@ -41,6 +41,9 @@ export declare class TouchNavigation extends Control {
41
41
  protected _touching: boolean;
42
42
  constructor(options?: ITouchNavigationParams);
43
43
  oninit(): void;
44
+ onadd(): void;
45
+ onremove(): void;
46
+ private _onCameraFly;
44
47
  protected onTouchStart(e: ITouchState): void;
45
48
  protected _startTouchOne(e: ITouchState): void;
46
49
  stopRotation(): void;
@@ -1,8 +1,14 @@
1
1
  import { Control, type IControlParams } from "../Control";
2
2
  import { PolygonDrawingScene } from "./PolygonDrawingScene";
3
+ export interface IDrawingControlParams extends IControlParams {
4
+ cornerStyle?: any;
5
+ centerStyle?: any;
6
+ outlineStyle?: any;
7
+ fillStyle?: any;
8
+ }
3
9
  declare class DrawingControl extends Control {
4
10
  protected _drawingScene: PolygonDrawingScene;
5
- constructor(options?: IControlParams);
11
+ constructor(options?: IDrawingControlParams);
6
12
  activatePolygonDrawing(): void;
7
13
  activateLineStringDrawing(): void;
8
14
  oninit(): void;
@@ -1,8 +1,9 @@
1
1
  import { type EventsHandler } from '../../Events';
2
- import type { CoordinatesType } from "../../entity/Geometry";
2
+ import type { CoordinatesType, IGeometryStyle } from "../../entity/Geometry";
3
+ import type { IGeoObjectParams } from "../../entity/GeoObject";
4
+ import type { IPolylineParams } from "../../entity/Polyline";
3
5
  import { Entity } from '../../entity/Entity';
4
6
  import type { IMouseState } from "../../renderer/RendererEvents";
5
- import { Object3d } from '../../Object3d';
6
7
  import { Planet } from '../../scene/Planet';
7
8
  import { RenderNode } from '../../scene/RenderNode';
8
9
  import { Vec2 } from '../../math/Vec2';
@@ -11,35 +12,21 @@ import { Vector } from '../../layer/Vector';
11
12
  type PolygonDrawingSceneEventsList = ["change", "startpoint"];
12
13
  export interface IPolygonDrawingSceneParams {
13
14
  coordinates?: CoordinatesType[];
15
+ cornerStyle?: IGeoObjectParams;
16
+ centerStyle?: IGeoObjectParams;
17
+ outlineStyle?: IPolylineParams;
18
+ fillStyle?: IGeometryStyle;
14
19
  name: string;
15
20
  }
16
21
  export declare const NUM_SEGMENTS = 200;
17
22
  export declare const OUTLINE_ALT = 0.3;
18
- export declare const COORDINATES_COLOR = "rgb(350, 350, 0)";
19
- export declare const CENTER_COLOR = "rgb(0, 350, 50)";
20
- export declare const OUTLINE_COLOR = "rgb(0, 350, 50)";
21
- export declare const OUTLINE_THICKNESS = 3.5;
22
- export declare const CORNER_OPTIONS: {
23
- scale: number;
24
- instanced: boolean;
25
- tag: string;
26
- color: string;
27
- object3d: Object3d;
28
- };
29
- export declare const CENTER_OPTIONS: {
30
- scale: number;
31
- instanced: boolean;
32
- tag: string;
33
- color: string;
34
- object3d: Object3d;
35
- };
36
- export declare const OUTLINE_OPTIONS: {
37
- thickness: number;
38
- color: string;
39
- };
40
23
  declare class PolygonDrawingScene extends RenderNode {
41
24
  events: EventsHandler<PolygonDrawingSceneEventsList>;
42
25
  _planet: Planet | null;
26
+ _cornerStyle: IGeoObjectParams;
27
+ _centerStyle: IGeoObjectParams;
28
+ _outlineStyle: IPolylineParams;
29
+ _fillStyle: IGeometryStyle;
43
30
  protected _initCoordinates: CoordinatesType[];
44
31
  protected _pickedCorner: Entity | null;
45
32
  protected _pickedCenter: Entity | null;
package/lib/index.d.ts CHANGED
@@ -33,4 +33,6 @@ export * from './layer/index';
33
33
  import { EmptyTerrain, GlobusTerrain, RgbTerrain, BilTerrain, GlobusRgbTerrain } from './terrain/index';
34
34
  import { MoveAxisEntity } from "./control/geoObjectEditor/MoveAxisEntity";
35
35
  import { Gltf } from './utils/gltf/gltfParser';
36
- export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, webgl, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d, Gltf, MoveAxisEntity, };
36
+ import { Easing } from './utils/easing';
37
+ import type { EasingFunction } from './utils/easing';
38
+ export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, webgl, Easing, EasingFunction, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, BilTerrain, Control, Camera, Ellipsoid, Planet, PlanetCamera, LightSource, Program, Handler, Multisample, Renderer, Clock, Events, Extent, LonLat, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d, Gltf, MoveAxisEntity, };