Skip to content

Commit f686110

Browse files
[feature]videomap新增播放控件、绘制控件、视频范围、点击弹窗(地图代理), videolayer新增播放控件
AI-GEN: 70% Cursor
1 parent 0d40ea2 commit f686110

37 files changed

Lines changed: 5054 additions & 300 deletions

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,30 @@ window.examplesResources = {
738738
"title_dataAttributes": "Attributes",
739739
"title_chartService": "Chart",
740740
"title_videoLayer":"Video Layer",
741+
"title_videoLayerWithTime":"Video Layer with Time Parameters",
741742
"title_videoMap":"Video Map",
743+
"title_videoMapDraw":"Video Map Draw Compare",
742744
"title_videoMapWithTime":"Dynamic Video Map",
745+
"title_videoMapWithTimeDraw":"Dynamic Video Map Draw Compare",
743746
"title_videoMapWithTime_qingdao":"Dynamic Video Map - Qingdao",
744747
"title_videoMapWithTime_huainan":"Dynamic Video Map - Huainan",
748+
"title_videoMapWithTime_huainanDraw":"Dynamic Video Map Draw Compare - Huainan",
749+
"text_videoLayerWithTime_play":"Play",
750+
"text_videoLayerWithTime_pause":"Pause",
751+
"text_videoLayerWithTime_paused":"Paused",
752+
"text_videoLayerWithTime_playing":"Playing",
753+
"text_videoMapDraw_videoLabel":"Video Map",
754+
"text_videoMapDraw_basemapLabel":"Tianditu Imagery",
755+
"text_videoMapDraw_hint":"Video features are overlaid on the right map. Lines and polygons drawn on the right show their length or area.",
756+
"text_videoMapDraw_syncHint":"Video features are overlaid on the right map. Drawings on the right are synced to the video and show their length or area.",
757+
"text_videoMapDraw_drawnCount":"{count} feature(s) drawn.",
758+
"text_videoMapDraw_length":"Length",
759+
"text_videoMapDraw_area":"Area",
760+
"text_huainanDraw_videoMapLabel":"Dynamic Video Map",
761+
"text_huainanDraw_realMapLabel":"Tianditu Imagery",
762+
"text_huainanDraw_hint":"Draw on either map; edits sync in real time. Lines show length and polygons show area.",
763+
"text_huainanDraw_length":"Length",
764+
"text_huainanDraw_area":"Area",
745765
"title_uavVideo":"Uav Video",
746766
"title_knowledgeGraphMap": "KnowledgeGraph",
747767
"title_l7_grid_map": "Grid Map",

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,30 @@ window.examplesResources = {
713713
"text_selectStartNode": "捕捉开始节点",
714714
"text_selectEndNode": "捕捉结束节点",
715715
"title_videoLayer":"视频图层",
716+
"title_videoLayerWithTime":"带时间参数的视频图层",
716717
"title_videoMap":"视频地图",
718+
"title_videoMapDraw":"视频地图标绘对比",
717719
"title_videoMapWithTime":"动态视频地图",
720+
"title_videoMapWithTimeDraw":"动态视频地图标绘对比",
718721
"title_videoMapWithTime_qingdao":"动态视频地图 - 青岛",
719722
"title_videoMapWithTime_huainan":"动态视频地图 - 淮南",
723+
"title_videoMapWithTime_huainanDraw":"动态视频地图标绘对比 - 淮南",
724+
"text_videoLayerWithTime_play":"播放",
725+
"text_videoLayerWithTime_pause":"暂停",
726+
"text_videoLayerWithTime_paused":"已暂停",
727+
"text_videoLayerWithTime_playing":"播放中",
728+
"text_videoMapDraw_videoLabel":"视频地图",
729+
"text_videoMapDraw_basemapLabel":"天地图影像",
730+
"text_videoMapDraw_hint":"左侧视频要素实时叠加到右侧;右侧绘制的线和面会显示长度或面积。",
731+
"text_videoMapDraw_syncHint":"左侧视频要素实时叠加到右侧;右侧绘制同步显示在左侧视频,并显示长度或面积。",
732+
"text_videoMapDraw_drawnCount":"已绘制 {count} 个要素。",
733+
"text_videoMapDraw_length":"长度",
734+
"text_videoMapDraw_area":"面积",
735+
"text_huainanDraw_videoMapLabel":"动态视频地图",
736+
"text_huainanDraw_realMapLabel":"天地图影像",
737+
"text_huainanDraw_hint":"两侧均可绘制,完成后实时同步;线显示长度,面显示面积。",
738+
"text_huainanDraw_length":"长度",
739+
"text_huainanDraw_area":"面积",
720740
"title_uavVideo":"无人机视频",
721741
"title_knowledgeGraphMap": "知识图谱",
722742
"title_l7_grid_map": "网格地图",

‎examples/mapboxgl/config.js‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,26 +1876,47 @@ var exampleConfig = {
18761876
thumbnail: 'videoMap.png',
18771877
fileName: 'videoMap'
18781878
},
1879+
// {
1880+
// name: '视频地图标绘对比',
1881+
// name_en: 'Video Map Draw Compare',
1882+
// version: '12.1.1',
1883+
// thumbnail: 'videoMap.png',
1884+
// fileName: 'videoMapDraw'
1885+
// },
18791886
{
18801887
name: '无人机视频',
18811888
name_en: 'UAV video',
18821889
version: '11.2.0',
18831890
thumbnail: 'videoLayerWithTime.png',
18841891
fileName: 'videoLayerWithTime'
1885-
},
1886-
{
1887-
name: '动态视频地图',
1888-
name_en: 'Dynamic Video Map',
1889-
version: '12.1.1',
1890-
thumbnail: 'videoMap.png',
1891-
fileName: 'videoMapWithTime'
1892+
},
1893+
{
1894+
name: '动态视频地图',
1895+
name_en: 'Dynamic Video Map',
1896+
version: '12.1.1',
1897+
thumbnail: 'videoMapWithTime.png',
1898+
fileName: 'videoMapWithTime'
1899+
},
1900+
{
1901+
name: '动态视频地图标绘对比',
1902+
name_en: 'Dynamic Video Map Draw Compare',
1903+
version: '12.1.1',
1904+
thumbnail: 'videoMapWithTimeDraw.png',
1905+
fileName: 'videoMapWithTimeDraw'
18921906
},
18931907
{
18941908
name: '动态视频地图 - 淮南',
18951909
name_en: 'Dynamic Video Map - Huainan',
18961910
version: '12.1.1',
1897-
thumbnail: 'videoMap.png',
1911+
thumbnail: 'videoMap_huainan.png',
18981912
fileName: 'videoMapWithTime_huainan'
1913+
},
1914+
{
1915+
name: '动态视频地图标绘对比 - 淮南',
1916+
name_en: 'Dynamic Video Map Draw Compare - Huainan',
1917+
version: '12.1.1',
1918+
thumbnail: 'videoMap_huainan_draw.png',
1919+
fileName: 'videoMapWithTime_huainanDraw'
18991920
}
19001921
]
19011922
}
1.63 MB
Loading
2.63 MB
Loading
2.32 MB
Loading
3.09 MB
Loading

