Skip to content

Commit e163c85

Browse files
优化 videomap api doc
1 parent f178384 commit e163c85

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

examples/mapboxgl/videoMap.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
name: dstName + '@' + datasource,
5050
attributeFilter: 'SMID > 0'
5151
},
52+
targetEpsgCode: '4326',
5253
datasetNames: [datasource + ':' + dstName]
5354
});
5455

@@ -203,8 +204,9 @@
203204
var cameraLocation = serviceResult.result.features.features[0].properties.cameraLocation;
204205
var calibrationModel = serviceResult.result.features.features[0].properties.videoParameters.videoParameterList[0].calibrationModel;
205206
videoMap = new mapboxgl.supermap.VideoMap(
207+
{
206208
url,
207-
{
209+
videoParameters: {
208210
fovX: calibrationModel.fovX,
209211
fovY: calibrationModel.fovY,
210212
centerX: calibrationModel.centerX,
@@ -216,7 +218,6 @@
216218
y: cameraLocation.cameraY,
217219
z: cameraLocation.cameraZ
218220
},
219-
{
220221
autoplay: false,
221222
styleOptions: {
222223
sprite: 'https://iclient.supermap.io/web/styles/street/sprite',

src/mapboxgl/mapping/GeojsonSource.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { featureEach, coordEach } from '@turf/meta';
22
import cloneDeep from 'lodash.clonedeep';
33
import { transformCoord } from './utils/VideoMapUtil';
4+
import proj4 from 'proj4';
45

56
/**
67
* @class GeojsonSource
@@ -33,7 +34,8 @@ export default class GeojsonSource {
3334
const newData = cloneDeep(source.data);
3435
featureEach(newData, (currentFeature) => {
3536
coordEach(currentFeature, (curCoords) => {
36-
let transCoords = this.coordTransfer.toVideoCoordinate(curCoords);
37+
let transCurCoords = proj4('EPSG:4326', 'EPSG:3857', curCoords);
38+
let transCoords = this.coordTransfer.toVideoCoordinate(transCurCoords);
3739
curCoords.length = 0;
3840
curCoords.push(
3941
...transformCoord({

src/mapboxgl/mapping/VideoMap.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const MAP_EVENTS = [
5252
/**
5353
* @class VideoMap
5454
* @classdesc 视频地图
55-
* @category VideoMap
55+
* @category Visualization Video
5656
* @version 11.2.0
5757
* @modulecategory Mapping
5858
* @param {Object} options - 参数
@@ -76,6 +76,7 @@ const MAP_EVENTS = [
7676
* @param {string} [options.autoplay=true] - 视频是否自动播放
7777
* @param {string} [options.loop=true] - 视频是否循环播放
7878
* @extends {mapboxgl.Evented}
79+
* @usage
7980
*/
8081

8182
export class VideoMap extends mapboxgl.Evented {
@@ -106,8 +107,16 @@ export class VideoMap extends mapboxgl.Evented {
106107

107108
/**
108109
* @function VideoMap.prototype.addLayer
109-
* @description 添加图层。
110+
* @description 添加图层。
110111
* @param {Object} layer - 图层配置。
112+
* @param {string} layer.id - 图层 id
113+
* @param {string} layer.type - 图层类型
114+
* @param {string|Object} layer.source - 数据源配置
115+
* @param {Array} [layer.filter] - 过滤配置
116+
* @param {Object} [layer.layout] - 布局配置
117+
* @param {Object} [layer.paint] - 绘制配置
118+
* @param {number} [layer.maxzoom] - 最大级别
119+
* @param {number} [layer.minzoom] - 最小级别
111120
* @param {string} beforeId - 已经存在的图层 ID。
112121
*/
113122
addLayer(layer, beforeId) {
@@ -127,6 +136,8 @@ export class VideoMap extends mapboxgl.Evented {
127136
* @description 添加数据源。
128137
* @param {string} id - 数据源 id。
129138
* @param {Object} source - 图层源配置。
139+
* @param {string} source.type - 只支持 geojson
140+
* @param {Object} source.data - geojson 数据。
130141
*/
131142
addSource(id, source) {
132143
if (!this._mapExisted()) {
@@ -159,7 +170,7 @@ export class VideoMap extends mapboxgl.Evented {
159170
/**
160171
* @function VideoMap.prototype.removeSource
161172
* @description 移除数据源。
162-
* @param {string} id - source id。
173+
* @param {string} id - 数据源 id。
163174
*/
164175
removeSource(id) {
165176
if (!this._mapExisted()) {

src/mapboxgl/mapping/layers/GeojsonLayer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { featureEach, coordEach } from '@turf/meta';
22
import cloneDeep from 'lodash.clonedeep';
33
import { transformCoord } from '../utils/VideoMapUtil';
4-
4+
import proj4 from 'proj4';
55
/**
66
* @class GeojsonLayer
77
* @version 11.2.0
@@ -61,7 +61,8 @@ export default class GeojsonLayer {
6161
}
6262
featureEach(features, (currentFeature) => {
6363
coordEach(currentFeature, (curCoords) => {
64-
let transCoords = this.coordTransfer.toVideoCoordinate(curCoords);
64+
let transCurCoords = proj4('EPSG:4326', 'EPSG:3857', curCoords);
65+
let transCoords = this.coordTransfer.toVideoCoordinate(transCurCoords);
6566
curCoords.length = 0;
6667
if (transCoords.data64F.length) {
6768
curCoords.push(

src/mapboxgl/overlay/VideoLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
/**
6464
* @function VideoLayer.prototype.onAdd
6565
* @description 添加该图层。
66-
* @param {Object} 地图实例。
66+
* @param {mapboxgl.Map} map - 地图实例。
6767
*/
6868
onAdd(map) {
6969
this.map = map;

0 commit comments

Comments
 (0)