| | |
| | | const pwythHost = "http://localhost/pwyth"; |
| | | //配置 |
| | | const config = { |
| | | images: host + "/imgs/", |
| | | // server服务 |
| | | apiServices: "http://" + apiHost + "/server/", |
| | | // 知识图谱服务 |
| | |
| | | // 获取点击位置的世界坐标 |
| | | var pickedFeature = window.Viewer.scene.pick(event.position); |
| | | if (Cesium.defined(pickedFeature)) { |
| | | console.log(pickedFeature); |
| | | if (pickedFeature.id) { |
| | | const obj = pickedFeature.id; |
| | | var arr = []; |
| | |
| | | break; |
| | | case 'a3': |
| | | earthCtrl.factory.createSimpleGraphic('polyline', { showSize: false }, (entity) => { |
| | | |
| | | // console.log(entity); |
| | | |
| | | // const obj = entity.polyline.positions.getValue(); |
| | | // var std = []; |
| | | // for (var i in obj) { |
| | | // var ellipsoid =Viewer.scene.globe.ellipsoid; |
| | | |
| | | // // 将世界坐标转换为地理坐标(Cartographic) |
| | | // var cartographic = ellipsoid.cartesianToCartographic(obj[i]); |
| | | |
| | | // // 获取经纬度 |
| | | // var longitude = Cesium.Math.toDegrees(cartographic.longitude); |
| | | // var latitude = Cesium.Math.toDegrees(cartographic.latitude); |
| | | // var height = 0; |
| | | // std.push([longitude, latitude, height]); |
| | | // } |
| | | // console.log(std); |
| | | const obj = this.getWKtCoord(entity.polyline.positions.getValue()); |
| | | console.log('polyline Wkt:' + obj); |
| | | }); |
| | | break; |
| | | case 'a4': |
| | | earthCtrl.factory.createSimpleGraphic('rectangle', { showSize: false }, (entity) => {}); |
| | | break; |
| | | case 'a5': |
| | | earthCtrl.factory.createSimpleGraphic('polygon', { showSize: false }, (entity) => {}); |
| | | earthCtrl.factory.createSimpleGraphic('polygon', { showSize: false }, (entity) => { |
| | | const obj = this.getWKtCoord(entity.polygon.hierarchy.getValue().positions); |
| | | console.log('polygon Wkt:' + obj); |
| | | }); |
| | | break; |
| | | case 'a6': |
| | | earthCtrl.factory.SimpleGraphic.clear(); |
| | |
| | | } |
| | | return null; |
| | | }, |
| | | getWKtCoord(obj) { |
| | | var ellipsoid = Viewer.scene.globe.ellipsoid; |
| | | var std = []; |
| | | for (var i in obj) { |
| | | // 将世界坐标转换为地理坐标(Cartographic) |
| | | var cartographic = ellipsoid.cartesianToCartographic(obj[i]); |
| | | // 获取经纬度 |
| | | var longitude = Cesium.Math.toDegrees(cartographic.longitude); |
| | | var latitude = Cesium.Math.toDegrees(cartographic.latitude); |
| | | var height = 0; |
| | | std.push([longitude, latitude, height]); |
| | | } |
| | | return std; |
| | | }, |
| | | // 测量 |
| | | setMenuS8(res) { |
| | | const colorAll = this.colorAll; |
| | |
| | | this.showEarth = true; |
| | | this.mapViewStart(); |
| | | this.$busEvent.$on('CHANGE_MAPINFO', (res) => { |
| | | |
| | | this.setMapInfo(res); |
| | | }); |
| | | }, |
| | |
| | | |
| | | methods: { |
| | | setMapInfo(res) { |
| | | // console.log(res); |
| | | if (res.length > 0) { |
| | | this.childObj = null |
| | | if (res && res.length > 0) { |
| | | this.childObj = res; |
| | | setTimeout(() => { |
| | | this.$nextTick(() => { |
| | | this.$refs && this.$refs.mapInfo && this.$refs.mapInfo.open(); |
| | | }, 200); |
| | | }) |
| | | |
| | | } else { |
| | | return |
| | | } |
| | | }, |
| | | mapViewStart() { |
| | |
| | | |
| | | |
| | | |
| | | setTimeout(() => { |
| | | console.log(store.getters.mapInfo); |
| | | }, 500); |
| | | |
| | | }, |
| | | |
| | | |
| | |
| | | <atlas v-if="isShow == '知识图谱'"></atlas> |
| | | <analysis v-if="isShow == '数据分析'"></analysis> |
| | | <statistics v-if="isShow == '数据统计'"></statistics> |
| | | <line-loss v-if="isShow == '数字线损'"></line-loss> |
| | | <line-loss v-if="isShow == '配网运检'"></line-loss> |
| | | <semanticFunction v-if="isShow == '语义功能'"></semanticFunction> |
| | | </div> |
| | | |
| | |
| | | import mapServer from '../../../assets/js/mapSdk/mapServe'; |
| | | |
| | | import * as turf from '@turf/turf'; |
| | | const mapWeather = { |
| | | regionWeather: null, |
| | | particle: null, |
| | | showRain: 'ShowRain', |
| | | closeRegionWeather() { |
| | | if (this.regionWeather) { |
| | | this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_NONE; |
| | |
| | | this.particle.deleteObject(); |
| | | this.particle = null; |
| | | } |
| | | for (var i in Viewer.scene.primitives._primitives) { |
| | | const name = Viewer.scene.primitives._primitives[i].name; |
| | | if (name && name == this.showRain) { |
| | | Viewer.scene.primitives.remove(Viewer.scene.primitives._primitives[i]); |
| | | } |
| | | } |
| | | }, |
| | | setRegionWeatherType(response) { |
| | | this.closeRegionWeather(); |
| | | if (!this.regionWeather) { |
| | | this.getRegionWather(response); |
| | | } |
| | | |
| | | const coord = this.getCoord(response); |
| | | earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0); |
| | | |
| | | switch (response.type) { |
| | | case 'rain': |
| | | this.showRain(); |
| | | // earthCtrl.camera.flyTo(coord[0], coord[1], 8000, 0, -90, 0, 0); |
| | | this.showRain(response); |
| | | |
| | | break; |
| | | case 'fire': |
| | | this.showFire(response); |
| | | earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0); |
| | | break; |
| | | case 'snow': |
| | | this.showSnow(); |
| | | earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0); |
| | | break; |
| | | } |
| | | }, |
| | |
| | | obj, |
| | | { |
| | | translation: SmartEarth.Cesium.Cartesian3.fromElements(0, 0, 0), //平移 |
| | | particleSize:10 |
| | | particleSize: 10, |
| | | }, |
| | | function (data) {} |
| | | ); |
| | | }, |
| | | |
| | | showRain() { |
| | | if (this.regionWeather) { |
| | | this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_RAIN; |
| | | this.regionWeather.regionAlpha = 0.6; |
| | | this.regionWeather.regionGradientDistance = 300; |
| | | showRain(res) { |
| | | var area = []; |
| | | var std =[]; |
| | | for (var i = 0; i < res.area.length; i += 3) { |
| | | area.push(res.area[i]); |
| | | area.push(res.area[i + 1]); |
| | | std.push([res.area[i],res.area[i + 1]]) |
| | | } |
| | | std.push(std[0]) |
| | | |
| | | |
| | | const polygon = turf.polygon([std]); |
| | | |
| | | const centerPoint = turf.center(polygon); |
| | | const coord= centerPoint.geometry.coordinates; |
| | | earthCtrl.camera.flyTo(coord[0], coord[1], 8000, 0, -90, 0, 0); |
| | | |
| | | const geometry = new Cesium.PolygonGeometry({ |
| | | polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(area)), |
| | | height: 0, // 底面高度 |
| | | extrudedHeight: 0.2, // 水面高度 |
| | | ellipsoid: Cesium.Ellipsoid.WGS84, |
| | | }); |
| | | |
| | | // 2. 创建GeometryInstance |
| | | const geometryInstances = new Cesium.GeometryInstance({ geometry }); |
| | | |
| | | // 3. 创建material |
| | | const material = new Cesium.Material({ |
| | | fabric: { |
| | | type: 'Water', |
| | | uniforms: { |
| | | baseWaterColor: new Cesium.Color(0.25, 0.6, 0.9, 0.5), // 水面颜色 |
| | | normalMap: config.images + 'waterNormals.jpg', // 贴图 |
| | | frequency: 5000, // 水波纹数量 |
| | | animationSpeed: 0.02, // 水流速 |
| | | amplitude: 30, // 水波纹振动幅度 |
| | | specularIntensity: 5, // 镜面反射强度 |
| | | }, |
| | | }, |
| | | }); |
| | | // 4. 创建Appearance |
| | | const appearance = new Cesium.EllipsoidSurfaceAppearance({ |
| | | aboveGround: true, |
| | | material, |
| | | }); |
| | | // 5. 创建primitive |
| | | var primitive = new Cesium.Primitive({ |
| | | geometryInstances, |
| | | appearance, |
| | | }); |
| | | primitive.name = this.showRain; |
| | | Viewer.scene.primitives.add(primitive); |
| | | |
| | | // Viewer.camera.lookAt(primitive.boundingSphere.center, new Cesium.HeadingPitchRange(0.0, Cesium.Math.toRadians(-90), 5000)); |
| | | // if (this.regionWeather) { |
| | | // this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_RAIN; |
| | | // this.regionWeather.regionAlpha = 0.6; |
| | | // this.regionWeather.regionGradientDistance = 300; |
| | | // } |
| | | }, |
| | | |
| | | showSnow() { |
| | | if (this.regionWeather) { |
| | | this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_SNOW; |
| | |
| | | } |
| | | }, |
| | | getCoord(res) { |
| | | const coord = res.point.split(','); |
| | | |
| | | |
| | | const coord = res.point.split(','); |
| | | return coord; |
| | | }, |
| | | getRegionWather(res) { |
| | |
| | | primitive: model[0].layer.item, |
| | | position: new SmartEarth.Cesium.Cartesian3.fromDegrees(coord[0], coord[1], 1), |
| | | radius: 1000, |
| | | }) |
| | | }); |
| | | }, |
| | | }; |
| | | |
| | |
| | | addRoadLayer() { |
| | | earthCtrl.factory.createPathLayer({ |
| | | url: road, |
| | | color: "#00FA9A", //线的颜色 |
| | | width: 4.0, //线的宽度 |
| | | // color: "#00FA9A", //线的颜色 |
| | | color: "#ff0000", //线的颜色 |
| | | width: 5.0, //线的宽度 |
| | | pointColor: "#FFFFFF", //移动点的颜色 |
| | | speed: 1, |
| | | far: 50000 |
| | |
| | | handleClick(item) { |
| | | this.removeLabel(); |
| | | // const point = mapConfig.getWKTParse(item.point) |
| | | const point = item.point.split(" ") |
| | | const point = item.point.split(",") |
| | | this.label = earthCtrl.factory.createLabel({ |
| | | lon: point[0], |
| | | lat: point[1], |