地图修改

This commit is contained in:
tanlinxing 2024-08-27 18:08:05 +08:00
parent 8ef7427b0d
commit 5d35f93de5
18 changed files with 636 additions and 30 deletions

View File

@ -1,4 +1,5 @@
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
flutter_webrtc=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_webrtc-0.9.48+hotfix.1\\
libserialport=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\git\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\ libserialport=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\git\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\
path_provider=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider-2.1.4\\ path_provider=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider-2.1.4\\
path_provider_android=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_android-2.2.10\\ path_provider_android=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_android-2.2.10\\

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"libserialport","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-26 18:57:11.469847","version":"3.24.0","swift_package_manager_enabled":false} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_webrtc","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_webrtc-0.9.48+hotfix.1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"flutter_webrtc","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_webrtc-0.9.48+hotfix.1\\\\","native_build":true,"dependencies":[]},{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_webrtc","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_webrtc-0.9.48+hotfix.1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_webrtc","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_webrtc-0.9.48+hotfix.1\\\\","native_build":true,"dependencies":[]},{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"flutter_webrtc","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_webrtc-0.9.48+hotfix.1\\\\","native_build":true,"dependencies":[]},{"name":"libserialport","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\git\\\\libserialport-d6d27ef7aaf89e4dfa026db0c50dd3053c546710\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"flutter_webrtc","dependencies":["path_provider"]},{"name":"libserialport","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-27 18:06:29.957598","version":"3.24.0","swift_package_manager_enabled":false}

BIN
images/pilerCar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

View File

