1
guanqb
2024-01-20 f13afcb61276061871b30bce17a7877287df0b67
src/utils/EntityDraw.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-10-18 17:17:50
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-11-17 16:29:06
 * @LastEditTime: 2022-11-18 09:22:49
 * @FilePath: \srs-police-affairs\src\utils\EntityDraw.js
 * @Description: 
 * 
@@ -61,6 +61,8 @@
        this.getMoveEvent = this.getMoveEvent.bind(this)
        this.getRightEvent = this.getRightEvent.bind(this)
        this.resizePolyLineGon = this.resizePolyLineGon.bind(this)
        this.Cesium = global.DC.Namespace.Cesium
        this.eventHandler = new global.DC.Namespace.Cesium.ScreenSpaceEventHandler(global.viewer.scene.canvas)
@@ -84,6 +86,9 @@
        // 添加编辑点图层
        this.emitPointLayer = new global.DC.VectorLayer('emitPointLayer')
        global.viewer.addLayer(this.emitPointLayer)
        // global.viewer.scene.globe.depthTestAgainstTerrain = true
    }
    // draw执行这个
@@ -102,10 +107,9 @@
        this.registerEvents()
        this.initLeftDownEventHandler()
        this.initLeftUpEventHandler()
        this.initMouseMoveEventHandler()
        // this.initLeftDownEventHandler()
        // this.initLeftUpEventHandler()
        // this.initMouseMoveEventHandler()
    }
    deactivate () {
@@ -236,13 +240,8 @@
                return
            }
        }
        this.lastEventData = event.windowPosition
        this.cb(this.lastEventData)
        this.terminateShape()
    }
    getLastEventData () {
        return this.lastEventData
        this.terminateShape()
    }
    terminateShape () {
@@ -268,13 +267,13 @@
            this.drawPolylineLayer.addOverlay(polyline)
            this.addPolyLineGon(100)
            this.addPolyLineGon(100, this.cb)
            this.EditMoveCenterPositoin = this.Cesium.Cartesian3.fromDegrees(this.drawCompletePosition[this.drawCompletePosition.length - 1].lng + 200 * lngOneM, this.drawCompletePosition[this.drawCompletePosition.length - 1].lat + 200 * latOneM, 0)
            // this.EditMoveCenterPositoin = this.Cesium.Cartesian3.fromDegrees(this.drawCompletePosition[this.drawCompletePosition.length - 1].lng + 200 * lngOneM, this.drawCompletePosition[this.drawCompletePosition.length - 1].lat + 200 * latOneM, 0)
            global.viewer.scene.globe.depthTestAgainstTerrain = true
            this.createEditMoveCenterEntity()
            // this.createEditMoveCenterEntity()
        } else {
            let polygon = new global.DC.Polygon(this.drawCompletePosition)
@@ -284,7 +283,17 @@
                )
            })
            // console.log(polygon, 999)
            this.drawPolygonLayer.addOverlay(polygon)
            this.lastEventData = {
                type: 'polygon',
                data: this.drawCompletePosition
            }
            this.cb(this.lastEventData)
        }
        this.clickInTheProcess()
@@ -339,7 +348,11 @@
        this.drawCompletePosition = []
    }
    addPolyLineGon (num) {
    resizePolyLineGon (num) {
        this.addPolyLineGon(num)
    }
    addPolyLineGon (num, cb) {
        this.drawPolyLineGonLayer.clear()
        let coords = global.DC.GeoTools.polylineBuffer(this.drawCompletePosition, num)
@@ -351,6 +364,14 @@
        })
        this.drawPolyLineGonLayer.addOverlay(polygon)
        this.lastEventData = {
            type: 'line',
            data: coords,
            lineData: this.drawCompletePosition
        }
        cb(this.lastEventData)
    }
    //场景鼠标左键按下事件