Compare commits

..

No commits in common. "38f72342808703bbdf93977d2ee6dcee87b0b4ee" and "5cc66f831456538039ffac810c4a8b077848f1b3" have entirely different histories.

6 changed files with 87 additions and 140 deletions

View File

@ -19,13 +19,13 @@ class PassTrackController extends GetxController {
late final GetServices service; late final GetServices service;
// final PassTrack _passTrackPlugin; // final PassTrack _passTrackPlugin;
PassTrackController(this.projCode, this.projType); PassTrackController(this.projCode, this.projType);
Map<String, int> deviceMap = {};
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
service = GetServices(projCode: projCode, projType: projType); service = GetServices(projCode: projCode, projType: projType);
loadProject(); loadProject();
// loadSideLine(); loadSideLine();
loadBindDevice(); loadBindDevice();
// getHisFileList(); // getHisFileList();
} }
@ -34,8 +34,7 @@ class PassTrackController extends GetxController {
var binddevices = await service.getDeviceBind(); var binddevices = await service.getDeviceBind();
for (var device in binddevices) { for (var device in binddevices) {
var dev = DeviceItem.fromJson(device); var dev = DeviceItem.fromJson(device);
deviceMap[dev.TID.toString()] = 0; mapController.deviceList[dev.TID] = dev;
// deviceMap[dev.TID as String] = dev[int.parse(dev["width"])];
} }
} }
@ -81,19 +80,17 @@ class PassTrackController extends GetxController {
} }
} }
Future<int> getHisFileList(PassTrack passTrackPlugin) async { getHisFileList(PassTrack passTrackPlugin) async {
Map textlist = await GetServices().getHisFileList(); Map textlist = await GetServices().getHisFileList();
List fileList = textlist['list']; List fileList = textlist['list'];
for (var i = 0; i < fileList.length; i++) { for (var i = 0; i < fileList.length; i++) {
var file = fileList[i]; var file = fileList[i];
var jsData = await GetServices().getHisFil1(file); var jsData = await GetServices().getHisFile(file);
print("have message");
int len = fileHandle.resolveJson(jsData, passTrackPlugin); int len = fileHandle.resolveJson(jsData, passTrackPlugin);
allLen += len; allLen += len;
if (allLen >= 20000) { // print("$pointList");
break; // var totalList =fileHandle.allPointData;
}
} }
return allLen; print("allLen: $allLen");
} }
} }

View File