@ -1,12 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:scence_map/controllers/controller.dart';
// import '../login_in/connect/bluetooth_page.dart'; // import '../login_in/connect/bluetooth_page.dart';
// import '../login_in/connect/connect_type.dart'; // import '../login_in/connect/connect_type.dart';
// import '../login_in/getx/real_data.dart'; // import '../login_in/getx/real_data.dart';
// import 'main.dart'; // import 'main.dart';
// final RealController controller1 = Get.find(); final ScenceMapController mapcontroller = Get.find();
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
final double appBarHeight; final double appBarHeight;
@ -87,13 +88,13 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
() => InkWell( () => InkWell(
onTap: () { onTap: () {
// //
// sight.isCardVisible.value = mapcontroller.isCardVisible.value =
// !sight.isCardVisible.value; // !mapcontroller.isCardVisible.value; //
}, },
child: Icon( child: Icon(
Icons.my_location_sharp, Icons.my_location_sharp,
size: 35, size: 35,
color: isCardVisible.value color: mapcontroller.isCardVisible.value
? Colors.blue ? Colors.blue
// : const Color.fromARGB(200, 29, 28, 28), // : const Color.fromARGB(200, 29, 28, 28),
: (isDarkMode.value : (isDarkMode.value

View File

@ -31,8 +31,8 @@ class GnssController extends GetxController {
type: 2, type: 2,
height: 3.0, height: 3.0,
width: 3.0, width: 3.0,
lat: 4196584.0, lat: 3790616.710,
lon: 517728, lon: 577046.048,
image: ['assets/images/pilerCar.png']); image: ['assets/images/pilerCar.png']);
mapController.addDevice(device); mapController.addDevice(device);
// pilerCenterPoint = PilerPointCalculate( // pilerCenterPoint = PilerPointCalculate(
@ -42,7 +42,8 @@ class GnssController extends GetxController {
// ); // );
// pilerPos3D // pilerPos3D
pilerCenter = Pos3D(4196584.0, 517728, 0.0); // pilerCenter = Pos3D(4196544.959, 517639.709, 0.0);
// //
timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
device.x += 0.2; device.x += 0.2;

View File

@ -0,0 +1,56 @@
import 'package:cpnav/pages/pass_track/view.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'aimPointer.dart';
final SightController controller = Get.put(SightController());
class SightGview extends GetView<SightController> {
const SightGview({super.key});
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Obx(() => Positioned(
left: controller.sightOffset.value.dx,
top: controller.sightOffset.value.dy,
width: size.width / 5 * 1.5,
height: size.width / 5 * 1.5,
child: GestureDetector(
onScaleStart: (details) {
//
controller.sightInit.value =
details.localFocalPoint - controller.sightOffset.value;
},
onScaleUpdate: (details) {
// 使
controller.sightOffset.value =
details.localFocalPoint - controller.sightInit.value;
},
child: Visibility(
visible: mapcontroller.isCardVisible.value, //
child: Container(
decoration: const BoxDecoration(color: Colors.transparent),
child: Stack(children: [
const Card(
elevation: 5.0,
child: SightView(),
),
Positioned(
right: 0,
top: 0,
child: IconButton(
icon: const Icon(Icons.close),
onPressed: () {
//
mapcontroller.isCardVisible.value = false;
},
),
),
]),
)))));
}
}

View File

@ -0,0 +1,213 @@
import 'package:cpnav/pages/real_data/realController.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:scence_map/controllers/controller.dart';
import 'package:scence_map/scence_map.dart';
import '../../service/pile/device_type.dart';
final RealController realcontroller = Get.put(RealController());
//
class SightController extends GetxController {
final mapcontroller = Get.put(ScenceMapController());
var isNomal = true.obs;
//
var sightOffset = const Offset(3, 3).obs;
var sightOffsetInit = const Offset(0, 0).obs;
var sightInit = const Offset(0, 0).obs;
var lastSightOffset = const Offset(0, 0).obs; //
var initDx = 0.0.obs;
var isFirst = true.obs;
var visualList = [].obs;
var plot = 2.0.obs;
var scale = 0.75.obs;
reset() {
sightOffset.value = const Offset(3, 3);
sightOffsetInit.value = const Offset(0, 0);
sightInit.value = const Offset(0, 0);
initDx.value = 0.0;
update();
}
}
class SightView extends GetView<SightController> {
const SightView({super.key});
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
MediaQueryData mediaQueryData =
MediaQueryData.fromView(WidgetsBinding.instance.window); //
final orientation = mediaQueryData.orientation; //
final deviceType = getDeviceType(context);
double rectWidth = size.height / 2;
if (!controller.isNomal.value) {
rectWidth = size.width;
} else {
if (orientation == Orientation.landscape) {
rectWidth = size.width / 2;
if (deviceType == DeviceType.mobile) {
rectWidth = size.height - 5;
}
} else {
rectWidth = size.height / 2;
if (deviceType == DeviceType.mobile) {
rectWidth = size.width - 5;
}
}
}
bool isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Obx(() {
return Stack(
children: [
CustomPaint(
//
size: Size(rectWidth, rectWidth),
painter: DrawCicle(controller, realcontroller.centerX.value,
realcontroller.centerX.value, isDarkMode),
)
],
);
});
}
}
class DrawCicle extends CustomPainter {
final SightController controller;
final double tiltX;
final double tiltY;
final bool isDarkMode;
DrawCicle(this.controller, this.tiltX, this.tiltY, this.isDarkMode);
final _paint = Paint(); //
Path path = Path();
List<IconData> icons = [
Icons.arrow_drop_up,
Icons.arrow_drop_down,
Icons.arrow_left,
Icons.arrow_right
];
List<Offset> iconOffset = [];
List<String> text = ["", "", "", ""]; //['前移', '后移', '左移', '右移'];
@override
void paint(Canvas canvas, size) {
_paint
..strokeWidth = 2
..style = PaintingStyle.stroke
..color = const Color.fromARGB(255, 183, 183, 162);
double rectWidth = (size.height / 2 - 5).roundToDouble();
if (!controller.isNomal.value) {
} else {}
path.moveTo(0, rectWidth + 5);
path.lineTo(size.height, rectWidth + 5);
path.moveTo(rectWidth + 5, 0);
path.lineTo(rectWidth + 5, size.height);
canvas.drawPath(path, _paint);
// 2m
double step = (rectWidth / controller.plot.value / 10).roundToDouble();
canvas.translate(rectWidth + 5, rectWidth + 5);
for (var i = 0; i < 21; i++) {
if (i % 10 == 0) {
double line = 7;
canvas.drawLine(Offset(0, i * step), Offset(line, i * step), _paint);
canvas.drawLine(Offset(i * step, 0), Offset(i * step, line), _paint);
canvas.drawLine(Offset(0, -i * step), Offset(line, -i * step), _paint);
canvas.drawLine(Offset(-i * step, 0), Offset(-i * step, line), _paint);
drawText(canvas, Offset(line, i * step), i ~/ 10);
drawText(canvas, Offset(line, -i * step), (-i ~/ 10));
if (i ~/ 10 != 0) {
drawText(canvas, Offset(i * step, line), i ~/ 10);
drawText(canvas, Offset(-i * step, line), (-i ~/ 10));
}
} else if (i % 5 == 0) {
double line = 5;
canvas.drawLine(Offset(0, i * step), Offset(line, i * step), _paint);
canvas.drawLine(Offset(i * step, 0), Offset(i * step, line), _paint);
canvas.drawLine(Offset(0, -i * step), Offset(line, -i * step), _paint);
canvas.drawLine(Offset(-i * step, 0), Offset(-i * step, line), _paint);
} else {
double line = 3;
canvas.drawLine(Offset(0, i * step), Offset(line, i * step), _paint);
canvas.drawLine(Offset(i * step, 0), Offset(i * step, line), _paint);
canvas.drawLine(Offset(0, -i * step), Offset(line, -i * step), _paint);
canvas.drawLine(Offset(-i * step, 0), Offset(-i * step, line), _paint);
}
}
canvas.translate(-(rectWidth + 5), -(rectWidth + 5));
canvas.translate(rectWidth + 5, rectWidth + 5);
// if (controller.visualList.isNotEmpty) {
drawPoint(canvas, step);
// }
//
double x = realcontroller.tiltX.value; //
double y = realcontroller.tiltY.value; //
print(
"----${realcontroller.centerX.value},${realcontroller.centerY.value}");
if (realcontroller.tiltX.value == 0 || realcontroller.tiltY.value == 0) {
x = 0;
y = 0;
}
_paint.color = Colors.red;
canvas.drawCircle(Offset(x * step * 10, y * step * 10), 10, _paint);
canvas.translate(-(rectWidth + 5), -(rectWidth + 5));
}
drawText(Canvas canvas, Offset offset, int i, [bool isShow = true]) {
TextPainter textPainter = TextPainter(
text: TextSpan(
text: isShow ? "$i m" : "$i",
style: TextStyle(
fontSize: 12, color: isDarkMode ? Colors.white : Colors.black)),
textDirection: TextDirection.ltr,
textAlign: TextAlign.left);
textPainter.layout();
textPainter.paint(canvas, offset);
}
// drawPoint(Canvas canvas, double step) {
// // bug
// // ,
// for (int i = 0; i < plumDataController.plumList.length; i++) {
// Offset item = plumDataController.plumList[i];
// double x = item.dx - realController.centerX.value;
// double y = item.dy - realController.centerY.value;
// //
// Offset pos = Offset(x, y) * step * 10;
// canvas.drawCircle(pos, 20, Paint()..color = Colors.grey);
// drawText(canvas, pos - const Offset(20, 10), i, false);
// }
// }
drawPoint(Canvas canvas, double step) {
// bug
// ,
for (int i = 0; i < plumDataController.plumList.length; i++) {
Offset item = plumDataController.plumList[i];
double x = item.dx - realcontroller.centerX.value;
double y = item.dy - realcontroller.centerY.value;
//
Offset pos = Offset(x, y) * step * 10;
canvas.drawCircle(pos, 20, Paint()..color = Colors.grey);
drawText(canvas, pos - const Offset(20, 10), i, false);
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}

View File

@ -1,9 +1,9 @@
import 'dart:ui'; import 'dart:ui';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:cpnav/service/base.dart'; import 'package:cpnav/service/base.dart';
import 'package:scence_map/controllers/controller.dart'; import 'package:scence_map/controllers/controller.dart';
import 'package:scence_map/record_entity.dart';
class PassTrackController extends GetxController { class PassTrackController extends GetxController {
final mapController = Get.put(ScenceMapController()); final mapController = Get.put(ScenceMapController());
@ -20,7 +20,8 @@ class PassTrackController extends GetxController {
service = GetServices(projCode: projCode, projType: projType); service = GetServices(projCode: projCode, projType: projType);
loadProject(); loadProject();
loadSideLine(); loadSideLine();
loadBindDevice(); // loadBindDevice();
loadRcordList();
} }
loadBindDevice() async { loadBindDevice() async {
@ -73,4 +74,18 @@ class PassTrackController extends GetxController {
mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2); mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2);
} }
} }
loadRcordList() async {
List record = await service.getRcordList("2024-08-7");
if (record.isNotEmpty) {
for (var i = 0; i < record.length; i++) {
RecordEntity item = RecordEntity.fromJson(record[i]);
mapController.recordList.add(item);
}
mapController.centerXY = Offset(
mapController.recordList[mapController.recordList.length - 1].x,
mapController.recordList[mapController.recordList.length - 1].y);
//
}
}
} }

View File

@ -9,8 +9,11 @@ import 'package:scence_map/controllers/controller.dart';
import 'package:scence_map/scence_map.dart'; import 'package:scence_map/scence_map.dart';
import 'package:syncfusion_flutter_sliders/sliders.dart'; import 'package:syncfusion_flutter_sliders/sliders.dart';
import '../../controllers/gnss_Controller.dart';
import '../aim_point/aimCard.dart';
import 'iconContainer.dart'; import 'iconContainer.dart';
import "controller.dart"; import "controller.dart";
// import '../login_in/connect/bluetooth_page.dart'; // import '../login_in/connect/bluetooth_page.dart';
// import '../login_in/connect/config.dart'; // import '../login_in/connect/config.dart';
// import '../login_in/connect/connect_type.dart'; // import '../login_in/connect/connect_type.dart';
@ -21,6 +24,7 @@ import "controller.dart";
// import '../setting/xy_change.dart'; // import '../setting/xy_change.dart';
ScenceMapController mapcontroller = Get.put(ScenceMapController()); ScenceMapController mapcontroller = Get.put(ScenceMapController());
GnssController gnsscontroller = Get.find<GnssController>();
class PassTrack extends StatefulWidget { class PassTrack extends StatefulWidget {
final String date; final String date;
@ -35,7 +39,7 @@ class PassTrack extends StatefulWidget {
class _PasstrackState extends State<PassTrack> { class _PasstrackState extends State<PassTrack> {
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey = final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
GlobalKey<PopupMenuButtonState<int>>(); GlobalKey<PopupMenuButtonState<int>>();
final controller = Get.put(PassTrackController("WXLMB", "cp_orad")); final controller = Get.put(PassTrackController("TEST", "pile_cm"));
String str = "播放"; String str = "播放";
int sWidth = 0; int sWidth = 0;
int bits = -1; int bits = -1;
@ -249,7 +253,8 @@ class _PasstrackState extends State<PassTrack> {
], ],
), ),
), ),
IconContainer() IconContainer(),
SightGview()
], ],
); );
}); });

