ry-vue-map 0.2.1 → 0.2.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.
Files changed (43) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.js +999 -380
  3. package/lib/ryui.common.js.gz +0 -0
  4. package/lib/ryui.css +1 -1
  5. package/lib/ryui.umd.js +999 -380
  6. package/lib/ryui.umd.js.gz +0 -0
  7. package/lib/ryui.umd.min.js +5 -5
  8. package/lib/ryui.umd.min.js.gz +0 -0
  9. package/package.json +8 -3
  10. package/src/assets/map.png +0 -0
  11. package/src/assets/moveMarker.png +0 -0
  12. package/src/assets/startpoint.png +0 -0
  13. package/src/assets/stoppoint.png +0 -0
  14. package/src/components/index.js +3 -1
  15. package/src/components/maps/models/ryLines/ryLines.js +73 -0
  16. package/src/components/maps/models/ryMapTool/mapTool.js +7 -0
  17. package/src/components/maps/models/ryStaticMap/map.js +36 -0
  18. package/src/components/maps/models/ryStaticMap/view.js +66 -0
  19. package/src/components/maps/ryClusters/src/index.vue +4 -2
  20. package/src/components/maps/ryLines/index.js +7 -0
  21. package/src/components/maps/ryLines/src/index.vue +226 -0
  22. package/src/components/maps/ryMap/src/index.vue +5 -2
  23. package/src/components/maps/ryMapTool/src/index.vue +6 -6
  24. package/src/components/maps/ryPolygons/src/index.vue +67 -68
  25. package/src/components/maps/ryStaticMap/index.js +7 -0
  26. package/src/components/maps/ryStaticMap/src/index.vue +233 -0
  27. package/src/components/maps/ryUniMap/index.js +6 -0
  28. package/src/components/maps/ryUniMap/src/index.vue +351 -0
  29. package/src/components/maps/ryVectorMap/src/index.vue +1 -3
  30. package/src/components/maps/switchMap/src/newIndex.vue +39 -19
  31. package/src/router/index.js +30 -5
  32. package/src/utils/lMapServices.js +962 -918
  33. package/src/views/docx/index.vue +36 -0
  34. package/src/views/excel/index.vue +26 -0
  35. package/src/views/map/dksj.js +1103 -0
  36. package/src/views/map/index.vue +76 -205
  37. package/src/views/map/indexNew.vue +625 -0
  38. package/src/views/map/lineData.js +19592 -0
  39. package/src/views/map/lineData2.js +3449 -0
  40. package/src/views/pdf/index.vue +24 -0
  41. package/src/views/staticMap/index.vue +91 -0
  42. package/src/views/tree/index.vue +193 -0
  43. package/src/views/vectorMap/index.vue +26 -5
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-map",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "private": false,
5
5
  "main": "lib/ryui.umd.min.js",
6
6
  "description": "ry公共组件库",
@@ -32,14 +32,20 @@
32
32
  "@form-create/element-ui": "^2.5.20",
33
33
  "@turf/helpers": "^6.5.0",
34
34
  "@turf/line-intersect": "^6.5.0",
35
+ "@vue-office/docx": "^0.2.4",
36
+ "@vue-office/excel": "^0.2.4",
37
+ "@vue-office/pdf": "^0.2.4",
38
+ "@vue/composition-api": "^1.7.1",
35
39
  "axios": "~0.21.1",
36
40
  "core-js": "~3.15.2",
37
41
  "countup.js": "~2.0.7",
42
+ "dayjs": "^1.11.7",
38
43
  "element-ui": "~2.15.6",
39
44
  "nprogress": "~0.2.0",
40
45
  "ol": "^6.14.1",
41
- "ry-map": "^0.3.2",
46
+ "ry-map": "^0.3.8",
42
47
  "vue": "~2.6.14",
48
+ "vue-demi": "^0.13.11",
43
49
  "vue-router": "~3.5.2",
44
50
  "vue-server-renderer": "^2.6.14",
45
51
  "vuedraggable": "~2.24.3",
@@ -52,7 +58,6 @@
52
58
  "@vue/cli-plugin-router": "~4.4.6",
53
59
  "@vue/cli-plugin-vuex": "~4.4.6",
54
60
  "@vue/cli-service": "~4.4.6",
55
- "@vue/composition-api": "~1.2.2",
56
61
  "babel-eslint": "~10.1.0",
