ry-vue-mapv3 0.0.7 → 0.0.9

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/dist/index.js CHANGED
@@ -903,10 +903,30 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
903
903
  const RyMapTool = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-dfd4cfff"]]);
904
904
  function ryMapHook(props) {
905
905
  let map = null;
906
+ let _services;
906
907
  vue.watch(
907
908
  () => props.center,
909
+ (val) => {
910
+ if (_services && val.length == 2) {
911
+ _services.setCenter(val);
912
+ }
913
+ },
914
+ { deep: true }
915
+ );
916
+ vue.watch(
917
+ () => props.bboxRange,
908
918
  (val) => {
909
919
  console.log("val===", val);
920
+ if (_services && val.length) {
921
+ _services.setBBOXRange(val);
922
+ }
923
+ },
924
+ { deep: true }
925
+ );
926
+ vue.watch(
927
+ () => props.bbox,
928
+ (val) => {
929
+ setFit(val);
910
930
  },
911
931
  { deep: true }
912
932
  );
@@ -932,7 +952,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
932
952
  viewOptions: getViewOptions(),
933
953
  callback: (_map, layers) => {
934
954
  map = _map;
935
- setFit(props.bbox);
955
+ _services = lMap;
956
+ if (props.bboxRange.length) {
957
+ lMap.setBBOXRange(props.bbox);
958
+ }
959
+ if (props && props.bbox.length) {
960
+ setFit(props.bbox);
961
+ }
936
962
  callback({
937
963
  map,
938
964
  mapServices: lMap,
@@ -1050,6 +1076,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1050
1076
  bingResolutionEvent(val);
1051
1077
  }
1052
1078
  );
1079
+ vue.watch(
1080
+ () => props.isMapSize,
1081
+ (val) => {
1082
+ updateMapSize();
1083
+ }
1084
+ );
1053
1085
  function getHit(evt) {
1054
1086
  if (evt.dragging) {
1055
1087
  return;
@@ -1204,6 +1236,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1204
1236
  view.un("change:resolution", resolutionFun);
1205
1237
  }
1206
1238
  }
1239
+ function updateMapSize() {
1240
+ if (!map) return;
1241
+ map.updateSize();
1242
+ }
1207
1243
  return {
1208
1244
  init,
1209
1245
  mapClickOnce,
@@ -1212,7 +1248,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1212
1248
  dblClick,
1213
1249
  setLastMapType,
1214
1250
  changeSwitch,
1215
- bingResolutionEvent
1251
+ bingResolutionEvent,
1252
+ updateMapSize
1216
1253
  };
1217
1254
  }
1218
1255
  const CollectionEventType = {
@@ -18337,6 +18374,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
18337
18374
  get DrawZIndex() {
18338
18375
  return this.drawZIndex;
18339
18376
  }
18377
+ setBBOXRange(number) {
18378
+ if (number.length === 1) {
18379
+ this.setCenter(number[0], 15);
18380
+ return;
18381
+ }
18382
+ const am = new ryMapts.AM();
18383
+ number.forEach((val) => {
18384
+ const [X, Y] = val;
18385
+ am.getLngAndLatMaxMin({
18386
+ X,
18387
+ Y
18388
+ });
18389
+ });
18390
+ const [x1, y1, x2, y2] = am.getLngLats();
18391
+ if (!x1[0] || !y1[0] || x2[0] === 400 || y2[0] === 400) return;
18392
+ this.fit([
18393
+ [x1, y1],
18394
+ [x2, y2]
18395
+ ]);
18396
+ }
18340
18397
  }
18341
18398
  let MapDto$1 = class MapDto {
18342
18399
  constructor() {
@@ -18471,6 +18528,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
18471
18528
  type: Number,
18472
18529
  default: 17
18473
18530
  });
18531
+ // 地图大小重置
18532
+ __publicField(this, "isMapSize", {
18533
+ type: Boolean,
18534
+ default: false
18535
+ });
18536
+ // bbox范围
18537
+ __publicField(this, "bboxRange", {
18538
+ type: Array,
18539
+ default: []
18540
+ });
18474
18541
  }
18475
18542
  };
18476
18543
  class MapDto {
@@ -21070,6 +21137,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21070
21137
  type: Boolean,
21071
21138
  default: true
21072
21139
  });