View File

@ -0,0 +1,67 @@
import 'dart:core';
class ProcessEntity {
double speed;
double depth;
double tiltX;
double tiltY;
double current1;
double current2;
double toatalFlow2;
double toatalFlow1;
double subtotalFlow2;
double subtotalFlow1;
String recvTime;
// double? azimuth;
double alt = 0;
double lng = 0;
double lat = 0;
String pileId;
int utc;
int tid;
int? id;
ProcessEntity(
{this.speed = 0,
this.depth = 0,
this.tiltX = 0,
this.tiltY = 0,
this.current1 = 0,
this.current2 = 0,
this.toatalFlow2 = 0,
this.toatalFlow1 = 0,
this.subtotalFlow2 = 0,
this.subtotalFlow1 = 0,
required this.recvTime,
// this.azimuth,
this.alt = 0,
this.lng = 0,
this.lat = 0,
required this.pileId,
required this.utc,
required this.tid,
this.id});
factory ProcessEntity.fromJson(Map<String, dynamic> json) {
return ProcessEntity(
speed: (json["speed"] ?? "0").toDouble(),
depth: (json["depth"] ?? "0").toDouble(),
tiltX: (json["tilt_x"] ?? "0").toDouble(),
tiltY: (json["tilt_y"] ?? "0").toDouble(),
current1: (json["current1"] ?? "0").toDouble(),
current2: (json["current2"] ?? "0").toDouble(),
toatalFlow2: (json["toatal_flow2"] ?? "0").toDouble(),
toatalFlow1: (json["toatal_flow1"] ?? "0").toDouble(),
subtotalFlow2: (json["subtotal_flow2"] ?? "0").toDouble(),
subtotalFlow1: (json["subtotal_flow1"] ?? "0").toDouble(),
recvTime: json["recv_time"] ?? DateTime.now(),
// azimuth: (json["azimuth"] ?? "0").toDouble(),
alt: (json["ALT"] ?? "0").toDouble(),
lng: (json["LNG"] ?? "0").toDouble(),
lat: (json["LAT"] ?? "0").toDouble(),
pileId: json["pile_id"].toString(),
utc: json["UTC"],
tid: json['tid'],
id: json["id"],
);
}
}

