@vtx/map 1.1.43 → 1.1.45

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 (65) hide show
  1. package/lib/VtxMap/AMap/AMap.js +1012 -640
  2. package/lib/VtxMap/AMap/AMap.js.map +1 -1
  3. package/lib/VtxMap/BMap/Map.js +1197 -749
  4. package/lib/VtxMap/BMap/Map.js.map +1 -1
  5. package/lib/VtxMap/GMap/Map.js +1564 -1046
  6. package/lib/VtxMap/GMap/Map.js.map +1 -1
  7. package/lib/VtxMap/Map.js +42 -8
  8. package/lib/VtxMap/Map.js.map +1 -1
  9. package/lib/VtxMap/MapToolFunction.js +63 -26
  10. package/lib/VtxMap/MapToolFunction.js.map +1 -1
  11. package/lib/VtxMap/OMap/Map.js +1361 -867
  12. package/lib/VtxMap/OMap/Map.js.map +1 -1
  13. package/lib/VtxMap/OlMap/Map.js +1289 -699
  14. package/lib/VtxMap/OlMap/Map.js.map +1 -1
  15. package/lib/VtxMap/TMap/TMap.js +1058 -651
  16. package/lib/VtxMap/TMap/TMap.js.map +1 -1
  17. package/lib/VtxMap/index.js +8 -1
  18. package/lib/VtxMap/index.js.map +1 -1
  19. package/lib/VtxMap/mapPlayer.js +123 -67
  20. package/lib/VtxMap/mapPlayer.js.map +1 -1
  21. package/lib/VtxMap/optimizingPointMap.js +77 -21
  22. package/lib/VtxMap/optimizingPointMap.js.map +1 -1
  23. package/lib/VtxMap/style/css.js +6 -0
  24. package/lib/VtxMap/style/css.js.map +1 -1
  25. package/lib/VtxMap/style/index.js +6 -0
  26. package/lib/VtxMap/style/index.js.map +1 -1
  27. package/lib/VtxMap/zoomMap.js +41 -12
  28. package/lib/VtxMap/zoomMap.js.map +1 -1
  29. package/lib/VtxModal/VtxModal.js +63 -19
  30. package/lib/VtxModal/VtxModal.js.map +1 -1
  31. package/lib/VtxModal/draggableModal.js +48 -12
  32. package/lib/VtxModal/draggableModal.js.map +1 -1
  33. package/lib/VtxModal/index.js +6 -1
  34. package/lib/VtxModal/index.js.map +1 -1
  35. package/lib/VtxModal/style/css.js +6 -0
  36. package/lib/VtxModal/style/css.js.map +1 -1
  37. package/lib/VtxModal/style/index.js +6 -0
  38. package/lib/VtxModal/style/index.js.map +1 -1
  39. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js +238 -105
  40. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js.map +1 -1
  41. package/lib/VtxSearchCheckMap/index.js +2 -0
  42. package/lib/VtxSearchCheckMap/index.js.map +1 -1
  43. package/lib/VtxSearchCheckMap/mapping.js +2 -1
  44. package/lib/VtxSearchCheckMap/mapping.js.map +1 -1
  45. package/lib/VtxSearchCheckMap/style/css.js +19 -0
  46. package/lib/VtxSearchCheckMap/style/css.js.map +1 -1
  47. package/lib/VtxSearchCheckMap/style/index.js +19 -0
  48. package/lib/VtxSearchCheckMap/style/index.js.map +1 -1
  49. package/lib/VtxSearchMap/VtxSearchMap.js +289 -120
  50. package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
  51. package/lib/VtxSearchMap/index.js +2 -0
  52. package/lib/VtxSearchMap/index.js.map +1 -1
  53. package/lib/VtxSearchMap/mapping.js +2 -1
  54. package/lib/VtxSearchMap/mapping.js.map +1 -1
  55. package/lib/VtxSearchMap/style/css.js +19 -0
  56. package/lib/VtxSearchMap/style/css.js.map +1 -1
  57. package/lib/VtxSearchMap/style/index.js +19 -0
  58. package/lib/VtxSearchMap/style/index.js.map +1 -1
  59. package/lib/default.js +13 -4
  60. package/lib/default.js.map +1 -1
  61. package/lib/index.js +3 -0
  62. package/lib/index.js.map +1 -1
  63. package/lib/utils/util.js +94 -0
  64. package/lib/utils/util.js.map +1 -0
  65. package/package.json +1 -1
@@ -1,45 +1,80 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _button = _interopRequireDefault(require("antd/lib/button"));
13
+
10
14
  var _input = _interopRequireDefault(require("antd/lib/input"));
15
+
11
16
  var _message = _interopRequireDefault(require("antd/lib/message"));
17
+
12
18
  var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
19
+
13
20
  var _popover = _interopRequireDefault(require("antd/lib/popover"));
21
+
14
22
  var _VtxModal = require("../VtxModal");
23
+
15
24
  var _VtxMap = require("../VtxMap");
25
+
16
26
  var _default2 = _interopRequireWildcard(require("../default"));
27
+
17
28
  var _mapping = require("./mapping");
