@mapcatch/util 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcatch/util",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "./dist/catchUtil.min.js",
5
5
  "repository": "",
6
6
  "author": "wanyanyan",
@@ -0,0 +1,44 @@
1
+ export default [
2
+ {
3
+ type: 'image',
4
+ img: 'satellite',
5
+ name: '影像地图',
6
+ items: [
7
+ { // 影像地图
8
+ type: 'raster',
9
+ tileSize: 256,
10
+ tiles: ['http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=bfc12ce6bd94a4449ad626b8a0b709d0'],
11
+ maxzoom: 18,
12
+ layerType:'bmap'
13
+ },
14
+ { // 影像标注
15
+ type: 'raster',
16
+ tileSize: 256,
17
+ tiles: ['http://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=bfc12ce6bd94a4449ad626b8a0b709d0'],
18
+ maxzoom: 18,
19
+ layerType:'bmap'
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ type: 'vector_standard',
25
+ img: 'vector_standard',
26
+ name: '矢量地图',
27
+ items: [
28
+ { // 矢量淡雅
29
+ type: 'raster',
30
+ tileSize: 256,
31
+ tiles: ['http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=bfc12ce6bd94a4449ad626b8a0b709d0'],
32
+ maxzoom: 18,
33
+ layerType:'bmap'
34
+ },
35
+ {
36
+ type: 'raster',
37
+ tileSize: 256,
38
+ tiles: ['http://t0.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=bfc12ce6bd94a4449ad626b8a0b709d0'],
39
+ maxzoom: 18,
40
+ layerType:'bmap'
41
+ }
42
+ ]
43
+ }
44
+ ]
@@ -0,0 +1,10 @@
1
+ export default [
2
+ '#321644',
3
+ '#455dd1',
4
+ '#2eb4f2',
5
+ '#26eda6',
6
+ '#c3f134',
7
+ '#f8bd39',
8
+ '#e14209',
9
+ '#7a0403'
10
+ ]
@@ -0,0 +1,58 @@
1
+ export default [
2
+ {
3
+ type: 'dom',
4
+ name: '正射影像(DOM)',
5
+ group: 'output',
6
+ visible: true,
7
+ opacity: 1,
8
+ class: 'image2d'
9
+ },
10
+ {
11
+ type: 'tmp',
12
+ name: '温度图',
13
+ group: 'output',
14
+ visible: true,
15
+ opacity: 1,
16
+ class: 'tmp'
17
+ },
18
+ {
19
+ type: 'dsm',
20
+ name: '数字表面模型(DSM)',
21
+ group: 'output',
22
+ visible: false,
23
+ opacity: 0.5,
24
+ class: 'image2d'
25
+ },
26
+ {
27
+ type: 'mesh3d',
28
+ name: '三维模型',
29
+ group: 'output',
30
+ visible: true,
31
+ opacity: 1,
32
+ class: 'mesh3d'
33
+ },
34
+ // {
35
+ // type: 'point_cloud',
36
+ // name: '三维点云',
37
+ // group: 'output',
38
+ // visible: false,
39
+ // opacity: 1,
40
+ // dataTypes: ['normal']
41
+ // },
42
+ {
43
+ type: 'ndvi',
44
+ name: '植被指数(NDVI)',
45
+ group: 'output',
46
+ visible: true,
47
+ opacity: 1,
48
+ class: 'ndvi'
49
+ },
50
+ {
51
+ type: 'photos',
52
+ name: '照片',
53
+ group: 'dataset',
54
+ visible: false,
55
+ opacity: 1,
56
+ class: 'photos'
57
+ }
58
+ ]
@@ -1 +1,10 @@
1
- export {default as cameras} from './cameras'
1
+ export {default as cameras} from './cameras'
2
+ export {default as layerGroups} from './layer_groups'
3
+ export {default as bmapTypes} from './bmap_types'
4
+ export {default as colors} from './colors'
5
+ export {default as defaultLayers} from './default_layers'
6
+ export {default as layerFolders} from './layer_folders'
7
+ export {default as layerIcons} from './layer_icons'
8
+ export {default as mapViewModes} from './map_view_mode'
9
+ export {default as taskParams} from './task_params'
10
+ export {default as tools} from './tools'
@@ -0,0 +1,6 @@
1
+ export default {
2
+ dom: 'tile',
3
+ dsm: 'dsm_tile',
4
+ ndvi: 'ndvi_tile',
5
+ tmp: 'tem_tile'
6
+ }
@@ -0,0 +1,26 @@
1
+ export default [
2
+ {
3
+ id: 'annotation',
4
+ type: 'annotation',
5
+ name: '标注',
6
+ collapsed: false,
7
+ visible: true,
8
+ opacity: 1
9
+ },
10
+ {
11
+ id: 'output',
12
+ type: 'output',
13
+ name: '成果图层',
14
+ collapsed: false,
15
+ visible: true,
16
+ opacity: 1
17
+ },
18
+ {
19
+ id: 'dataset',
20
+ type: 'dataset',
21
+ name: '数据集',
22
+ collapsed: false,
23
+ visible: true,
24
+ opacity: 1
25
+ }
26
+ ]
@@ -0,0 +1,14 @@
1
+ export default {
2
+ annotation: 'icon-biaozhu',
3
+ output: 'icon-chengguo',
4
+ dataset: 'icon-dataset',
5
+ dom: 'icon-tuxiang',
6
+ dsm: 'icon-moxing',
7
+ ndvi: 'icon-zhishu',
8
+ mesh3d: 'icon-mesh',
9
+ point_cloud: 'icon-dianyun',
10
+ photos: 'icon-24gf-photoAlbum',
11
+ point: 'icon-locate',
12
+ line: 'icon-line',
13
+ polygon: 'icon-polygon'
14
+ }
@@ -0,0 +1,10 @@
1
+ export default [
2
+ {
3
+ name: '2d',
4
+ icon: 'icon-view_d'
5
+ },
6
+ {
7
+ name: '3d',
8
+ icon: 'icon-view_d1'
9
+ }
10
+ ]
@@ -0,0 +1,33 @@
1
+ export default {
2
+ quality: 'medium', // high、low、medium
3
+ output: {
4
+ normal: [
5
+ {
6
+ type: 'image2d',
7
+ name: '二维正射(DOM+DSM)'
8
+ },
9
+ {
10
+ type: 'mesh3d',
11
+ name: '三维模型(3DTiles)'
12
+ }
13
+ ],
14
+ infrared: [
15
+ {
16
+ type: 'tmp',
17
+ name: '温度图',
18
+ required: true
19
+ }
20
+ ],
21
+ multispectral: [
22
+ {
23
+ type: 'image2d',
24
+ name: '二维正射(DOM+DSM)'
25
+ },
26
+ {
27
+ type: 'ndvi',
28
+ name: '植被指数(NDVI)',
29
+ required: true
30
+ }
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,20 @@
1
+ export default [
2
+ {
3
+ type: 'draw_point',
4
+ mode: 'draw_point',
5
+ name: '标点',
6
+ icon: 'icon-locate'
7
+ },
8
+ {
9
+ type: 'draw_line_string',
10
+ mode: 'draw_line_string',
11
+ name: '标线',
12
+ icon: 'icon-line'
13
+ },
14
+ {
15
+ type: 'draw_polygon',
16
+ mode: 'draw_polygon',
17
+ name: '标面',
18
+ icon: 'icon-polygon'
19
+ }
20
+ ]
@@ -20,7 +20,7 @@ export const getData = function (img, callback) {
20
20
  getImageData(img, callback);
21
21
  } else {
22
22
  if (callback) {
23
- callback.call(img);
23
+ callback(img);
24
24
  }
25
25
  }
26
26
  return true;
@@ -38,7 +38,7 @@ function getImageData(img, callback) {
38
38
  img.xmpdata = xmpdata || {};
39
39
  }
40
40
  if (callback) {
41
- callback.call(img);
41
+ callback(img);
42
42
  }
43
43
  } catch (err) {
44
44
  callback(null, err)
package/src/util.js CHANGED
@@ -5,6 +5,7 @@ import _ from 'lodash'
5
5
  import {getPhotoTags} from './exif'
6
6
  import cameras from './constants/cameras'
7
7
  import * as turf from '@turf/turf'
8
+ import { layerGroups } from './constants'
8
9
 
9
10
  export function generateId() { // 生成随机id
10
11
  return uuidv4()
@@ -13,7 +14,7 @@ export function formatDate(date) {
13
14
  if (!date) {
14
15
  return '-'
15
16
  }
16
- return moment().format('YYYY-MM-DD HH:mm:ss')
17
+ return moment(date).format('YYYY-MM-DD HH:mm:ss')
17
18
  }
18
19
  export function formatLocalDate() {
19
20
  return moment().format('YYYY/M/D HH:mm:ss')
@@ -311,13 +312,13 @@ export function getLineLabelFeature(lineFeature) {
311
312
  midPoint.geometry.coordinates.push(((labelLine[0][2] || 0) + (labelLine[1][2] || 0)) / 2)
312
313
  return midPoint
313
314
  }
314
- export function project(lngLat) { // 经纬度转墨卡托像素坐标
315
+ export function project(lngLat, zoom=12) { // 经纬度转墨卡托像素坐标
315
316
  let [lng, lat] = lngLat
316
317
  let x = (180 + lng) / 360
317
318
  let y = (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360))) / 360
318
319
  return {
319
- x: x * Math.pow(2, 12) * 512,
320
- y: y * Math.pow(2, 12) * 512
320
+ x: x * Math.pow(2, zoom) * 512,
321
+ y: y * Math.pow(2, zoom) * 512
321
322
  }
322
323
  }
323
324
  export function addIcons2Map (map, icons) {
@@ -329,4 +330,27 @@ export function addIcons2Map (map, icons) {
329
330
  map.addImage(iconName, image)
330
331
  })
331
332
  })
333
+ }
334
+
335
+ export function getTaskTreeList(taskInfo, annotations, layers) {
336
+ let groups = _.cloneDeep(taskInfo.metadata?.groups || layerGroups)
337
+ groups.forEach(g => g.items = [])
338
+ annotations.forEach(item => {
339
+ let info = _.cloneDeep(item)
340
+ if (!info.group) {
341
+ info.group === 'annotation'
342
+ }
343
+ let groupItem = groups.find(d => d.id === info.group)
344
+ groupItem.items.push(info)
345
+ })
346
+ let lyrs = taskInfo.status === 'complete' ? layers : []
347
+ lyrs.forEach(d => {
348
+ let {group} = d
349
+ let groupItem = groups.find(d => d.id === group)
350
+ if (!groupItem.items) {
351
+ groupItem.items = []
352
+ }
353
+ groupItem.items.push(d)
354
+ })
355
+ return groups
332
356
  }