|
@@ -24,6 +24,13 @@
|
|
|
|
|
|
<script>
|
|
|
// import { getJctbhcInfo, getTiffPath } from "@/api/ghss/jctb.js";
|
|
|
+import VectorSource from "ol/source/Vector";
|
|
|
+import VectorLayer from "ol/layer/Vector";
|
|
|
+import Feature from "ol/Feature";
|
|
|
+import Point from "ol/geom/Point";
|
|
|
+import Style from "ol/style/Style";
|
|
|
+import Icon from "ol/style/Icon";
|
|
|
+
|
|
|
export default {
|
|
|
props: {
|
|
|
detailObj: {
|
|
@@ -40,6 +47,8 @@ export default {
|
|
|
monitorList: [
|
|
|
{
|
|
|
name: "11swm",
|
|
|
+ imagerLzb: "",
|
|
|
+ imagerBzb: "",
|
|
|
imagerPath:
|
|
|
"/analyse/全域土地整治/jctb/0/HN4602022023022004080074/1b9a9da4a23d426cab363ed369150b4f.jpg",
|
|
|
},
|
|
@@ -61,8 +70,8 @@ export default {
|
|
|
inputAction() {
|
|
|
this.handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
// 鼠标移动事件
|
|
|
- this.handler.setInputAction(function (movement) {
|
|
|
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
+ this.handler.setInputAction(function (movement) {},
|
|
|
+ Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
},
|
|
|
handleMouseEnter(a, b) {
|
|
|
this.ceshi(a.id, "yr");
|
|
@@ -82,48 +91,82 @@ export default {
|
|
|
ddd(obj) {
|
|
|
// 将经纬度转换为 Cartesian3 坐标,起始点
|
|
|
//起始点
|
|
|
- var startPosition = Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(obj.imagerLzb),
|
|
|
- Number(obj.imagerBzb)
|
|
|
- );
|
|
|
- let poi = this.getLonAndLat(
|
|
|
- Number(obj.imagerLzb),
|
|
|
- Number(obj.imagerBzb),
|
|
|
- Number(obj.imagerAngle),
|
|
|
- 20
|
|
|
- );
|
|
|
- //结束点
|
|
|
- var targetPosition = Cesium.Cartesian3.fromDegrees(poi.lng, poi.lat);
|
|
|
- // 创建一个实体来表示点
|
|
|
- var pointEntity = viewer.entities.add({
|
|
|
- id: "dw" + obj.id,
|
|
|
- position: startPosition, // 点的位置
|
|
|
- point: {
|
|
|
- heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 设置为贴地
|
|
|
- pixelSize: 10, // 点的大小
|
|
|
- color: Cesium.Color.RED, // 点的颜色
|
|
|
- outlineColor: Cesium.Color.BLACK, // 点的轮廓颜色
|
|
|
- outlineWidth: 2, // 点的轮廓宽度
|
|
|
- },
|
|
|
- });
|
|
|
+ // var startPosition = Cesium.Cartesian3.fromDegrees(
|
|
|
+ // Number(obj.imagerLzb),
|
|
|
+ // Number(obj.imagerBzb)
|
|
|
+ // );
|
|
|
+ // let poi = this.getLonAndLat(
|
|
|
+ // Number(obj.imagerLzb),
|
|
|
+ // Number(obj.imagerBzb),
|
|
|
+ // Number(obj.imagerAngle),
|
|
|
+ // 20
|
|
|
+ // );
|
|
|
+ // //结束点
|
|
|
+ // var targetPosition = Cesium.Cartesian3.fromDegrees(poi.lng, poi.lat);
|
|
|
+ // // 创建一个实体来表示点
|
|
|
+ // var pointEntity = viewer.entities.add({
|
|
|
+ // id: "dw" + obj.id,
|
|
|
+ // position: startPosition, // 点的位置
|
|
|
+ // point: {
|
|
|
+ // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 设置为贴地
|
|
|
+ // pixelSize: 10, // 点的大小
|
|
|
+ // color: Cesium.Color.RED, // 点的颜色
|
|
|
+ // outlineColor: Cesium.Color.BLACK, // 点的轮廓颜色
|
|
|
+ // outlineWidth: 2, // 点的轮廓宽度
|
|
|
+ // },
|
|
|
+ // });
|
|
|
// 创建一个实体来放置箭头
|
|
|
- var arrowEntity = viewer.entities.add({
|
|
|
- id: "jt" + obj.id,
|
|
|
- position: startPosition, // 设置箭头位置
|
|
|
- billboard: {
|
|
|
- // image: "http://192.168.176.1:8001/长箭头.png", // 设置箭头图标
|
|
|
- image: "/static/images/路径@3x-2.png", // 设置箭头图标
|
|
|
- width: 37, // 设置图标宽度
|
|
|
- height: 69, // 设置图标高度
|
|
|
- scale: 0.7, // 设置图标缩放
|
|
|
- rotation: Cesium.Math.toRadians(360 - Number(obj.imagerAngle)), // 可选,默认为0
|
|
|
- // rotation: Number(obj.imagerAngle), // 可选,默认为0
|
|
|
- heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 设置贴地
|
|
|
- },
|
|
|
- });
|
|
|
+ // var arrowEntity = viewer.entities.add({
|
|
|
+ // id: "jt" + obj.id,
|
|
|
+ // position: startPosition, // 设置箭头位置
|
|
|
+ // billboard: {
|
|
|
+ // // image: "http://192.168.176.1:8001/长箭头.png", // 设置箭头图标
|
|
|
+ // image: "/static/images/路径@3x-2.png", // 设置箭头图标
|
|
|
+ // width: 37, // 设置图标宽度
|
|
|
+ // height: 69, // 设置图标高度
|
|
|
+ // scale: 0.7, // 设置图标缩放
|
|
|
+ // rotation: Cesium.Math.toRadians(360 - Number(obj.imagerAngle)), // 可选,默认为0
|
|
|
+ // // rotation: Number(obj.imagerAngle), // 可选,默认为0
|
|
|
+ // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 设置贴地
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+
|
|
|
+ // // 聚焦视角到箭头位置
|
|
|
+ // viewer.zoomTo(arrowEntity);
|
|
|
|
|
|
- // 聚焦视角到箭头位置
|
|
|
- viewer.zoomTo(arrowEntity);
|
|
|
+ var vectorSource = new VectorSource();
|
|
|
+ window.map.mapDiv.addLayer(
|
|
|
+ new VectorLayer({
|
|
|
+ source: vectorSource,
|
|
|
+ style: new Style({
|
|
|
+ image: new Icon({
|
|
|
+ anchor: [0.5, 46], // 调整锚点以正确显示箭头尖端位置
|
|
|
+ anchorXUnits: "fraction",
|
|
|
+ anchorYUnits: "pixels",
|
|
|
+ src: "/static/images/路径@3x-2.png", // 替换为你的箭头图片路径
|
|
|
+ rotation: Math.PI / 4, //360 - Number(obj.imagerAngle),
|
|
|
+ }),
|
|
|
+ }), // 使用自定义样式
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ // 添加一个特征,并设置其旋转角度
|
|
|
+ var feature = new Feature({
|
|
|
+ geometry: new Point([0, 0]), // 设置位置
|
|
|
+ });
|
|
|
+ // feature.setStyle(
|
|
|
+ // new ol.style.Style({
|
|
|
+ // // 可以单独为特征设置样式以覆盖图层样式
|
|
|
+ // image: new ol.style.Icon({
|
|
|
+ // anchor: [0.5, 46], // 保持锚点设置不变
|
|
|
+ // anchorXUnits: "fraction",
|
|
|
+ // anchorYUnits: "pixels",
|
|
|
+ // src: "path/to/your/arrow.png", // 替换为你的箭头图片路径
|
|
|
+ // rotation: Math.PI / 4, // 设置旋转角度,例如45度角,Math.PI / 4 表示 π/4 弧度,即45度角。可以根据需要调整角度值。
|
|
|
+ // }),
|
|
|
+ // })
|
|
|
+ // );
|
|
|
+ vectorSource.addFeature(feature);
|
|
|
},
|
|
|
ceshi(id, evtName) {
|
|
|
let aaa = viewer.entities.getById("jt" + id);
|
|
@@ -236,7 +279,7 @@ export default {
|
|
|
// window.axiosURI +/file/upload/attachment
|
|
|
item.imagerPath =
|
|
|
"http://192.168.60.2:8080/file/upload/attachment" + item.imagerPath;
|
|
|
- // this.ddd(item);
|
|
|
+ this.ddd(item);
|
|
|
this.idArr.push(item.id);
|
|
|
});
|
|
|
// }
|