18
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
29
+
30
+ var _util = require("../utils/util");
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
20
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37
+
21
38
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
39
+
40
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
41
+
42
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43
+
24
44
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
45
+
46
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
47
+
26
48
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
49
+
27
50
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
51
+
28
52
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
53
+
29
54
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
55
+
30
56
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
57
+
31
58
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
59
+
32
60
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
61
+
33
62
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
36
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
63
+
64
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
65
+
37
66
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
67
+
38
68
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
69
+
39
70
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
71
+
40
72
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
73
+
41
74
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
42
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } //公共地址配置
75
+
76
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
77
+
43
78
  var styles = {
44
79
  searchModal: 'vtx-ui-searchmap-searchmodal',
45
80
  searchMap: 'vtx-ui-searchmap-searchmap',
@@ -61,17 +96,18 @@ var styles = {
61
96
  hiddenLabel: 'vtx-ui-searchmap-hiddenlabel',
62
97
  otherModal: 'vtx-ui-searchmap-othermodal',
63
98
  mapTxt: 'vtx-ui-searchmap-mapTxt'
64
- };
65
-
66
- // message.config({
99
+ }; // message.config({
67
100
  // top: document.getElementById('root').offsetHeight/3,
68
101
  // duration: 5,
69
102
  // });
103
+
70
104
  var warning = function warning() {
71
105
  _message["default"].warning('位置点查询失败,请缩小比例尺或切换关键字后再重新查询!');
72
106
  };
107
+
73
108
  function distinct(ary) {
74
109
  var pts = _toConsumableArray(ary);
110
+
75
111
  if (pts[0][0] == pts[pts.length - 1][0] && pts[0][1] == pts[pts.length - 1][1]) {
76
112
  pts.pop();
77
113
  return distinct(pts);
@@ -79,24 +115,31 @@ function distinct(ary) {
79
115
  return pts;
80
116
  }
81
117
  }
118
+
82
119
  var getIcon = function getIcon(type) {
83
120
  return _default2.antdMajorVersion === '4' ? /*#__PURE__*/_react["default"].createElement(_default2.VtxMapIcon, {
84
121
  type: "icon-".concat(_mapping.iconMapping[type])
85
122
  }) : type;
86
123
  };
124
+
87
125
  var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
88
126
  _inherits(VtxSearchMap, _React$Component);
127
+
89
128
  var _super = _createSuper(VtxSearchMap);
129
+
90
130
  function VtxSearchMap(props) {
91
131
  var _this;
132
+
92
133
  _classCallCheck(this, VtxSearchMap);
134
+
93
135
  _this = _super.call(this, props);
94
- // 绘制多个图元时返回参数
136
+
95
137
  _defineProperty(_assertThisInitialized(_this), "getMultiRes", function (graphicType) {
96
138
  var resData = [];
97
139
  var _this$state = _this.state,
98
- graphicValue = _this$state.graphicValue,
99
- editGraphic = _this$state.editGraphic;
140
+ graphicValue = _this$state.graphicValue,
141
+ editGraphic = _this$state.editGraphic;
142
+
100
143
  switch (graphicType) {
101
144
  case 'polygon':
102
145
  [].concat(_toConsumableArray(graphicValue || []), _toConsumableArray(editGraphic || [])).forEach(function (item) {
@@ -106,6 +149,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
106
149
  });
107
150
  });
108
151
  break;
152
+
109
153
  case 'polyline':
110
154
  [].concat(_toConsumableArray(graphicValue || []), _toConsumableArray(editGraphic || [])).forEach(function (item) {
111
155
  resData.push({
@@ -113,21 +157,25 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
113
157
  length: _this.map.calculateDistance(item.paths || item.geometry.paths)
114
158
  });
115
159
  });
160
+
116
161
  default:
117
162
  break;
118
163
  }
164
+
119
165
  return resData.length ? resData : null;
120
166
  });
167
+
121
168
  _this.map = null; //Map组件的ref对象
169
+
122
170
  _this.mapLoaded = false;
123
171
  _this.isDrawStatus = false;
124
172
  _this.isClickMap = false;
125
173
  _this.apid = []; //所有点id,除编辑点外
174
+
126
175
  _this.loadExtent = null;
127
176
  _this.mapId = "searchMap".concat(new Date().getTime());
128
177
  _this.multiDraw = props.multiDraw && ['polygon', 'polyline'].includes(props.graphicType);
129
- _this.clickable = false,
130
- // 多个面绘制时,是否可以点击面进行编辑
178
+ _this.clickable = false, // 多个面绘制时,是否可以点击面进行编辑
131
179
  _this.state = {
132
180
  //列表和地图宽度切换的动画需要
133
181
  isShowList: false,
@@ -146,6 +194,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
146
194
  graphicValue: _this.multiDraw ? [] : null,
147
195
  // 绘制图元id集合
148
196
  drawGraphID: _this.multiDraw ? ['drawnGraph'] : 'drawnGraph',
197
+
149
198
  /*地图Api参数*/
150
199
  mapCenter: props.mapCenter || '',
151
200
  maxZoom: props.maxZoom,
@@ -166,6 +215,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
166
215
  editGraphic: _this.multiDraw ? [] : null,
167
216
  mapZoomLevel: props.mapZoomLevel || 11,
168
217
  setZoomLevel: false,
218
+
169
219
  /*modal参数*/
170
220
  modal1Visible: props.modal1Visible || false,
171
221
  isShowOther: props.isShowOther || false,
@@ -179,28 +229,35 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
179
229
  showControl: props.showControl || false
180
230
  };
