Compare commits
2 Commits
5cc66f8314
...
38f7234280
Author | SHA1 | Date | |
---|---|---|---|
38f7234280 | |||
07d3835cc6 |
@ -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,7 +34,8 @@ 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);
|
||||||
mapController.deviceList[dev.TID] = dev;
|
deviceMap[dev.TID.toString()] = 0;
|
||||||
|
// deviceMap[dev.TID as String] = dev[int.parse(dev["width"])];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,17 +81,19 @@ class PassTrackController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getHisFileList(PassTrack passTrackPlugin) async {
|
Future<int> 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().getHisFile(file);
|
var jsData = await GetServices().getHisFil1(file);
|
||||||
|
print("have message");
|
||||||
int len = fileHandle.resolveJson(jsData, passTrackPlugin);
|
int len = fileHandle.resolveJson(jsData, passTrackPlugin);
|
||||||
allLen += len;
|
allLen += len;
|
||||||
// print("$pointList");
|
if (allLen >= 20000) {
|
||||||
// var totalList =fileHandle.allPointData;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print("allLen: $allLen");
|
return allLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ 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';
|
||||||
@ -17,8 +16,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;
|
||||||
@ -250,66 +249,83 @@ class FileHandle {
|
|||||||
List<RecieveModel> allPointData = [];
|
List<RecieveModel> allPointData = [];
|
||||||
int start = 0;
|
int start = 0;
|
||||||
var allPointLen = 0;
|
var allPointLen = 0;
|
||||||
// 记录当前数组的长度
|
// data 是一个列表
|
||||||
while (true) {
|
var data = jsonDecode(res)["data"];
|
||||||
int end = res.indexOf('\n', start);
|
for (var item in data) {
|
||||||
if (end < 0) {
|
// RecieveModel recieveModel = RecieveModel.fromJson(item);
|
||||||
break;
|
var X = item["X"].toDouble();
|
||||||
}
|
var Y = item["Y"].toDouble();
|
||||||
String str = res.substring(start, end);
|
var TID = item["TID"];
|
||||||
try {
|
var type = int.parse(item["type"]);
|
||||||
if (str[str.length - 1] == ",") {
|
var p = passTrackPlugin.wantPoint();
|
||||||
str = str.substring(0, str.length - 1);
|
p.ref.X = X;
|
||||||
}
|
p.ref.Y = Y;
|
||||||
var item = jsonDecode(str);
|
p.ref.TID = TID;
|
||||||
RecieveModel recieveModel = RecieveModel.fromJson(item);
|
p.ref.type = type;
|
||||||
if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
|
|
||||||
//dart重置中心
|
|
||||||
drawCtx.setCenter(
|
|
||||||
// {"x": recieveModel.x / 20, "y": recieveModel.y / 20});//532863.8,4208668.95
|
|
||||||
{"x": 10656637 / 20, "y": 84172941 / 20});//532863.8,4208668.95
|
|
||||||
}
|
|
||||||
int x = recieveModel.x;
|
|
||||||
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);
|
|
||||||
// }
|
|
||||||
} catch (e) {
|
|
||||||
print("----$e\r\n$str");
|
|
||||||
}
|
|
||||||
allPointLen++;
|
|
||||||
start = end + 1;
|
|
||||||
}
|
}
|
||||||
return allPointLen;
|
return data.length;
|
||||||
} else {
|
|
||||||
//只有一条数据的时候
|
|
||||||
var item = res;
|
|
||||||
var data = item['data'];
|
|
||||||
if (data != null) {
|
|
||||||
item['obj'] = DecodeDataObj.fromBase64(item['data']);
|
|
||||||
item['type'] = num.parse(item['type']);
|
|
||||||
item['TID'] = num.parse(item['TID']);
|
|
||||||
// this.updateDevice(item);
|
|
||||||
// this.sportsData.push(item);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
// 记录当前数组的长度
|
||||||
|
// while (true) {
|
||||||
|
// int end = res.indexOf('\n', start);
|
||||||
|
// if (end < 0) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// String str = res.substring(start, end);
|
||||||
|
// try {
|
||||||
|
// if (str[str.length - 1] == ",") {
|
||||||
|
// str = str.substring(0, str.length - 1);
|
||||||
|
// }
|
||||||
|
// var item = jsonDecode(str);
|
||||||
|
// RecieveModel recieveModel = RecieveModel.fromJson(item);
|
||||||
|
// if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
|
||||||
|
// //dart重置中心
|
||||||
|
// drawCtx.setCenter(
|
||||||
|
// // {"x": recieveModel.x / 20, "y": recieveModel.y / 20});//532863.8,4208668.95
|
||||||
|
// {"x": 10656637 / 20, "y": 84172941 / 20}); //532863.8,4208668.95
|
||||||
|
// }
|
||||||
|
// int x = recieveModel.x;
|
||||||
|
// 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);
|
||||||
|
// // }
|
||||||
|
// } catch (e) {
|
||||||
|
// print("----$e\r\n$str");
|
||||||
|
// }
|
||||||
|
// allPointLen++;
|
||||||
|
// start = end + 1;
|
||||||
|
// }
|
||||||
|
// return allPointLen;
|
||||||
|
// } else {
|
||||||
|
// //只有一条数据的时候
|
||||||
|
// var item = res;
|
||||||
|
// var data = item['data'];
|
||||||
|
// if (data != null) {
|
||||||
|
// item['obj'] = DecodeDataObj.fromBase64(item['data']);
|
||||||
|
// item['type'] = num.parse(item['type']);
|
||||||
|
// item['TID'] = num.parse(item['TID']);
|
||||||
|
// // this.updateDevice(item);
|
||||||
|
// // this.sportsData.push(item);
|
||||||
|
// }
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改点的bits和typeBits
|
//修改点的bits和typeBits
|
||||||
|
@ -39,15 +39,16 @@ 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_orad"));
|
final controller = Get.put(PassTrackController("WXLMB", "cp_road"));
|
||||||
String str = "播放";
|
String str = "播放";
|
||||||
int sWidth = 0;
|
int sWidth = 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];
|
List<int> speedList = [1, 2, 10, 20, 50, 100, 200, 500];
|
||||||
// int maxLength = 200;
|
// int maxLength = 200;
|
||||||
late SfRangeValues _rangevalues;
|
late SfRangeValues _rangevalues;
|
||||||
final _passTrackPlugin = PassTrack();
|
final PassTrack _passTrackPlugin = PassTrack();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
@ -84,14 +85,20 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
initPlatformState();
|
var f = initPlatformState();
|
||||||
controller.getHisFileList(_passTrackPlugin);
|
|
||||||
if (controller.allLen <= 0) {
|
f.then((void _) {
|
||||||
return;
|
var future = controller.getHisFileList(_passTrackPlugin);
|
||||||
}
|
future.then((value) {
|
||||||
_passTrackPlugin.generateTile(0, controller.allLen);
|
_passTrackPlugin.setScale(1);
|
||||||
_passTrackPlugin.waitForTile();
|
for (var TID in controller.deviceMap.keys) {
|
||||||
_passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr);
|
_passTrackPlugin.addDevice(int.parse(TID), 0);
|
||||||
|
}
|
||||||
|
_passTrackPlugin.generateTile(0, value);
|
||||||
|
_passTrackPlugin.waitForTile();
|
||||||
|
_passTrackPlugin.playTrack(0, value, true, 0, ffi.nullptr);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initPlatformState() async {
|
Future<void> initPlatformState() async {
|
||||||
@ -106,11 +113,12 @@ 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) return;
|
if (!mounted) Exception('Failed to get textureId.');
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
platformVersion = platformVersion;
|
platformVersion = platformVersion;
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -121,7 +129,16 @@ 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");
|
||||||
},
|
},
|
||||||
@ -235,6 +252,7 @@ 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>(
|
||||||
@ -264,7 +282,8 @@ class _PasstrackState extends State<PassTrackWidget> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -10,7 +10,7 @@ class BaseService {
|
|||||||
//创建client实例
|
//创建client实例
|
||||||
final _client = http.Client();
|
final _client = http.Client();
|
||||||
final String token =
|
final String token =
|
||||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiMSIsIjI0Il0sInVzZXJuYW1lIjoiYWRtaW4iLCJ1c2VySWQiOjEsIlBWIjo1LCJvcmciOiJhIiwiaWF0IjoxNzIyODY1MTE0LCJleHAiOjE3MjQxNjExMTR9.zuY366ldKkbtd1TTfcYIZfvhrovMlXLzzRk3j65Ua7o";
|
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI1NTI2MDc0LCJleHAiOjE3MjY4MjIwNzR9.l47sd4L8OswBcHJxamGe9M5ttWqiukoJvE5QfwPARlw";
|
||||||
|
|
||||||
// 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 = "", this.projType = ""});
|
GetServices({this.projCode = "WXLMB", this.projType = "cp_road"});
|
||||||
// int tid = 1000;
|
// int tid = 1000;
|
||||||
// String projType = "pile_cm";
|
// String projType = "pile_cm";
|
||||||
// 道路边线
|
// 道路边线
|
||||||
@ -114,6 +114,21 @@ 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 30a101b8415cd162ab14f661f6f75ac7751962d3
|
Subproject commit 5145127697ac2f0e3c8b80ae44d49fad9da760cf
|
@ -1 +1 @@
|
|||||||
Subproject commit ac2179219ba52d0c91dfd51470fd1d7ebaae69be
|
Subproject commit dfc74693602773a5e28d045854047e408b96a55d
|
Loading…
Reference in New Issue
Block a user