Compare commits
No commits in common. "38f72342808703bbdf93977d2ee6dcee87b0b4ee" and "5cc66f831456538039ffac810c4a8b077848f1b3" have entirely different histories.
38f7234280
...
5cc66f8314
@ -19,13 +19,13 @@ class PassTrackController extends GetxController {
|
||||
late final GetServices service;
|
||||
// final PassTrack _passTrackPlugin;
|
||||
PassTrackController(this.projCode, this.projType);
|
||||
Map<String, int> deviceMap = {};
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
service = GetServices(projCode: projCode, projType: projType);
|
||||
loadProject();
|
||||
// loadSideLine();
|
||||
loadSideLine();
|
||||
loadBindDevice();
|
||||
// getHisFileList();
|
||||
}
|
||||
@ -34,8 +34,7 @@ class PassTrackController extends GetxController {
|
||||
var binddevices = await service.getDeviceBind();
|
||||
for (var device in binddevices) {
|
||||
var dev = DeviceItem.fromJson(device);
|
||||
deviceMap[dev.TID.toString()] = 0;
|
||||
// deviceMap[dev.TID as String] = dev[int.parse(dev["width"])];
|
||||
mapController.deviceList[dev.TID] = dev;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,19 +80,17 @@ class PassTrackController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> getHisFileList(PassTrack passTrackPlugin) async {
|
||||
getHisFileList(PassTrack passTrackPlugin) async {
|
||||
Map textlist = await GetServices().getHisFileList();
|
||||
List fileList = textlist['list'];
|
||||
for (var i = 0; i < fileList.length; i++) {
|
||||
var file = fileList[i];
|
||||
var jsData = await GetServices().getHisFil1(file);
|
||||
print("have message");
|
||||
var jsData = await GetServices().getHisFile(file);
|
||||
int len = fileHandle.resolveJson(jsData, passTrackPlugin);
|
||||
allLen += len;
|
||||
if (allLen >= 20000) {
|
||||
break;
|
||||
// print("$pointList");
|
||||
// var totalList =fileHandle.allPointData;
|
||||
}
|
||||
}
|
||||
return allLen;
|
||||
print("allLen: $allLen");
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import 'package:ffi/ffi.dart';
|
||||
import 'package:web_socket_channel/io.dart';
|
||||
import 'package:web_socket_channel/status.dart' as status;
|
||||
|
||||
|
||||
import 'package:pass_track/binding.dart' as Binding;
|
||||
|
||||
import '../../../service/base.dart';
|
||||
@ -16,8 +17,8 @@ import '../model/coord_trans.dart';
|
||||
import '../model/draw_context.dart';
|
||||
import '../model/recievemodel.dart';
|
||||
|
||||
DrawContext drawCtx = DrawContext();
|
||||
|
||||
DrawContext drawCtx = DrawContext();
|
||||
class FileHandle {
|
||||
int textureId = -1;
|
||||
int index = 0;
|
||||
@ -249,83 +250,66 @@ class FileHandle {
|
||||
List<RecieveModel> allPointData = [];
|
||||
int start = 0;
|
||||
var allPointLen = 0;
|
||||
// data 是一个列表
|
||||
var data = jsonDecode(res)["data"];
|
||||
for (var item in data) {
|
||||
// RecieveModel recieveModel = RecieveModel.fromJson(item);
|
||||
var X = item["X"].toDouble();
|
||||
var Y = item["Y"].toDouble();
|
||||
var TID = item["TID"];
|
||||
var type = int.parse(item["type"]);
|
||||
var p = passTrackPlugin.wantPoint();
|
||||
p.ref.X = X;
|
||||
p.ref.Y = Y;
|
||||
p.ref.TID = TID;
|
||||
p.ref.type = type;
|
||||
}
|
||||
return data.length;
|
||||
}
|
||||
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;
|
||||
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']);
|
||||
// item['type'] = num.parse(item['type']);
|
||||
// item['TID'] = num.parse(item['TID']);
|
||||
// // this.updateDevice(item);
|
||||
// // this.sportsData.push(item);
|
||||
|
||||
allPointData.add(recieveModel);
|
||||
// }
|
||||
// return 1;
|
||||
// }
|
||||
} 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
|
||||
|
@ -39,16 +39,15 @@ class PassTrackWidget extends StatefulWidget {
|
||||
class _PasstrackState extends State<PassTrackWidget> {
|
||||
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
|
||||
GlobalKey<PopupMenuButtonState<int>>();
|
||||
final controller = Get.put(PassTrackController("WXLMB", "cp_road"));
|
||||
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
||||
String str = "播放";
|
||||
int sWidth = 800;
|
||||
int sHeight = 800;
|
||||
int sWidth = 0;
|
||||
int bits = -1;
|
||||
int speed = 50;
|
||||
List<int> speedList = [1, 2, 10, 20, 50, 100, 200, 500];
|
||||
// int maxLength = 200;
|
||||
late SfRangeValues _rangevalues;
|
||||
final PassTrack _passTrackPlugin = PassTrack();
|
||||
final _passTrackPlugin = PassTrack();
|
||||
|
||||
@override
|
||||
initState() {
|
||||
@ -85,20 +84,14 @@ class _PasstrackState extends State<PassTrackWidget> {
|
||||
// }
|
||||
// });
|
||||
});
|
||||
var f = initPlatformState();
|
||||
|
||||
f.then((void _) {
|
||||
var future = controller.getHisFileList(_passTrackPlugin);
|
||||
future.then((value) {
|
||||
_passTrackPlugin.setScale(1);
|
||||
for (var TID in controller.deviceMap.keys) {
|
||||
_passTrackPlugin.addDevice(int.parse(TID), 0);
|
||||
initPlatformState();
|
||||
controller.getHisFileList(_passTrackPlugin);
|
||||
if (controller.allLen <= 0) {
|
||||
return;
|
||||
}
|
||||
_passTrackPlugin.generateTile(0, value);
|
||||
_passTrackPlugin.generateTile(0, controller.allLen);
|
||||
_passTrackPlugin.waitForTile();
|
||||
_passTrackPlugin.playTrack(0, value, true, 0, ffi.nullptr);
|
||||
});
|
||||
});
|
||||
_passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr);
|
||||
}
|
||||
|
||||
Future<void> initPlatformState() async {
|
||||
@ -113,12 +106,11 @@ class _PasstrackState extends State<PassTrackWidget> {
|
||||
fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1;
|
||||
print("textureId: ${fileHandle.textureId}");
|
||||
|
||||
if (!mounted) Exception('Failed to get textureId.');
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
platformVersion = platformVersion;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -129,16 +121,7 @@ class _PasstrackState extends State<PassTrackWidget> {
|
||||
return Stack(
|
||||
children: [
|
||||
ScenceMapView(
|
||||
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))),
|
||||
],
|
||||
children: [],
|
||||
onUpdate: (Offset center, double scale, double rotation) {
|
||||
print("center:$center scale:$scale rotation:$rotation");
|
||||
},
|
||||
@ -252,7 +235,6 @@ class _PasstrackState extends State<PassTrackWidget> {
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
|
||||
children: [
|
||||
const Text("此处遍数:0"),
|
||||
StreamBuilder<DateTime>(
|
||||
@ -282,8 +264,7 @@ class _PasstrackState extends State<PassTrackWidget> {
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -10,7 +10,7 @@ class BaseService {
|
||||
//创建client实例
|
||||
final _client = http.Client();
|
||||
final String token =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI1NTI2MDc0LCJleHAiOjE3MjY4MjIwNzR9.l47sd4L8OswBcHJxamGe9M5ttWqiukoJvE5QfwPARlw";
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiMSIsIjI0Il0sInVzZXJuYW1lIjoiYWRtaW4iLCJ1c2VySWQiOjEsIlBWIjo1LCJvcmciOiJhIiwiaWF0IjoxNzIyODY1MTE0LCJleHAiOjE3MjQxNjExMTR9.zuY366ldKkbtd1TTfcYIZfvhrovMlXLzzRk3j65Ua7o";
|
||||
|
||||
// String baseUrl = "http://192.168.1.189:8001";//本地
|
||||
String baseUrl = "http://1.82.251.83:8001"; //线上
|
||||
@ -74,7 +74,7 @@ class GetServices {
|
||||
// int tid = 109;
|
||||
String projType;
|
||||
String projCode;
|
||||
GetServices({this.projCode = "WXLMB", this.projType = "cp_road"});
|
||||
GetServices({this.projCode = "", this.projType = ""});
|
||||
// int tid = 1000;
|
||||
// String projType = "pile_cm";
|
||||
// 道路边线
|
||||
@ -114,21 +114,6 @@ class GetServices {
|
||||
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 {
|
||||
Map res = await service
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5145127697ac2f0e3c8b80ae44d49fad9da760cf
|
||||
Subproject commit 30a101b8415cd162ab14f661f6f75ac7751962d3
|
@ -1 +1 @@
|
||||
Subproject commit dfc74693602773a5e28d045854047e408b96a55d
|
||||
Subproject commit ac2179219ba52d0c91dfd51470fd1d7ebaae69be
|
Loading…
Reference in New Issue
Block a user