@vtx/map 1.1.29 → 1.1.30

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.
@@ -156,6 +156,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
156
156
  bl: 'LB',
157
157
  br: 'RB'
158
158
  };
159
+ _this.frameSelectProps = {};
159
160
 
160
161
  _this.loadMapJs();
161
162
 
@@ -498,6 +499,8 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
498
499
  t.mousetool = new AMap.MouseTool(t.state.gis); //绘制完后的回调
499
500
 
500
501
  t.mousetool.on('draw', function (_ref2) {
502
+ var _t$frameSelectProps;
503
+
501
504
  var type = _ref2.type,
502
505
  obj = _ref2.obj;
503
506
  var drawExtData = obj.getExtData();
@@ -572,6 +575,10 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
572
575
  if ('drawEnd' in t.props) {
573
576
  t.props.drawEnd(backobj);
574
577
  }
578
+
579
+ if (((_t$frameSelectProps = t.frameSelectProps) === null || _t$frameSelectProps === void 0 ? void 0 : _t$frameSelectProps.callback) instanceof Function) {
580
+ t.frameSelectProps.callback(backobj);
581
+ }
575
582
  });
576
583
  t.heatmap = new AMap.Heatmap(t.state.gis);
577
584
  t.state.gis.on('mapmove', function (e) {
@@ -584,6 +591,68 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
584
591
  });
585
592
  }
586
593
  });
594
+ t.initPropsForUser();
595
+ } // 初始化对外方法
596
+
597
+ }, {
598
+ key: "initPropsForUser",
599
+ value: function initPropsForUser() {
600
+ var t = this;
601
+
602
+ t.state.gis["frameSelect"] = function () {
603
+ var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
604
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
605
+ return t.frameSelect(obj, callback);
606
+ };
607
+
608
+ t.state.gis["clearFrameSelect"] = function () {
609
+ return t.clearFrameSelect();
610
+ };
611
+ } // 框选
612
+
613
+ }, {
614
+ key: "frameSelect",
615
+ value: function frameSelect(_ref3, callback) {
616
+ var geometryType = _ref3.geometryType,
617
+ _ref3$parameter = _ref3.parameter,
618
+ parameter = _ref3$parameter === void 0 ? {} : _ref3$parameter,
619
+ _ref3$data = _ref3.data,
620
+ data = _ref3$data === void 0 ? {} : _ref3$data;
621
+
622
+ if (!['polygon', 'circle', 'rectangle'].includes(geometryType)) {
623
+ message.warn("传入的类型不支持框选!");
624
+ return false;
625
+ }
626
+
627
+ var t = this;
628
+ var params = {},
629
+ type = geometryType || 'polygon',
630
+ id = data.id || 'frameSelectFeature';
631
+ params.color = parameter.color || 'red';
632
+ params.lineColor = parameter.lineColor || 'red';
633
+ params.lineOpacity = parameter.lineOpacity || 1;
634
+ params.lineWidth = parameter.lineWidth || 2;
635
+ params.pellucidity = parameter.pellucidity || 0.6;
636
+ params.lineType = parameter.lineType || 'solid';
637
+ t.draw({
638
+ geometryType: type,
639
+ parameter: _objectSpread(_objectSpread({}, parameter), params),
640
+ data: {
641
+ id: id
642
+ }
643
+ });
644
+ t.frameSelectProps = {
645
+ callback: callback,
646
+ id: id,
647
+ type: geometryType
648
+ };
649
+ } // 清除框选
650
+
651
+ }, {
652
+ key: "clearFrameSelect",
653
+ value: function clearFrameSelect() {
654
+ this.removeGraphic(this.frameSelectProps.id, this.frameSelectProps.type);
655
+ this.frameSelectProps = {};
587
656
  }
588
657
  /*
589
658
  切换地图矢量图和卫星图背景