21140
+ // 异步加载KML时间默认100毫秒
21141
+ __publicField(this, "time", {
21142
+ type: Number,
21143
+ default: 100
21144
+ });
21073
21145
  }
21074
21146
  }
21075
21147
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
@@ -21129,7 +21201,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21129
21201
  }, 50);
21130
21202
  }
21131
21203
  };
21132
- const _insert = (dto) => {
21204
+ const _insert = async (dto) => {
21133
21205
  const {
21134
21206
  id,
21135
21207
  url: kmlUrl,
@@ -21157,6 +21229,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21157
21229
  extractStyles
21158
21230
  );
21159
21231
  url.value = kmlUrl;
21232
+ await kml.init(props.time);
21160
21233
  gcj02Url.value = kmlGcj02Url;
21161
21234
  setBBOXArr(bbox2);
21162
21235
  };
@@ -21263,6 +21336,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21263
21336
  type: Object,
21264
21337
  default: () => null
21265
21338
  });
21339
+ // 异步加载KML时间默认100毫秒
21340
+ __publicField(this, "time", {
21341
+ type: Number,
21342
+ default: 100
21343
+ });
21266
21344
  }
21267
21345
  }
21268
21346
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
@@ -21365,7 +21443,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21365
21443
  }, 50);
21366
21444
  }
21367
21445
  };