View File

@ -0,0 +1,154 @@
import 'dart:typed_data';
import 'dart:ui';
import 'package:get/get.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'process.dart';
class RealController extends GetxController {
var sightOffset1 = const Offset(3, 3).obs;
var sightOffsetInit1 = const Offset(0, 0).obs;
var sightInit1 = const Offset(0, 0).obs;
var initDx = 0.0.obs;
reset() {
sightOffset1.value = const Offset(3, 3);
sightOffsetInit1.value = const Offset(0, 0);
sightInit1.value = const Offset(0, 0);
initDx.value = 0.0;
update();
}
RTCPeerConnection? peerConnection;
RTCDataChannel? dataChannel;
final speed = 0.0.obs;
final depth = 0.0.obs;
final tiltX = 0.0.obs;
final tiltY = 0.0.obs;
final centerX = 0.0.obs;
final centerY = 0.0.obs;
final current1 = 0.0.obs;
final current2 = 0.0.obs;
final totalFlow2 = 0.0.obs;
final totalFlow1 = 0.0.obs;
final flow10cm1 = 0.0.obs;
final flow10cm2 = 0.0.obs;
final subtotalFlow2 = 0.0.obs;
final subtotalFlow1 = 0.0.obs;
final recvTime = ''.obs;
final alt = 0.0.obs;
final lng = 0.0.obs;
final lat = 0.0.obs;
final pileId = ''.obs;
final time = "0".obs;
final startIndex = 0.obs;
// 线
final processList = <ProcessEntity>[].obs;
var isDataVisible = false.obs;
void updateProcessList(List<ProcessEntity> newList) {
processList.assignAll(newList); // 使 assignAll RxList
}
DateTime? sliderTime;
updateSlider(double newValue, [isHand = true]) {
if (isHand) {
sliderTime = DateTime.now();
}
startIndex.value = newValue.toInt();
update();
}
@override
void onInit() {
super.onInit();
//
// Timer.periodic(const Duration(milliseconds: 1000), (_) {
// time.value = DateTime.now();
// });
initializePeerConnection();
}
void initializePeerConnection() async {
final configuration = <String, dynamic>{
'iceServers': [
{'url': 'stun:stun.l.google.com:19302'},
],
};
peerConnection = await createPeerConnection(configuration);
initializeDataChannel();
}
void initializeDataChannel() async {
//
dataChannel = await peerConnection!
.createDataChannel('dataChannel', RTCDataChannelInit()..id = 1);
//
dataChannel!.onMessage = (RTCDataChannelMessage message) {
//
if (message.isBinary) {
onBleData(message.binary);
}
};
}
onBleData(Uint8List data) {
ByteData byteData = data.buffer.asByteData();
int tag = byteData.getUint8(0);
// int length = byteData.getUint8(1);
if (tag == 161) {
speed.value = byteData.getInt16(2, Endian.little) * 0.1;
int timeInt = byteData.getUint16(4, Endian.little);
// print(timeInt);
time.value = convertSecondsToMinSec(timeInt);
depth.value = byteData.getInt16(6, Endian.little) * 0.001;
pileId.value = byteData.getUint16(8, Endian.little).toString();
subtotalFlow1.value = byteData.getInt16(10, Endian.little) * 0.01;
flow10cm1.value = byteData.getUint16(12, Endian.little) * 0.01;
totalFlow1.value = byteData.getInt32(14, Endian.little) * 0.01;
subtotalFlow2.value = byteData.getInt16(18, Endian.little) * 0.01;
flow10cm2.value = byteData.getUint16(20, Endian.little) * 0.01;
totalFlow2.value = byteData.getInt32(22, Endian.little) * 0.01;
current1.value = byteData.getUint16(26, Endian.little) * 0.01;
current2.value = byteData.getUint16(28, Endian.little) * 0.01;
// current3.value = byteData.getUint16(30, Endian.little) * 0.01;
int tag1 = byteData.getUint8(34);
// int length = byteData.getUint8(35);
if (tag1 == 162) {
// var gpsStatus = byteData.getUint8(36);
// var gpsView = byteData.getUint8(37);
// var gpsUse = byteData.getUint8(38);
// var reg = byteData.getUint8(39);
// var utc = byteData.getUint32(40, Endian.little);
//
centerX.value = byteData.getFloat64(44, Endian.little);
centerY.value = byteData.getFloat64(52, Endian.little);
// print("中心---$centerX,$centerY");
// tiltX.value = byteData.getFloat64(44, Endian.little);
// tiltY.value = byteData.getFloat64(52, Endian.little);
// var direction = byteData.getFloat64(60, Endian.little);
// var pitch = byteData.getFloat64(68, Endian.little);
// print("$gpsUse,$gpsView,$utc,$direction,$pitch");
}
}
}
String convertSecondsToMinSec(int totalSeconds) {
int minutes = totalSeconds ~/ 60;
int seconds = totalSeconds % 60;
String formattedTime = '$minutes:${seconds.toString().padLeft(2, '0')}';
return formattedTime;
}
@override
void dispose() {
dataChannel?.close(); //
peerConnection?.close(); //
super.dispose();
}
}

