xy-map 1.0.60 → 1.1.1

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.
Files changed (68) hide show
  1. package/demo.html +1 -0
  2. package/{src/image/marker.png → img/marker.42b5782a.png} +0 -0
  3. package/package.json +11 -47
  4. package/xy-map.common.js +67645 -0
  5. package/xy-map.css +1 -0
  6. package/xy-map.umd.js +67664 -0
  7. package/xy-map.umd.min.js +20 -0
  8. package/.browserslistrc +0 -3
  9. package/.eslintignore +0 -1
  10. package/.eslintrc.js +0 -29
  11. package/README.md +0 -36
  12. package/babel.config.js +0 -3
  13. package/jsconfig.json +0 -12
  14. package/lint-staged.config.js +0 -3
  15. package/public/draco/README.md +0 -32
  16. package/public/draco/draco_decoder.js +0 -52
  17. package/public/draco/draco_decoder.wasm +0 -0
  18. package/public/draco/draco_encoder.js +0 -33
  19. package/public/draco/draco_wasm_wrapper.js +0 -104
  20. package/public/draco/gltf/draco_decoder.js +0 -48
  21. package/public/draco/gltf/draco_decoder.wasm +0 -0
  22. package/public/draco/gltf/draco_encoder.js +0 -33
  23. package/public/draco/gltf/draco_wasm_wrapper.js +0 -104
  24. package/public/favicon.ico +0 -0
  25. package/public/img/MM.png +0 -0
  26. package/public/img/MM_D.png +0 -0
  27. package/public/img/MM_W.png +0 -0
  28. package/public/img/loading.gif +0 -0
  29. package/public/img/waternormals.jpg +0 -0
  30. package/public/index.html +0 -29
  31. package/src/App.vue +0 -13
  32. package/src/image/arrow_white.png +0 -0
  33. package/src/image/map_end.png +0 -0
  34. package/src/image/map_start.png +0 -0
  35. package/src/index.js +0 -154
  36. package/src/layers/Line.js +0 -203
  37. package/src/layers/Point.js +0 -384
  38. package/src/layers/Polygon.js +0 -119
  39. package/src/layers/Text.js +0 -53
  40. package/src/layers/circle.js +0 -148
  41. package/src/layers/circleAnimate.js +0 -147
  42. package/src/layers/index.js +0 -128
  43. package/src/layers/model copy.js +0 -314
  44. package/src/layers/model.js +0 -341
  45. package/src/layers/scene.js +0 -314
  46. package/src/layers/water.js +0 -239
  47. package/src/map.js +0 -486
  48. package/src/package/draw/index.vue +0 -239
  49. package/src/package/draw/line.vue +0 -172
  50. package/src/package/draw/point.vue +0 -152
  51. package/src/package/draw/polygon.vue +0 -172
  52. package/src/package/draw/shpFile.vue +0 -49
  53. package/src/package/draw/styles.js +0 -162
  54. package/src/package/mapFullScreen.vue +0 -105
  55. package/src/package/mapLoad.vue +0 -120
  56. package/src/package/mapMarker.vue +0 -50
  57. package/src/package/mapModel.vue +0 -69
  58. package/src/package/mapRain.vue +0 -110
  59. package/src/style/hoverHtml.css +0 -29
  60. package/src/style/main.scss +0 -186
  61. package/src/style/map.css +0 -7
  62. package/src/util/gaodeApi.js +0 -67
  63. package/src/util/mapEvent.js +0 -111
  64. package/src/util/mapHoverHtml.js +0 -59
  65. package/src/util/mapTools.js +0 -169
  66. package/src/util/measure-area.js +0 -215
  67. package/src/util/measure-distance.js +0 -600
  68. package/vue.config.js +0 -32
