8000 【update】 新增视频地图 api review by xiongjj · SuperMap/iClient-JavaScript@254dc4d · GitHub
[go: up one dir, main page]

Skip to content

Commit 254dc4d

Browse files
【update】 新增视频地图 api review by xiongjj
1 parent 1d16224 commit 254dc4d

14 files changed

+1625
-2
lines changed

libs/opencv-js/opencv_js.js

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@
6969
"browserify": "^17.0.0",
7070
"browserify-css": "^0.15.0",
7171
"browserify-imgify": "^0.0.1",
72+
"browserify-versionify": "^1.0.6",
7273
"chromedriver": "87.0.5",
7374
"clean-css-cli": "^4.3.0",
7475
"commander": "^6.1.0",
7576
"cross-env": "^7.0.2",
7677
"css-loader": "^5.0.0",
78+
"envify": "^4.1.0",
7779
"es3ify-loader": "^0.2.0",
7880
"eslint": "^7.11.0",
7981
"eslint-plugin-import": "^2.22.1",
@@ -112,6 +114,7 @@
112114
"webpack-node-externals": "^2.5.2"
113115
},
114116
"dependencies": {
117+
"@mapbox/mapbox-gl-draw": "^1.3.0",
115118
"@mapbox/vector-tile": "1.3.1",
116119
"@supermap/iclient-common": "file:src/common",
117120
"@tensorflow/tfjs": "^3.9.0",
@@ -121,6 +124,7 @@
121124
"elasticsearch": "16.7.2",
122125
"fetch-ie8": "1.5.0",
123126
"fetch-jsonp": "1.1.3",
127+
"flv.js": "^1.6.2",
124128
"jsonsql": "0.2.5",
125129
"leaflet": "1.7.1",
126130
"lodash.remove": "^4.7.0",
@@ -132,6 +136,8 @@
132136
"proj4": "2.7.5",
133137
"promise-polyfill": "8.2.0",
134138
"three": "0.126.1",
139+
"video.js": "^7.15.4",
140+
"videojs-flvjs-es6": "^1.0.1",
135141
"xlsx": "0.17.2",
136142
"xml-js": "1.6.11"
137143
},

src/mapboxgl/css/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import '@supermap/iclient-common/css/webmapfont/iconfont.css'
2-
import '@supermap/iclient-common/components/css/MessageBox.css'
2+
import '@supermap/iclient-common/components/css/MessageBox.css'
3+
import 'video.js/dist/video-js.css';

src/mapboxgl/mapping/GeojsonSource.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { featureEach, coordEach } from '@turf/meta';
2+
import cloneDeep from 'lodash.clonedeep';
3+
import { transformCoord } from './util';
4+
5+
/**
6+
* @class SuperMap.GeojsonSource
7+
* @classdesc geojson 数据源。
8+
* @param {Object} videoMap - 视频地图实例。
9+
*/
10+
11+
export default class GeojsonSource {
12+
constructor(videoMap) {
13+
const { coordTransfer, originCoordsRightBottom, originCoordsLeftTop, videoWidth, videoHeight, map } = videoMap;
14+
this.map = map;
15+
this.coordTransfer = coordTransfer;
16+
this.originCoordsRightBottom = originCoordsRightBottom;
17+
this.originCoordsLeftTop = originCoordsLeftTop;
18+
this.videoWidth = videoWidth;
19+
this.videoHeight = videoHeight;
20+
this.layerId = null;
21+
this.cacheData = null;
22+
this.setDataFn = this.setData.bind(this);
23+
}
24+
25+
/**
26+
* @function SuperMap.GeojsonSource.prototype.addSource
27+
* @description 添加数据源。
28+
* @param {Object} id - 视频配准 x y z 参数。
29+
* @param {Object} source
30+
*/
31+
addSource(id, source) {
32+
if (this.map.getLayer(id)) {
33+
return;
34+
}
35+
this.layerId = id;
36+
const newData = cloneDeep(source.data);
37+
featureEach(newData, (currentFeature) => {
38+
coordEach(currentFeature, (curCoords) => {
39+
let transCoords = this.coordTransfer.toVideoCoordinate(curCoords);
40+
// 剔除无效坐标
41+
curCoords.length = 0;
42+
curCoords.push(
43+
...transformCoord({
44+
videoPoint: transCoords.data64F,
45+
videoWidth: this.videoWidth,
46+
videoHeight: this.videoHeight,
47+
originCoordsRightBottom: this.originCoordsRightBottom,
48+
originCoordsLeftTop: this.originCoordsLeftTop
49+
})
50+
);
51+
});
52+
});
53+
54+
this.cacheData = source.data;
55+
this.map.on('videoparameterchange', this.setDataFn);
56+
source.data = newData;
57+
58+
this.map.addSource(id, source);
59+
}
60+
/**
61+
* @function SuperMap.GeojsonSource.prototype.addSource
62+
* @description 添加数据源。
63+
* @param {Object} id - 视频配准 x y z 参数。
64+
* @param {Object} source
65+
*/
66+
removeSource() {
67+
this.map.off('videoparameterchange', this.setDataFn);
68+
}
69+
70+
/**
71+
* @function SuperMap.GeojsonSource.prototype.addSource
72+
* @description 添加数据源。
73+
* @param {Object} id - 视频配准 x y z 参数。
74+
* @param {Object} source
75+
*/
76+
setData() {
77+
const newData = cloneDeep(this.cacheData);
78+
featureEach(newData, (currentFeature) => {
79+
coordEach(currentFeature, (curCoords) => {
80+
let transCoords = this.coordTransfer.toVideoCoordinate(curCoords);
81+
curCoords.length = 0;
82+
curCoords.push(...this.transformCoord(transCoords.data64F));
83+
});
84+
});
85+
this.map.getSource(this.layerId).setData(newData);
86+
}
87+
}

0 commit comments

Comments
 (0)
0