Skip to content

Commit 8043b87

Browse files
[fix]无人机示例名字修改,jsdoc版本号更新,标绘选中问题修复
AI-GEN: 70% Cursor
1 parent 95e54bc commit 8043b87

9 files changed

Lines changed: 998 additions & 16 deletions

File tree

‎examples/locales/en-US/resources.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ window.examplesResources = {
759759
"text_videoMapDraw_drawnCount":"{count} feature(s) drawn.",
760760
"text_videoMapDraw_length":"Length",
761761
"text_videoMapDraw_area":"Area",
762+
"text_videoMapDraw_save":"Save",
763+
"text_videoMapDraw_saveHint":"Click Save to upload the newly drawn features.",
764+
"text_videoMapDraw_pending":"{count} feature(s) to save.",
765+
"text_videoMapDraw_saving":"Saving...",
762766
"text_huainanDraw_videoMapLabel":"Dynamic Video Map",
763767
"text_huainanDraw_realMapLabel":"Tianditu Imagery",
764768
"text_huainanDraw_length":"Length",

‎examples/locales/zh-CN/resources.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,10 @@ window.examplesResources = {
734734
"text_videoMapDraw_drawnCount":"已绘制 {count} 个要素。",
735735
"text_videoMapDraw_length":"长度",
736736
"text_videoMapDraw_area":"面积",
737+
"text_videoMapDraw_save":"保存",
738+
"text_videoMapDraw_saveHint":"标绘完成后点击「保存」上传。",
739+
"text_videoMapDraw_pending":"待保存 {count} 个要素。",
740+
"text_videoMapDraw_saving":"保存中…",
737741
"text_huainanDraw_videoMapLabel":"动态视频地图",
738742
"text_huainanDraw_realMapLabel":"天地图影像",
739743
"text_huainanDraw_length":"长度",

‎examples/mapboxgl/config.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,22 +1883,22 @@ var exampleConfig = {
18831883
fileName: 'videoMap'
18841884
},
18851885
{
1886-
name: '无人机视频图层',
1886+
name: '无人机视频投放',
18871887
name_en: 'UAV Video Layer',
18881888
version: '11.2.0',
18891889
thumbnail: 'videoLayerWithTime.png',
18901890
fileName: 'videoLayerWithTime'
18911891
},
18921892
{
1893-
name: '无人机视频地图',
1894-
name_en: 'UAV Video Map',
1893+
name: '无人机视频叠加矢量',
1894+
name_en: 'UAV Video Map add vector',
18951895
version: '12.1.1',
18961896
thumbnail: 'videoMapWithTime.png',
18971897
fileName: 'videoMapWithTime'
18981898
},
18991899
{
1900-
name: '视频标绘',
1901-
name_en: 'Video Map Draw',
1900+
name: '无人机视频标绘',
1901+
name_en: 'UAV Video Map Draw',
19021902
version: '12.1.1',
19031903
thumbnail: 'videoMapWithTimeDraw.png',
19041904
fileName: 'videoMapWithTimeDraw'

‎src/mapboxgl/control/VideoMapDrawControl.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function resolveControls(options) {
5454

5555
/**
5656
* @class VideoMapDrawControl
57+
* @version 12.1.1
5758
* @category Control
5859
* @classdesc 视频地图绘制控件。UI 参考 mapbox-gl-draw:点、线、面、删除。
5960
* 绘制结果走 VideoMap 地理坐标与重投影链路,可同步到真实地图。后续可在此控件上扩展要素编辑。

‎src/mapboxgl/control/VideoPlayControl.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function sanitizeHTML(html) {
3232
/**
3333
* @class VideoPlayControl
3434
* @category Control
35+
* @version 12.1.1
3536
* @classdesc VideoMap 或 VideoLayer 的播放/暂停控件。
3637
* @modulecategory Control
3738
* @param {Object} [options] - 参数。

‎src/mapboxgl/mapping/VideoMap.js‎

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const MAP_EVENTS = [
7575
*/
7676

7777
/**
78+
* @version 12.1.1
7879
* @typedef {Object} VideoMap.VideoTimeParameters - 动态视频配准参数(按视频时间动态更新相机位置)。
7980
* @property {number} time - 视频时间戳,单位秒。用于按视频播放时间匹配对应的相机参数。
8081
* @property {number} pitch - 相机俯仰角,单位:度。
@@ -217,7 +218,11 @@ export class VideoMap extends mapboxgl.Evented {
217218
has: (target, property) => Reflect.has(target, property) || !!(target.map && property in target.map)
218219
});
219220
}
220-
221+
/**
222+
*
223+
*
224+
* @version 12.1.1
225+
*/
221226
on(type, layerIds, listener) {
222227
if (!MAP_EVENTS.includes(type) || type === 'load') {
223228
return arguments.length === 2 ? super.on(type, layerIds) : super.on(type, listener);
@@ -383,6 +388,7 @@ export class VideoMap extends mapboxgl.Evented {
383388
}
384389

385390
/**
391+
* @private
386392
* @function VideoMap.prototype.updateAtTime
387393
* @description 使用视频时间更新相机参数并重新投影已添加的 GeoJSON 数据源。
388394
* @param {number} time - 视频时间,单位秒。
@@ -427,7 +433,8 @@ export class VideoMap extends mapboxgl.Evented {
427433
this.map.fire('move');
428434
}
429435
/**
430-
* @event VideoMap#videoparameterupdate
436+
* @version 12.1.1
437+
`* @event VideoMap#videoparameterupdate
431438
* @description 矢量要素重投影完成时触发。已打开的弹窗可监听此事件跟随要素位置更新。
432439
*/
433440
this.fire('videoparameterupdate', { time: this.currentTime });
@@ -460,6 +467,7 @@ export class VideoMap extends mapboxgl.Evented {
460467
}
461468

462469
/**
470+
* @private
463471
* @function VideoMap.prototype.project
464472
* @description 将 EPSG:4326 经纬度投影到当前视频地图坐标后,再转换为屏幕像素坐标。
465473
* @param {mapboxgl.LngLat|Object|Array<number>} lngLat - EPSG:4326 坐标。
@@ -515,6 +523,7 @@ export class VideoMap extends mapboxgl.Evented {
515523

516524
/**
517525
* @function VideoMap.prototype.getVideoBounds
526+
* @version 12.1.1
518527
* @description 获取当前视频画面反投影到地面的覆盖多边形。
519528
* 顶点顺序为左上 → 右上 → 右下 → 左下;坐标为 EPSG:4326,经纬度,环自动闭合。
520529
* @param {Object} [options] - 参数。
@@ -570,7 +579,8 @@ export class VideoMap extends mapboxgl.Evented {
570579

571580
/**
572581
* @function VideoMap.prototype.play
573-
* @description 播放视频。推荐使用 {@link VideoPlayControl} 提供圆形播放/暂停按钮。
582+
* @version 12.1.1
583+
* @description 播放视频。推荐使用 {@link VideoPlayControl} 提供圆形播放/暂停按钮。
574584
*/
575585
play() {
576586
if (this.videoMapLayer) {
@@ -580,6 +590,7 @@ export class VideoMap extends mapboxgl.Evented {
580590

581591
/**
582592
* @function VideoMap.prototype.pause
593+
* @version 12.1.1
583594
* @description 暂停视频。
584595
*/
585596
pause() {
@@ -590,6 +601,7 @@ export class VideoMap extends mapboxgl.Evented {
590601

591602
/**
592603
* @function VideoMap.prototype.paused
604+
* @version 12.1.1
593605
* @description 获取当前视频播放状态。返回 `true` 表示已暂停,返回 `false` 表示正在播放。
594606
* @returns {boolean} 视频是否暂停。
595607
*/
@@ -599,9 +611,10 @@ export class VideoMap extends mapboxgl.Evented {
599611

600612
/**
601613
* @function VideoMap.prototype.addControl
602-
* @description 向视频地图添加 MapboxGL 控件。若控件实现了 `setTarget` 且尚无目标,或实现了 `setVideoMap`,会自动注入当前 VideoMap。
614+
* @version 12.1.1
615+
* @description 向视频地图添加 MapboxGL 控件。若控件实现了 `setTarget` 且尚无目标,或实现了 `setVideoMap`,会自动注入当前 VideoMap。
603616
* @param {Object} control - MapboxGL IControl 控件。
604-
* @param {string} [position] - MapboxGL 原生控件位置:`'top-left'` | `'top-right'` | `'bottom-left'` | `'bottom-right'`。
617+
* @param {string} [position] - MapboxGL 原生控件位置:`'top-left'` | `'top-right'` | `'bottom-left'` | `'bottom-right'`。
605618
* @returns {VideoMap} this。
606619
*/
607620
addControl(control, position) {
@@ -615,6 +628,7 @@ export class VideoMap extends mapboxgl.Evented {
615628

616629
/**
617630
* @function VideoMap.prototype.removeControl
631+
* @version 12.1.1
618632
* @description 移除控件。
619633
* @param {Object} control - 已添加的控件。
620634
* @returns {VideoMap} this。
@@ -630,6 +644,7 @@ export class VideoMap extends mapboxgl.Evented {
630644

631645
/**
632646
* @function VideoMap.prototype.startDraw
647+
* @version 12.1.1
633648
* @description 开始点、线、面标绘。单击加点;线、面双击或调用 `finishDraw` 结束当前图形。坐标会转换为真实地理坐标,并随相机更新重投影。推荐使用 {@link VideoMapDrawControl} 提供工具条。
634649
* @param {string} type - 标绘类型,`'Point'` | `'LineString'` | `'Polygon'`。
635650
*/
@@ -639,55 +654,64 @@ export class VideoMap extends mapboxgl.Evented {
639654

640655
/**
641656
* @event VideoMap#drawstart
657+
* @version 12.1.1
642658
* @description 开始标绘时触发。
643659
* @property {string} type - 标绘类型。
644660
*/
645661

646662
/**
663+
* @version 12.1.1
647664
* @event VideoMap#drawcreate
648665
* @description 完成一个标绘要素时触发。
649666
* @property {Object} feature - 新增的 GeoJSON Feature。
650667
* @property {Object} data - 当前全部标绘结果。
651668
*/
652669

653670
/**
671+
* @version 12.1.1
654672
* @event VideoMap#drawupdate
655673
* @description 标绘结果或绘制中的图形发生变化时触发,可用于同步到其它地图。
656674
* @property {Object} data - 已完成的 GeoJSON FeatureCollection。
657675
* @property {Object} live - 已完成图形加上当前草稿的 GeoJSON FeatureCollection。
658676
*/
659677

660678
/**
679+
* @version 12.1.1
661680
* @event VideoMap#drawcancel
662681
* @description 取消当前标绘时触发。
663682
*/
664683

665684
/**
685+
* @version 12.1.1
666686
* @event VideoMap#drawclear
667687
* @description 清空标绘结果时触发。
668688
*/
669689

670690
/**
691+
* @version 12.1.1
671692
* @event VideoMap#drawmodechange
672693
* @description 绘制模式变化时触发。
673694
* @property {string} mode - UI 模式,`'simple_select'` | `'draw_point'` | `'draw_line_string'` | `'draw_polygon'`。
674695
* @property {string|null} type - GeoJSON 类型,`'Point'` | `'LineString'` | `'Polygon'` | `null`。
675696
*/
676697

677698
/**
699+
* @version 12.1.1
678700
* @event VideoMap#drawselectionchange
679701
* @description 选中要素变化时触发,供后续要素编辑使用。
680702
* @property {Array} features - 当前选中的 GeoJSON Feature。
681703
*/
682704

683705
/**
706+
* @version 12.1.1
684707
* @event VideoMap#drawdelete
685708
* @description 删除选中要素时触发。
686709
* @property {Array} features - 被删除的 GeoJSON Feature。
687710
* @property {Object} data - 删除后的全部标绘结果。
688711
*/
689712

690713
/**
714+
* @version 12.1.1
691715
* @function VideoMap.prototype.finishDraw
692716
* @description 结束当前线或面标绘并保存图形。点标绘在单击时即完成,无需调用此方法。
693717
* @returns {Object|null} 完成的 GeoJSON Feature。
@@ -697,6 +721,7 @@ export class VideoMap extends mapboxgl.Evented {
697721
}
698722

699723
/**
724+
* @version 12.1.1
700725
* @function VideoMap.prototype.cancelDraw
701726
* @description 取消当前正在绘制的图形并退出标绘。
702727
*/
@@ -707,6 +732,7 @@ export class VideoMap extends mapboxgl.Evented {
707732
}
708733

709734
/**
735+
* @version 12.1.1
710736
* @function VideoMap.prototype.clearDraw
711737
* @description 清空已标绘的点、线、面。
712738
*/
@@ -717,6 +743,7 @@ export class VideoMap extends mapboxgl.Evented {
717743
}
718744

719745
/**
746+
* @version 12.1.1
720747
* @function VideoMap.prototype.getDrawData
721748
* @description 获取已标绘要素的 GeoJSON(经纬度,EPSG:4326)。
722749
* @returns {Object} GeoJSON FeatureCollection。
@@ -726,6 +753,7 @@ export class VideoMap extends mapboxgl.Evented {
726753
}
727754

728755
/**
756+
* @version 12.1.1
729757
* @function VideoMap.prototype.getDrawLiveData
730758
* @description 获取已完成标绘加上当前草稿的 GeoJSON(经纬度,EPSG:4326),可用于同步到真实地图。
731759
* @returns {Object} GeoJSON FeatureCollection。
@@ -735,6 +763,7 @@ export class VideoMap extends mapboxgl.Evented {
735763
}
736764

737765
/**
766+
* @version 12.1.1
738767
* @function VideoMap.prototype.getDrawMode
739768
* @description 获取当前标绘类型。未处于标绘状态时返回 `null`。
740769
* @returns {string|null} `'Point'` | `'LineString'` | `'Polygon'` | `null`。
@@ -744,6 +773,7 @@ export class VideoMap extends mapboxgl.Evented {
744773
}
745774

746775
/**
776+
* @version 12.1.1
747777
* @function VideoMap.prototype.getDrawUiMode
748778
* @description 获取当前绘制 UI 模式,对齐 mapbox-gl-draw。
749779
* @returns {string} `'simple_select'` | `'draw_point'` | `'draw_line_string'` | `'draw_polygon'`。
@@ -753,6 +783,7 @@ export class VideoMap extends mapboxgl.Evented {
753783
}
754784

755785
/**
786+
* @version 12.1.1
756787
* @function VideoMap.prototype.changeDrawMode
757788
* @description 切换绘制模式。`direct_select` 预留给后续顶点编辑,当前按选中处理。
758789
* @param {string} mode - `'simple_select'` | `'draw_point'` | `'draw_line_string'` | `'draw_polygon'` | `'direct_select'`。
@@ -763,6 +794,7 @@ export class VideoMap extends mapboxgl.Evented {
763794
}
764795

765796
/**
797+
* @version 12.1.1
766798
* @function VideoMap.prototype.deleteDraw
767799
* @description 删除标绘要素。不传 ids 时删除当前选中要素。
768800
* @param {string|Array<string>} [ids] - 要素 id。
@@ -773,6 +805,7 @@ export class VideoMap extends mapboxgl.Evented {
773805
}
774806

775807
/**
808+
* @version 12.1.1
776809
* @function VideoMap.prototype.getDrawSelected
777810
* @description 获取当前选中的标绘要素。
778811
* @returns {Object} GeoJSON FeatureCollection。

‎src/mapboxgl/mapping/VideoMapDraw.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,9 @@ export default class VideoMapDraw {
663663
const queried = map.queryRenderedFeatures(box, { layers }) || [];
664664
const ids = [];
665665
queried.forEach((item) => {
666-
const id = item.id || (item.properties && (item.properties.id || item.properties.drawId));
667-
if (id && ids.indexOf(id) === -1) {
666+
const properties = item.properties || {};
667+
const id = properties.drawId != null ? properties.drawId : item.id != null ? item.id : properties.id;
668+
if (id != null && id !== '' && ids.indexOf(id) === -1) {
668669
ids.push(id);
669670
}
670671
});
@@ -785,7 +786,10 @@ export default class VideoMapDraw {
785786
return {
786787
type: 'Feature',
787788
id: feature.id,
788-
properties: Object.assign({}, feature.properties, { selected: !!selected[feature.id] }),
789+
properties: Object.assign({}, feature.properties, {
790+
selected: !!selected[feature.id],
791+
drawId: feature.id
792+
}),
789793
geometry: feature.geometry
790794
};
791795
})

‎src/mapboxgl/overlay/VideoLayer.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@
521521
}
522522

523523
/**
524+
* @version 12.1.1
524525
* @function VideoLayer.prototype.play
525526
* @description 播放视频。
526527
*/
@@ -535,6 +536,7 @@
535536
}
536537

537538
/**
539+
* @version 12.1.1
538540
* @function VideoLayer.prototype.pause
539541
* @description 暂停视频。
540542
*/
@@ -549,6 +551,7 @@
549551
}
550552

551553
/**
554+
* @version 12.1.1
552555
* @function VideoLayer.prototype.paused
553556
* @description 获取当前视频播放状态。返回 `true` 表示已暂停,返回 `false` 表示正在播放。
554557
* @returns {boolean} 视频是否暂停。

0 commit comments

Comments
 (0)