|
@@ -84,7 +84,7 @@ import VlImglayers from '@/components/ol/VLImgLayers';
|
|
|
import { arcgisQuery } from '@/utils/arcgis-map-server-query';
|
|
|
import VlMapDevInfo from '@/components/ol/VlMapDevInfo';
|
|
|
import VlChinaCities from '@/components/ol/VlChinaCities';
|
|
|
-import { MultiPolygon } from 'ol/geom';
|
|
|
+import { MultiPolygon, Point } from 'ol/geom';
|
|
|
import { getSrid, mapFit, toArcGIS } from '@/utils/arcgis-utils';
|
|
|
import { Stroke, Style } from 'ol/style';
|
|
|
import { Vector as VectorSource } from 'ol/source';
|
|
@@ -95,7 +95,7 @@ import { scatter_bg4, bg_text } from './base64Img.js';
|
|
|
import { Geometry as WkxGeometry } from 'wkx';
|
|
|
import { GeoJSON } from 'ol/format';
|
|
|
import { convertRingsToGeoJSON } from '@/utils/ArcGISGeoJSONConvertTool.js';
|
|
|
-import { Fill, Text } from 'ol/style';
|
|
|
+import { Fill, Text, Icon } from 'ol/style';
|
|
|
import VlToolBox from '@/components/ol/VlToolBox';
|
|
|
|
|
|
import TABLE_COMP_MAPPING from './TABLE_COMP_MAPPING.js';
|
|
@@ -104,7 +104,7 @@ import TdytMapping from '@/mock/TdytMapping.js';
|
|
|
|
|
|
import HeatmapLayer from 'ol/layer/Heatmap';
|
|
|
import hotJson from '@/assets/geoJson/GYYDPT4490.json';
|
|
|
-
|
|
|
+import { Feature } from 'ol';
|
|
|
export default {
|
|
|
name: 'BigScreenMap',
|
|
|
computed: {
|
|
@@ -182,6 +182,9 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ mapPointList: [],
|
|
|
+ pointLayerSource: null,
|
|
|
+ pointLayer: null, // 绘制地图中心点的图层
|
|
|
map: undefined,
|
|
|
mapDragPan: null,
|
|
|
visibleLayerId: '',
|
|
@@ -351,9 +354,13 @@ export default {
|
|
|
});
|
|
|
this.$vm.$on('location-feature-where', (payload) => {
|
|
|
//根据dzjgh进行图斑定位
|
|
|
- const { layerId, where, setting = {} } = payload;
|
|
|
+ const { layerId, where, setting = {}, isFit = false } = payload;
|
|
|
this.locationFeatureWhere(layerId, where, setting);
|
|
|
});
|
|
|
+ this.$vm.$on('addPoint', (city) => {
|
|
|
+ //根据dzjgh进行图斑定位
|
|
|
+ this.addPoints(city);
|
|
|
+ });
|
|
|
this.$vm.$on('location-more-feature-where', (payload) => {
|
|
|
//根据dzjgh进行图斑定位
|
|
|
const { layerId, where, setting = {} } = payload;
|
|
@@ -449,6 +456,40 @@ export default {
|
|
|
this.echartslayer && this.echartslayer.remove();
|
|
|
},
|
|
|
methods: {
|
|
|
+ addPoints(city) {
|
|
|
+ // 地理坐标数组
|
|
|
+ const pointData = [city];
|
|
|
+ // const pointData = [city.longitude, city.latitude];
|
|
|
+ console.log(pointData);
|
|
|
+ pointData.map((item) => {
|
|
|
+ // 创建点
|
|
|
+ const point = new Feature({
|
|
|
+ geometry: new Point([item.longitude, item.latitude]),
|
|
|
+ data: item,
|
|
|
+ });
|
|
|
+ // 点的样式
|
|
|
+ const iconStyle = new Style({
|
|
|
+ image: new Icon({
|
|
|
+ color: '#ffffff',
|
|
|
+ crossOrigin: 'anonymous',
|
|
|
+ src: require('../../../assets/images/webview/dian.png'), // 图片url,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ // 设置样式
|
|
|
+ point.setStyle(iconStyle);
|
|
|
+ this.mapPointList.push(point);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 创建geojson据源
|
|
|
+ this.pointLayerSource = new VectorSource({ features: this.mapPointList });
|
|
|
+ // 创建图层 并加载数据
|
|
|
+ this.pointLayer = new VectorLayer({ source: this.pointLayerSource });
|
|
|
+ // 将图层添加地图上
|
|
|
+ this.pointLayer.setZIndex(1003);
|
|
|
+ console.log(this.pointLayer);
|
|
|
+ this.map.addLayer(this.pointLayer);
|
|
|
+ },
|
|
|
+
|
|
|
initHotLayer(field) {
|
|
|
this.heatMapLayer = new HeatmapLayer({
|
|
|
source: new VectorSource({
|
|
@@ -813,7 +854,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- async locationFeatureWhere(layerId, where, setting) {
|
|
|
+ async locationFeatureWhere(layerId, where, setting, isFit) {
|
|
|
this.spinShow = true;
|
|
|
const layerById = this.$refs.configLayer.getLayerConfigById(layerId);
|
|
|
await arcgisQuery(
|
|
@@ -832,6 +873,21 @@ export default {
|
|
|
).toWkt();
|
|
|
feature.set('wkt', wkt);
|
|
|
this.feature = feature;
|
|
|
+ console.log(isFit);
|
|
|
+ console.log(geometry);
|
|
|
+ console.log(geometry.getExtent());
|
|
|
+ // if (isFit) {
|
|
|
+ setTimeout(() => {
|
|
|
+ let [width, height] = this.map.getSize();
|
|
|
+ width = Math.ceil(width / 5);
|
|
|
+ height = Math.ceil(height / 5);
|
|
|
+ this.map.getView().fit(geometry.getExtent(), {
|
|
|
+ padding: [height, width, height + 340, width],
|
|
|
+ duration: 500,
|
|
|
+ maxZoom: 18,
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+ // }
|
|
|
});
|
|
|
this.spinShow = false;
|
|
|
},
|