@ -9,6 +9,7 @@ import 'package:ffi/ffi.dart';
import 'package:web_socket_channel/io.dart'; import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/status.dart' as status; import 'package:web_socket_channel/status.dart' as status;
import 'package:pass_track/binding.dart' as Binding; import 'package:pass_track/binding.dart' as Binding;
import '../../../service/base.dart'; import '../../../service/base.dart';
@ -16,8 +17,8 @@ import '../model/coord_trans.dart';
import '../model/draw_context.dart'; import '../model/draw_context.dart';
import '../model/recievemodel.dart'; import '../model/recievemodel.dart';
DrawContext drawCtx = DrawContext();
DrawContext drawCtx = DrawContext();
class FileHandle { class FileHandle {
int textureId = -1; int textureId = -1;
int index = 0; int index = 0;
@ -249,83 +250,66 @@ class FileHandle {
List<RecieveModel> allPointData = []; List<RecieveModel> allPointData = [];
int start = 0; int start = 0;
var allPointLen = 0; var allPointLen = 0;
// data //
var data = jsonDecode(res)["data"]; while (true) {
for (var item in data) { int end = res.indexOf('\n', start);
// RecieveModel recieveModel = RecieveModel.fromJson(item); if (end < 0) {
var X = item["X"].toDouble(); break;
var Y = item["Y"].toDouble(); }
var TID = item["TID"]; String str = res.substring(start, end);
var type = int.parse(item["type"]); try {
var p = passTrackPlugin.wantPoint(); if (str[str.length - 1] == ",") {
p.ref.X = X; str = str.substring(0, str.length - 1);
p.ref.Y = Y; }
p.ref.TID = TID; var item = jsonDecode(str);
p.ref.type = type; RecieveModel recieveModel = RecieveModel.fromJson(item);
} if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
return data.length; //dart重置中心
} drawCtx.setCenter(
return 0; // {"x": recieveModel.x / 20, "y": recieveModel.y / 20});//532863.8,4208668.95
// {"x": 10656637 / 20, "y": 84172941 / 20});//532863.8,4208668.95
// while (true) { }
// int end = res.indexOf('\n', start); int x = recieveModel.x;
// if (end < 0) { int y = recieveModel.y;
// break; int tid = recieveModel.TID;
// } int type = recieveModel.type;
// String str = res.substring(start, end); var p = passTrackPlugin.wantPoint();
// try { p.ref.X = x.toDouble();
// if (str[str.length - 1] == ",") { p.ref.Y = y.toDouble();
// str = str.substring(0, str.length - 1); p.ref.TID = tid;
// } p.ref.type = type;
// var item = jsonDecode(str); // var data = item['data'];
// RecieveModel recieveModel = RecieveModel.fromJson(item); // if (data != null) {
// if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) { // item['TID'] =
// //dart重置中心 // item['TID'] is int ? item['TID'] : num.parse(item['TID']);
// drawCtx.setCenter( // item['type'] =
// // {"x": recieveModel.x / 20, "y": recieveModel.y / 20});//532863.8,4208668.95 // item['type'] is int ? item['type'] : num.parse(item['type']);
// {"x": 10656637 / 20, "y": 84172941 / 20}); //532863.8,4208668.95 // item['obj'] = DecodeDataObj.fromBase64(item['data']);
// } // // this.updateDevice(item);
// int x = recieveModel.x; // // this.sportsData.push(item);
// int y = recieveModel.y;
// int tid = recieveModel.TID;
// int type = recieveModel.type;
// var p = passTrackPlugin.wantPoint();
// p.ref.X = x.toDouble();
// p.ref.Y = y.toDouble();
// p.ref.TID = tid;
// p.ref.type = type;
// // var data = item['data'];
// // if (data != null) {
// // item['TID'] =
// // item['TID'] is int ? item['TID'] : num.parse(item['TID']);
// // item['type'] =
// // item['type'] is int ? item['type'] : num.parse(item['type']);
// // item['obj'] = DecodeDataObj.fromBase64(item['data']);
// // // this.updateDevice(item);
// // // this.sportsData.push(item);
// allPointData.add(recieveModel); allPointData.add(recieveModel);
// // } // }
// } catch (e) { } catch (e) {
// print("----$e\r\n$str"); print("----$e\r\n$str");
// } }
// allPointLen++; allPointLen++;
// start = end + 1; start = end + 1;
// } }
// return allPointLen; return allPointLen;
// } else { } else {
// // //
// var item = res; var item = res;
// var data = item['data']; var data = item['data'];
// if (data != null) { if (data != null) {
// item['obj'] = DecodeDataObj.fromBase64(item['data']); item['obj'] = DecodeDataObj.fromBase64(item['data']);
// item['type'] = num.parse(item['type']); item['type'] = num.parse(item['type']);
// item['TID'] = num.parse(item['TID']); item['TID'] = num.parse(item['TID']);
// // this.updateDevice(item); // this.updateDevice(item);
// // this.sportsData.push(item); // this.sportsData.push(item);
// } }
// return 1; return 1;
// } }
} }
//bits和typeBits //bits和typeBits

View File

@ -39,16 +39,15 @@ class PassTrackWidget extends StatefulWidget {
class _PasstrackState extends State<PassTrackWidget> { 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_orad"));
String str = "播放"; String str = "播放";
int sWidth = 800; int sWidth = 0;
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]; 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 _passTrackPlugin = PassTrack();
@override @override
initState() { initState() {
@ -85,20 +84,14 @@ class _PasstrackState extends State<PassTrackWidget> {
// } // }
// }); // });
}); });
var f = initPlatformState(); initPlatformState();
controller.getHisFileList(_passTrackPlugin);
f.then((void _) { if (controller.allLen <= 0) {
var future = controller.getHisFileList(_passTrackPlugin); return;
future.then((value) { }
_passTrackPlugin.setScale(1); _passTrackPlugin.generateTile(0, controller.allLen);
for (var TID in controller.deviceMap.keys) { _passTrackPlugin.waitForTile();
_passTrackPlugin.addDevice(int.parse(TID), 0); _passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr);
}
_passTrackPlugin.generateTile(0, value);
_passTrackPlugin.waitForTile();
_passTrackPlugin.playTrack(0, value, true, 0, ffi.nullptr);
});
});
} }
Future<void> initPlatformState() async { Future<void> initPlatformState() async {
@ -113,12 +106,11 @@ class _PasstrackState extends State<PassTrackWidget> {
fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1; fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1;
print("textureId: ${fileHandle.textureId}"); print("textureId: ${fileHandle.textureId}");
if (!mounted) Exception('Failed to get textureId.'); if (!mounted) return;
setState(() { setState(() {
platformVersion = platformVersion; platformVersion = platformVersion;
}); });
return;
} }
@override @override
@ -129,16 +121,7 @@ class _PasstrackState extends State<PassTrackWidget> {
return Stack( return Stack(
children: [ children: [
ScenceMapView( ScenceMapView(
children: [ children: [],
Positioned(
top: 0,
left: 0,
child: SizedBox(
width: sWidth * 1.0,
height: sWidth * 1.0,
// child: Text('Running on: $_platformVersion\n'),
child: Texture(textureId: fileHandle.textureId))),
],
onUpdate: (Offset center, double scale, double rotation) { onUpdate: (Offset center, double scale, double rotation) {
print("center:$center scale:$scale rotation:$rotation"); print("center:$center scale:$scale rotation:$rotation");
}, },
@ -252,7 +235,6 @@ class _PasstrackState extends State<PassTrackWidget> {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Column( Column(
children: [ children: [
const Text("此处遍数0"), const Text("此处遍数0"),
StreamBuilder<DateTime>( StreamBuilder<DateTime>(
@ -282,8 +264,7 @@ class _PasstrackState extends State<PassTrackWidget> {
}, },
), ),
], ],
), )
], ],
), ),
), ),

View File

@ -10,7 +10,7 @@ class BaseService {
//client实例 //client实例
final _client = http.Client(); final _client = http.Client();
final String token = final String token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI1NTI2MDc0LCJleHAiOjE3MjY4MjIwNzR9.l47sd4L8OswBcHJxamGe9M5ttWqiukoJvE5QfwPARlw"; "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiMSIsIjI0Il0sInVzZXJuYW1lIjoiYWRtaW4iLCJ1c2VySWQiOjEsIlBWIjo1LCJvcmciOiJhIiwiaWF0IjoxNzIyODY1MTE0LCJleHAiOjE3MjQxNjExMTR9.zuY366ldKkbtd1TTfcYIZfvhrovMlXLzzRk3j65Ua7o";
// String baseUrl = "http://192.168.1.189:8001";// // String baseUrl = "http://192.168.1.189:8001";//
String baseUrl = "http://1.82.251.83:8001"; //线 String baseUrl = "http://1.82.251.83:8001"; //线
@ -74,7 +74,7 @@ class GetServices {
// int tid = 109; // int tid = 109;
String projType; String projType;
String projCode; String projCode;
GetServices({this.projCode = "WXLMB", this.projType = "cp_road"}); GetServices({this.projCode = "", this.projType = ""});
// int tid = 1000; // int tid = 1000;
// String projType = "pile_cm"; // String projType = "pile_cm";
// 线 // 线
@ -114,21 +114,6 @@ class GetServices {
return res; return res;
} }
getHisFil1(String file) async {
file = file.substring(file.length - 18, file.length);
String fullUrl =
"http://192.168.1.154:8300/api/cp_road/record/data1/$projCode/$file";
Map<String, String> headers = {
// HttpHeaders.contentTypeHeader: "text/plain",
HttpHeaders.authorizationHeader:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1JlZnJlc2giOmZhbHNlLCJpc1IiOjAsInJvbGVJZHMiOlsiMSIsIjI0Il0sInVzZXJuYW1lIjoiYWRtaW4iLCJ1c2VySWQiOjEsIlBWIjo1LCJvcmciOiJhIiwiZXhwIjoxNzI2NzE1ODE3LCJpYXQiOjE3MjU0MTk4MTd9.RZ5MpHavsF_akOZALiHo-Y3bx-f_tTp5tfgNatR-98k",
};
Response response =
await http.Client().get(Uri.parse(fullUrl), headers: headers);
var res = response.body;
return res;
}
// //
getproject() async { getproject() async {
Map res = await service Map res = await service

@ -1 +1 @@
Subproject commit 5145127697ac2f0e3c8b80ae44d49fad9da760cf Subproject commit 30a101b8415cd162ab14f661f6f75ac7751962d3

@ -1 +1 @@
Subproject commit dfc74693602773a5e28d045854047e408b96a55d Subproject commit ac2179219ba52d0c91dfd51470fd1d7ebaae69be