|
@@ -19,12 +19,7 @@
|
|
|
</div>
|
|
|
</van-popup> -->
|
|
|
</div>
|
|
|
- <canvas
|
|
|
- id="canvas-b"
|
|
|
- class="canvas"
|
|
|
- width="500"
|
|
|
- height="180"
|
|
|
- ></canvas>
|
|
|
+ <canvas id="canvas-b" class="canvas" width="500" height="180"></canvas>
|
|
|
<Tool></Tool>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -33,10 +28,12 @@
|
|
|
// import Clipboard from "clipboard";
|
|
|
import { defineAsyncComponent } from "vue";
|
|
|
import Water from "@/utils/Water";
|
|
|
+import api from "@/api/content";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ JHEntityObj: {},
|
|
|
dialogVisible: false,
|
|
|
dialogInfoStr: "",
|
|
|
clipboard: null,
|
|
@@ -152,15 +149,15 @@ export default {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- window.addImage = this.addImage;
|
|
|
- window.changeImage = this.changeImage;
|
|
|
- addImage(globalVariable.viewer, {
|
|
|
- arr: [
|
|
|
- 121.12273519090121, 31.153827313511016, 3.280499471365055,
|
|
|
- 121.12273815983032, 31.153814774429165, 3.281036567079009,
|
|
|
- ],
|
|
|
- minH: [2.807028457880749, 2.807028457880749],
|
|
|
- });
|
|
|
+ // window.addImage = this.addImage;
|
|
|
+ // window.changeImage = this.changeImage;
|
|
|
+ // addImage(globalVariable.viewer, {
|
|
|
+ // arr: [
|
|
|
+ // 121.12273519090121, 31.153827313511016, 3.280499471365055,
|
|
|
+ // 121.12273815983032, 31.153814774429165, 3.281036567079009,
|
|
|
+ // ],
|
|
|
+ // minH: [2.807028457880749, 2.807028457880749],
|
|
|
+ // });
|
|
|
// window.tp =
|
|
|
// this.addImage(globalVariable.viewer, {
|
|
|
// arr: [
|
|
@@ -178,7 +175,7 @@ export default {
|
|
|
// ],
|
|
|
// minH: [2.8569308025328994, 2.8529680784118310]
|
|
|
// }, '../static/images/ceshi.png');
|
|
|
-
|
|
|
+ this.initJH();
|
|
|
return;
|
|
|
},
|
|
|
|
|
@@ -294,7 +291,8 @@ export default {
|
|
|
// }
|
|
|
// );
|
|
|
// }
|
|
|
- window.changeImage = this.changeImage;
|
|
|
+ // window.changeImage = this.changeImage;
|
|
|
+
|
|
|
// 水面加载
|
|
|
setTimeout(() => {
|
|
|
that.addWaterPanel();
|
|
@@ -367,7 +365,7 @@ export default {
|
|
|
container.addEventListener("pointermove", mousemove);
|
|
|
}
|
|
|
function mousemove(event) {
|
|
|
- var touch = event;
|
|
|
+ var touch = event;
|
|
|
//手势滑动时,手势坐标不断变化,取最后一点的坐标为最终的终点坐标
|
|
|
endX = touch.pageX;
|
|
|
distanceX = endX - startX;
|
|
@@ -660,8 +658,8 @@ export default {
|
|
|
// cartesian = Cesium.Cartesian3.fromDegrees(lng, lat, height);
|
|
|
// console.log("模型高度点", cartesian);
|
|
|
let str = `
|
|
|
- lon:${lon}
|
|
|
- lat:${lat}
|
|
|
+ lon:${lon},
|
|
|
+ lat:${lat},
|
|
|
height:${height}
|
|
|
`;
|
|
|
console.log(str);
|
|
@@ -678,6 +676,134 @@ export default {
|
|
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
},
|
|
|
|
|
|
+ initJH() {
|
|
|
+ let that = this;
|
|
|
+ window.getToken = function () {
|
|
|
+ return that.$store.getters.getToken;
|
|
|
+ };
|
|
|
+ this.getToken().then(() => {
|
|
|
+ serviceWindow.map(function (item, index) {
|
|
|
+ let pointArr = item.topPoint
|
|
|
+ .map(function (item_) {
|
|
|
+ return [item_.lon, item_.lat, item_.height];
|
|
|
+ })
|
|
|
+ .join()
|
|
|
+ .split(",")
|
|
|
+ .map((num) => Number(num));
|
|
|
+ that.getWindowInfo(item).then((info) => {
|
|
|
+ let image = that.createJHImage(item, info);
|
|
|
+ let entity = globalVariable.viewer.entities.add({
|
|
|
+ wall: {
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArrayHeights(pointArr),
|
|
|
+ minimumHeights: item.endHeight,
|
|
|
+ material: new Cesium.ImageMaterialProperty({
|
|
|
+ image: image,
|
|
|
+ transparent: true,
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ });
|
|
|
+ that.JHEntityObj[item.id] = {
|
|
|
+ item: item,
|
|
|
+ entity: entity,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 开始循环访问
|
|
|
+ setInterval(() => {
|
|
|
+ that.loopJH();
|
|
|
+ }, 5000); //3 * 60 * 1000
|
|
|
+ },
|
|
|
+ getToken() {
|
|
|
+ let that = this;
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ api.getToken().then(function (result) {
|
|
|
+ that.$store.commit("setToken", result.data);
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getWindowInfo(params) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ api.getWindowInfo({ id: params.id }).then(function (result) {
|
|
|
+ resolve(result.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ createJHImage(item, info) {
|
|
|
+ // win_code: "A02",
|
|
|
+ // win_id: "102",
|
|
|
+ // area_id: "310000310100310118001",
|
|
|
+ // win_status: "STOP",
|
|
|
+ // user_code: "742",
|
|
|
+ // user_name: "谢晨 ",
|
|
|
+ // ticket_uuid: "",
|
|
|
+ // ticket_code: "",
|
|
|
+ let width = 300,
|
|
|
+ height = 100;
|
|
|
+ var canvas = document.createElement("canvas");
|
|
|
+ canvas.width = 300;
|
|
|
+ canvas.height = 100;
|
|
|
+ var ctx = canvas.getContext("2d");
|
|
|
+ ctx.clearRect(0, 0, width, height);
|
|
|
+
|
|
|
+ ctx.fillStyle = "#000000";
|
|
|
+ ctx.fillRect(0, 0, width, height);
|
|
|
+
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.font = "30px Arial";
|
|
|
+ // ctx.fillText(item.id, 15, 60);
|
|
|
+ ctx.fillText(info.win_code, 15, 60);
|
|
|
+
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.lineWidth = "2";
|
|
|
+ ctx.strokeStyle = "#FF0000"; // Green path
|
|
|
+ ctx.moveTo(83, 10);
|
|
|
+ ctx.lineTo(83, 90);
|
|
|
+ ctx.stroke(); // Draw it
|
|
|
+
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.font = "30px Arial";
|
|
|
+ ctx.fillText(item.name, 100, 37);
|
|
|
+
|
|
|
+ if (info.win_status == "STOP") {
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.font = "30px Arial";
|
|
|
+ ctx.fillText("暂停服务", 116, 83);
|
|
|
+ } else {
|
|
|
+ if (info.ticket_code == "") {
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.font = "30px Arial";
|
|
|
+ ctx.fillText("欢迎光临", 116, 83);
|
|
|
+ } else {
|
|
|
+ ctx.fillStyle = "#FF0000";
|
|
|
+ ctx.font = "30px Arial";
|
|
|
+ ctx.fillText("请" + info.ticket_code + "号", 116, 83);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return canvas.toDataURL("image/png");
|
|
|
+ },
|
|
|
+ loopJH() {
|
|
|
+ let that = this;
|
|
|
+ this.getToken().then(() => {
|
|
|
+ let arr = Object.getOwnPropertyNames(that.JHEntityObj);
|
|
|
+ arr.map(function (index) {
|
|
|
+ let obj = that.JHEntityObj[index];
|
|
|
+ let item = obj.item;
|
|
|
+ that.getWindowInfo(obj.item).then((info) => {
|
|
|
+ let image = that.createJHImage(item, info);
|
|
|
+ obj.entity.wall.material = new Cesium.ImageMaterialProperty({
|
|
|
+ image: image,
|
|
|
+ transparent: true,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
// 地图添加图片
|
|
|
addImage(viewer, pObj, imgUrl) {
|
|
|
// // 顺时针
|