aviation-chart 0.3.25 → 0.3.26

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.
@@ -3463,7 +3463,10 @@ class GlobalConfigManager {
3463
3463
  const headers = this.config.apiKey
3464
3464
  ? { "X-Api-Key": this.config.apiKey }
3465
3465
  : {};
3466
- const response = await fetch(`${base}/api/periods`, { headers });
3466
+ const apiPath = this.config.apiVersion
3467
+ ? `${base}/api/${this.config.apiVersion}/periods`
3468
+ : `${base}/api/periods`;
3469
+ const response = await fetch(apiPath, { headers });
3467
3470
  if (!response.ok) {
3468
3471
  throw new Error(`获取期数失败(${response.status})`);
3469
3472
  }
@@ -4286,6 +4289,10 @@ class GraticuleManager {
4286
4289
  function authHeaders(apiKey) {
4287
4290
  return apiKey ? { "X-Api-Key": apiKey } : {};
4288
4291
  }
4292
+ function apiPrefix$1(baseUrl, version) {
4293
+ const base = baseUrl.replace(/\/$/, "");
4294
+ return version ? `${base}/api/${version}` : `${base}/api`;
4295
+ }
4289
4296
  async function toJSON(res) {
4290
4297
  if (!res.ok) {
4291
4298
  let detail = "";
@@ -4301,7 +4308,7 @@ async function toJSON(res) {
4301
4308
  }
4302
4309
  return res.json();
4303
4310
  }
4304
- async function searchFeatures(baseUrl, apiKey, params) {
4311
+ async function searchFeatures(baseUrl, apiKey, params, version) {
4305
4312
  const { q, type, period, limit, signal } = params;
4306
4313
  if (!q || !q.trim()) {
4307
4314
  throw new Error("search: q 参数必填");
@@ -4313,7 +4320,7 @@ async function searchFeatures(baseUrl, apiKey, params) {
4313
4320
  qs.set("period", period);
4314
4321
  if (limit != null)
4315
4322
  qs.set("limit", String(limit));
4316
- const res = await fetch(`${baseUrl}/api/search?${qs.toString()}`, {
4323
+ const res = await fetch(`${apiPrefix$1(baseUrl, version)}/search?${qs.toString()}`, {
4317
4324
  method: "GET",
4318
4325
  headers: authHeaders(apiKey),
4319
4326
  ...(signal ? { signal } : {}),
@@ -4321,7 +4328,7 @@ async function searchFeatures(baseUrl, apiKey, params) {
4321
4328
  const data = await toJSON(res);
4322
4329
  return data.results ?? [];
4323
4330
  }
4324
- async function getFeatureGeometry(baseUrl, apiKey, params) {
4331
+ async function getFeatureGeometry(baseUrl, apiKey, params, version) {
4325
4332
  const { type, id, period, signal } = params;
4326
4333
  if (!type || !id) {
4327
4334
  throw new Error("getGeometry: type 和 id 参数必填");
@@ -4329,15 +4336,15 @@ async function getFeatureGeometry(baseUrl, apiKey, params) {
4329
4336
  const qs = new URLSearchParams({ type, id });
4330
4337
  if (period)
4331
4338
  qs.set("period", period);
4332
- const res = await fetch(`${baseUrl}/api/geometry?${qs.toString()}`, {
4339
+ const res = await fetch(`${apiPrefix$1(baseUrl, version)}/geometry?${qs.toString()}`, {
4333
4340
  method: "GET",
4334
4341
  headers: authHeaders(apiKey),
4335
4342
  ...(signal ? { signal } : {}),
4336
4343
  });
4337
4344
  return toJSON(res);
4338
4345
  }
4339
- async function getPeriods(baseUrl, apiKey, signal) {
4340
- const res = await fetch(`${baseUrl}/api/periods`, {
4346
+ async function getPeriods(baseUrl, apiKey, signal, version) {
4347
+ const res = await fetch(`${apiPrefix$1(baseUrl, version)}/periods`, {
4341
4348
  method: "GET",
4342
4349
  headers: authHeaders(apiKey),
4343
4350
  ...(signal ? { signal } : {}),
@@ -7405,6 +7412,10 @@ return exported;
7405
7412
  var mlcontour$1 = mlcontour;
7406
7413
 
7407
7414
  const DEFAULT_CHART_API_URL = "https://aips.siniswift.com";
7415
+ function apiPrefix(apiUrl, version) {
7416
+ const base = apiUrl.replace(/\/$/, "");
7417
+ return version ? `${base}/api/${version}` : `${base}/api`;
7418
+ }
7408
7419
  function getAviationBaseStyle(opts) {
7409
7420
  const apiUrl = opts.apiUrl.replace(/\/$/, "");
7410
7421
  const spriteBase = (opts.spriteUrl ?? apiUrl).replace(/\/$/, "");
@@ -7436,21 +7447,21 @@ function getAviationBaseStyle(opts) {
7436
7447
  }
7437
7448
  };
7438
7449
  }
7439
- function navdataTilesUrl(apiUrl, period) {
7440
- return `${apiUrl.replace(/\/$/, "")}/api/tiles/${period}/{z}/{x}/{y}.pbf`;
7450
+ function navdataTilesUrl(apiUrl, period, version) {
7451
+ return `${apiPrefix(apiUrl, version)}/tiles/${period}/{z}/{x}/{y}.pbf`;
7441
7452
  }
7442
- function getNavdataSource(apiUrl, period) {
7453
+ function getNavdataSource(apiUrl, period, version) {
7443
7454
  return {
7444
7455
  type: "vector",
7445
- tiles: [navdataTilesUrl(apiUrl, period)],
7456
+ tiles: [navdataTilesUrl(apiUrl, period, version)],
7446
7457
  minzoom: 0.5,
7447
7458
  maxzoom: 18,
7448
7459
  };
7449
7460
  }
7450
- function getChartAmmSource(apiUrl) {
7461
+ function getChartAmmSource(apiUrl, version) {
7451
7462
  return {
7452
7463
  type: "vector",
7453
- tiles: [`${apiUrl.replace(/\/$/, "")}/api/amm/{z}/{x}/{y}.pbf`],
7464
+ tiles: [`${apiPrefix(apiUrl, version)}/amm/{z}/{x}/{y}.pbf`],
7454
7465
  minzoom: 11,
7455
7466
  maxzoom: 18,
7456
7467
  };
@@ -7581,103 +7592,136 @@ async function fetchGzJson(url, headers = {}) {
7581
7592
  return new Response(stream).json();
7582
7593
  }
7583
7594
 
7584
- // ICAO aviation chart layer styles — multi-theme support.
7585
- // Add new themes by implementing buildLayersXxx() and registering in CHART_THEMES.
7595
+ // ICAO aviation chart layer styles — token-driven multi-theme.
7596
+ //
7597
+ // 单一 buildLayers(T):图层结构只写一份(以 light 为准);凡随主题变化的值
7598
+ // (颜色 / halo / icon-image / pattern)都从 token 表 T 取。尺寸曲线、zoom、
7599
+ // 偏移、opacity 曲线、text-field、placement 等结构性属性两主题一致,写死。
7600
+ //
7601
+ // 加主题 = 在 THEME_TOKENS 增加一张 token 表;不再复制整份 build 函数,
7602
+ // 彻底消除 light/dark 漂移(历史上 dark 航线消失、6,6 插值等 bug 均源于此)。
7586
7603
 
7587
- // ── Light theme ───────────────────────────────────────────────────────────────
7588
- // const ICAO_LIGHT = {
7589
- // airspaceStroke: '#AAB7B8',
7590
- // restrictedStroke: "#D35400",
7591
- // controlledStroke: '#6ec1f4',
7592
- // controlledFill: '#6ec1f4',
7593
- // segment: '#0044AA',
7594
- // waypoint: '#663399',
7595
- // vor: '#00008B',
7596
- // ndb: '#0066CC',
7597
- // airport: '#CC6600',
7598
- // runway: '#333333',
7599
- // }
7600
- const ICAO_LIGHT = {
7601
- airspaceStroke: '#AAB7B8',
7602
- restrictedStroke: "#D35400",
7603
- controlledStroke: '#10B981',
7604
- controlledFill: '#10B981',
7605
- segment: '#2E4053',
7606
- waypoint: '#1C2526',
7607
- vor: '#00008B',
7608
- ndb: '#0066CC',
7609
- airport: '#006400',
7610
- runway: '#333333',
7604
+ /**
7605
+ * 主题 token 表。每个 key 是一个"随主题变化"的值,值可以是颜色字符串、
7606
+ * _ml 表达式,或 halo 片段对象(用对象展开有条件地注入 text-halo-*)。
7607
+ */
7608
+ const THEME_TOKENS = {
7609
+ light: {
7610
+ background: '#EAF2F8',
7611
+ land: '#F7F9FB',
7612
+ halo: '#ffffff',
7613
+ boundaryPattern: 'normal:national-border',
7614
+ adizLine: null, // light 不给 adiz 线描色(仅用 pattern)
7615
+ adizLabel: '#6600cc',
7616
+ airspaceStroke: '#AAB7B8',
7617
+ restrictedFill: '#FAD7A0',
7618
+ restrictedStrokeLine: '#f6bf65',
7619
+ restrictedStroke: '#D35400', // 限制区标注文字色(ICAO 导出/图例用)
7620
+ controlledStroke: '#10B981',
7621
+ controlledFill: '#10B981',
7622
+ segment: '#2E4053',
7623
+ segmentRemark: '#E8A020', // HAS_REMARK 航段
7624
+ airport: '#006400', // 机场图标色
7625
+ airportText: '#006400', // 机场文字色(非 AMM)
7626
+ runway: '#333333',
7627
+ vorDial: '#0b417a',
7628
+ vorNormal: '#3874cb',
7629
+ vor: '#00008B',
7630
+ ndbIcon: 'v2:ndb-normal', // 图标按主题不同(正常)
7631
+ ndb: '#0066CC',
7632
+ waypoint: '#1C2526',
7633
+ // airline_label format 内嵌文字色
7634
+ alBase: '#ffffff', alDist: '#3E4759', alRnp: '#E8A020',
7635
+ // halo 片段:light 多数标注无 halo → 空对象
7636
+ sideHalo: {},
7637
+ centerHalo: {},
7638
+ restrictedHalo: {},
7639
+ controlledHalo: {},
7640
+ radialHalo: {},
7641
+ runwayHalo: { 'text-halo-width': 1 },
7642
+ alHalo: { 'text-halo-color': '#ffffff', 'text-halo-width': 0.1 },
7643
+ ndbHalo: { 'text-halo-color': '#ffffff', 'text-halo-width': 0.5, 'text-halo-blur': 1 },
7644
+ },
7645
+ dark: {
7646
+ background: '#000000',
7647
+ land: '#0A111A',
7648
+ halo: '#0f172a',
7649
+ boundaryPattern: 'normal:national-border-dark',
7650
+ adizLine: '#a855f7',
7651
+ adizLabel: '#c084fc',
7652
+ airspaceStroke: '#18C29C',
7653
+ restrictedFill: ['case', ['==', ['get', 'CODE_TYPE'], 'P'], '#ef4444', ['==', ['get', 'CODE_TYPE'], 'D'], '#f97316', '#ef4444'],
7654
+ restrictedStrokeLine: '#CC7722',
7655
+ restrictedStroke: '#CC7722',
7656
+ controlledStroke: '#22C55E',
7657
+ controlledFill: '#22C55E',
7658
+ segment: '#40C4FF',
7659
+ segmentRemark: '#fbbf24',
7660
+ airport: '#73ccdd',
7661
+ airportText: '#E0F7FA',
7662
+ runway: '#64748b',
7663
+ vorDial: '#38bdf8',
7664
+ vorNormal: '#38bdf8',
7665
+ vor: '#72aae5',
7666
+ ndbIcon: 'ndb-inway',
7667
+ ndb: '#62d6ef',
7668
+ waypoint: '#74cdde',
7669
+ alBase: '#0f172a', alDist: '#cbd5e1', alRnp: '#FFFFFF',
7670
+ sideHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
7671
+ centerHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1.5 },
7672
+ restrictedHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
7673
+ controlledHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1.5 },
7674
+ radialHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
7675
+ runwayHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
7676
+ alHalo: {},
7677
+ ndbHalo: { 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
7678
+ },
7611
7679
  };
7612
7680
 
7613
- function buildLayersLight() {
7681
+ function buildLayers(themeId = 'light') {
7682
+ const T = THEME_TOKENS[themeId] ?? THEME_TOKENS.light;
7614
7683
  const sourceId = 'navdata';
7615
- const C = ICAO_LIGHT;
7616
7684
  return [
7617
7685
  {
7618
7686
  "id": "landLayer", "type": "fill", "source": "land",
7619
7687
  "layout": { "visibility": "visible" },
7620
- "paint": { "fill-color": "#F7F9FB", "fill-opacity": 1 }
7688
+ "paint": { "fill-color": T.land, "fill-opacity": 1 }
7621
7689
  },
7622
7690
  {
7623
- "id": "boundary",
7624
- "type": "line",
7625
- "source": "boundary",
7626
- "minzoom": 0,
7691
+ "id": "boundary", "type": "line", "source": "boundary", "minzoom": 0,
7627
7692
  "paint": {
7628
- "line-width": [
7629
- "interpolate",
7630
- [
7631
- "linear"
7632
- ],
7633
- [
7634
- "zoom"
7635
- ],
7636
- 0,
7637
- 1,
7638
- 7,
7639
- 4
7640
- ],
7641
- "line-opacity": [
7642
- "interpolate",
7643
- [
7644
- "linear"
7645
- ],
7646
- [
7647
- "zoom"
7648
- ],
7649
- 0,
7650
- 1,
7651
- 2,
7652
- 0.5
7653
- ],
7654
- "line-pattern": "normal:national-border"
7693
+ "line-width": ["interpolate", ["linear"], ["zoom"], 0, 1, 7, 4],
7694
+ "line-opacity": ["interpolate", ["linear"], ["zoom"], 0, 1, 2, 0.5],
7695
+ "line-pattern": T.boundaryPattern,
7655
7696
  }
7656
7697
  },
7657
7698
  {
7658
7699
  id: 'adiz-line', type: 'line', source: sourceId, 'source-layer': 'adiz', minzoom: 3,
7659
7700
  layout: { 'line-cap': 'round', 'line-join': 'round' },
7660
- paint: { 'line-width': 4, "line-pattern": "normal:adiz", 'line-opacity': ['interpolate', ['linear'], ['zoom'], 3, 0.6, 8, 0.4] },
7701
+ paint: {
7702
+ ...(T.adizLine ? { 'line-color': T.adizLine } : {}),
7703
+ 'line-width': 4, "line-pattern": "normal:adiz",
7704
+ 'line-opacity': ['interpolate', ['linear'], ['zoom'], 3, 0.6, 8, 0.4],
7705
+ },
7661
7706
  },
7662
7707
  {
7663
7708
  id: 'adiz-label', type: 'symbol', source: sourceId, 'source-layer': 'adiz-centroid', minzoom: 3,
7664
7709
  layout: { 'text-field': ['coalesce', ['get', 'TXT_NAME'], ['get', 'CODE_ID']], 'text-size': 10, 'text-max-width': 10, 'symbol-placement': 'point' },
7665
- paint: { 'text-color': '#6600cc', 'text-halo-color': '#ffffff', 'text-halo-width': 1.5 },
7710
+ paint: { 'text-color': T.adizLabel, 'text-halo-color': T.halo, 'text-halo-width': 1.5 },
7666
7711
  },
7667
7712
  {
7668
7713
  id: 'airspaceLayer', type: 'line', source: sourceId, 'source-layer': 'fir', minzoom: 2,
7669
- // layout: { "line-cap": "butt", "line-join": "miter", "line-miter-limit": 0 },
7670
- paint: { "line-color": C.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 2, 0, 2.7, 0.8, 9, 0.8, 10, 0.5], "line-width": 0.5, 'line-dasharray': [4.2, 4] }
7714
+ paint: { "line-color": T.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 2, 0, 2.7, 0.8, 9, 0.8, 10, 0.5], "line-width": 0.5, 'line-dasharray': [4.2, 4] }
7671
7715
  },
7672
7716
  {
7673
7717
  "id": "airspaceLayer_line", type: 'line', source: sourceId, 'source-layer': 'fir', "minzoom": 5,
7674
7718
  layout: { "line-miter-limit": 0, "line-cap": "butt", "line-join": "miter" },
7675
- paint: { "line-color": C.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0, 5.5, 0.8, 9, 0.8, 10, 0.5], "line-width": 6, "line-dasharray": [0.2, 5] }
7719
+ paint: { "line-color": T.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0, 5.5, 0.8, 9, 0.8, 10, 0.5], "line-width": 6, "line-dasharray": [0.2, 5] }
7676
7720
  },
7677
7721
  {
7678
7722
  id: 'airspace_label_side_layer', type: 'symbol', source: sourceId, 'source-layer': 'fir', minzoom: 4,
7679
7723
  layout: { 'text-field': ["concat", ["get", "TXT_NAME"], "/", ["get", "CODE_ID"], "/", ["get", "CODE_TYPE"]], 'text-size': 10, 'symbol-placement': 'line', 'text-max-width': 8, "text-offset": [0, 1], "text-letter-spacing": 0.05, "text-optional": true },
7680
- paint: { 'text-color': C.airspaceStroke },
7724
+ paint: { 'text-color': T.airspaceStroke, ...T.sideHalo },
7681
7725
  },
7682
7726
  {
7683
7727
  id: 'airspace_label_center_layer', type: 'symbol', source: sourceId, 'source-layer': 'fir-centroid', minzoom: 3,
@@ -7688,98 +7732,50 @@ function buildLayersLight() {
7688
7732
  'text-max-width': 8,
7689
7733
  },
7690
7734
  paint: {
7691
- 'text-color': C.airspaceStroke,
7735
+ 'text-color': T.airspaceStroke,
7736
+ ...T.centerHalo,
7692
7737
  'text-opacity': ['interpolate', ['linear'], ['zoom'], 3, 0.85, 8, 0.7, 12, 0.5],
7693
7738
  },
7694
7739
  },
7695
7740
  {
7696
7741
  id: 'restrictedLayer', type: 'fill', source: sourceId, 'source-layer': 'restricted-fill', minzoom: 4,
7697
7742
  paint: {
7698
- 'fill-color': "#FAD7A0",
7699
- // "fill-pattern": "normal:passline",
7700
- 'fill-opacity': [
7701
- "interpolate",
7702
- [
7703
- "linear"
7704
- ],
7705
- [
7706
- "zoom"
7707
- ],
7708
- 10,
7709
- 0.15,
7710
- 11.5,
7711
- 0
7712
- ],
7743
+ 'fill-color': T.restrictedFill,
7744
+ 'fill-opacity': ["interpolate", ["linear"], ["zoom"], 10, 0.15, 11.5, 0],
7713
7745
  },
7714
7746
  },
7715
7747
  {
7716
7748
  id: 'restrictedLayer_stroke', type: 'line', source: sourceId, 'source-layer': 'restricted',
7717
- paint: { 'line-color': "#f6bf65", 'line-width': 1, "line-dasharray": [2, 2], "line-opacity": ['interpolate', ['linear'], ['zoom'], 4, 0.5, 8, 1] },
7749
+ paint: { 'line-color': T.restrictedStrokeLine, 'line-width': 1, "line-dasharray": [2, 2], "line-opacity": ['interpolate', ['linear'], ['zoom'], 4, 0.5, 8, 1] },
7718
7750
  },
7719
7751
  {
7720
7752
  id: 'restricted_line_label', type: 'symbol', source: sourceId, 'source-layer': 'restricted', minzoom: 6,
7721
7753
  layout: { 'text-field': ["concat", ["get", "TXT_NAME"], "/", ["get", "CODE_ID"], "/", ["get", "CODE_TYPE"]], "text-letter-spacing": 0.1, 'text-size': 10, 'symbol-placement': 'line', 'text-max-width': 8, "text-offset": [0, 1] },
7722
- paint: { 'text-color': C.restrictedStroke },
7754
+ paint: { 'text-color': T.restrictedStroke, ...T.restrictedHalo },
7723
7755
  },
7724
7756
  {
7725
7757
  id: 'controlledLayer', type: 'fill', source: sourceId, 'source-layer': 'controlled-fill', minzoom: 4,
7726
7758
  paint: {
7727
- 'fill-color': C.controlledFill,
7728
- "fill-opacity": [
7729
- "interpolate",
7730
- [
7731
- "linear"
7732
- ],
7733
- [
7734
- "zoom"
7735
- ],
7736
- 10,
7737
- 0.035,
7738
- 11.5,
7739
- 0
7740
- ]
7759
+ 'fill-color': T.controlledFill,
7760
+ "fill-opacity": ["interpolate", ["linear"], ["zoom"], 10, 0.035, 11.5, 0],
7741
7761
  },
7742
7762
  },
7743
7763
  {
7744
7764
  id: 'controlledLayer_stroke', type: 'line', source: sourceId, 'source-layer': 'controlled',
7745
-
7746
- paint: {
7747
- 'line-color': C.controlledStroke, 'line-width': 1, 'line-opacity': ['interpolate', ['linear'], ['zoom'], 4, 0.5, 8, 1], "line-dasharray": [1,
7748
- 1.4]
7749
- },
7765
+ paint: { 'line-color': T.controlledStroke, 'line-width': 1, 'line-opacity': ['interpolate', ['linear'], ['zoom'], 4, 0.5, 8, 1], "line-dasharray": [1, 1.4] },
7750
7766
  },
7751
7767
  {
7752
- id: 'controlled_line_label',
7753
- type: 'symbol', source: sourceId, 'source-layer': 'controlled', minzoom: 6,
7768
+ id: 'controlled_line_label', type: 'symbol', source: sourceId, 'source-layer': 'controlled', minzoom: 6,
7754
7769
  layout: { 'text-field': ["concat", ["get", "TXT_NAME"], "/", ["get", "CODE_ID"], "/", ["get", "CODE_TYPE"]], 'text-size': 10, 'symbol-placement': 'line', 'text-letter-spacing': 0.2, 'text-max-width': 8, "text-offset": [0, 1] },
7755
- paint: { 'text-color': C.controlledStroke },
7770
+ paint: { 'text-color': T.controlledStroke, ...T.controlledHalo },
7756
7771
  },
7757
7772
  {
7758
7773
  id: 'airline', type: 'line', source: sourceId, 'source-layer': 'segment', minzoom: 6,
7759
7774
  paint: {
7760
- 'line-color': ['case', ['==', ['get', 'HAS_REMARK'], 1], '#E8A020', C.segment],
7775
+ 'line-color': ['case', ['==', ['get', 'HAS_REMARK'], 1], T.segmentRemark, T.segment],
7761
7776
  'line-width': ['interpolate', ['linear'], ['zoom'], 6, 0.2, 8, 0.8],
7762
7777
  "line-blur": 0,
7763
- "line-opacity":
7764
- [
7765
- "interpolate",
7766
- [
7767
- "linear"
7768
- ],
7769
- [
7770
- "zoom"
7771
- ],
7772
- 6,
7773
- 0.3,
7774
- 7,
7775
- 1,
7776
- 8,
7777
- 1,
7778
- 12,
7779
- 0.8,
7780
- 15,
7781
- 0.2
7782
- ]
7778
+ "line-opacity": ["interpolate", ["linear"], ["zoom"], 6, 0.3, 7, 1, 8, 1, 12, 0.8, 15, 0.2],
7783
7779
  }
7784
7780
  },
7785
7781
  {
@@ -7790,56 +7786,27 @@ function buildLayersLight() {
7790
7786
  "text-allow-overlap": false, "icon-allow-overlap": false, "text-optional": false,
7791
7787
  "text-anchor": "center", "text-justify": "center", "text-line-height": 1.3, "text-letter-spacing": 0.1,
7792
7788
  "text-field": ["step", ["zoom"],
7793
- ["format", ["case", ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": "#ffffff" }],
7789
+ ["format", ["case", ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": T.alBase }],
7794
7790
  10,
7795
7791
  ["format",
7796
- ["concat", ["get", "VAL_LEN"], "", ["get", "UOM_DIST"]], { "font-scale": 0.95, "text-color": "#3E4759" }, "\n",
7797
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""], ""], { "font-scale": 1, "text-color": "#E8A020" },
7792
+ ["concat", ["get", "VAL_LEN"], "", ["get", "UOM_DIST"]], { "font-scale": 0.95, "text-color": T.alDist }, "\n",
7793
+ ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""], ""], { "font-scale": 1, "text-color": T.alRnp },
7798
7794
  ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], " ", ""], ""], {},
7799
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": "#ffffff", "font-weight": "bold" },
7795
+ ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": T.alBase, "font-weight": "bold" },
7800
7796
  ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], "", ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], " ", ""]], {},
7801
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], "", ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""]], { "font-scale": 0.85, "text-color": "#E8A020" },
7797
+ ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], "", ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""]], { "font-scale": 0.85, "text-color": T.alRnp },
7802
7798
  "\n",
7803
- ["case", ["all", ["has", "TXT_DESIG_HIGH"], ["!=", ["get", "TXT_DESIG_HIGH"], ""]], ["get", "TXT_DESIG_HIGH"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 0.95, "text-color": "#3E4759" }
7799
+ ["case", ["all", ["has", "TXT_DESIG_HIGH"], ["!=", ["get", "TXT_DESIG_HIGH"], ""]], ["get", "TXT_DESIG_HIGH"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 0.95, "text-color": T.alDist }
7804
7800
  ]
7805
7801
  ],
7806
7802
  "text-size": ["interpolate", ["linear"], ["zoom"], 6, 9, 10, 10],
7807
7803
  "icon-text-fit-padding": [0, 3, 0, 3],
7808
7804
  },
7809
7805
  paint: {
7810
- "text-halo-color": "#ffffff",
7811
- "text-halo-width": 0.1,
7812
- "icon-color": C.segment,
7813
- "text-opacity": [
7814
- "interpolate",
7815
- [
7816
- "linear"
7817
- ],
7818
- [
7819
- "zoom"
7820
- ],
7821
- 6,
7822
- 1,
7823
- 12,
7824
- 1,
7825
- 15,
7826
- 0.3
7827
- ],
7828
- "icon-opacity": [
7829
- "interpolate",
7830
- [
7831
- "linear"
7832
- ],
7833
- [
7834
- "zoom"
7835
- ],
7836
- 6,
7837
- 1,
7838
- 12,
7839
- 1,
7840
- 15,
7841
- 0.3
7842
- ]
7806
+ ...T.alHalo,
7807
+ "icon-color": T.segment,
7808
+ "text-opacity": ["interpolate", ["linear"], ["zoom"], 6, 1, 12, 1, 15, 0.3],
7809
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 6, 1, 12, 1, 15, 0.3],
7843
7810
  },
7844
7811
  },
7845
7812
  {
@@ -7854,7 +7821,7 @@ function buildLayersLight() {
7854
7821
  'text-offset': [0, -0.6],
7855
7822
  'text-justify': 'auto',
7856
7823
  },
7857
- paint: { 'text-color': C.segment },
7824
+ paint: { 'text-color': T.segment, ...T.radialHalo },
7858
7825
  },
7859
7826
  {
7860
7827
  id: 'airport', type: 'symbol', source: sourceId, minzoom: 3, 'source-layer': 'airport',
@@ -7877,102 +7844,34 @@ function buildLayersLight() {
7877
7844
  "text-allow-overlap": true,
7878
7845
  "text-ignore-placement": true,
7879
7846
  "visibility": "none",
7880
- "icon-size": [
7881
- "interpolate",
7882
- [
7883
- "linear"
7884
- ],
7885
- [
7886
- "zoom"
7887
- ],
7888
- 5,
7889
- 0.6,
7890
- 9,
7891
- 1.2,
7892
- 12,
7893
- 1.3
7894
- ]
7847
+ "icon-size": ["interpolate", ["linear"], ["zoom"], 5, 0.6, 9, 1.2, 12, 1.3]
7895
7848
  },
7896
7849
  paint: {
7897
- 'icon-color': ['case',
7898
- ['has', 'has_amm'], '#4B2D6E',
7899
- C.airport,
7900
- ],
7901
- "icon-opacity": [
7902
- "interpolate",
7903
- [
7904
- "linear"
7905
- ],
7906
- [
7907
- "zoom"
7908
- ],
7909
- 2,
7910
- 0.75,
7911
- 3,
7912
- 0.95,
7913
- 5,
7914
- 1,
7915
- 9,
7916
- 1,
7917
- 11,
7918
- 0.2
7919
- ],
7920
- "text-color": ['case',
7921
- ['has', 'has_amm'], '#4B2D6E',
7922
- C.airport,
7923
- ],
7924
- "text-opacity": [
7925
- "interpolate",
7926
- [
7927
- "linear"
7928
- ],
7929
- [
7930
- "zoom"
7931
- ],
7932
- 4,
7933
- 0.95,
7934
- 5,
7935
- 1,
7936
- 9,
7937
- 1,
7938
- 11,
7939
- 0.2
7940
- ],
7850
+ 'icon-color': ['case', ['has', 'has_amm'], '#4B2D6E', T.airport],
7851
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 2, 0.75, 3, 0.95, 5, 1, 9, 1, 11, 0.2],
7852
+ "text-color": ['case', ['has', 'has_amm'], '#4B2D6E', T.airportText],
7853
+ "text-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0.95, 5, 1, 9, 1, 11, 0.2],
7941
7854
  },
7942
7855
  },
7943
7856
  {
7944
- id: 'runway-line',
7945
- type: 'line',
7946
- source: sourceId,
7947
- 'source-layer': 'runway',
7948
- filter: ['!', ['has', 'has_amm']],
7949
- minzoom: 4,
7950
- maxzoom: 11,
7857
+ id: 'runway-line', type: 'line', source: sourceId, 'source-layer': 'runway',
7858
+ filter: ['!', ['has', 'has_amm']], minzoom: 4, maxzoom: 11,
7951
7859
  paint: {
7952
- 'line-color': C.runway,
7860
+ 'line-color': T.runway,
7953
7861
  'line-width': ['interpolate', ['linear'], ['zoom'], 4, 1, 13, 10],
7954
7862
  },
7955
7863
  },
7956
7864
  {
7957
- id: 'runway-line-amm',
7958
- type: 'line',
7959
- source: sourceId,
7960
- 'source-layer': 'runway',
7961
- filter: ['has', 'has_amm'],
7962
- minzoom: 4,
7963
- maxzoom: 11,
7865
+ id: 'runway-line-amm', type: 'line', source: sourceId, 'source-layer': 'runway',
7866
+ filter: ['has', 'has_amm'], minzoom: 4, maxzoom: 11,
7964
7867
  paint: {
7965
- 'line-color': C.runway,
7868
+ 'line-color': T.runway,
7966
7869
  'line-width': ['interpolate', ['linear'], ['zoom'], 4, 1, 10, 4],
7967
7870
  'line-opacity': ['interpolate', ['linear'], ['zoom'], 10.5, 1, 11, 0],
7968
7871
  },
7969
7872
  },
7970
7873
  {
7971
- id: 'runway-label',
7972
- type: 'symbol',
7973
- source: sourceId,
7974
- 'source-layer': 'runway',
7975
- minzoom: 10,
7874
+ id: 'runway-label', type: 'symbol', source: sourceId, 'source-layer': 'runway', minzoom: 10,
7976
7875
  layout: {
7977
7876
  'text-field': ['concat', ['to-string', ['get', 'VAL_LEN']], '×', ['to-string', ['get', 'VAL_WID']], 'm'],
7978
7877
  'text-size': 10,
@@ -7981,28 +7880,16 @@ function buildLayersLight() {
7981
7880
  'text-optional': true,
7982
7881
  },
7983
7882
  paint: {
7984
- 'text-color': C.runway,
7985
- 'text-halo-width': 1,
7883
+ 'text-color': T.runway,
7884
+ ...T.runwayHalo,
7986
7885
  'text-opacity': ['interpolate', ['linear'], ['zoom'], 10.5, 1, 11, 0],
7987
7886
  },
7988
7887
  },
7989
7888
  {
7990
- id: 'vor_icon_dial',
7991
- type: 'symbol',
7992
- source: sourceId,
7993
- 'source-layer': 'vor',
7994
- minzoom: 8,
7889
+ id: 'vor_icon_dial', type: 'symbol', source: sourceId, 'source-layer': 'vor', minzoom: 8,
7995
7890
  layout: {
7996
7891
  "icon-image": "vor:vor_dial",
7997
7892
  "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],
7998
- // "icon-size": [
7999
- // "interpolate",
8000
- // ["exponential", 1.25],
8001
- // ["zoom"],
8002
- // 8, 0.28,
8003
- // 17, 1.7,
8004
- // 22, 1.7
8005
- // ],
8006
7893
  "icon-rotate": ["to-number", ["get", "VAL_MAG_VAR"], 0],
8007
7894
  "icon-rotation-alignment": "map",
8008
7895
  "symbol-z-order": "viewport-y",
@@ -8011,7 +7898,7 @@ function buildLayersLight() {
8011
7898
  "icon-allow-overlap": true,
8012
7899
  "visibility": "none",
8013
7900
  },
8014
- paint: { "icon-color": "#0b417a" }
7901
+ paint: { "icon-color": T.vorDial }
8015
7902
  },
8016
7903
  {
8017
7904
  id: 'vor_icon', minzoom: 4, maxzoom: 9, type: 'symbol', source: sourceId, 'source-layer': 'vor',
@@ -8025,45 +7912,25 @@ function buildLayersLight() {
8025
7912
  "icon-allow-overlap": true,
8026
7913
  },
8027
7914
  paint: {
8028
- "icon-color": "#3874cb",
7915
+ "icon-color": T.vorNormal,
8029
7916
  "icon-opacity": ["interpolate", ["linear"], ["zoom"], 8, 1, 9, 0],
8030
7917
  }
8031
7918
  },
8032
7919
  {
8033
7920
  id: 'vor_label', type: 'symbol', source: sourceId, 'source-layer': 'vor', minzoom: 5,
8034
7921
  layout: { 'text-field': ['get', 'CODE_ID'], 'text-size': 10, 'text-anchor': 'bottom', 'text-offset': [0, -0.8] },
8035
- paint: { 'text-color': C.vor, 'text-halo-color': '#ffffff', 'text-halo-width': 1 },
7922
+ paint: { 'text-color': T.vor, 'text-halo-color': T.halo, 'text-halo-width': 1 },
8036
7923
  },
8037
7924
  {
8038
7925
  id: 'ndb_icon', type: 'symbol', source: sourceId, minzoom: 4, 'source-layer': 'ndb',
8039
7926
  layout: {
8040
- "icon-image": "v2:ndb-normal", "icon-size": ["interpolate", ["linear"], ["zoom"], 6, 0.5, 10, 1],
7927
+ "icon-image": T.ndbIcon, "icon-size": ["interpolate", ["linear"], ["zoom"], 6, 0.5, 10, 1],
8041
7928
  "symbol-z-order": "viewport-y",
8042
- // "text-field": ["concat", ["get", "CODE_ID"], "\n", ["get", "VAL_FREQ"], "kHz"],
8043
7929
  "text-field": [
8044
7930
  "format",
8045
- [
8046
- "get",
8047
- "CODE_ID"
8048
- ],
8049
- {
8050
- "text-color": C.ndb,
8051
- "font-scale": 1.1,
8052
- },
8053
- "",
8054
- {},
8055
- [
8056
- "coalesce",
8057
- [
8058
- "get",
8059
- "VAL_FREQ"
8060
- ],
8061
- ""
8062
- ],
8063
- {
8064
- "text-color": C.ndb,
8065
- "font-scale": 0.95
8066
- }
7931
+ ["get", "CODE_ID"], { "text-color": T.ndb, "font-scale": 1.1 },
7932
+ "", {},
7933
+ ["coalesce", ["get", "VAL_FREQ"], ""], { "text-color": T.ndb, "font-scale": 0.95 }
8067
7934
  ],
8068
7935
  "text-size": 10,
8069
7936
  "text-offset": [0, 0.5],
@@ -8073,53 +7940,11 @@ function buildLayersLight() {
8073
7940
  "text-anchor": "top"
8074
7941
  },
8075
7942
  paint: {
8076
- "text-color": C.ndb,
8077
- "text-halo-color": "#ffffff",
8078
- "text-halo-width": 0.5,
8079
- "text-halo-blur": 1,
8080
- "icon-color": C.ndb,
8081
- "text-opacity": [
8082
- "interpolate",
8083
- [
8084
- "linear"
8085
- ],
8086
- [
8087
- "zoom"
8088
- ],
8089
- 4,
8090
- 0,
8091
- 5.5,
8092
- 0,
8093
- 6,
8094
- 0.6,
8095
- 8,
8096
- 1,
8097
- 10,
8098
- 0.3,
8099
- 12,
8100
- 0
8101
- ],
8102
- "icon-opacity": [
8103
- "interpolate",
8104
- [
8105
- "linear"
8106
- ],
8107
- [
8108
- "zoom"
8109
- ],
8110
- 4,
8111
- 0,
8112
- 5,
8113
- 0.3,
8114
- 5.5,
8115
- 0.8,
8116
- 8,
8117
- 1,
8118
- 12,
8119
- 1,
8120
- 14,
8121
- 0.6
8122
- ]
7943
+ "text-color": T.ndb,
7944
+ ...T.ndbHalo,
7945
+ "icon-color": T.ndb,
7946
+ "text-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0, 5.5, 0, 6, 0.6, 8, 1, 10, 0.3, 12, 0],
7947
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 4, 0, 5, 0.3, 5.5, 0.8, 8, 1, 12, 1, 14, 0.6],
8123
7948
  }
8124
7949
  },
8125
7950
  {
@@ -8135,421 +7960,37 @@ function buildLayersLight() {
8135
7960
  'text-justify': 'auto',
8136
7961
  },
8137
7962
  paint: {
8138
- 'icon-color': C.waypoint,
8139
- 'text-color': C.waypoint,
8140
- 'text-halo-color': '#ffffff',
8141
- 'text-halo-width': 1,
7963
+ 'icon-color': T.waypoint,
7964
+ 'text-color': T.waypoint,
8142
7965
  "icon-halo-color": "rgba(0,0,0,0)",
8143
7966
  "icon-halo-width": 0,
8144
- "icon-opacity": [
8145
- "interpolate",
8146
- [
8147
- "linear"
8148
- ],
8149
- [
8150
- "zoom"
8151
- ],
8152
- 6,
8153
- 0.5,
8154
- 12,
8155
- 1,
8156
- 15,
8157
- 0.2
8158
- ],
8159
- "text-halo-color": "#FFFFFF",
7967
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 6, 0.5, 12, 1, 15, 0.2],
7968
+ "text-halo-color": T.halo,
7969
+ "text-halo-width": 1,
8160
7970
  "text-halo-blur": 0,
8161
- "text-opacity": [
8162
- "interpolate",
8163
- [
8164
- "linear"
8165
- ],
8166
- [
8167
- "zoom"
8168
- ],
8169
- 6,
8170
- 1,
8171
- 12,
8172
- 0.9,
8173
- 15,
8174
- 0.15
8175
- ],
7971
+ "text-opacity": ["interpolate", ["linear"], ["zoom"], 6, 1, 12, 0.9, 15, 0.15],
8176
7972
  },
8177
7973
  },
8178
7974
  {
8179
7975
  id: 'waypoint-off-airway-symbol', type: 'symbol', source: sourceId, 'source-layer': 'waypoint-off-airway', minzoom: 7,
8180
7976
  layout: { 'icon-image': ['case', ['==', ['get', 'report_type'], 'C'], 'designate_point_inway', 'designate_point_notinway'], 'icon-size': 0.6, 'icon-allow-overlap': true, 'icon-ignore-placement': true, 'text-field': ['get', 'CODE_ID'], 'text-size': 9, 'text-variable-anchor-offset': ['bottom', [0, -0.6], 'top', [0, 0.6], 'right', [-0.6, 0], 'left', [0.6, 0], 'bottom-right', [-0.4, -0.4], 'bottom-left', [0.4, -0.4], 'top-right', [-0.4, 0.4], 'top-left', [0.4, 0.4]], 'text-justify': 'auto', 'text-optional': true },
8181
7977
  paint: {
8182
- 'icon-color': C.waypoint, 'text-color': C.waypoint, 'text-halo-color': '#ffffff', 'text-halo-width': 1,
8183
- "icon-opacity": [
8184
- "interpolate",
8185
- [
8186
- "linear"
8187
- ],
8188
- [
8189
- "zoom"
8190
- ],
8191
- 7,
8192
- 0.5,
8193
- 12,
8194
- 1,
8195
- 15,
8196
- 0.2
8197
- ],
8198
- "text-opacity": [
8199
- "interpolate",
8200
- [
8201
- "linear"
8202
- ],
8203
- [
8204
- "zoom"
8205
- ],
8206
- 7,
8207
- 1,
8208
- 12,
8209
- 0.9,
8210
- 15,
8211
- 0.15
8212
- ],
8213
- },
8214
- },
8215
- ]
8216
- }
8217
-
8218
- // ── Dark theme ────────────────────────────────────────────────────────────────
8219
- const ICAO_DARK = {
8220
- airspaceStroke: '#18C29C',
8221
- restrictedStroke: '#CC7722',
8222
- controlledStroke: '#22C55E',
8223
- controlledFill: '#22C55E',
8224
- segment: '#40C4FF',
8225
- waypoint: '#74cdde',
8226
- vor: '#72aae5',
8227
- ndb: '#62d6ef',
8228
- airport: '#73ccdd',
8229
- runway: '#64748b',
8230
- };
8231
-
8232
- function buildLayersDark() {
8233
- const sourceId = 'navdata';
8234
- const C = ICAO_DARK;
8235
- return [
8236
- {
8237
- "id": "landLayer", "type": "fill", "source": "land",
8238
- "layout": { "visibility": "visible" },
8239
- "paint": { "fill-color": "#0A111A", "fill-opacity": 1 }
8240
- },
8241
- {
8242
- "id": "boundary",
8243
- "type": "line",
8244
- "source": "boundary",
8245
- "minzoom": 0,
8246
- "paint": {
8247
- "line-width": [
8248
- "interpolate",
8249
- [
8250
- "linear"
8251
- ],
8252
- [
8253
- "zoom"
8254
- ],
8255
- 0,
8256
- 1,
8257
- 7,
8258
- 4
8259
- ],
8260
- "line-opacity": 1,
8261
- "line-pattern": "normal:national-border-dark"
8262
- }
8263
- },
8264
- {
8265
- id: 'adiz-line', type: 'line', source: sourceId, 'source-layer': 'adiz', minzoom: 3,
8266
- layout: { 'line-cap': 'round', 'line-join': 'round' },
8267
- paint: { 'line-color': '#a855f7', 'line-width': ['interpolate', ['linear'], ['zoom'], 3, 3, 7, 6], "line-pattern": "normal:adiz", 'line-opacity': ['interpolate', ['linear'], ['zoom'], 3, 0.7, 8, 0.5] },
8268
- },
8269
- {
8270
- id: 'adiz-label', type: 'symbol', source: sourceId, 'source-layer': 'adiz-centroid', minzoom: 3,
8271
- layout: { 'text-field': ['coalesce', ['get', 'TXT_NAME'], ['get', 'CODE_ID']], 'text-size': 10, 'text-max-width': 10, 'symbol-placement': 'point' },
8272
- paint: { 'text-color': '#c084fc', 'text-halo-color': '#0f172a', 'text-halo-width': 1.5 },
8273
- },
8274
- {
8275
- id: 'airspaceLayer', type: 'line', source: sourceId, 'source-layer': 'fir', minzoom: 2,
8276
- layout: { "line-cap": "butt", "line-join": "miter", "line-miter-limit": 0 },
8277
- paint: { "line-color": C.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 2, 0, 2.7, 0.8, 9, 0.8, 10, 0.5], "line-width": 0.8, 'line-dasharray': [4.2, 4] }
8278
- },
8279
- {
8280
- "id": "airspaceLayer_line", type: 'line', source: sourceId, 'source-layer': 'fir', "minzoom": 5,
8281
- layout: { "line-miter-limit": 0, "line-cap": "butt", "line-join": "miter" },
8282
- paint: { "line-color": C.airspaceStroke, "line-opacity": ["interpolate", ["linear"], ["zoom"], 5, 0, 5.5, 0.8, 9, 0.8, 10, 0.5], "line-width": 5, "line-dasharray": [0.2, 5] }
8283
- },
8284
- {
8285
- id: 'airspace_label_side_layer', type: 'symbol', source: sourceId, 'source-layer': 'fir', minzoom: 4,
8286
- layout: { 'text-field': ["concat", ["get", "TXT_NAME"], "/", ["get", "CODE_ID"], "/", ["get", "CODE_TYPE"]], 'text-size': 10, 'symbol-placement': 'line', 'text-max-width': 8, "text-offset": [0, 1], "text-letter-spacing": 0.05, "text-optional": true },
8287
- paint: { 'text-color': C.airspaceStroke, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8288
- },
8289
- {
8290
- id: 'airspace_label_center_layer', type: 'symbol', source: sourceId, 'source-layer': 'fir-centroid', minzoom: 3,
8291
- layout: {
8292
- 'text-field': ['coalesce', ['get', 'TXT_NAME'], ['get', 'CODE_ID']],
8293
- 'text-size': ['interpolate', ['linear'], ['zoom'], 3, 12, 17, 16],
8294
- 'symbol-placement': 'point',
8295
- 'text-max-width': 8,
8296
- },
8297
- paint: {
8298
- 'text-color': C.airspaceStroke,
8299
- 'text-halo-color': '#0f172a',
8300
- 'text-halo-width': 1.5,
8301
- 'text-opacity': ['interpolate', ['linear'], ['zoom'], 3, 0.85, 8, 0.7, 12, 0.5],
8302
- },
8303
- },
8304
- {
8305
- id: 'restrictedLayer', type: 'fill', source: sourceId, 'source-layer': 'restricted-fill', minzoom: 4,
8306
- paint: { 'fill-color': ['case', ['==', ['get', 'CODE_TYPE'], 'P'], '#ef4444', ['==', ['get', 'CODE_TYPE'], 'D'], '#f97316', '#ef4444'], 'fill-opacity': 0.04 },
8307
- },
8308
- {
8309
- id: 'restrictedLayer_stroke', type: 'line', source: sourceId, 'source-layer': 'restricted',
8310
- paint: { 'line-color': C.restrictedStroke, 'line-width': 1, "line-dasharray": [2, 2], "line-opacity": ['interpolate', ['linear'], ['zoom'], 4, 0.6, 8, 1] },
8311
- },
8312
- {
8313
- id: 'restricted_line_label', type: 'symbol', source: sourceId, 'source-layer': 'restricted', minzoom: 6,
8314
- layout: { 'text-field': ['coalesce', ['get', 'TXT_NAME'], ['get', 'CODE_ID']], 'text-size': 10, 'symbol-placement': 'line', 'text-max-width': 8, "text-offset": [0, 1] },
8315
- paint: { 'text-color': C.restrictedStroke, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8316
- },
8317
- {
8318
- id: 'controlledLayer', type: 'fill', source: sourceId, 'source-layer': 'controlled-fill', minzoom: 4,
8319
- paint: {
8320
- 'fill-color': C.controlledFill, "fill-opacity": [
8321
- "interpolate",
8322
- [
8323
- "linear"
8324
- ],
8325
- [
8326
- "zoom"
8327
- ],
8328
- 10,
8329
- 0.04,
8330
- 11.5,
8331
- 0
8332
- ]
8333
- },
8334
- },
8335
- {
8336
- id: 'controlledLayer_stroke', type: 'line', source: sourceId, 'source-layer': 'controlled',
8337
- paint: { 'line-color': C.controlledStroke, 'line-width': 1, 'line-opacity': ['interpolate', ['linear'], ['zoom'], 4, 0.6, 8, 1], "line-dasharray": [4, 2] },
8338
- },
8339
- {
8340
- id: 'controlled_line_label', type: 'symbol', source: sourceId, 'source-layer': 'controlled', minzoom: 6,
8341
- layout: { 'text-field': ['coalesce', ['get', 'TXT_NAME'], ['get', 'CODE_ID']], 'text-size': 10, 'symbol-placement': 'point', 'text-max-width': 8 },
8342
- paint: { 'text-color': C.controlledStroke, 'text-halo-color': '#0f172a', 'text-halo-width': 1.5 },
8343
- },
8344
- {
8345
- id: 'airline', type: 'line', source: sourceId, 'source-layer': 'segment', minzoom: 6,
8346
- paint: {
8347
- 'line-color': ['case', ['==', ['get', 'HAS_REMARK'], 1], '#fbbf24', C.segment],
8348
- 'line-width': ['interpolate', ['linear'], ['zoom'], 6, 0.2, 8, 0.8],
8349
- "line-blur": 0,
8350
- "line-opacity":
8351
- [
8352
- "interpolate",
8353
- [
8354
- "linear"
8355
- ],
8356
- [
8357
- "zoom"
8358
- ],
8359
- 6,
8360
- 0.3,
8361
- 7,
8362
- 1,
8363
- 8,
8364
- 1,
8365
- 12,
8366
- 0.8,
8367
- 15,
8368
- 0.2
8369
- ]
8370
- },
8371
- },
8372
- {
8373
- id: 'airline_label', type: 'symbol', source: sourceId, 'source-layer': 'segment', minzoom: 6,
8374
- layout: {
8375
- "icon-image": ["case", ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""], ["!=", ["get", "TXT_DESIG"], " "], ["!=", ["get", "TXT_DESIG"], null]], "segment-both", ["all", ["has", "TXT_DESIG_FORWARD"]], "segment-right", ["all", ["has", "TXT_DESIG_BACKWARD"]], "segment-left", "segment-both"],
8376
- "icon-anchor": "center", "symbol-placement": "line", "icon-text-fit": "width", "icon-size": 1,
8377
- "text-allow-overlap": false, "icon-allow-overlap": false,
8378
- "text-anchor": "center", "text-justify": "center", "text-line-height": 1.3, "text-letter-spacing": 0.1,
8379
- "text-field":
8380
- ["step", ["zoom"],
8381
- ["format", ["case", ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": "#0f172a" }],
8382
- 10,
8383
- ["format",
8384
- ["concat", ["get", "VAL_LEN"], "", ["get", "UOM_DIST"]], { "font-scale": 0.95, "text-color": "#cbd5e1" }, "\n",
8385
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""], ""], { "font-scale": 1, "text-color": "#FFFFFF" },
8386
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], " ", ""], ""], {},
8387
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG"], ["!=", ["get", "TXT_DESIG"], ""]], ["get", "TXT_DESIG"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 1, "text-color": "#0f172a", "font-weight": "bold" },
8388
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], "", ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], " ", ""]], {},
8389
- ["case", ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], "", ["case", ["all", ["has", "TXT_DESIG_RNP"], ["!=", ["get", "TXT_DESIG_RNP"], ""]], ["get", "TXT_DESIG_RNP"], ""]], { "font-scale": 0.85, "text-color": "#FFFFFF" },
8390
- "\n",
8391
- ["case", ["all", ["has", "TXT_DESIG_HIGH"], ["!=", ["get", "TXT_DESIG_HIGH"], ""]], ["get", "TXT_DESIG_HIGH"], ["all", ["has", "TXT_DESIG_FORWARD"], ["!=", ["get", "TXT_DESIG_FORWARD"], ""]], ["get", "TXT_DESIG_FORWARD"], ["all", ["has", "TXT_DESIG_BACKWARD"], ["!=", ["get", "TXT_DESIG_BACKWARD"], ""]], ["get", "TXT_DESIG_BACKWARD"], "-"], { "font-scale": 0.95, "text-color": "#cbd5e1" }
8392
- ]
8393
- ],
8394
- "text-size": ["interpolate", ["linear"], ["zoom"], 6, 9, 10, 10],
8395
- "icon-text-fit-padding": [0, 3, 0, 3],
8396
- },
8397
- paint: { "icon-color": C.segment },
8398
- },
8399
- {
8400
- id: 'airline_radial', type: 'symbol', source: sourceId, 'source-layer': 'segment-radial', minzoom: 13,
8401
- layout: { 'text-field': ['concat', ['get', 'bearing'], '°'], 'text-size': 9, 'text-rotate': ['to-number', ['get', 'line_angle'], 0], 'text-rotation-alignment': 'map', 'text-allow-overlap': true, 'text-ignore-placement': true, 'text-offset': [0, -1] },
8402
- paint: { 'text-color': C.segment, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8403
- },
8404
- {
8405
- id: 'airport', type: 'symbol', source: sourceId, minzoom: 3, 'source-layer': 'airport',
8406
- filter: ['case', ['<', ['zoom'], 6], ['==', ['get', 'level'], 1], true],
8407
- layout: {
8408
- "icon-image": ["case", ["==", ["get", "CODE_TYPE_MIL_OPS"], "MIL"], "airport-mil", ["==", ["get", "CODE_TYPE_MIL_OPS"], "MILEXT"], "airport-milext", "airport-civ"], "icon-size": ["interpolate", ["linear"], ["zoom"], 4, 0.5, 10, 0.9], "symbol-z-order": "viewport-y", "text-field": ["get", "codeId"],
8409
- "text-letter-spacing": 0.05,
8410
- "text-anchor": "bottom",
8411
- 'text-field': ['get', 'CODE_ID'],
8412
- "text-justify": "center",
8413
- "text-size": ["interpolate", ["linear"], ["zoom"], 4, 0, 5, 12],
8414
- "text-offset": ["interpolate", ["linear"], ["zoom"], 4, ["literal", [0, -1.2]], 5, ["literal", [0, -0.6]]],
8415
- "icon-allow-overlap": true,
8416
- "icon-ignore-placement": true,
8417
- "text-allow-overlap": true,
8418
- "text-ignore-placement": true,
8419
- "visibility": "none",
8420
- "icon-size": [
8421
- "interpolate",
8422
- [
8423
- "linear"
8424
- ],
8425
- [
8426
- "zoom"
8427
- ],
8428
- 5,
8429
- 0.6,
8430
- 9,
8431
- 1.2,
8432
- 12,
8433
- 1.3
8434
- ]
8435
- },
8436
- paint: {
8437
- 'icon-color': ['case',
8438
- ['has', 'has_amm'], '#4B2D6E',
8439
- C.airport,
8440
- ],
8441
- "icon-opacity": [
8442
- "interpolate",
8443
- [
8444
- "linear"
8445
- ],
8446
- [
8447
- "zoom"
8448
- ],
8449
- 2,
8450
- 0.75,
8451
- 3,
8452
- 0.95,
8453
- 5,
8454
- 1,
8455
- 9,
8456
- 1,
8457
- 11,
8458
- 0.2
8459
- ],
8460
- "text-color": ['case',
8461
- ['has', 'has_amm'], '#4B2D6E',
8462
- "#E0F7FA",
8463
- ],
8464
- "text-opacity": [
8465
- "interpolate",
8466
- [
8467
- "linear"
8468
- ],
8469
- [
8470
- "zoom"
8471
- ],
8472
- 4,
8473
- 0.95,
8474
- 5,
8475
- 1,
8476
- 9,
8477
- 1,
8478
- 11,
8479
- 0.2
8480
- ],
8481
- },
8482
- },
8483
- {
8484
- id: 'runway-line', type: 'line', source: sourceId, 'source-layer': 'runway', filter: ['!', ['has', 'has_amm']], minzoom: 4,
8485
- paint: { 'line-color': C.runway, 'line-width': ['interpolate', ['linear'], ['zoom'], 4, 1, 10, 3] },
8486
- },
8487
- {
8488
- id: 'runway-line-amm', type: 'line', source: sourceId, 'source-layer': 'runway', filter: ['has', 'has_amm'], minzoom: 4,
8489
- paint: { 'line-color': C.runway, 'line-width': ['interpolate', ['linear'], ['zoom'], 4, 1, 10, 3], 'line-opacity': ['interpolate', ['linear'], ['zoom'], 10.5, 1, 11, 0] },
8490
- },
8491
- {
8492
- id: 'runway-label', type: 'symbol', source: sourceId, 'source-layer': 'runway', minzoom: 10,
8493
- layout: { 'text-field': ['concat', ['to-string', ['get', 'VAL_LEN']], '×', ['to-string', ['get', 'VAL_WID']], 'm'], 'text-size': 10, 'text-font': ['Noto Sans Regular'], 'symbol-placement': 'line-center', 'text-rotation-alignment': 'map', 'text-optional': true },
8494
- paint: { 'text-color': C.runway, 'text-halo-color': '#0f172a', 'text-halo-width': 1, 'text-opacity': ['interpolate', ['linear'], ['zoom'], 10.5, 1, 11, 0] },
8495
- },
8496
- {
8497
- id: 'vor_icon_dial', type: 'symbol', source: sourceId, 'source-layer': 'vor',
8498
- layout: { "icon-image": "vor:vor_dial", "icon-size": ["interpolate", ["linear"], ["zoom"], 5, 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], "icon-rotate": ["to-number", ["get", "VAL_MAG_VAR"], 0], "icon-rotation-alignment": "map", "symbol-z-order": "viewport-y", "text-letter-spacing": 0.05, "text-optional": true, "icon-allow-overlap": true, "visibility": "none" },
8499
- paint: { "icon-color": "#38bdf8" }
8500
- },
8501
- {
8502
- id: 'vor_icon', minzoom: 4, maxzoom: 9, type: 'symbol', source: sourceId, 'source-layer': 'vor',
8503
- layout: {
8504
- "icon-image": "v2:vor-normal",
8505
- "icon-size": ["interpolate", ["linear"], ["zoom"], 4, 0.7, 8, 1],
8506
- "icon-rotation-alignment": "map",
8507
- "symbol-z-order": "viewport-y",
8508
- "text-letter-spacing": 0.05,
8509
- "text-optional": true,
8510
- "icon-allow-overlap": true,
7978
+ 'icon-color': T.waypoint, 'text-color': T.waypoint, 'text-halo-color': T.halo, 'text-halo-width': 1,
7979
+ "icon-opacity": ["interpolate", ["linear"], ["zoom"], 7, 0.5, 12, 1, 15, 0.2],
7980
+ "text-opacity": ["interpolate", ["linear"], ["zoom"], 7, 1, 12, 0.9, 15, 0.15],
8511
7981
  },
8512
- paint: {
8513
- "icon-color": "#38bdf8",
8514
- "icon-opacity": ["interpolate", ["linear"], ["zoom"], 8, 1, 9, 0],
8515
- }
8516
- },
8517
- {
8518
- id: 'vor_label', type: 'symbol', source: sourceId, 'source-layer': 'vor', minzoom: 5,
8519
- layout: { 'text-field': ['get', 'CODE_ID'], 'text-size': 10, 'text-anchor': 'bottom', 'text-offset': [0, -0.8] },
8520
- paint: { 'text-color': C.vor, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8521
- },
8522
- {
8523
- id: 'ndb_icon', type: 'symbol', source: sourceId, minzoom: 4, 'source-layer': 'ndb',
8524
- layout: { "icon-image": "ndb-inway", "icon-size": ["interpolate", ["linear"], ["zoom"], 6, 0.5, 10, 1], "symbol-z-order": "viewport-y", "text-field": ["concat", ["get", "CODE_ID"], "\n", ["get", "VAL_FREQ"], "kHz"], "text-size": 10, "text-offset": [0, 1.4], "text-letter-spacing": 0.05, "text-optional": true, "icon-allow-overlap": true },
8525
- paint: { "text-color": C.ndb, "text-halo-color": "#0f172a", "text-halo-width": 1, "icon-color": C.ndb }
8526
- },
8527
- {
8528
- id: 'airline_point', type: 'symbol', source: sourceId, 'source-layer': 'waypoint', minzoom: 6,
8529
- layout: { 'icon-image': ['case', ['==', ['get', 'report_type'], 'C'], 'waypoint-compusory', 'waypoint'], 'icon-size': 0.6, 'icon-allow-overlap': true, 'icon-ignore-placement': true, 'text-field': ['get', 'CODE_ID'], 'text-size': 9, 'text-variable-anchor-offset': ['bottom', [0, -0.6], 'top', [0, 0.6], 'right', [-0.6, 0], 'left', [0.6, 0], 'bottom-right', [-0.4, -0.4], 'bottom-left', [0.4, -0.4], 'top-right', [-0.4, 0.4], 'top-left', [0.4, 0.4]], 'text-justify': 'auto', 'text-optional': true },
8530
- paint: { 'icon-color': C.waypoint, 'text-color': C.waypoint, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8531
- },
8532
- {
8533
- id: 'waypoint-off-airway-symbol', type: 'symbol', source: sourceId, 'source-layer': 'waypoint-off-airway', minzoom: 7,
8534
- layout: { 'icon-image': ['case', ['==', ['get', 'report_type'], 'C'], 'designate_point_inway', 'designate_point_notinway'], 'icon-size': 0.6, 'icon-allow-overlap': true, 'icon-ignore-placement': true, 'text-field': ['get', 'CODE_ID'], 'text-size': 9, 'text-variable-anchor-offset': ['bottom', [0, -0.6], 'top', [0, 0.6], 'right', [-0.6, 0], 'left', [0.6, 0], 'bottom-right', [-0.4, -0.4], 'bottom-left', [0.4, -0.4], 'top-right', [-0.4, 0.4], 'top-left', [0.4, 0.4]], 'text-justify': 'auto', 'text-optional': true },
8535
- paint: { 'icon-color': C.waypoint, 'text-color': C.waypoint, 'text-halo-color': '#0f172a', 'text-halo-width': 1 },
8536
7982
  },
8537
7983
  ]
8538
7984
  }
8539
7985
 
8540
-
8541
- // ── Theme registry
8542
- // Add new entries here to register additional chart styles.
7986
+ // ── Theme registry ──────────────────────────────────────────────────────────
7987
+ // 加主题 = 在 THEME_TOKENS 增加一张 token 表 + 在此登记。
8543
7988
  const CHART_THEMES = {
8544
- light: { id: 'light', label: '日间', background: '#EAF2F8', build: buildLayersLight },
8545
- dark: { id: 'dark', label: '夜间', background: '#000000', build: buildLayersDark },
7989
+ light: { id: 'light', label: '日间', background: '#EAF2F8' },
7990
+ dark: { id: 'dark', label: '夜间', background: '#000000' },
8546
7991
  };
8547
7992
 
8548
- function buildLayers(themeId = 'light') {
8549
- return (CHART_THEMES[themeId] ?? CHART_THEMES.light).build()
8550
- }
8551
-
8552
- // ── Layer groups & labels (theme-independent)
7993
+ // ── Layer groups & labels (theme-independent) ────────────────────────────────
8553
7994
  const LAYER_GROUPS = {
8554
7995
  adiz: ['adiz-line', 'adiz-label'],
8555
7996
  airspace: ['airspaceLayer', 'airspaceLayer_line', 'airspace_label_center_layer', 'airspace_label_side_layer'],
@@ -8656,6 +8097,7 @@ class MapSDK {
8656
8097
  initializeMap(options) {
8657
8098
  this._baseUrl = options.staticUrl || "https://aips.siniswift.com";
8658
8099
  this._chartApiUrl = (options.apiUrl || DEFAULT_CHART_API_URL).replace(/\/$/, "");
8100
+ this._apiVersion = options.apiVersion || undefined;
8659
8101
  const themeId = options.theme === "dark" ? "dark" : "light";
8660
8102
  const themeConfig = CHART_THEMES[themeId] ?? CHART_THEMES.light;
8661
8103
  const style = options.style ??
@@ -8810,7 +8252,7 @@ class MapSDK {
8810
8252
  return;
8811
8253
  }
8812
8254
  if (!this.map.getSource("navdata")) {
8813
- this.map.addSource("navdata", getNavdataSource(this._chartApiUrl, period));
8255
+ this.map.addSource("navdata", getNavdataSource(this._chartApiUrl, period, this._apiVersion));
8814
8256
  }
8815
8257
  const themeId = this.initialOptions.theme === "dark" ? "dark" : "light";
8816
8258
  for (const layer of buildLayers(themeId)) {
@@ -8821,7 +8263,7 @@ class MapSDK {
8821
8263
  this.map.addLayer(layer);
8822
8264
  }
8823
8265
  if (!this.map.getSource("amm")) {
8824
- this.map.addSource("amm", getChartAmmSource(this._chartApiUrl));
8266
+ this.map.addSource("amm", getChartAmmSource(this._chartApiUrl, this._apiVersion));
8825
8267
  }
8826
8268
  const ammBefore = this.map.getLayer("airspaceLayer") ? "airspaceLayer" : undefined;
8827
8269
  for (const layer of buildAMMLayers("amm", themeId)) {
@@ -9150,7 +8592,7 @@ class MapSDK {
9150
8592
  this.globalConfig.setPeriod(period);
9151
8593
  const navdata = this.map?.getSource("navdata");
9152
8594
  if (navdata?.setTiles) {
9153
- navdata.setTiles([navdataTilesUrl(this._chartApiUrl, period)]);
8595
+ navdata.setTiles([navdataTilesUrl(this._chartApiUrl, period, this._apiVersion)]);
9154
8596
  }
9155
8597
  if (from !== undefined && from !== period) {
9156
8598
  this.map?.fire("periodchange", { from, to: period });
@@ -9168,7 +8610,7 @@ class MapSDK {
9168
8610
  return searchFeatures(this._chartApiUrl, apiKey, {
9169
8611
  ...params,
9170
8612
  ...(period ? { period } : {}),
9171
- });
8613
+ }, this._apiVersion);
9172
8614
  }
9173
8615
  getGeometry(params) {
9174
8616
  const apiKey = this.globalConfig.getConfig().apiKey;
@@ -9176,11 +8618,11 @@ class MapSDK {
9176
8618
  return getFeatureGeometry(this._chartApiUrl, apiKey, {
9177
8619
  ...params,
9178
8620
  ...(period ? { period } : {}),
9179
- });
8621
+ }, this._apiVersion);
9180
8622
  }
9181
8623
  getPeriods(signal) {
9182
8624
  const apiKey = this.globalConfig.getConfig().apiKey;
9183
- return getPeriods(this._chartApiUrl, apiKey, signal);
8625
+ return getPeriods(this._chartApiUrl, apiKey, signal, this._apiVersion);
9184
8626
  }
9185
8627
  showGraticule() {
9186
8628
  this.graticule?.show();
@@ -9264,6 +8706,8 @@ class MapSDK {
9264
8706
  if (options.baseUrl)
9265
8707
  config.baseUrl = options.baseUrl;
9266
8708
  config.apiUrl = this._chartApiUrl;
8709
+ if (this._apiVersion)
8710
+ config.apiVersion = this._apiVersion;
9267
8711
  if (options.period)
9268
8712
  config.period = options.period;
9269
8713
  globalConfig.setConfig(config);