{"_id":"@bitalltech-maplibre/core","_rev":"11-1b659f5365745a447f9ac071cd8c66aa","name":"@bitalltech-maplibre/core","dist-tags":{"latest":"1.0.9"},"versions":{"1.0.0":{"name":"@bitalltech-maplibre/core","version":"1.0.0","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.0","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"28c3a808dbcec22799bf0670106160375303f1c4","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.0.tgz","fileCount":15,"integrity":"sha512-3hei28Xri5IJnOD6S/MP1oKMlvuaq9i1MT4K+WwO0dfWXp+ExZ2ouVehW6dw029FNFYoP31SPQlyL5sEUjiiGQ==","signatures":[{"sig":"MEYCIQCf6tqATM2zUH5zJ7Cn67icKkARq9SbsIF9EBeaPmh5mwIhAOtPqgCyfpTU3AohFRHeztR9EjbaOggw9M9K8rlIVTS2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77060},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"d8091f95b99d6cd6c94c139294005a261e682dc9","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.5.0","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"20.12.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.0_1783506963351_0.49720515115901054","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bitalltech-maplibre/core","version":"1.0.2","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.2","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"400c0b40fb307e51319df4235e11229fa9575ffe","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.2.tgz","fileCount":15,"integrity":"sha512-+fADi0l8+SbKmzuA7kNF9QlZNB5HtBRXcLmJHQ0Q4VmgPJxoBRTLsISzKVq5WEeQcJz8OHJgX1h/hs9XJeek3Q==","signatures":[{"sig":"MEUCIAgpNhLbHecwQLI8dpKnHUsrYAxDm2KsdC/v1RUZjMXbAiEAouKicE8Z4Ph8rR8Bn4a9Dgi8CrWAJC1LM/42TLm7/RM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":179974},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"195afa8e5c8710969c82c678cc5694eca09a6f59","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.5.0","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"20.12.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.2_1784191841793_0.6954939007094556","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bitalltech-maplibre/core","version":"1.0.3","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.3","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"73b4c04a1d7812506dd2000869019ffa4f993616","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.3.tgz","fileCount":34,"integrity":"sha512-omvZhlOfT83b2kT1IkDFtmVb1qb8rWC87AfjtO66nozrzTn5c5gyZHJTlSjUIbX4Stx6wmH73UMw90yR/lQ3rA==","signatures":[{"sig":"MEUCIAaG/mua6ItuqL2aeGXZs3tSAJZQSoVZTvPpi8cPJFh2AiEA1CSLKFJ4HUoMeCRBC+8UD2s+c+z5c4738L8CsXR48RI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":292769},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"2c25cb28ec5522380181bba6304e021a6f08a9ca","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.3_1785228787560_0.29205788424920764","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bitalltech-maplibre/core","version":"1.0.4","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.4","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"2d1ed17b60b9bfe022c0d9c78e2bc97a81781d7f","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.4.tgz","fileCount":19,"integrity":"sha512-DZSub9XLZKGCtAKxMNemN2oYkVzsKndNGMVP1k1BNcURR2Pjqc13oUT1yff8nbNX3lDn31N7fJ9G4BC9qWsP/Q==","signatures":[{"sig":"MEQCIHSbZgXWjA1NDp8tlj4zKwLHHqvuBme4YwvELfWfW2Z0AiBlIqdg0oIq5aEGRIMwFYc2ycUSuH0xHNeUwhRhu3LjaA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":286178},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"5d62fff7e64418e5a3e3cf325e4c855352f1f36a","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.4_1787549818120_0.20528895241210976","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@bitalltech-maplibre/core","version":"1.0.5","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.5","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"8e8577bf5ccaab70fa2ba27e11f3c699e5b92478","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.5.tgz","fileCount":21,"integrity":"sha512-IF7t/hAFk5oQe4CBHy8YNcGpxSZVdzKOep0eZiA5Vvs+P1CWVH6NSe/hQjfJWR9Wqv+/Xto9dOfyNQYl3OFqzQ==","signatures":[{"sig":"MEUCIQDKh2tfxCcln3NdpI2RjZVuO8MeJMHkWB5SjGENXAt7hAIgbl3/XuD49ay0TSVxdaM5LcdYqxkkIIlht7CTOAJ6l0A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":307976},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"b0bea165646c27fff8246791671f699c2eb3ff64","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.5_1788946753393_0.2302739839574417","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@bitalltech-maplibre/core","version":"1.0.6","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.6","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"0949f1f966fae0b76c6bc0b2c25af58ae36928aa","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.6.tgz","fileCount":21,"integrity":"sha512-W+w68HjsXj6gLSQDLbd8kKaN8H0MZ5lvZGBa0qVC0hzCv36IIDdAVPh9b2Wpwh8tV5EKl23qboJn4FAgOm58PQ==","signatures":[{"sig":"MEUCIQC24wpf0QyERi1+28Vh09otVjbWQXnrBNK8T607xbkwHgIgZcXpyJHy8tzR3+bBy0cSIpWdDo++2EX/4wC1fI1Am78=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":309268},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"b0bea165646c27fff8246791671f699c2eb3ff64","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.6_1789007687103_0.30838610509128417","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@bitalltech-maplibre/core","version":"1.0.7","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.7","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"4beb0ff8db22b5571aad54b8700f693909175a1f","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.7.tgz","fileCount":22,"integrity":"sha512-3h4aikDoApPSY/MrQuGXTQpDIH/89kjWN9bw6Sgf4CBHHwMw2w2qMrSDv5MUhM+gdV6emewY/YftFaiiIJ0FGw==","signatures":[{"sig":"MEUCIG2wnXz7NulsxD34Kq1pkGeXgv3Skx7moX3fnXai5jckAiEAh1Z8b15YXpj8ml4qNvPRY+F7uTFqT9JXCquuOH+EKhI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":309300},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"b0bea165646c27fff8246791671f699c2eb3ff64","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.7_1789030053696_0.20556480178669245","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"@bitalltech-maplibre/core","version":"1.0.8","keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","_id":"@bitalltech-maplibre/core@1.0.8","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"dist":{"shasum":"1992837f1b6a86299fac26b35cc1c898dd528de0","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.8.tgz","fileCount":22,"integrity":"sha512-ZKvBHNGTg54RXtENqUQdYwWVEiA/XghsvDuYdI4AHoKGEEh+GPQkDKfWjIhLM5OYiXWTSbKuNaRoAydc00PJOA==","signatures":[{"sig":"MEYCIQCYUj8kxnc3KfwJmG0FIJ2qMmuutYMHN1CvMRiKtosQ1wIhAIww3rNNQNyUWNmPhpQHDmsRQBvFbM9CiEMSGMsC+gm2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":319719},"main":"dist/index.cjs.js","types":"dist/types/index.d.ts","unpkg":"dist/index.umd.js","module":"dist/index.esm.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"gitHead":"26af2e33cf5df7ced7071e832399bb9bb3b93a99","scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"_npmVersion":"10.9.8","description":"BitAllTech MapLibre 业务组件核心包","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"maplibre-gl":"^5.24.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.0.8_1789117112574_0.590995853163095","host":"s3://npm-registry-packages-npm-production"}},"1.0.9":{"name":"@bitalltech-maplibre/core","version":"1.0.9","description":"BitAllTech MapLibre 业务组件核心包","main":"dist/index.cjs.js","module":"dist/index.esm.js","unpkg":"dist/index.umd.js","types":"dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.cjs.js"}},"scripts":{"dev":"vite build --watch","build":"vite build && tsc --project tsconfig.json --emitDeclarationOnly","prepublishOnly":"npm run build"},"keywords":["bitalltech","maplibre","core"],"license":"UNLICENSED","sideEffects":false,"publishConfig":{"access":"public"},"peerDependencies":{"maplibre-gl":"^5.24.0"},"_id":"@bitalltech-maplibre/core@1.0.9","gitHead":"bf75ccda3b01faf81130a0690d4cac6cdf17b720","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-SryiFvsA7JR31/OaXLslvHKfCZHrVJP9TiPftQ+tcYhYOh5qxzMMSX7SbdPYEbLq8j+I22XMUu+weJbLLxz+MQ==","shasum":"dde871a0c58b017058d1fe97b11c56e65555d488","tarball":"https://registry.npmjs.org/@bitalltech-maplibre/core/-/core-1.0.9.tgz","fileCount":22,"unpackedSize":327292,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICGeR7bEf9aj/Jc0QF8gjI/yjsQNrjXW1DlLDvy7oCDkAiEAp1Q9QS0jzQ1e24BHLpcyBrWb+a2sG379IN4HK6g4Csc="}]},"_npmUser":{"name":"hanyue1218","email":"1584503074@qq.com"},"directories":{},"maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_1.0.9_1789349856622_0.8436050203860925"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-08T10:36:03.210Z","modified":"2026-09-14T01:37:36.974Z","1.0.0":"2026-07-08T10:36:03.488Z","1.0.1":"2026-07-10T09:33:35.778Z","1.0.2":"2026-07-16T08:50:41.912Z","1.0.3":"2026-07-28T08:53:07.693Z","1.0.4":"2026-08-24T05:36:58.248Z","1.0.5":"2026-09-09T09:39:13.525Z","1.0.6":"2026-09-10T02:34:47.241Z","1.0.7":"2026-09-10T08:47:33.914Z","1.0.8":"2026-09-11T08:58:32.705Z","1.0.9":"2026-09-14T01:37:36.790Z"},"license":"UNLICENSED","keywords":["bitalltech","maplibre","core"],"description":"BitAllTech MapLibre 业务组件核心包","maintainers":[{"name":"hanyue1218","email":"1584503074@qq.com"}],"readme":"# @bitalltech-maplibre/core\n\nBitAllTech MapLibre 核心工具包，封装地图初始化、内置底图和低空可视化特效。\n\n## 安装\n\n```bash\nnpm install @bitalltech-maplibre/core maplibre-gl\n```\n\n## 基础使用\n\n```ts\nimport {\n  createMap,\n  maplibregl,\n  setMaplibreToolsConfig,\n} from \"@bitalltech-maplibre/core\";\nimport \"maplibre-gl/dist/maplibre-gl.css\";\n\nsetMaplibreToolsConfig({\n  tdtToken: \"你的天地图 token\",\n});\n\nconst map = createMap({\n  container: \"map\",\n  center: [116.39, 39.91],\n  zoom: 10.5,\n  style: \"openfreemap-liberty\",\n  attributionControl: false,\n});\n\nmap.addControl(new maplibregl.NavigationControl(), \"top-right\");\n```\n\n## 地图初始化\n\n`createMap(options)` 是 `new maplibregl.Map()` 的轻量封装，额外支持内置底图类型：\n\n- `openfreemap-liberty`\n- `openfreemap-bright`\n- `openfreemap-positron`\n- `openfreemap-dark`\n- `openfreemap-fiord`\n- `tdt-image`\n- `tdt-image-label`\n\n如果 `style` 传入普通 URL 或完整 `StyleSpecification`，会原样交给 MapLibre。\n\n## 底图\n\n```ts\nimport { setBaseMap } from \"@bitalltech-maplibre/core\";\n\nsetBaseMap(map, \"tdt-image-label\", {\n  token: \"你的天地图 token\",\n  diff: false,\n});\n```\n\n天地图 token 可以通过单次调用传入，也可以通过 `setMaplibreToolsConfig({ tdtToken })` 设置全局默认值。\n\n## 低空特效\n\n```ts\nimport {\n  addBreathingCircle,\n  addRadarSweep,\n  addRadarPowerGroup,\n  addSectorScan,\n  addPulseMarker,\n  addTargetLock,\n  addCountermeasureBeam,\n} from \"@bitalltech-maplibre/core\";\n\nconst radar = addRadarSweep(map, {\n  id: \"radar\",\n  center: [116.39, 39.91],\n  radius: 3000,\n  color: \"#22c55e\",\n});\n\nconst pulse = addPulseMarker(map, {\n  id: \"event-pulse\",\n  center: [116.41, 39.92],\n  color: \"#ef4444\",\n});\n\nconst breathing = addBreathingCircle(map, {\n  id: \"target-breathing\",\n  center: [116.405, 39.915],\n  radius: 40,\n  // 屏幕像素模式：缩放地图时呼吸圆保持固定大小，与 symbol 图标比例稳定；\n  // 默认 \"meter\" 为地理米制半径，随缩放同步变大变小。\n  radiusUnit: \"pixel\",\n  color: \"#1677ff\",\n  duration: 1800,\n});\n\nconst lock = addTargetLock(map, {\n  id: \"target-lock\",\n  center: [116.4, 39.918],\n  color: \"#ff3b30\",\n  size: 76,\n});\n\nconst beam = addCountermeasureBeam(map, {\n  id: \"countermeasure-beam\",\n  center: [116.386, 39.906],\n  target: [116.399, 39.912],\n  mode: \"expulsion\",\n  color: \"#a855f7\",\n});\n\nradar.update({ radius: 5000 });\npulse.hide();\nbreathing.show();\nlock.update({ center: [116.402, 39.919] });\nradar.remove();\n```\n\n### 批量雷达威力图\n\n多个雷达威力图可以共用一个 GeoJSON source 和一组固定图层。调用时会先创建空 source/layer；如果不传 `radars`，也可以在接口数据返回后再调用 `setData`。\n\n```ts\nimport { addRadarPowerGroup } from \"@bitalltech-maplibre/core\";\n\nmap.on(\"load\", () => {\n  const radarPower = addRadarPowerGroup(map, {\n    id: \"radar-power\",\n    // 可选：插入到指定图层之前；layerIds 会按 fill、core、ring、crosshair、labels 顺序创建。\n    beforeId: \"target-layer\",\n  });\n\n  // 数据返回后只更新共享 source，不重新创建图层，因此图层顺序保持不变。\n  radarPower.setData([\n    {\n      id: \"radar-west\",\n      center: [116.382, 39.903],\n      radius: 4000,\n      color: \"#22c55e\",\n      ringCount: 4,\n    },\n    {\n      id: \"radar-east\",\n      center: [116.42, 39.915],\n      radius: 3000,\n      color: \"#38bdf8\",\n      visible: true,\n    },\n  ]);\n\n  radarPower.setRadarVisible(\"radar-east\", false);\n  radarPower.updateRadar(\"radar-west\", { radius: 5000 });\n\n  // 不再使用时一次性清理整组 source/layer。\n  // radarPower.remove();\n});\n```\n\n`radarPower.sourceId` 是共享 GeoJSON source，`radarPower.layerIds` 是按绘制顺序排列的固定图层 id。插件只保证威力图组内部顺序；雷达组与目标、轨迹、测距等其他业务组之间的顺序，建议由业务侧统一图层管理器安排。\n\n渐变扇形扫描在旋转时使用 MapLibre 的 CanvasSource 动画模式同步最新纹理；不显示轮廓线时只重绘 Canvas，不会逐帧更新 GeoJSON source。`frameRate` 可用于限制 Canvas 内容刷新频率，减少不必要的绘制；若需要轮廓线跟随扇面旋转，插件会同步更新轮廓线几何。\n\n扇形扫描支持从圆心到外缘的径向渐变：\n\n```ts\naddSectorScan(map, {\n  id: \"sector\",\n  center: [116.39, 39.91],\n  radius: 1600,\n  startAngle: 215,\n  endAngle: 282,\n  outlineColor: \"#22c55e\",\n  rotationSpeed: 10,\n  frameRate: 30,\n  gradient: {\n    colors: [\"#f97316\", \"#facc15\", \"#22c55e\"],\n    steps: 64,\n    centerOpacity: 0.08,\n    edgeOpacity: 0.34,\n  },\n});\n```\n\n当前提供：\n\n- `addBreathingCircle`\n- `addPulseMarker`\n- `addRingPulseMarker`\n- `addSectorScan`\n- `addDirectionalPulse`\n- `addRadarSweep`\n- `addRadarPowerGroup`\n- `addDefenceCircle`\n- `addTargetLock`\n- `addCountermeasureBeam`\n- `addCoordinatedCountermeasure`\n- `addNavigationSpoofing`\n- `addBreachAlert`\n\n这些方法都会返回控制器，支持 `update()`、`show()`、`hide()` 和 `remove()`。其中 `addBreachAlert` 额外提供 `trigger(point)`、`reset()` 和 `isActive()`：trigger 开始持续预警，reset 停止，开始与结束都由业务层决定。\n\n### 交互事件\n\n支持命中目标的特效（当前为 `addSectorScan`；`addBreachAlert` 委托到围栏图层）提供 `controller.on(type, handler)` 订阅 `click` / `mouseenter` / `mouseleave`：\n\n```ts\nconst sector = addSectorScan(map, {\n  id: \"sector\",\n  center: [116.39, 39.91],\n  radius: 1600,\n  startAngle: 215,\n  endAngle: 282,\n  // 业务透传数据：写入特效要素属性，事件回调原样带回。\n  properties: { deviceId: \"radar-01\", level: 3 },\n});\n\nconst dispose = sector.on(\"click\", (event) => {\n  // event.lngLat / event.point：点击位置；event.properties：含透传字段。\n  console.log(event.properties.deviceId, event.lngLat);\n});\n```\n\n旋转扫描时命中区域跟随扇面实时更新；渐变（raster 渲染）模式下点击同样有效——插件内部使用独立的透明 fill 命中层，不依赖渲染图层类型。`update()` 重建图层后监听依然有效，`remove()` 自动解绑，返回的取消函数可提前退订。未声明命中目标的特效调用 `on` 会静默忽略。\n\n`addBreathingCircle`、`addPulseMarker` 和 `addRingPulseMarker` 支持 `radiusUnit` 选项：默认 `\"meter\"` 为地理米制半径，渲染结果贴地、随地图缩放同步变化；设为 `\"pixel\"` 时半径按屏幕像素解释，任何缩放级别下保持固定大小，适合叠加在固定尺寸 symbol 图标后的背景高亮，缩放过程中图标与光晕的比例保持稳定。像素模式内部改用 circle 图层渲染，图层通过 `beforeId` 插入时同样可以压在 symbol 之下。\n\n### 电子围栏渲染\n\n电子围栏提供两个互不依赖的渲染器，由业务在创建时明确选择：\n\n- `addStandardElectronicFenceLayer`：使用一个 GeoJSON Source 和固定数量的 MapLibre 内置图层，适合几十到上百个围栏。\n- `addWebGLElectronicFenceLayer`：使用一个原生 WebGL 3D CustomLayer 绘制透明围栏、白色流动虚线或实线，以及与围栏同色的多层柔和泛光，适合少量重点围栏；首版支持 Mercator 投影。\n\n两者共用 `ElectronicFenceFeature` 和 `ElectronicFenceController`，均不依赖编辑插件。围栏必须是带稳定字符串 `id` 的 GeoJSON Polygon；矩形和圆形应先转换成 Polygon。`properties` 仅作为业务数据保存和回传，插件不会读取其中字段覆盖高度、样式或状态。\n\n`defaults.thickness` 可省略，默认使用 `1` 米；显式传入时必须大于 `0`。\n\n```ts\nimport {\n  addStandardElectronicFenceLayer,\n  addWebGLElectronicFenceLayer,\n  type ElectronicFenceFeatureCollection,\n} from \"@bitalltech-maplibre/core\";\n\nconst data: ElectronicFenceFeatureCollection = {\n  type: \"FeatureCollection\",\n  features: [\n    {\n      type: \"Feature\",\n      id: \"fence-01\",\n      geometry: {\n        type: \"Polygon\",\n        coordinates: [[\n          [116.386, 39.905],\n          [116.396, 39.905],\n          [116.396, 39.912],\n          [116.386, 39.912],\n          [116.386, 39.905],\n        ]],\n      },\n      properties: {\n        name: \"核心防区\",\n      },\n    },\n  ],\n};\n\nconst standardFence = addStandardElectronicFenceLayer(map, {\n  id: \"standard-fence\",\n  defaults: {\n    baseHeight: 0,\n    height: 130,\n    thickness: 18,\n  },\n});\n\nstandardFence.setData(data);\n```\n\nWebGL 版本使用相同数据和控制器 API：\n\n```ts\nconst webglFence = addWebGLElectronicFenceLayer(map, {\n  id: \"webgl-fence\",\n  defaults: {\n    baseHeight: 0,\n    height: 150,\n    thickness: 22,\n  },\n  styles: {\n    normal: {\n      color: \"#c084fc\",\n      opacity: 0.18,\n      glowStrength: 1,\n      flowColor: \"#ffffff\",\n      flowCount: 3,\n      flowLineStyle: \"dashed\",\n      flowWidth: 0.18,\n    },\n  },\n  animation: {\n    enabled: true,\n    fps: 30,\n    speed: 0.35,\n    scope: \"all\",\n  },\n});\n\nwebglFence.setData(data);\nwebglFence.setFeatureState(\"fence-01\", \"alarm\");\nwebglFence.setFeatureActive(\"fence-01\", true);\n```\n\n公共控制器方法：\n\n- `setData(data)`：全量替换，清除 renderer state、active 和 hidden 状态。\n- `add(feature)`：严格新增，重复 id 抛错。\n- `update(id, patch)`：严格更新业务 Feature，不读取 properties 控制渲染。\n- `removeFeature(id)`：严格删除单围栏。\n- `clear()`：清空数据但保留插件。\n- `setFeatureState(id, state)`：显式设置 normal、warning、alarm 或 disabled 渲染状态。\n- `setFeatureActive(id, active)`：设置临时高亮，不修改业务 Feature。\n- `setFeatureVisible(id, visible)`：临时控制单围栏显隐。\n- `show()`、`hide()`：控制整个插件显隐；WebGL 版隐藏时暂停动画。\n- `destroy()`：释放 Source、Layer、事件和 WebGL 资源。\n\n当 `interactive` 未设为 `false` 时，两种渲染器都会通过地图触发 `fence.click`、`fence.mouseenter` 和 `fence.mouseleave`，事件载荷包含 `instanceId`、`renderer`、`id`、`feature` 和 `originalEvent`。\n\n### 围栏闯入预警\n\n`addBreachAlert` 用于无人机闯入电子围栏时的复合预警，三段叠加且各自独立开关。trigger 后三段持续播放，直到业务层调用 reset() 才停止：\n\n- 围栏高频闪烁：接触瞬间围栏由正常色（蓝/绿）切到高频闪烁警报红\n- 接触点涟漪扩散：以接触点为中心持续向外扩散红色涟漪\n- 战术框闪烁：全屏或局部 DOM 边框高频闪烁\n\n```ts\nimport { addBreachAlert, createFenceCircle } from \"@bitalltech-maplibre/core\";\n\n// fence 支持直接传入 edit 插件 getAll() 的 FeatureCollection，\n// 或单个 Polygon / MultiPolygon / Feature；圆形用 createFenceCircle 构造。\nconst fence = createFenceCircle([116.39, 39.91], 1000);\n\nconst alert = addBreachAlert(map, {\n  id: \"breach-zone\",\n  center: [116.39, 39.91],\n  fence,                         // 围栏几何\n  fenceColor: \"#1677ff\",         // 正常态蓝\n  fenceAlertColor: \"#ff3b30\",    // 警报红\n  fenceFlash: true,              // 围栏闪烁：开\n  ripple: true,                  // 涟漪：开\n  tacticalFlash: false,          // 战术框：关\n});\n\n// 业务层判定闯入后触发（几何判定与目标分类归业务层）\ndetector.on(\"breach\", ({ point }) => {\n  alert.trigger(point);\n});\n\nalert.reset();   // 业务层判定解警后停止\nalert.remove();  // 销毁（连 DOM 一起清理）\n```\n\n> 插件只负责视觉表现，不判定「是否闯入」「目标是否黑飞/未知」，也不决定警报持续多久——这些都由业务层完成，插件只暴露 trigger 与 reset。\n\n## 常用导出\n\n- `createMap`、`maplibregl`\n- `setMaplibreToolsConfig`、`getMaplibreToolsConfig`\n- `getBaseMapStyle`、`setBaseMap`\n- 低空特效方法和对应类型\n","readmeFilename":"README.md"}