Browse Source

将基站基本信息画在页面上

zhoutao 2 days ago
parent
commit
d302433361
1 changed files with 15 additions and 5 deletions
  1. 15 5
      pages/home/home.js

+ 15 - 5
pages/home/home.js

@@ -87,9 +87,6 @@ Page({
     },
     //初始化
     init() {
-        // //初始化画布
-        // this.initCanvas()
-
         //创建线程
         app.createWorker(this.workerMessageListenerHome)
 
@@ -366,7 +363,7 @@ Page({
         //画定位轨迹
         this.drawLocateTrack(2, coord.x, coord.y, this.data.coordDataList)
     },
-    //画定位轨迹,包括网格线、基站坐标、定位轨迹和当前位置
+    //画定位轨迹,包括网格线、基站信息、定位轨迹和当前位置
     drawLocateTrack(type, coordinateX, coordinateY, coordDataList) {
         let i = 0
         let pos = 0
@@ -424,7 +421,20 @@ Page({
         for (i = 0; i < this.data.btsDataList.length; i++) {
             let x = (this.data.btsDataList[i].dwCoordX - ctxMinX) * radio
             let y = this.data.canvasHeight - (this.data.btsDataList[i].dwCoordY - ctxMinY) * radio
-            positionCtx.fillRect(x - 5, y - 5, 6, 6);
+            const btsId = this.data.btsDataList[i].dwBtsId
+            const freqIndex = this.data.btsDataList[i].dwFreqIndex
+            const slot = this.data.btsDataList[i].dwSlot
+            const coord = "[" + this.data.btsDataList[i].dwCoordX / 100 + "," + this.data.btsDataList[i].dwCoordY / 100 + "," + this.data.btsDataList[i].dwCoordZ / 100 + "]"
+
+            positionCtx.fillStyle = "#FF0000"
+            positionCtx.fillRect(x - 5, y - 5, 6, 6);//基站标识符
+
+            positionCtx.fillStyle = "#000000"
+            positionCtx.fillText(btsId, x + 5, y - 15)//画基站ID
+            positionCtx.fillText("f: " + freqIndex, x + 5, y - 5)//画频率
+            positionCtx.fillText("t: " + slot, x + 5, y + 5)//时隙
+            positionCtx.fillText(coord, x + 5, y + 15)//坐标
+
         }
         if (type === 1) {//仅画基站
             return