57
62
  "compression-webpack-plugin": "~6.1.1",
58
63
  "eslint": "~6.8.0",
Binary file
Binary file
Binary file
Binary file
@@ -8,10 +8,12 @@ import RyClusters from './maps/ryClusters';
8
8
  import RyClustersMarker from './maps/ryClustersMarker';
9
9
  import RyPolygonGeo from './maps/ryPolygonGeo';
10
10
  import RyVectorMap from './maps/ryVectorMap';
11
+ import RyLines from './maps/ryLines';
12
+ import RyStaticMap from './maps/ryStaticMap/index';
11
13
  // import "./fonts/iconfont.css";
12
14
 
13
15
  // 组件列表
14
- const components = [ RyMap,RyCrossHair,RyMapTool, RyPolygon,RyPolygons,RyClusters, RyPolygonGeo, RyClustersMarker,RyVectorMap];
16
+ const components = [RyMap,RyCrossHair,RyMapTool, RyPolygon,RyPolygons,RyClusters, RyPolygonGeo, RyClustersMarker,RyVectorMap,RyLines,RyStaticMap];
15
17
 
16
18
  // 定义install
17
19
  const install = (Vue, options) => {
@@ -0,0 +1,73 @@
1
+ import Base from './../base/base';
2
+
3
+ const _lineDto = {
4
+ color: 'red',
5
+ width: 2,
6
+ zIndex: 1,
7
+ };
8
+
9
+ export default class LineDto extends Base {
10
+
11
+ // 折线数据
12
+ model = {
13
+ type: Object,
14
+ default: () => null,
15
+ };
16
+
17
+ // 批量插入数据
18
+ linenIsert = {
19
+ type: Object,
20
+ default: () => null,
21
+ };
22
+
23
+ // 是否根据bbox 设为中心点
24
+ isLineFit = {
25
+ type: Boolean,
26
+ default: true,
27
+ };
28
+
29
+ // 追加点
30
+ lineAppend = {
31
+ type: Array,
32
+ default: () => [],
33
+ };
34
+
35
+ startMarkerDto = {
36
+ type: Object,
37
+ default: () => null,
38
+ };
39
+
40
+ // 结束marker数据结构
41
+
42
+ endMarkerDto = {
43
+ type: Object,
44
+ default: () => null
45
+ };
46
+
47
+ // 轨迹回放中心点数据结构
48
+
49
+ moveMarkerDto = {
50
+ type: Object,
51
+ default: () => null
52
+ };
53
+
54
+
55
+ clearLiens = {
56
+ type: Boolean,
57
+ default: false,
58
+ };
59
+
60
+
61
+ endMarkerPoint = {
62
+ type: Array,
63
+ default: () => []
64
+ };
65
+
66
+
67
+
68
+ lineDto = {
69
+ type: Object,
70
+ default: () => _lineDto
71
+ }
72
+
73
+ }
@@ -1,5 +1,12 @@
1
1
  export default class MapToolDto {
2
2
 
3
+
4
+ //是否显示地图中的
5
+ isHideAreaAndKM = {
6
+ type:Boolean,
7
+ default:false,
8
+ };
9
+
3
10
  //切换地图控件top值
4
11
  switchMapPosTop = {
5
12
  type:Number,
@@ -0,0 +1,36 @@
1
+ export default class MapDto {
2
+ constructor() {
3
+
4
+
5
+ this.isSwitchMapTool = {
6
+ type: Boolean,
7
+ default: true,
8
+ };
9
+
10
+ this.isRyMapTool = {
11
+ type: Boolean,
12
+ default: false,
13
+ };
14
+
15
+ this.isRight = {
16
+ type: Boolean,
17
+ default: false,
18
+ };
19
+
20
+ this.bindMapClick = {
21
+ type: Boolean,
22
+ default: false,
23
+ }
24
+
25
+
26
+ // 初始化编辑多边形
27
+ this.initModifyPolygon = {
28
+ type: [String, Object],
29
+ default: () => null,
30
+ };
31
+
32
+
33
+ }
34
+
35
+
36
+ }
@@ -0,0 +1,66 @@
1
+ const viewOptions = {
2
+ projection: 'EPSG:4326',
3
+ center: [116.40769, 39.89945],
4
+ zoom: 18
5
+ }
6
+
7
+ export default class MapDto {
8
+ constructor(opt) {
9
+
10
+ // 默认缩放率
11
+ this.zoom = {
12
+ type: Number,
13
+ default: 10,
14
+ };
15
+
16
+ // 最大缩放率
17
+ this.maxZoom = {
18
+ type: Number,
19
+ default: 28,
20
+ };
21
+
22
+ // 最小缩放率
23
+ this.minZoom = {
24
+ type: Number,
25
+ default: 1,
26
+ };
27
+
28
+ // 默认中心点数组
29
+ this.center = {
30
+ type: Array,
31
+ default: () => [2575, 1450],
32
+ };
33
+
34
+ // 二维数组 [[],[]] 根据多个中心点数组进行定位 fit 适合用于 多边形 marker 折线等
35
+ this.bbox = {
36
+ type: Array,
37
+ default: () => [],
38
+ };
39
+
40
+ this.url = {
41
+ type: String,
42
+ default: () => null,
43
+ };
44
+
45
+ this.imageSize={
46
+ type: Array,
47
+ default: () => [0, 0, 7247, 3562],
48
+ }
49
+ this.imageExtent={
50
+ type: Array,
51
+ default: () =>[500, 400, 5000, 2700],
52
+ }
53
+ // this.viewOptions = {
54
+ // type: Object,
55
+ // default: () => {
56
+ // return {
57
+ // projection: 'EPSG:4326',
58
+ // center: [116.40769, 39.89945],
59
+ // zoom: 18,
60
+ // minZoom:1,
61
+ // maxZoom:18
62
+ // };
63
+ // }
64
+ // }
65
+ }
66
+ }
@@ -11,7 +11,7 @@
11
11
  stroke: 'rgba(23, 168, 162, 0.56)',
12
12
  width: 3,
13
13
  // id:'ceshi',
14
- text:''
14
+ text:''
15
15
  };
16
16
  import {
17
17
  CheckPoint,
@@ -70,7 +70,7 @@
70
70
  checkPointArr: new Map(),
71
71
  currentArr: Array(),
72
72
  fpModelArr: [],
73
- featurePolygon: new FeaturePolygon(this.gpsType),
73
+ featurePolygon:null,
74
74
  multiPolygonMap: new Map(),
75
75
  // model: new multiPolygonGeoJsonModel(),
76
76
  scan: new GrahamScan(),
@@ -80,6 +80,7 @@
80
80
  beforeDestroy() {
81
81
  this.clear();
82
82
  },
83
+
83
84
  watch: {
84
85
  modelArr(data) {
85
86
  if (this.map) {
@@ -93,6 +94,7 @@
93
94
  }
94
95
  },
95
96
  created(){
97
+ this.featurePolygon = new FeaturePolygon(this.gpsType);
96
98
  this.clear();
97
99
  this.init();
98
100
  },
@@ -0,0 +1,7 @@
1
+ import RyLines from './src/index';
2
+
3
+ RyLines.install = (Vue) => {
4
+ Vue.install(RyLines.name, RyLines);
5
+ };
6
+
7
+ export default RyLines;
@@ -0,0 +1,226 @@
1
+ <template>
2
+ </template>
3
+
4
+ <script>
5
+ import {
6
+ Polyline,
7
+ LMarker,
8
+ getCenterPoint,
9
+ fitNew,
10
+ getLngAndLatMaxMin,
11
+ GPS,
12
+ AM,
13
+ } from 'ry-map';
14
+ import Dto from './../../models/ryLines/ryLines.js';
15
+ export default {
16
+ name: 'RyLines',
17
+ props: {
18
+ ...new Dto(),
19
+ },
20
+ data() {
21
+ return {
22
+ lines: null,
23
+ checkPoint: null,
24
+ bbox: [],
25
+ bboxGCJ02: [],
26
+ lastType: -1,
27
+ lastLinesDto: null,
28
+ moveMarker: null,
29
+ endMarker: null,
30
+ startMarker: null,
31
+ pineArr: [],
32
+ lastLineX: 0,
33
+ lastLineY: 0,
34
+ cachePointArr: new Array(),
35
+ drawingEnd: false,
36
+ isFist: true,
37
+ lastColor: null,
38
+ am: new AM()
39
+ };
40
+ },
41
+ watch: {
42
+ model(val) {
43
+ this.init();
44
+ },
45
+ linenIsert(val) {
46
+ if (!this.map || !val) return;
47
+ this._insertLineAndMarker(val);
48
+ },
49
+ gpsType(val) {
50
+
51
+ },
52
+ clearLiens(val) {
53
+ if (val) {
54
+ this.clearLine();
55
+ }
56
+ },
57
+ lineAppend(val) {
58
+ if (val.length > 0 && this.map) {
59
+ this.appendCoordinate(val);
60
+ this.setMarkerPoint(this.endMarker, val);
61
+ }
62
+ }
63
+ },
64
+ created() {
65
+ this.init();
66
+ },
67
+ methods: {
68
+ init() {
69
+ if (!this.map) return;
70
+ this.clearLine();
71
+ if (!this.model) return;
72
+ this.lastType = this.gpsType;
73
+ this._insertLineAndMarker(this.model);
74
+ },
75
+ _insertLineAndMarker(val) {
76
+ const color = val.color;
77
+ const arr = val.pointArr;
78
+ if (this.isLineFit) {
79
+ this.calculateLineBBOX(arr);
80
+ }
81
+ this.initMarker(arr[0]);
82
+ if (!val.isAppend || !this.pineArr.length) {
83
+ this._insertPoint(val);
84
+ const line = this.createPolyline(val);
85
+ const len = arr.length - 1;
86
+ this.setMarkerPoint(this.endMarker, arr[len]);
87
+ this.restLastData(arr);
88
+ this.pineArr.push(line);
89
+ return;
90
+ }
91
+ arr.forEach(r => {
92
+ this.appendCoordinate(r);
93
+ });
94
+ const len = arr.length - 1;
95
+ this.setMarkerPoint(this.endMarker, arr[len]);
96
+ this.restLastData(arr);
97
+ },
98
+ async calculateLineBBOX(arr) {
99
+ return await new Promise(r => {
100
+ arr.forEach(r => {
101
+ this.am.getLngAndLatMaxMin({
102
+ X: r[0],
103
+ Y: r[1]
104
+ });
105
+ });
106
+ const amGpsArr = this.am.getLngLats();
107
+ fitNew(this.map, [
108
+ [amGpsArr[0], amGpsArr[1]],
109
+ [amGpsArr[2], amGpsArr[3]]
110
+ ]);
111
+ r();
112
+ });
113
+ },
114
+ initMarker(arr) {
115
+
116
+ if (!this.startMarkerDto && !this.endMarkerDto) return;
117
+ if (!this.startMarker && !this.endMarker) {
118
+ this.startMarker = this.createStartMarker(this.startMarkerDto, arr);
119
+ this.endMarker = this.createStartMarker(this.endMarkerDto);
120
+ }
121
+ },
122
+ setMarkerPoint(marker, points) {
123
+ if (marker && points.length > 1) {
124
+ marker.setPosition(points, this.gpsType);
125
+ }
126
+ },
127
+ restLastData(arr) {
128
+ if (arr.length > 0) {
129
+ const [x, y] = arr[arr.length - 1];
130
+ this.lastLineX = x;
131
+ this.lastLineY = y;
132
+ }
133
+ },
134
+ _insertPoint(val) {
135
+ if (this.lastLineX > 0 && this.lastLineY > 0 && val) {
136
+ val.pointArr.unshift([this.lastLineX, this.lastLineY]);
137
+ }
138
+ },
139
+ createPolyline(polylineModel = {
140
+ color: 'rgb(0,0,255)',
141
+ width: 2,
142
+ pointArr: [],
143
+ zIndex: 1000,
144
+ }) {
145
+ return new Polyline({
146
+ ...polylineModel,
147
+ type: this.gpsType
148
+ }, this.map);
149
+ },
150
+
151
+ createStartMarker({
152
+ offset,
153
+ url,
154
+ width,
155
+ height
156
+ }, points = []) {
157
+ const marker = new LMarker(url, width, height);
158
+ marker.setOffset(offset);
159
+ if (points.length) {
160
+ marker.setPosition(points, this.gpsType);
161
+ }
162
+ this.map.addOverlay(marker.getMarker());
163
+ return marker;
164
+ },
165
+
166
+
167
+ getLngLatGCJ02(pointArr) {
168
+ const arr = [];
169
+ pointArr.forEach(r => {
170
+ const {
171
+ lon,
172
+ lat
173
+ } = GPS.gcj_encrypt(r[0], r[1]);
174
+ arr.push([lon, lat]);
175
+ });
176
+ return arr;
177
+ },
178
+
179
+ removeLines() {
180
+ this.pineArr.forEach(val => {
181
+ val.removePolyline();
182
+ });
183
+ this.pineArr = [];
184
+ },
185
+ removeLineMarker() {
186
+ if (!this.map) return;
187
+ if (this.endMarker) {
188
+ this.map.removeOverlay(this.endMarker.getMarker());
189
+ }
190
+ if (this.startMarker) {
191
+ this.map.removeOverlay(this.startMarker.getMarker());
192
+ }
193
+ if (this.moveMarker) {
194
+ this.map.removeOverlay(this.moveMarker.getMarker());
195
+ }
196
+ this.moveMarker = null;
197
+ this.endMarker = null;
198
+ this.startMarker = null;
199
+ },
200
+ clearLine() {
201
+ this.removeLines();
202
+ this.removeLineMarker();
203
+ this.cachePointArr = [];
204
+ this.lastColor = null;
205
+ this.lastLineX = 0;
206
+ this.lastLineY = 0;
207
+ this.am = null;
208
+ this.am = new AM();
209
+ },
210
+ appendCoordinate(coordinate = []) {
211
+ if (!coordinate.length) return;
212
+ if (!this.pineArr.length) {
213
+ this._insertLineAndMarker({...this.lineDto,pointArr:[coordinate],isAppend: false});
214
+ };
215
+ const line = this.pineArr[this.pineArr.length - 1];
216
+ line.appendCoordinate(coordinate);
217
+ },
218
+ selectGPSAll(type) {
219
+
220
+ },
221
+ }
222
+ }
223
+ </script>
224
+
225
+ <style>
226
+ </style>
@@ -171,6 +171,7 @@
171
171
  type: this.mapType,
172
172
  layerType: this.layerType,
173
173
  viewOptions: this.getViewOptions(),
174
+
174
175
  callback: (map,layers) => {
175
176
  this.map = map;
176
177
 
@@ -282,7 +283,8 @@
282
283
  m,
283
284
  oversteSetValue: m >= this.m ? true : false,
284
285
  x,
285
- y
286
+ y,
287
+ e
286
288
  });
287
289
 
288
290
  if (m >= this.m) {
@@ -295,7 +297,8 @@
295
297
  m,
296
298
  oversteSetValue: false,
297
299
  x,
298
- y
300
+ y,
301
+ e
299
302
  });
300
303
  }
301
304
  if (isMoveend) {
@@ -90,9 +90,9 @@
90
90
  isCrossHair(val) {
91
91
  this.isCrossHair = val;
92
92
  },
93
- gpsType(val){
94
- if(this.lastType == val) return;
95
- this.gpsType=val;
93
+ gpsType(val){
94
+ if(this.lastType == val) return;
95
+ this.gpsType=val;
96
96
  this.lastType=val;
97
97
  if(this.drawPolygon){
98
98
  this.drawPolygon.type=val;
@@ -104,7 +104,7 @@
104
104
  data() {
105
105
  return {
106
106
  drawPolygon: null,
107
- isEdit:true,
107
+ isEdit:true,
108
108
  lastType:-1,
109
109
  };
110
110
  },
@@ -122,7 +122,7 @@
122
122
  bbox
123
123
  } = this._serializeGeoJson();
124
124
  this.onDelete();
125
- this.drawPolygon = this.lMap.onCreatePolygon(() => {});
125
+ this.drawPolygon = this.lMap.onCreatePolygon(() => {},this.isHideAreaAndKM);
126
126
  this.lastType=this.gpsType;
127
127
  this.drawPolygon.type= this.gpsType;
128
128
  this.drawPolygon.initCoordinates(coordinates);
@@ -159,7 +159,7 @@
159
159
  onCreatePolygon() {
160
160
  if (this.lMap) {
161
161
  // this.drawPolygon=null;
162
- this.drawPolygon = this.lMap.onCreatePolygon(() => {});
162
+ this.drawPolygon = this.lMap.onCreatePolygon(() => {},this.isHideAreaAndKM);
163
163
  this.lastType=this.gpsType;
164
164
  this.drawPolygon.type=this.gpsType;
165
165
  this.$emit('loadDrawPolygonEvent', this);