Compare commits

...

3 Commits

Author SHA1 Message Date
ff9f1f9be2 merge network 2024-09-06 10:16:07 +08:00
b803fab5d5 框架搭好 2024-09-06 09:52:06 +08:00
tanlinxing
2bd17c166b 播放器 2024-09-06 09:11:06 +08:00
13 changed files with 2084 additions and 309 deletions

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\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"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-09-06 09:18:35.600396","version":"3.24.2","swift_package_manager_enabled":false} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"pass_track","path":"G:\\\\workplace\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"pass_track","path":"G:\\\\workplace\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"pass_track","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-09-06 09:19:51.601720","version":"3.24.2","swift_package_manager_enabled":false}

View File

@ -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 = [
PassTrack( PassTrackWidget(
date: '', date: '',
), ),
Container( Container(

View File

@ -1,63 +0,0 @@
class CoordTrans {
int id;
// ignore: non_constant_identifier_names
double L0;
String belt;
String? calibs;
String dstEllipsoid;
double dx;
double dy;
double dz;
double wx;
double wy;
double wz;
double k;
double elevation;
int isMain;
String name;
double rota;
String srcEllipsoid;
CoordTrans({
required this.name,
// ignore: non_constant_identifier_names
required this.L0,
required this.belt,
this.calibs,
required this.dstEllipsoid,
required this.dx,
required this.dy,
required this.dz,
required this.id,
required this.wx,
required this.wy,
required this.wz,
required this.k,
required this.elevation,
required this.isMain,
required this.rota,
required this.srcEllipsoid,
});
factory CoordTrans.fromJson(Map<dynamic, dynamic> data) {
return CoordTrans(
name: data['name'],
id: data['id'],
L0: data['L0'].toDouble(),
belt: data['belt'],
calibs: data['calibs'],
dstEllipsoid: data['dstEllipsoid'],
dx: data['dx'].toDouble(),
dy: data['dy'].toDouble(),
dz: data['dz'].toDouble(),
wx: data['wx'].toDouble(),
wy: data['wy'].toDouble(),
wz: data['wz'].toDouble(),
rota: data['rota'].toDouble(),
k: data['k'].toDouble(),
isMain: data['is_main'],
elevation: data['elevation'].toDouble(),
srcEllipsoid: data['srcEllipsoid'],
);
}
void forEach(Null Function(dynamic key, dynamic value) param0) {}
}

View File

@ -1,16 +1,23 @@
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 'sevice/file_handle.dart';
FileHandle fileHandle = FileHandle();
class PassTrackController extends GetxController { class PassTrackController extends GetxController {
int allLen = 0;
final mapController = Get.put(ScenceMapController()); final mapController = Get.put(ScenceMapController());
String projCode; String projCode;
String projType; String projType;
late final GetServices service; late final GetServices service;
// final PassTrack _passTrackPlugin;
PassTrackController(this.projCode, this.projType); PassTrackController(this.projCode, this.projType);
@override @override
@ -20,6 +27,7 @@ class PassTrackController extends GetxController {
loadProject(); loadProject();
loadSideLine(); loadSideLine();
loadBindDevice(); loadBindDevice();
// getHisFileList();
} }
loadBindDevice() async { loadBindDevice() async {
@ -71,4 +79,18 @@ class PassTrackController extends GetxController {
mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2); mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2);
} }
} }
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().getHisFile(file);
int len = fileHandle.resolveJson(jsData, passTrackPlugin);
allLen += len;
// print("$pointList");
// var totalList =fileHandle.allPointData;
}
print("allLen: $allLen");
}
} }

View File

