| | |
| | | </template> |
| | | |
| | | <script> |
| | | import axios from 'axios' |
| | | // import axios from 'axios' |
| | | import NCregion from "@/assets/region" |
| | | |
| | | // 图层变量做声明 |
| | | var farmRegionLayer = null |
| | |
| | | } |
| | | |
| | | global.DC.ready(initViewer) |
| | | |
| | | this.addRegionPolyLine('http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengfwx/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson') |
| | | // this.addRegionPolyLine('http://arcgis.jxpskj.com:6080/arcgis/rest/services/nanchengfwx/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson') |
| | | this.addRegionPolyLine(NCregion) |
| | | }, |
| | | methods: { |
| | | /** |
| | | * 添加南城县边界的数据 |
| | | * @param {string} url arcgis服务地址 |
| | | */ |
| | | addRegionPolyLine (url) { |
| | | axios.get(url).then(res => { |
| | | let position = '' |
| | | addRegionPolyLine (regionJSON) { |
| | | // axios.get(regionJSON).then(res => { |
| | | let position = '' |
| | | |
| | | res.data.features[0].geometry.rings[0].forEach(item => { |
| | | position += `${item[0]}, ${item[1]};` |
| | | }) |
| | | |
| | | console.log(position, 565656) |
| | | |
| | | const polyline = new global.DC.Polyline(position) |
| | | polyline.setStyle({ |
| | | width: 4, |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 244, 157, 21, |
| | | 200 |
| | | ), |
| | | clampToGround: true |
| | | }) |
| | | regionPolyLineLayer.addOverlay(polyline) |
| | | regionJSON.features[0].geometry.rings[0].forEach(item => { |
| | | position += `${item[0]}, ${item[1]};` |
| | | }) |
| | | |
| | | console.log(position, 565656) |
| | | |
| | | const polyline = new global.DC.Polyline(position) |
| | | polyline.setStyle({ |
| | | width: 4, |
| | | material: global.DC.Namespace.Cesium.Color.fromBytes( |
| | | 244, 157, 21, |
| | | 200 |
| | | ), |
| | | clampToGround: true |
| | | }) |
| | | regionPolyLineLayer.addOverlay(polyline) |
| | | // }) |
| | | }, |
| | | /** |
| | | * 添加农场点及范围的方法 |