21368
- const _insert = (dto) => {
21446
+ const _insert = async (dto) => {
21369
21447
  const {
21370
21448
  id,
21371
21449
  url,
@@ -21379,6 +21457,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21379
21457
  gcj02Url
21380
21458
  } = dto;
21381
21459
  if (!kmlMap.value.has(id)) {
21460
+ console.log(dto);
21461
+ console.log(props.map);
21382
21462
  const lKml = new ryMapts.LKML(
21383
21463
  {
21384
21464
  id,
@@ -21393,6 +21473,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
21393
21473
  props.map,
21394
21474
  extractStyles
21395
21475
  );
21476
+ await lKml.init(props.time);
21396
21477
  kmlMap.value.set(id, lKml);
21397
21478
  urls.value.set(id, url);
21398
21479
  if (gcj02Url) {
package/dist/index.mjs CHANGED
@@ -902,10 +902,30 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
902
902
  const RyMapTool = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-dfd4cfff"]]);
903
903
  function ryMapHook(props) {
904
904
  let map = null;
905
+ let _services;
905
906
  watch(
906
907
  () => props.center,
908
+ (val) => {
909
+ if (_services && val.length == 2) {
910
+ _services.setCenter(val);
911
+ }
912
+ },
913
+ { deep: true }
914
+ );
915
+ watch(
916
+ () => props.bboxRange,
907
917
  (val) => {
908
918
  console.log("val===", val);
919
+ if (_services && val.length) {
920
+ _services.setBBOXRange(val);
921
+ }
922
+ },
923
+ { deep: true }
924
+ );
925
+ watch(
926
+ () => props.bbox,
927
+ (val) => {
928
+ setFit(val);
909
929
  },
910
930
  { deep: true }
911
931
  );
@@ -931,7 +951,13 @@ function ryMapHook(props) {
931
951
  viewOptions: getViewOptions(),
932
952
  callback: (_map, layers) => {
933
953
  map = _map;
934
- setFit(props.bbox);
954
+ _services = lMap;
955
+ if (props.bboxRange.length) {
956
+ lMap.setBBOXRange(props.bbox);
957
+ }
958
+ if (props && props.bbox.length) {
959
+ setFit(props.bbox);
960
+ }
935
961
  callback({
936
962
  map,
937
963
  mapServices: lMap,
@@ -1049,6 +1075,12 @@ function useMapEvent(props) {
1049
1075
  bingResolutionEvent(val);
1050
1076
  }
1051
1077
  );
1078
+ watch(
1079
+ () => props.isMapSize,
1080
+ (val) => {
1081
+ updateMapSize();
1082
+ }
1083
+ );
1052
1084
  function getHit(evt) {
1053
1085
  if (evt.dragging) {
1054
1086
  return;
@@ -1203,6 +1235,10 @@ function useMapEvent(props) {
1203
1235
  view.un("change:resolution", resolutionFun);
1204
1236
  }
1205
1237
  }
1238
+ function updateMapSize() {
1239
+ if (!map) return;
1240
+ map.updateSize();
1241
+ }
1206
1242
  return {
1207
1243
  init,
1208
1244
  mapClickOnce,
@@ -1211,7 +1247,8 @@ function useMapEvent(props) {
1211
1247
  dblClick,
1212
1248
  setLastMapType,
1213
1249
  changeSwitch,
1214
- bingResolutionEvent
1250
+ bingResolutionEvent,
1251
+ updateMapSize
1215
1252
  };
1216
1253
  }
1217
1254
  const CollectionEventType = {
@@ -18336,6 +18373,26 @@ class LMapServices {
18336
18373
  get DrawZIndex() {
18337
18374
  return this.drawZIndex;
18338
18375
  }
18376
+ setBBOXRange(number) {
18377
+ if (number.length === 1) {
18378
+ this.setCenter(number[0], 15);
18379
+ return;
18380
+ }
18381
+ const am = new AM();
18382
+ number.forEach((val) => {
18383
+ const [X, Y] = val;
18384
+ am.getLngAndLatMaxMin({
18385
+ X,
18386
+ Y
18387
+ });
18388
+ });
18389
+ const [x1, y1, x2, y2] = am.getLngLats();
18390
+ if (!x1[0] || !y1[0] || x2[0] === 400 || y2[0] === 400) return;
18391
+ this.fit([
18392
+ [x1, y1],
18393
+ [x2, y2]
18394
+ ]);
18395
+ }
18339
18396
  }
18340
18397
  let MapDto$1 = class MapDto {
18341
18398
  constructor() {
@@ -18470,6 +18527,16 @@ let MapDto$1 = class MapDto {
18470
18527
  type: Number,
18471
18528
  default: 17
18472
18529
  });
18530
+ // 地图大小重置
18531
+ __publicField(this, "isMapSize", {
18532
+ type: Boolean,
18533
+ default: false
18534
+ });
18535
+ // bbox范围
18536
+ __publicField(this, "bboxRange", {
18537
+ type: Array,
18538
+ default: []
18539
+ });
18473
18540
  }
18474
18541
  };
18475
18542
  class MapDto2 {
@@ -21069,6 +21136,11 @@ class RyKMLDto extends Base {
21069
21136
  type: Boolean,
21070
21137
  default: true
21071
21138
  });
21139
+ // 异步加载KML时间默认100毫秒
21140
+ __publicField(this, "time", {
21141
+ type: Number,
21142
+ default: 100
21143
+ });
21072
21144
  }
21073
21145
  }
21074
21146
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
@@ -21128,7 +21200,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
21128
21200
  }, 50);
21129
21201
  }
21130
21202
  };
21131
- const _insert = (dto) => {
21203
+ const _insert = async (dto) => {
21132
21204
  const {
21133
21205
  id,
21134
21206
  url: kmlUrl,
@@ -21156,6 +21228,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
21156
21228
  extractStyles
21157
21229
  );
21158
21230
  url.value = kmlUrl;
21231
+ await kml.init(props.time);
21159
21232
  gcj02Url.value = kmlGcj02Url;
21160
21233
  setBBOXArr(bbox2);
21161
21234
  };
@@ -21262,6 +21335,11 @@ class RyKMLDtoArr extends Base {
21262
21335
  type: Object,
21263
21336
  default: () => null
21264
21337
  });
21338
+ // 异步加载KML时间默认100毫秒
21339
+ __publicField(this, "time", {
21340
+ type: Number,
21341
+ default: 100
21342
+ });
21265
21343
  }
21266
21344
  }
21267
21345
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
@@ -21364,7 +21442,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
21364
21442
  }, 50);
21365
21443
  }
21366
21444
  };
