From 2bd17c166bce0dafed29d2cad85b203e585c43cb Mon Sep 17 00:00:00 2001 From: tanlinxing Date: Fri, 6 Sep 2024 09:11:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flutter-plugins | 12 +- .flutter-plugins-dependencies | 2 +- lib/models/coord_trans.dart | 63 -- lib/pages/pass_track/controller.dart | 20 + lib/pages/pass_track/model/coord_trans.dart | 682 +++++++++++++++++++ lib/pages/pass_track/model/draw_context.dart | 261 +++++++ lib/pages/pass_track/model/recievemodel.dart | 146 ++++ lib/pages/pass_track/sevice/file_handle.dart | 674 ++++++++++++++++++ lib/pages/pass_track/view.dart | 5 +- lib/service/base.dart | 26 + lib/service/cp_road.dart | 432 ++++++------ pubspec.lock | 128 ++-- pubspec.yaml | 1 + windows/CMakeLists.txt | 2 +- 14 files changed, 2109 insertions(+), 345 deletions(-) delete mode 100644 lib/models/coord_trans.dart create mode 100644 lib/pages/pass_track/model/coord_trans.dart create mode 100644 lib/pages/pass_track/model/draw_context.dart create mode 100644 lib/pages/pass_track/model/recievemodel.dart create mode 100644 lib/pages/pass_track/sevice/file_handle.dart diff --git a/.flutter-plugins b/.flutter-plugins index e14a1e0..f2fb963 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,7 +1,7 @@ # This is a generated file; do not edit or check into version control. -pass_track=G:\\workplace\\cpnav\\plugins\\pass_track\\ -path_provider=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.1.4\\ -path_provider_android=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.2.10\\ -path_provider_foundation=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.4.0\\ -path_provider_linux=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_linux-2.2.1\\ -path_provider_windows=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_windows-2.3.0\\ +pass_track=D:\\workspace\\cpnav_new\\cpnav\\plugins\\pass_track\\ +path_provider=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider-2.1.4\\ +path_provider_android=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_android-2.2.10\\ +path_provider_foundation=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_foundation-2.4.0\\ +path_provider_linux=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_linux-2.2.1\\ +path_provider_windows=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_windows-2.3.0\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 921fce5..dfd22a6 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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":"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-05 16:17:49.022296","version":"3.24.2","swift_package_manager_enabled":false} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"pass_track","path":"D:\\\\workspace\\\\cpnav_new\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"pass_track","path":"D:\\\\workspace\\\\cpnav_new\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\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 08:42:07.937977","version":"3.24.0","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/lib/models/coord_trans.dart b/lib/models/coord_trans.dart deleted file mode 100644 index 8921f90..0000000 --- a/lib/models/coord_trans.dart +++ /dev/null @@ -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 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) {} -} diff --git a/lib/pages/pass_track/controller.dart b/lib/pages/pass_track/controller.dart index 63081f6..0d6d56d 100644 --- a/lib/pages/pass_track/controller.dart +++ b/lib/pages/pass_track/controller.dart @@ -4,7 +4,12 @@ import 'package:get/get.dart'; import 'package:scence_map/controller.dart'; import 'package:cpnav/service/base.dart'; +import 'sevice/file_handle.dart'; + +FileHandle fileHandle = FileHandle(); + class PassTrackController extends GetxController { + var allLen = 0.0; final mapController = Get.put(ScenceMapController()); String projCode; @@ -20,6 +25,7 @@ class PassTrackController extends GetxController { loadProject(); loadSideLine(); loadBindDevice(); + getHisFileList(); } loadBindDevice() async { @@ -71,4 +77,18 @@ class PassTrackController extends GetxController { mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2); } } + + getHisFileList() 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"); + } } diff --git a/lib/pages/pass_track/model/coord_trans.dart b/lib/pages/pass_track/model/coord_trans.dart new file mode 100644 index 0000000..cd01421 --- /dev/null +++ b/lib/pages/pass_track/model/coord_trans.dart @@ -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> 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; + } + } +} diff --git a/lib/pages/pass_track/model/draw_context.dart b/lib/pages/pass_track/model/draw_context.dart new file mode 100644 index 0000000..0ffb6a5 --- /dev/null +++ b/lib/pages/pass_track/model/draw_context.dart @@ -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 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];四种,默认倍数是100,那么mark默认1000 + double space = 1; + List? pointList; + List> gengerateList = []; + List 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]); +} diff --git a/lib/pages/pass_track/model/recievemodel.dart b/lib/pages/pass_track/model/recievemodel.dart new file mode 100644 index 0000000..dd8161e --- /dev/null +++ b/lib/pages/pass_track/model/recievemodel.dart @@ -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 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); + } +} \ No newline at end of file diff --git a/lib/pages/pass_track/sevice/file_handle.dart b/lib/pages/pass_track/sevice/file_handle.dart new file mode 100644 index 0000000..94e51d1 --- /dev/null +++ b/lib/pages/pass_track/sevice/file_handle.dart @@ -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'; + +final passTrackPlugin = PassTrack(); +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) { + // //传null,筛选所有点,并把筛选完的点全部返回,如果传入一个点,返回true或者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() - (512 * 512 - obj.w * obj.h) * 2; + + var size_x = ffi.sizeOf(); + // if (check < 0) { + // print('check:$check'); + // } + ffi.Pointer pointer = calloc.allocate( + ffi.sizeOf() - (512 * 512 - obj.w * obj.h) * 2 + 1000); + // ffi.Pointer pointer = calloc + // .allocate(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 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 pointerNull = + // calloc.allocate(ffi.sizeOf()); + // // 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 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 pointer = + calloc.allocate(ffi.sizeOf()); + // 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转换成abgr,因为c++那边渲染需要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的颜色扩充到256,对于非cumulate的颜色添加一个白色的初始色 +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; +} + +//如果类型是layer,重新对standard和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; +} diff --git a/lib/pages/pass_track/view.dart b/lib/pages/pass_track/view.dart index 26477a7..ff453c1 100644 --- a/lib/pages/pass_track/view.dart +++ b/lib/pages/pass_track/view.dart @@ -41,7 +41,7 @@ class _PasstrackState extends State { int bits = -1; int speed = 50; List speedList = [1, 2, 10, 20, 50, 100, 200, 500]; - int maxLength = 200; + // int maxLength = 200; SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0); @override @@ -118,7 +118,8 @@ class _PasstrackState extends State { padding: const EdgeInsets.only(bottom: 5), child: SfRangeSlider( min: 0.0, - max: maxLength, + // max: maxLength, + max: controller.allLen, values: _rangevalues, showTicks: false, showLabels: false, diff --git a/lib/service/base.dart b/lib/service/base.dart index 5e16114..d0b5282 100644 --- a/lib/service/base.dart +++ b/lib/service/base.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:http/http.dart' as http; +import 'package:http/http.dart'; import 'loginprefs.dart'; LoginPrefs loginPrefs = LoginPrefs(); @@ -34,6 +35,16 @@ class BaseService { } } + getHisFileClient(String url) async { + String fullUrl = "$baseUrl$url"; + Map headers = { + HttpHeaders.contentTypeHeader: "text/plain", + HttpHeaders.authorizationHeader: token, + }; + Response response = await _client.get(Uri.parse(fullUrl), headers: headers); + return response.body; + } + //发送POST请求 postClient(String url, body) async { 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 { Map res = await service diff --git a/lib/service/cp_road.dart b/lib/service/cp_road.dart index 33ee69b..18c1a0b 100644 --- a/lib/service/cp_road.dart +++ b/lib/service/cp_road.dart @@ -1,244 +1,244 @@ -import 'package:get/get.dart'; -import 'base.dart'; +// import 'package:get/get.dart'; +// import 'base.dart'; -// String projCode = 'CJGKJEBYYB'; -// String tid = "109"; -// String projType = "hydraulic_tamping"; -String projCode = 'TEST'; -String tid = "1000"; -String projType = "pile_cm"; -BaseService service = BaseService(); +// // String projCode = 'CJGKJEBYYB'; +// // String tid = "109"; +// // String projType = "hydraulic_tamping"; +// String projCode = 'TEST'; +// String tid = "1000"; +// String projType = "pile_cm"; +// BaseService service = BaseService(); -class ProjController extends GetxController { - ProjController(); -// 道路边线 - Future getSideLine() async { - Map res = await service.getClient( - '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType'); - return res['data']; - } +// class ProjController extends GetxController { +// ProjController(); +// // 道路边线 +// Future getSideLine() async { +// Map res = await service.getClient( +// '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType'); +// return res['data']; +// } -// 设备绑定 --- 获取设备 - Future getDeviceBind() async { - Map res = await service.getClient( - '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode'); - return res['data']; - } +// // 设备绑定 --- 获取设备 +// 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&proj_code=$projCode'); - return res['data']; - } -} +// // 项目列表 +// getproject() async { +// Map res = await service.getClient( +// '/api/sys/project/list?org_code=a&proj_type=$projType&proj_code=$projCode'); +// return res['data']; +// } +// } -class LoginController { - // 验证码 - getsmsCode(String phone) async { - Map res = - await service.postClient("/admin/base/open/smsCode", {"phone": phone}); - return res; - } +// class LoginController { +// // 验证码 +// 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; - } +// // 手机号登录 +// 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']; - } +// // 获取用户信息 +// 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']; - } +// // 验证码 +// 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; - } -} +// 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; +// } +// } -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']; - } +// 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']; - } +// 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 []; - } - } +// //获取施工记录的日期 +// 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']; - } -} +// //施工详细记录 +// 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 {}; - } - } +// 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']; - } +// // 设备绑定 --- 获取设备 +// 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']; - } +// // 项目列表 +// 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, +// [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, - // [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']; - // } +// //获取水泥搅拌桩点数据 +// // 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']; - // } - 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 []; - } - } +// // 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']; +// // } +// 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 { - 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 []; - } - } +// //获取施工记录的日期 +// 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']; - } +// //施工详细记录 +// 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; - } +// // 验证码 +// 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; - } +// // 手机号登录 +// 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']; - } +// // 获取用户信息 +// 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']; - } +// // 验证码 +// 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; - } +// 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']; - } +// 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']; - } -} +// getCoordTrans() async { +// Map res = await service.getClient( +// "/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode"); +// return res['data']; +// } +// } diff --git a/pubspec.lock b/pubspec.lock index 5ddcac1..1e0cd8a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: description: name: args sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.5.0" async: @@ -14,7 +14,7 @@ packages: description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.11.0" boolean_selector: @@ -22,7 +22,7 @@ packages: description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" bottom_picker: @@ -30,7 +30,7 @@ packages: description: name: bottom_picker sha256: "7c690407c6c489bc7c556858c3f1b804aac73c3a128559f328cc829ba12983ad" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.8.0" characters: @@ -38,7 +38,7 @@ packages: description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.0" clock: @@ -46,7 +46,7 @@ packages: description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.1" collection: @@ -54,7 +54,7 @@ packages: description: name: collection sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.18.0" crypto: @@ -62,7 +62,7 @@ packages: description: name: crypto sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.5" cupertino_icons: @@ -70,7 +70,7 @@ packages: description: name: cupertino_icons sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.8" fake_async: @@ -78,7 +78,7 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" ffi: @@ -86,7 +86,7 @@ packages: description: name: ffi sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.3" flutter: @@ -99,7 +99,7 @@ packages: description: name: flutter_lints sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.2" flutter_svg: @@ -107,7 +107,7 @@ packages: description: name: flutter_svg sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.10+1" flutter_test: @@ -120,7 +120,7 @@ packages: description: name: get sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.6.6" get_storage: @@ -128,7 +128,7 @@ packages: description: name: get_storage sha256: "39db1fffe779d0c22b3a744376e86febe4ade43bf65e06eab5af707dc84185a2" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" google_fonts: @@ -136,7 +136,7 @@ packages: description: name: google_fonts sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.2.1" http: @@ -144,7 +144,7 @@ packages: description: name: http sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.2" http_parser: @@ -152,7 +152,7 @@ packages: description: name: http_parser sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "4.0.2" intl: @@ -160,7 +160,7 @@ packages: description: name: intl sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.19.0" leak_tracker: @@ -168,7 +168,7 @@ packages: description: name: leak_tracker sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "10.0.5" leak_tracker_flutter_testing: @@ -176,7 +176,7 @@ packages: description: name: leak_tracker_flutter_testing sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.5" leak_tracker_testing: @@ -184,7 +184,7 @@ packages: description: name: leak_tracker_testing sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.1" lints: @@ -192,7 +192,7 @@ packages: description: name: lints sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.0" matcher: @@ -200,7 +200,7 @@ packages: description: name: matcher sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.12.16+1" material_color_utilities: @@ -208,7 +208,7 @@ packages: description: name: material_color_utilities sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.11.1" meta: @@ -216,7 +216,7 @@ packages: description: name: meta sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.15.0" pass_track: @@ -231,7 +231,7 @@ packages: description: name: path sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.9.0" path_parsing: @@ -239,7 +239,7 @@ packages: description: name: path_parsing sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.1" path_provider: @@ -247,7 +247,7 @@ packages: description: name: path_provider sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" path_provider_android: @@ -255,7 +255,7 @@ packages: description: name: path_provider_android sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.10" path_provider_foundation: @@ -263,7 +263,7 @@ packages: description: name: path_provider_foundation sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.4.0" path_provider_linux: @@ -271,7 +271,7 @@ packages: description: name: path_provider_linux sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.2.1" path_provider_platform_interface: @@ -279,7 +279,7 @@ packages: description: name: path_provider_platform_interface sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" path_provider_windows: @@ -287,7 +287,7 @@ packages: description: name: path_provider_windows sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.3.0" petitparser: @@ -295,7 +295,7 @@ packages: description: name: petitparser sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.0.2" platform: @@ -303,7 +303,7 @@ packages: description: name: platform sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.1.5" plugin_platform_interface: @@ -311,7 +311,7 @@ packages: description: name: plugin_platform_interface sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.8" scence_map: @@ -331,7 +331,7 @@ packages: description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.10.0" stack_trace: @@ -339,7 +339,7 @@ packages: description: name: stack_trace sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.11.1" stream_channel: @@ -347,7 +347,7 @@ packages: description: name: stream_channel sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" string_scanner: @@ -355,7 +355,7 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0" syncfusion_flutter_core: @@ -363,7 +363,7 @@ packages: description: name: syncfusion_flutter_core sha256: "038390d6f633368dc306c250877f93d2e3932de58a781945a3b7ed10c4df5171" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "26.2.12" syncfusion_flutter_sliders: @@ -371,7 +371,7 @@ packages: description: name: syncfusion_flutter_sliders sha256: "0392849fef2990eb3b61197499f16265ae85202698d3868f740626bbda57162f" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "26.2.12" term_glyph: @@ -379,7 +379,7 @@ packages: description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: @@ -387,7 +387,7 @@ packages: description: name: test_api sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.7.2" typed_data: @@ -395,7 +395,7 @@ packages: description: name: typed_data sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.2" vector_graphics: @@ -403,7 +403,7 @@ packages: description: name: vector_graphics sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_graphics_codec: @@ -411,7 +411,7 @@ packages: description: name: vector_graphics_codec sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_graphics_compiler: @@ -419,7 +419,7 @@ packages: description: name: vector_graphics_compiler sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.11+1" vector_math: @@ -427,31 +427,47 @@ packages: description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" - url: "https://pub.flutter-io.cn" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.4" web: dependency: transitive description: name: web sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: "direct main" + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" xdg_directories: dependency: transitive description: name: xdg_directories sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.4" xml: @@ -459,7 +475,7 @@ packages: description: name: xml sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "6.5.0" sdks: diff --git a/pubspec.yaml b/pubspec.yaml index 3a7a21b..bcd72a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: google_fonts: ^6.2.1 syncfusion_flutter_sliders: ^26.2.9 bottom_picker: ^2.8.0 + web_socket_channel: ^3.0.1 dev_dependencies: flutter_test: diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index f0b2a3c..1acea69 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -39,7 +39,7 @@ add_definitions(-DUNICODE -D_UNICODE) # of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + # target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") From 9c2a14f775a75fd3891872b5938db547e64b983e Mon Sep 17 00:00:00 2001 From: LiXiaoqi <2360211477@qq.com> Date: Fri, 6 Sep 2024 09:19:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flutter-plugins | 1 - .flutter-plugins-dependencies | 2 +- pubspec.lock | 7 ------- pubspec.yaml | 4 ++-- windows/CMakeLists.txt | 2 +- windows/flutter/generated_plugin_registrant.cc | 3 --- windows/flutter/generated_plugins.cmake | 1 - 7 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.flutter-plugins b/.flutter-plugins index e14a1e0..5d0bb0f 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,5 +1,4 @@ # This is a generated file; do not edit or check into version control. -pass_track=G:\\workplace\\cpnav\\plugins\\pass_track\\ path_provider=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.1.4\\ path_provider_android=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.2.10\\ path_provider_foundation=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.4.0\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 921fce5..f9bc5a6 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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":"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-05 16:17:49.022296","version":"3.24.2","swift_package_manager_enabled":false} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 5ddcac1..9d72d70 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -219,13 +219,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" - pass_track: - dependency: "direct main" - description: - path: "plugins/pass_track" - relative: true - source: path - version: "0.0.1" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3a7a21b..fe7c99f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,8 +32,8 @@ dependencies: sdk: flutter scence_map: path: plugins/scence_map - pass_track: - path: plugins/pass_track + # pass_track: + # path: plugins/pass_track # git: https://git.mcxa.cn:89/LiXiaoqi/pass_track.git # ref: main # The following adds the Cupertino Icons font to your application. diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index f0b2a3c..1acea69 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -39,7 +39,7 @@ add_definitions(-DUNICODE -D_UNICODE) # of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + # target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 075413e..8b6d468 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,6 @@ #include "generated_plugin_registrant.h" -#include void RegisterPlugins(flutter::PluginRegistry* registry) { - PassTrackPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("PassTrackPluginCApi")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 2e2cdc4..b93c4c3 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - pass_track ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From b803fab5d574de03fa24652c096d98d369126dad Mon Sep 17 00:00:00 2001 From: LiXiaoqi <2360211477@qq.com> Date: Fri, 6 Sep 2024 09:52:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E6=90=AD=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flutter-plugins | 12 +- .flutter-plugins-dependencies | 2 +- lib/main.dart | 4 +- lib/pages/pass_track/controller.dart | 12 +- lib/pages/pass_track/sevice/file_handle.dart | 60 ++++----- lib/pages/pass_track/view.dart | 49 +++++--- pubspec.lock | 124 +++++++++---------- 7 files changed, 137 insertions(+), 126 deletions(-) diff --git a/.flutter-plugins b/.flutter-plugins index f2fb963..e14a1e0 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,7 +1,7 @@ # This is a generated file; do not edit or check into version control. -pass_track=D:\\workspace\\cpnav_new\\cpnav\\plugins\\pass_track\\ -path_provider=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider-2.1.4\\ -path_provider_android=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_android-2.2.10\\ -path_provider_foundation=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_foundation-2.4.0\\ -path_provider_linux=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_linux-2.2.1\\ -path_provider_windows=C:\\Users\\Administrator\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\path_provider_windows-2.3.0\\ +pass_track=G:\\workplace\\cpnav\\plugins\\pass_track\\ +path_provider=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.1.4\\ +path_provider_android=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.2.10\\ +path_provider_foundation=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.4.0\\ +path_provider_linux=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_linux-2.2.1\\ +path_provider_windows=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_windows-2.3.0\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index dfd22a6..a647325 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"pass_track","path":"D:\\\\workspace\\\\cpnav_new\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"pass_track","path":"D:\\\\workspace\\\\cpnav_new\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\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 08:42:07.937977","version":"3.24.0","swift_package_manager_enabled":false} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index f708704..395fb4a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,7 +8,7 @@ import 'pages/pass_track/view.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); //设置全屏 - + runApp(const MyApp()); } @@ -68,7 +68,7 @@ class _MyHomePageState extends State { final _currentIndex = 0.obs; final List _pages = [ - PassTrack( + PassTrackWidget( date: '', ), Container( diff --git a/lib/pages/pass_track/controller.dart b/lib/pages/pass_track/controller.dart index 0d6d56d..4c747eb 100644 --- a/lib/pages/pass_track/controller.dart +++ b/lib/pages/pass_track/controller.dart @@ -1,21 +1,23 @@ import 'dart:ui'; + import 'package:get/get.dart'; import 'package:scence_map/controller.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 { - var allLen = 0.0; + int allLen = 0; final mapController = Get.put(ScenceMapController()); String projCode; String projType; late final GetServices service; - + // final PassTrack _passTrackPlugin; PassTrackController(this.projCode, this.projType); @override @@ -25,7 +27,7 @@ class PassTrackController extends GetxController { loadProject(); loadSideLine(); loadBindDevice(); - getHisFileList(); + // getHisFileList(); } loadBindDevice() async { @@ -78,7 +80,7 @@ class PassTrackController extends GetxController { } } - getHisFileList() async { + getHisFileList(PassTrack passTrackPlugin) async { Map textlist = await GetServices().getHisFileList(); List fileList = textlist['list']; for (var i = 0; i < fileList.length; i++) { diff --git a/lib/pages/pass_track/sevice/file_handle.dart b/lib/pages/pass_track/sevice/file_handle.dart index 94e51d1..8bf1101 100644 --- a/lib/pages/pass_track/sevice/file_handle.dart +++ b/lib/pages/pass_track/sevice/file_handle.dart @@ -17,7 +17,7 @@ import '../model/coord_trans.dart'; import '../model/draw_context.dart'; import '../model/recievemodel.dart'; -final passTrackPlugin = PassTrack(); + DrawContext drawCtx = DrawContext(); class FileHandle { int textureId = -1; @@ -210,39 +210,39 @@ class FileHandle { } //初始化设备,并且根据设备修改point的bits值 - initDevice() async { - //读取设备数据 - List temp = await GetServices().getDeviceBind(); - //筛出其中的roller和paver - temp.forEach((element) { - if (element["type"] == "roller" || element["type"] == "paver") { - deviceList.add(element); - } - }); + // 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]; - } + // for (var i = 0; i < deviceList.length; i++) { + // //对所有设备的bits进行处理 + // deviceList[i]["bits"] = 1 << i; + // //再将TID作为键,赋值给deviceData + // deviceData[deviceList[i]["tid"]] = deviceList[i]; + // } - await getFile(); - } + // 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); - } + // 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) { diff --git a/lib/pages/pass_track/view.dart b/lib/pages/pass_track/view.dart index ff453c1..c712c6a 100644 --- a/lib/pages/pass_track/view.dart +++ b/lib/pages/pass_track/view.dart @@ -11,6 +11,10 @@ import 'package:scence_map/scence_map.dart'; import 'package:syncfusion_flutter_sliders/sliders.dart'; import 'iconContainer.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/config.dart'; // import '../login_in/connect/connect_type.dart'; @@ -22,20 +26,19 @@ import "controller.dart"; ScenceMapController mapcontroller = Get.put(ScenceMapController()); -class PassTrack extends StatefulWidget { +class PassTrackWidget extends StatefulWidget { final String date; final controller; - const PassTrack({super.key, required this.date, this.controller}); + const PassTrackWidget({super.key, required this.date, this.controller}); @override - State createState() => _PasstrackState(); + State createState() => _PasstrackState(); } -class _PasstrackState extends State { +class _PasstrackState extends State { final GlobalKey> _popupMenuKey = GlobalKey>(); - final controller = Get.put(PassTrackController("WXLMB", "cp_orad")); String str = "播放"; int sWidth = 0; int bits = -1; @@ -43,7 +46,8 @@ class _PasstrackState extends State { List speedList = [1, 2, 10, 20, 50, 100, 200, 500]; // int maxLength = 200; SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0); - + final _passTrackPlugin = PassTrack(); + final controller = Get.put(PassTrackController("WXLMB", "cp_orad")); @override initState() { super.initState(); @@ -76,25 +80,30 @@ class _PasstrackState extends State { // } // }); }); + initPlatformState(); + controller.getHisFileList(_passTrackPlugin); + _passTrackPlugin.generateTile(0, controller.allLen); + _passTrackPlugin.waitForTile(); + _passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr); } Future initPlatformState() async { - // String platformVersion; - // try { - // platformVersion = await passTrackPlugin.getPlatformVersion() ?? - // 'Unknown platform version'; - // } on PlatformException { - // platformVersion = 'Failed to get platform version.'; - // } - // await passTrackPlugin.create(sWidth, sWidth); - // fileHandle.textureId = await passTrackPlugin.getTextureId() ?? -1; - // print("textureId: ${fileHandle.textureId}"); + String platformVersion; + try { + platformVersion = await _passTrackPlugin.getPlatformVersion() ?? + 'Unknown platform version'; + } on Exception { + platformVersion = 'Failed to get platform version.'; + } + await _passTrackPlugin.create(sWidth, sWidth); + fileHandle.textureId = await _passTrackPlugin.getTextureId() ?? -1; + print("textureId: ${fileHandle.textureId}"); - // if (!mounted) return; + if (!mounted) return; - // setState(() { - // platformVersion = platformVersion; - // }); + setState(() { + platformVersion = platformVersion; + }); } @override diff --git a/pubspec.lock b/pubspec.lock index 1e0cd8a..5980a74 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: description: name: args sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.5.0" async: @@ -14,7 +14,7 @@ packages: description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.11.0" boolean_selector: @@ -22,7 +22,7 @@ packages: description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" bottom_picker: @@ -30,7 +30,7 @@ packages: description: name: bottom_picker sha256: "7c690407c6c489bc7c556858c3f1b804aac73c3a128559f328cc829ba12983ad" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.0" characters: @@ -38,7 +38,7 @@ packages: description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" clock: @@ -46,7 +46,7 @@ packages: description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.1" collection: @@ -54,7 +54,7 @@ packages: description: name: collection sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.18.0" crypto: @@ -62,7 +62,7 @@ packages: description: name: crypto sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.5" cupertino_icons: @@ -70,7 +70,7 @@ packages: description: name: cupertino_icons sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.8" fake_async: @@ -78,7 +78,7 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" ffi: @@ -86,7 +86,7 @@ packages: description: name: ffi sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" flutter: @@ -99,7 +99,7 @@ packages: description: name: flutter_lints sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" flutter_svg: @@ -107,7 +107,7 @@ packages: description: name: flutter_svg sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.10+1" flutter_test: @@ -120,7 +120,7 @@ packages: description: name: get sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.6.6" get_storage: @@ -128,7 +128,7 @@ packages: description: name: get_storage sha256: "39db1fffe779d0c22b3a744376e86febe4ade43bf65e06eab5af707dc84185a2" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" google_fonts: @@ -136,7 +136,7 @@ packages: description: name: google_fonts sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "6.2.1" http: @@ -144,7 +144,7 @@ packages: description: name: http sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.2" http_parser: @@ -152,7 +152,7 @@ packages: description: name: http_parser sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "4.0.2" intl: @@ -160,7 +160,7 @@ packages: description: name: intl sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.19.0" leak_tracker: @@ -168,7 +168,7 @@ packages: description: name: leak_tracker sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "10.0.5" leak_tracker_flutter_testing: @@ -176,7 +176,7 @@ packages: description: name: leak_tracker_flutter_testing sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.5" leak_tracker_testing: @@ -184,7 +184,7 @@ packages: description: name: leak_tracker_testing sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" lints: @@ -192,7 +192,7 @@ packages: description: name: lints sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" matcher: @@ -200,7 +200,7 @@ packages: description: name: matcher sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.16+1" material_color_utilities: @@ -208,7 +208,7 @@ packages: description: name: material_color_utilities sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.11.1" meta: @@ -216,7 +216,7 @@ packages: description: name: meta sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" pass_track: @@ -231,7 +231,7 @@ packages: description: name: path sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.0" path_parsing: @@ -239,7 +239,7 @@ packages: description: name: path_parsing sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" path_provider: @@ -247,7 +247,7 @@ packages: description: name: path_provider sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" path_provider_android: @@ -255,7 +255,7 @@ packages: description: name: path_provider_android sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.10" path_provider_foundation: @@ -263,7 +263,7 @@ packages: description: name: path_provider_foundation sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.4.0" path_provider_linux: @@ -271,7 +271,7 @@ packages: description: name: path_provider_linux sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.1" path_provider_platform_interface: @@ -279,7 +279,7 @@ packages: description: name: path_provider_platform_interface sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" path_provider_windows: @@ -287,7 +287,7 @@ packages: description: name: path_provider_windows sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.3.0" petitparser: @@ -295,7 +295,7 @@ packages: description: name: petitparser sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.2" platform: @@ -303,7 +303,7 @@ packages: description: name: platform sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.5" plugin_platform_interface: @@ -311,7 +311,7 @@ packages: description: name: plugin_platform_interface sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.8" scence_map: @@ -331,7 +331,7 @@ packages: description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stack_trace: @@ -339,7 +339,7 @@ packages: description: name: stack_trace sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.11.1" stream_channel: @@ -347,7 +347,7 @@ packages: description: name: stream_channel sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" string_scanner: @@ -355,31 +355,31 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" syncfusion_flutter_core: dependency: transitive description: name: syncfusion_flutter_core - sha256: "038390d6f633368dc306c250877f93d2e3932de58a781945a3b7ed10c4df5171" - url: "https://pub.dev" + sha256: "877411504a07c874970c361762c447081e6e13219a6bea6fc88fbb31c2aff4a4" + url: "https://pub.flutter-io.cn" source: hosted - version: "26.2.12" + version: "26.2.13" syncfusion_flutter_sliders: dependency: "direct main" description: name: syncfusion_flutter_sliders - sha256: "0392849fef2990eb3b61197499f16265ae85202698d3868f740626bbda57162f" - url: "https://pub.dev" + sha256: "5811b5c6a03f4f23928ce970cb537e5c6bcded5145715a5394ba1b21e805c207" + url: "https://pub.flutter-io.cn" source: hosted - version: "26.2.12" + version: "26.2.13" term_glyph: dependency: transitive description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.1" test_api: @@ -387,7 +387,7 @@ packages: description: name: test_api sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.7.2" typed_data: @@ -395,7 +395,7 @@ packages: description: name: typed_data sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.2" vector_graphics: @@ -403,7 +403,7 @@ packages: description: name: vector_graphics sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.11+1" vector_graphics_codec: @@ -411,7 +411,7 @@ packages: description: name: vector_graphics_codec sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.11+1" vector_graphics_compiler: @@ -419,7 +419,7 @@ packages: description: name: vector_graphics_compiler sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.11+1" vector_math: @@ -427,23 +427,23 @@ packages: description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc - url: "https://pub.dev" + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.flutter-io.cn" source: hosted - version: "14.2.4" + version: "14.2.5" web: dependency: transitive description: name: web sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" web_socket: @@ -451,7 +451,7 @@ packages: description: name: web_socket sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" web_socket_channel: @@ -459,7 +459,7 @@ packages: description: name: web_socket_channel sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" xdg_directories: @@ -467,7 +467,7 @@ packages: description: name: xdg_directories sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" xml: @@ -475,7 +475,7 @@ packages: description: name: xml sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" + url: "https://pub.flutter-io.cn" source: hosted version: "6.5.0" sdks: From 694b9d198d21f4f4a38a810465f77c2a611113b4 Mon Sep 17 00:00:00 2001 From: LiXiaoqi <2360211477@qq.com> Date: Fri, 6 Sep 2024 10:34:04 +0800 Subject: [PATCH 4/5] slider has bug --- .flutter-plugins | 1 + .flutter-plugins-dependencies | 2 +- lib/pages/pass_track/view.dart | 3 +++ pubspec.lock | 7 +++++++ pubspec.yaml | 4 ++-- windows/flutter/generated_plugin_registrant.cc | 3 +++ windows/flutter/generated_plugins.cmake | 1 + 7 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.flutter-plugins b/.flutter-plugins index 5d0bb0f..e14a1e0 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,4 +1,5 @@ # This is a generated file; do not edit or check into version control. +pass_track=G:\\workplace\\cpnav\\plugins\\pass_track\\ path_provider=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider-2.1.4\\ path_provider_android=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_android-2.2.10\\ path_provider_foundation=C:\\Users\\Adminis\\AppData\\Local\\Pub\\Cache\\hosted\\pub.flutter-io.cn\\path_provider_foundation-2.4.0\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index a647325..d722f01 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -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":"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} \ No newline at end of file +{"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 10:27:39.418202","version":"3.24.2","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/lib/pages/pass_track/view.dart b/lib/pages/pass_track/view.dart index c712c6a..53bfd85 100644 --- a/lib/pages/pass_track/view.dart +++ b/lib/pages/pass_track/view.dart @@ -82,6 +82,9 @@ class _PasstrackState extends State { }); initPlatformState(); controller.getHisFileList(_passTrackPlugin); + if (controller.allLen <= 0) { + return; + } _passTrackPlugin.generateTile(0, controller.allLen); _passTrackPlugin.waitForTile(); _passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr); diff --git a/pubspec.lock b/pubspec.lock index f6aba3d..5980a74 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -219,6 +219,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" + pass_track: + dependency: "direct main" + description: + path: "plugins/pass_track" + relative: true + source: path + version: "0.0.1" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c36d79f..bcd72a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,8 +32,8 @@ dependencies: sdk: flutter scence_map: path: plugins/scence_map - # pass_track: - # path: plugins/pass_track + pass_track: + path: plugins/pass_track # git: https://git.mcxa.cn:89/LiXiaoqi/pass_track.git # ref: main # The following adds the Cupertino Icons font to your application. diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..075413e 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + PassTrackPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PassTrackPluginCApi")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..2e2cdc4 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + pass_track ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From 745e5cac7f1fc36920d1d78affa9295710dbad5a Mon Sep 17 00:00:00 2001 From: LiXiaoqi <2360211477@qq.com> Date: Fri, 6 Sep 2024 10:39:59 +0800 Subject: [PATCH 5/5] 12 --- plugins/pass_track | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pass_track b/plugins/pass_track index ca4a542..0aba221 160000 --- a/plugins/pass_track +++ b/plugins/pass_track @@ -1 +1 @@ -Subproject commit ca4a542c8428ed4c659cbf1273c443a96ce6c56c +Subproject commit 0aba221c479c5962783bfbcbff92b754963c6fb2