@@ -1,172 +0,0 @@
1
- <template>
2
- <div id="fullScreen"
3
- class="full-height relative overflow">
4
- <div id="map"
5
- class="full-height"></div>
6
-
7
- <draw-tools ref="draw"
8
- :list="['polygon']"
9
- :single="single"
10
- :showFullBtn="showFullBtn"
11
- :showMoveInput="showMoveInput"
12
- @update="drawUpdate"
13
- @end="drawUpdate"
14
- @clear="clear">
15
- <div class="mt-15 ">
16
- <el-input :value="position.toString()"
17
- size="small"
18
- placeholder="点击地图获取坐标"
19
- :readonly="readonly"
20
- style="width: 300px; margin-right: 10px;"></el-input>
21
-
22
- <shp-file @upload="getShp"
23
- v-if="upload"></shp-file>
24
-
25
- <el-button type="primary"
26
- size="small"
27
- @click="save">保存</el-button>
28
- </div>
29
- </draw-tools>
30
- </div>
31
- </template>
32
-
33
- <script>
34
- import { mapSdk } from '../../index.js'
35
- import drawTools from './index.vue'
36
- import shpFile from './shpFile.vue'
37
-
38
- export default {
39
- components: {
40
- drawTools,
41
- shpFile
42
- },
43
- props: {
44
- config: {
45
- type: Object,
46
- default: () => { }
47
- },
48
- single: {
49
- type: Boolean,
50
- default: false
51
- },
52
- autoZoom: { // 自动缩放适应边界
53
- type: Boolean,
54
- default: false
55
- },
56
- readonly: {
57
- type: Boolean,
58
- default: true
59
- },
60
- upload: {
61
- type: Boolean,
62
- default: false
63
- },
64
- geoData: {
65
- type: [Object, String],
66
- default: ''
67
- },
68
- pointList: {
69
- type: [Array, String],
70
- default: ''
71
- },
72
- showFullBtn: { // 全屏按钮
73
- type: Boolean,
74
- default: true,
75
- },
76
- showMoveInput: { // 移动定位输入框
77
- type: Boolean,
78
- default: false,
79
- }
80
- },
81
- data () {
82
- return {
83
- geoJson: '',
84
- position: '',
85
- }
86
- },
87
- watch: {
88
- pointList () {
89
- this.draw()
90
- },
91
- geoData () {
92
- this.draw()
93
- }
94
- },
95
- mounted () {
96
- this.init()
97
- },
98
- methods: {
99
- init () {
100
- let config = Object.assign({}, {
101
- accessToken: 'pk.eyJ1IjoiaGo0NjI3NzEzOTYiLCJhIjoiY2w5YzNjOTZvMDF6NDNwb2d6YmJkYWRpMCJ9.-fW-OChGB1oY2DCMO_c8sg',
102
- zoom: 14,
103
- center: [102.83643451528434, 24.81972792178513],
104
- is3d: false,
105
- }, this.config)
106
- mapSdk.initMap(config).then(map => {
107
- this.$refs.draw.initDraw(map)
108
- this.draw()
109
- })
110
- },
111
- draw () {
112
- if (this.pointList && this.pointList.length > 0) {
113
- let features = this.pointList.map(item => {
114
- return {
115
- 'type': 'Feature',
116
- 'geometry': {
117
- 'type': 'Polygon',
118
- 'coordinates': [item]
119
- },
120
- 'properties': {}
121
- }
122
- })
123
- this.geoJson = {
124
- 'type': 'FeatureCollection',
125
- 'features': features
126
- }
127
- } else {
128
- this.geoJson = this.geoData
129
- }
130
- this.drawUpdate(this.geoJson, true)
131
- this.edit()
132
- },
133
- edit () { // 开启编辑
134
- if (this.geoJson) {
135
- this.$refs.draw.drawEdit(this.geoJson)
136
- }
137
- },
138
- drawUpdate (data, autoZoom = false) {
139
- if (!data) return
140
- this.geoJson = data
141
- this.position = data.features.map(item => item.geometry.coordinates[0])
142
-
143
- if (this.autoZoom || autoZoom) {
144
- this.$nextTick(() => {
145
- const bounds = this.position.flat() // 二维数组转一维数组
146
- mapSdk.fitLineBounds(bounds, {
147
- padding: 100
148
- })
149
- })
150
- }
151
- },
152
- save () {
153
- let data = {
154
- geoJson: this.geoJson,
155
- position: this.position
156
- }
157
- console.log(data)
158
- this.$emit('save', data)
159
- },
160
- clear () {
161
- this.geoJson = ''
162
- this.position = ''
163
- },
164
- getShp (shp) {
165
- console.log(shp)
166
- this.$refs.draw.clear() // 先清空画布
167
- this.drawUpdate(shp, true)
168
- this.edit()
169
- }
170
- }
171
- }
172
- </script>
@@ -1,49 +0,0 @@
1
- <template>
2
- <el-button size="small"
3
- class="upload"
4
- type="warning">
5
- shp上传
6
- <input class="file"
7
- type="file"
8
- accept=".json"
9
- @change="getFile" />
10
- </el-button>
11
- </template>
12
-
13
- <script>
14
- export default {
15
- data () {
16
- return {}
17
- },
18
- methods: {
19
- getFile (e) {
20
- const file = e.target.files ? e.target.files[0] : ''
21
- if (file) {
22
- let reader = new FileReader()
23
- reader.readAsText(file, 'UTF-8')
24
- reader.onload = (f) => {
25
- let json = f.target.result
26
- if (json) {
27
- json = JSON.parse(json)
28
- this.$emit('upload', json)
29
- }
30
- }
31
- }
32
- }
33
- }
34
- }
35
- </script>
36
-
37
- <style lang="scss" scoped>
38
- .upload {
39
- position: relative;
40
- input {
41
- position: absolute;
42
- width: 100%;
43
- height: 100%;
44
- left: 0;
45
- top: 0;
46
- opacity: 0;
47
- }
48
- }
49
- </style>
@@ -1,162 +0,0 @@
1
- export default [
2
- // 绘制点图标
3
- {
4
- 'id': 'points-are-blue',
5
- 'type': 'symbol',
6
- 'filter': ['all',
7
- ['==', '$type', 'Point'],
8
- ['==', 'meta', 'feature'],
9
- ['==', 'active', 'false']
10
- ],
11
- 'layout': { // 设置绘制后显示的点图标
12
- 'icon-image': 'Point',
13
- 'icon-size': 0.6,
14
- /* 图标大小 */
15
- 'icon-offset': [0, -15],
16
- 'icon-ignore-placement': true, //图标忽略位置
17
- // 'text-field': ['get', this.props.title], /* 使用text标签显示的值,Feature属性使用{域名}格式*/
18
- 'text-anchor': 'top', // 图标与锚点的位置关系
19
- },
20
- 'paint': {
21
- 'text-color': '#fff',
22
- }
23
- },
24
- // ACTIVE (being drawn)
25
- // line stroke
26
- {
27
- id: 'gl-draw-line',
28
- type: 'line',
29
- filter: ['all', ['==', '$type', 'LineString'],
30
- ['!=', 'mode', 'static']
31
- ],
32
- layout: {
33
- 'line-cap': 'round',
34
- 'line-join': 'round',
35
- },
36
- paint: {
37
- 'line-color': '#409eff',
38
- // 'line-dasharray': [0.8, 2],
39
- 'line-width': 4,
40
- },
41
- },
42
- // polygon fill
43
- {
44
- id: 'gl-draw-polygon-fill',
45
- type: 'fill',
46
- filter: ['all', ['==', '$type', 'Polygon'],
47
- ['!=', 'mode', 'static']
48
- ],
49
- paint: {
50
- 'fill-color': '#409eff',
51
- 'fill-outline-color': '#409eff',
52
- 'fill-opacity': 0.1,
53
- },
54
- },
55
- // polygon mid points
56
- {
57
- id: 'gl-draw-polygon-midpoint',
58
- type: 'circle',
59
- filter: ['all', ['==', '$type', 'Point'],
60
- ['==', 'meta', 'midpoint']
61
- ],
62
- paint: {
63
- 'circle-radius': 4,
64
- 'circle-color': '#fbb03b',
65
- },
66
- },
67
- // polygon outline stroke
68
- // This doesn't style the first edge of the polygon, which uses the line stroke styling instead
69
- {
70
- id: 'gl-draw-polygon-stroke-active',
71
- type: 'line',
72
- filter: ['all', ['==', '$type', 'Polygon'],
73
- ['!=', 'mode', 'static']
74
- ],
75
- layout: {
76
- 'line-cap': 'round',
77
- 'line-join': 'round',
78
- },
79
- paint: {
80
- 'line-color': '#409eff',
81
- // 'line-dasharray': [0.8, 2],
82
- 'line-width': 4,
83
- },
84
- },
85
- // vertex point halos
86
- {
87
- id: 'gl-draw-polygon-and-line-vertex-halo-active',
88
- type: 'circle',
89
- filter: [
90
- 'all',
91
- ['==', 'meta', 'vertex'],
92
- ['==', '$type', 'Point'],
93
- ['!=', 'mode', 'static'],
94
- ],
95
- paint: {
96
- 'circle-radius': 5,
97
- 'circle-color': '#FFF',
98
- },
99
- },
100
- // vertex points
101
- {
102
- id: 'gl-draw-polygon-and-line-vertex-active',
103
- type: 'circle',
104
- filter: [
105
- 'all',
106
- ['==', 'meta', 'vertex'],
107
- ['==', '$type', 'Point'],
108
- ['!=', 'mode', 'static'],
109
- ],
110
- paint: {
111
- 'circle-radius': 4,
112
- 'circle-color': '#409eff',
113
- },
114
- },
115
-
116
- // INACTIVE (static, already drawn)
117
- // line stroke
118
- {
119
- id: 'gl-draw-line-static',
120
- type: 'line',
121
- filter: ['all', ['==', '$type', 'LineString'],
122
- ['==', 'mode', 'static']
123
- ],
124
- layout: {
125
- 'line-cap': 'round',
126
- 'line-join': 'round',
127
- },
128
- paint: {
129
- 'line-color': '#000',
130
- 'line-width': 4,
131
- },
132
- },
133
- // polygon fill
134
- {
135
- id: 'gl-draw-polygon-fill-static',
136
- type: 'fill',
137
- filter: ['all', ['==', '$type', 'Polygon'],
138
- ['==', 'mode', 'static']
139
- ],
140
- paint: {
141
- 'fill-color': '#000',
142
- 'fill-outline-color': '#000',
143
- 'fill-opacity': 0.1,
144
- },
145
- },
146
- // polygon outline
147
- {
148
- id: 'gl-draw-polygon-stroke-static',
149
- type: 'line',
150
- filter: ['all', ['==', '$type', 'Polygon'],
151
- ['==', 'mode', 'static']
152
- ],
153
- layout: {
154
- 'line-cap': 'round',
155
- 'line-join': 'round',
156
- },
157
- paint: {
158
- 'line-color': '#000',
159
- 'line-width': 4,
160
- },
161
- },
162
- ]
@@ -1,105 +0,0 @@
1
- <template>
2
- <span>
3
- <span v-if="isSlot"
4
- @click="handleFullScreen"
5
- :title="isFullScreen ? '退出全屏' : '进入全屏'">
6
- <slot></slot>
7
- </span>
8
- <span v-else
9
- @click="handleFullScreen"
10
- :title="isFullScreen ? '退出全屏' : '进入全屏'">
11
- <i class="el-icon-full-screen mr-5"></i>
12
- {{ isFullScreen ? '退出全屏' : '全屏' }}
13
- </span>
14
- </span>
15
- </template>
16
-
17
- <script>
18
- export default {
19
- props: {
20
- isSlot: {
21
- type: Boolean,
22
- default: false
23
- },
24
- dom: {
25
- type: String,
26
- default: ''
27
- }
28
- },
29
- data () {
30
- return {
31
- isFullScreen: false,
32
- }
33
- },
34
- watch: {
35
- isFullScreen (val) {
36
- this.$emit('change', val)
37
- }
38
- },
39
- methods: {
40
- // 全屏
41
- handleFullScreen () {
42
- let mapMainContent
43
- // 判断是否有dom传入,没有则是整个页面全屏展示
44
- this.dom ? mapMainContent = document.getElementById(this.dom) : mapMainContent = document.documentElement
45
- if (this.isFUllScreenEnabled()) {
46
- if (this.hasFullScreenElement()) {
47
- this.exitFullScreen()
48
- this.isFullScreen = false
49
- } else {
50
- this.setFullScreen(mapMainContent)
51
- this.isFullScreen = true
52
- }
53
- } else {
54
- console.log('此浏览器不支持全屏')
55
- }
56
- },
57
- // 判断浏览器是否支持全屏
58
- isFUllScreenEnabled () {
59
- return document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled
60
- },
61
- // 判断是否有已全屏的元素
62
- hasFullScreenElement () {
63
- return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement
64
- },
65
- // 将目标元素设置为全屏展示
66
- setFullScreen (target) {
67
- if (target.requestFullscreen) {
68
- target.requestFullscreen()
69
- }
70
- if (target.webkitRequestFullscreen) {
71
- target.webkitRequestFullscreen()
72
- }
73
- if (target.mozRequestFullScreen) {
74
- target.mozRequestFullScreen()
75
- }
76
- if (target.msRequestFullscreen) {
77
- target.msRequestFullscreen()
78
- }
79
- },
80
- // 文档退出全屏
81
- exitFullScreen () {
82
- if (document.exitFullscreen) {
83
- document.exitFullscreen()
84
- }
85
- if (document.webkitExitFullscreen) {
86
- document.webkitExitFullscreen()
87
- }
88
- if (document.mozCancelFullScreen) {
89
- document.mozCancelFullScreen()
90
- }
91
- if (document.msExitFullscreen) {
92
- document.msExitFullscreen()
93
- }
94
- }
95
- }
96
- }
97
- </script>
98
-
99
- <style lang="scss" scoped>
100
- :fullscreen {
101
- .d {
102
- color: red;
103
- }
104
- }
105
- </style>
@@ -1,120 +0,0 @@
1
- <template>
2
- <div class="mapLoad flex flex-col flex-align-center"
3
- :class="{'loadOver' : !show}">
4
- <img src="/img/loading.gif"
5
- style="margin-top: 10%"
6
- width="400" />
7
-
8
- <div class="text-center"
9
- style="width: 400px; margin-top: -90px">
10
- <div class="mb-20">正在努力加载中...{{progress.toFixed(0)}}%</div>
11
- <div class="progress-wrap">
12
- <div class="progress-inner">
13
- <div class="progress-nums"
14
- :style="`width: ${progress}%`"></div>
15
- </div>
16
- </div>
17
- </div>
18
-
19
- </div>
20
- </template>
21
-
22
- <script>
23
- export default {
24
- props: {
25
- loading: { // 是否在加载
26
- type: Boolean,
27
- default: true,
28
- },
29
- loadTime: { // 等待时长,毫秒
30
- type: Number,
31
- default: 5000,
32
- }
33
- },
34
- data () {
35
- return {
36
- progress: 0,
37
- timer: '',
38
- show: true,
39
- }
40
- },
41
- watch: {
42
- loading: {
43
- handler (val) {
44
- if (!val) {
45
- this.show = false
46
- this.progress = 100
47
- window.clearInterval(this.timer)
48
- }
49
- },
50
- immediate: true,
51
- }
52
- },
53
- destroyed () {
54
- window.clearInterval(this.timer)
55
- },
56
- created () {
57
- this.timer = setInterval(() => {
58
- this.progress += 3
59
- if (this.progress >= 99) {
60
- window.clearInterval(this.timer)
61
- }
62
- }, this.loadTime / 30)
63
- }
64
- }
65
- </script>
66
-
67
- <style lang="scss" scoped>
68
- .mapLoad {
69
- position: absolute;
70
- width: 100%;
71
- height: 100%;
72
- top: 0;
73
- left: 0;
74
- background-color: #d5f2fd;
75
- z-index: 99999999;
76
- transition: all 0.5s;
77
- opacity: 1;
78
- overflow: hidden;
79
- }
80
- .loadOver {
81
- opacity: 0;
82
- pointer-events: none;
83
- }
84
-
85
- /*进度条*/
86
- .progress-wrap {
87
- width: 100%;
88
- height: 12px;
89
- border-radius: 8px;
90
- position: relative;
91
- }
92
- /*进度条底层背景样式*/
93
- .progress-inner {
94
- height: inherit;
95
- background: rgba(142, 193, 255, 0.2);
96
- border-radius: 8px;
97
- }
98
- /*进度层样式效果,使用动画效果*/
99
- .progress-nums {
100
- height: inherit;
101
- border-radius: 6px;
102
- background: repeating-linear-gradient(
103
- -45deg,
104
- #008bdd 25%,
105
- #49beff 0,
106
- #49beff 50%,
107
- #008bdd 0,
108
- #008bdd 75%,
109
- #49beff 0
110
- );
111
- background-size: 16px 16px;
112
- animation: panoramic 30s linear infinite;
113
- }
114
- /*定义动画*/
115
- @keyframes panoramic {
116
- to {
117
- background-position: 200% 0;
118
- }
119
- }
120
- </style>
@@ -1,50 +0,0 @@
1
- <template>
2
- <div ref="dom">
3
- <slot></slot>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- import mapBoxGl from 'mapbox-gl'
9
- import { mapSdk } from '../index.js'
10
-
11
- export default {
12
- props: {
13
- map: {
14
- type: Object,
15
- default: () => { }
16
- },
17
- position: {
18
- type: Array,
19
- default: () => []
20
- },
21
- drag: {
22
- type: Boolean,
23
- default: false
24
- }
25
- },
26
- data () {
27
- return {
28
- }
29
- },
30
- mounted () {
31
- this.createdMarker()
32
- },
33
- methods: {
34
- createdMarker () {
35
- let { map } = mapSdk
36
- let el = this.$refs.dom
37
- const marker = new mapBoxGl.Marker(el, { draggable: this.drag }).setLngLat(this.position).addTo(map)
38
- if (this.drag) {
39
- marker.on('dragend', () => {
40
- const lngLat = marker.getLngLat()
41
- this.$emit('dragEnd', lngLat)
42
- })
43
- }
44
- }
45
- }
46
- }
47
- </script>
48
-
49
- <style lang="scss" scoped>
50
- </style>