@openglobus/og 0.26.4 → 0.26.5

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,9 @@ 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
- export type CameraEvents = ["viewchange", "moveend"];
13
+ import { EasingFunction } from "../utils/easing";
14
+ import { LonLat } from "../LonLat";
15
+ export type CameraEvents = ["viewchange", "moveend", "flystart", "flyend", "flystop"];
14
16
  export interface ICameraParams {
15
17
  eye?: Vec3;
16
18
  viewAngle?: number;
@@ -20,6 +22,30 @@ export interface ICameraParams {
20
22
  width?: number;
21
23
  height?: number;
22
24
  }
25
+ export interface IFlyCartesianParams extends IFlyBaseParams {
26
+ look?: Vec3 | LonLat;
27
+ up?: Vec3;
28
+ }
29
+ export interface IFlyBaseParams {
30
+ duration?: number;
31
+ ease?: EasingFunction;
32
+ completeCallback?: Function;
33
+ startCallback?: Function;
34
+ frameCallback?: Function;
35
+ }
36
+ export declare const DEFAULT_FLIGHT_DURATION = 800;
37
+ export declare const DEFAULT_EASING: EasingFunction;
38
+ type CameraFrame = {
39
+ eye: Vec3;
40
+ n: Vec3;
41
+ u: Vec3;
42
+ v: Vec3;
43
+ };
44
+ type CameraFlight = {
45
+ fly: (progress: number) => CameraFrame;
46
+ duration: number;
47
+ startedAt: number;
48
+ };
23
49
  /**
24
50
  * Camera class.
25
51
  * @class
@@ -123,8 +149,35 @@ declare class Camera {
123
149
  isFirstPass: boolean;
124
150
  _width: number;
125
151
  _height: number;
152
+ protected _flight: CameraFlight | null;
153
+ protected _completeCallback: Function | null;
154
+ protected _frameCallback: Function | null;
155
+ protected _flying: boolean;
126
156
  constructor(options?: ICameraParams);
127
157
  get id(): number;
158
+ /**
159
+ * Flies to the cartesian coordinates.
160
+ * @public
161
+ * @param {Vec3} [cartesian] - Finish cartesian coordinates.
162
+ * @param {IFlyCartesianParams} [params] - Flight parameters
163
+ */
164
+ flyCartesian(cartesian: Vec3, params?: IFlyCartesianParams): void;
165
+ /**
166
+ * Breaks the flight.
167
+ * @public
168
+ */
169
+ stopFlying(): void;
170
+ /**
171
+ * Prepare camera to the frame. Used in render node frame function.
172
+ * @public
173
+ */
174
+ checkFly(): void;
175
+ /**
176
+ * Returns camera is flying.
177
+ * @public
178
+ * @returns {boolean}
179
+ */
180
+ isFlying(): boolean;
128
181
  checkMoveEnd(): void;
129
182
  bindFrustumsPickingColors(renderer: Renderer): void;
130
183
  /**
@@ -1,34 +1,20 @@
1
- import { Camera, CameraEvents, type ICameraParams } from "./Camera";
1
+ import { Camera, type IFlyCartesianParams, 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";
10
8
  export interface IPlanetCameraParams extends ICameraParams {
11
9
  minAltitude?: number;
12
10
  maxAltitude?: number;
13
11
  }
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;
21
- type CameraFrame = {
22
- eye: Vec3;
23
- n: Vec3;
24
- u: Vec3;
25
- v: Vec3;
26
- };
27
- type CameraFlight = {
28
- fly: (progress: number) => CameraFrame;
29
- duration: number;
30
- startedAt: number;
31
- };
12
+ export interface IPlanetFlyCartesianParams extends IFlyCartesianParams {
13
+ amplitude?: number;
14
+ }
15
+ export interface IPlanetFlyDistanceParams extends IPlanetFlyCartesianParams {
16
+ distance?: number;
17
+ }
32
18
  /**
33
19
  * Planet camera.
34
20
  * @class
@@ -46,9 +32,9 @@ type CameraFlight = {
46
32
  * @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
47
33
  * @fires og.Camera#viewchange
48
34
  * @fires og.Camera#moveend
49
- * @fires og.PlanetCamera#flystart
50
- * @fires og.PlanetCamera#flyend
51
- * @fires og.PlanetCamera#flystop
35
+ * @fires og.Camera#flystart
36
+ * @fires og.Camera#flyend
37
+ * @fires og.Camera#flystop
52
38
  */
53
39
  declare class PlanetCamera extends Camera {
54
40
  /**
@@ -57,7 +43,6 @@ declare class PlanetCamera extends Camera {
57
43
  * @type {Planet}
58
44
  */
59
45
  planet: Planet;
60
- events: EventsHandler<PlanetCameraEventsList> & EventsHandler<CameraEvents>;
61
46
  /**
62
47
  * Minimal altitude that camera can reach over the terrain.
63
48
  * @public
@@ -102,10 +87,6 @@ declare class PlanetCamera extends Camera {
102
87
  _insideSegment: Segment | null;
103
88
  slope: number;
104
89
  protected _keyLock: Key;
105
- protected _flight: CameraFlight | null;
106
- protected _completeCallback: Function | null;
107
- protected _frameCallback: Function | null;
108
- protected _flying: boolean;
109
90
  protected _checkTerrainCollision: boolean;
110
91
  eyeNorm: Vec3;
111
92
  constructor(planet: Planet, options?: IPlanetCameraParams);
@@ -168,56 +149,20 @@ declare class PlanetCamera extends Camera {
168
149
  * @public
169
150
  * @param {Extent} extent - Current extent.
170
151
  * @param {number} [height] - Destination height.
171
- * @param {Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
172
- * @param {Number} [ampl] - Altitude amplitude factor.
173
- * @param {Number} [duration] - Animation duration
174
- * @param {EasingFunction} [ease] - Animation easing
175
- * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
176
- * @param {Function} [startCallback] - Callback that calls before the flying begins.
177
- * @param {Function} [frameCallback] - Each frame callback
152
+ * @param {IPlanetFlyCartesianParams} [params] - Flight parameters
178
153
  */
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;
154
+ flyExtent(extent: Extent, height?: number | null, params?: IPlanetFlyCartesianParams): void;
180
155
  viewDistance(cartesian: Vec3, distance?: number): void;
181
- flyDistance(cartesian: Vec3, distance?: number, ampl?: number, duration?: number, ease?: EasingFunction, completeCallback?: Function, startCallback?: Function, frameCallback?: Function): void;
182
- /**
183
- * Flies to the cartesian coordinates.
184
- * @public
185
- * @param {Vec3} cartesian - Finish cartesian coordinates.
186
- * @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
187
- * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
188
- * @param {Number} [ampl=1.0] - Altitude amplitude factor.
189
- * @param {Number} [duration] - Animation duration
190
- * @param {EasingFunction} [ease] - Animation easing
191
- * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
192
- * @param {Function} [startCallback] - Callback that calls before the flying begins.
193
- * @param {Function} [frameCallback] - Each frame callback
194
- */
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;
196
156
  /**
197
157
  * Flies to the geo coordinates.
198
158
  * @public
199
159
  * @param {LonLat} lonlat - Finish coordinates.
200
- * @param {Vec3 | LonLat} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
201
- * @param {Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
202
- * @param {number} [ampl] - Altitude amplitude factor.
203
- * @param {Number} [duration] - Animation duration
204
- * @param {EasingFunction} [ease] - Animation easing
205
- * @param {Function} [completeCallback] - Callback that calls after flying when flying is finished.
206
- * @param {Function} [startCallback] - Callback that calls befor the flying begins.
207
- * @param {Function} [frameCallback] - each frame callback
208
- */
209
- flyLonLat(lonlat: LonLat, look?: Vec3 | LonLat, up?: Vec3, ampl?: number, duration?: number, ease?: EasingFunction, completeCallback?: Function, startCallback?: Function, frameCallback?: Function): void;
210
- /**
211
- * Breaks the flight.
212
- * @public
160
+ * @param {IPlanetFlyCartesianParams} [params] - Flight parameters
213
161
  */
162
+ flyLonLat(lonlat: LonLat, params?: IPlanetFlyCartesianParams): void;
163
+ flyDistance(cartesian: Vec3, distance?: number, params?: IPlanetFlyCartesianParams): void;
164
+ flyCartesian(cartesian: Vec3, params?: IPlanetFlyCartesianParams): void;
214
165
  stopFlying(): void;
215
- /**
216
- * Returns camera is flying.
217
- * @public
218
- * @returns {boolean}
219
- */
220
- isFlying(): boolean;
221
166
  /**
222
167
  * Rotates around planet to the left.
223
168
  * @public
@@ -245,11 +190,6 @@ declare class PlanetCamera extends Camera {
245
190
  */
246
191
  rotateDown(angle: number): void;
247
192
  rotateVertical(angle: number, center: Vec3, minSlope?: number): void;
248
- /**
249
- * Prepare camera to the frame. Used in render node frame function.
250
- * @public
251
- */
252
- checkFly(): void;
253
193
  checkTerrainCollision(): Vec3 | undefined;
254
194
  getSurfaceVisibleDistance(d: number): number;
255
195
  /**