181
231
  return _this;
182
- }
232
+ } // 绘制多个图元时返回参数
233
+
234
+
183
235
  _createClass(VtxSearchMap, [{
184
236
  key: "callback",
185
- value:
186
- //经纬度回调
237
+ value: //经纬度回调
187
238
  function callback() {
188
239
  var fun = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'callback';
240
+
189
241
  if (fun in this.props && typeof this.props[fun] === 'function') {
190
242
  var editGraphicId = this.state.editGraphicId;
243
+
191
244
  switch (this.state.graphicType) {
192
245
  case 'point':
193
246
  var locationPoint = this.state.locationPoint;
247
+
194
248
  if (this.map.getGraphic('locationPoint')) {
195
249
  var p = this.map.getGraphic(locationPoint[0].id).geometry;
196
250
  this.props[fun]([p.x, p.y]);
197
251
  } else {
198
252
  return [];
199
253
  }
254
+
200
255
  break;
256
+
201
257
  case 'circle':
202
258
  if (this.map.getGraphic(editGraphicId)) {
203
259
  var _p = this.map.getGraphic(editGraphicId);
260
+
204
261
  this.props[fun]({
205
262
  x: _p.geometry.x,
206
263
  y: _p.geometry.y,
@@ -215,14 +272,18 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
215
272
  area: this.state.graphicValue.area
216
273
  } : null);
217
274
  }
275
+
218
276
  break;
277
+
219
278
  case 'polygon':
220
279
  if (this.multiDraw) {
221
280
  this.props[fun](this.getMultiRes('polygon'));
222
281
  return;
223
282
  }
283
+
224
284
  if (this.map.getGraphic(editGraphicId)) {
225
285
  var _p2 = this.map.getGraphic(editGraphicId);
286
+
226
287
  this.props[fun]({
227
288
  rings: distinct(_p2.geometry.rings),
228
289
  area: this.map.getPolygonArea(distinct(_p2.geometry.rings))
@@ -233,20 +294,25 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
233
294
  area: this.state.graphicValue.area
234
295
  } : null);
235
296
  }
297
+
236
298
  break;
299
+
237
300
  case 'rectangle':
238
301
  this.props[fun](this.state.graphicValue ? {
239
302
  rings: distinct(this.state.graphicValue.geometry.rings),
240
303
  area: this.state.graphicValue.area
241
304
  } : null);
242
305
  break;
306
+
243
307
  case 'polyline':
244
308
  if (this.multiDraw) {
245
309
  this.props[fun](this.getMultiRes('polyline'));
246
310
  return;
247
311
  }
312
+
248
313
  if (this.map.getGraphic(editGraphicId)) {
249
314
  var _p3 = this.map.getGraphic(editGraphicId);
315
+
250
316
  this.props[fun]({
251
317
  paths: _p3.geometry.paths,
252
318
  length: this.map.calculateDistance(_p3.geometry.paths)
@@ -257,9 +323,11 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
257
323
  length: this.map.calculateDistance(this.state.graphicValue.geometry.paths)
258
324
  } : null);
259
325
  }
326
+
260
327
  break;
261
328
  }
262
329
  }
330
+
263
331
  if (this.props.clearDrawnGraph) {
264
332
  this.clearDrawnGraph();
265
333
  }
@@ -270,17 +338,18 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
270
338
  this.setState({
271
339
  isShowList: bealoon
272
340
  });
273
- }
274
- //绘制定位点(以当前的中心点位参照 => 同时开启点位编辑)
341
+ } //绘制定位点(以当前的中心点位参照 => 同时开启点位编辑)
342
+
275
343
  }, {
276
344
  key: "drawLocationPoint",
277
345
  value: function drawLocationPoint() {
278
- var t = this;
279
- //判断arcgis,是: 判断中心点是否已经确定,确定,继续走逻辑.不确认.轮询等待
346
+ var t = this; //判断arcgis,是: 判断中心点是否已经确定,确定,继续走逻辑.不确认.轮询等待
347
+
280
348
  if (this.props.mapType !== 'gmap' || this.map.state.gis.extent && !!this.map.state.gis.extent.xmax) {
281
349
  var lglt = this.map.getMapExtent(),
282
- editGraphic = null,
283
- editGraphicId = 'locationPoint';
350
+ editGraphic = null,
351
+ editGraphicId = 'locationPoint';
352
+
284
353
  if (!this.multiDraw && this.props.editParam) {
285
354
  // && (this.props.graphicType == 'polyline' || this.props.graphicType == 'polygon')
286
355
  editGraphic = _objectSpread(_objectSpread({}, this.props.editParam), {}, {
@@ -288,6 +357,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
288
357
  });
289
358
  editGraphicId = 'drawnGraph';
290
359
  }
360
+
291
361
  if (this.multiDraw && Array.isArray(this.props.editParam) && this.props.editParam.length) {
292
362
  // && (this.props.graphicType == 'polyline' || this.props.graphicType == 'polygon')
293
363
  editGraphic = this.props.editParam.map(function (item, index) {
@@ -297,6 +367,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
297
367
  });
298
368
  editGraphicId = null;
299
369
  }
370
+
300
371
  this.isinit = false;
301
372
  this.setState({
302
373
  editGraphic: editGraphic,
@@ -327,13 +398,13 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
327
398
  t.drawLocationPoint();
328
399
  }, 50);
329
400
  }
330
- }
331
- //校正定位的点位位置到当前的中心点
401
+ } //校正定位的点位位置到当前的中心点
402
+
332
403
  }, {
333
404
  key: "correction",
334
405
  value: function correction() {
335
- var t = this;
336
- //获取当前中心点经纬度
406
+ var t = this; //获取当前中心点经纬度
407
+
337
408
  var lglt = this.map.getMapExtent();
338
409
  var locationPoint = t.state.locationPoint;
339
410
  locationPoint = locationPoint.map(function (item, index) {
@@ -343,57 +414,96 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
343
414
  });
344
415
  });
