aviation-chart 0.3.4 → 0.3.6

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/dist/nav-sdk.d.ts CHANGED
@@ -438,7 +438,9 @@ interface IMapSDK {
438
438
  destroy(): void;
439
439
  use(plugin: IPlugin): void;
440
440
  getPlugin<T extends IPlugin>(name: string): T | undefined;
441
- setPeriod(period: string): void;
441
+ setPeriod(period: string, options?: {
442
+ validate?: boolean;
443
+ }): void;
442
444
  getPeriod(): string | undefined;
443
445
  generateCurrentPeriod(): Promise<string>;
444
446
  showGraticule(): void;
@@ -1036,7 +1038,10 @@ declare class MapSDK implements IMapSDK {
1036
1038
  lazyLoadingEnabled: boolean;
1037
1039
  };
1038
1040
  getErrorStats(): void;
1039
- setPeriod(period: string): void;
1041
+ setPeriod(period: string, options?: {
1042
+ validate?: boolean;
1043
+ }): void;
1044
+ private _applyPeriod;
1040
1045
  getPeriod(): string | undefined;
1041
1046
  generateCurrentPeriod(): Promise<string>;
1042
1047
  search(params: SearchParams): Promise<SearchResultItem[]>;
@@ -2149,7 +2154,7 @@ declare function buildLayersLight(): ({
2149
2154
  minzoom: number;
2150
2155
  layout: {
2151
2156
  "icon-image": string;
2152
- "icon-size": (string | number | string[])[];
2157
+ "icon-size": (string | number | (string | number)[])[];
2153
2158
  "icon-rotate": (string | number | string[])[];
2154
2159
  "icon-rotation-alignment": string;
2155
2160
  "symbol-z-order": string;
@@ -5500,7 +5500,15 @@ function buildLayersLight() {
5500
5500
  minzoom: 8,
5501
5501
  layout: {
5502
5502
  "icon-image": "vor:vor_dial",
5503
- "icon-size": ["interpolate", ["linear"], ["zoom"], 8, 0.072, 10, 0.072, 11, 0.126, 12, 0.180, 13, 0.234, 14, 0.288, 15, 0.342, 16, 0.396, 17, 0.450, 22, 0.450],
5503
+ // "icon-size": ["interpolate", ["linear"], ["zoom"], 8, 0.072, 10, 0.072, 11, 0.126, 12, 0.180, 13, 0.234, 14, 0.288, 15, 0.342, 16, 0.396, 17, 0.450, 22, 0.450],
5504
+ "icon-size": [
5505
+ "interpolate",
5506
+ ["exponential", 1.3],
5507
+ ["zoom"],
5508
+ 8, 0.35,
5509
+ 17, 0.764,
5510
+ 22, 0.85
5511
+ ],
5504
5512
  "icon-rotate": ["to-number", ["get", "VAL_MAG_VAR"], 0],
5505
5513
  "icon-rotation-alignment": "map",
5506
5514
  "symbol-z-order": "viewport-y",
@@ -6607,12 +6615,32 @@ class MapSDK {
6607
6615
  }
6608
6616
  getErrorStats() {
6609
6617
  }
6610
- setPeriod(period) {
6618
+ setPeriod(period, options) {
6619
+ if (options?.validate) {
6620
+ this.getPeriods()
6621
+ .then((all) => {
6622
+ if (!all.includes(period)) {
6623
+ const err = new Error(`期数 ${period} 不存在,可用期数:${all.join(", ")}`);
6624
+ this.map?.fire("error", { error: err });
6625
+ return;
6626
+ }
6627
+ this._applyPeriod(period);
6628
+ })
6629
+ .catch((e) => (void 0));
6630
+ return;
6631
+ }
6632
+ this._applyPeriod(period);
6633
+ }
6634
+ _applyPeriod(period) {
6635
+ const from = this.getPeriod();
6611
6636
  this.globalConfig.setPeriod(period);
6612
6637
  const navdata = this.map?.getSource("navdata");
6613
6638
  if (navdata?.setTiles) {
6614
6639
  navdata.setTiles([navdataTilesUrl(this._chartApiUrl, period)]);
6615
6640
  }
6641
+ if (from !== undefined && from !== period) {
6642
+ this.map?.fire("periodchange", { from, to: period });
6643
+ }
6616
6644
  }
6617
6645
  getPeriod() {
6618
6646
  return this.globalConfig.getPeriod();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aviation-chart",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "KunYu aviation map SDK",
5
5
  "main": "dist/nav-sdk.esm.js",
6
6
  "module": "dist/nav-sdk.esm.js",