Skip to content

Commit 7c151da

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

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
@@ -740,10 +740,30 @@ window.examplesResources = {
740740
"title_dataAttributes": "Attributes",
741741
"title_chartService": "Chart",
742742
"title_videoLayer":"Video Layer",
743+
"title_videoLayerWithTime":"Video Layer with Time Parameters",
743744
"title_videoMap":"Video Map",
745+
"title_videoMapDraw":"Video Map Draw Compare",
744746
"title_videoMapWithTime":"Dynamic Video Map",
747+
"title_videoMapWithTimeDraw":"Dynamic Video Map Draw Compare",
745748
"title_videoMapWithTime_qingdao":"Dynamic Video Map - Qingdao",
746749
"title_videoMapWithTime_huainan":"Dynamic Video Map - Huainan",
750+
"title_videoMapWithTime_huainanDraw":"Dynamic Video Map Draw Compare - Huainan",
751+
"text_videoLayerWithTime_play":"Play",
752+
"text_videoLayerWithTime_pause":"Pause",
753+
"text_videoLayerWithTime_paused":"Paused",
754+
"text_videoLayerWithTime_playing":"Playing",
755+
"text_videoMapDraw_videoLabel":"Video Map",
756+
"text_videoMapDraw_basemapLabel":"Tianditu Imagery",
757+
"text_videoMapDraw_hint":"Video features are overlaid on the right map. Lines and polygons drawn on the right show their length or area.",
758+
"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.",
759+
"text_videoMapDraw_drawnCount":"{count} feature(s) drawn.",
760+
"text_videoMapDraw_length":"Length",
761+
"text_videoMapDraw_area":"Area",
762+
"text_huainanDraw_videoMapLabel":"Dynamic Video Map",
763+
"text_huainanDraw_realMapLabel":"Tianditu Imagery",
764+
"text_huainanDraw_hint":"Draw on either map; edits sync in real time. Lines show length and polygons show area.",
765+
"text_huainanDraw_length":"Length",
766+
"text_huainanDraw_area":"Area",
747767
"title_uavVideo":"Uav Video",
748768
"title_knowledgeGraphMap": "KnowledgeGraph",
749769
"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
@@ -715,10 +715,30 @@ window.examplesResources = {
715715
"text_selectStartNode": "捕捉开始节点",
716716
"text_selectEndNode": "捕捉结束节点",
717717
"title_videoLayer":"视频图层",
718+
"title_videoLayerWithTime":"带时间参数的视频图层",
718719
"title_videoMap":"视频地图",
720+
"title_videoMapDraw":"视频地图标绘对比",
719721
"title_videoMapWithTime":"动态视频地图",
722+
"title_videoMapWithTimeDraw":"动态视频地图标绘对比",
720723
"title_videoMapWithTime_qingdao":"动态视频地图 - 青岛",
721724
"title_videoMapWithTime_huainan":"动态视频地图 - 淮南",
725+
"title_videoMapWithTime_huainanDraw":"动态视频地图标绘对比 - 淮南",
726+
"text_videoLayerWithTime_play":"播放",
727+
"text_videoLayerWithTime_pause":"暂停",
728+
"text_videoLayerWithTime_paused":"已暂停",
729+
"text_videoLayerWithTime_playing":"播放中",
730+
"text_videoMapDraw_videoLabel":"视频地图",
731+
"text_videoMapDraw_basemapLabel":"天地图影像",
732+
"text_videoMapDraw_hint":"左侧视频要素实时叠加到右侧;右侧绘制的线和面会显示长度或面积。",
733+
"text_videoMapDraw_syncHint":"左侧视频要素实时叠加到右侧;右侧绘制同步显示在左侧视频,并显示长度或面积。",
734+
"text_videoMapDraw_drawnCount":"已绘制 {count} 个要素。",
735+
"text_videoMapDraw_length":"长度",
736+
"text_videoMapDraw_area":"面积",
737+
"text_huainanDraw_videoMapLabel":"动态视频地图",
738+
"text_huainanDraw_realMapLabel":"天地图影像",
739+
"text_huainanDraw_hint":"两侧均可绘制,完成后实时同步;线显示长度,面显示面积。",
740+
"text_huainanDraw_length":"长度",
741+
"text_huainanDraw_area":"面积",
722742
"title_uavVideo":"无人机视频",
723743
"title_knowledgeGraphMap": "知识图谱",
724744
"title_l7_grid_map": "网格地图",

‎examples/mapboxgl/config.js‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,26 +1882,47 @@ var exampleConfig = {
18821882
thumbnail: 'videoMap.png',
18831883
fileName: 'videoMap'
18841884
},
1885+
// {
1886+
// name: '视频地图标绘对比',
1887+
// name_en: 'Video Map Draw Compare',
1888+
// version: '12.1.1',
1889+
// thumbnail: 'videoMap.png',
1890+
// fileName: 'videoMapDraw'
1891+
// },
18851892
{
18861893
name: '无人机视频',
18871894
name_en: 'UAV video',
18881895
version: '11.2.0',
18891896
thumbnail: 'videoLayerWithTime.png',
18901897
fileName: 'videoLayerWithTime'
1891-
},
1892-
{
1893-
name: '动态视频地图',
1894-
name_en: 'Dynamic Video Map',
1895-
version: '12.1.1',
1896-
thumbnail: 'videoMap.png',
1897-
fileName: 'videoMapWithTime'
1898+
},
1899+
{
1900+
name: '动态视频地图',
1901+
name_en: 'Dynamic Video Map',
1902+
version: '12.1.1',
1903+
thumbnail: 'videoMapWithTime.png',
1904+
fileName: 'videoMapWithTime'
1905+
},
1906+
{
1907+
name: '动态视频地图标绘对比',
1908+
name_en: 'Dynamic Video Map Draw Compare',
1909+
version: '12.1.1',
1910+
thumbnail: 'videoMapWithTimeDraw.png',
1911+
fileName: 'videoMapWithTimeDraw'
18981912
},
18991913
{
19001914
name: '动态视频地图 - 淮南',
19011915
name_en: 'Dynamic Video Map - Huainan',
19021916
version: '12.1.1',
1903-
thumbnail: 'videoMap.png',
1917+
thumbnail: 'videoMap_huainan.png',
19041918
fileName: 'videoMapWithTime_huainan'
1919+
},
1920+
{
1921+
name: '动态视频地图标绘对比 - 淮南',
1922+
name_en: 'Dynamic Video Map Draw Compare - Huainan',
1923+
version: '12.1.1',
1924+
thumbnail: 'videoMap_huainan_draw.png',
1925+
fileName: 'videoMapWithTime_huainanDraw'
19051926
}
19061927
]
19071928
}
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)