| | |
| | | <div> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getList">搜索</el-button> |
| | | <el-button @click="cancelSearch">取消</el-button> |
| | | <el-button @click="cancelSearch">清空</el-button> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | |
| | | viewer.entities.removeAll() |
| | | const { longitude, latitude } = cartesian3Convert(viewer.scene.pickPosition(movement.position), viewer) |
| | | let result = await getLnglatAltitude(longitude, latitude, viewer) |
| | | let height = result.height + 60 |
| | | let height = result.height + 2 |
| | | const point = { longitude, latitude, height } |
| | | pointList.value.push(point) |
| | | ShowTwoPoints() |
| | |
| | | const position = Cesium.Cartesian3.fromDegrees( |
| | | Number(item.longitude), |
| | | Number(item.latitude), |
| | | Number(item.height) |
| | | Number(item.height), |
| | | ) |
| | | viewer.entities.add({ |
| | | id: `point-${index}`, |
| | | position: position, |
| | | billboard: { |
| | | image: new Cesium.ConstantProperty(newStartPoint), |
| | | width: 40, |
| | | height: 40, |
| | | point: { |
| | | pixelSize: 10, |
| | | color: Cesium.Color.fromCssColorString('#FFFFFF'), |
| | | clampToGround: true, |
| | | heightReference: Cesium.HeightReference.NONE, |
| | | }, |
| | | }) |
| | | viewer?.entities.add({ |
| | | id: 'placement-' + index, |
| | | position: position, |
| | | polyline: getPolyLine(viewer, { value: pointList.value }, index), |
| | | }) |
| | | // viewer?.entities.add({ |
| | | // id: 'placement-' + index, |
| | | // position: position, |
| | | // polyline: getPolyLine(viewer, { value: pointList.value }, index), |
| | | // }) |
| | | }) |
| | | if (pointList.value.length < 2) return |
| | | const position1 = Cesium.Cartesian3.fromDegrees( |
| | | Number(pointList.value[0].longitude), |
| | | Number(pointList.value[0].latitude), |
| | |
| | | |
| | | viewer.entities.add({ |
| | | rectangle: { |
| | | coordinates: Cesium.Rectangle.fromDegrees(west, south, east, north), |
| | | material: Cesium.Color.RED.withAlpha(0.5), |
| | | outline: true, |
| | | outlineColor: Cesium.Color.RED, |
| | | outlineWidth: 2, |
| | | height: 60, |
| | | extrudedHeight: 60, |
| | | heightReference: Cesium.HeightReference.NONE |
| | | // disableDepthTestDistance: Number.POSITIVE_INFINITY, |
| | | coordinates: Cesium.Rectangle.fromDegrees(west, south, east, north), |
| | | material: Cesium.Color.RED.withAlpha(0.5), |
| | | outline: true, |
| | | outlineColor: Cesium.Color.RED, |
| | | outlineWidth: 2, |
| | | height: pointList.value[1].height, |
| | | extrudedHeight: pointList.value[1].height, |
| | | heightReference: Cesium.HeightReference.NONE, |
| | | } |
| | | }); |
| | | // 获取两点在屏幕上的位置 |
| | | // const screenPos1 = Cesium.SceneTransforms?.wgs84ToWindowCoordinates?.(viewer.scene, position1) |
| | | // || viewer.scene.cartesianToCanvasCoordinates(position1); |
| | | // const screenPos2 = Cesium.SceneTransforms?.wgs84ToWindowCoordinates?.(viewer.scene, position2) |
| | | // || viewer.scene.cartesianToCanvasCoordinates(position2); |
| | | |
| | | // // // 生成屏幕矩形 |
| | | // const boundingRect = new Cesium.BoundingRectangle( |
| | | // Math.min(screenPos1.x, screenPos2.x), |
| | | // Math.min(screenPos1.y, screenPos2.y), |
| | | // Math.abs(screenPos1.x - screenPos2.x), |
| | | // Math.abs(screenPos1.y - screenPos2.y) |
| | | // ); |
| | | // const center = Cesium.Cartesian3.midpoint(screenPos1, screenPos2, new Cesium.Cartesian3()); |
| | | // const angle = Cesium.Math.PI_OVER_FOUR; // 45度 |
| | | |
| | | // viewer.entities.add({ |
| | | // position: center, |
| | | // rectangle: { |
| | | // coordinates: boundingRect, |
| | | // material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | // rotation: angle // 弧度制旋转 |
| | | // } |
| | | // }); |
| | | // viewer.entities.add({ |
| | | // id: `line`, |
| | | // polyline: { |