aviation-chart 0.2.0 → 0.2.1
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/README.md +100 -216
- package/dist/nav-sdk@0.2.1.cjs +27061 -0
- package/dist/nav-sdk@0.2.1.d.ts +3228 -0
- package/dist/nav-sdk@0.2.1.esm.js +27037 -0
- package/dist/nav-sdk@0.2.1.min.js +1 -0
- package/dist/nav-sdk@0.2.1.umd.js +27067 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,286 +1,170 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Kunyu Aviation Chart SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A high-performance aviation chart SDK providing complete aeronautical data visualization: FIR/UIR, controlled and restricted airspace, airways, navaids (VOR/NDB), airports and runways, AMM, and terrain — plus business features such as NOTAM, ADS-B, and weather radar. Built with a modular architecture supporting plugins, performance optimization, and unified error handling.
|
|
4
4
|
|
|
5
|
-
## ✨
|
|
5
|
+
## ✨ Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- **Aviation data stack**: FIR, controlled/restricted airspace, airways, VOR/NDB, airport runways, AMM, terrain/contours — published per AIRAC period
|
|
8
|
+
- **Theme switching**: in-place light/dark recoloring that never covers your overlay layers
|
|
9
|
+
- **Business modules**: NOTAM, ADS-B, weather radar, raster layers
|
|
10
|
+
- **Performance**: LOD (level-of-detail), lazy layer loading, massive-point clustering, low-zoom style simplification
|
|
11
|
+
- **Plugin system**: unified plugin interface with a built-in measurement plugin
|
|
12
|
+
- **Unified error handling**: centralized error management, fallback strategies, error statistics
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
- **LOD机制**: 基于缩放级别的图层细节层次管理
|
|
14
|
-
- **懒加载**: 图层按需加载,提升初始化和运行性能
|
|
15
|
-
- **聚类支持**: 大数据量点的智能聚合显示
|
|
16
|
-
- **样式优化**: 根据缩放级别自动简化图层样式
|
|
14
|
+
## 🚀 Getting Started
|
|
17
15
|
|
|
18
|
-
###
|
|
19
|
-
- **统一错误管理**: 集中的错误处理和日志记录
|
|
20
|
-
- **错误边界**: 防止单个错误影响整个系统
|
|
21
|
-
- **降级策略**: 智能的错误恢复和降级处理
|
|
22
|
-
- **错误统计**: 详细的错误分析和统计信息
|
|
23
|
-
|
|
24
|
-
### 🔌 插件系统
|
|
25
|
-
- **标准接口**: 统一的插件开发接口
|
|
26
|
-
- **生命周期管理**: 插件的安装、卸载和状态管理
|
|
27
|
-
- **示例插件**: 内置测量工具插件,展示插件开发模式
|
|
28
|
-
|
|
29
|
-
## 🚀 快速开始
|
|
30
|
-
|
|
31
|
-
### UMD 使用
|
|
16
|
+
### Option 1: CDN script (global `navMap`)
|
|
32
17
|
|
|
33
18
|
```html
|
|
34
|
-
|
|
35
|
-
<script src="https://
|
|
36
|
-
|
|
19
|
+
<!-- latest -->
|
|
20
|
+
<script src="https://aips.siniswift.com/sdk/nav-sdk.min.js"></script>
|
|
21
|
+
<!-- or pin a version -->
|
|
22
|
+
<!-- <script src="https://aips.siniswift.com/sdk/nav-sdk@0.2.0.min.js"></script> -->
|
|
37
23
|
|
|
38
24
|
<div id="map" style="width:100%;height:600px;"></div>
|
|
39
25
|
|
|
40
26
|
<script>
|
|
41
|
-
const sdk = new
|
|
27
|
+
const sdk = new navMap.MapSDK({
|
|
42
28
|
container: 'map',
|
|
43
|
-
style: 'https://demotiles.maplibre.org/style.json',
|
|
44
29
|
center: [116.3974, 39.9093],
|
|
45
|
-
zoom:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
lodEnabled: true,
|
|
49
|
-
clusteringEnabled: true,
|
|
50
|
-
lazyLoadingEnabled: true
|
|
51
|
-
}
|
|
30
|
+
zoom: 4,
|
|
31
|
+
theme: 'light', // 'light' | 'dark'
|
|
32
|
+
period: '202606', // AIRAC period; auto-computed if omitted
|
|
52
33
|
});
|
|
53
34
|
</script>
|
|
54
35
|
```
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
> The underlying map engine is bundled into `nav-sdk.min.js` — no extra script needed.
|
|
38
|
+
|
|
39
|
+
### Option 2: npm
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install aviation-chart
|
|
43
|
+
```
|
|
57
44
|
|
|
58
45
|
```javascript
|
|
59
|
-
import { MapSDK, MeasurePlugin } from '
|
|
46
|
+
import { MapSDK, MeasurePlugin } from 'aviation-chart';
|
|
60
47
|
|
|
61
|
-
const sdk = new MapSDK({
|
|
48
|
+
const sdk = new MapSDK({
|
|
62
49
|
container: 'map',
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
center: [116.3974, 39.9093],
|
|
51
|
+
zoom: 4,
|
|
52
|
+
performance: { lodEnabled: true, clusteringEnabled: true, lazyLoadingEnabled: true },
|
|
65
53
|
});
|
|
66
|
-
|
|
67
|
-
// 使用插件
|
|
68
|
-
const measurePlugin = new MeasurePlugin();
|
|
69
|
-
sdk.use(measurePlugin);
|
|
70
54
|
```
|
|
71
55
|
|
|
72
|
-
## 📚 API
|
|
56
|
+
## 📚 API Overview
|
|
57
|
+
|
|
58
|
+
### Initialization options
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
| Option | Description |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `container` | Container id or element (required) |
|
|
63
|
+
| `center` / `zoom` | Initial center and zoom |
|
|
64
|
+
| `theme` | `'light'` / `'dark'` |
|
|
65
|
+
| `period` | AIRAC period `YYYYMM` |
|
|
66
|
+
| `apiUrl` | Chart data service URL, default `https://aips.siniswift.com` |
|
|
67
|
+
| `layers` | Initial layer visibility, e.g. `{ airspace: true, controlled: false, terrain: false }` |
|
|
68
|
+
| `performance` | `{ lodEnabled, clusteringEnabled, lazyLoadingEnabled }` |
|
|
69
|
+
| `errorHandler` | Custom error handler function |
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
- **错误处理**: `errorHandler` 配置,自动错误捕获和处理
|
|
78
|
-
- **性能优化**: `performance` 配置,支持LOD、聚类、懒加载
|
|
71
|
+
### Layer control
|
|
79
72
|
|
|
80
|
-
|
|
73
|
+
Layer groups: `airspace` (FIR), `airline` (airways), `controlled`, `restricted`, `vor`, `ndb`, `airport`, `runway`, `adiz`, `waypointOffAirway`, `amm`, `terrain`, `contour`, `background`, `landLayer`, `boundary`.
|
|
81
74
|
|
|
82
75
|
```javascript
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
sdk.
|
|
86
|
-
sdk.toggleBuiltInLayer('
|
|
76
|
+
// Two equivalent APIs
|
|
77
|
+
sdk.setLayerVisible('airspace', true);
|
|
78
|
+
sdk.addBuiltInLayer('controlled');
|
|
79
|
+
sdk.toggleBuiltInLayer('airline');
|
|
80
|
+
sdk.removeBuiltInLayer('restricted');
|
|
87
81
|
|
|
88
|
-
//
|
|
82
|
+
// Theme and period
|
|
83
|
+
sdk.setTheme('dark');
|
|
84
|
+
sdk.setPeriod('202609');
|
|
85
|
+
|
|
86
|
+
// LOD
|
|
89
87
|
sdk.layerManager.setLODEnabled(true);
|
|
90
|
-
sdk.layerManager.setLayerLODConfig('layerId', {
|
|
91
|
-
minZoom: 10,
|
|
92
|
-
maxZoom: 18,
|
|
93
|
-
minPixelSize: 10,
|
|
94
|
-
maxPixelSize: 100,
|
|
95
|
-
cullingEnabled: true
|
|
96
|
-
});
|
|
97
88
|
```
|
|
98
89
|
|
|
99
|
-
### GeoJSON
|
|
90
|
+
### Feature drawing (GeoJSON)
|
|
100
91
|
|
|
101
92
|
```javascript
|
|
102
|
-
// 添加要素
|
|
103
93
|
sdk.addPoint([lng, lat], properties, style);
|
|
104
94
|
sdk.addLine(coordinates, properties, style);
|
|
105
95
|
sdk.addPolygon(coordinates, properties, style);
|
|
106
96
|
|
|
107
|
-
//
|
|
97
|
+
// Cluster massive point sets
|
|
108
98
|
sdk.geoJSONManager.setClusteringEnabled(true);
|
|
109
|
-
sdk.geoJSONManager.setClusteringConfig('layerId', {
|
|
110
|
-
enabled: true,
|
|
111
|
-
radius: 50,
|
|
112
|
-
maxZoom: 16,
|
|
113
|
-
minPoinjavascript: 3
|
|
114
|
-
});
|
|
115
99
|
```
|
|
116
100
|
|
|
117
|
-
###
|
|
101
|
+
### Business features
|
|
118
102
|
|
|
119
103
|
```javascript
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
sdk.
|
|
123
|
-
|
|
124
|
-
// 启用测量功能
|
|
125
|
-
measurePlugin.enable('distance'); // 距离测量
|
|
126
|
-
measurePlugin.enable('area'); // 面积测量
|
|
127
|
-
measurePlugin.disable(); // 禁用测量
|
|
128
|
-
|
|
129
|
-
// 获取插件
|
|
130
|
-
const plugin = sdk.getPlugin<MeasurePlugin>('measure');
|
|
104
|
+
sdk.notam.open(true); // NOTAM
|
|
105
|
+
sdk.adsb.open(); // ADS-B
|
|
106
|
+
sdk.api.getRadarData(); // weather radar data
|
|
131
107
|
```
|
|
132
108
|
|
|
133
|
-
###
|
|
109
|
+
### Popup
|
|
134
110
|
|
|
135
111
|
```javascript
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
console.error('Recoverable:', error.recoverable);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const sdk = new MapSDK({
|
|
144
|
-
container: 'map',
|
|
145
|
-
errorHandler
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// 获取错误统计
|
|
149
|
-
const errorStajavascript = sdk.getErrorStajavascript();
|
|
150
|
-
console.log('Total Errors:', errorStajavascript.total);
|
|
112
|
+
const popup = new navMap.Popup()
|
|
113
|
+
.setLngLat([lng, lat])
|
|
114
|
+
.setHTML('<h3>Title</h3>')
|
|
115
|
+
.addTo(sdk.map);
|
|
151
116
|
```
|
|
152
117
|
|
|
153
|
-
###
|
|
118
|
+
### Plugins
|
|
154
119
|
|
|
155
120
|
```javascript
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
console.log('Clustering Enabled:', perfStajavascript.clusteringEnabled);
|
|
161
|
-
console.log('Lazy Loading Enabled:', perfStajavascript.lazyLoadingEnabled);
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## 🔧 开发插件
|
|
165
|
-
|
|
166
|
-
### 插件接口
|
|
121
|
+
const measure = new navMap.MeasurePlugin();
|
|
122
|
+
sdk.use(measure);
|
|
123
|
+
measure.enable('distance'); // 'distance' | 'area'
|
|
124
|
+
measure.disable();
|
|
167
125
|
|
|
168
|
-
|
|
169
|
-
import type { IPlugin, IMapSDK } from 'maplibre-sdk';
|
|
170
|
-
|
|
171
|
-
export class MyPlugin implemenjavascript IPlugin {
|
|
172
|
-
public name = 'my-plugin';
|
|
173
|
-
public version = '1.0.0';
|
|
174
|
-
|
|
175
|
-
install(sdk: IMapSDK): void {
|
|
176
|
-
// 插件安装逻辑
|
|
177
|
-
console.log('Plugin installed');
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
uninstall(sdk: IMapSDK): void {
|
|
181
|
-
// 插件卸载逻辑
|
|
182
|
-
console.log('Plugin uninstalled');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
126
|
+
const plugin = sdk.getPlugin('measure');
|
|
185
127
|
```
|
|
186
128
|
|
|
187
|
-
###
|
|
129
|
+
### Underlying engine passthrough
|
|
188
130
|
|
|
189
|
-
|
|
190
|
-
import { MyPlugin } from './MyPlugin';
|
|
131
|
+
The SDK passes through the full underlying map-engine API — call methods directly on the instance, or access the raw instance via `sdk.map`:
|
|
191
132
|
|
|
192
|
-
|
|
193
|
-
sdk.
|
|
133
|
+
```javascript
|
|
134
|
+
sdk.flyTo({ center: [lng, lat], zoom: 8 });
|
|
135
|
+
sdk.setPaintProperty('airline', 'line-color', '#0057c8');
|
|
136
|
+
sdk.queryRenderedFeatures([x, y]);
|
|
194
137
|
|
|
195
|
-
//
|
|
196
|
-
const hasPlugin = sdk.pluginManager.hasPlugin('my-plugin');
|
|
197
|
-
const pluginStajavascript = sdk.pluginManager.getPluginStajavascript();
|
|
138
|
+
const map = sdk.map; // raw map instance
|
|
198
139
|
```
|
|
199
140
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# 安装依赖
|
|
204
|
-
pnpm install
|
|
205
|
-
|
|
206
|
-
# 开发模式构建
|
|
207
|
-
pnpm build:dev
|
|
208
|
-
|
|
209
|
-
# 生产模式构建
|
|
210
|
-
pnpm build:prod
|
|
141
|
+
### Error & performance
|
|
211
142
|
|
|
212
|
-
|
|
213
|
-
|
|
143
|
+
```javascript
|
|
144
|
+
const sdk = new navMap.MapSDK({
|
|
145
|
+
container: 'map',
|
|
146
|
+
errorHandler: (error) => console.error(error.code, error.details),
|
|
147
|
+
});
|
|
214
148
|
|
|
215
|
-
|
|
216
|
-
|
|
149
|
+
sdk.getErrorStats(); // error statistics
|
|
150
|
+
sdk.getPerformanceStats(); // performance statistics
|
|
217
151
|
```
|
|
218
152
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
### LOD (Level of Detail)
|
|
222
|
-
- 根据缩放级别自动调整图层细节
|
|
223
|
-
- 低缩放级别使用简化样式
|
|
224
|
-
- 高缩放级别显示完整细节
|
|
225
|
-
|
|
226
|
-
### 懒加载
|
|
227
|
-
- 图层按需加载,提升初始化速度
|
|
228
|
-
- 支持图层加载优先级设置
|
|
229
|
-
- 智能的加载队列管理
|
|
230
|
-
|
|
231
|
-
### 聚类
|
|
232
|
-
- 大数据量点的智能聚合
|
|
233
|
-
- 可配置的聚类参数
|
|
234
|
-
- 平滑的聚合动画效果
|
|
153
|
+
## 🔧 Writing a Plugin
|
|
235
154
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
- 错误历史记录
|
|
244
|
-
- 错误类型分析
|
|
245
|
-
- 错误趋势监控
|
|
246
|
-
|
|
247
|
-
### 降级策略
|
|
248
|
-
- 功能降级处理
|
|
249
|
-
- 备用方案切换
|
|
250
|
-
- 用户友好的错误提示
|
|
251
|
-
|
|
252
|
-
## 📁 项目结构
|
|
155
|
+
```javascript
|
|
156
|
+
export class MyPlugin {
|
|
157
|
+
name = 'my-plugin';
|
|
158
|
+
version = '1.0.0';
|
|
159
|
+
install(sdk) { /* install logic */ }
|
|
160
|
+
uninstall(sdk) { /* uninstall logic */ }
|
|
161
|
+
}
|
|
253
162
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
│ ├── LayerManager.javascript # 图层管理
|
|
258
|
-
│ ├── GeoJSONManager.javascript # GeoJSON管理
|
|
259
|
-
│ ├── ErrorManager.javascript # 错误管理
|
|
260
|
-
│ ├── PerformanceManager.javascript # 性能管理
|
|
261
|
-
│ └── PluginManager.javascript # 插件管理
|
|
262
|
-
├── plugins/ # 插件模块
|
|
263
|
-
│ └── MeasurePlugin.javascript # 测量插件示例
|
|
264
|
-
├── types/ # 类型定义
|
|
265
|
-
├── constanjavascript/ # 常量定义
|
|
266
|
-
├── MapSDK.javascript # 主SDK类
|
|
267
|
-
└── index.javascript # 导出文件
|
|
163
|
+
const plugin = new MyPlugin();
|
|
164
|
+
sdk.use(plugin);
|
|
165
|
+
sdk.pluginManager.hasPlugin('my-plugin');
|
|
268
166
|
```
|
|
269
167
|
|
|
270
|
-
##
|
|
271
|
-
|
|
272
|
-
- [ ] 更多内置插件(编辑工具、分析工具等)
|
|
273
|
-
- [ ] 高级性能优化(WebGL优化、内存管理)
|
|
274
|
-
- [ ] 更多数据源支持(WMS、WFS、3D Tiles等)
|
|
275
|
-
- [ ] 移动端优化
|
|
276
|
-
- [ ] 国际化支持
|
|
277
|
-
|
|
278
|
-
## 📄 许可证
|
|
168
|
+
## 📄 License
|
|
279
169
|
|
|
280
170
|
MIT License
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
## 开发规范
|
|
284
|
-
- [代码规范](docs/code-specification.md)
|
|
285
|
-
- [JSDoc注释规范](docs/jsdoc-specification.md)
|
|
286
|
-
- [发版说明](docs/release-notes-specification.md)
|