|
@@ -248,12 +248,12 @@ export default {
|
|
|
layers: [
|
|
|
new TileLayer({
|
|
|
source: new XYZ({
|
|
|
- // url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
|
|
|
+ url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
|
|
|
// url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //本地
|
|
|
// url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //内网
|
|
|
// url: "http://10.96.137.5:9080/tiles/{z}/{x}/{y}.png", //大~#@唐
|
|
|
// url: "http://192.168.0.1/tiles/{z}/{x}/{y}.png", //华电
|
|
|
- url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //中广核
|
|
|
+ // url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //中广核
|
|
|
}),
|
|
|
}),
|
|
|
new VectorLayer({
|
|
@@ -265,44 +265,44 @@ export default {
|
|
|
});
|
|
|
|
|
|
// -------------【添加山西省真实边界线】------------- 定位全国的时候注释这个代码
|
|
|
- if (this.$route.path === "/home/cockpitManage") {
|
|
|
- // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
|
|
|
- const shanxiSource = new Vector({
|
|
|
- features: new GeoJSON().readFeatures(shanxiBoundary, {
|
|
|
- featureProjection: "EPSG:4326",
|
|
|
- }),
|
|
|
- });
|
|
|
- // 创建矢量图层,仅显示边界线(填充颜色设为透明)
|
|
|
- const shanxiLayer = new VectorLayer({
|
|
|
- source: shanxiSource,
|
|
|
- style: new Style({
|
|
|
- stroke: new Stroke({
|
|
|
- color: "rgba(59, 130, 246, 0.5)",
|
|
|
- width: 3,
|
|
|
- }),
|
|
|
- fill: new Fill({
|
|
|
- color: "rgba(59, 130, 246, 0.05)", // 透明填充
|
|
|
- }),
|
|
|
- }),
|
|
|
- });
|
|
|
- this.map.addLayer(shanxiLayer);
|
|
|
+ // if (this.$route.path === "/home/cockpitManage") {
|
|
|
+ // // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
|
|
|
+ // const shanxiSource = new Vector({
|
|
|
+ // features: new GeoJSON().readFeatures(shanxiBoundary, {
|
|
|
+ // featureProjection: "EPSG:4326",
|
|
|
+ // }),
|
|
|
+ // });
|
|
|
+ // // 创建矢量图层,仅显示边界线(填充颜色设为透明)
|
|
|
+ // const shanxiLayer = new VectorLayer({
|
|
|
+ // source: shanxiSource,
|
|
|
+ // style: new Style({
|
|
|
+ // stroke: new Stroke({
|
|
|
+ // color: "rgba(59, 130, 246, 0.5)",
|
|
|
+ // width: 3,
|
|
|
+ // }),
|
|
|
+ // fill: new Fill({
|
|
|
+ // color: "rgba(59, 130, 246, 0.05)", // 透明填充
|
|
|
+ // }),
|
|
|
+ // }),
|
|
|
+ // });
|
|
|
+ // this.map.addLayer(shanxiLayer);
|
|
|
|
|
|
- const markerLayer = this.map
|
|
|
- .getLayers()
|
|
|
- .getArray()
|
|
|
- .find((layer) => {
|
|
|
- return layer.get("id") === "marker";
|
|
|
- });
|
|
|
- if (markerLayer) {
|
|
|
- markerLayer.setZIndex(10);
|
|
|
- }
|
|
|
+ // const markerLayer = this.map
|
|
|
+ // .getLayers()
|
|
|
+ // .getArray()
|
|
|
+ // .find((layer) => {
|
|
|
+ // return layer.get("id") === "marker";
|
|
|
+ // });
|
|
|
+ // if (markerLayer) {
|
|
|
+ // markerLayer.setZIndex(10);
|
|
|
+ // }
|
|
|
|
|
|
- // 同时设置高亮图层 zIndex 较低
|
|
|
- shanxiLayer.setZIndex(1);
|
|
|
- // -------------【结束】-------------
|
|
|
- const targetExtent = [106.8, 34.3, 118.6, 41.2];
|
|
|
- this.map.getView().fit(targetExtent, { duration: 2000 });
|
|
|
- }
|
|
|
+ // // 同时设置高亮图层 zIndex 较低
|
|
|
+ // shanxiLayer.setZIndex(1);
|
|
|
+ // // -------------【结束】-------------
|
|
|
+ // const targetExtent = [106.8, 34.3, 118.6, 41.2];
|
|
|
+ // this.map.getView().fit(targetExtent, { duration: 2000 });
|
|
|
+ // }
|
|
|
// 这个放在外面
|
|
|
this.initEvent();
|
|
|
},
|