cmap-core 0.0.2 → 0.0.4

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.
@@ -14,9 +14,8 @@ import { Source } from 'mapbox-gl';
14
14
  import { SourceSpecification } from 'mapbox-gl';
15
15
 
16
16
  export declare class AisShip extends BaseShip<IAisShipOptions> {
17
- static readonly SOURCE: string;
18
- static readonly NAME: string;
19
- tooltip: Tooltip | null;
17
+ readonly SOURCE: string;
18
+ readonly NAME: string;
20
19
  constructor(map: Map_2, options: IAisShipOptions);
21
20
  onAdd(): void;
22
21
  onRemove(): void;
@@ -29,7 +28,7 @@ export declare class AisShip extends BaseShip<IAisShipOptions> {
29
28
  getShape(): Shape | null;
30
29
  getFeature(): GeoJSON_2.Feature<GeoJSON_2.Polygon, IAisShipOptions> | GeoJSON_2.Feature<GeoJSON_2.Point, IAisShipOptions>;
31
30
  remove(): void;
32
- setTooltip(): void;
31
+ setTooltip(tooltip: Tooltip): void;
33
32
  update(options: IAisShipOptions): void;
34
33
  select(): void;
35
34
  unselect(): void;
@@ -58,8 +57,9 @@ declare type Anchor = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left
58
57
 
59
58
  export declare abstract class BaseShip<T extends IBaseShipOptions> extends Module {
60
59
  options: T;
61
- static readonly SOURCE: string;
62
- static readonly NAME: string;
60
+ readonly SOURCE: string;
61
+ readonly NAME: string;
62
+ tooltip: Tooltip | null;
63
63
  visible: boolean;
64
64
  protected constructor(map: Map_2, options: T);
65
65
  destroy(): void;
@@ -75,7 +75,7 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
75
75
  abstract getShape(): Shape | null;
76
76
  abstract getFeature(): GeoJSON_2.Feature<GeoJSON_2.Polygon, T> | GeoJSON_2.Feature<GeoJSON_2.Point, T>;
77
77
  abstract remove(): void;
78
- abstract setTooltip(): void;
78
+ abstract setTooltip(tooltip: Tooltip): void;
79
79
  abstract update(options: IAisShipOptions): void;
80
80
  abstract select(): void;
81
81
  abstract unselect(): void;
@@ -92,6 +92,11 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
92
92
  getName(): string;
93
93
  }
94
94
 
95
+ declare interface BaseShipConstructor<T extends IBaseShipOptions = any> {
96
+ new (map: Map_2, options: T): BaseShip<T>;
97
+ readonly NAME: string;
98
+ }
99
+
95
100
  declare class Cache_2 {
96
101
  _options: CacheOptions;
97
102
  cacheKey: string;
@@ -353,6 +358,10 @@ declare interface Image_2 {
353
358
  image: ImageBitmap | HTMLImageElement | ImageData;
354
359
  }
355
360
 
361
+ declare interface IShipOptions {
362
+ plugins?: BaseShipConstructor[];
363
+ }
364
+
356
365
  declare interface ITooltipOptions {
357
366
  id: string | number;
358
367
  visible?: boolean;
@@ -467,21 +476,24 @@ declare interface Shape {
467
476
  }
468
477
 
469
478
  export declare class Ship extends Module {
470
- ships: AisShip[];
479
+ options: IShipOptions;
480
+ ships: BaseShip<any>[];
471
481
  event: ResidentEvent;
482
+ private pluginRegistry;
472
483
  private collision;
473
- constructor(map: Map_2);
484
+ constructor(map: Map_2, options: IShipOptions);
474
485
  onAdd(): void;
475
486
  onRemove(): void;
476
487
  get tooltips(): Tooltip[];
488
+ private registerPlugins;
477
489
  private createCollisions;
478
490
  private collisionTooltip;
479
- add(data: IAisShipOptions): AisShip;
480
- load(list: IAisShipOptions[]): AisShip[];
491
+ add(data: IAisShipOptions): BaseShip<any> | undefined;
492
+ load(list: IAisShipOptions[]): BaseShip<any>[];
481
493
  remove(id: IAisShipOptions['id']): void;
482
494
  removeAll(): void;
483
495
  render(): void;
484
- get(id: IAisShipOptions['id']): AisShip | undefined;
496
+ get(id: string | number): BaseShip<any> | undefined;
485
497
  select(id: IAisShipOptions['id']): void;
486
498
  unselect(id: IAisShipOptions['id']): void;
487
499
  }