‎examples/mapboxgl/videoLayerWithTime.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<head>
1616
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
17-
<title data-i18n="resources.title_uavVideo"></title>
17+
<title data-i18n="resources.title_videoLayerWithTime"></title>
1818
<style type="text/css">
1919
body {
2020
margin: 0;
@@ -132,6 +132,7 @@
132132
]
133133
});
134134
map.addLayer(videoLayer);
135+
map.addControl(new mapboxgl.supermap.VideoPlayControl({ target: videoLayer }));
135136
});
136137
}
137138
map.on('load', function () {

‎examples/mapboxgl/videoLayerWithTime1.html‎

Lines changed: 0 additions & 148 deletions
This file was deleted.

‎examples/mapboxgl/videoMap.html‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@
2626
bottom: 0;
2727
width: 100%;
2828
}
29+
30+
.custom-play-btn {
31+
display: flex;
32+
align-items: center;
33+
gap: 6px;
34+
padding: 8px 16px;
35+
border: none;
36+
border-radius: 4px;
37+
background: #1f6feb;
38+
color: #fff;
39+
font-size: 14px;
40+
cursor: pointer;
41+
}
42+
43+
.custom-play-icon {
44+
width: 18px;
45+
height: 18px;
46+
fill: #fff;
47+
}
48+
.mapboxgl-ctrl .custom-play-btn:not(:disabled):hover {
49+
background: #1f6feb;
50+
}
2951
</style>
3052
</head>
3153
<body>
@@ -215,6 +237,42 @@
215237
});
216238

217239
videoMap.on('load', function () {
240+
var playControl = new mapboxgl.supermap.VideoPlayControl();
241+
playControl.setHTML(
242+
'<button type="button" class="custom-play-btn">' +
243+
'<span class="sm-mapboxgl-play-when-paused">' +
244+
resources.text_videoLayerWithTime_play +
245+
'</span>' +
246+
'<span class="sm-mapboxgl-play-when-playing">' +
247+
resources.text_videoLayerWithTime_pause +
248+
'</span>' +
249+
'</button>'
250+
);
251+
videoMap.addControl(playControl, 'bottom-left');
252+
253+
videoMap.on('click', function (event) {
254+
var features = videoMap.queryRenderedFeatures(event.point);
255+
if (!features.length) {
256+
return;
257+
}
258+
var feature = features[0];
259+
var content = document.createElement('div');
260+
Object.keys(feature.properties || {}).forEach(function (key) {
261+
var row = document.createElement('div');
262+
var label = document.createElement('strong');
263+
label.textContent = key + ': ';
264+
var value = document.createElement('span');
265+
value.textContent = String(feature.properties[key]);
266+
row.appendChild(label);
267+
row.appendChild(value);
268+
content.appendChild(row);
269+
});
270+
new mapboxgl.Popup({ closeButton: true, closeOnClick: true })
271+
.setLngLat(event.lngLat)
272+
.setDOMContent(content)
273+
.addTo(videoMap);
274+
});
275+
218276
var datasetList = ['POI', 'Road_L', 'Water', '写字楼', '学校', '步行道'];
219277
datasetList.forEach((name) => {
220278
query1(name);

0 commit comments

Comments
 (0)