View File

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:get/get.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'loginprefs.dart'; import 'loginprefs.dart';
@ -57,6 +58,8 @@ class BaseService {
} }
} }
class PileCmController extends GetxController {}
class GetServices { class GetServices {
BaseService service = BaseService(); BaseService service = BaseService();
// String projCode = 'CJGKJEBYYB'; // String projCode = 'CJGKJEBYYB';
@ -102,12 +105,12 @@ class GetServices {
} }
// //
getRcordData(int page, int size, String date, // getRcordData(int page, int size, String date,
[String sort = "desc", String order = "tp_id"]) async { // [String sort = "desc", String order = "tp_id"]) async {
Map res = await service.getClient( // Map res = await service.getClient(
"/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&date=$date&sort=$sort&order=$order"); // "/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&date=$date&sort=$sort&order=$order");
return res['data']; // return res['data'];
} // }
// //
// getRcordData(int page, int size, String date, // getRcordData(int page, int size, String date,
@ -123,16 +126,16 @@ class GetServices {
// "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd"); // "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
// return res['data']; // return res['data'];
// } // }
getRcordList(String date, [String? dateEnd]) async { // getRcordList(String date, [String? dateEnd]) async {
dateEnd ??= date; // dateEnd ??= date;
Map res = await service.getClient( // Map res = await service.getClient(
"/api/$projType/record/list?org_code=a&proj_code=$projCode&date=$date&dateEnd=$dateEnd"); // "/api/$projType/record/list?org_code=a&proj_code=$projCode&date=$date&dateEnd=$dateEnd");
if (res['code'] == 1000) { // if (res['code'] == 1000) {
return res['data']; // return res['data'];
} else { // } else {
return []; // return [];
} // }
} // }
// //
getworkDateData() async { getworkDateData() async {
@ -201,4 +204,19 @@ class GetServices {
"/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode"); "/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode");
return res['data']; return res['data'];
} }
//
getRcordData(int page, int size, String date,
[String sort = "desc", String order = "pile_id", int? tid]) async {
Map res = await service.getClient(
"/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order");
return res['data'];
}
getRcordList(String date, [String? dateEnd, int? tid]) async {
dateEnd ??= date;
Map res = await service.getClient(
"/api/$projType/record/list?org_code=a&proj_code=$projCode&date=$date&dateEnd=$dateEnd");//&tid=1000
return res['data'];
}
} }

