|
@@ -79,6 +79,7 @@ import VlMapDevInfo from '@/components/ol/VlMapDevInfo';
|
|
|
import VlChinaCities from '@/components/ol/VlChinaCities';
|
|
|
import { MultiPolygon, Point } from 'ol/geom';
|
|
|
import { getSrid, mapFit, toArcGIS } from '@/utils/arcgis-utils';
|
|
|
+import Map from 'ol';
|
|
|
import { Stroke, Style } from 'ol/style';
|
|
|
import { Vector as VectorSource } from 'ol/source';
|
|
|
import { Vector as VectorLayer } from 'ol/layer';
|
|
@@ -553,21 +554,6 @@ export default {
|
|
|
fill: new Fill({
|
|
|
color: '#4AD808',
|
|
|
}),
|
|
|
- // text: new Text(({
|
|
|
- // // 位置
|
|
|
- // textAlign: 'center',
|
|
|
- // // 基准线
|
|
|
- // textBaseline: 'middle',
|
|
|
- // // 文字样式
|
|
|
- // font: 'bold 16px 微软雅黑',
|
|
|
- // // 文本内容
|
|
|
- // text: feature.get('name')+'\n'+feature.get('value')+' '+feature.get('unit'),
|
|
|
- // // 文字颜色
|
|
|
- // fill: new Fill({ color: '#FFF' }),
|
|
|
- // // fill: new Fill({ color: feature.get('color') }),
|
|
|
- // // 文字背景
|
|
|
- // // stroke: new Stroke({ color: '#ffcc33', width: 10 })
|
|
|
- // }))
|
|
|
});
|
|
|
},
|
|
|
zIndex: 99,
|
|
@@ -599,11 +585,8 @@ export default {
|
|
|
if (layerById) {
|
|
|
layerById.visible = v
|
|
|
}
|
|
|
- if (v) {
|
|
|
- this.visibleLayerId = k;
|
|
|
- this.$vm.$emit('switchLayerEvent', k)
|
|
|
- }
|
|
|
}, 500)
|
|
|
+ this.$vm.$emit('switchLayerEvent', idsState)
|
|
|
})
|
|
|
},
|
|
|
showLandDetail(props) {
|
|
@@ -1464,33 +1447,39 @@ export default {
|
|
|
configLayerLoaded(enabledLayersConfig) {
|
|
|
this.enabledLayersConfig = enabledLayersConfig;
|
|
|
},
|
|
|
- async pickServerFeature (e) {
|
|
|
+ async pickServerFeature(e) {
|
|
|
+ console.log(
|
|
|
+ this.visibleLayerId,
|
|
|
+ typeof this.visibleLayerId,
|
|
|
+ "typeof this.visibleLayerId"
|
|
|
+ );
|
|
|
let tempLayerIds = this.visibleLayerIds.filter(
|
|
|
(it) =>
|
|
|
- it !== 'xzqh-s' &&
|
|
|
- it !== 'xzqh-s-search' &&
|
|
|
- it !== 'xzqh-x-search' &&
|
|
|
- it !== 'xzqh-x-search-dzl' &&
|
|
|
- it !== 'xzqh-x' &&
|
|
|
- it !== 'xzqh-z' &&
|
|
|
- it !== 'hzyx-202311' &&
|
|
|
- it !== 'hzyx-202310' &&
|
|
|
- it !== 'hzyx-202308' &&
|
|
|
- it !== 'hzyx-202309' &&
|
|
|
- it !== 'bj-czkfbj' &&
|
|
|
- it !== 'bj-stbhhx' &&
|
|
|
- it !== 'bj-kfbjw',
|
|
|
+ it !== "xzqh-s" &&
|
|
|
+ it !== "xzqh-s-search" &&
|
|
|
+ it !== "xzqh-x-search" &&
|
|
|
+ it !== "xzqh-x-search-dzl" &&
|
|
|
+ it !== "xzqh-x" &&
|
|
|
+ it !== "xzqh-z" &&
|
|
|
+ it !== "bjq-xzq" &&
|
|
|
+ it !== "hzyx-202311" &&
|
|
|
+ it !== "hzyx-202310" &&
|
|
|
+ it !== "hzyx-202308" &&
|
|
|
+ it !== "hzyx-202309" &&
|
|
|
+ it !== "bj-czkfbj" &&
|
|
|
+ it !== "bj-stbhhx" &&
|
|
|
+ it !== "bj-kfbjw"
|
|
|
);
|
|
|
- if (tempLayerIds.length === this.visibleLayerIds.length) {
|
|
|
+ if (tempLayerIds.length === 1) {
|
|
|
const layerConfig = this.$refs.configLayer.getLayerConfigById(
|
|
|
- this.visibleLayerId,
|
|
|
+ this.visibleLayerId
|
|
|
);
|
|
|
// 带上图层显示参数,只拾取显示的图斑
|
|
|
- let where = '1=1';
|
|
|
+ let where = "1=1";
|
|
|
try {
|
|
|
where = layerConfig.params.layerDefs[0];
|
|
|
if (!where) {
|
|
|
- where = '1=1';
|
|
|
+ where = "1=1";
|
|
|
}
|
|
|
} catch (e) {
|
|
|
// 获取图层 参数
|
|
@@ -1498,64 +1487,68 @@ export default {
|
|
|
const [x, y] = e.coordinate;
|
|
|
const param = {
|
|
|
where,
|
|
|
- f: 'json',
|
|
|
+ f: "json",
|
|
|
inSR: getSrid(this.map),
|
|
|
outFields: TABLE_COMP_MAPPING[this.visibleLayerId]
|
|
|
- ? TABLE_COMP_MAPPING[this.visibleLayerId]['outFields']
|
|
|
- : '',
|
|
|
- returnGeometry: 'true',
|
|
|
+ ? TABLE_COMP_MAPPING[this.visibleLayerId]["outFields"]
|
|
|
+ : "",
|
|
|
+ returnGeometry: "true",
|
|
|
geometry: JSON.stringify({ x, y }),
|
|
|
- geometryType: 'esriGeometryPoint',
|
|
|
+ geometryType: "esriGeometryPoint",
|
|
|
};
|
|
|
+ const pointWkt = `POINT(${y} ${x})`
|
|
|
if (layerConfig.serverType === 'wms') {
|
|
|
- const pointWkt = `POINT(${y} ${x})`
|
|
|
- await GeoServerQuery(`${layerConfig.queryUrl}`, {
|
|
|
+ return GeoServerQuery(`${layerConfig.queryUrl}`, {
|
|
|
typeName: layerConfig.params.layers,
|
|
|
cql_filter: `INTERSECTS(shape, ${pointWkt})`
|
|
|
}, true).then(({ features: [feature] }) => {
|
|
|
- if (feature) {
|
|
|
- this.locationFeature(null, this.visibleLayerId, { feature });
|
|
|
- } else {
|
|
|
- this.feature = undefined;
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- arcgisQuery(
|
|
|
- `${layerConfig.url}/${this.layerIndex}/query`,
|
|
|
- param,
|
|
|
- true,
|
|
|
- ).then(({ features: [feature] }) => {
|
|
|
if (feature) {
|
|
|
this.locationFeature(null, this.visibleLayerId, { feature });
|
|
|
} else {
|
|
|
this.feature = undefined;
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
+ arcgisQuery(
|
|
|
+ `${layerConfig.url}/${this.layerIndex}/query`,
|
|
|
+ param,
|
|
|
+ true
|
|
|
+ ).then(({ features: [feature] }) => {
|
|
|
+ if (feature) {
|
|
|
+ this.locationFeature(null, this.visibleLayerId, { feature });
|
|
|
+ } else {
|
|
|
+ this.feature = undefined;
|
|
|
+ }
|
|
|
+ });
|
|
|
} else if (tempLayerIds.length > 1) {
|
|
|
// 带上图层显示参数,只拾取显示的图斑
|
|
|
- const where = '1=1';
|
|
|
+ const where = "1=1";
|
|
|
const [x, y] = e.coordinate;
|
|
|
const param = {
|
|
|
where,
|
|
|
- f: 'json',
|
|
|
+ f: "json",
|
|
|
inSR: getSrid(this.map),
|
|
|
- outFields: '',
|
|
|
- returnGeometry: 'true',
|
|
|
+ outFields: "",
|
|
|
+ returnGeometry: "true",
|
|
|
geometry: JSON.stringify({ x, y }),
|
|
|
- geometryType: 'esriGeometryPoint',
|
|
|
+ geometryType: "esriGeometryPoint",
|
|
|
};
|
|
|
+ const pointWkt = `POINT(${y} ${x})`
|
|
|
const urls = tempLayerIds.map((i) => this.getLayerConfigById(i));
|
|
|
|
|
|
- const promiseArr = urls.map((i) => {
|
|
|
- param.outFields = TABLE_COMP_MAPPING[i.id]
|
|
|
- ? TABLE_COMP_MAPPING[i.id]['outFields']
|
|
|
- : '';
|
|
|
- return arcgisQuery(`${i.url}/${this.layerIndex}/query`, param, true);
|
|
|
- });
|
|
|
+ console.log("1109行----------------------------------")
|
|
|
+ const promiseArr = urls.map(i => {
|
|
|
+ if (i.serverType === 'wms') {
|
|
|
+ return GeoServerQuery(`${i.queryUrl}`, {
|
|
|
+ typeName: i.params.layers,
|
|
|
+ cql_filter: `INTERSECTS(shape, ${pointWkt})`
|
|
|
+ }, true)
|
|
|
+ }
|
|
|
+ return arcgisQuery(`${i}/0/query`, param, true)
|
|
|
+ })
|
|
|
|
|
|
const feature = await Promise.all(promiseArr).then((resp) => {
|
|
|
- if (this.visibleLayerIds.includes('bj-gyyd-new')) {
|
|
|
+ if (this.visibleLayerIds.includes("bj-gyyd-new")) {
|
|
|
for (let i = 0; i < resp.length; i++) {
|
|
|
if (resp[i].features.length != 0) {
|
|
|
this.isgyyd = resp[i].displayFieldName;
|