21367
- const _insert = (dto) => {
21445
+ const _insert = async (dto) => {
21368
21446
  const {
21369
21447
  id,
21370
21448
  url,
@@ -21378,6 +21456,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
21378
21456
  gcj02Url
21379
21457
  } = dto;
21380
21458
  if (!kmlMap.value.has(id)) {
21459
+ console.log(dto);
21460
+ console.log(props.map);
21381
21461
  const lKml = new LKML(
21382
21462
  {
21383
21463
  id,
@@ -21392,6 +21472,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
21392
21472
  props.map,
21393
21473
  extractStyles
21394
21474
  );
21475
+ await lKml.init(props.time);
21395
21476
  kmlMap.value.set(id, lKml);
21396
21477
  urls.value.set(id, url);
21397
21478
  if (gcj02Url) {
@@ -16,4 +16,8 @@ export default class RyKMLDto extends Base {
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
+ time: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
19
23
  }
@@ -28,4 +28,8 @@ export default class RyKMLDtoArr extends Base {
28
28
  type: ObjectConstructor;
29
29
  default: () => null;
30
30
  };
31
+ time: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
31
35
  }
@@ -76,4 +76,12 @@ export default class MapDto {
76
76
  type: NumberConstructor;
77
77
  default: number;
78
78
  };
79
+ isMapSize: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ bboxRange: {
84
+ type: ArrayConstructor;
85
+ default: never[];
86
+ };
79
87
  }
@@ -16,6 +16,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
+ time: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
19
23
  map: {
20
24
  type: ObjectConstructor;
21
25
  default: () => null;
@@ -41,6 +45,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
41
45
  type: BooleanConstructor;
42
46
  default: boolean;
43
47
  };
48
+ time: {
49
+ type: NumberConstructor;
50
+ default: number;
51
+ };
44
52
  map: {
45
53
  type: ObjectConstructor;
46
54
  default: () => null;
@@ -52,6 +60,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
52
60
  }>> & Readonly<{}>, {
53
61
  map: Record<string, any>;
54
62
  clear: boolean;
63
+ time: number;
55
64
  gpsType: number;
56
65
  model: Record<string, any>;
57
66
  isShow: boolean;
@@ -28,6 +28,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
28
28
  type: ObjectConstructor;
29
29
  default: () => null;
30
30
  };
31
+ time: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
31
35
  map: {
32
36
  type: ObjectConstructor;
33
37
  default: () => null;
@@ -65,6 +69,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
65
69
  type: ObjectConstructor;
66
70
  default: () => null;
67
71
  };
72
+ time: {
73
+ type: NumberConstructor;
74
+ default: number;
75
+ };
68
76
  map: {
69
77
  type: ObjectConstructor;
70
78
  default: () => null;
@@ -76,6 +84,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
76
84
  }>> & Readonly<{}>, {
77
85
  map: Record<string, any>;
78
86
  clear: boolean;
87
+ time: number;
79
88
  gpsType: number;
80
89
  isFit: boolean;
81
90
  modelArr: unknown[];
@@ -728,6 +728,14 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
728
728
  type: NumberConstructor;
729
729
  default: number;
730
730
  };
731
+ isMapSize: {
732
+ type: BooleanConstructor;
733
+ default: boolean;
734
+ };
735
+ bboxRange: {
736
+ type: ArrayConstructor;
737
+ default: never[];
738
+ };
731
739
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
732
740
  changeSwitchMap: (...args: any[]) => void;
733
741
  loadDrawPolygonEvent: (...args: any[]) => void;
@@ -924,6 +932,14 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
924
932
  type: NumberConstructor;
925
933
  default: number;
926
934
  };
935
+ isMapSize: {
936
+ type: BooleanConstructor;
937
+ default: boolean;
938
+ };
939
+ bboxRange: {
940
+ type: ArrayConstructor;
941
+ default: never[];
942
+ };
927
943
  }>> & Readonly<{
928
944
  onChangeSwitchMap?: ((...args: any[]) => any) | undefined;
929
945
  onLoadDrawPolygonEvent?: ((...args: any[]) => any) | undefined;
@@ -982,6 +998,8 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
982
998
  isShowSwitchMap: boolean;
983
999
  resolution: boolean;
984
1000
  zoomedIn: number;
1001
+ isMapSize: boolean;
1002
+ bboxRange: unknown[];
985
1003
  }, {}, {}, {}, string, ComponentProvideOptions, true, {
986
1004
  mapTool: ({
987
1005
  $: ComponentInternalInstance;
@@ -146,4 +146,5 @@ export default class LMapServices {
146
146
  }): Promise<void>;
147
147
  set DrawZIndex(zIndex: number);
148
148
  get DrawZIndex(): number;
149
+ setBBOXRange(number: [][]): void;
149
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-mapv3",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"