345
416
  this.map.updatePoint(locationPoint);
346
- }
347
- //搜索关键字切换
417
+ } //搜索关键字切换
418
+
348
419
  }, {
349
420
  key: "changeValue",
350
421
  value: function changeValue(e) {
351
422
  this.setState({
352
423
  searchValue: e.target.value
353
424
  });
354
- }
355
- //根据关键字搜索数据
425
+ } //根据关键字搜索数据
426
+
356
427
  }, {
357
428
  key: "searchList",
358
429
  value: function searchList() {
359
- //因为antd组件问题,这边使用手动关键位,控制方法执行
360
430
  var t = this;
361
- var searchPoints = t.map.searchPoints(this.state.searchValue);
362
- searchPoints.then(function (results) {
363
- if (results.length > 0) {
364
- var lsp = [],
431
+
432
+ if (window.AMap) {
433
+ t.searchPoints();
434
+ } else {
435
+ $.getScript("//webapi.amap.com/maps?v=1.4.14&key=e59ef9272e3788ac59d9a22f0f8cf9fe&plugin=AMap.PlaceSearch", function () {
436
+ t.searchPoints();
437
+ });
438
+ }
439
+ }
440
+ }, {
441
+ key: "searchPoints",
442
+ value: function searchPoints() {
443
+ var t = this;
444
+ var psc = new AMap.PlaceSearch({
445
+ pageSize: 10,
446
+ pageIndex: 1
447
+ });
448
+ psc.search(this.state.searchValue, function (status, result) {
449
+ var list = result.poiList.pois.map(function (r) {
450
+ var lnglat = (0, _util.transform)(r.location, t.state.mapType);
451
+ return {
452
+ id: r.id,
453
+ longitude: lnglat.lng,
454
+ latitude: lnglat.lat,
455
+ canShowLabel: true,
456
+ config: {
457
+ labelContent: r.name,
458
+ labelPixelY: 27
459
+ },
460
+ other: 'search'
461
+ };
462
+ });
463
+ t.handleSearch(list);
464
+ });
465
+ }
466
+ }, {
467
+ key: "handleSearch",
468
+ value: function handleSearch(results) {
469
+ var t = this;
470
+
471
+ if (results.length > 0) {
472
+ var lsp = [],
365
473
  lsm = [];
366
- t.apid = [];
367
- for (var i = 0; i < results.length; i++) {
368
- var r = results[i];
369
- lsp.push(_objectSpread(_objectSpread({}, results[i]), {}, {
370
- // url: `${configUrl.mapServerURL}/images/defaultMarker_selected.png`,
371
- url: require("../VtxMap/images/defaultMarker_selected.png"),
372
- labelClass: styles.hiddenLabel
373
- }));
374
- lsm.push({
375
- id: r.id,
376
- title: r.config.labelContent,
377
- isSelect: false
378
- });
379
- t.apid.push(r.id);
380
- }
381
- t.setState({
382
- listPoint: lsp,
383
- listMess: lsm,
384
- isShowList: true
474
+ t.apid = [];
475
+
476
+ for (var i = 0; i < results.length; i++) {
477
+ var r = results[i];
478
+ lsp.push(_objectSpread(_objectSpread({}, results[i]), {}, {
479
+ // url: `${configUrl.mapServerURL}/images/defaultMarker_selected.png`,
480
+ url: require("../VtxMap/images/defaultMarker_selected.png"),
481
+ labelClass: styles.hiddenLabel
482
+ }));
483
+ lsm.push({
484
+ id: r.id,
485
+ title: r.config.labelContent,
486
+ isSelect: false
385
487
  });
386
- t.setFitView();
387
- } else {
388
- warning();
488
+ t.apid.push(r.id);
389
489
  }
390
- });
391
- }
392
- //返回最佳位置(zoom,center)
490
+
491
+ t.setState({
492
+ listPoint: lsp,
493
+ listMess: lsm,
494
+ isShowList: true
495
+ });
496
+ t.setFitView();
497
+ } else {
498
+ warning();
499
+ }
500
+ } //返回最佳位置(zoom,center)
501
+
393
502
  }, {
394
503
  key: "setFitView",
395
504
  value: function setFitView() {
396
505
  var _this2 = this;
506
+
397
507
  this.setState({
398
508
  mapVisiblePoints: {
399
509
  fitView: this.apid,
@@ -405,8 +515,8 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
405
515
  setVisiblePoints: false
406
516
  });
407
517
  });
408
- }
409
- //清空列表的所有数据(包括点位)
518
+ } //清空列表的所有数据(包括点位)
519
+
410
520
  }, {
411
521
  key: "clearList",
412
522
  value: function clearList() {
@@ -417,15 +527,15 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
417
527
  listMess: [],
418
528
  isShowList: false
419
529
  });
