fuchengshen
2022-07-09 3a25c05b5ab837714f30469cdcb1e2a77d8d7f6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<template>
  <mars-pannel :visible="true" right="10" top="10" width="300">
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">视椎体状态:</span>
        <mars-button @click="locate">定位至卫星</mars-button>
        <mars-button @click="selPoint(formState.enabledSee)">{{ formState.enabledSee ? "取消凝视" : "凝视" }}</mars-button>
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">类型:</span>
        <a-radio-group v-model:value="value" name="radioGroup" @change="chkSensorType">
          <a-radio value="1">圆锥体</a-radio>
          <a-radio value="2">四棱锥体</a-radio>
        </a-radio-group>
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">前后侧摆:</span>
        <mars-slider @change="pitchChange" v-model:value="pitchValue" :min="-180" :max="180" :step="1" />值{{ pitchValue }}
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">左右侧摆:</span>
        <mars-slider @change="rollChange" v-model:value="rollValue" :min="-180" :max="180" :step="1" />值{{ rollValue }}
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">夹角1:</span>
        <mars-slider @change="angle1" v-model:value="angleValue1" :min="1" :max="89" :step="0.01" />值{{ angleValue1 }}
      </a-space>
    </div>
 
    <div class="f-mb" v-if="value === '2'">
      <a-space>
        <span class="mars-pannel-item-label">夹角2:</span>
        <mars-slider @change="angle2" v-model:value="angleValue2" :min="1" :max="89" :step="0.01" />值{{ angleValue2 }}
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">参考系轴:</span>
        <a-checkbox v-model:checked="formState.enabledShowMatrix" @change="chkShowModelMatrix">显示/隐藏</a-checkbox>
      </a-space>
    </div>
  </mars-pannel>
 
  <mars-pannel :visible="true" right="10" bottom="50px" width="293">
    <table class="mars-table tb-border">
      <tr>
        <td class="nametd">名称</td>
        <td id="td_name">{{ formState.name }}</td>
      </tr>
      <tr>
        <td class="nametd">TLE1</td>
        <td id="td_tle1">{{ formState.tle1 }}</td>
      </tr>
      <tr>
        <td class="nametd">TLE2</td>
        <td id="td_tle2">{{ formState.tle2 }}</td>
      </tr>
      <tr>
        <td class="nametd">时间</td>
        <td id="td_time">{{ formState.time }}</td>
      </tr>
 
      <tr>
        <td class="nametd">经度</td>
        <td id="td_jd">{{ formState.td_jd }}</td>
      </tr>
      <tr>
        <td class="nametd">经度</td>
        <td id="td_wd">{{ formState.td_wd }}</td>
      </tr>
      <tr>
        <td class="nametd">高程</td>
        <td id="td_gd">{{ formState.td_gd }}</td>
      </tr>
    </table>
  </mars-pannel>
</template>
 
<script lang="ts" setup>
import { onMounted, reactive, ref } from "vue"
import type { UnwrapRef } from "vue"
import * as mapWork from "./map.js"
 
interface FormState {
  enabledShowMatrix: boolean // 参考轴系
  enabledSee: boolean
  name: string
  tle1: string
  tle2: string
  time: string
  td_jd: number
  td_wd: number
  td_gd: string
}
 
const value = ref<string>("2")
const angleValue1 = ref<number>(30)
const angleValue2 = ref<number>(20)
const pitchValue = ref<number>(0) // 仰角
const rollValue = ref<number>(0) // 左右
 
const formState: UnwrapRef<FormState> = reactive({
  enabledShowMatrix: false,
  enabledSee: false,
  name: "",
  tle1: "",
  tle2: "",
  time: "",
  td_jd: 0,
  td_wd: 0,
  td_gd: "0米"
})
 
mapWork.eventTarget.on("satelliteChange", function (event: any) {
  const nowData = event.weixinData
  formState.name = nowData.name
  formState.tle1 = nowData.tle1
  formState.tle2 = nowData.tle2
  formState.time = nowData.time
  formState.td_jd = nowData.td_jd
  formState.td_wd = nowData.td_wd
  formState.td_gd = nowData.td_gd
})
 
 
// 俯仰角
const pitchChange = () => {
  mapWork.pitchChange(pitchValue.value)
}
 
// 左右角
const rollChange = () => {
  mapWork.rollChange(rollValue.value)
}
 
// 夹角
const angle1 = () => {
  mapWork.angle1(angleValue1.value)
}
 
const angle2 = () => {
  mapWork.angle2(angleValue2.value)
}
 
// 定位至卫星
const locate = () => {
  mapWork.locate()
}
 
// 凝视目标
const selPoint = (texShow: boolean) => {
  formState.enabledSee = !texShow
  if (!texShow) {
    mapWork.selPoint()
  }
  mapWork.selPoint()
}
 
// 参考轴系显示与隐藏
const chkShowModelMatrix = () => {
  mapWork.chkShowModelMatrix(formState.enabledShowMatrix)
}
 
// 类型选择
const chkSensorType = () => {
  mapWork.chkSensorType(value.value)
}
</script>
<style scoped lang="less">
th.column-money,
td.column-money {
  text-align: right !important;
}
.ant-slider {
  width: 110px;
}
.mars-table {
  width: 270px;
  border-collapse: collapse;
  border-spacing: 0;
}
 
.mars-table tr td {
  padding: 5px 10px;
  text-align: left;
}
 
.mars-table tr td:first-child {
  border-left: none;
}
 
.mars-table .nametd {
  padding: 5px 20px 5px 10px;
}
.tb-border {
  border: 1px solid #4db3ff70;
}
 
.tb-border tr td {
  border: 1px solid #4db3ff70;
}
</style>