@ -0,0 +1,682 @@
// ignore_for_file: non_constant_identifier_names
import 'dart:math';
class CoordGPS {
double LAT; //
double LNG; //
double? ALT; //
CoordGPS({this.ALT, required this.LAT, required this.LNG});
}
class CoordXYH {
double X;
double Y;
double H;
CoordXYH({required this.X, required this.Y, required this.H});
}
class CoordBLH {
double B;
double L;
double H;
CoordBLH({required this.B, required this.H, required this.L});
}
class CoordXYZ {
double X;
double Y;
double Z;
CoordXYZ({required this.X, required this.Y, required this.Z});
}
class PointXY {
double X;
double Y;
PointXY({required this.X, required this.Y});
}
class Region {
double X;
double Y;
double? width;
double? heigth;
double? D;
Region({this.D, required this.X, required this.Y, this.heigth, this.width});
}
class Ellipsoid {
late double A;
late double F;
late double B;
late double E12;
late double E22;
Ellipsoid(String name) {
const Map<String, Map<String, double>> datums = {
'BJ54': {'a': 6378245, 'f': 1 / 298.3},
'XA80': {'a': 6378140, 'f': 1 / 298.257},
'WGS84': {'a': 6378137, 'f': 1 / 298.257223563},
'WGS2000': {'a': 6378137, 'f': 1 / 298.257222101}
};
var Datum = datums[name];
if (Datum != null) {
double a = Datum['a']!;
double f = Datum['f']!;
double b = a - f * a;
double e12 = (a * a - b * b) / (a * a); //
double e22 = (a * a - b * b) / (b * b); //
A = a;
F = f;
B = b;
E12 = e12;
E22 = e22;
}
}
}
class TransParm {
late double dx;
late double dy;
late double dz;
late double rx;
late double ry;
late double rz;
late double rota;
late double k;
TransParm(TransOptions options) {
dx = options.dx ?? 0;
dy = options.dy ?? 0;
dz = options.dz ?? 0;
rx = options.rx ?? 0;
ry = options.ry ?? 0;
rz = options.rz ?? 0;
k = options.k ?? 0;
rota = options.rota ?? 0;
}
}
class TransOptions {
double? dx; //X平移(M)
double? dy; //Y平移(M)
double? dz; //z平移(M)
double? rx; //X旋转(°)
double? ry; //Y旋转(°)
double? rz; //Z旋转(°)
double? rota; //4
double? k; //(ppm)
double? L0; //线()
String? srcEllipsoid; //
String? dstEllipsoid; //
double? zoneWidth; //线
double? elevation; //
TransOptions({
this.L0,
this.dstEllipsoid,
this.dx,
this.dy,
this.dz,
this.elevation,
this.k,
this.rota,
this.rx,
this.ry,
this.rz,
this.srcEllipsoid,
});
}
class CoordTrans {
late double L0; //线
late double zoneWidth; //
late double elevation; //
late double rota; //4
late Ellipsoid srcEllipsoid; //
late Ellipsoid dstEllipsoid; //
late TransParm transParm; //7
CoordTrans(TransOptions options) {
transParm = TransParm(options);
L0 = options.L0 ?? 0;
elevation = options.elevation ?? 0;
srcEllipsoid = Ellipsoid(options.srcEllipsoid ?? 'WGS84');
dstEllipsoid = Ellipsoid(options.dstEllipsoid ?? 'WGS2000');
zoneWidth = options.zoneWidth ?? 3;
}
CoordXYH GPS2XY(CoordGPS gps) {
return d2p(CoordBLH(H: gps.ALT ?? elevation, B: gps.LAT, L: gps.LNG));
}
//
CoordXYH d2p(CoordBLH blh) {
CoordXYZ zj = BLH2XYZ(blh);
CoordXYZ xzj = XYZ2XYZ(zj);
CoordBLH xdd = XYZ2BLH(xzj);
CoordXYH xpm = BL2XY(xdd);
return xpm;
}
//
CoordBLH p2d(CoordXYH xyh) {
CoordBLH bl = XY2BL(xyh, true);
CoordXYZ zj = BLH2XYZ(bl, true);
CoordXYZ xzj = XYZ2XYZ(zj, true);
CoordBLH xdd = XYZ2BLH(xzj, true);
return xdd;
}
setZoneWidth(width) {
if (width != 6 && width != 3) {
print('带宽应当为6或者为3');
} else {
zoneWidth = width;
}
}
setL0(l0) {
L0 = l0;
}
int getZoneNo(double lng) {
// 6
//
if (zoneWidth == 6) {
return ((lng + 6) / 6).floor();
}
// 3
return ((lng + 1.5) / 3).floor();
}
PointXY xy2xyLocal(PointXY source) {
double x = source.X;
double y = source.Y;
double destx = x * transParm.k * cos(rota) -
y * transParm.k * sin(rota) +
transParm.dx;
double desty = x * transParm.k * sin(rota) +
y * transParm.k * cos(rota) +
transParm.dy;
return PointXY(X: destx, Y: desty);
}
CoordXYZ BLH2XYZ(CoordBLH pointBLH, [srcDst = false]) {
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
double a = ellipsoid.A;
double e12 = ellipsoid.E12;
double radB = pointBLH.B / 180 * pi;
double radL = pointBLH.L / 180 * pi;
double H = pointBLH.H;
double N = a / sqrt(1 - e12 * sin(radB) * sin(radB)); //
double X = (N + H) * cos(radB) * cos(radL);
double Y = (N + H) * cos(radB) * sin(radL);
double Z = (N * (1 - e12) + H) * sin(radB);
return CoordXYZ(X: X, Y: Y, Z: Z);
}
/*
dX, dY, dZ:
wX, wY, wZ: ()
Kppm: ppm 1000000
*/
CoordXYZ XYZ2XYZ(CoordXYZ xyz, [srcDst = false]) {
double X = xyz.X;
double Y = xyz.Y;
double Z = xyz.Z;
double dX = transParm.dx;
double dY = transParm.dy;
double dZ = transParm.dz;
double rX = transParm.rx / 3600 / 180 * pi;
double rY = transParm.ry / 3600 / 180 * pi;
double rZ = transParm.rz / 3600 / 180 * pi;
double Kppm = transParm.k / 1000000;
CoordXYZ result = CoordXYZ(X: 0, Y: 0, Z: 0);
if (srcDst) {
result.X = X - dX - Kppm * X + rY * Z - rZ * Y;
result.Y = Y - dY - Kppm * Y - rX * Z + rZ * X;
result.Z = Z - dZ - Kppm * Z + rX * Y - rY * X;
} else {
result.X = X + dX + Kppm * X - rY * Z + rZ * Y;
result.Y = Y + dY + Kppm * Y + rX * Z - rZ * X;
result.Z = Z + dZ + Kppm * Z - rX * Y + rY * X;
}
return result;
}
/*
2
https://wenku.baidu.com/view/30a08f9ddd88d0d233d46a50.html
*/
CoordBLH XYZ2BLH(CoordXYZ XYZ, [srcDst = false]) {
double X = XYZ.X;
double Y = XYZ.Y;
double Z = XYZ.Z;
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
double a = ellipsoid.A;
double b = ellipsoid.B;
double e12 = ellipsoid.E12;
double e22 = ellipsoid.E22;
double L = atan(Y / X);
//
double degL = L * 180 / pi;
// Y值为正 西
if (Y > 0) {
while (degL < 0) {
degL += 180;
}
while (degL > 180) {
degL -= 180;
}
} else {
while (degL > 0) {
degL -= 180;
}
while (degL < -180) {
degL += 180;
}
}
double tgU = Z / (sqrt(X * X + Y * Y) * sqrt(1 - e12));
double U = atan(tgU);
double tgB = (Z + b * e22 * pow(sin(U), 3)) /
(sqrt(X * X + Y * Y) - a * e12 * pow(cos(U), 3));
double B = atan(tgB);
double degB = B * 180 / pi; //
if (Z > 0) {
// Z值为正
while (degB < 0) {
degB += 90;
}
while (degB > 90) {
degB -= 90;
}
} else {
while (degB > 0) {
degB -= 90;
}
while (degB < -90) {
degB += 90;
}
}
while (degB < 0) {
degB += 360;
}
while (degB > 360) {
degB -= 360;
}
double N = a / sqrt(1 - e12 * sin(B) * sin(B)); //
double H = 0;
// B接近极区 ±90°
if ((degB).abs() > 80) {
H = Z / sin(B) - N * (1 - e12);
} else {
H = sqrt(X * X + Y * Y) / cos(B) - N;
}
return CoordBLH(B: degB, L: degL, H: H);
}
/*
prjHeight:
http://www.cnblogs.com/imeiba/p/5696967.html
*/
CoordXYH BL2XY(CoordBLH BLH,
[srcDst = false, offsetY = 500000, offsetX = 0]) {
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
double a = ellipsoid.A;
double b = ellipsoid.B;
double e12 = ellipsoid.E12;
double e22 = ellipsoid.E22;
if (L0 == 0) {
int zoneNo = getZoneNo(BLH.L);
L0 = (zoneNo - 0.5) * zoneWidth;
}
double radL0 = L0 / 180 * pi;
double radB = BLH.B / 180 * pi;
double radL = BLH.L / 180 * pi;
double N = a / sqrt(1 - e12 * sin(radB) * sin(radB)); //
double T = tan(radB) * tan(radB);
double C = e22 * cos(radB) * cos(radB);
double A = (radL - radL0) * cos(radB);
double M = a *
((1 - e12 / 4 - 3 * e12 * e12 / 64 - 5 * e12 * e12 * e12 / 256) * radB -
(3 * e12 / 8 + 3 * e12 * e12 / 32 + 45 * e12 * e12 * e12 / 1024) *
sin(2 * radB) +
(15 * e12 * e12 / 256 + 45 * e12 * e12 * e12 / 1024) *
sin(4 * radB) -
(35 * e12 * e12 * e12 / 3072) * sin(6 * radB));
//x,y的计算公式见孔祥元等主编武汉大学出版社2002年出版的72
//( [
double x = M +
N *
tan(radB) *
(A * A / 2 +
(5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 +
(61 - 58 * T + T * T + 600 * C - 330 * e22) *
A *
A *
A *
A *
A *
A /
720);
double y = N *
(A +
(1 - T + C) * A * A * A / 6 +
(5 - 18 * T * T * T + 72 * C - 58 * e22) * A * A * A * A * A / 120);
x = offsetX + x * (b + elevation) / b;
y = offsetY + y * (b + elevation) / b;
return CoordXYH(
X: (x * 1000).round() / 1000, Y: (y * 1000).round() / 1000, H: BLH.H);
}
/*
prjHeight:
http://www.cnblogs.com/imeiba/p/5696967.html
*/
CoordBLH XY2BL(CoordXYH xyh,
[srcDst = false, offsetY = 500000, offsetX = 0]) {
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
double a = ellipsoid.A;
double b = ellipsoid.B;
double e12 = ellipsoid.E12;
double e22 = ellipsoid.E22;
double e1 = (1 - sqrt(1 - e12)) / (1 + sqrt(1 - e12));
double radL0 = L0 / 180 * pi;
//
double Y = xyh.Y % 1000000;
double x = (xyh.X - offsetX) * b / (b + elevation);
double y = (Y - offsetY) * b / (b + elevation);
double u = x /
(a * (1 - e12 / 4 - 3 * e12 * e12 / 64 - 5 * e12 * e12 * e12 / 256));
double fai = u +
(3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * sin(2 * u) +
(21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * sin(4 * u) +
(151 * e1 * e1 * e1 / 96) * sin(6 * u) +
(1097 * e1 * e1 * e1 * e1 / 512) * sin(8 * u);
double C = e22 * cos(fai) * cos(fai);
double T = tan(fai) * tan(fai);
double N = a / sqrt(1 - e12 * sin(fai) * sin(fai));
double R = a *
(1 - e12) /
sqrt((1 - e12 * sin(fai) * sin(fai)) *
(1 - e12 * sin(fai) * sin(fai)) *
(1 - e12 * sin(fai) * sin(fai)));
double D = y / N;
double L = radL0 +
(D -
(1 + 2 * T + C) * D * D * D / 6 +
(5 - 2 * C + 28 * T - 3 * C * C + 8 * e22 + 24 * T * T) *
D *
D *
D *
D *
D /
120) /
cos(fai);
double B = fai -
(N * tan(fai) / R) *
(D * D / 2 -
(5 + 3 * T + 10 * C - 4 * C * C - 9 * e22) *
D *
D *
D *
D /
24 +
(61 + 90 * T + 298 * C + 45 * T * T - 256 * e22 - 3 * C * C) *
D *
D *
D *
D *
D *
D /
720);
B = B * 180 / pi;
L = L * 180 / pi;
return CoordBLH(B: B, L: L, H: xyh.H);
}
//
dist(PointXY p1, PointXY p2) {
double d = sqrt(pow((p2.X - p1.X), 2) + pow((p2.Y - p1.Y), 2));
return d;
}
//
double fwj(PointXY p1, PointXY p2) {
double dx = p2.X - p1.X;
double dy = p2.Y - p1.Y;
return pi - sign(dy) - atan(dx / dy);
}
//
TransOptions calcThree(CoordBLH p1, CoordXYH p2) {
CoordXYZ source = BLH2XYZ(p1);
CoordBLH bl = XY2BL(p2, true);
CoordXYZ dest = BLH2XYZ(bl, true);
double dX = dest.X - source.X;
double dY = dest.Y - source.Y;
double dZ = dest.Z - source.Z;
return TransOptions(dx: dX, dy: dY, dz: dZ);
}
// TransOptions calcFour(List p1, List p2, int PointCount) {
// double rota = 0;
// double scale = 0;
// double dx = 0;
// double dy = 0;
// if (PointCount == 2) {
// rota = fwj(p2[0] as PointXY, p2[1]) - fwj(p1[0], p1[1]);
// scale = dist(p2[0], p2[1]) / dist(p1[0], p1[1]);
// dx = p2[0].X - scale * cos(rota) * p1[0].X + scale * sin(rota) * p1[0].Y;
// dy = p2[0].Y - scale * sin(rota) * p1[0].X - scale * cos(rota) * p1[0].Y;
// } else if (PointCount > 2) {
// double u = 1.0, v = 0, Dx = 0.0, Dy = 0.0;
// int intCount = PointCount;
// Matrix4 dx1 = Matrix.zeros(4, 1);
// // Matrix4 B1 = Matrix.zeros(2 * intCount, 4);
// Matrix4 B1 = Matrix4.zero();
// for (int i = 0; i < 2 * intCount; i++) {
// for (int j = 0; j < 4; j++) {
// B1.setEntry(i, j, 0);
// }
// }
// Matrix4 W1 = Matrix.zeros(2 * intCount, 1);
// // Matrix4 BT = Matrix.zeros(4, 2 * intCount);
// Matrix4 BT = Matrix4.zero();
// for (int i = 0; i < 4; i++) {
// for (int j = 0; j < 2 * intCount; j++) {
// BT.setEntry(i, j, 0);
// }
// }
// Matrix4 N = Matrix4(
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// );
// Matrix4 InvN = Matrix4(
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// 0,
// );
// Matrix4 BTW = Matrix.zeros(4, 1);
// for (int i = 0; i < intCount; i++) {
// //
// B1.setEntry(2 * i, 0, 1);
// B1.setEntry(2 * i, 1, 0);
// B1.setEntry(2 * i, 2, p1[i].X);
// B1.setEntry(2 * i, 3, -p1[i].Y);
// B1.setEntry(2 * i + 1, 0, 0);
// B1.setEntry(2 * i + 1, 1, 1);
// B1.setEntry(2 * i + 1, 2, p1[i].Y);
// B1.setEntry(2 * i + 1, 3, p1[i].X);
// // B1[2 * i][0] = 1;
// // B1[2 * i][1] = 0;
// // B1[2 * i][2] = p1[i].X;
// // B1[2 * i][3] = -p1[i].Y;
// // B1[2 * i + 1][0] = 0;
// // B1[2 * i + 1][1] = 1;
// // B1[2 * i + 1][2] = p1[i].Y;
// // B1[2 * i + 1][3] = p1[i].X;
// }
// for (int i = 0; i < intCount; i++) {
// //
// // W1[2 * i][0] = p2[i].X - u * p1[i].X + v * p1[i].Y - Dx;
// // W1[2 * i + 1][0] = p2[i].Y - u * p1[i].Y - v * p1[i].X - Dy;
// W1.setEntry(2 * i, 0, p2[i].X - u * p1[i].X + v * p1[i].Y - Dx);
// W1.setEntry(2 * i + 1, 0, p2[i].Y - u * p1[i].Y - v * p1[i].X - Dy);
// }
// //
// Matrix4 b1 = Matrix4.identity();
// // B1
// BT = Matrix4.copy(b1);
// BT.transpose();
// //
// N = BT * B1;
// //
// InvN = N.clone();
// InvN.invert();
// BTW = BT * (W1);
// dx1 = InvN * (BTW);
// Dx = Dx + dx1[0][0];
// Dy = Dy + dx1[1][0];
// u = u + dx1[2][0];
// v = v + dx1[3][0];
// dx = Dx;
// dy = Dy;
// rota = atan(v / u);
// scale = u / cos(rota);
// }
// return TransOptions(rota: rota, k: scale, dx: dx, dy: dy);
// }
// //
// TransOptions calcBuras(List p1, List p2, pointCount) {
// let B1 = Matrix.zeros(pointCount * 3, 7);
// let dx1 = Matrix.zeros(7, 1);
// let L = Matrix.zeros(pointCount * 3, 1);
// let BT = Matrix.zeros(7, pointCount * 3);
// let N = Matrix.zeros(7, 7);
// let InvN = Matrix.zeros(7, 7);
// let BTL = Matrix.zeros(7, 1);
// for (int i = 0; i < pointCount * 3; i++) {
// if (i % 3 == 0) {
// L[i][0] = p2[(i / 3).floor()].X;
// } else if (i % 3 == 1) {
// L[i][0] = p2[(i / 3).floor()].Y;
// } else if (i % 3 == 2) {
// L[i][0] = p2[(i / 3).floor()].Z;
// }
// }
// for (int i = 0; i < pointCount * 3; i++) {
// if (i % 3 == 0) {
// int index = (i / 3) as int;
// B1[i][0] = 1;
// B1[i][1] = 0;
// B1[i][2] = 0;
// B1[i][3] = p1[index].X;
// B1[i][4] = 0;
// B1[i][5] = -p1[index].Z;
// B1[i][6] = p1[index].Y;
// } else if (i % 3 == 1) {
// int index = ((i - 1) / 3) as int;
// B1[i][0] = 0;
// B1[i][1] = 1;
// B1[i][2] = 0;
// B1[i][3] = p1[index].Y;
// B1[i][4] = p1[index].Z;
// B1[i][5] = 0;
// B1[i][6] = -p1[index].X;
// } else if (i % 3 == 2) {
// int index = ((i - 2) / 3) as int;
// B1[i][0] = 0;
// B1[i][1] = 0;
// B1[i][2] = 1;
// B1[i][3] = p1[index].Z;
// B1[i][4] = -p1[index].Y;
// B1[i][5] = p1[index].X;
// B1[i][6] = 0;
// }
// }
// Matrix4 b1 = Matrix4.identity();
// BT = B1.transpose();
// N = BT.mmul(B1);
// InvN = inverse(N);
// BTL = BT.mmul(L);
// dx1 = InvN.mmul(BTL);
// double dx = dx1[0][0];
// double dy = dx1[1][0];
// double dz = dx1[2][0];
// double scale = dx1[3][0];
// double rotax = dx1[4][0] / dx1[3][0];
// double rotay = dx1[5][0] / dx1[3][0];
// double rotaz = dx1[6][0] / dx1[3][0];
// return TransOptions(
// dx: dx, dy: dy, dz: dz, k: scale, rx: rotax, ry: rotay, rz: rotaz);
// }
double sign(num number) {
if (number < 0) {
return -1.0;
} else if (number > 0) {
return 1.0;
} else {
return 0.0;
}
}
}

View File

@ -0,0 +1,261 @@
import 'dart:math';
import 'dart:typed_data';
import 'dart:convert';
import 'package:flutter/material.dart';
class DrawContext {
DrawContext();
//
//
double zeroDX = 0;
double zeroDY = 0;
//
double zeroX = 0;
double zeroY = 0;
//
double scale = 1;
double lastScale = 1;
//
Size screenSize = const Size(100, 100);
//
static int unit = 20;
//
double angle = 0;
double lastAngle = 0;
List<double> grounScaleList = [
78271.5170,
39135.7585,
19567.8792,
9783.9396,
4891.9698,
2445.9849,
1222.9925,
611.4962,
305.7481,
152.8741,
76.4370,
38.2185,
19.1093,
9.5546,
4.7773,
2.3887,
1.1943,
0.5972,
0.2986,
0.1493,
0.0746,
0.0373,
0.0187
];
//
bool isRuler = false;
bool isScale = true;
//
bool isMap = true;
//
List dotList = [];
//
int? currentDotIndex;
//
List polyonList = [];
int polyonExpendIndex = 0;
//
Offset currentDot = const Offset(0, 0);
//
int groundScaleIndex = 21;
//
Offset pos = const Offset(0, 0);
Offset lastPos = const Offset(0, 0);
//
bool isNomal = true;
double mark = 1000;//[8,40,200,1000]100mark默认1000
double space = 1;
List? pointList;
List<List<double>> gengerateList = [];
List<Widget> devicePositioned=[];
/// @param {double} m -
m2px(double m) {
return m / 20 / scale;
}
/// @param {double} px -
px2m(double px) {
return px * 20 / scale;
}
// x是平面坐标的竖直方向
/// @param {num} x - x
/// @param {num} y - y
// xy2Screen(num x, num y, [k = 1]) {
// double screenx = (y / k * scale - zeroDX);
// double screeny = (screenSize.height - (x / k * scale - zeroDY));
// return Offset(screenx, screeny);
// }
xy2Screen(num x, num y, [k = 1]) {
double screenx = (y * k / (scale) - zeroDX);
double screeny = (screenSize.height - (x * k / (scale) - zeroDY));
return Offset(screenx, screeny);
}
/// @param {screenOffset} x - Offset(x,y)
screen2xy(Offset screenOffset, [k = 1]) {
// double X = (screenOffset.dy / k * scale + zeroDX);
// double Y = (screenSize.height - screenOffset.dx / k * scale + zeroDY);
double Y = (screenOffset.dx+zeroDX)*scale/k;
double X=(screenSize.height-screenOffset.dy+zeroDY)*scale/k;
// double X = (screenOffset.dx * k + zeroDX);
// double Y = (screenSize.height - screenOffset.dy * k + zeroDY);
return Offset(X, Y);
}
//
/// @param {Size} size - (width,height)
setSize(Size size) {
screenSize = size;
if (screenSize != size) {
setCenter(null);
lastScale = scale;
screenSize = size;
}
}
//
// setCenter(obj, [k = 1]) {
// if (obj != null) {
// zeroDX = ((obj['y'] * k * scale - screenSize.width / 2).abs())
// .floor()
// .toDouble();
// zeroDY = ((obj['x'] * k * scale - screenSize.height / 2).abs())
// .floor()
// .toDouble();
// zeroX = (obj['x'] * k).toDouble();
// zeroY = (obj['y'] * k).toDouble();
// } else {
// zeroDX =
// ((zeroY * k * scale - screenSize.width / 2).abs()).floor().toDouble();
// zeroDY = ((zeroX * k * scale - screenSize.height / 2).abs())
// .floor()
// .toDouble();
// }
// }
setCenter(obj, [k = 1]) {
scale = 1;
if (obj != null) {
zeroDX = (((obj["x"] as num) / k / (scale) - screenSize.width / 2).abs())
.floor()
.toDouble();
zeroDY = (((obj["y"] as num) / k / (scale) - screenSize.height / 2).abs())
.floor()
.toDouble();
zeroX = ((obj["x"])).toDouble();
zeroY = ((obj["y"])).toDouble();
// print("$zeroDX,$zeroDY");
} else {
zeroDX = ((zeroX / k / (scale)- screenSize.width / 2).abs())
.floor()
.toDouble();
zeroDY = ((zeroY / k / (scale) - screenSize.height / 2).abs())
.floor()
.toDouble();
}
}
//
// getGridStepXY() {
// double dx = (zeroX % 100) * 20 / scale;
// double dy = (zeroY % 100) * 20 / scale;
// double step =
// scaleList[scale.toInt() - 1 < 0 ? 0 : scale.toInt() - 1] / scale;
// return GridStepXY(step, dx, dy);
// }
setZeroOffset(Offset pos) {
//
zeroDX -= pos.dx;
zeroDY += pos.dy;
//zeroX和Y,
zeroX -=pos.dx*scale ;
zeroY += pos.dy*scale;
}
//
setCurrentDot(Offset offset) {
currentDot = offset;
}
setDotListIndex(Offset offset) {
dotList[currentDotIndex!] = offset;
}
setDotList(List list) {
dotList = list;
}
/// @param {int} index -
setPolyonList(int index, List lists) {
List arr = [];
// List arr1 = [];
for (int i = 0; i < lists.length; i++) {
Offset list = screen2xy(lists[i]);
arr.add(list);
}
polyonList[index].list = arr;
}
// 线
/// @param {Offset} dot - 3
double dot2Line(Offset dot1, Offset dot2, Offset dot) {
double A = (dot1.dy - dot2.dy) / (dot1.dx - dot2.dx); //1,2线
double B = dot1.dy - A * dot1.dx; //
double distance =
((A * dot.dx + B - dot.dy) / sqrt(A * A + 1)).abs(); //3线1,2
return distance;
}
//
int getGroundScaleIndex(double sacle) {
groundScaleIndex = grounScaleList.lastIndexWhere((el) => el > scale) + 1;
return groundScaleIndex;
}
//
double getGroundScale() {
return grounScaleList[groundScaleIndex - 1];
}
//
pointInfo(Offset point) {
if (pointList != null && pointList!.isNotEmpty) {
for (var el in pointList!) {
double x = ((el['dx'] as double) - point.dx).abs();
double y = ((el['dy'] as double) - point.dy).abs();
if (x <= 15 && y <= 15) {
return el;
}
}
}
}
}
//
class GridStepXY {
double step;
double dx;
double dy;
GridStepXY(this.step, this.dx, this.dy);
}
//
class Polyon {
String label;
String key;
bool expend;
List list;
Polyon(this.key, this.label, this.list, [this.expend = false]);
}

View File

@ -0,0 +1,146 @@
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
class RecieveModel {
// int UTC;
// double LAT;
// double LNG;
// double ASL;
// double speed;
// int status;
// num HDG;
// num TP;
int type;
int TID;
// num count;
// String data;
// num? mile;
// int layer;
// DecodeDataObj? obj;
int x;
int y;
RecieveModel(
{
// required this.ASL, //
// required this.HDG, //
// required this.LAT, //
// required this.LNG, //
required this.TID,
// required this.TP,
// required this.UTC,
// required this.count,
// required this.data,
// required this.layer,
// required this.mile,
// required this.speed,
// required this.status,
required this.type,
required this.x,
required this.y,
// this.obj
});
factory RecieveModel.fromJson(Map<dynamic, dynamic> json) {
return RecieveModel(
// ASL: json['ASL']!.toDouble(),
// UTC: json['UTC'],
type: int.tryParse(json['type'])??1,
// TP: json['TP'],
// count: json['count'],
// data: json['data'],
// HDG: json['HDG'],
// LAT: json['LAT'],
// layer: json['layer'],
// LNG: json['LNG'],
// mile: json['mile'],
// speed: json['speed'],
// status: json['status'],
TID: json['TID'],
// obj: json['obj'],
x: json['x'] ?? 0,
y: json['y'] ?? 0);
}
}
class DecodeDataObj {
int x;
int y;
Uint16List data;
int dx;
int dy;
int w;
int h;
double rad;
DecodeDataObj(
{required this.data,
required this.dx,
required this.dy,
required this.h,
required this.w,
required this.x,
required this.y,
required this.rad});
factory DecodeDataObj.fromBase64(String base64) {
// base64
Uint8List bytes = base64Decode(base64);
ByteData byteData = bytes.buffer.asByteData();
//
int x = byteData.getInt32(0, Endian.little); //readInt32LE(str, 0);
int y = byteData.getInt32(4, Endian.little); //readInt32LE(str, 4);
int v = byteData.getUint16(8, Endian.little); //readUInt16LE(str, 8);
int w = v & 0x3ff;
double rad = (v >>> 10) * 2 * pi / 64;
Uint16List data;
int length = bytes.length;
int h = 0;
h -= 1;
int dx;
int dy;
int i = 0;
if (w < 16) {
h = (length - 10 - 1);
data = Uint16List(h * 2);
for (i = 0; i < h; i++) {
int x = bytes[10 + i] & 0x0f;
int w = bytes[10 + i] >> 4;
data[i * 2] = x;
data[i * 2 + 1] = w;
}
dx = bytes[10 + i] & 0x0f;
dy = bytes[10 + i] >> 4;
} else if (w < 256) {
h = ((length - 10) / 2 - 1).toInt();
data = Uint16List(h * 2);
for (i = 0; i < h; i++) {
int x = bytes[10 + i * 2];
int w = bytes[10 + i * 2 + 1];
data[i * 2] = x;
data[i * 2 + 1] = w;
}
dx = bytes[10 + i * 2];
dy = bytes[10 + i * 2 + 1];
} else {
h = ((length - 10) / 3 - 1).toInt();
data = Uint16List(h * 2);
for (i = 0; i < h; i++) {
if (10 + i * 3 + 3 < h) {
int a = bytes[10 + i * 3];
int b = bytes[10 + i * 3 + 1];
int c = bytes[10 + i * 3 + 2];
int x = a | (b & 0x0f) << 8;
int w = (b & 0xf0) >> 4 | (c & 0x0f) << 4;
data[i * 2] = x;
data[i * 2 + 1] = w;
}
}
int a = bytes[10 + i * 3];
int b = bytes[10 + i * 3 + 1];
int c = bytes[10 + i * 3 + 2];
dx = a | (b & 0x0f) << 8;
dy = (b & 0xf0) >> 4 | (c & 0x0f) << 4;
}
return DecodeDataObj(
x: x, y: y, w: w, h: h, dx: dx, dy: dy, data: data, rad: rad);
}
}

View File

@ -0,0 +1,674 @@
import 'dart:convert';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:pass_track/binding.dart';
import 'package:pass_track/pass_track.dart';
import 'dart:ffi' as ffi;
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';
import '../model/coord_trans.dart';
import '../model/draw_context.dart';
import '../model/recievemodel.dart';
DrawContext drawCtx = DrawContext();
class FileHandle {
int textureId = -1;
int index = 0;
List deviceList = [];
Map deviceData = {};
String type = "cumulate";
List palette = [];
//
List allPointData = [];
//
List pointData = [];
double L0 = 102;
late CoordTrans coordTrans;
/* 这个是配合原版ts更改的addpoint*/
// //
// filterPoint(var point) {
// //nulltrue或者false
// if (point == null) {
// //
// List newpointData = [];
// if (pointData is List) {
// for (var i = 0; i < (pointData as List).length; i++) {
// if (pointData[i]['bits'] != 0) {
// if (pointData[i]['count'] >= 0 && pointData[i]['count'] <= 50) {
// newpointData.add(pointData[i]);
// } else if (pointData[i]['type'] == 0 || pointData[i]['type'] == 2) {
// newpointData.add(pointData[i]);
// }
// }
// }
// } else {
// //websocket时用
// }
// pointData = newpointData;
// return newpointData;
// } else {
// //
// if (point.runtimeType == "undefind" ||
// point.obj.runtimeType == "undefined") {
// return false;
// }
// if (point["bits"] != 0) {
// if (point["count"] >= 0 && point["count"] <= 50) {
// return true;
// } else if (point["type"] == 0 || point["type"] == 2) {
// return true;
// } else {
// return false;
// }
// } else {
// return false;
// }
// }
// }
//null就是全部点endindex
filterPoint(var startIndex, var endIndex) {
List newpointData = [];
if (endIndex == null || startIndex == null) {
if (allPointData is List) {
for (var i = 0; i < (allPointData as List).length; i++) {
if (allPointData[i]['bits'] != 0) {
if (allPointData[i]['count'] >= 0 &&
allPointData[i]['count'] <= 50) {
newpointData.add(allPointData[i]);
} else if (allPointData[i]['type'] == 0 ||
allPointData[i]['type'] == 2) {
newpointData.add(allPointData[i]);
}
}
}
} else {
//websocket时用
}
pointData = newpointData;
return newpointData;
} else {
if (allPointData is List) {
for (var i = startIndex; i < endIndex; i++) {
if (allPointData[i]['bits'] != 0) {
if (allPointData[i]['count'] >= 0 &&
allPointData[i]['count'] <= 50) {
newpointData.add(allPointData[i]);
} else if (allPointData[i]['type'] == 0 ||
allPointData[i]['type'] == 2) {
newpointData.add(allPointData[i]);
}
}
}
} else {
//websocket时用
}
pointData = newpointData;
return newpointData;
}
}
updateObj(pointData) {
final obj = DecodeDataObj.fromBase64(pointData['data']);
pointData['obj'] = obj;
// var check = ffi.sizeOf<Point>() - (512 * 512 - obj.w * obj.h) * 2;
var size_x = ffi.sizeOf<Point>();
// if (check < 0) {
// print('check:$check');
// }
ffi.Pointer<Point> pointer = calloc.allocate<Point>(
ffi.sizeOf<Point>() - (512 * 512 - obj.w * obj.h) * 2 + 1000);
// ffi.Pointer<Point> pointer = calloc
// .allocate<Point>(size_x>>1);
if (pointer == ffi.nullptr) {
return;
}
// pointer.ref.tile.x = obj.x;
// pointer.ref.tile.y = obj.y;
// pointer.ref.tile.w = obj.w;
// pointer.ref.tile.h = obj.h;
// pointer.ref.tile.dx = obj.dx;
// pointer.ref.tile.dy = obj.dy;
// pointer.ref.tile.rad = obj.rad;
pointer.ref.TID = pointData["TID"] as int;
pointer.ref.type = pointData["type"] as int;
pointer.ref.bits = pointData['bits'] == null ? 0 : pointData['bits'] as int;
pointer.ref.typeBits =
pointData['typeBits'] == null ? 0 : pointData['typeBits'] as int;
pointer.ref.TP = (pointData["TP"]) * 1.0;
pointer.ref.speed = pointData["speed"].toDouble();
pointer.ref.count = pointData["count"] as int;
pointer.ref.LAT = pointData["LAT"].toDouble();
pointer.ref.LNG = pointData["LNG"].toDouble();
pointer.ref.ASL = pointData["ASL"].toDouble();
var xyh = coordTrans.d2p(CoordBLH(
B: pointData["LAT"].toDouble(),
L: pointData["LNG"].toDouble(),
H: pointData["ASL"].toDouble()));
pointer.ref.X = xyh.X * 20;
pointer.ref.Y = xyh.Y * 20;
pointer.ref.H = xyh.H;
// print(pointer.ref.X);
// print(pointer.ref.Y);
// print(pointer.ref.H);
pointer.ref.HDG = pointData["HDG"].toDouble();
pointer.ref.UTC = pointData["UTC"] as int;
pointer.ref.layer = pointData["layer"] as int;
// pointer.ref.mile = pointData["mile"] as int;
pointer.ref.status = pointData["status"] as int;
// for (int i = 0; i < obj.w; i++) {
// //tile处理
// for (int j = 0; j < obj.h; j++) {
// if (i * obj.h + j < obj.data.length) {
// pointer.ref.tile.data[i * obj.h + j] = obj.data[i * obj.h + j];
// }
// }
// }
// passTrackPlugin.passTrack_fullMap_addPoint(pointer);
//calloc.free(pointer);
}
Future<bool> init() async {
return false;
// await initDevice();
// await initPalette();
// coordTrans = CoordTrans(TransOptions(L0: L0));
// List allPointData = filterPoint(null, null);
// var count = 0;
// if (allPointData is List) {
// for (var e in allPointData) {
// count++;
// updateObj(e);
// // if (count > 100000) {
// // break;
// // // ++count
// // }
// }
// } else {
// count++;
// updateObj(allPointData);
// // if (count > 100000) {
// // return true;
// // }
// }
// // passTrackPlugin.passTrack_drawFullScreen(true);
// ffi.Pointer<Binding.Point> pointerNull =
// calloc.allocate<Binding.Point>(ffi.sizeOf<Binding.Point>());
// // passTrackPlugin.playTrack(true, true, false, 0, 115000, ffi.nullptr);
// calloc.free(pointerNull);
// return true;
}
//point的bits值
// initDevice() async {
// //
// List temp = await GetServices().getDeviceBind();
// //roller和paver
// temp.forEach((element) {
// if (element["type"] == "roller" || element["type"] == "paver") {
// deviceList.add(element);
// }
// });
// for (var i = 0; i < deviceList.length; i++) {
// //bits进行处理
// deviceList[i]["bits"] = 1 << i;
// //TID作为键deviceData
// deviceData[deviceList[i]["tid"]] = deviceList[i];
// }
// await getFile();
// }
//txt文件内容
// getFile() async {
// var fileList = await GetServices().getHisFileList();
// for (var i = 0; i < fileList["list"].length; i++) {
// // print(fileList[i]);
// dynamic data = await GetServices().getHisFile(fileList["list"][i]);
// allPointData.addAll(resolveJson(data, passTrackPlugin));
// }
// allPointData.forEach((ele) {
// updateDevices(ele);
// });
// // print(pointData);
// }
//
resolveJson(var res, PassTrack passTrackPlugin) {
if (res is String) {
List<RecieveModel> allPointData = [];
int start = 0;
var allPointLen = 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
updateDevices(var point) {
var TID = point["TID"];
if (deviceData.containsKey(TID)) {
var device = deviceData[TID];
device["show"] = true;
point["bits"] = device["bits"];
point["typeBits"] = (device["type"] == "paver" ? 2 : 1) < 2
? 1
: device["bits"] | (1 << ((device["type"] == "paver" ? 2 : 1) - 2));
device["point"] = point;
}
//bug
//websocket
// if(isLive ==true&&devicState.timer==null){
// //
// }
}
//
// initPalette() async {
// var data = await GetServices().getLayeConfig();
// for (var i = 0; i < data.length; i++) {
// if (data[i]['name'] == "times_draw") {
// data[i] = filterAndResolveModel(data[i]);
// }
// data[i] = FormatColor(data[i]);
// if (data[i]['type'] == 'layer' && data[i]["standard"] != null) {
// data[i] = BubbleSort(data[i]);
// }
// }
// palette = data[0]["color"];
// //
// for (int i = 0; i < palette.length; i++) {
// passTrackPlugin.setPalette(i, changeARGBInt8toInt32(palette[i]));
// }
// // print(palette);
// // print(palette.length);
// //cumulate类型还要对颜色进行扩充
// }
List liveData = [];
bool isLive = false;
var devicState;
num centerTid = 0;
//
bool end = true;
var sportsData;
num angle = 0;
//
var centerDevice = null;
bool isCenter = false;
//
bool isTranslate = false;
//
bool isView = false;
int? startIndex;
int? endIndex;
//websocket
liveView(bool isLive, String wsHost, String proj_code) {
String token = "";
String ws_url = wsHost + "?token=" + token;
final _channel = IOWebSocketChannel.connect(ws_url);
String? message;
//
_channel.sink.add(jsonEncode(["ProjSubscribe", "cp_road", proj_code]));
_channel.stream.listen((message) {
//
List data = json.decode(message);
if (data[0] == "ProjSubAck") {
//
if (proj_code != data[2]) {
_channel.sink
.add(jsonEncode(["ProjSubscribe", "cp_road", proj_code]));
}
//bug,
//
} else if (data[0] == "cp_roadPublish") {
if (proj_code != data[2]) {}
var row = data[3];
row.obj = DecodeDataObj.fromBase64(row.data);
row.TID = num.parse(row.TID);
liveData.add(row);
recivePoint(row);
updateDevices(row);
//tid
if (centerTid != 0 && row.TID == centerTid) {
//bug
//point传给c++
// passTrackPlugin.passTrack_fullMap_updateCenter(point);
drawCtx.setCenter(row.obj);
}
//return
if (!filterPoint(null, null).isNotEmpty) {
return;
}
if (end && isLive) {
var socketInfo;
sportsData.addAll(liveData);
liveData.clear();
if (angle == 0) {
angle = pi / 2 - row.obj.rad;
socketInfo.rotate = (180 / pi) * angle;
socketInfo.TP = row.TP;
socketInfo.speed = row.speed;
socketInfo.LAT = row.LAT;
socketInfo.LNG = row.LNG;
} else if (row.bits == centerDevice) {
angle = pi / 2 - row.obj.rad;
socketInfo.rotate = (180 / pi) * angle;
socketInfo.TP = row.TP;
socketInfo.speed = row.speed;
socketInfo.LAT = row.LAT;
socketInfo.LNG = row.LNG;
if (isCenter) {
backCenter();
}
}
socketInfo.count = row.count;
// this.eventObject['socketing']?.call(this, socketInfo);
}
if (!this.isTranslate) {
//bug
// this.fillAndDrawImageData(false, row);
if (isView || !centerDevice) {
//bug
// centerDevice=
}
}
}
});
}
recivePoint(var point) {
if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
//dart重置中心
drawCtx.setCenter(point);
//bug
//c++
ffi.Pointer<Binding.Point> pointer =
calloc.allocate<Binding.Point>(ffi.sizeOf<Binding.Point>());
// pointer.ref.x
// passTrackPlugin.playTrack(
// true, false, false, 0, -1, pointer);
calloc.free(pointer);
}
//bug
//point传给c++
// passTrackPlugin.passTrack_fullMap_addPoint(point);
// passTrackPlugin.passTrack_drawFullScreen(true);
//c++addpoint后的返回值
bool isSucceed = true;
if (isSucceed) {
isCenter = true;
} else {
isCenter = false;
}
}
//
backCenter() {
//bug
//
}
drawSection(int startIndex, int endIndex, bool isCenter) {
if (endIndex > allPointData.length) {
return;
}
if (isCenter) {
filterPoint(startIndex, endIndex);
} else {}
}
// drawSection(int startIndex, int endIndex, bool isCenter) {
// if (startIndex < 0 && endIndex < 0) {
// return;
// }
// //
// //bug
// // this.ctx.clearRect(0, 0, this.width, this.height);
// // this.global.data.fill(0);
// updateDeviceVisible();
// if (isCenter || drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
// if (sportsData[endIndex]["obj"] != null) {
// double ox = sportsData[endIndex]["obj"]["x"];
// double oy = sportsData[endIndex]["obj"]["y"];
// num x = ((ox / drawCtx.scale - drawCtx.screenSize.width / 2) -
// drawCtx.zeroDX)
// .floor()
// .abs();
// num y = ((oy / drawCtx.scale - drawCtx.screenSize.height / 2) -
// drawCtx.zeroDY)
// .floor()
// .abs();
// if (x >= drawCtx.screenSize.width / 2 ||
// y >= drawCtx.screenSize.height / 2) {
// drawCtx.zeroX = ox;
// drawCtx.zeroY = oy;
// drawCtx.setCenter(null);
// }
// }
// }
// reciveAndFilterPoint(startIndex, endIndex);
// //
// // this.fillAndDrawImageData(true);
// //
// // this.drawGrid();
// //线
// // this.drawSideLine(this.roadData);
// //
// // let arr = this.getDeviceData();
// //
// // this.drawDevice(arr);
// endIndex = endIndex;
// startIndex = startIndex;
// //
// // this.viewStatus(false);
// // this.isPlay = false;
// }
// //
// updateDeviceVisible() {
// for (int i = 0; i < deviceList.length; i++) {
// if (deviceList[i] != null) {
// deviceList[i]["show"] = true;
// } else {
// deviceList[i]["show"] = false;
// }
// }
// }
// reciveAndFilterPoint(int startIndex, int endIndex) {
// if (endIndex == -1) {
// endIndex = sportsData.length - 1;
// }
// for (int i = startIndex; i <= endIndex; i++) {
// var isDraw = filterPoint(sportsData[i]);
// if (isDraw) {
// recivePoint(sportsData[i]);
// updateDevices(sportsData[i]);
// // this.allowDLPI = index;
// }
// }
// }
}
//rgba转换成abgrc++abgr
int changeARGBInt8toInt32(List row) {
int result;
result = (row[3] << 24) | (row[2] << 16) | (row[1] << 8) | row[0];
return result;
}
//standard处理color的值
Map filterAndResolveModel(Map item) {
item["standard"] = tranToArray(item["standard"]);
item["color"] = tranToArray(item["color"]);
var standard = item["standard"];
var color = item["color"];
for (var i = 0; i < standard.length; i++) {
var inter = standard[i];
var actColor = color[i];
var interDiff = inter[1] - inter[0];
var colorDiff1 =
((actColor[0][0] - actColor[1][0]) / interDiff).round().abs();
var colorDiff2 =
((actColor[0][1] - actColor[1][1]) / interDiff).round().abs();
var colorDiff3 =
((actColor[0][2] - actColor[1][2]) / interDiff).round().abs();
var arr = [];
for (var j = 1; j < interDiff; j++) {
arr.add([
actColor[0][0] - colorDiff1 * j,
actColor[0][1] - colorDiff2 * j,
actColor[0][2] - colorDiff3 * j,
255
]);
}
actColor.insert(1, arr);
}
var newStandard = [];
for (var i = 0; i < standard.length; i++) {
for (var j = 0; j < standard[i].length; j++) {
newStandard.add(standard[i][j]);
}
}
item["standard"] = newStandard;
var newColor = [];
for (var i = 0; i < color.length; i++) {
for (var j = 0; j < color[i].length; j++) {
for (var k = 0; k < color[i][j].length; k++) {
if (color[i][j][k] is int) {
newColor.add(color[i][j]);
break;
} else {
newColor.add(color[i][j][k]);
}
}
}
}
item["color"] = newColor;
return item;
}
List tranToArray(List arr) {
var newArr = [];
for (var i = 0; i < arr.length; i += 2) {
newArr.add([arr[i], arr[i + 1]]);
}
return newArr;
}
//cumulate的颜色扩充到256cumulate的颜色添加一个白色的初始色
Map FormatColor(Map item) {
if (item["type"] == "cumulate") {
List newColor = [];
for (int i = 1; i < item["color"].length; i++) {
newColor.addAll([
item["color"][i],
item["color"][i],
item["color"][i],
item["color"][i]
]);
}
item["color"] = newColor;
var maxColor = item["color"][item["color"].length - 1];
for (var i = item["color"].length; i < 254; i++) {
item["color"].add(maxColor);
}
item["color"].insert(0, [0, 0, 0, 0]);
item["color"].insert(0, [0, 0, 0, 0]);
} else {
item["color"].insert(0, [0, 0, 0, 0]);
}
if (item["sideColor"] != null && item["sideColor"] != 0) {
item["color"][1] = item["sideColor"];
}
return item;
}
//layerstandard和color排序
Map BubbleSort(Map item) {
for (var i = 0; i < item["standard"].length; i++) {
for (var j = 1; j < item["standard"].length; j++) {
if (item["standard"][i] > item["standard"][j]) {
var num = item["standard"][i];
item["standard"][i] = item["standard"][j];
item["standard"][j] = num;
var color = item["color"][i];
item["color"][i] = item["color"][j];
item["color"][j] = color;
}
}
}
return item;
}

View File

@ -11,6 +11,10 @@ import 'package:scence_map/scence_map.dart';
import 'package:syncfusion_flutter_sliders/sliders.dart'; import 'package:syncfusion_flutter_sliders/sliders.dart';
import 'iconContainer.dart'; import 'iconContainer.dart';
import "controller.dart"; import "controller.dart";
import "package:pass_track/pass_track.dart";
import "package:pass_track/pass_track_platform_interface.dart";
import "controller.dart";
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';
@ -22,28 +26,28 @@ import "controller.dart";
ScenceMapController mapcontroller = Get.put(ScenceMapController()); ScenceMapController mapcontroller = Get.put(ScenceMapController());
class PassTrack extends StatefulWidget { class PassTrackWidget extends StatefulWidget {
final String date; final String date;
final controller; final controller;
const PassTrack({super.key, required this.date, this.controller}); const PassTrackWidget({super.key, required this.date, this.controller});
@override @override
State<PassTrack> createState() => _PasstrackState(); State<PassTrackWidget> createState() => _PasstrackState();
} }
class _PasstrackState extends State<PassTrack> { 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"));
String str = "播放"; String str = "播放";
int sWidth = 0; int sWidth = 0;
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;
SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0); SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0);
final _passTrackPlugin = PassTrack();
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
@override @override
initState() { initState() {
super.initState(); super.initState();
@ -76,25 +80,30 @@ class _PasstrackState extends State<PassTrack> {
// } // }
// }); // });
}); });
initPlatformState();
controller.getHisFileList(_passTrackPlugin);
_passTrackPlugin.generateTile(0, controller.allLen);
_passTrackPlugin.waitForTile();
_passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr);
} }
Future<void> initPlatformState() async { Future<void> initPlatformState() async {
// String platformVersion; String platformVersion;
// try { try {
// platformVersion = await passTrackPlugin.getPlatformVersion() ?? platformVersion = await _passTrackPlugin.getPlatformVersion() ??
// 'Unknown platform version'; 'Unknown platform version';
// } on PlatformException { } on Exception {
// platformVersion = 'Failed to get platform version.'; platformVersion = 'Failed to get platform version.';
// } }
// await passTrackPlugin.create(sWidth, sWidth); await _passTrackPlugin.create(sWidth, sWidth);
// 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) return;
// setState(() { setState(() {
// platformVersion = platformVersion; platformVersion = platformVersion;
// }); });
} }
@override @override
@ -118,7 +127,8 @@ class _PasstrackState extends State<PassTrack> {
padding: const EdgeInsets.only(bottom: 5), padding: const EdgeInsets.only(bottom: 5),
child: SfRangeSlider( child: SfRangeSlider(
min: 0.0, min: 0.0,
max: maxLength, // max: maxLength,
max: controller.allLen,
values: _rangevalues, values: _rangevalues,
showTicks: false, showTicks: false,
showLabels: false, showLabels: false,

View File

@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:http/http.dart';
import 'loginprefs.dart'; import 'loginprefs.dart';
LoginPrefs loginPrefs = LoginPrefs(); LoginPrefs loginPrefs = LoginPrefs();
@ -34,6 +35,16 @@ class BaseService {
} }
} }
getHisFileClient(String url) async {
String fullUrl = "$baseUrl$url";
Map<String, String> headers = {
HttpHeaders.contentTypeHeader: "text/plain",
HttpHeaders.authorizationHeader: token,
};
Response response = await _client.get(Uri.parse(fullUrl), headers: headers);
return response.body;
}
//POST请求 //POST请求
postClient(String url, body) async { postClient(String url, body) async {
try { try {
@ -88,6 +99,21 @@ class GetServices {
} }
} }
getHisFileList() async {
Map res = await service.getClient(
'/api/cp_road/record/data_list?proj_code=$projCode&date=2023-10-26');
return res['data'];
}
//
getHisFile(String file) async {
// String file = '12209/26/L0122.txt';
file = file.substring(file.length - 18, file.length);
var res = await service
.getHisFileClient("/app/cp_road/record/data/$projCode/$file");
return res;
}
// //
getproject() async { getproject() async {
Map res = await service Map res = await service

View File

@ -1,155 +1,80 @@
import 'package:get/get.dart'; // import 'package:get/get.dart';
import 'base.dart'; // import 'base.dart';
// String projCode = 'CJGKJEBYYB'; // // String projCode = 'CJGKJEBYYB';
// String tid = "109"; // // String tid = "109";
// String projType = "hydraulic_tamping"; // // String projType = "hydraulic_tamping";
String projCode = 'TEST'; // String projCode = 'TEST';
String tid = "1000"; // String tid = "1000";
String projType = "pile_cm"; // String projType = "pile_cm";
BaseService service = BaseService(); // BaseService service = BaseService();
class ProjController extends GetxController { // class ProjController extends GetxController {
ProjController(); // ProjController();
// 线 // // 线
Future getSideLine() async { // Future getSideLine() async {
Map res = await service.getClient( // Map res = await service.getClient(
'/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType'); // '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType');
return res['data']; // return res['data'];
} // }
// --- // // ---
Future getDeviceBind() async { // Future getDeviceBind() async {
Map res = await service.getClient( // Map res = await service.getClient(
'/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode'); // '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode');
return res['data']; // return res['data'];
} // }
// // //
getproject() async { // getproject() async {
Map res = await service.getClient( // Map res = await service.getClient(
'/api/sys/project/list?org_code=a&proj_type=$projType&proj_code=$projCode'); // '/api/sys/project/list?org_code=a&proj_type=$projType&proj_code=$projCode');
return res['data']; // return res['data'];
} // }
} // }
class LoginController { // class LoginController {
// // //
getsmsCode(String phone) async { // getsmsCode(String phone) async {
Map res = // Map res =
await service.postClient("/admin/base/open/smsCode", {"phone": phone}); // await service.postClient("/admin/base/open/smsCode", {"phone": phone});
return res; // return res;
} // }
// // //
phoneLogin(String phone, String smsCode) async { // phoneLogin(String phone, String smsCode) async {
Map res = await service.postClient( // Map res = await service.postClient(
"/admin/base/open/phone", {"phone": phone, "smsCode": smsCode}); // "/admin/base/open/phone", {"phone": phone, "smsCode": smsCode});
return res; // return res;
} // }
// // //
getPerson() async { // getPerson() async {
Map res = await service.getClient("/admin/base/comm/person"); // Map res = await service.getClient("/admin/base/comm/person");
return res['data']; // return res['data'];
} // }
// // //
getCaptcha() async { // getCaptcha() async {
Map res = // Map res =
await service.getClient("/admin/base/open/captcha?height=40&width=150"); // await service.getClient("/admin/base/open/captcha?height=40&width=150");
return res['data']; // return res['data'];
} // }
getAccountLogin(String captchaId, String password, String username, // getAccountLogin(String captchaId, String password, String username,
String verifyCode) async { // String verifyCode) async {
Map res = await service.postClient("/admin/base/open/login", { // Map res = await service.postClient("/admin/base/open/login", {
"captchaId": captchaId, // "captchaId": captchaId,
"password": password, // "password": password,
"username": username, // "username": username,
"verifyCode": verifyCode // "verifyCode": verifyCode
}); // });
return res; // return res;
} // }
} // }
class PileCmController { // class PileCmController {
// // //
getRcordData(int page, int size, String date,
[String sort = "desc", String order = "pile_id"]) 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) async {
dateEnd ??= date;
Map res = await service.getClient(
"/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
return res['data'];
}
//
getworkDateData() async {
Map res = await service.getClient(
"/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid");
if (res['code'] == 1000) {
return res['data'] ?? [];
} else {
return [];
}
}
//
getProcessData(int pileId) async {
Map res = await service.getClient(
"/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid");
return res['data'];
}
}
class GetServices {
BaseService service = BaseService();
// String projCode = 'CJGKJEBYYB';
// int tid = 109;
// String projType = "hydraulic_tamping";
String projCode = 'TEST';
int tid = 1000;
String projType = "pile_cm";
// 线
Future getSideLine() async {
try {
Map res = await service.getClient(
'/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType');
return res['data'];
} catch (e) {
return {};
}
}
// ---
Future getDeviceBind() async {
Map res = await service.getClient(
'/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode');
return res['data'];
}
//
getproject() async {
Map res = await service
.getClient('/api/sys/project/list?org_code=a&proj_type=$projType');
return res['data'];
}
//
getRcordData(int page, int size, String date,
[String sort = "desc", String order = "tp_id"]) 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'];
}
//
// getRcordData(int page, int size, String date, // getRcordData(int page, int size, String date,
// [String sort = "desc", String order = "pile_id"]) async { // [String sort = "desc", String order = "pile_id"]) async {
// Map res = await service.getClient( // Map res = await service.getClient(
@ -163,82 +88,157 @@ 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 {
dateEnd ??= date;
Map res = await service.getClient(
"/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
if (res['code'] == 1000) {
return res['data'];
} else {
return [];
}
}
// // //
getworkDateData() async { // getworkDateData() async {
Map res = await service.getClient( // Map res = await service.getClient(
"/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid"); // "/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid");
if (res['code'] == 1000) { // if (res['code'] == 1000) {
return res['data'] ?? []; // return res['data'] ?? [];
} else { // } else {
return []; // return [];
} // }
} // }
// // //
getProcessData(int pileId) async { // getProcessData(int pileId) async {
Map res = await service.getClient( // Map res = await service.getClient(
"/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid"); // "/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid");
return res['data']; // return res['data'];
} // }
// }
// // class GetServices {
getsmsCode(String phone) async { // BaseService service = BaseService();
Map res = // // String projCode = 'CJGKJEBYYB';
await service.postClient("/admin/base/open/smsCode", {"phone": phone}); // // int tid = 109;
return res; // // String projType = "hydraulic_tamping";
} // String projCode = 'TEST';
// int tid = 1000;
// String projType = "pile_cm";
// // 线
// Future getSideLine() async {
// try {
// Map res = await service.getClient(
// '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType');
// return res['data'];
// } catch (e) {
// return {};
// }
// }
// // // ---
phoneLogin(String phone, String smsCode) async { // Future getDeviceBind() async {
Map res = await service.postClient( // Map res = await service.getClient(
"/admin/base/open/phone", {"phone": phone, "smsCode": smsCode}); // '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode');
return res; // return res['data'];
} // }
// // //
getPerson() async { // getproject() async {
Map res = await service.getClient("/admin/base/comm/person"); // Map res = await service
return res['data']; // .getClient('/api/sys/project/list?org_code=a&proj_type=$projType');
} // return res['data'];
// }
// // //
getCaptcha() async { // getRcordData(int page, int size, String date,
Map res = // [String sort = "desc", String order = "tp_id"]) async {
await service.getClient("/admin/base/open/captcha?height=40&width=150"); // Map res = await service.getClient(
return res['data']; // "/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'];
// }
getAccountLogin(String captchaId, String password, String username, // //
String verifyCode) async { // // getRcordData(int page, int size, String date,
Map res = await service.postClient("/admin/base/open/login", { // // [String sort = "desc", String order = "pile_id"]) async {
"captchaId": captchaId, // // Map res = await service.getClient(
"password": password, // // "/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order");
"username": username, // // return res['data'];
"verifyCode": verifyCode // // }
});
return res;
}
getRtuLast() async { // // getRcordList(String date, String? dateEnd) async {
Map res = await service.getClient( // // dateEnd ??= date;
"/api/t2n/rtu/rtu_last?proj_type=$projType&proj_code=$projCode"); // // Map res = await service.getClient(
return res['data']; // // "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
} // // return res['data'];
// // }
// getRcordList(String date, [String? dateEnd]) async {
// dateEnd ??= date;
// Map res = await service.getClient(
// "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
// if (res['code'] == 1000) {
// return res['data'];
// } else {
// return [];
// }
// }
getCoordTrans() async { // //
Map res = await service.getClient( // getworkDateData() async {
"/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode"); // Map res = await service.getClient(
return res['data']; // "/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid");
} // if (res['code'] == 1000) {
} // return res['data'] ?? [];
// } else {
// return [];
// }
// }
// //
// getProcessData(int pileId) async {
// Map res = await service.getClient(
// "/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid");
// return res['data'];
// }
// //
// getsmsCode(String phone) async {
// Map res =
// await service.postClient("/admin/base/open/smsCode", {"phone": phone});
// return res;
// }
// //
// phoneLogin(String phone, String smsCode) async {
// Map res = await service.postClient(
// "/admin/base/open/phone", {"phone": phone, "smsCode": smsCode});
// return res;
// }
// //
// getPerson() async {
// Map res = await service.getClient("/admin/base/comm/person");
// return res['data'];
// }
// //
// getCaptcha() async {
// Map res =
// await service.getClient("/admin/base/open/captcha?height=40&width=150");
// return res['data'];
// }
// getAccountLogin(String captchaId, String password, String username,
// String verifyCode) async {
// Map res = await service.postClient("/admin/base/open/login", {
// "captchaId": captchaId,
// "password": password,
// "username": username,
// "verifyCode": verifyCode
// });
// return res;
// }
// getRtuLast() async {
// Map res = await service.getClient(
// "/api/t2n/rtu/rtu_last?proj_type=$projType&proj_code=$projCode");
// return res['data'];
// }
// getCoordTrans() async {
// Map res = await service.getClient(
// "/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode");
// return res['data'];
// }
// }

View File

@ -355,18 +355,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: syncfusion_flutter_core name: syncfusion_flutter_core
sha256: "038390d6f633368dc306c250877f93d2e3932de58a781945a3b7ed10c4df5171" sha256: "877411504a07c874970c361762c447081e6e13219a6bea6fc88fbb31c2aff4a4"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "26.2.12" version: "26.2.13"
syncfusion_flutter_sliders: syncfusion_flutter_sliders:
dependency: "direct main" dependency: "direct main"
description: description:
name: syncfusion_flutter_sliders name: syncfusion_flutter_sliders
sha256: "0392849fef2990eb3b61197499f16265ae85202698d3868f740626bbda57162f" sha256: "5811b5c6a03f4f23928ce970cb537e5c6bcded5145715a5394ba1b21e805c207"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "26.2.12" version: "26.2.13"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -439,6 +439,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
web_socket:
dependency: transitive
description:
name: web_socket
sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.6"
web_socket_channel:
dependency: "direct main"
description:
name: web_socket_channel
sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

View File

@ -46,6 +46,7 @@ dependencies:
google_fonts: ^6.2.1 google_fonts: ^6.2.1
syncfusion_flutter_sliders: ^26.2.9 syncfusion_flutter_sliders: ^26.2.9
bottom_picker: ^2.8.0 bottom_picker: ^2.8.0
web_socket_channel: ^3.0.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: