| | |
| | | } |
| | | }) |
| | | |
| | | let titleLng = center[0] - 0.01 |
| | | let titleLat = center[1] - 0.03 |
| | | |
| | | this.$EventBus.$emit('layerPointAdd', { |
| | | layerName: 'policeStationLayer', |
| | | type: 'label', |
| | | params: { |
| | | lng: titleLng, |
| | | lat: titleLat, |
| | | lng: center[0], |
| | | lat: center[1], |
| | | alt: 0, |
| | | text: item.policeStationName |
| | | }, |
| | | distanceDisplayCondition: { |
| | | near: 20000, //最近距离 |
| | | far: 200000 //最远距离 |
| | | } |
| | | // distanceDisplayCondition: { |
| | | // near: 20000, //最近距离 |
| | | // far: 200000 //最远距离 |
| | | // } |
| | | }) |
| | | |
| | | let cylinder = new global.DC.LightCylinderPrimitive(new global.DC.Position(center[0], center[1]), 1200, 1, 600) |
| | |
| | | this.initAreaCheckoptions(this.BMareaCheckoptions) |
| | | this.initAreaCheckoptions(this.LXareaCheckoptions) |
| | | this.houseChange(true) |
| | | let points = [] |
| | | this.policeStationOptions[1].position.forEach(item => { |
| | | let jin = Number(item[0]) |
| | | let wei = Number(item[1]) |
| | | let cartesian3 = global.DC.T.transformWGS84ToCartesian(new global.DC.Position(jin, wei)) |
| | | points.push(cartesian3) |
| | | }) |
| | | console.log('points11111', points) |
| | | let areaCenter = global.DC.Namespace.Cesium.BoundingSphere.fromPoints(points).center |
| | | console.log('areaCenter222222', areaCenter) |
| | | let position3 = global.DC.T.transformCartesianToWGS84(areaCenter) |
| | | console.log('position3', position3) |
| | | |
| | | }) |
| | | |
| | | // axios.get('/user/getUserList').then((res) => { |
| | |
| | | } else { |
| | | if (item.policeStationName == '车站派出所') { |
| | | this.$EventBus.$emit('toPosition', { |
| | | siteJd: 116.082737, |
| | | siteWd: 28.724034, |
| | | // siteJd: 116.082737, |
| | | // siteWd: 28.724034, |
| | | siteJd: 115.963097, |
| | | siteWd: 28.669357, |
| | | siteGd: 18000, |
| | | siteHeading: -3, |
| | | sitePitch: -90 |
| | |
| | | this.areaOptions.push({ name: "责任区" + (i + 1) }) |
| | | } |
| | | |
| | | console.log(this.areaOptions) |
| | | // console.log(this.areaOptions) |
| | | } |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | getCenter (arr) { |
| | | let centerLonLat = [] |
| | | if (arr.length) { |
| | | const lon = [] |
| | | const lat = [] |
| | | const poly = [] |
| | | for (let i = 0, len = arr.length; i < len; i++) { |
| | | lon.push(arr[i][0]) |
| | | lat.push(arr[i][1]) |
| | | } |
| | | for (let i = 0, len = lon.length; i < len; i++) { |
| | | poly.push({ |
| | | x: parseFloat(lon[i]), |
| | | y: parseFloat(lat[i]), |
| | | z: 0 |
| | | }) |
| | | } |
| | | const sortedLongitudeArray = poly.map(item => item.x).sort() |
| | | const sortedLatitudeArray = poly.map(item => item.y).sort() |
| | | const centerLongitude = ((parseFloat(sortedLongitudeArray[0]) + parseFloat(sortedLongitudeArray[sortedLongitudeArray.length - 1])) / 2).toFixed(14) |
| | | const centerLatitude = ((parseFloat(sortedLatitudeArray[0]) + parseFloat(sortedLatitudeArray[sortedLatitudeArray.length - 1])) / 2).toFixed(14) |
| | | // console.log(centerLongitude, centerLatitude) |
| | | centerLonLat = [Number(centerLongitude), Number(centerLatitude)] |
| | | } |
| | | return centerLonLat |
| | | let positions = [] |
| | | arr.forEach((item, index) => { |
| | | positions[index] = [item[0], item[1]] |
| | | }) |
| | | positions.push([arr[0][0], arr[0][1]]) |
| | | let polygon = this.$turf.polygon([positions]) |
| | | let center = this.$turf.centroid(polygon) |
| | | console.log([positions], polygon, center, 123) |
| | | return [center.geometry.coordinates[0], center.geometry.coordinates[1]] |
| | | }, |
| | | |
| | | navClick (e) { |
| | |
| | | landMyChart.resize() |
| | | }) |
| | | }, |
| | | |
| | | initLandOptions (xDate, y1Date, y2Date) { |
| | | return { |
| | | |
| | |
| | | |
| | | } |
| | | }, |
| | | |
| | | landTabClick (type) { |
| | | this.tabTypeTwo = type |
| | | |
| | |
| | | this.$EventBus.$emit('layerPolygonAdd', { |
| | | layerName: 'polygonLayer', |
| | | positions: str, |
| | | material: this.positionColor[index], |
| | | distanceDisplayCondition: { |
| | | near: 0, //最近距离 |
| | | far: 20000 //最远距离 |
| | | } |
| | | material: this.positionColor[index] |
| | | }) |
| | | const center = this.getCenter(item.position) |
| | | |
| | |
| | | lat: center[1], |
| | | alt: 0, |
| | | text: item.areaCheckName |
| | | }, |
| | | distanceDisplayCondition: { |
| | | near: 0, //最近距离 |
| | | far: 20000 //最远距离 |
| | | } |
| | | }) |
| | | }) |