| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | let pointLayer = null |
| | | export default { |
| | | name: "dcSearchMap", |
| | | props: ['isDetail', 'point'], |
| | | data () { |
| | | return { |
| | | pointLayer: null, |
| | | currentPoint: null, |
| | | //绘制工具 |
| | | plotTool: null, |
| | |
| | | }) |
| | | |
| | | //加载地图 |
| | | // global.searchViewer.imageryLayers.addImageryProvider( |
| | | // new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({ |
| | | // url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=d083e4cf30bfc438ef93436c10c2c20a', |
| | | // subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], |
| | | // format: 'image/jpeg', |
| | | // show: true, |
| | | // maximumLevel: 18 |
| | | // }) |
| | | // ) |
| | | |
| | | global.searchViewer.imageryLayers.addImageryProvider( |
| | | new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({ |
| | | url: 'https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal', |
| | | format: 'image/jpeg', |
| | | show: true, |
| | | maximumLevel: 18 |
| | | new global.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: "http://10.141.11.11:80/slapi/MapTileService/wmts?STORETYPE=merged-dat&PROJECTION=4326", |
| | | layer: "wmts_4326_361100", |
| | | style: "default", |
| | | format: "image/png", |
| | | tileMatrixSetID: "c", |
| | | tileMatrixLabels: new Array(18).fill(0).map((v, i) => i + 1), |
| | | tilingScheme: new global.DC.Namespace.Cesium.GeographicTilingScheme(), |
| | | }) |
| | | ) |
| | | |
| | | //添加图层 |
| | | self.pointLayer = new global.DC.VectorLayer('polygonLayer') |
| | | global.searchViewer.addLayer(self.pointLayer) |
| | | pointLayer = new global.DC.VectorLayer('polygonLayer') |
| | | global.searchViewer.addLayer(pointLayer) |
| | | |
| | | self.plotTool = new global.DC.Plot(global.searchViewer, { |
| | | icon_center: "/img/dwicon.jpeg", // 自定义的中心点图标 |
| | |
| | | // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州 |
| | | // fromDegrees()方法,将经纬度和高程转换为世界坐标 |
| | | destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | //设置坐标为上饶市 |
| | | 117.951478782, 28.447896798, 1800.0 |
| | | //设置坐标为上饶市信州区 |
| | | 117.966460, 28.431002, 5000.0 |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | |
| | | //鼠标左键事件 |
| | | let leftClick = function (event) { |
| | | if (self.currentPoint) { |
| | | self.pointLayer.removeOverlay(self.currentPoint) |
| | | pointLayer.removeOverlay(self.currentPoint) |
| | | self.currentPoint = null |
| | | } |
| | | let point = new global.DC.Point(new global.DC.Position(event.wgs84SurfacePosition.lng, event.wgs84SurfacePosition.lat)) |
| | | point.setStyle({ |
| | | pixelSize: 10, |
| | | color: global.DC.Color.RED, //颜色 |
| | | outlineColor: global.DC.Color.WHITE, //边框颜色 |
| | | outlineWidth: 2, //边框大小, |
| | | }) |
| | | let point = new global.DC.Billboard(new global.DC.Position(event.wgs84SurfacePosition.lng, event.wgs84SurfacePosition.lat), 'img/dwicon.jpeg') |
| | | // point.setStyle({ |
| | | // pixelSize: 10, |
| | | // color: global.DC.Color.RED, //颜色 |
| | | // outlineColor: global.DC.Color.WHITE, //边框颜色 |
| | | // outlineWidth: 2, //边框大小, |
| | | // }) |
| | | self.currentPoint = point |
| | | self.pointLayer.addOverlay(point) |
| | | pointLayer.addOverlay(point) |
| | | let pointLonLat = [event.wgs84SurfacePosition.lng, event.wgs84SurfacePosition.lat] |
| | | self.$emit("getMapData", pointLonLat) |
| | | } |
| | |
| | | pointArray = pointData[1].split(" ") |
| | | |
| | | let position = new global.DC.Position(pointArray[0], pointArray[1]) |
| | | let point = new global.DC.Point(position) |
| | | point.setStyle({ |
| | | pixelSize: 10, |
| | | color: global.DC.Color.RED, //颜色 |
| | | outlineColor: global.DC.Color.WHITE, //边框颜色 |
| | | outlineWidth: 2, //边框大小, |
| | | }) |
| | | let point = new global.DC.Billboard(position, 'img/dwicon.jpeg') |
| | | // point.setStyle({ |
| | | // pixelSize: 10, |
| | | // color: global.DC.Color.RED, //颜色 |
| | | // outlineColor: global.DC.Color.WHITE, //边框颜色 |
| | | // outlineWidth: 2, //边框大小, |
| | | // }) |
| | | this.currentPoint = point |
| | | this.pointLayer.addOverlay(point) |
| | | viewer.flyTo(this.pointLayer) |
| | | pointLayer.addOverlay(point) |
| | | viewer.flyTo(pointLayer) |
| | | } |
| | | }, |
| | | setView (points) { |
| | | if (points) { |
| | | let position = new global.DC.Position(Number(points.lng), Number(points.lat), 2000, 0, -90, 0) |
| | | let point = new global.DC.Billboard(position, 'img/dwicon.jpeg') |
| | | this.currentPoint = point |
| | | pointLayer.clear() |
| | | pointLayer.addOverlay(point) |
| | | global.searchViewer.flyToPosition( |
| | | new global.DC.Position(Number(points.lng), Number(points.lat), 2000, 0, -90, 0) |
| | | ) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
| | | <style scoped></style> |