View File

@ -6,9 +6,13 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <libserialport/libserialport_plugin.h> #include <libserialport/libserialport_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_webrtc_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterWebRTCPlugin");
flutter_web_r_t_c_plugin_register_with_registrar(flutter_webrtc_registrar);
g_autoptr(FlPluginRegistrar) libserialport_registrar = g_autoptr(FlPluginRegistrar) libserialport_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "LibserialportPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "LibserialportPlugin");
libserialport_plugin_register_with_registrar(libserialport_registrar); libserialport_plugin_register_with_registrar(libserialport_registrar);

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
flutter_webrtc
libserialport libserialport
) )

View File

@ -73,6 +73,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.8" version: "1.0.8"
dart_webrtc:
dependency: transitive
description:
name: dart_webrtc
sha256: "5cbc40bd9b33d0c9b8004cff52e9883c71f0f54799afc8faca77535eeb9ef857"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
dylib: dylib:
dependency: transitive dependency: transitive
description: description:
@ -123,6 +131,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_webrtc:
dependency: "direct main"
description:
name: flutter_webrtc
sha256: "2f17fb96e0c9c6ff75f6b1c36d94755461fc7f36a5c28386f5ee5a18b98688c8"
url: "https://pub.dev"
source: hosted
version: "0.9.48+hotfix.1"
get: get:
dependency: "direct main" dependency: "direct main"
description: description:
@ -180,6 +196,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.19.0" version: "0.19.0"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
leak_tracker: leak_tracker:
dependency: transitive dependency: transitive
description: description:
@ -221,6 +245,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
logging:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -325,6 +357,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.5" version: "3.1.5"
platform_detect:
dependency: transitive
description:
name: platform_detect
sha256: a62f99417fc4fa2d099ce0ccdbb1bd3977920f2a64292c326271f049d4bc3a4f
url: "https://pub.dev"
source: hosted
version: "2.1.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -333,6 +373,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pub_semver:
dependency: transitive
description:
name: pub_semver
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
roslibdart: roslibdart:
dependency: "direct main" dependency: "direct main"
description: description:
@ -401,6 +449,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "26.2.9" version: "26.2.9"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255
url: "https://pub.dev"
source: hosted
version: "3.2.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -481,6 +537,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
webrtc_interface:
dependency: transitive
description:
name: webrtc_interface
sha256: abec3ab7956bd5ac539cf34a42fa0c82ea26675847c0966bb85160400eea9388
url: "https://pub.dev"
source: hosted
version: "1.2.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -498,5 +562,5 @@ packages:
source: hosted source: hosted
version: "6.5.0" version: "6.5.0"
sdks: sdks:
dart: ">=3.4.4 <4.0.0" dart: ">=3.5.0 <4.0.0"
flutter: ">=3.22.0" flutter: ">=3.22.0"

View File

@ -48,6 +48,7 @@ dependencies:
syncfusion_flutter_sliders: ^26.2.9 syncfusion_flutter_sliders: ^26.2.9
bottom_picker: ^2.8.0 bottom_picker: ^2.8.0
roslibdart: ^0.0.1-dev+4 roslibdart: ^0.0.1-dev+4
flutter_webrtc: ^0.9.48+hotfix.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -73,6 +74,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- images/
- images/navi_pointer.png - images/navi_pointer.png
- images/satellite.png - images/satellite.png
- images/pilerCar.png - images/pilerCar.png

View File

@ -6,9 +6,12 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <libserialport/libserialport_plugin_c_api.h> #include <libserialport/libserialport_plugin_c_api.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
FlutterWebRTCPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterWebRTCPlugin"));
LibserialportPluginCApiRegisterWithRegistrar( LibserialportPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LibserialportPluginCApi")); registry->GetRegistrarForPlugin("LibserialportPluginCApi"));
} }

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
flutter_webrtc
libserialport libserialport
) )