cp
This commit is contained in:
parent
27ce92e6ee
commit
261d77afa0
85
.vscode/launch.json
vendored
Normal file
85
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
// 使用 IntelliSense 了解相关属性。
|
||||||
|
// 悬停以查看现有属性的描述。
|
||||||
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "cpnav",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cpnav (profile mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cpnav (release mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pass_track",
|
||||||
|
"cwd": "plugins\\pass_track",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pass_track (profile mode)",
|
||||||
|
"cwd": "plugins\\pass_track",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pass_track (release mode)",
|
||||||
|
"cwd": "plugins\\pass_track",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "scence_map",
|
||||||
|
"cwd": "plugins\\scence_map",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "scence_map (profile mode)",
|
||||||
|
"cwd": "plugins\\scence_map",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "scence_map (release mode)",
|
||||||
|
"cwd": "plugins\\scence_map",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "example",
|
||||||
|
"cwd": "plugins\\pass_track\\example",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "example (profile mode)",
|
||||||
|
"cwd": "plugins\\pass_track\\example",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "example (release mode)",
|
||||||
|
"cwd": "plugins\\pass_track\\example",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -68,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
final _currentIndex = 0.obs;
|
final _currentIndex = 0.obs;
|
||||||
final List<Widget> _pages = [
|
final List<Widget> _pages = [
|
||||||
PassTrackWidget(
|
PassTrackView(
|
||||||
date: '',
|
date: '',
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:scence_map/controller.dart';
|
import 'package:scence_map/controller.dart';
|
||||||
import 'package:cpnav/service/base.dart';
|
import 'package:cpnav/service/base.dart';
|
||||||
import 'package:pass_track/pass_track.dart';
|
import 'package:pass_track/pass_track.dart';
|
||||||
import 'sevice/file_handle.dart';
|
import 'sevice/file_handle.dart';
|
||||||
|
|
||||||
|
|
||||||
FileHandle fileHandle = FileHandle();
|
FileHandle fileHandle = FileHandle();
|
||||||
|
|
||||||
class PassTrackController extends GetxController {
|
class PassTrackController extends GetxController {
|
||||||
@ -16,6 +14,7 @@ class PassTrackController extends GetxController {
|
|||||||
|
|
||||||
String projCode;
|
String projCode;
|
||||||
String projType;
|
String projType;
|
||||||
|
var speed = 1.obs;
|
||||||
late final GetServices service;
|
late final GetServices service;
|
||||||
// final PassTrack _passTrackPlugin;
|
// final PassTrack _passTrackPlugin;
|
||||||
PassTrackController(this.projCode, this.projType);
|
PassTrackController(this.projCode, this.projType);
|
||||||
|
@ -62,7 +62,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Color.fromARGB(255, 54, 52, 52),
|
color: const Color.fromARGB(255, 54, 52, 52),
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
@ -134,7 +134,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Color.fromARGB(255, 54, 52, 52),
|
color: const Color.fromARGB(255, 54, 52, 52),
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
@ -206,7 +206,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: 33,
|
width: 33,
|
||||||
height: 33,
|
height: 33,
|
||||||
margin: EdgeInsets.symmetric(vertical: 2.0),
|
margin: const EdgeInsets.symmetric(vertical: 2.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _iconColors[icon],
|
color: _iconColors[icon],
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@ -229,7 +229,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: 33,
|
width: 33,
|
||||||
height: 33,
|
height: 33,
|
||||||
margin: EdgeInsets.symmetric(vertical: 2.0),
|
margin: const EdgeInsets.symmetric(vertical: 2.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _iconColors[icon],
|
color: _iconColors[icon],
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
|
@ -15,6 +15,7 @@ import "package:pass_track/pass_track.dart";
|
|||||||
import "package:pass_track/pass_track_platform_interface.dart";
|
import "package:pass_track/pass_track_platform_interface.dart";
|
||||||
import "controller.dart";
|
import "controller.dart";
|
||||||
import "dart:ffi" as ffi;
|
import "dart:ffi" as ffi;
|
||||||
|
|
||||||
// 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';
|
||||||
@ -26,37 +27,29 @@ import "dart:ffi" as ffi;
|
|||||||
|
|
||||||
ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
||||||
|
|
||||||
class PassTrackWidget extends StatefulWidget {
|
class PassTrackView extends GetView<PassTrackController> {
|
||||||
final String date;
|
|
||||||
final controller;
|
|
||||||
|
|
||||||
const PassTrackWidget({super.key, required this.date, this.controller});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<PassTrackWidget> createState() => _PasstrackState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PasstrackState extends State<PassTrackWidget> {
|
|
||||||
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
|
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
|
||||||
GlobalKey<PopupMenuButtonState<int>>();
|
GlobalKey<PopupMenuButtonState<int>>();
|
||||||
final controller = Get.put(PassTrackController("WXLMB", "cp_road"));
|
// final controller = Get.put(PassTrackController("WXLMB", "cp_road"));
|
||||||
String str = "播放";
|
final String str = "播放";
|
||||||
int sWidth = 800;
|
// int sWidth = 800;
|
||||||
int sHeight = 800;
|
// int sHeight = 800;
|
||||||
int bits = -1;
|
// int bits = -1;
|
||||||
int speed = 50;
|
// int speed = 50;
|
||||||
List<int> speedList = [1, 2, 10, 20, 50, 100, 200, 500];
|
|
||||||
// int maxLength = 200;
|
// int maxLength = 200;
|
||||||
late SfRangeValues _rangevalues;
|
// late SfRangeValues _rangevalues;
|
||||||
final PassTrack _passTrackPlugin = PassTrack();
|
final PassTrack _passTrackPlugin = PassTrack();
|
||||||
|
|
||||||
@override
|
PassTrackView({Key? key}) : super(key: key);
|
||||||
initState() {
|
|
||||||
super.initState();
|
// @override
|
||||||
var maxLen =
|
// initState() {
|
||||||
controller.allLen > 0 ? controller.allLen : 1.0; // 确保 maxLen 大于 0
|
// super.initState();
|
||||||
_rangevalues = SfRangeValues(0.0, maxLen);
|
// var maxLen =
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
// controller.allLen > 0 ? controller.allLen : 1.0; // 确保 maxLen 大于 0
|
||||||
|
// _rangevalues = SfRangeValues(0.0, maxLen);
|
||||||
|
// SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
// sWidth = sqrt(screen.width * screen.width + screen.height * screen.height)
|
// sWidth = sqrt(screen.width * screen.width + screen.height * screen.height)
|
||||||
// .ceil();
|
// .ceil();
|
||||||
|
|
||||||
@ -84,73 +77,76 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
// _rangevalues = SfRangeValues(0.0, maxLength.toDouble());
|
// _rangevalues = SfRangeValues(0.0, maxLength.toDouble());
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
});
|
// });
|
||||||
var f = initPlatformState();
|
// var f = initPlatformState();
|
||||||
var future = controller.getHisFileList(_passTrackPlugin);
|
// var future = controller.getHisFileList(_passTrackPlugin);
|
||||||
f.then((void _) {
|
// f.then((void _) {
|
||||||
_passTrackPlugin.setGridColor(const Color.fromARGB(255, 0, 0, 0).value);
|
// _passTrackPlugin.setGridColor(const Color.fromARGB(255, 0, 0, 0).value);
|
||||||
_passTrackPlugin.drawGrid();
|
|
||||||
|
|
||||||
future.then((value) {
|
|
||||||
_passTrackPlugin.setScale(1);
|
|
||||||
for (var TID in controller.deviceMap.keys) {
|
|
||||||
_passTrackPlugin.addDevice(int.parse(TID), 0);
|
|
||||||
}
|
|
||||||
for (var item in controller.coorTransMap.entries) {
|
|
||||||
print("tid:${item.key} value:${item.value}");
|
|
||||||
}
|
|
||||||
// 统计用时 获取当前时间
|
|
||||||
var start = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
// _passTrackPlugin.generateTile(0, value);
|
|
||||||
_passTrackPlugin.waitForTile(() {
|
|
||||||
var start = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
print("len: ${_passTrackPlugin.allTileCnt()}");
|
|
||||||
_rangevalues = SfRangeValues(0, _passTrackPlugin.allTileCnt());
|
|
||||||
_passTrackPlugin.playTrack(0, _passTrackPlugin.allTileCnt(), true, 0, ffi.nullptr);
|
|
||||||
var end = DateTime.now().millisecondsSinceEpoch;
|
|
||||||
print("play: ${end - start}");
|
|
||||||
});
|
|
||||||
// _passTrackPlugin.drawGrid();
|
// _passTrackPlugin.drawGrid();
|
||||||
// 获取当前时间
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initPlatformState() async {
|
// future.then((value) {
|
||||||
String platformVersion;
|
// _passTrackPlugin.setScale(1);
|
||||||
try {
|
// for (var TID in controller.deviceMap.keys) {
|
||||||
platformVersion = await _passTrackPlugin.getPlatformVersion() ??
|
// _passTrackPlugin.addDevice(int.parse(TID), 0);
|
||||||
'Unknown platform version';
|
// }
|
||||||
} on Exception {
|
// for (var item in controller.coorTransMap.entries) {
|
||||||
platformVersion = 'Failed to get platform version.';
|
// print("tid:${item.key} value:${item.value}");
|
||||||
}
|
// }
|
||||||
await _passTrackPlugin.create(sWidth, sWidth);
|
// // 统计用时 获取当前时间
|
||||||
fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1;
|
// var start = DateTime.now().millisecondsSinceEpoch;
|
||||||
print("textureId: ${fileHandle.textureId}");
|
// // _passTrackPlugin.generateTile(0, value);
|
||||||
|
// _passTrackPlugin.waitForTile(() {
|
||||||
|
// var start = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
// print("len: ${_passTrackPlugin.allTileCnt()}");
|
||||||
|
// _rangevalues = SfRangeValues(0, _passTrackPlugin.allTileCnt());
|
||||||
|
// _passTrackPlugin.playTrack(
|
||||||
|
// 0, _passTrackPlugin.allTileCnt(), true, 0, ffi.nullptr);
|
||||||
|
// var end = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
// print("play: ${end - start}");
|
||||||
|
// });
|
||||||
|
// // _passTrackPlugin.drawGrid();
|
||||||
|
// // 获取当前时间
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
if (!mounted) Exception('Failed to get textureId.');
|
// Future<void> initPlatformState() async {
|
||||||
|
// String platformVersion;
|
||||||
|
// try {
|
||||||
|
// platformVersion = await _passTrackPlugin.getPlatformVersion() ??
|
||||||
|
// 'Unknown platform version';
|
||||||
|
// } on Exception {
|
||||||
|
// platformVersion = 'Failed to get platform version.';
|
||||||
|
// }
|
||||||
|
// await _passTrackPlugin.create(
|
||||||
|
// mapcontroller.height.toInt(), mapcontroller.width.toInt());
|
||||||
|
// fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1;
|
||||||
|
// print("textureId: ${fileHandle.textureId}");
|
||||||
|
|
||||||
setState(() {
|
// if (!mounted) Exception('Failed to get textureId.');
|
||||||
platformVersion = platformVersion;
|
|
||||||
});
|
// setState(() {
|
||||||
return;
|
// platformVersion = platformVersion;
|
||||||
}
|
// });
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
var isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
var isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
||||||
|
var controller = this.controller;
|
||||||
return OrientationBuilder(builder: (context, orientation) {
|
return OrientationBuilder(builder: (context, orientation) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
ScenceMapView(
|
ScenceMapView(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: mapcontroller.top,
|
||||||
left: 0,
|
left: mapcontroller.left,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: sWidth * 1.0,
|
width: mapcontroller.width,
|
||||||
height: sWidth * 1.0,
|
height: mapcontroller.height,
|
||||||
// child: Text('Running on: $_platformVersion\n'),
|
// child: Text('Running on: $_platformVersion\n'),
|
||||||
child: Texture(textureId: fileHandle.textureId))),
|
child: Texture(textureId: fileHandle.textureId))),
|
||||||
],
|
],
|
||||||
@ -177,10 +173,10 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
minorTicksPerInterval: 1,
|
minorTicksPerInterval: 1,
|
||||||
stepSize: 1,
|
stepSize: 1,
|
||||||
onChanged: (SfRangeValues values) {
|
onChanged: (SfRangeValues values) {
|
||||||
setState(() {
|
// setState(() {
|
||||||
_rangevalues = SfRangeValues(values.start.roundToDouble(),
|
// _rangevalues = SfRangeValues(values.start.roundToDouble(),
|
||||||
values.end.roundToDouble());
|
// values.end.roundToDouble());
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -195,20 +191,20 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
width: 74,
|
width: 74,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateProperty.all<Color?>(
|
backgroundColor: WidgetStateProperty.all<Color?>(
|
||||||
str == "播放" ? Colors.blue : Colors.red,
|
str == "播放" ? Colors.blue : Colors.red,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (str == "播放") {
|
if (str == "播放") {
|
||||||
_passTrackPlugin.playTrack(0, 10000, true, 50, ffi.nullptr);
|
_passTrackPlugin.playTrack(
|
||||||
|
0, 10000, true, 50, ffi.nullptr);
|
||||||
} else {
|
} else {
|
||||||
_passTrackPlugin.playPause();
|
_passTrackPlugin.playPause();
|
||||||
}
|
}
|
||||||
setState(() {
|
// setState(() {
|
||||||
str = str == "播放" ? "暂停" : "播放";
|
// str = str == "播放" ? "暂停" : "播放";
|
||||||
});
|
// });
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
str,
|
str,
|
||||||
@ -234,12 +230,14 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Obx(
|
||||||
"$speed X",
|
() => Text(
|
||||||
|
"${controller.speed.value} X",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 11, color: Colors.black),
|
fontSize: 11, color: Colors.black),
|
||||||
),
|
),
|
||||||
Container(
|
),
|
||||||
|
SizedBox(
|
||||||
width: 25,
|
width: 25,
|
||||||
child: PopupMenuButton<int>(
|
child: PopupMenuButton<int>(
|
||||||
key: _popupMenuKey,
|
key: _popupMenuKey,
|
||||||
@ -247,9 +245,7 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
icon: const Icon(Icons.arrow_drop_up,
|
icon: const Icon(Icons.arrow_drop_up,
|
||||||
color: Color.fromARGB(255, 47, 48, 47)),
|
color: Color.fromARGB(255, 47, 48, 47)),
|
||||||
onSelected: (int value) {
|
onSelected: (int value) {
|
||||||
setState(() {
|
controller.speed.value = value;
|
||||||
speed = value;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// style: ButtonStyle(
|
// style: ButtonStyle(
|
||||||
// minimumSize: MaterialStateProperty.all<Size>(
|
// minimumSize: MaterialStateProperty.all<Size>(
|
||||||
@ -262,7 +258,8 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
return PopupMenuItem<int>(
|
return PopupMenuItem<int>(
|
||||||
height: 30,
|
height: 30,
|
||||||
value: speed,
|
value: speed,
|
||||||
child: Text("$speed X速度"),
|
child: Obx(() =>
|
||||||
|
Text("${controller.speed.value} X速度")),
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
},
|
},
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1318d54e5901967be53f6ceba0825df45df9d167
|
Subproject commit 65de63acc0c565de548b02b15be6554b24ebad11
|
@ -1 +1 @@
|
|||||||
Subproject commit 2eaf69b52fb3965a920202f878a8416a164d6e15
|
Subproject commit ac2179219ba52d0c91dfd51470fd1d7ebaae69be
|
Loading…
Reference in New Issue
Block a user