@vtx/map 1.1.27 → 1.1.29
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/lib/VtxMap/BMap/Map.js +3 -5
- package/lib/VtxMap/BMap/Map.js.map +1 -1
- package/lib/VtxMap/OlMap/Map.js +136 -15
- package/lib/VtxMap/OlMap/Map.js.map +1 -1
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.css +1 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.less +1 -0
- package/lib/VtxSearchMap/VtxSearchMap.css +1 -0
- package/lib/VtxSearchMap/VtxSearchMap.less +1 -0
- package/package.json +2 -2
package/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -29,10 +29,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
29
29
|
|
|
30
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
31
|
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
32
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
33
|
|
|
38
34
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -45,6 +41,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
45
41
|
|
|
46
42
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
43
|
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
48
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
49
49
|
|
|
50
50
|
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); } }
|
|
@@ -117,10 +117,14 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
117
117
|
case 'superMap':
|
|
118
118
|
t.addSuperMapLayer(item.coverage);
|
|
119
119
|
break;
|
|
120
|
-
//
|
|
120
|
+
// geoServer_geoJSON
|
|
121
121
|
|
|
122
122
|
case 'geoServer':
|
|
123
123
|
t.addGeoServerLayer(item.coverage);
|
|
124
|
+
// geoServer_image
|
|
125
|
+
|
|
126
|
+
case 'geoServer_image':
|
|
127
|
+
t.addGeoServerImageLayer(item.coverage);
|
|
124
128
|
|
|
125
129
|
default:
|
|
126
130
|
break;
|
|
@@ -577,7 +581,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
577
581
|
address: url,
|
|
578
582
|
layer: layer
|
|
579
583
|
});
|
|
580
|
-
} // 添加
|
|
584
|
+
} // 添加geoServer_geoJSON图层
|
|
581
585
|
|
|
582
586
|
}, {
|
|
583
587
|
key: "addGeoServerLayer",
|
|
@@ -636,6 +640,61 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
636
640
|
address: _url,
|
|
637
641
|
layer: layer
|
|
638
642
|
});
|
|
643
|
+
}
|
|
644
|
+
}, {
|
|
645
|
+
key: "formatUrl",
|
|
646
|
+
value: function formatUrl(url) {
|
|
647
|
+
var param = {},
|
|
648
|
+
address = url.split("?")[0];
|
|
649
|
+
url.split("?")[1].split("&").map(function (item) {
|
|
650
|
+
var json = item.split("=");
|
|
651
|
+
param[json[0].toUpperCase()] = json[1] ? decodeURIComponent(json[1]) : '';
|
|
652
|
+
});
|
|
653
|
+
return {
|
|
654
|
+
param: param,
|
|
655
|
+
address: address
|
|
656
|
+
};
|
|
657
|
+
} // 添加geoServer_image图层
|
|
658
|
+
|
|
659
|
+
}, {
|
|
660
|
+
key: "addGeoServerImageLayer",
|
|
661
|
+
value: function addGeoServerImageLayer(url) {
|
|
662
|
+
var exist = this.olLayers.find(function (item) {
|
|
663
|
+
return item.address === url;
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
if (exist) {
|
|
667
|
+
exist.layer.setVisible(true);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
var _this$formatUrl = this.formatUrl(url),
|
|
672
|
+
_this$formatUrl$param = _this$formatUrl.param,
|
|
673
|
+
param = _this$formatUrl$param === void 0 ? {} : _this$formatUrl$param,
|
|
674
|
+
address = _this$formatUrl.address; // 矢量数据源
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
var vectorSource = new ol.source.ImageWMS({
|
|
678
|
+
url: address,
|
|
679
|
+
serverType: 'geoserver',
|
|
680
|
+
crossOrigin: '*',
|
|
681
|
+
ratio: 1,
|
|
682
|
+
params: _objectSpread({
|
|
683
|
+
VERSION: '1.1.0'
|
|
684
|
+
}, param)
|
|
685
|
+
}); // 矢量图层
|
|
686
|
+
|
|
687
|
+
var layer = new ol.layer.Image({
|
|
688
|
+
// 设置数据源
|
|
689
|
+
source: vectorSource
|
|
690
|
+
}); // 将图层添加到地图上
|
|
691
|
+
|
|
692
|
+
this.state.gis.addLayer(layer);
|
|
693
|
+
this.olLayers.push({
|
|
694
|
+
address: url,
|
|
695
|
+
layer: layer,
|
|
696
|
+
source: vectorSource
|
|
697
|
+
});
|
|
639
698
|
} // 初始化对外方法
|
|
640
699
|
|
|
641
700
|
}, {
|
|
@@ -4087,8 +4146,70 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4087
4146
|
x: e.pixel ? e.pixel[0] : undefined,
|
|
4088
4147
|
y: e.pixel ? e.pixel[1] : undefined
|
|
4089
4148
|
};
|
|
4149
|
+
var temp = [];
|
|
4150
|
+
t.olLayers.map(function (item) {
|
|
4151
|
+
if (item.layer) {
|
|
4152
|
+
temp.push(t.getFeatureInfo(e, t.state.gis.getView(), item.layer.getSource()));
|
|
4153
|
+
}
|
|
4154
|
+
});
|
|
4155
|
+
|
|
4156
|
+
if (temp.length) {
|
|
4157
|
+
obj.features = temp;
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4090
4160
|
t.props.clickMap(obj);
|
|
4091
4161
|
}
|
|
4162
|
+
} // 获取geoServer要素
|
|
4163
|
+
|
|
4164
|
+
}, {
|
|
4165
|
+
key: "getFeatureInfo",
|
|
4166
|
+
value: function getFeatureInfo(event, view, source) {
|
|
4167
|
+
var _source$params_,
|
|
4168
|
+
_source$params_2,
|
|
4169
|
+
_this8 = this;
|
|
4170
|
+
|
|
4171
|
+
var url = source.getFeatureInfoUrl(event.coordinate, view.getResolution(), view.getProjection(), {
|
|
4172
|
+
cql_filter: (_source$params_ = source.params_) === null || _source$params_ === void 0 ? void 0 : _source$params_.cql_filter,
|
|
4173
|
+
QUERY_LAYERS: (_source$params_2 = source.params_) === null || _source$params_2 === void 0 ? void 0 : _source$params_2.layers,
|
|
4174
|
+
INFO_FORMAT: 'application/json',
|
|
4175
|
+
REQUEST: "GetFeatureInfo",
|
|
4176
|
+
FEATURE_COUNT: 50
|
|
4177
|
+
});
|
|
4178
|
+
|
|
4179
|
+
var _this$formatUrl2 = this.formatUrl(url),
|
|
4180
|
+
param = _this$formatUrl2.param,
|
|
4181
|
+
address = _this$formatUrl2.address; // let temp = param.BBOX.split(",");
|
|
4182
|
+
// let BBOX = [temp[1],temp[0],temp[3],temp[2]].join(",");
|
|
4183
|
+
// param.BBOX = BBOX;
|
|
4184
|
+
|
|
4185
|
+
|
|
4186
|
+
param.QUERY_LAYERS = param.LAYERS;
|
|
4187
|
+
var temp = [];
|
|
4188
|
+
|
|
4189
|
+
for (var key in param) {
|
|
4190
|
+
temp.push("".concat(key, "=").concat(param[key]));
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
address += "?".concat(temp.join("&"));
|
|
4194
|
+
var geoJsonFormat = new ol.format.GeoJSON();
|
|
4195
|
+
return fetch(address).then(function (res) {
|
|
4196
|
+
return res.json();
|
|
4197
|
+
}).then(function (data) {
|
|
4198
|
+
var _data$features;
|
|
4199
|
+
|
|
4200
|
+
var features = [];
|
|
4201
|
+
|
|
4202
|
+
if (data !== null && data !== void 0 && (_data$features = data.features) !== null && _data$features !== void 0 && _data$features.length) {
|
|
4203
|
+
features = geoJsonFormat.readFeatures(data);
|
|
4204
|
+
features.map(function (item) {
|
|
4205
|
+
item.key = _this8 === null || _this8 === void 0 ? void 0 : _this8.key;
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
return features;
|
|
4210
|
+
})["catch"](function () {
|
|
4211
|
+
return [];
|
|
4212
|
+
});
|
|
4092
4213
|
} // 要素鼠标悬浮事件
|
|
4093
4214
|
|
|
4094
4215
|
}, {
|
|
@@ -4340,18 +4461,18 @@ var Popup = /*#__PURE__*/function (_React$Component2) {
|
|
|
4340
4461
|
var _super2 = _createSuper(Popup);
|
|
4341
4462
|
|
|
4342
4463
|
function Popup(props) {
|
|
4343
|
-
var
|
|
4464
|
+
var _this9;
|
|
4344
4465
|
|
|
4345
4466
|
_classCallCheck(this, Popup);
|
|
4346
4467
|
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
return
|
|
4468
|
+
_this9 = _super2.call(this);
|
|
4469
|
+
_this9.map = props.map;
|
|
4470
|
+
_this9.position = props.position;
|
|
4471
|
+
_this9.overlay = null;
|
|
4472
|
+
_this9.container = null;
|
|
4473
|
+
_this9.innerHTML = props.innerHTML;
|
|
4474
|
+
_this9.closeble = props.close;
|
|
4475
|
+
return _this9;
|
|
4355
4476
|
} // 弹出框
|
|
4356
4477
|
|
|
4357
4478
|
|