@mapcatch/util 1.0.10 → 1.0.11

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.
@@ -8,4 +8,5 @@ export {default as layerIcons} from './layer_icons'
8
8
  export {default as taskParams} from './task_params'
9
9
  export {default as tools} from './tools'
10
10
  export {default as measurementFields} from './measurement_fields'
11
- export {default as crsTypes} from './crs_types'
11
+ export {default as crsTypes} from './crs_types'
12
+ export {default as crsList} from './crs'
package/src/util.js CHANGED
@@ -5,6 +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
9
 
9
10
  export function generateId() { // 生成随机id
10
11
  return uuidv4()
@@ -333,4 +334,33 @@ export function getRotationMatrix (pitch, roll, yaw) {
333
334
  }
334
335
  }
335
336
  return orientation
337
+ }
338
+
339
+ export function getWKTString(crs) {
340
+ let {type, epsg_code} = crs
341
+ for(let i = 0;i < crsList.length;i++) {
342
+ if (crsList[i].type !== type) {
343
+ continue
344
+ }
345
+ let {authCode, wkt, children} = crsList[i]
346
+ if (authCode == epsg_code) {
347
+ return wkt
348
+ }
349
+ if (children?.length) {
350
+ for(let j = 0;j < children.length;j++) {
351
+ if (children[j].children) {
352
+ for(let n = 0;n < children[j].children.length;n++) {
353
+ if (children[j].children[n].authCode == epsg_code) {
354
+ return children[j].children[n].wkt
355
+ }
356
+ }
357
+ } else {
358
+ if (children[j].authCode == epsg_code) {
359
+ return children[j].wkt
360
+ }
361
+ }
362
+ }
363
+ }
364
+ }
365
+ return null
336
366
  }
package/.eslintrc.js DELETED
@@ -1,53 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- node: true,
5
- browser: true,
6
- },
7
- extends: ['eslint:recommended'],
8
- parser: 'babel-eslint',
9
- rules: {
10
- 'no-extra-semi': 'error',
11
- 'no-console': ['error', { allow: ['warn', 'error'] }],
12
- quotes: [
13
- 'error',
14
- 'single',
15
- {
16
- avoidEscape: true,
17
- allowTemplateLiterals: true,
18
- },
19
- ],
20
- semi: ['error', 'never'],
21
- indent: [
22
- 'error',
23
- 2,
24
- {
25
- SwitchCase: 1,
26
- flatTernaryExpressions: true,
27
- },
28
- ],
29
- 'comma-dangle': ['error', 'never'],
30
- 'no-multi-spaces': [
31
- 'error',
32
- {
33
- ignoreEOLComments: true,
34
- },
35
- ],
36
- 'space-infix-ops': 'error',
37
- 'space-unary-ops': [
38
- 'error',
39
- {
40
- words: true,
41
- nonwords: false,
42
- },
43
- ],
44
- 'space-before-function-paren': 'error',
45
- },
46
- globals: {
47
- echarts: true,
48
- },
49
- parserOptions: {
50
- ecmaVersion: 7,
51
- sourceType: 'module',
52
- },
53
- }
package/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "semi": false
4
- }
package/debug/app.js DELETED
@@ -1,22 +0,0 @@
1
- import * as util from '../src/index.js'
2
-
3
- Vue.createApp({
4
- methods: {
5
- coustom() {
6
- },
7
- coustom2() {
8
- },
9
- async parsePhoto(e) {
10
- let file = e.target.files[0]
11
- let exif = await util.getPhotoMeta(file)
12
- console.log(exif)
13
- }
14
- },
15
- mounted() {
16
-
17
- },
18
- data() {
19
- return {
20
- }
21
- }
22
- }).mount('#app')
package/debug/index.html DELETED
@@ -1,52 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset=utf-8 />
5
- <title>Catch3d-js</title>
6
-
7
- <style>
8
- body {
9
- position: absolute;
10
- width: 100%;
11
- height: 100%;
12
- margin:0;
13
- padding:0;
14
- overflow: hidden;
15
- }
16
- #map {
17
- position: absolute;
18
- width: 100%;
19
- height: 100%;
20
- background-color: #000000;
21
- }
22
- .btn{
23
- position: absolute;
24
- z-index: 5;
25
- top: 20px;
26
- left: 220px;
27
- }
28
- .btn2{
29
- position: absolute;
30
- z-index: 5;
31
- top: 20px;
32
- left: 320px;
33
- }
34
- .btn3{
35
- position: absolute;
36
- z-index: 5;
37
- top: 20px;
38
- left: 20px;
39
- }
40
- </style>
41
- <script src="./libs/vue.global.js"></script>
42
- </head>
43
- <body>
44
- <div id="app">
45
- <div id='map'></div>
46
- <button class="btn" @click="coustom">测试1</button>
47
- <button class="btn2" @click="coustom2">测试2</button>
48
- <input class="btn3" type="file" @change="parsePhoto">
49
- </div>
50
- <script type='module' src="./app.js"></script>
51
- </body>
52
- </html>