fix: 轨迹黑屏问题优化,防止进入车检页面再进考试界面黑屏问题
This commit is contained in:
parent
829cb9e576
commit
4f76c81429
@ -5,9 +5,9 @@
|
||||
"name": "default",
|
||||
"material": {
|
||||
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer",
|
||||
"storePassword": "0000001BC64885799C5237EE8F4A1DD2F6A02E9E9ECDF000224536FC73A97B0762A9DE3DA53E12989713A5",
|
||||
"storePassword": "0000001B3C172BE457130742FD9398569777C93BBF9F9BBC9FA403F3FD8E06D5893F3D14B1789DF6E0F242",
|
||||
"keyAlias": "debugKey",
|
||||
"keyPassword": "0000001B4C1141AC4B73DF3FB5112EDFA2017F07BD680B5ACEC3FAA37E9C84DD4B8DA0C9EBBB4605A7DAD4",
|
||||
"keyPassword": "0000001BEB9FF05D2B1A12791F121AFD8768580FD640018F6A394C3992EF05F73C2CEFAA130DE40703DFE8",
|
||||
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12"
|
||||
|
||||
@ -2,6 +2,7 @@ import { PerLane } from '../../../model/index'
|
||||
import { dConsole } from '../../../utils/LogWorker'
|
||||
import SignalDisplayComponent from '../../compontents/SignalDisplay'
|
||||
import TabComponent from '../../compontents/Tab'
|
||||
import TrajectoryViewComponent from '../../compontents/TrajectoryView'
|
||||
|
||||
@CustomDialog
|
||||
export default struct SignalTrajectoryDialog {
|
||||
@ -38,10 +39,16 @@ export default struct SignalTrajectoryDialog {
|
||||
|
||||
Scroll() {
|
||||
Column() {
|
||||
SignalDisplayComponent({
|
||||
active: this.active,
|
||||
laneSignal: this.laneSignal
|
||||
})
|
||||
if (this.active !== 2) {
|
||||
SignalDisplayComponent({
|
||||
active: this.active,
|
||||
})
|
||||
} else {
|
||||
TrajectoryViewComponent({
|
||||
laneSignal: this.laneSignal
|
||||
})
|
||||
}
|
||||
|
||||
}.height(890)
|
||||
}.width("100%")
|
||||
.height(700)
|
||||
|
||||
@ -45,7 +45,6 @@ struct SignDisplayPage {
|
||||
|
||||
SignalDisplayComponent({
|
||||
active: this.active,
|
||||
laneSignal: this.laneSignal
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
|
||||
25
entry/src/main/ets/pages/compontents/Block.ets
Normal file
25
entry/src/main/ets/pages/compontents/Block.ets
Normal file
@ -0,0 +1,25 @@
|
||||
@Component
|
||||
export default struct BlockComponent {
|
||||
@State label: string = "发送次数"
|
||||
@Prop value: string = "1"
|
||||
@State widthNum: number = 130
|
||||
@State heightNum: number = 70
|
||||
@State color: string = "#FDF5E7"
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Row() {
|
||||
Text(this.label + ":").fontColor(this.color).fontSize(14)
|
||||
}.width(this.widthNum).justifyContent(FlexAlign.End)
|
||||
|
||||
Row() {
|
||||
Text(this.value).fontColor(this.color)
|
||||
}.width(80).justifyContent(FlexAlign.Start).margin({
|
||||
left: 20
|
||||
})
|
||||
}
|
||||
.height(this.heightNum)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
}
|
||||
}
|
||||
36
entry/src/main/ets/pages/compontents/Coordinate.ets
Normal file
36
entry/src/main/ets/pages/compontents/Coordinate.ets
Normal file
@ -0,0 +1,36 @@
|
||||
import { SignalDataType } from '../../model'
|
||||
import BlockComponent from './Block'
|
||||
|
||||
@Component
|
||||
export default struct CoordinateComponent {
|
||||
@Prop data: Array<SignalDataType>
|
||||
@State isItHorizontal: boolean = true
|
||||
@State heightNum: number = 65
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Text("GPS坐标").fontColor("#FFB433").fontSize(20).margin({
|
||||
top: 10
|
||||
})
|
||||
Flex({
|
||||
wrap: FlexWrap.Wrap,
|
||||
direction: this.isItHorizontal ? FlexDirection.Row : FlexDirection.Column
|
||||
}) {
|
||||
ForEach(this.data, (item: SignalDataType) => {
|
||||
BlockComponent({
|
||||
heightNum: this.heightNum,
|
||||
color: "#FFB433",
|
||||
label: item.key,
|
||||
value: item.value
|
||||
})
|
||||
})
|
||||
}.width("100%")
|
||||
}
|
||||
.width("100%")
|
||||
.height(this.isItHorizontal ? 210 : "100%")
|
||||
.backgroundColor("#1A1A1A")
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,11 @@
|
||||
import { GPSData, SignalData } from '../../mock';
|
||||
import {
|
||||
EnvironmentConfigurationType,
|
||||
PerLane,
|
||||
RoadDataType,
|
||||
SignalDataType,
|
||||
WorkerBackMessage,
|
||||
WorkerBackMessageType
|
||||
} from '../../model';
|
||||
import { EnvironmentConfigurationType, SignalDataType, WorkerBackMessage, WorkerBackMessageType } from '../../model';
|
||||
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker';
|
||||
import { examJudgeMapSetDrawing, examJudgeMapSetScaling } from '../Judge/JudgeUtils';
|
||||
import { dConsole } from '../../utils/LogWorker';
|
||||
import { SignDisplayTag } from '../../config';
|
||||
import CoordinateComponent from './Coordinate';
|
||||
import BlockComponent from './Block';
|
||||
|
||||
|
||||
@Component
|
||||
@ -26,12 +20,6 @@ export default struct SignalDisplayComponent {
|
||||
@Prop active: number = 0
|
||||
// 原始数据
|
||||
@State rawData: string = "$GPS,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
|
||||
// 车道信息
|
||||
@Link @Watch("laneSignalChange") laneSignal: PerLane
|
||||
|
||||
laneSignalChange() {
|
||||
dConsole.log("车道信号变化333", this.laneSignal)
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
DifferentialAndSignal.onMsg(this.getMsg)
|
||||
@ -128,28 +116,6 @@ export default struct SignalDisplayComponent {
|
||||
Column() {
|
||||
Text(this.rawData).fontSize(20).fontColor("#fff")
|
||||
}.backgroundColor("#282828").width("100%").height("100%")
|
||||
} else {
|
||||
// 轨迹查看
|
||||
Flex() {
|
||||
Column() {
|
||||
CoordinateComponent({
|
||||
isItHorizontal: false,
|
||||
heightNum: 40,
|
||||
data: this.GPSColum
|
||||
})
|
||||
}.width("20%")
|
||||
|
||||
Column() {
|
||||
LaneComponent({
|
||||
laneSignal: this.laneSignal
|
||||
})
|
||||
}.width("20%")
|
||||
|
||||
Column() {
|
||||
trajectoryComponent()
|
||||
}.height("100%").width("60%")
|
||||
|
||||
}.backgroundColor("#282828").width("100%").height("100%")
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
@ -161,122 +127,6 @@ export default struct SignalDisplayComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct trajectoryComponent {
|
||||
@State scaleNum: number = 100
|
||||
scaleFn = async (num: number) => {
|
||||
console.log("缩放传入数据", num.toString())
|
||||
const scaleNum = this.scaleNum
|
||||
if (scaleNum > 0 && scaleNum < 5000) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
if (scaleNum === 0 && num > 0) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
if (scaleNum > 5000 && num < 0) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
console.log("缩放数据", this.scaleNum.toString())
|
||||
await examJudgeMapSetScaling(this.scaleNum);
|
||||
}
|
||||
getScaleNum = (): number => {
|
||||
const scaleNum = this.scaleNum;
|
||||
if (scaleNum < 200) return 10;
|
||||
if (scaleNum < 400) return 30;
|
||||
if (scaleNum < 600) return 50;
|
||||
if (scaleNum < 800) return 70;
|
||||
if (scaleNum < 1000) return 100;
|
||||
if (scaleNum < 2000) return 500;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack({
|
||||
alignContent: Alignment.TopEnd
|
||||
}) {
|
||||
XComponent({
|
||||
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
|
||||
type: 'surface',
|
||||
// libraryname: 'JudgeSdk'
|
||||
libraryname: 'judgesdk'
|
||||
})
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.onLoad(() => {
|
||||
dConsole.log("开始绘制")
|
||||
examJudgeMapSetDrawing(true)
|
||||
})
|
||||
.onDestroy(() => {
|
||||
dConsole.log("结束绘制")
|
||||
examJudgeMapSetDrawing(false)
|
||||
})
|
||||
Row() {
|
||||
Image($rawfile('judge/big.png')).width(60).onClick(() => {
|
||||
this.scaleFn(-this.getScaleNum())
|
||||
})
|
||||
Image($rawfile('judge/small.png')).width(60).onClick(() => {
|
||||
this.scaleFn(this.getScaleNum())
|
||||
}).margin({ left: 20 })
|
||||
}.align(Alignment.TopEnd)
|
||||
}.width("100%").height("100%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
struct LaneComponent {
|
||||
@Link laneSignal: PerLane
|
||||
private RoadData: Array<RoadDataType> = [
|
||||
{ name: '路段组号', key: 'MapRoad_Code_No' },
|
||||
{ name: '路段编码', key: 'MapRoad_Name' },
|
||||
{ name: '车轮压线', key: ['TouchLineType', 'TouchDir'] },
|
||||
{ name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] },
|
||||
{ name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] },
|
||||
{ name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] },
|
||||
{ name: '后车点道', key: ['BackPointLaneNo', 'BackPointLaneCount'] },
|
||||
{ name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] },
|
||||
{ name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] },
|
||||
{ name: '右前/后车身边线', key: ['Body_RF_ToBaseLine', 'Body_RB_ToBaseLine'] },
|
||||
{ name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] },
|
||||
{ name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] },
|
||||
{ name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] },
|
||||
{ name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] },
|
||||
{ name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr', 'DirInverse'] },
|
||||
{ name: '形状', key: ['InShapeAttr', 'ShapeNo', 'ShapeNoWheel'] },
|
||||
{ name: '路段点', key: ['CrossPointNo'] },
|
||||
]
|
||||
|
||||
getValues(roadColumn: RoadDataType) {
|
||||
dConsole.log(SignDisplayTag, "车道信息", this.laneSignal)
|
||||
let key = roadColumn.key;
|
||||
let str = ''
|
||||
if (Array.isArray(key)) {
|
||||
key.forEach((k, index) => {
|
||||
str += (Reflect.get(this.laneSignal, k) === undefined ? '' : Reflect.get(this.laneSignal, k)) + (index == key.length - 1 ? '' : '/')
|
||||
})
|
||||
} else {
|
||||
str = Reflect.get(this.laneSignal, key) === undefined ? '' : Reflect.get(this.laneSignal, key)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text("车道信息").fontSize(20).fontColor("#FFB433").margin({
|
||||
top: 20
|
||||
})
|
||||
ForEach(this.RoadData, (item: RoadDataType) => {
|
||||
blockComponent({
|
||||
color: "#FFB433",
|
||||
heightNum: 40,
|
||||
label: item.name,
|
||||
value: this.getValues(item)
|
||||
})
|
||||
})
|
||||
}.width("100%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
struct GPSComponent {
|
||||
@ -299,59 +149,59 @@ struct GPSComponent {
|
||||
Flex({
|
||||
wrap: FlexWrap.Wrap
|
||||
}) {
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "发送次数",
|
||||
value: this.data[49] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "固件版本",
|
||||
value: this.data[54] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "方向盘类型",
|
||||
value: this.data[50] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "按键数值",
|
||||
value: this.data[55] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "GPS错误次数",
|
||||
value: this.data[60] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "汽车类型",
|
||||
value: this.data[51] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "GPS板卡类型",
|
||||
value: this.data[56] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "本机IP",
|
||||
value: this.ip
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "接口心跳",
|
||||
value: this.data[52] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "GPS板卡软件版本",
|
||||
value: this.data[57] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "改正数次数/改正数大小",
|
||||
value: this.data[58] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "已工作时长/设定工作时长",
|
||||
value: this.data[61] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "GPS数据次数/数据长度",
|
||||
value: this.data[59] || "-"
|
||||
})
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: "改正数据长度*数据长度-基准站RTCM改正数类型",
|
||||
value: this.data[62] || "-"
|
||||
})
|
||||
@ -368,7 +218,7 @@ struct CarComponent {
|
||||
wrap: FlexWrap.Wrap
|
||||
}) {
|
||||
ForEach(this.data, (item: SignalDataType) => {
|
||||
blockComponent({
|
||||
BlockComponent({
|
||||
label: item.key,
|
||||
value: item.value
|
||||
})
|
||||
@ -377,62 +227,4 @@ struct CarComponent {
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct CoordinateComponent {
|
||||
@Prop data: Array<SignalDataType>
|
||||
@State isItHorizontal: boolean = true
|
||||
@State heightNum: number = 65
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Text("GPS坐标").fontColor("#FFB433").fontSize(20).margin({
|
||||
top: 10
|
||||
})
|
||||
Flex({
|
||||
wrap: FlexWrap.Wrap,
|
||||
direction: this.isItHorizontal ? FlexDirection.Row : FlexDirection.Column
|
||||
}) {
|
||||
ForEach(this.data, (item: SignalDataType) => {
|
||||
blockComponent({
|
||||
heightNum: this.heightNum,
|
||||
color: "#FFB433",
|
||||
label: item.key,
|
||||
value: item.value
|
||||
})
|
||||
})
|
||||
}.width("100%")
|
||||
}
|
||||
.width("100%")
|
||||
.height(this.isItHorizontal ? 210 : "100%")
|
||||
.backgroundColor("#1A1A1A")
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct blockComponent {
|
||||
@State label: string = "发送次数"
|
||||
@Prop value: string = "1"
|
||||
@State widthNum: number = 130
|
||||
@State heightNum: number = 70
|
||||
@State color: string = "#FDF5E7"
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Row() {
|
||||
Text(this.label + ":").fontColor(this.color).fontSize(14)
|
||||
}.width(this.widthNum).justifyContent(FlexAlign.End)
|
||||
|
||||
Row() {
|
||||
Text(this.value).fontColor(this.color)
|
||||
}.width(80).justifyContent(FlexAlign.Start).margin({
|
||||
left: 20
|
||||
})
|
||||
}
|
||||
.height(this.heightNum)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
}
|
||||
}
|
||||
194
entry/src/main/ets/pages/compontents/TrajectoryView.ets
Normal file
194
entry/src/main/ets/pages/compontents/TrajectoryView.ets
Normal file
@ -0,0 +1,194 @@
|
||||
import { SignDisplayTag } from '../../config'
|
||||
import { GPSData } from '../../mock'
|
||||
import { PerLane, RoadDataType, SignalDataType, WorkerBackMessage, WorkerBackMessageType } from '../../model'
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
|
||||
import { dConsole } from '../../utils/LogWorker'
|
||||
import { examJudgeMapSetDrawing, examJudgeMapSetScaling } from '../Judge/JudgeUtils'
|
||||
import BlockComponent from './Block'
|
||||
import CoordinateComponent from './Coordinate'
|
||||
|
||||
@Component
|
||||
export default struct TrajectoryViewComponent {
|
||||
// GPS信号
|
||||
@State GPSColum: Array<SignalDataType> = GPSData
|
||||
// 车道信息
|
||||
@Link @Watch("laneSignalChange") laneSignal: PerLane
|
||||
|
||||
laneSignalChange() {
|
||||
dConsole.log("车道信号变化333", this.laneSignal)
|
||||
}
|
||||
|
||||
aboutToAppear(): void {
|
||||
DifferentialAndSignal.onMsg(this.getMsg)
|
||||
}
|
||||
|
||||
aboutToDisappear(): void {
|
||||
DifferentialAndSignal.offMsg(this.getMsg)
|
||||
}
|
||||
|
||||
getMsg = (data: string) => {
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
dConsole.log(SignDisplayTag, "wzj", data)
|
||||
if (result.type === WorkerBackMessageType.ObtainUdpData) {
|
||||
this.getSignal(result.data as string)
|
||||
}
|
||||
}
|
||||
getSignal = (msg: string) => {
|
||||
const newArr = msg.split(',')
|
||||
if (newArr[0] != '#DN_GD') {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let t = 0
|
||||
for (let i = 83; i <= 97; i++) {
|
||||
this.GPSColum[t].value = newArr[i]
|
||||
t++
|
||||
}
|
||||
this.GPSColum[14].value = ((Number((newArr[97] || 0)) * 1.852).toFixed(2)).toString()
|
||||
this.GPSColum[10].value = newArr[93]
|
||||
|
||||
this.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex() {
|
||||
Column() {
|
||||
CoordinateComponent({
|
||||
isItHorizontal: false,
|
||||
heightNum: 40,
|
||||
data: this.GPSColum
|
||||
})
|
||||
}.width("20%")
|
||||
|
||||
Column() {
|
||||
LaneComponent({
|
||||
laneSignal: this.laneSignal
|
||||
})
|
||||
}.width("20%")
|
||||
|
||||
Column() {
|
||||
trajectoryComponent()
|
||||
}.height("100%").width("60%")
|
||||
}.backgroundColor("#282828").width("100%").height("100%").borderRadius(10)
|
||||
}.width("100%").height("100%").backgroundColor("#fff").padding(10)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
struct LaneComponent {
|
||||
@Link laneSignal: PerLane
|
||||
private RoadData: Array<RoadDataType> = [
|
||||
{ name: '路段组号', key: 'MapRoad_Code_No' },
|
||||
{ name: '路段编码', key: 'MapRoad_Name' },
|
||||
{ name: '车轮压线', key: ['TouchLineType', 'TouchDir'] },
|
||||
{ name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] },
|
||||
{ name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] },
|
||||
{ name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] },
|
||||
{ name: '后车点道', key: ['BackPointLaneNo', 'BackPointLaneCount'] },
|
||||
{ name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] },
|
||||
{ name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] },
|
||||
{ name: '右前/后车身边线', key: ['Body_RF_ToBaseLine', 'Body_RB_ToBaseLine'] },
|
||||
{ name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] },
|
||||
{ name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] },
|
||||
{ name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] },
|
||||
{ name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] },
|
||||
{ name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr', 'DirInverse'] },
|
||||
{ name: '形状', key: ['InShapeAttr', 'ShapeNo', 'ShapeNoWheel'] },
|
||||
{ name: '路段点', key: ['CrossPointNo'] },
|
||||
]
|
||||
|
||||
getValues(roadColumn: RoadDataType) {
|
||||
dConsole.log(SignDisplayTag, "车道信息", this.laneSignal)
|
||||
let key = roadColumn.key;
|
||||
let str = ''
|
||||
if (Array.isArray(key)) {
|
||||
key.forEach((k, index) => {
|
||||
str += (Reflect.get(this.laneSignal, k) === undefined ? '' : Reflect.get(this.laneSignal, k)) + (index == key.length - 1 ? '' : '/')
|
||||
})
|
||||
} else {
|
||||
str = Reflect.get(this.laneSignal, key) === undefined ? '' : Reflect.get(this.laneSignal, key)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text("车道信息").fontSize(20).fontColor("#FFB433").margin({
|
||||
top: 20
|
||||
})
|
||||
ForEach(this.RoadData, (item: RoadDataType) => {
|
||||
BlockComponent({
|
||||
color: "#FFB433",
|
||||
heightNum: 40,
|
||||
label: item.name,
|
||||
value: this.getValues(item)
|
||||
})
|
||||
})
|
||||
}.width("100%")
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct trajectoryComponent {
|
||||
@State scaleNum: number = 100
|
||||
scaleFn = async (num: number) => {
|
||||
console.log("缩放传入数据", num.toString())
|
||||
const scaleNum = this.scaleNum
|
||||
if (scaleNum > 0 && scaleNum < 5000) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
if (scaleNum === 0 && num > 0) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
if (scaleNum > 5000 && num < 0) {
|
||||
this.scaleNum += num;
|
||||
}
|
||||
console.log("缩放数据", this.scaleNum.toString())
|
||||
await examJudgeMapSetScaling(this.scaleNum);
|
||||
}
|
||||
getScaleNum = (): number => {
|
||||
const scaleNum = this.scaleNum;
|
||||
if (scaleNum < 200) return 10;
|
||||
if (scaleNum < 400) return 30;
|
||||
if (scaleNum < 600) return 50;
|
||||
if (scaleNum < 800) return 70;
|
||||
if (scaleNum < 1000) return 100;
|
||||
if (scaleNum < 2000) return 500;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack({
|
||||
alignContent: Alignment.TopEnd
|
||||
}) {
|
||||
XComponent({
|
||||
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变
|
||||
type: 'surface',
|
||||
// libraryname: 'JudgeSdk'
|
||||
libraryname: 'judgesdk'
|
||||
})
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.onLoad(() => {
|
||||
dConsole.log("开始绘制")
|
||||
examJudgeMapSetDrawing(true)
|
||||
})
|
||||
.onDestroy(() => {
|
||||
dConsole.log("结束绘制")
|
||||
examJudgeMapSetDrawing(false)
|
||||
})
|
||||
Row() {
|
||||
Image($rawfile('judge/big.png')).width(60).onClick(() => {
|
||||
this.scaleFn(-this.getScaleNum())
|
||||
})
|
||||
Image($rawfile('judge/small.png')).width(60).onClick(() => {
|
||||
this.scaleFn(this.getScaleNum())
|
||||
}).margin({ left: 20 })
|
||||
}.align(Alignment.TopEnd)
|
||||
}.width("100%").height("100%")
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,8 +23,7 @@ export default class FileModel {
|
||||
|
||||
constructor(context: common.UIAbilityContext) {
|
||||
(async () => {
|
||||
const fileUtil = new FileUtils(context)
|
||||
this.fileUtil = fileUtil
|
||||
this.fileUtil = new FileUtils(context)
|
||||
})()
|
||||
|
||||
}
|
||||
|
||||
@ -339,9 +339,9 @@ export const GetPhotoBase64 = async (context: common.UIAbilityContext): Promise<
|
||||
} else {
|
||||
try {
|
||||
dConsole.info(JudgeTag, '拍照开始')
|
||||
const res = await takePhoto(videoConfig, context, 'pz/', 2);
|
||||
const res = await takePhoto(videoConfig!, context, 'pz/', 2);
|
||||
dConsole.info(JudgeTag, '拍照完成')
|
||||
return res.base64
|
||||
return res.base64 || ""
|
||||
} catch (e) {
|
||||
dConsole.error(JudgeTag, '拍照异常' + JSON.stringify(e))
|
||||
Prompt.showToast({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user