@mapcatch/util 1.0.14 → 1.0.15-a

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,13 +1,13 @@
1
1
  {
2
2
  "name": "@mapcatch/util",
3
- "version": "1.0.14",
3
+ "version": "1.0.15-a",
4
4
  "main": "./dist/catchUtil.min.esm.js",
5
5
  "repository": "",
6
6
  "author": "wanyanyan",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "build": "vite build",
10
- "start": "vite --host",
10
+ "start": "vite --host --port 5174",
11
11
  "lint": "eslint src/ --fix",
12
12
  "format": "prettier-eslint --write src/*.js"
13
13
  },
@@ -3,17 +3,17 @@ export default {
3
3
  point: [
4
4
  {
5
5
  field: 'lng',
6
- label: '经度',
6
+ label: '经度(X)',
7
7
  unit: ''
8
8
  },
9
9
  {
10
10
  field: 'lat',
11
- label: '纬度',
11
+ label: '纬度(Y)',
12
12
  unit: ''
13
13
  },
14
14
  {
15
15
  field: 'height',
16
- label: '高程',
16
+ label: '高程(Z)',
17
17
  unit: 'm'
18
18
  }
19
19
  ],
package/src/util.js CHANGED
@@ -5,7 +5,7 @@ import cameras from './constants/cameras'
5
5
  import {getType, distance as calcDistance, midpoint as getMidpoint} from '@turf/turf'
6
6
  import { layerGroups } from './constants'
7
7
  import { mat4 } from 'gl-matrix'
8
- import { crsList } from './constants'
8
+ import { crsList, crsTypes } from './constants'
9
9
 
10
10
  export function generateId() { // 生成随机id
11
11
  return uuidv4()
@@ -279,7 +279,7 @@ export function project(lngLat, zoom=12) { // 经纬度转墨卡托像素坐标
279
279
  export function addIcons2Map (map, icons) {
280
280
  icons.forEach(({url, sdf}) => {
281
281
  map.loadImage(url, (error, image) => {
282
- let iconName = path.split('/').pop().split('.')[0]
282
+ let iconName = url.split('/').pop().split('.')[0]
283
283
  if(map.hasImage(iconName)) return
284
284
  if (error) throw error
285
285
  map.addImage(iconName, image, {sdf})
@@ -339,7 +339,8 @@ export function getRotationMatrix (pitch, roll, yaw) {
339
339
  export function getWKTString(crs) {
340
340
  let {type, epsg_code} = crs
341
341
  for(let i = 0;i < crsList.length;i++) {
342
- if (crsList[i].type !== type) {
342
+ let typeCode = crsTypes[crsList[i].type].code
343
+ if (typeCode !== type) {
343
344
  continue
344
345
  }
345
346
  let {authCode, wkt, children} = crsList[i]