|
|
@@ -25,9 +25,17 @@
|
|
|
<script lang="ts">
|
|
|
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
|
|
|
import PipeUnitInfo from '@/views/groupPage/districtPageModules/pipeUnitInfo/index.vue'
|
|
|
+import artifactsInfo from '@/views/groupPage/districtPageModules/customTools/infoComponents/artifactsInfo.vue'
|
|
|
+import { createTooltip } from '@/views/groupPage/util'
|
|
|
+import { getLatAndLon } from '@/views/groupPage/util'
|
|
|
+const Cesium = (window as any).Cesium
|
|
|
//属性查看
|
|
|
@Component({ name: 'PropertiesView' })
|
|
|
export default class PropertiesView extends Vue {
|
|
|
+ toolTip = null
|
|
|
+ tooltipHandler = null
|
|
|
+ componentInfo = null
|
|
|
+ pipeInfo = null
|
|
|
options = [
|
|
|
{
|
|
|
value: 'bjck',
|
|
|
@@ -44,20 +52,41 @@ export default class PropertiesView extends Vue {
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- value: '工程查看',
|
|
|
- label: '工程查看'
|
|
|
+ value: 'component',
|
|
|
+ label: '构件查看'
|
|
|
}
|
|
|
]
|
|
|
- selectValue = null
|
|
|
+ selectValue = []
|
|
|
+ viewer
|
|
|
+ get isInitViewer() {
|
|
|
+ return this.$store.state.bigScreen.isInitViewer
|
|
|
+ }
|
|
|
+ get propertiesViewValue() {
|
|
|
+ return this.$store.state.bigScreen.propertiesViewValue
|
|
|
+ }
|
|
|
+ @Watch('isInitViewer')
|
|
|
+ onChangeViewMethod() {
|
|
|
+ this.viewer = (window as any).viewer
|
|
|
+ }
|
|
|
+ @Watch('propertiesViewValue')
|
|
|
+ onChangeValueMethod(val) {
|
|
|
+ this.selectValue = val
|
|
|
+ }
|
|
|
@Watch('selectValue')
|
|
|
onChangeMethod(val) {
|
|
|
+ if (!val) return
|
|
|
+ this.$store.state.bigScreen.propertiesViewValue = val
|
|
|
const type = [...val]
|
|
|
+ this.destroyLastOperation()
|
|
|
if (type.includes('point')) {
|
|
|
this.pipeUnitInfo('point')
|
|
|
}
|
|
|
if (type.includes('rect')) {
|
|
|
this.pipeUnitInfo('rect')
|
|
|
}
|
|
|
+ if (type.includes('component')) {
|
|
|
+ this.activeViewComponent()
|
|
|
+ }
|
|
|
}
|
|
|
mounted() {
|
|
|
let target = this.$refs['widget-PropertiesView'] as any
|
|
|
@@ -65,7 +94,7 @@ export default class PropertiesView extends Vue {
|
|
|
}
|
|
|
pipeUnitInfo(type) {
|
|
|
const pipeInfoConstructor = Vue.extend(PipeUnitInfo)
|
|
|
- const pipeInfo = new pipeInfoConstructor({
|
|
|
+ this.pipeInfo = new pipeInfoConstructor({
|
|
|
data: {
|
|
|
pickType: type,
|
|
|
isInteractive: true,
|
|
|
@@ -74,6 +103,64 @@ export default class PropertiesView extends Vue {
|
|
|
store: this.$store
|
|
|
}).$mount()
|
|
|
}
|
|
|
+ //构件查看激活
|
|
|
+ activeViewComponent() {
|
|
|
+ const that = this
|
|
|
+ this.toolTip = createTooltip(document.querySelector('#' + this.$store.state.bigScreen.mapContainerId))
|
|
|
+ const handler = new Cesium.ScreenSpaceEventHandler(this.viewer.canvas)
|
|
|
+ this.tooltipHandler = handler
|
|
|
+ // 设置要在输入事件上执行的功能,官方文档查询ScreenSpaceEventType可以看到所有的cesium鼠标事件
|
|
|
+ handler.setInputAction((movement) => {
|
|
|
+ var pickedObject = this.viewer.scene.pick(movement.position)
|
|
|
+ const coordinate = getLatAndLon(this.viewer, movement)
|
|
|
+ const position = Cesium.Cartesian3.fromDegrees(coordinate.longitude, coordinate.latitude, coordinate.altitude)
|
|
|
+ if (this.viewer.scene.pickPositionSupported && Cesium.defined(pickedObject)) {
|
|
|
+ const info = {
|
|
|
+ name: pickedObject.primitive._name
|
|
|
+ }
|
|
|
+ this.showInfoPanel(position, info)
|
|
|
+ }
|
|
|
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
|
|
|
+ handler.setInputAction((movement) => {
|
|
|
+ this.toolTip.showAt(movement.endPosition, '<p>鼠标左键选择构件进行查看,右键单击取消</p>')
|
|
|
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
|
|
|
+ handler.setInputAction(() => {
|
|
|
+ this.clearPickEvent()
|
|
|
+ this.selectValue = []
|
|
|
+ }, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
|
|
|
+ }
|
|
|
+ //显示构件信息
|
|
|
+ showInfoPanel(position, info) {
|
|
|
+ const artifactsInfoConstructor = Vue.extend(artifactsInfo)
|
|
|
+ const that = this
|
|
|
+ this.componentInfo = new artifactsInfoConstructor({
|
|
|
+ data: {
|
|
|
+ position,
|
|
|
+ info
|
|
|
+ },
|
|
|
+ store: this.$store
|
|
|
+ }).$mount()
|
|
|
+ }
|
|
|
+ //清除事件
|
|
|
+ clearPickEvent() {
|
|
|
+ if (this.componentInfo) {
|
|
|
+ this.componentInfo.close()
|
|
|
+ }
|
|
|
+ if (this.toolTip) {
|
|
|
+ this.toolTip.remove()
|
|
|
+ this.toolTip = null
|
|
|
+ }
|
|
|
+ if (this.tooltipHandler && !this.tooltipHandler.isDestroyed()) {
|
|
|
+ this.tooltipHandler.destroy()
|
|
|
+ this.tooltipHandler = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ destroyLastOperation() {
|
|
|
+ if (this.pipeInfo) {
|
|
|
+ this.pipeInfo.reset()
|
|
|
+ }
|
|
|
+ this.clearPickEvent()
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|