| | |
| | | // this.getTableselectFields(); |
| | | // this.restSpacePopLayer(); |
| | | }, |
| | | |
| | | }, |
| | | created() { |
| | | this.spaceLayer = this.$store.state.mapSpaceQueryLayer |
| | |
| | | } |
| | | var coord = res.coordinates |
| | | |
| | | if (res.type == "Point") { |
| | | var val = Cesium.Cartesian3.fromDegrees( |
| | | res.coordinates[0], |
| | | res.coordinates[1] |
| | | ) |
| | | this.$store.state.primitLayer = Viewer.entities.add({ |
| | | properties: properties, |
| | | tag: "properties_point", |
| | | position: val, |
| | | billboard: { |
| | | // 图像地址,URI或Canvas的属性 |
| | | image: SmartEarthRootUrl + "Workers/image/mark.png", |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | // 大小是否以米为单位 |
| | | sizeInMeters: false, |
| | | // 相对于坐标的垂直位置 |
| | | verticalOrigin: Cesium.VerticalOrigin.CENTER, |
| | | // 相对于坐标的水平位置 |
| | | horizontalOrigin: Cesium.HorizontalOrigin.LEFT, |
| | | // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。 |
| | | scale: 1.0, |
| | | // 是否显示 |
| | | show: true, |
| | | }, |
| | | }) |
| | | this.$store.state.primitLayer.billboard.disableDepthTestDistance = |
| | | Number.POSITIVE_INFINITY |
| | | switch (res.type) { |
| | | case "Point": |
| | | var val = Cesium.Cartesian3.fromDegrees( |
| | | res.coordinates[0], |
| | | res.coordinates[1] |
| | | ) |
| | | var point = Viewer.entities.add({ |
| | | properties: properties, |
| | | tag: "properties_point", |
| | | position: val, |
| | | billboard: { |
| | | // 图像地址,URI或Canvas的属性 |
| | | image: SmartEarthRootUrl + "Workers/image/mark.png", |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | // 大小是否以米为单位 |
| | | sizeInMeters: false, |
| | | // 相对于坐标的垂直位置 |
| | | verticalOrigin: Cesium.VerticalOrigin.CENTER, |
| | | // 相对于坐标的水平位置 |
| | | horizontalOrigin: Cesium.HorizontalOrigin.LEFT, |
| | | // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。 |
| | | scale: 1.0, |
| | | // 是否显示 |
| | | show: true, |
| | | }, |
| | | }) |
| | | point.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY |
| | | this.$store.state.queryInfo.push(point) |
| | | sgworld.Navigate.flyToObj(point) |
| | | this.$store.state.primitLayer = point |
| | | |
| | | sgworld.Navigate.flyToObj(this.$store.state.primitLayer) |
| | | } else if (res.type == "MultiPolygon" || res.type == "LineString") { |
| | | var val = res.coordinates[0][0] |
| | | var std = [] |
| | | for (var i in val) { |
| | | std.push(val[i][0]) |
| | | |
| | | std.push(val[i][1]) |
| | | } |
| | | |
| | | this.$store.state.primitLayer = Viewer.entities.add({ |
| | | properties: properties, |
| | | tag: "properties_line", |
| | | |
| | | polyline: { |
| | | positions: Cesium.Cartesian3.fromDegreesArray(std), |
| | | width: 5, |
| | | material: new Cesium.Color(1.0, 0.0, 0.0, 0.3), |
| | | clampToGround: true, |
| | | }, |
| | | }) |
| | | |
| | | // this.$store.state.primitLayer = sgworld.Creator.createPolygon(std, { |
| | | // fillColor: '#ffff00', |
| | | // outlineColor: '#fff', |
| | | // outlineWidth: 2 |
| | | // }, 1, 0, "面"); |
| | | sgworld.Navigate.flyToObj(this.$store.state.primitLayer) |
| | | } else if (res.type == "MultiLineString") { |
| | | var line = res.coordinates[0] |
| | | var std = [] |
| | | for (var i in line) { |
| | | std.push({ x: line[i][0], y: line[i][1], z: 1000 }) |
| | | } |
| | | const polyline = sgworld.Creator.createPolyline( |
| | | std, |
| | | "#ffff00", |
| | | 1, |
| | | 0, |
| | | "线" |
| | | ) |
| | | const entity = polyline.item |
| | | entity.properties = properties |
| | | entity.tag = "properties_line" |
| | | |
| | | |
| | | this.$store.state.primitLayer = polyline |
| | | |
| | | sgworld.Navigate.flyToObj(entity) |
| | | break |
| | | case "LineString": |
| | | case "MultiLineString": |
| | | var line = res.coordinates[0] |
| | | var std = [] |
| | | for (var i in line) { |
| | | std.push(line[i][0], line[i][1]) |
| | | } |
| | | var polyline = Viewer.entities.add({ |
| | | properties: properties, |
| | | tag: "properties_line", |
| | | polyline: { |
| | | positions: Cesium.Cartesian3.fromDegreesArray(std), |
| | | width: 5, |
| | | material: new Cesium.Color(1.0, 0.0, 0.0, 0.3), |
| | | clampToGround: true, |
| | | }, |
| | | }) |
| | | this.$store.state.queryInfo.push(polyline) |
| | | sgworld.Navigate.flyToObj(polyline) |
| | | this.$store.state.primitLayer = polyline |
| | | break |
| | | case "MultiPolygon": |
| | | var val = res.coordinates[0][0] |
| | | var std = [] |
| | | for (var i in val) { |
| | | std.push(val[i][0], val[i][1]) |
| | | } |
| | | var entity = Viewer.entities.add({ |
| | | properties: properties, |
| | | tag: "properties_polygon", |
| | | polygon: { |
| | | hierarchy: Cesium.Cartesian3.fromDegreesArray(std), |
| | | //height : 100000, |
| | | material: new Cesium.Color(1.0, 0.0, 0.0, 0.3), |
| | | outline: true, |
| | | outlineColor: new Cesium.Color(1.0, 0.0, 0.0, 0.3), |
| | | }, |
| | | }) |
| | | this.$store.state.queryInfo.push(entity) |
| | | sgworld.Navigate.flyToObj(entity) |
| | | this.$store.state.primitLayer = entity |
| | | break |
| | | } |
| | | this.setMapHandler() |
| | | }, |
| | |
| | | ) |
| | | window.propertieshandler.setInputAction(event => { |
| | | let pick = sgworld.Viewer.scene.pick(event.position) |
| | | // ; |
| | | |
| | | if (pick && pick.id && pick.id.tag == "properties_point") { |
| | | this.$store.state.propertiesFlag = "1" |
| | | let properties = pick.id.properties |
| | | let propertyNames = pick.id.properties.propertyNames |
| | | let obj = {} |
| | | obj["eventid"] = properties["_eventid"]._value |
| | | // |
| | | this.attributeData.forEach(item => { |
| | | propertyNames.forEach(itemElement => { |
| | | if (itemElement == item.field) { |
| | | obj[item.alias] = properties[itemElement]._value |
| | | } |
| | | }) |
| | | }) |
| | | this.$store.state.propertiesInfo = obj |
| | | } else if (pick && pick.id && pick.id._polyline && pick.id.tag == "properties_line") { |
| | | if ( |
| | | pick && |
| | | pick.id && |
| | | pick.id.tag && |
| | | pick.id.tag.includes("properties_") |
| | | ) { |
| | | this.$store.state.propertiesFlag = "1" |
| | | let properties = pick.id.properties |
| | | let propertyNames = pick.id.properties.propertyNames |