420
- }
421
- //列表选中地址
530
+ } //列表选中地址
531
+
422
532
  }, {
423
533
  key: "chooseAddress",
424
534
  value: function chooseAddress(id) {
425
535
  var t = this;
426
536
  var _this$state2 = this.state,
427
- listPoint = _this$state2.listPoint,
428
- listMess = _this$state2.listMess;
537
+ listPoint = _this$state2.listPoint,
538
+ listMess = _this$state2.listMess;
429
539
  var mapCenter = [];
430
540
  listPoint = listPoint.map(function (item, index) {
431
541
  if (item.id === id) {
@@ -461,6 +571,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
461
571
  t.setState({
462
572
  setCenter: false
463
573
  });
574
+
464
575
  if (t.state.graphicType == 'point') {
465
576
  t.correction();
466
577
  }
@@ -470,11 +581,14 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
470
581
  key: "clickGraphic",
471
582
  value: function clickGraphic(obj) {
472
583
  var _this3 = this;
584
+
473
585
  if (obj.type === 'point' && obj.attributes.other === 'search') {
474
586
  this.chooseAddress(obj.attributes.id);
475
587
  }
588
+
476
589
  if (this.clickable && ['polygon', 'polyline'].includes(obj.type)) {
477
590
  var _obj$param$attributes;
591
+
478
592
  // 开启编辑
479
593
  this.setState({
480
594
  editGraphicId: obj.param.id || ((_obj$param$attributes = obj.param.attributes) === null || _obj$param$attributes === void 0 ? void 0 : _obj$param$attributes.id),
@@ -491,6 +605,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
491
605
  value: function closeModal(e) {
492
606
  this.isDrawStatus = false;
493
607
  this.isClickMap = false;
608
+
494
609
  if (this.isDrawStatus && this.isClickMap) {
495
610
  _message["default"].warning('请双击结束图元编辑');
496
611
  } else {
@@ -500,16 +615,17 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
500
615
  this.setState({
501
616
  modal1Visible: false
502
617
  });
503
- }
504
- // if(this.props.clearDrawnGraph){
505
- this.clearDrawnGraph();
506
- // }
618
+ } // if(this.props.clearDrawnGraph){
619
+
620
+
621
+ this.clearDrawnGraph(); // }
507
622
  }
508
623
  }
509
624
  }, {
510
625
  key: "clearDrawnGraph",
511
626
  value: function clearDrawnGraph() {
512
627
  var _this4 = this;
628
+
513
629
  this.isDrawStatus = true;
514
630
  this.setState({
515
631
  isDraw: this.state.graphicType !== 'point',
@@ -525,6 +641,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
525
641
  key: "continueDraw",
526
642
  value: function continueDraw(func) {
527
643
  var _this5 = this;
644
+
528
645
  this.clickable = false;
529
646
  this.setState({
530
647
  isDraw: false,
@@ -547,11 +664,15 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
547
664
  key: "editGraphic",
548
665
  value: function editGraphic() {
549
666
  var _this6 = this;
667
+
550
668
  if (this.isDrawStatus && this.isClickMap) {
551
669
  _message["default"].warning('请双击结束图元编辑');
670
+
552
671
  return;
553
672
  }
673
+
554
674
  _message["default"].info('请点击图元进行编辑');
675
+
555
676
  this.clickable = true;
556
677
  this.isDrawStatus = false;
557
678
  this.setState({
@@ -571,8 +692,8 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
571
692
  value: function editGraphicChange(obj) {
572
693
  if (!this.multiDraw) return;
573
694
  var _this$state3 = this.state,
574
- graphicValue = _this$state3.graphicValue,
575
- editGraphic = _this$state3.editGraphic;
695
+ graphicValue = _this$state3.graphicValue,
696
+ editGraphic = _this$state3.editGraphic;
576
697
  this.setState({
577
698
  graphicValue: (graphicValue || []).map(function (item) {
578
699
  return item.id === obj.id ? obj : item;
@@ -591,6 +712,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
591
712
  currentMap: str
592
713
  });
593
714
  var layers = [];
715
+
594
716
  switch (mapType) {
595
717
  case 'amap':
596
718
  case 'bmap':
@@ -600,9 +722,12 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
600
722
  } else {
601
723
  t.map.setMapType('wx');
602
724
  }
725
+
603
726
  break;
727
+
604
728
  case 'gmap':
605
729
  break;
730
+
606
731
  default:
607
732
  break;
608
733
  }
@@ -611,40 +736,41 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
611
736
  key: "render",
612
737
  value: function render() {
613
738
  var _this7 = this;
739
+
614
740
  var t = this;
615
741
  var _this$state4 = this.state,
616
- isShowList = _this$state4.isShowList,
617
- searchValue = _this$state4.searchValue,
618
- locationPoint = _this$state4.locationPoint,
619
- listPoint = _this$state4.listPoint,
620
- listMess = _this$state4.listMess,
621
- mapZoomLevel = _this$state4.mapZoomLevel,
622
- setZoomLevel = _this$state4.setZoomLevel,
623
- maxZoom = _this$state4.maxZoom,
624
- minZoom = _this$state4.minZoom,
625
- wkid = _this$state4.wkid,
626
- mapServer = _this$state4.mapServer,
627
- mapCenter = _this$state4.mapCenter,
628
- setCenter = _this$state4.setCenter,
629
- mapType = _this$state4.mapType,
630
- mapStyle = _this$state4.mapStyle,
631
- mapVisiblePoints = _this$state4.mapVisiblePoints,
632
- setVisiblePoints = _this$state4.setVisiblePoints,
633
- isDoEdit = _this$state4.isDoEdit,
634
- editGraphicId = _this$state4.editGraphicId,
635
- isEndEdit = _this$state4.isEndEdit,
636
- modal1Visible = _this$state4.modal1Visible,
637
- drawGraphID = _this$state4.drawGraphID,
638
- isShowOther = _this$state4.isShowOther,
639
- otherText = _this$state4.otherText,
640
- isShowOtherGraph = _this$state4.isShowOtherGraph,
641
- editGraphic = _this$state4.editGraphic,
642
- graphicType = _this$state4.graphicType,
643
- graphicValue = _this$state4.graphicValue,
644
- olProps = _this$state4.olProps,
645
- isChangeMapType = _this$state4.isChangeMapType,
646
- currentMap = _this$state4.currentMap,
647
- showControl = _this$state4.showControl;
742
+ isShowList = _this$state4.isShowList,
743
+ searchValue = _this$state4.searchValue,
744
+ locationPoint = _this$state4.locationPoint,
745
+ listPoint = _this$state4.listPoint,
746
+ listMess = _this$state4.listMess,
747
+ mapZoomLevel = _this$state4.mapZoomLevel,
748
+ setZoomLevel = _this$state4.setZoomLevel,
749
+ maxZoom = _this$state4.maxZoom,
750
+ minZoom = _this$state4.minZoom,
751
+ wkid = _this$state4.wkid,
752
+ mapServer = _this$state4.mapServer,
753
+ mapCenter = _this$state4.mapCenter,
754
+ setCenter = _this$state4.setCenter,
755
+ mapType = _this$state4.mapType,
756
+ mapStyle = _this$state4.mapStyle,
757
+ mapVisiblePoints = _this$state4.mapVisiblePoints,
758
+ setVisiblePoints = _this$state4.setVisiblePoints,
759
+ isDoEdit = _this$state4.isDoEdit,
760
+ editGraphicId = _this$state4.editGraphicId,
761
+ isEndEdit = _this$state4.isEndEdit,
762
+ modal1Visible = _this$state4.modal1Visible,
763
+ drawGraphID = _this$state4.drawGraphID,
764
+ isShowOther = _this$state4.isShowOther,
765
+ otherText = _this$state4.otherText,
766
+ isShowOtherGraph = _this$state4.isShowOtherGraph,
767
+ editGraphic = _this$state4.editGraphic,
768
+ graphicType = _this$state4.graphicType,
769
+ graphicValue = _this$state4.graphicValue,
770
+ olProps = _this$state4.olProps,
771
+ isChangeMapType = _this$state4.isChangeMapType,
772
+ currentMap = _this$state4.currentMap,
773
+ showControl = _this$state4.showControl;
648
774
  var InputProps = {
649
775
  style: {
650
776
  'width': '200px'
@@ -669,9 +795,11 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
669
795
  isDoEdit: !_this7.multiDraw,
670
796
  isDraw: _this7.multiDraw
671
797
  };
798
+
672
799
  if (!_this7.multiDraw && (obj.geometryType == 'polyline' || obj.geometryType == 'polygon')) {
673
800
  objparam.editGraphicId = obj.id;
674
801
  }
802
+
675
803
  _this7.setState(objparam);
676
804
  },
677
805
  mapDraw: {
@@ -703,42 +831,51 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
703
831
  }
704
832
  };
705
833
  var mapPoints = [],
706
- mapLines = [],
707
- mapPolygons = [],
708
- mapCircles = [];
834
+ mapLines = [],
835
+ mapPolygons = [],
836
+ mapCircles = [];
837
+
709
838
  if (graphicType == 'point') {
710
839
  mapPoints = [].concat(_toConsumableArray(locationPoint), _toConsumableArray(listPoint));
711
840
  } else {
712
841
  mapPoints = _toConsumableArray(listPoint);
713
842
  }
843
+
714
844
  if (graphicType === 'polygon') {
715
845
  if (editGraphic) {
716
846
  var _mapPolygons;
847
+
717
848
  Array.isArray(editGraphic) ? (_mapPolygons = mapPolygons).push.apply(_mapPolygons, _toConsumableArray(editGraphic)) : mapPolygons.push(editGraphic);
718
849
  !this.multiDraw && (drawProps = null);
719
850
  }
720
851
  }
852
+
721
853
  if (graphicType === 'polyline') {
722
854
  if (editGraphic) {
723
855
  var _mapLines;
856
+
724
857
  Array.isArray(editGraphic) ? (_mapLines = mapLines).push.apply(_mapLines, _toConsumableArray(editGraphic)) : mapLines.push(editGraphic);
725
858
  !this.multiDraw && (drawProps = null);
726
859
  }
727
860
  }
861
+
728
862
  if (graphicType === 'rectangle') {
729
863
  if (editGraphic) {
730
864
  mapPolygons.push(editGraphic);
731
865
  drawProps = null;
732
866
  }
733
867
  }
868
+
734
869
  if (graphicType === 'circle') {
735
870
  if (editGraphic) {
736
871
  mapCircles.push(editGraphic);
737
872
  drawProps = null;
738
873
  }
739
874
  }
875
+
740
876
  if (isShowOtherGraph) {
741
877
  var otherGraph = this.props.otherGraph;
878
+
742
879
  if (otherGraph) {
743
880
  mapPoints = [].concat(_toConsumableArray(mapPoints), _toConsumableArray(otherGraph.point || []));
744
881
  mapLines = [].concat(_toConsumableArray(mapLines), _toConsumableArray(otherGraph.polyline || []));
@@ -746,6 +883,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
746
883
  mapCircles = [].concat(_toConsumableArray(mapCircles), _toConsumableArray(otherGraph.circle || []));
747
884
  }
748
885
  }
886
+
749
887
  var mapTypeContent = /*#__PURE__*/_react["default"].createElement("div", {
750
888
  style: {
751
889
  width: '170px',
@@ -781,6 +919,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
781
919
  }, /*#__PURE__*/_react["default"].createElement("img", {
782
920
  src: "".concat(_default2["default"].mapServerURL, "/images/wx.png")
783
921
  })));
922
+
784
923
  return /*#__PURE__*/_react["default"].createElement(_VtxModal.VtxModal, {
785
924
  title: this.state.graphicType == 'point' ? "定位" : "绘制",
786
925
  style: {
@@ -802,8 +941,10 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
802
941
  onClick: function onClick() {
803
942
  if (_this7.multiDraw && _this7.state.isDoEdit && !_this7.state.isEndEdit) {
804
943
  _this7.continueDraw(_this7.callback.bind(_this7));
944
+
805
945
  return;
806
946
  }
947
+
807
948
  _this7.callback();
808
949
  },
809
950
  icon: getIcon('check')
@@ -815,7 +956,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
815
956
  className: styles.searchMap
816
957
  }, /*#__PURE__*/_react["default"].createElement("div", {
817
958
  className: styles.top
818
- }, mapType == 'gmap' || mapType == 'olmap' ? '' : [/*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
959
+ }, [/*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
819
960
  key: "1"
820
961
  }, InputProps)), /*#__PURE__*/_react["default"].createElement(_button["default"], {
821
962
  key: "2",
@@ -833,14 +974,16 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
833
974
  disabled: this.isDrawStatus,
834
975
  onClick: function onClick() {
835
976
  _this7.isDrawStatus = true;
977
+
836
978
  if (_this7.multiDraw) {
837
979
  _this7.clickable = false;
838
- graphicValue === null || graphicValue === void 0 || graphicValue.forEach(function (item) {
980
+ graphicValue === null || graphicValue === void 0 ? void 0 : graphicValue.forEach(function (item) {
839
981
  return t.map.removeGraphic(item.id, 'draw');
840
982
  });
841
- editGraphic === null || editGraphic === void 0 || editGraphic.forEach(function (item) {
983
+ editGraphic === null || editGraphic === void 0 ? void 0 : editGraphic.forEach(function (item) {
842
984
  return t.map.removeGraphic(item.id, 'draw');
843
985
  });
986
+
844
987
  _this7.setState({
845
988
  isDraw: false,
846
989
  isCloseDraw: true,
@@ -867,6 +1010,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
867
1010
  });
868
1011
  });
869
1012
  }
1013
+
870
1014
  _this7.callback('editDraw');
871
1015
  },
872
1016
  icon: getIcon('edit')
@@ -876,7 +1020,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
876
1020
  }, "\u7EE7\u7EED\u7ED8\u5236"), this.multiDraw && /*#__PURE__*/_react["default"].createElement(_button["default"], {
877
1021
  onClick: this.editGraphic.bind(this),
878
1022
  icon: getIcon('edit')
879
- }, "\u7F16\u8F91\u56FE\u5143"), mapType == 'gmap' || mapType == 'olmap' ? '' : /*#__PURE__*/_react["default"].createElement(_button["default"], {
1023
+ }, "\u7F16\u8F91\u56FE\u5143"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
880
1024
  onClick: this.setFitView.bind(this),
881
1025
  icon: getIcon('sync')
882
1026
  }, "\u8FD4\u56DE\u5168\u5C40\u5730\u56FE"), isChangeMapType && (mapType == 'amap' || mapType == 'bmap' || mapType == 'tmap') && /*#__PURE__*/_react["default"].createElement(_popover["default"], {
@@ -898,9 +1042,9 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
898
1042
  }, otherText)) : ''), /*#__PURE__*/_react["default"].createElement("div", {
899
1043
  className: styles.content,
900
1044
  style: {
901
- paddingLeft: mapType == 'gmap' || mapType == 'olmap' ? '0px' : '25px'
1045
+ paddingLeft: '25px'
902
1046
  }
903
- }, mapType == 'gmap' || mapType == 'olmap' ? '' : /*#__PURE__*/_react["default"].createElement("div", {
1047
+ }, /*#__PURE__*/_react["default"].createElement("div", {
904
1048
  className: "".concat(styles.content_left, " ").concat(isShowList ? styles.w_l : '')
905
1049
  }, /*#__PURE__*/_react["default"].createElement("div", {
906
1050
  className: "".concat(isShowList ? styles.show : styles.hidden)
@@ -971,11 +1115,15 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
971
1115
  key: "initSearchMap",
972
1116
  value: function initSearchMap() {
973
1117
  var _this8 = this;
974
- if (this.props.modal1Visible /*&& !this.state.locationPoint[0]*/) {
1118
+
1119
+ if (this.props.modal1Visible
1120
+ /*&& !this.state.locationPoint[0]*/
1121
+ ) {
975
1122
  if (this.map) {
976
1123
  this.map.loadMapComplete.then(function () {
977
1124
  if (!_this8.mapLoaded) {
978
1125
  _this8.mapLoaded = true;
1126
+
979
1127
  _this8.drawLocationPoint();
980
1128
  }
981
1129
  });
@@ -998,16 +1146,20 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
998
1146
  key: "componentWillReceiveProps",
999
1147
  value: function componentWillReceiveProps(nextProps) {
1000
1148
  var _this9 = this;
1149
+
1001
1150
  var t = this;
1002
1151
  this.isClickMap = false;
1152
+
1003
1153
  if (t.state.graphicType !== nextProps.graphicType && !!this.map) {
1004
1154
  this.map.clearAll();
1005
1155
  t.mapLoaded = false;
1006
1156
  t.isinit = true;
1007
1157
  }
1158
+
1008
1159
  if (nextProps.editParam) {
1009
1160
  t.mapLoaded = false;
1010
1161
  }
1162
+
1011
1163
  t.isDrawStatus = nextProps.graphicType !== 'point' && !nextProps.editParam;
1012
1164
  this.setState({
1013
1165
  modal1Visible: nextProps.modal1Visible,
@@ -1032,6 +1184,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1032
1184
  //实现2+次进入时,清理数据
1033
1185
  if (nextProps.modal1Visible) {
1034
1186
  _this9.clearList();
1187
+
1035
1188
  _this9.setState({
1036
1189
  setZoomLevel: true
1037
1190
  }, function () {
@@ -1039,27 +1192,39 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1039
1192
  setZoomLevel: false
1040
1193
  });
1041
1194
  });
1195
+
1042
1196
  if (!!_this9.map && !!_this9.state.locationPoint[0] && nextProps.mapCenter && !!nextProps.mapCenter[0]) {
1043
1197
  if (_this9.map.getGraphic('locationPoint')) {
1044
1198
  switch (nextProps.mapType) {
1045
1199
  case 'bmap':
1046
1200
  _this9.map.getGraphic('locationPoint').mapLayer.setPosition(new BMap.Point(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1201
+
1047
1202
  break;
1203
+
1048
1204
  case 'amap':
1049
1205
  _this9.map.getGraphic('locationPoint').mapLayer.setPosition(new AMap.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1206
+
1050
1207
  break;
1208
+
1051
1209
  case 'tmap':
1052
1210
  _this9.map.getGraphic('locationPoint').mapLayer.setLngLat(new T.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1211
+
1053
1212
  break;
1213
+
1054
1214
  case 'gmap':
1055
1215
  _this9.map.getGraphic('locationPoint').mapLayer.geometry.setLatitude(nextProps.mapCenter[1]);
1216
+
1056
1217
  _this9.map.getGraphic('locationPoint').mapLayer.geometry.setLongitude(nextProps.mapCenter[0]);
1218
+
1057
1219
  _this9.map.state.gis.graphics.refresh();
1220
+
1058
1221
  case 'olMap':
1059
1222
  _this9.map.getGraphic('locationPoint').mapLayer.setGeometry(new ol.geom.Point(nextProps.mapCenter));
1223
+
1060
1224
  break;
1061
1225
  }
1062
1226
  }
1227
+
1063
1228
  _this9.map.setCenter(nextProps.mapCenter);
1064
1229
  }
1065
1230
  }
@@ -1070,13 +1235,17 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1070
1235
  value: function componentWillUnmount() {
1071
1236
  //关闭moveTo定时
1072
1237
  var t = this;
1238
+
1073
1239
  if (t.loadExtent) {
1074
1240
  clearInterval(t.loadExtent);
1075
1241
  }
1076
1242
  }
1077
1243
  }]);
1244
+
1078
1245
  return VtxSearchMap;
1079
1246
  }(_react["default"].Component);
1080
- var _default = exports["default"] = VtxSearchMap;
1247
+
1248
+ var _default = VtxSearchMap;
1249
+ exports["default"] = _default;
1081
1250
  module.exports = exports["default"];
1082
1251
  //# sourceMappingURL=VtxSearchMap.js.map