@vtx/map 1.1.42 → 1.1.44
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/OlMap/Map.js
CHANGED
|
@@ -129,6 +129,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
129
129
|
default:
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
|
+
} else if (item.coverage.indexOf("WMTS") > -1) {
|
|
133
|
+
t.addTileLayer(JSON.parse(item.coverage));
|
|
132
134
|
} else if (OL_SCREEN[item.coverage]) {
|
|
133
135
|
if (first) {
|
|
134
136
|
var layers = eval(OL_SCREEN[item.coverage].initLayer);
|
|
@@ -572,10 +574,90 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
572
574
|
t.initPropsForUser();
|
|
573
575
|
} // 加载图层
|
|
574
576
|
|
|
577
|
+
}, {
|
|
578
|
+
key: "getWMTS",
|
|
579
|
+
value: // wmts图层资源
|
|
580
|
+
function getWMTS(options) {
|
|
581
|
+
var url = options.url,
|
|
582
|
+
params = options.params,
|
|
583
|
+
sourceOptions = options.sourceOptions; //切片名
|
|
584
|
+
|
|
585
|
+
var matrixIds = ['EPSG:4326:0', 'EPSG:4326:1', 'EPSG:4326:2', 'EPSG:4326:3', 'EPSG:4326:4', 'EPSG:4326:5', 'EPSG:4326:6', 'EPSG:4326:7', 'EPSG:4326:8', 'EPSG:4326:9', 'EPSG:4326:10', 'EPSG:4326:11', 'EPSG:4326:12', 'EPSG:4326:13', 'EPSG:4326:14', 'EPSG:4326:15', 'EPSG:4326:16', 'EPSG:4326:17', 'EPSG:4326:18']; //分辨率
|
|
586
|
+
|
|
587
|
+
var resolutions = [0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 6.866455078125e-4, 3.4332275390625e-4, 1.71661376953125e-4, 8.58306884765625e-5, 4.291534423828125e-5, 2.1457672119140625e-5, 1.0728836059570312e-5, 5.364418029785156e-6, 2.682209014892578e-6]; //切片策略
|
|
588
|
+
|
|
589
|
+
var tilegrid = new ol.tilegrid.WMTS({
|
|
590
|
+
extent: [-180.0, -90.0, 180.0, 90.0],
|
|
591
|
+
//范围
|
|
592
|
+
tileSize: [256, 256],
|
|
593
|
+
origin: [-180.0, 90.0],
|
|
594
|
+
//切片原点
|
|
595
|
+
resolutions: resolutions,
|
|
596
|
+
//分辨率
|
|
597
|
+
matrixIds: matrixIds //层级标识列表,与地图级数保持一致
|
|
598
|
+
|
|
599
|
+
}); //设置地图投影
|
|
600
|
+
|
|
601
|
+
var projection = new ol.proj.Projection({
|
|
602
|
+
code: 'EPSG:4326',
|
|
603
|
+
units: 'degrees',
|
|
604
|
+
axisOrientation: 'neu'
|
|
605
|
+
});
|
|
606
|
+
return new ol.source.WMTS(_objectSpread({
|
|
607
|
+
url: url,
|
|
608
|
+
layer: params === null || params === void 0 ? void 0 : params.layer,
|
|
609
|
+
format: 'image/png',
|
|
610
|
+
matrixSet: 'EPSG:4326',
|
|
611
|
+
projection: projection,
|
|
612
|
+
tileGrid: tilegrid
|
|
613
|
+
}, sourceOptions));
|
|
614
|
+
} // 添加普通图层
|
|
615
|
+
|
|
616
|
+
}, {
|
|
617
|
+
key: "addTileLayer",
|
|
618
|
+
value: function addTileLayer(_ref) {
|
|
619
|
+
var url = _ref.url,
|
|
620
|
+
_ref$params = _ref.params,
|
|
621
|
+
params = _ref$params === void 0 ? {} : _ref$params,
|
|
622
|
+
_ref$sourceOptions = _ref.sourceOptions,
|
|
623
|
+
sourceOptions = _ref$sourceOptions === void 0 ? {} : _ref$sourceOptions,
|
|
624
|
+
type = _ref.type,
|
|
625
|
+
source = _ref.source;
|
|
626
|
+
|
|
627
|
+
if (url) {
|
|
628
|
+
var exist = this.olLayers.find(function (item) {
|
|
629
|
+
return item.address === url;
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
if (exist) {
|
|
633
|
+
exist.layer.setVisible(true);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
var layerSource = source || (type === 'WMTS' ? this.getWMTS({
|
|
638
|
+
url: url,
|
|
639
|
+
params: params,
|
|
640
|
+
sourceOptions: sourceOptions
|
|
641
|
+
}) : new ol.source.XYZ(_objectSpread({
|
|
642
|
+
url: url
|
|
643
|
+
}, sourceOptions)));
|
|
644
|
+
|
|
645
|
+
var _layer2 = new ol.layer.Tile({
|
|
646
|
+
source: layerSource
|
|
647
|
+
}); // 将图层添加到地图上
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
this.state.gis.addLayer(_layer2);
|
|
651
|
+
this.olLayers.push({
|
|
652
|
+
address: url,
|
|
653
|
+
layer: _layer2
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
} // 添加超图图层
|
|
657
|
+
|
|
575
658
|
}, {
|
|
576
659
|
key: "addSuperMapLayer",
|
|
577
|
-
value:
|
|
578
|
-
function addSuperMapLayer(url) {
|
|
660
|
+
value: function addSuperMapLayer(url) {
|
|
579
661
|
var exist = this.olLayers.find(function (item) {
|
|
580
662
|
return item.address === url;
|
|
581
663
|
});
|
|
@@ -2014,12 +2096,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2014
2096
|
|
|
2015
2097
|
}, {
|
|
2016
2098
|
key: "frameSelect",
|
|
2017
|
-
value: function frameSelect(
|
|
2018
|
-
var geometryType =
|
|
2019
|
-
|
|
2020
|
-
parameter =
|
|
2021
|
-
|
|
2022
|
-
data =
|
|
2099
|
+
value: function frameSelect(_ref2, callback) {
|
|
2100
|
+
var geometryType = _ref2.geometryType,
|
|
2101
|
+
_ref2$parameter = _ref2.parameter,
|
|
2102
|
+
parameter = _ref2$parameter === void 0 ? {} : _ref2$parameter,
|
|
2103
|
+
_ref2$data = _ref2.data,
|
|
2104
|
+
data = _ref2$data === void 0 ? {} : _ref2$data;
|
|
2023
2105
|
|
|
2024
2106
|
if (!['polygon', 'circle', 'rectangle'].includes(geometryType)) {
|
|
2025
2107
|
message.warn("传入的类型不支持框选!");
|