车位置
This commit is contained in:
parent
b300935498
commit
22b7993ffc
File diff suppressed because one or more lines are too long
@ -91,20 +91,44 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => InkWell(
|
() {
|
||||||
onTap: () {
|
Color color = appcontroller.isDarkMode.value
|
||||||
// Navigator.push(context,
|
? Colors.white70
|
||||||
// MaterialPageRoute(builder: (context) => const ScenceMap())),
|
: const Color.fromARGB(200, 29, 28, 28);
|
||||||
},
|
int status = realcontroller.status.value;
|
||||||
child: Image(
|
if (status == 4) {
|
||||||
image: const AssetImage('images/satellite.png'),
|
color = Colors.green;
|
||||||
// width: 40,
|
} else if (status == 1) {
|
||||||
color: appcontroller.isDarkMode.value
|
color = Colors.red;
|
||||||
? Colors.white70
|
} else {
|
||||||
: const Color.fromARGB(200, 29, 28, 28),
|
if (status != 0) {
|
||||||
height: 40,
|
color = Colors.blue;
|
||||||
),
|
}
|
||||||
),
|
}
|
||||||
|
String text = "";
|
||||||
|
text = "${realcontroller.sa.value}/${realcontroller.sv.value}";
|
||||||
|
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
// Navigator.push(context,
|
||||||
|
// MaterialPageRoute(builder: (context) => const ScenceMap())),
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
Image(
|
||||||
|
image: const AssetImage('images/satellite.png'),
|
||||||
|
// width: 40,
|
||||||
|
color: color,
|
||||||
|
height: 40,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
|
@ -114,8 +114,8 @@ class ProcessEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
factory ProcessEntity.fromString(String str) {
|
factory ProcessEntity.fromList(List<String> list) {
|
||||||
List<String> list = str.split(",");
|
|
||||||
return ProcessEntity(
|
return ProcessEntity(
|
||||||
utc:int.parse( list[2]),
|
utc:int.parse( list[2]),
|
||||||
lat: double.parse(list[3]),
|
lat: double.parse(list[3]),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:math';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:cpnav/pages/setting/child_pages/XyChange/xy_change.dart';
|
import 'package:cpnav/pages/setting/child_pages/XyChange/xy_change.dart';
|
||||||
@ -178,6 +179,9 @@ class RealController extends GetxController {
|
|||||||
impact_force: []).obs;
|
impact_force: []).obs;
|
||||||
var dataCount = 0.obs;
|
var dataCount = 0.obs;
|
||||||
CoordTrans? coordTrans;
|
CoordTrans? coordTrans;
|
||||||
|
var status = 0.obs;
|
||||||
|
var sa = 0.obs;
|
||||||
|
var sv = 0.obs;
|
||||||
reset() {
|
reset() {
|
||||||
sightOffset1.value = const Offset(3, 3);
|
sightOffset1.value = const Offset(3, 3);
|
||||||
sightOffsetInit1.value = const Offset(0, 0);
|
sightOffsetInit1.value = const Offset(0, 0);
|
||||||
@ -190,9 +194,23 @@ class RealController extends GetxController {
|
|||||||
var isDataVisible = false.obs;
|
var isDataVisible = false.obs;
|
||||||
onBleData(Uint8List data) {
|
onBleData(Uint8List data) {
|
||||||
String str = String.fromCharCodes(data);
|
String str = String.fromCharCodes(data);
|
||||||
|
String first = str.split("#POSA")[1];
|
||||||
ProcessEntity process = ProcessEntity.fromString(str);
|
List<String> list = first.split(",");
|
||||||
processdata.value = process;
|
double baseLine = double.parse(list[7]);
|
||||||
|
double heading = double.parse(list[8]);
|
||||||
|
double pitch = double.parse(list[9]);
|
||||||
|
status.value = int.parse(list[1]);
|
||||||
|
sa.value = int.parse(list[10]);
|
||||||
|
List<String> svStr = list[11].trim().split(" ");
|
||||||
|
sv.value = int.parse(svStr[0]);
|
||||||
|
ProcessEntity process = ProcessEntity.fromList(list);
|
||||||
|
processdata.update((value) {
|
||||||
|
// value.speed = process.speed;
|
||||||
|
value?.lat = process.lat;
|
||||||
|
value?.lng = process.lng;
|
||||||
|
value?.alt = process.height;
|
||||||
|
value?.utc = process.utc;
|
||||||
|
});
|
||||||
dataCount.value++;
|
dataCount.value++;
|
||||||
CoorTransModel trans = xyChangeController.coorTrans.value;
|
CoorTransModel trans = xyChangeController.coorTrans.value;
|
||||||
coordTrans ??= CoordTrans(TransOptions(
|
coordTrans ??= CoordTrans(TransOptions(
|
||||||
@ -213,9 +231,19 @@ class RealController extends GetxController {
|
|||||||
mapController.deviceList[settingController.currentDevice.value?.tid];
|
mapController.deviceList[settingController.currentDevice.value?.tid];
|
||||||
if (centerDev != null) {
|
if (centerDev != null) {
|
||||||
// log("center${xyh.X},${xyh.Y}");
|
// log("center${xyh.X},${xyh.Y}");
|
||||||
centerDev.x.value = xyh.X;
|
|
||||||
centerDev.y.value = xyh.Y;
|
|
||||||
centerDev.update.value++;
|
centerDev.update.value++;
|
||||||
|
double pitchRad = pitch * pi / 180;
|
||||||
|
double headingRad = (270 - heading) * pi / 180; //(270-)
|
||||||
|
centerDev.rotation.value = headingRad;
|
||||||
|
// 计算水平投影距离
|
||||||
|
double dXY = baseLine * cos(pitchRad);
|
||||||
|
|
||||||
|
// 计算副天线的坐标
|
||||||
|
double carX = xyh.X + dXY * cos(headingRad);
|
||||||
|
double carY = xyh.Y + dXY * sin(headingRad);
|
||||||
|
centerDev.x.value = carX;
|
||||||
|
centerDev.y.value = carY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user