merge network
This commit is contained in:
commit
ff9f1f9be2
@ -1 +1 @@
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-09-06 09:18:35.600396","version":"3.24.2","swift_package_manager_enabled":false}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"pass_track","path":"G:\\\\workplace\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"pass_track","path":"G:\\\\workplace\\\\cpnav\\\\plugins\\\\pass_track\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Adminis\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"pass_track","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-09-06 09:19:51.601720","version":"3.24.2","swift_package_manager_enabled":false}
|
@ -68,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
|
||||
final _currentIndex = 0.obs;
|
||||
final List<Widget> _pages = [
|
||||
PassTrack(
|
||||
PassTrackWidget(
|
||||
date: '',
|
||||
),
|
||||
Container(
|
||||
|
@ -1,63 +0,0 @@
|
||||
class CoordTrans {
|
||||
int id;
|
||||
// ignore: non_constant_identifier_names
|
||||
double L0;
|
||||
String belt;
|
||||
String? calibs;
|
||||
String dstEllipsoid;
|
||||
double dx;
|
||||
double dy;
|
||||
double dz;
|
||||
double wx;
|
||||
double wy;
|
||||
double wz;
|
||||
double k;
|
||||
double elevation;
|
||||
int isMain;
|
||||
String name;
|
||||
double rota;
|
||||
String srcEllipsoid;
|
||||
CoordTrans({
|
||||
required this.name,
|
||||
// ignore: non_constant_identifier_names
|
||||
required this.L0,
|
||||
required this.belt,
|
||||
this.calibs,
|
||||
required this.dstEllipsoid,
|
||||
required this.dx,
|
||||
required this.dy,
|
||||
required this.dz,
|
||||
required this.id,
|
||||
required this.wx,
|
||||
required this.wy,
|
||||
required this.wz,
|
||||
required this.k,
|
||||
required this.elevation,
|
||||
required this.isMain,
|
||||
required this.rota,
|
||||
required this.srcEllipsoid,
|
||||
});
|
||||
factory CoordTrans.fromJson(Map<dynamic, dynamic> data) {
|
||||
return CoordTrans(
|
||||
name: data['name'],
|
||||
id: data['id'],
|
||||
L0: data['L0'].toDouble(),
|
||||
belt: data['belt'],
|
||||
calibs: data['calibs'],
|
||||
dstEllipsoid: data['dstEllipsoid'],
|
||||
dx: data['dx'].toDouble(),
|
||||
dy: data['dy'].toDouble(),
|
||||
dz: data['dz'].toDouble(),
|
||||
wx: data['wx'].toDouble(),
|
||||
wy: data['wy'].toDouble(),
|
||||
wz: data['wz'].toDouble(),
|
||||
rota: data['rota'].toDouble(),
|
||||
k: data['k'].toDouble(),
|
||||
isMain: data['is_main'],
|
||||
elevation: data['elevation'].toDouble(),
|
||||
srcEllipsoid: data['srcEllipsoid'],
|
||||
);
|
||||
}
|
||||
|
||||
void forEach(Null Function(dynamic key, dynamic value) param0) {}
|
||||
}
|
@ -1,16 +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 {
|
||||
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
|
||||
@ -20,6 +27,7 @@ class PassTrackController extends GetxController {
|
||||
loadProject();
|
||||
loadSideLine();
|
||||
loadBindDevice();
|
||||
// getHisFileList();
|
||||
}
|
||||
|
||||
loadBindDevice() async {
|
||||
@ -71,4 +79,18 @@ class PassTrackController extends GetxController {
|
||||
mapController.centerXY = Offset((maxX + minX) / 2, (maxY + minY) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
getHisFileList(PassTrack passTrackPlugin) async {
|
||||
Map textlist = await GetServices().getHisFileList();
|
||||
List fileList = textlist['list'];
|
||||
for (var i = 0; i < fileList.length; i++) {
|
||||
var file = fileList[i];
|
||||
var jsData = await GetServices().getHisFile(file);
|
||||
int len = fileHandle.resolveJson(jsData, passTrackPlugin);
|
||||
allLen += len;
|
||||
// print("$pointList");
|
||||
// var totalList =fileHandle.allPointData;
|
||||
}
|
||||
print("allLen: $allLen");
|
||||
}
|
||||
}
|
||||
|
682
lib/pages/pass_track/model/coord_trans.dart
Normal file
682
lib/pages/pass_track/model/coord_trans.dart
Normal file
@ -0,0 +1,682 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
class CoordGPS {
|
||||
double LAT; //纬度
|
||||
double LNG; //经度
|
||||
double? ALT; //高度
|
||||
CoordGPS({this.ALT, required this.LAT, required this.LNG});
|
||||
}
|
||||
|
||||
class CoordXYH {
|
||||
double X;
|
||||
double Y;
|
||||
double H;
|
||||
CoordXYH({required this.X, required this.Y, required this.H});
|
||||
}
|
||||
|
||||
class CoordBLH {
|
||||
double B;
|
||||
double L;
|
||||
double H;
|
||||
CoordBLH({required this.B, required this.H, required this.L});
|
||||
}
|
||||
|
||||
class CoordXYZ {
|
||||
double X;
|
||||
double Y;
|
||||
double Z;
|
||||
CoordXYZ({required this.X, required this.Y, required this.Z});
|
||||
}
|
||||
|
||||
class PointXY {
|
||||
double X;
|
||||
double Y;
|
||||
PointXY({required this.X, required this.Y});
|
||||
}
|
||||
|
||||
class Region {
|
||||
double X;
|
||||
double Y;
|
||||
double? width;
|
||||
double? heigth;
|
||||
double? D;
|
||||
Region({this.D, required this.X, required this.Y, this.heigth, this.width});
|
||||
}
|
||||
|
||||
class Ellipsoid {
|
||||
late double A;
|
||||
late double F;
|
||||
late double B;
|
||||
late double E12;
|
||||
late double E22;
|
||||
Ellipsoid(String name) {
|
||||
const Map<String, Map<String, double>> datums = {
|
||||
'BJ54': {'a': 6378245, 'f': 1 / 298.3},
|
||||
'XA80': {'a': 6378140, 'f': 1 / 298.257},
|
||||
'WGS84': {'a': 6378137, 'f': 1 / 298.257223563},
|
||||
'WGS2000': {'a': 6378137, 'f': 1 / 298.257222101}
|
||||
};
|
||||
var Datum = datums[name];
|
||||
if (Datum != null) {
|
||||
double a = Datum['a']!;
|
||||
double f = Datum['f']!;
|
||||
double b = a - f * a;
|
||||
double e12 = (a * a - b * b) / (a * a); // 第一偏心率平方
|
||||
double e22 = (a * a - b * b) / (b * b); // 第二偏心率平方
|
||||
A = a;
|
||||
F = f;
|
||||
B = b;
|
||||
E12 = e12;
|
||||
E22 = e22;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TransParm {
|
||||
late double dx;
|
||||
late double dy;
|
||||
late double dz;
|
||||
late double rx;
|
||||
late double ry;
|
||||
late double rz;
|
||||
late double rota;
|
||||
late double k;
|
||||
|
||||
TransParm(TransOptions options) {
|
||||
dx = options.dx ?? 0;
|
||||
dy = options.dy ?? 0;
|
||||
dz = options.dz ?? 0;
|
||||
rx = options.rx ?? 0;
|
||||
ry = options.ry ?? 0;
|
||||
rz = options.rz ?? 0;
|
||||
k = options.k ?? 0;
|
||||
rota = options.rota ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
class TransOptions {
|
||||
double? dx; //X平移(M)
|
||||
double? dy; //Y平移(M)
|
||||
double? dz; //z平移(M)
|
||||
double? rx; //X旋转(°)
|
||||
double? ry; //Y旋转(°)
|
||||
double? rz; //Z旋转(°)
|
||||
double? rota; //平面旋转,用于4参数
|
||||
double? k; //尺度(ppm)
|
||||
double? L0; //中央子午线(经度)
|
||||
String? srcEllipsoid; //源椭球名称
|
||||
String? dstEllipsoid; //目标椭球名称
|
||||
double? zoneWidth; //带宽度,用于未指定中央子午线时自动计算
|
||||
double? elevation; //投影高程
|
||||
TransOptions({
|
||||
this.L0,
|
||||
this.dstEllipsoid,
|
||||
this.dx,
|
||||
this.dy,
|
||||
this.dz,
|
||||
this.elevation,
|
||||
this.k,
|
||||
this.rota,
|
||||
this.rx,
|
||||
this.ry,
|
||||
this.rz,
|
||||
this.srcEllipsoid,
|
||||
});
|
||||
}
|
||||
|
||||
class CoordTrans {
|
||||
late double L0; //中央子午线
|
||||
late double zoneWidth; //带宽度
|
||||
late double elevation; //投影高程
|
||||
late double rota; //平面旋转,用于4参数
|
||||
late Ellipsoid srcEllipsoid; //源椭球
|
||||
late Ellipsoid dstEllipsoid; //目标椭球
|
||||
late TransParm transParm; //7参数
|
||||
CoordTrans(TransOptions options) {
|
||||
transParm = TransParm(options);
|
||||
L0 = options.L0 ?? 0;
|
||||
elevation = options.elevation ?? 0;
|
||||
srcEllipsoid = Ellipsoid(options.srcEllipsoid ?? 'WGS84');
|
||||
dstEllipsoid = Ellipsoid(options.dstEllipsoid ?? 'WGS2000');
|
||||
zoneWidth = options.zoneWidth ?? 3;
|
||||
}
|
||||
|
||||
CoordXYH GPS2XY(CoordGPS gps) {
|
||||
return d2p(CoordBLH(H: gps.ALT ?? elevation, B: gps.LAT, L: gps.LNG));
|
||||
}
|
||||
|
||||
//经纬度转平面坐标
|
||||
CoordXYH d2p(CoordBLH blh) {
|
||||
CoordXYZ zj = BLH2XYZ(blh);
|
||||
CoordXYZ xzj = XYZ2XYZ(zj);
|
||||
CoordBLH xdd = XYZ2BLH(xzj);
|
||||
CoordXYH xpm = BL2XY(xdd);
|
||||
return xpm;
|
||||
}
|
||||
|
||||
//平面坐标转大地坐标
|
||||
CoordBLH p2d(CoordXYH xyh) {
|
||||
CoordBLH bl = XY2BL(xyh, true);
|
||||
CoordXYZ zj = BLH2XYZ(bl, true);
|
||||
CoordXYZ xzj = XYZ2XYZ(zj, true);
|
||||
CoordBLH xdd = XYZ2BLH(xzj, true);
|
||||
return xdd;
|
||||
}
|
||||
|
||||
setZoneWidth(width) {
|
||||
if (width != 6 && width != 3) {
|
||||
print('带宽应当为6或者为3');
|
||||
} else {
|
||||
zoneWidth = width;
|
||||
}
|
||||
}
|
||||
|
||||
setL0(l0) {
|
||||
L0 = l0;
|
||||
}
|
||||
|
||||
int getZoneNo(double lng) {
|
||||
// 6度带
|
||||
// 这里应为向下取整
|
||||
if (zoneWidth == 6) {
|
||||
return ((lng + 6) / 6).floor();
|
||||
}
|
||||
// 3度带
|
||||
return ((lng + 1.5) / 3).floor();
|
||||
}
|
||||
|
||||
PointXY xy2xyLocal(PointXY source) {
|
||||
double x = source.X;
|
||||
double y = source.Y;
|
||||
double destx = x * transParm.k * cos(rota) -
|
||||
y * transParm.k * sin(rota) +
|
||||
transParm.dx;
|
||||
double desty = x * transParm.k * sin(rota) +
|
||||
y * transParm.k * cos(rota) +
|
||||
transParm.dy;
|
||||
|
||||
return PointXY(X: destx, Y: desty);
|
||||
}
|
||||
|
||||
CoordXYZ BLH2XYZ(CoordBLH pointBLH, [srcDst = false]) {
|
||||
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
|
||||
double a = ellipsoid.A;
|
||||
double e12 = ellipsoid.E12;
|
||||
|
||||
double radB = pointBLH.B / 180 * pi;
|
||||
double radL = pointBLH.L / 180 * pi;
|
||||
double H = pointBLH.H;
|
||||
|
||||
double N = a / sqrt(1 - e12 * sin(radB) * sin(radB)); // 卯酉圈半径
|
||||
|
||||
double X = (N + H) * cos(radB) * cos(radL);
|
||||
double Y = (N + H) * cos(radB) * sin(radL);
|
||||
double Z = (N * (1 - e12) + H) * sin(radB);
|
||||
|
||||
return CoordXYZ(X: X, Y: Y, Z: Z);
|
||||
}
|
||||
|
||||
/*
|
||||
七参数转换
|
||||
不同椭球参数下, 地心直角坐标系之间转换
|
||||
dX, dY, dZ: 三个坐标方向的平移参数
|
||||
wX, wY, wZ: 三个方向的旋转角参数(单位为弧度)
|
||||
Kppm: 尺度参数, 单位是ppm,如果是以米为单位, 需要在传参前 除以1000000
|
||||
*/
|
||||
CoordXYZ XYZ2XYZ(CoordXYZ xyz, [srcDst = false]) {
|
||||
double X = xyz.X;
|
||||
double Y = xyz.Y;
|
||||
double Z = xyz.Z;
|
||||
double dX = transParm.dx;
|
||||
double dY = transParm.dy;
|
||||
double dZ = transParm.dz;
|
||||
double rX = transParm.rx / 3600 / 180 * pi;
|
||||
double rY = transParm.ry / 3600 / 180 * pi;
|
||||
double rZ = transParm.rz / 3600 / 180 * pi;
|
||||
double Kppm = transParm.k / 1000000;
|
||||
CoordXYZ result = CoordXYZ(X: 0, Y: 0, Z: 0);
|
||||
if (srcDst) {
|
||||
result.X = X - dX - Kppm * X + rY * Z - rZ * Y;
|
||||
result.Y = Y - dY - Kppm * Y - rX * Z + rZ * X;
|
||||
result.Z = Z - dZ - Kppm * Z + rX * Y - rY * X;
|
||||
} else {
|
||||
result.X = X + dX + Kppm * X - rY * Z + rZ * Y;
|
||||
result.Y = Y + dY + Kppm * Y + rX * Z - rZ * X;
|
||||
result.Z = Z + dZ + Kppm * Z - rX * Y + rY * X;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
地心直角坐标系 转换到 地心大地坐标系
|
||||
用直接法2
|
||||
https://wenku.baidu.com/view/30a08f9ddd88d0d233d46a50.html
|
||||
*/
|
||||
CoordBLH XYZ2BLH(CoordXYZ XYZ, [srcDst = false]) {
|
||||
double X = XYZ.X;
|
||||
double Y = XYZ.Y;
|
||||
double Z = XYZ.Z;
|
||||
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
|
||||
double a = ellipsoid.A;
|
||||
double b = ellipsoid.B;
|
||||
double e12 = ellipsoid.E12;
|
||||
double e22 = ellipsoid.E22;
|
||||
double L = atan(Y / X);
|
||||
// 弧度转角度
|
||||
double degL = L * 180 / pi;
|
||||
// Y值为正, 东半球, 否则西半球
|
||||
if (Y > 0) {
|
||||
while (degL < 0) {
|
||||
degL += 180;
|
||||
}
|
||||
while (degL > 180) {
|
||||
degL -= 180;
|
||||
}
|
||||
} else {
|
||||
while (degL > 0) {
|
||||
degL -= 180;
|
||||
}
|
||||
while (degL < -180) {
|
||||
degL += 180;
|
||||
}
|
||||
}
|
||||
|
||||
double tgU = Z / (sqrt(X * X + Y * Y) * sqrt(1 - e12));
|
||||
double U = atan(tgU);
|
||||
|
||||
double tgB = (Z + b * e22 * pow(sin(U), 3)) /
|
||||
(sqrt(X * X + Y * Y) - a * e12 * pow(cos(U), 3));
|
||||
double B = atan(tgB);
|
||||
double degB = B * 180 / pi; // 弧度转角度
|
||||
if (Z > 0) {
|
||||
// Z值为正, 北半球, 否则南半球
|
||||
while (degB < 0) {
|
||||
degB += 90;
|
||||
}
|
||||
while (degB > 90) {
|
||||
degB -= 90;
|
||||
}
|
||||
} else {
|
||||
while (degB > 0) {
|
||||
degB -= 90;
|
||||
}
|
||||
while (degB < -90) {
|
||||
degB += 90;
|
||||
}
|
||||
}
|
||||
|
||||
while (degB < 0) {
|
||||
degB += 360;
|
||||
}
|
||||
while (degB > 360) {
|
||||
degB -= 360;
|
||||
}
|
||||
|
||||
double N = a / sqrt(1 - e12 * sin(B) * sin(B)); // 卯酉圈半径
|
||||
double H = 0;
|
||||
// B接近极区, 在±90°附近
|
||||
if ((degB).abs() > 80) {
|
||||
H = Z / sin(B) - N * (1 - e12);
|
||||
} else {
|
||||
H = sqrt(X * X + Y * Y) / cos(B) - N;
|
||||
}
|
||||
return CoordBLH(B: degB, L: degL, H: H);
|
||||
}
|
||||
|
||||
/*
|
||||
地心大地坐标系 转换到 大地平面坐标系
|
||||
prjHeight: 投影面高程
|
||||
http://www.cnblogs.com/imeiba/p/5696967.html
|
||||
*/
|
||||
CoordXYH BL2XY(CoordBLH BLH,
|
||||
[srcDst = false, offsetY = 500000, offsetX = 0]) {
|
||||
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
|
||||
double a = ellipsoid.A;
|
||||
double b = ellipsoid.B;
|
||||
double e12 = ellipsoid.E12;
|
||||
double e22 = ellipsoid.E22;
|
||||
if (L0 == 0) {
|
||||
int zoneNo = getZoneNo(BLH.L);
|
||||
L0 = (zoneNo - 0.5) * zoneWidth;
|
||||
}
|
||||
double radL0 = L0 / 180 * pi;
|
||||
|
||||
double radB = BLH.B / 180 * pi;
|
||||
double radL = BLH.L / 180 * pi;
|
||||
|
||||
double N = a / sqrt(1 - e12 * sin(radB) * sin(radB)); // 卯酉圈半径
|
||||
double T = tan(radB) * tan(radB);
|
||||
double C = e22 * cos(radB) * cos(radB);
|
||||
double A = (radL - radL0) * cos(radB);
|
||||
double M = a *
|
||||
((1 - e12 / 4 - 3 * e12 * e12 / 64 - 5 * e12 * e12 * e12 / 256) * radB -
|
||||
(3 * e12 / 8 + 3 * e12 * e12 / 32 + 45 * e12 * e12 * e12 / 1024) *
|
||||
sin(2 * radB) +
|
||||
(15 * e12 * e12 / 256 + 45 * e12 * e12 * e12 / 1024) *
|
||||
sin(4 * radB) -
|
||||
(35 * e12 * e12 * e12 / 3072) * sin(6 * radB));
|
||||
|
||||
//x,y的计算公式见孔祥元等主编武汉大学出版社2002年出版的《控制测量学》的第72页
|
||||
//书的的括号有问题,( 和 [ 应该交换
|
||||
|
||||
double x = M +
|
||||
N *
|
||||
tan(radB) *
|
||||
(A * A / 2 +
|
||||
(5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 +
|
||||
(61 - 58 * T + T * T + 600 * C - 330 * e22) *
|
||||
A *
|
||||
A *
|
||||
A *
|
||||
A *
|
||||
A *
|
||||
A /
|
||||
720);
|
||||
double y = N *
|
||||
(A +
|
||||
(1 - T + C) * A * A * A / 6 +
|
||||
(5 - 18 * T * T * T + 72 * C - 58 * e22) * A * A * A * A * A / 120);
|
||||
|
||||
x = offsetX + x * (b + elevation) / b;
|
||||
y = offsetY + y * (b + elevation) / b;
|
||||
|
||||
return CoordXYH(
|
||||
X: (x * 1000).round() / 1000, Y: (y * 1000).round() / 1000, H: BLH.H);
|
||||
}
|
||||
|
||||
/*
|
||||
大地平面坐标系 转换到 地心大地坐标系
|
||||
prjHeight: 投影面高程
|
||||
http://www.cnblogs.com/imeiba/p/5696967.html
|
||||
*/
|
||||
CoordBLH XY2BL(CoordXYH xyh,
|
||||
[srcDst = false, offsetY = 500000, offsetX = 0]) {
|
||||
Ellipsoid ellipsoid = srcDst ? srcEllipsoid : dstEllipsoid;
|
||||
double a = ellipsoid.A;
|
||||
double b = ellipsoid.B;
|
||||
double e12 = ellipsoid.E12;
|
||||
double e22 = ellipsoid.E22;
|
||||
|
||||
double e1 = (1 - sqrt(1 - e12)) / (1 + sqrt(1 - e12));
|
||||
double radL0 = L0 / 180 * pi;
|
||||
// 带内大地坐标
|
||||
double Y = xyh.Y % 1000000;
|
||||
double x = (xyh.X - offsetX) * b / (b + elevation);
|
||||
double y = (Y - offsetY) * b / (b + elevation);
|
||||
|
||||
double u = x /
|
||||
(a * (1 - e12 / 4 - 3 * e12 * e12 / 64 - 5 * e12 * e12 * e12 / 256));
|
||||
double fai = u +
|
||||
(3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * sin(2 * u) +
|
||||
(21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * sin(4 * u) +
|
||||
(151 * e1 * e1 * e1 / 96) * sin(6 * u) +
|
||||
(1097 * e1 * e1 * e1 * e1 / 512) * sin(8 * u);
|
||||
double C = e22 * cos(fai) * cos(fai);
|
||||
double T = tan(fai) * tan(fai);
|
||||
double N = a / sqrt(1 - e12 * sin(fai) * sin(fai));
|
||||
double R = a *
|
||||
(1 - e12) /
|
||||
sqrt((1 - e12 * sin(fai) * sin(fai)) *
|
||||
(1 - e12 * sin(fai) * sin(fai)) *
|
||||
(1 - e12 * sin(fai) * sin(fai)));
|
||||
double D = y / N;
|
||||
|
||||
double L = radL0 +
|
||||
(D -
|
||||
(1 + 2 * T + C) * D * D * D / 6 +
|
||||
(5 - 2 * C + 28 * T - 3 * C * C + 8 * e22 + 24 * T * T) *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D /
|
||||
120) /
|
||||
cos(fai);
|
||||
double B = fai -
|
||||
(N * tan(fai) / R) *
|
||||
(D * D / 2 -
|
||||
(5 + 3 * T + 10 * C - 4 * C * C - 9 * e22) *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D /
|
||||
24 +
|
||||
(61 + 90 * T + 298 * C + 45 * T * T - 256 * e22 - 3 * C * C) *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D *
|
||||
D /
|
||||
720);
|
||||
|
||||
B = B * 180 / pi;
|
||||
L = L * 180 / pi;
|
||||
return CoordBLH(B: B, L: L, H: xyh.H);
|
||||
}
|
||||
|
||||
//两点之间的距离公式
|
||||
dist(PointXY p1, PointXY p2) {
|
||||
double d = sqrt(pow((p2.X - p1.X), 2) + pow((p2.Y - p1.Y), 2));
|
||||
return d;
|
||||
}
|
||||
|
||||
//求坐标方位角
|
||||
double fwj(PointXY p1, PointXY p2) {
|
||||
double dx = p2.X - p1.X;
|
||||
double dy = p2.Y - p1.Y;
|
||||
return pi - sign(dy) - atan(dx / dy);
|
||||
}
|
||||
|
||||
// 计算三参数
|
||||
TransOptions calcThree(CoordBLH p1, CoordXYH p2) {
|
||||
CoordXYZ source = BLH2XYZ(p1);
|
||||
CoordBLH bl = XY2BL(p2, true);
|
||||
CoordXYZ dest = BLH2XYZ(bl, true);
|
||||
|
||||
double dX = dest.X - source.X;
|
||||
double dY = dest.Y - source.Y;
|
||||
double dZ = dest.Z - source.Z;
|
||||
return TransOptions(dx: dX, dy: dY, dz: dZ);
|
||||
}
|
||||
|
||||
// TransOptions calcFour(List p1, List p2, int PointCount) {
|
||||
// double rota = 0;
|
||||
// double scale = 0;
|
||||
// double dx = 0;
|
||||
// double dy = 0;
|
||||
// if (PointCount == 2) {
|
||||
// rota = fwj(p2[0] as PointXY, p2[1]) - fwj(p1[0], p1[1]);
|
||||
// scale = dist(p2[0], p2[1]) / dist(p1[0], p1[1]);
|
||||
// dx = p2[0].X - scale * cos(rota) * p1[0].X + scale * sin(rota) * p1[0].Y;
|
||||
// dy = p2[0].Y - scale * sin(rota) * p1[0].X - scale * cos(rota) * p1[0].Y;
|
||||
// } else if (PointCount > 2) {
|
||||
// double u = 1.0, v = 0, Dx = 0.0, Dy = 0.0;
|
||||
// int intCount = PointCount;
|
||||
|
||||
// Matrix4 dx1 = Matrix.zeros(4, 1);
|
||||
// // Matrix4 B1 = Matrix.zeros(2 * intCount, 4);
|
||||
// Matrix4 B1 = Matrix4.zero();
|
||||
// for (int i = 0; i < 2 * intCount; i++) {
|
||||
// for (int j = 0; j < 4; j++) {
|
||||
// B1.setEntry(i, j, 0);
|
||||
// }
|
||||
// }
|
||||
// Matrix4 W1 = Matrix.zeros(2 * intCount, 1);
|
||||
// // Matrix4 BT = Matrix.zeros(4, 2 * intCount);
|
||||
// Matrix4 BT = Matrix4.zero();
|
||||
// for (int i = 0; i < 4; i++) {
|
||||
// for (int j = 0; j < 2 * intCount; j++) {
|
||||
// BT.setEntry(i, j, 0);
|
||||
// }
|
||||
// }
|
||||
// Matrix4 N = Matrix4(
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// );
|
||||
// Matrix4 InvN = Matrix4(
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// );
|
||||
// Matrix4 BTW = Matrix.zeros(4, 1);
|
||||
// for (int i = 0; i < intCount; i++) {
|
||||
// //计算误差方程系数
|
||||
// B1.setEntry(2 * i, 0, 1);
|
||||
// B1.setEntry(2 * i, 1, 0);
|
||||
// B1.setEntry(2 * i, 2, p1[i].X);
|
||||
// B1.setEntry(2 * i, 3, -p1[i].Y);
|
||||
|
||||
// B1.setEntry(2 * i + 1, 0, 0);
|
||||
// B1.setEntry(2 * i + 1, 1, 1);
|
||||
// B1.setEntry(2 * i + 1, 2, p1[i].Y);
|
||||
// B1.setEntry(2 * i + 1, 3, p1[i].X);
|
||||
// // B1[2 * i][0] = 1;
|
||||
// // B1[2 * i][1] = 0;
|
||||
// // B1[2 * i][2] = p1[i].X;
|
||||
// // B1[2 * i][3] = -p1[i].Y;
|
||||
|
||||
// // B1[2 * i + 1][0] = 0;
|
||||
// // B1[2 * i + 1][1] = 1;
|
||||
// // B1[2 * i + 1][2] = p1[i].Y;
|
||||
// // B1[2 * i + 1][3] = p1[i].X;
|
||||
// }
|
||||
// for (int i = 0; i < intCount; i++) {
|
||||
// //计算误差方程系常数
|
||||
// // W1[2 * i][0] = p2[i].X - u * p1[i].X + v * p1[i].Y - Dx;
|
||||
// // W1[2 * i + 1][0] = p2[i].Y - u * p1[i].Y - v * p1[i].X - Dy;
|
||||
// W1.setEntry(2 * i, 0, p2[i].X - u * p1[i].X + v * p1[i].Y - Dx);
|
||||
// W1.setEntry(2 * i + 1, 0, p2[i].Y - u * p1[i].Y - v * p1[i].X - Dy);
|
||||
// }
|
||||
// // 最小二乘求解
|
||||
// Matrix4 b1 = Matrix4.identity();
|
||||
// // 矩阵 B1 的转置
|
||||
// BT = Matrix4.copy(b1);
|
||||
// BT.transpose();
|
||||
// // 矩阵乘法
|
||||
// N = BT * B1;
|
||||
// // 逆矩阵
|
||||
// InvN = N.clone();
|
||||
// InvN.invert();
|
||||
// BTW = BT * (W1);
|
||||
// dx1 = InvN * (BTW);
|
||||
|
||||
// Dx = Dx + dx1[0][0];
|
||||
// Dy = Dy + dx1[1][0];
|
||||
// u = u + dx1[2][0];
|
||||
// v = v + dx1[3][0];
|
||||
// dx = Dx;
|
||||
// dy = Dy;
|
||||
// rota = atan(v / u);
|
||||
// scale = u / cos(rota);
|
||||
// }
|
||||
// return TransOptions(rota: rota, k: scale, dx: dx, dy: dy);
|
||||
// }
|
||||
|
||||
// // 计算七参数
|
||||
// TransOptions calcBuras(List p1, List p2, pointCount) {
|
||||
// let B1 = Matrix.zeros(pointCount * 3, 7);
|
||||
// let dx1 = Matrix.zeros(7, 1);
|
||||
// let L = Matrix.zeros(pointCount * 3, 1);
|
||||
// let BT = Matrix.zeros(7, pointCount * 3);
|
||||
// let N = Matrix.zeros(7, 7);
|
||||
// let InvN = Matrix.zeros(7, 7);
|
||||
// let BTL = Matrix.zeros(7, 1);
|
||||
// for (int i = 0; i < pointCount * 3; i++) {
|
||||
// if (i % 3 == 0) {
|
||||
// L[i][0] = p2[(i / 3).floor()].X;
|
||||
// } else if (i % 3 == 1) {
|
||||
// L[i][0] = p2[(i / 3).floor()].Y;
|
||||
// } else if (i % 3 == 2) {
|
||||
// L[i][0] = p2[(i / 3).floor()].Z;
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < pointCount * 3; i++) {
|
||||
// if (i % 3 == 0) {
|
||||
// int index = (i / 3) as int;
|
||||
// B1[i][0] = 1;
|
||||
// B1[i][1] = 0;
|
||||
// B1[i][2] = 0;
|
||||
// B1[i][3] = p1[index].X;
|
||||
// B1[i][4] = 0;
|
||||
// B1[i][5] = -p1[index].Z;
|
||||
// B1[i][6] = p1[index].Y;
|
||||
// } else if (i % 3 == 1) {
|
||||
// int index = ((i - 1) / 3) as int;
|
||||
// B1[i][0] = 0;
|
||||
// B1[i][1] = 1;
|
||||
// B1[i][2] = 0;
|
||||
// B1[i][3] = p1[index].Y;
|
||||
// B1[i][4] = p1[index].Z;
|
||||
// B1[i][5] = 0;
|
||||
// B1[i][6] = -p1[index].X;
|
||||
// } else if (i % 3 == 2) {
|
||||
// int index = ((i - 2) / 3) as int;
|
||||
// B1[i][0] = 0;
|
||||
// B1[i][1] = 0;
|
||||
// B1[i][2] = 1;
|
||||
// B1[i][3] = p1[index].Z;
|
||||
// B1[i][4] = -p1[index].Y;
|
||||
// B1[i][5] = p1[index].X;
|
||||
// B1[i][6] = 0;
|
||||
// }
|
||||
// }
|
||||
// Matrix4 b1 = Matrix4.identity();
|
||||
// BT = B1.transpose();
|
||||
// N = BT.mmul(B1);
|
||||
// InvN = inverse(N);
|
||||
// BTL = BT.mmul(L);
|
||||
// dx1 = InvN.mmul(BTL);
|
||||
|
||||
// double dx = dx1[0][0];
|
||||
// double dy = dx1[1][0];
|
||||
// double dz = dx1[2][0];
|
||||
// double scale = dx1[3][0];
|
||||
// double rotax = dx1[4][0] / dx1[3][0];
|
||||
// double rotay = dx1[5][0] / dx1[3][0];
|
||||
// double rotaz = dx1[6][0] / dx1[3][0];
|
||||
|
||||
// return TransOptions(
|
||||
// dx: dx, dy: dy, dz: dz, k: scale, rx: rotax, ry: rotay, rz: rotaz);
|
||||
// }
|
||||
|
||||
double sign(num number) {
|
||||
if (number < 0) {
|
||||
return -1.0;
|
||||
} else if (number > 0) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
261
lib/pages/pass_track/model/draw_context.dart
Normal file
261
lib/pages/pass_track/model/draw_context.dart
Normal file
@ -0,0 +1,261 @@
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DrawContext {
|
||||
DrawContext();
|
||||
// 中心坐标
|
||||
//左下角显示的坐标
|
||||
double zeroDX = 0;
|
||||
double zeroDY = 0;
|
||||
//上一次的坐标
|
||||
double zeroX = 0;
|
||||
double zeroY = 0;
|
||||
// 缩放
|
||||
double scale = 1;
|
||||
double lastScale = 1;
|
||||
// 屏幕尺寸
|
||||
Size screenSize = const Size(100, 100);
|
||||
//暂时没用
|
||||
static int unit = 20;
|
||||
//弧度
|
||||
double angle = 0;
|
||||
double lastAngle = 0;
|
||||
List<double> grounScaleList = [
|
||||
78271.5170,
|
||||
39135.7585,
|
||||
19567.8792,
|
||||
9783.9396,
|
||||
4891.9698,
|
||||
2445.9849,
|
||||
1222.9925,
|
||||
611.4962,
|
||||
305.7481,
|
||||
152.8741,
|
||||
76.4370,
|
||||
38.2185,
|
||||
19.1093,
|
||||
9.5546,
|
||||
4.7773,
|
||||
2.3887,
|
||||
1.1943,
|
||||
0.5972,
|
||||
0.2986,
|
||||
0.1493,
|
||||
0.0746,
|
||||
0.0373,
|
||||
0.0187
|
||||
];
|
||||
// 是否显示标尺
|
||||
bool isRuler = false;
|
||||
bool isScale = true;
|
||||
// 是否显示地图
|
||||
bool isMap = true;
|
||||
// 坐标点
|
||||
List dotList = [];
|
||||
// 按下的点
|
||||
int? currentDotIndex;
|
||||
|
||||
//暂时没用
|
||||
List polyonList = [];
|
||||
int polyonExpendIndex = 0;
|
||||
// 当前移动的点
|
||||
Offset currentDot = const Offset(0, 0);
|
||||
//没用
|
||||
int groundScaleIndex = 21;
|
||||
//偏移坐标
|
||||
Offset pos = const Offset(0, 0);
|
||||
Offset lastPos = const Offset(0, 0);
|
||||
// 控制位移图的大小
|
||||
bool isNomal = true;
|
||||
|
||||
double mark = 1000;//显示当前比例尺,因为缩放的原因,比例尺有[8,40,200,1000];四种,默认倍数是100,那么mark默认1000
|
||||
double space = 1;
|
||||
List? pointList;
|
||||
List<List<double>> gengerateList = [];
|
||||
List<Widget> devicePositioned=[];
|
||||
|
||||
/// @param {double} m - 米
|
||||
m2px(double m) {
|
||||
return m / 20 / scale;
|
||||
}
|
||||
|
||||
/// @param {double} px - 像素
|
||||
px2m(double px) {
|
||||
return px * 20 / scale;
|
||||
}
|
||||
|
||||
// x是平面坐标的竖直方向
|
||||
/// @param {num} x - 坐标x
|
||||
/// @param {num} y - 坐标y
|
||||
// xy2Screen(num x, num y, [k = 1]) {
|
||||
// double screenx = (y / k * scale - zeroDX);
|
||||
// double screeny = (screenSize.height - (x / k * scale - zeroDY));
|
||||
// return Offset(screenx, screeny);
|
||||
// }
|
||||
xy2Screen(num x, num y, [k = 1]) {
|
||||
double screenx = (y * k / (scale) - zeroDX);
|
||||
double screeny = (screenSize.height - (x * k / (scale) - zeroDY));
|
||||
return Offset(screenx, screeny);
|
||||
}
|
||||
|
||||
/// @param {screenOffset} x - 屏幕坐标Offset(x,y)
|
||||
screen2xy(Offset screenOffset, [k = 1]) {
|
||||
// double X = (screenOffset.dy / k * scale + zeroDX);
|
||||
// double Y = (screenSize.height - screenOffset.dx / k * scale + zeroDY);
|
||||
double Y = (screenOffset.dx+zeroDX)*scale/k;
|
||||
double X=(screenSize.height-screenOffset.dy+zeroDY)*scale/k;
|
||||
// double X = (screenOffset.dx * k + zeroDX);
|
||||
// double Y = (screenSize.height - screenOffset.dy * k + zeroDY);
|
||||
return Offset(X, Y);
|
||||
}
|
||||
|
||||
//设置缩放
|
||||
/// @param {Size} size - (width,height)
|
||||
setSize(Size size) {
|
||||
screenSize = size;
|
||||
if (screenSize != size) {
|
||||
setCenter(null);
|
||||
lastScale = scale;
|
||||
screenSize = size;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置中心坐标
|
||||
// setCenter(obj, [k = 1]) {
|
||||
// if (obj != null) {
|
||||
// zeroDX = ((obj['y'] * k * scale - screenSize.width / 2).abs())
|
||||
// .floor()
|
||||
// .toDouble();
|
||||
// zeroDY = ((obj['x'] * k * scale - screenSize.height / 2).abs())
|
||||
// .floor()
|
||||
// .toDouble();
|
||||
// zeroX = (obj['x'] * k).toDouble();
|
||||
// zeroY = (obj['y'] * k).toDouble();
|
||||
// } else {
|
||||
// zeroDX =
|
||||
// ((zeroY * k * scale - screenSize.width / 2).abs()).floor().toDouble();
|
||||
// zeroDY = ((zeroX * k * scale - screenSize.height / 2).abs())
|
||||
// .floor()
|
||||
// .toDouble();
|
||||
// }
|
||||
// }
|
||||
setCenter(obj, [k = 1]) {
|
||||
scale = 1;
|
||||
if (obj != null) {
|
||||
zeroDX = (((obj["x"] as num) / k / (scale) - screenSize.width / 2).abs())
|
||||
.floor()
|
||||
.toDouble();
|
||||
zeroDY = (((obj["y"] as num) / k / (scale) - screenSize.height / 2).abs())
|
||||
.floor()
|
||||
.toDouble();
|
||||
zeroX = ((obj["x"])).toDouble();
|
||||
zeroY = ((obj["y"])).toDouble();
|
||||
// print("$zeroDX,$zeroDY");
|
||||
} else {
|
||||
zeroDX = ((zeroX / k / (scale)- screenSize.width / 2).abs())
|
||||
.floor()
|
||||
.toDouble();
|
||||
zeroDY = ((zeroY / k / (scale) - screenSize.height / 2).abs())
|
||||
.floor()
|
||||
.toDouble();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 没有用
|
||||
// getGridStepXY() {
|
||||
// double dx = (zeroX % 100) * 20 / scale;
|
||||
// double dy = (zeroY % 100) * 20 / scale;
|
||||
// double step =
|
||||
// scaleList[scale.toInt() - 1 < 0 ? 0 : scale.toInt() - 1] / scale;
|
||||
// return GridStepXY(step, dx, dy);
|
||||
// }
|
||||
|
||||
setZeroOffset(Offset pos) {
|
||||
//移动当前中心
|
||||
zeroDX -= pos.dx;
|
||||
zeroDY += pos.dy;
|
||||
//将偏移值附加给存储的zeroX和Y,保证缩放的时候仍然保留之前的偏移量
|
||||
zeroX -=pos.dx*scale ;
|
||||
zeroY += pos.dy*scale;
|
||||
}
|
||||
|
||||
//设置当前移动点的坐标
|
||||
setCurrentDot(Offset offset) {
|
||||
currentDot = offset;
|
||||
}
|
||||
|
||||
setDotListIndex(Offset offset) {
|
||||
dotList[currentDotIndex!] = offset;
|
||||
}
|
||||
|
||||
setDotList(List list) {
|
||||
dotList = list;
|
||||
}
|
||||
|
||||
/// @param {int} index - 下标位置
|
||||
setPolyonList(int index, List lists) {
|
||||
List arr = [];
|
||||
// List arr1 = [];
|
||||
for (int i = 0; i < lists.length; i++) {
|
||||
Offset list = screen2xy(lists[i]);
|
||||
arr.add(list);
|
||||
}
|
||||
polyonList[index].list = arr;
|
||||
}
|
||||
|
||||
// 点到直线得距离
|
||||
/// @param {Offset} dot - 3个点
|
||||
double dot2Line(Offset dot1, Offset dot2, Offset dot) {
|
||||
double A = (dot1.dy - dot2.dy) / (dot1.dx - dot2.dx); //1,2直线的斜率
|
||||
double B = dot1.dy - A * dot1.dx; //斜率
|
||||
|
||||
double distance =
|
||||
((A * dot.dx + B - dot.dy) / sqrt(A * A + 1)).abs(); //求3和直线1,2的距离
|
||||
return distance;
|
||||
}
|
||||
|
||||
// 获取地面分辨率的索引,暂时没用
|
||||
int getGroundScaleIndex(double sacle) {
|
||||
groundScaleIndex = grounScaleList.lastIndexWhere((el) => el > scale) + 1;
|
||||
return groundScaleIndex;
|
||||
}
|
||||
|
||||
// 获取地面分辨率,暂时没用
|
||||
double getGroundScale() {
|
||||
return grounScaleList[groundScaleIndex - 1];
|
||||
}
|
||||
|
||||
// 点的信息
|
||||
pointInfo(Offset point) {
|
||||
if (pointList != null && pointList!.isNotEmpty) {
|
||||
for (var el in pointList!) {
|
||||
double x = ((el['dx'] as double) - point.dx).abs();
|
||||
double y = ((el['dy'] as double) - point.dy).abs();
|
||||
if (x <= 15 && y <= 15) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 暂时没有用
|
||||
class GridStepXY {
|
||||
double step;
|
||||
double dx;
|
||||
double dy;
|
||||
GridStepXY(this.step, this.dx, this.dy);
|
||||
}
|
||||
|
||||
//暂时没用
|
||||
class Polyon {
|
||||
String label;
|
||||
String key;
|
||||
bool expend;
|
||||
List list;
|
||||
|
||||
Polyon(this.key, this.label, this.list, [this.expend = false]);
|
||||
}
|
146
lib/pages/pass_track/model/recievemodel.dart
Normal file
146
lib/pages/pass_track/model/recievemodel.dart
Normal file
@ -0,0 +1,146 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
class RecieveModel {
|
||||
// int UTC;
|
||||
// double LAT;
|
||||
// double LNG;
|
||||
// double ASL;
|
||||
// double speed;
|
||||
// int status;
|
||||
// num HDG;
|
||||
// num TP;
|
||||
int type;
|
||||
int TID;
|
||||
// num count;
|
||||
// String data;
|
||||
// num? mile;
|
||||
// int layer;
|
||||
// DecodeDataObj? obj;
|
||||
int x;
|
||||
int y;
|
||||
RecieveModel(
|
||||
{
|
||||
// required this.ASL, //
|
||||
// required this.HDG, //
|
||||
// required this.LAT, //
|
||||
// required this.LNG, //
|
||||
required this.TID,
|
||||
// required this.TP,
|
||||
// required this.UTC,
|
||||
// required this.count,
|
||||
// required this.data,
|
||||
// required this.layer,
|
||||
// required this.mile,
|
||||
// required this.speed,
|
||||
// required this.status,
|
||||
required this.type,
|
||||
required this.x,
|
||||
required this.y,
|
||||
// this.obj
|
||||
});
|
||||
factory RecieveModel.fromJson(Map<dynamic, dynamic> json) {
|
||||
return RecieveModel(
|
||||
// ASL: json['ASL']!.toDouble(),
|
||||
// UTC: json['UTC'],
|
||||
type: int.tryParse(json['type'])??1,
|
||||
// TP: json['TP'],
|
||||
// count: json['count'],
|
||||
// data: json['data'],
|
||||
// HDG: json['HDG'],
|
||||
// LAT: json['LAT'],
|
||||
// layer: json['layer'],
|
||||
// LNG: json['LNG'],
|
||||
// mile: json['mile'],
|
||||
// speed: json['speed'],
|
||||
// status: json['status'],
|
||||
TID: json['TID'],
|
||||
// obj: json['obj'],
|
||||
x: json['x'] ?? 0,
|
||||
y: json['y'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
class DecodeDataObj {
|
||||
int x;
|
||||
int y;
|
||||
Uint16List data;
|
||||
int dx;
|
||||
int dy;
|
||||
int w;
|
||||
int h;
|
||||
double rad;
|
||||
DecodeDataObj(
|
||||
{required this.data,
|
||||
required this.dx,
|
||||
required this.dy,
|
||||
required this.h,
|
||||
required this.w,
|
||||
required this.x,
|
||||
required this.y,
|
||||
required this.rad});
|
||||
factory DecodeDataObj.fromBase64(String base64) {
|
||||
// base64 解码
|
||||
Uint8List bytes = base64Decode(base64);
|
||||
ByteData byteData = bytes.buffer.asByteData();
|
||||
|
||||
// 解码后解析为需要的格式返回出去
|
||||
int x = byteData.getInt32(0, Endian.little); //readInt32LE(str, 0);
|
||||
int y = byteData.getInt32(4, Endian.little); //readInt32LE(str, 4);
|
||||
int v = byteData.getUint16(8, Endian.little); //readUInt16LE(str, 8);
|
||||
int w = v & 0x3ff;
|
||||
double rad = (v >>> 10) * 2 * pi / 64;
|
||||
Uint16List data;
|
||||
int length = bytes.length;
|
||||
int h = 0;
|
||||
h -= 1;
|
||||
int dx;
|
||||
int dy;
|
||||
int i = 0;
|
||||
if (w < 16) {
|
||||
h = (length - 10 - 1);
|
||||
data = Uint16List(h * 2);
|
||||
for (i = 0; i < h; i++) {
|
||||
int x = bytes[10 + i] & 0x0f;
|
||||
int w = bytes[10 + i] >> 4;
|
||||
data[i * 2] = x;
|
||||
data[i * 2 + 1] = w;
|
||||
}
|
||||
dx = bytes[10 + i] & 0x0f;
|
||||
dy = bytes[10 + i] >> 4;
|
||||
} else if (w < 256) {
|
||||
h = ((length - 10) / 2 - 1).toInt();
|
||||
data = Uint16List(h * 2);
|
||||
for (i = 0; i < h; i++) {
|
||||
int x = bytes[10 + i * 2];
|
||||
int w = bytes[10 + i * 2 + 1];
|
||||
data[i * 2] = x;
|
||||
data[i * 2 + 1] = w;
|
||||
}
|
||||
dx = bytes[10 + i * 2];
|
||||
dy = bytes[10 + i * 2 + 1];
|
||||
} else {
|
||||
h = ((length - 10) / 3 - 1).toInt();
|
||||
data = Uint16List(h * 2);
|
||||
for (i = 0; i < h; i++) {
|
||||
if (10 + i * 3 + 3 < h) {
|
||||
int a = bytes[10 + i * 3];
|
||||
int b = bytes[10 + i * 3 + 1];
|
||||
int c = bytes[10 + i * 3 + 2];
|
||||
int x = a | (b & 0x0f) << 8;
|
||||
int w = (b & 0xf0) >> 4 | (c & 0x0f) << 4;
|
||||
data[i * 2] = x;
|
||||
data[i * 2 + 1] = w;
|
||||
}
|
||||
}
|
||||
int a = bytes[10 + i * 3];
|
||||
int b = bytes[10 + i * 3 + 1];
|
||||
int c = bytes[10 + i * 3 + 2];
|
||||
dx = a | (b & 0x0f) << 8;
|
||||
dy = (b & 0xf0) >> 4 | (c & 0x0f) << 4;
|
||||
}
|
||||
return DecodeDataObj(
|
||||
x: x, y: y, w: w, h: h, dx: dx, dy: dy, data: data, rad: rad);
|
||||
}
|
||||
}
|
674
lib/pages/pass_track/sevice/file_handle.dart
Normal file
674
lib/pages/pass_track/sevice/file_handle.dart
Normal file
@ -0,0 +1,674 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pass_track/binding.dart';
|
||||
import 'package:pass_track/pass_track.dart';
|
||||
import 'dart:ffi' as ffi;
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:web_socket_channel/io.dart';
|
||||
import 'package:web_socket_channel/status.dart' as status;
|
||||
|
||||
|
||||
import 'package:pass_track/binding.dart' as Binding;
|
||||
|
||||
import '../../../service/base.dart';
|
||||
import '../model/coord_trans.dart';
|
||||
import '../model/draw_context.dart';
|
||||
import '../model/recievemodel.dart';
|
||||
|
||||
|
||||
DrawContext drawCtx = DrawContext();
|
||||
class FileHandle {
|
||||
int textureId = -1;
|
||||
int index = 0;
|
||||
List deviceList = [];
|
||||
Map deviceData = {};
|
||||
String type = "cumulate";
|
||||
List palette = [];
|
||||
//所有点的数据
|
||||
List allPointData = [];
|
||||
//需要渲染的点的数据
|
||||
List pointData = [];
|
||||
double L0 = 102;
|
||||
late CoordTrans coordTrans;
|
||||
/* 这个是配合原版ts更改的addpoint*/
|
||||
// //过滤点
|
||||
// filterPoint(var point) {
|
||||
// //传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<Point>() - (512 * 512 - obj.w * obj.h) * 2;
|
||||
|
||||
var size_x = ffi.sizeOf<Point>();
|
||||
// if (check < 0) {
|
||||
// print('check:$check');
|
||||
// }
|
||||
ffi.Pointer<Point> pointer = calloc.allocate<Point>(
|
||||
ffi.sizeOf<Point>() - (512 * 512 - obj.w * obj.h) * 2 + 1000);
|
||||
// ffi.Pointer<Point> pointer = calloc
|
||||
// .allocate<Point>(size_x>>1);
|
||||
if (pointer == ffi.nullptr) {
|
||||
return;
|
||||
}
|
||||
// pointer.ref.tile.x = obj.x;
|
||||
// pointer.ref.tile.y = obj.y;
|
||||
// pointer.ref.tile.w = obj.w;
|
||||
// pointer.ref.tile.h = obj.h;
|
||||
// pointer.ref.tile.dx = obj.dx;
|
||||
// pointer.ref.tile.dy = obj.dy;
|
||||
// pointer.ref.tile.rad = obj.rad;
|
||||
pointer.ref.TID = pointData["TID"] as int;
|
||||
pointer.ref.type = pointData["type"] as int;
|
||||
pointer.ref.bits = pointData['bits'] == null ? 0 : pointData['bits'] as int;
|
||||
pointer.ref.typeBits =
|
||||
pointData['typeBits'] == null ? 0 : pointData['typeBits'] as int;
|
||||
pointer.ref.TP = (pointData["TP"]) * 1.0;
|
||||
pointer.ref.speed = pointData["speed"].toDouble();
|
||||
pointer.ref.count = pointData["count"] as int;
|
||||
pointer.ref.LAT = pointData["LAT"].toDouble();
|
||||
pointer.ref.LNG = pointData["LNG"].toDouble();
|
||||
pointer.ref.ASL = pointData["ASL"].toDouble();
|
||||
var xyh = coordTrans.d2p(CoordBLH(
|
||||
B: pointData["LAT"].toDouble(),
|
||||
L: pointData["LNG"].toDouble(),
|
||||
H: pointData["ASL"].toDouble()));
|
||||
pointer.ref.X = xyh.X * 20;
|
||||
pointer.ref.Y = xyh.Y * 20;
|
||||
pointer.ref.H = xyh.H;
|
||||
// print(pointer.ref.X);
|
||||
// print(pointer.ref.Y);
|
||||
// print(pointer.ref.H);
|
||||
pointer.ref.HDG = pointData["HDG"].toDouble();
|
||||
pointer.ref.UTC = pointData["UTC"] as int;
|
||||
pointer.ref.layer = pointData["layer"] as int;
|
||||
// pointer.ref.mile = pointData["mile"] as int;
|
||||
pointer.ref.status = pointData["status"] as int;
|
||||
// for (int i = 0; i < obj.w; i++) {
|
||||
// //对tile处理
|
||||
// for (int j = 0; j < obj.h; j++) {
|
||||
// if (i * obj.h + j < obj.data.length) {
|
||||
// pointer.ref.tile.data[i * obj.h + j] = obj.data[i * obj.h + j];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// passTrackPlugin.passTrack_fullMap_addPoint(pointer);
|
||||
|
||||
//calloc.free(pointer);
|
||||
}
|
||||
|
||||
Future<bool> init() async {
|
||||
return false;
|
||||
// await initDevice();
|
||||
// await initPalette();
|
||||
// coordTrans = CoordTrans(TransOptions(L0: L0));
|
||||
// List allPointData = filterPoint(null, null);
|
||||
// var count = 0;
|
||||
// if (allPointData is List) {
|
||||
// for (var e in allPointData) {
|
||||
// count++;
|
||||
// updateObj(e);
|
||||
// // if (count > 100000) {
|
||||
// // break;
|
||||
// // // ++count
|
||||
// // }
|
||||
// }
|
||||
// } else {
|
||||
// count++;
|
||||
// updateObj(allPointData);
|
||||
// // if (count > 100000) {
|
||||
// // return true;
|
||||
// // }
|
||||
// }
|
||||
// // passTrackPlugin.passTrack_drawFullScreen(true);
|
||||
// ffi.Pointer<Binding.Point> pointerNull =
|
||||
// calloc.allocate<Binding.Point>(ffi.sizeOf<Binding.Point>());
|
||||
// // passTrackPlugin.playTrack(true, true, false, 0, 115000, ffi.nullptr);
|
||||
// calloc.free(pointerNull);
|
||||
// return true;
|
||||
}
|
||||
|
||||
//初始化设备,并且根据设备修改point的bits值
|
||||
// initDevice() async {
|
||||
// //读取设备数据
|
||||
// List temp = await GetServices().getDeviceBind();
|
||||
// //筛出其中的roller和paver
|
||||
// temp.forEach((element) {
|
||||
// if (element["type"] == "roller" || element["type"] == "paver") {
|
||||
// deviceList.add(element);
|
||||
// }
|
||||
// });
|
||||
|
||||
// for (var i = 0; i < deviceList.length; i++) {
|
||||
// //对所有设备的bits进行处理
|
||||
// deviceList[i]["bits"] = 1 << i;
|
||||
// //再将TID作为键,赋值给deviceData
|
||||
// deviceData[deviceList[i]["tid"]] = deviceList[i];
|
||||
// }
|
||||
|
||||
// await getFile();
|
||||
// }
|
||||
|
||||
//获取txt文件内容
|
||||
// getFile() async {
|
||||
// var fileList = await GetServices().getHisFileList();
|
||||
// for (var i = 0; i < fileList["list"].length; i++) {
|
||||
// // print(fileList[i]);
|
||||
// dynamic data = await GetServices().getHisFile(fileList["list"][i]);
|
||||
// allPointData.addAll(resolveJson(data, passTrackPlugin));
|
||||
// }
|
||||
// allPointData.forEach((ele) {
|
||||
// updateDevices(ele);
|
||||
// });
|
||||
// // print(pointData);
|
||||
// }
|
||||
|
||||
//处理文本文件
|
||||
resolveJson(var res, PassTrack passTrackPlugin) {
|
||||
if (res is String) {
|
||||
List<RecieveModel> allPointData = [];
|
||||
int start = 0;
|
||||
var allPointLen = 0;
|
||||
// 记录当前数组的长度
|
||||
while (true) {
|
||||
int end = res.indexOf('\n', start);
|
||||
if (end < 0) {
|
||||
break;
|
||||
}
|
||||
String str = res.substring(start, end);
|
||||
try {
|
||||
if (str[str.length - 1] == ",") {
|
||||
str = str.substring(0, str.length - 1);
|
||||
}
|
||||
var item = jsonDecode(str);
|
||||
RecieveModel recieveModel = RecieveModel.fromJson(item);
|
||||
if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
|
||||
//dart重置中心
|
||||
drawCtx.setCenter(
|
||||
// {"x": recieveModel.x / 20, "y": recieveModel.y / 20});//532863.8,4208668.95
|
||||
{"x": 10656637 / 20, "y": 84172941 / 20});//532863.8,4208668.95
|
||||
}
|
||||
int x = recieveModel.x;
|
||||
int y = recieveModel.y;
|
||||
int tid = recieveModel.TID;
|
||||
int type = recieveModel.type;
|
||||
var p = passTrackPlugin.wantPoint();
|
||||
p.ref.X = x.toDouble();
|
||||
p.ref.Y = y.toDouble();
|
||||
p.ref.TID = tid;
|
||||
p.ref.type = type;
|
||||
// var data = item['data'];
|
||||
// if (data != null) {
|
||||
// item['TID'] =
|
||||
// item['TID'] is int ? item['TID'] : num.parse(item['TID']);
|
||||
// item['type'] =
|
||||
// item['type'] is int ? item['type'] : num.parse(item['type']);
|
||||
// item['obj'] = DecodeDataObj.fromBase64(item['data']);
|
||||
// // this.updateDevice(item);
|
||||
// // this.sportsData.push(item);
|
||||
|
||||
allPointData.add(recieveModel);
|
||||
// }
|
||||
} catch (e) {
|
||||
print("----$e\r\n$str");
|
||||
}
|
||||
allPointLen++;
|
||||
start = end + 1;
|
||||
}
|
||||
return allPointLen;
|
||||
} else {
|
||||
//只有一条数据的时候
|
||||
var item = res;
|
||||
var data = item['data'];
|
||||
if (data != null) {
|
||||
item['obj'] = DecodeDataObj.fromBase64(item['data']);
|
||||
item['type'] = num.parse(item['type']);
|
||||
item['TID'] = num.parse(item['TID']);
|
||||
// this.updateDevice(item);
|
||||
// this.sportsData.push(item);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//修改点的bits和typeBits
|
||||
updateDevices(var point) {
|
||||
var TID = point["TID"];
|
||||
if (deviceData.containsKey(TID)) {
|
||||
var device = deviceData[TID];
|
||||
device["show"] = true;
|
||||
point["bits"] = device["bits"];
|
||||
point["typeBits"] = (device["type"] == "paver" ? 2 : 1) < 2
|
||||
? 1
|
||||
: device["bits"] | (1 << ((device["type"] == "paver" ? 2 : 1) - 2));
|
||||
device["point"] = point;
|
||||
}
|
||||
//bug
|
||||
//websocket
|
||||
// if(isLive ==true&&devicState.timer==null){
|
||||
// //设置了一个定时器
|
||||
// }
|
||||
}
|
||||
|
||||
//读取颜色
|
||||
// initPalette() async {
|
||||
// var data = await GetServices().getLayeConfig();
|
||||
// for (var i = 0; i < data.length; i++) {
|
||||
// if (data[i]['name'] == "times_draw") {
|
||||
// data[i] = filterAndResolveModel(data[i]);
|
||||
// }
|
||||
// data[i] = FormatColor(data[i]);
|
||||
// if (data[i]['type'] == 'layer' && data[i]["standard"] != null) {
|
||||
// data[i] = BubbleSort(data[i]);
|
||||
// }
|
||||
// }
|
||||
// palette = data[0]["color"];
|
||||
|
||||
// //给调色板赋值
|
||||
// for (int i = 0; i < palette.length; i++) {
|
||||
// passTrackPlugin.setPalette(i, changeARGBInt8toInt32(palette[i]));
|
||||
// }
|
||||
// // print(palette);
|
||||
// // print(palette.length);
|
||||
// //如果是cumulate类型还要对颜色进行扩充
|
||||
// }
|
||||
|
||||
List liveData = [];
|
||||
bool isLive = false;
|
||||
var devicState;
|
||||
num centerTid = 0;
|
||||
// 是否结束播放
|
||||
bool end = true;
|
||||
var sportsData;
|
||||
num angle = 0;
|
||||
// 中心设备的编号
|
||||
var centerDevice = null;
|
||||
bool isCenter = false;
|
||||
//是否平移
|
||||
bool isTranslate = false;
|
||||
// 正北模式
|
||||
bool isView = false;
|
||||
int? startIndex;
|
||||
int? endIndex;
|
||||
//websocket
|
||||
liveView(bool isLive, String wsHost, String proj_code) {
|
||||
String token = "";
|
||||
String ws_url = wsHost + "?token=" + token;
|
||||
final _channel = IOWebSocketChannel.connect(ws_url);
|
||||
String? message;
|
||||
//发送消息
|
||||
_channel.sink.add(jsonEncode(["ProjSubscribe", "cp_road", proj_code]));
|
||||
_channel.stream.listen((message) {
|
||||
//检查收到数据
|
||||
List data = json.decode(message);
|
||||
if (data[0] == "ProjSubAck") {
|
||||
//如果响应的数据不正确,重新发送信息
|
||||
if (proj_code != data[2]) {
|
||||
_channel.sink
|
||||
.add(jsonEncode(["ProjSubscribe", "cp_road", proj_code]));
|
||||
}
|
||||
//bug,这里应该还有些操作
|
||||
//绘制设备,绘制数据,
|
||||
} else if (data[0] == "cp_roadPublish") {
|
||||
if (proj_code != data[2]) {}
|
||||
var row = data[3];
|
||||
row.obj = DecodeDataObj.fromBase64(row.data);
|
||||
row.TID = num.parse(row.TID);
|
||||
liveData.add(row);
|
||||
recivePoint(row);
|
||||
updateDevices(row);
|
||||
//有tid,以当前设备为中心
|
||||
if (centerTid != 0 && row.TID == centerTid) {
|
||||
//bug
|
||||
//这里申请地址,创建一个point传给c++
|
||||
// passTrackPlugin.passTrack_fullMap_updateCenter(point);
|
||||
drawCtx.setCenter(row.obj);
|
||||
}
|
||||
//如果该点不符合要求直接return
|
||||
if (!filterPoint(null, null).isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
if (end && isLive) {
|
||||
var socketInfo;
|
||||
sportsData.addAll(liveData);
|
||||
liveData.clear();
|
||||
if (angle == 0) {
|
||||
angle = pi / 2 - row.obj.rad;
|
||||
socketInfo.rotate = (180 / pi) * angle;
|
||||
socketInfo.TP = row.TP;
|
||||
socketInfo.speed = row.speed;
|
||||
socketInfo.LAT = row.LAT;
|
||||
socketInfo.LNG = row.LNG;
|
||||
} else if (row.bits == centerDevice) {
|
||||
angle = pi / 2 - row.obj.rad;
|
||||
socketInfo.rotate = (180 / pi) * angle;
|
||||
socketInfo.TP = row.TP;
|
||||
socketInfo.speed = row.speed;
|
||||
socketInfo.LAT = row.LAT;
|
||||
socketInfo.LNG = row.LNG;
|
||||
if (isCenter) {
|
||||
backCenter();
|
||||
}
|
||||
}
|
||||
socketInfo.count = row.count;
|
||||
// this.eventObject['socketing']?.call(this, socketInfo);
|
||||
}
|
||||
if (!this.isTranslate) {
|
||||
//bug 局部重绘
|
||||
// this.fillAndDrawImageData(false, row);
|
||||
if (isView || !centerDevice) {
|
||||
//bug
|
||||
// centerDevice=
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
recivePoint(var point) {
|
||||
if (drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
|
||||
//dart重置中心
|
||||
drawCtx.setCenter(point);
|
||||
//bug
|
||||
//c++重置中心
|
||||
ffi.Pointer<Binding.Point> pointer =
|
||||
calloc.allocate<Binding.Point>(ffi.sizeOf<Binding.Point>());
|
||||
// pointer.ref.x
|
||||
// passTrackPlugin.playTrack(
|
||||
// true, false, false, 0, -1, pointer);
|
||||
calloc.free(pointer);
|
||||
}
|
||||
//bug
|
||||
//这里要申请地址,然后把point传给c++
|
||||
// passTrackPlugin.passTrack_fullMap_addPoint(point);
|
||||
// passTrackPlugin.passTrack_drawFullScreen(true);
|
||||
//这是c++addpoint后的返回值
|
||||
bool isSucceed = true;
|
||||
if (isSucceed) {
|
||||
isCenter = true;
|
||||
} else {
|
||||
isCenter = false;
|
||||
}
|
||||
}
|
||||
|
||||
//返回中心坐标
|
||||
backCenter() {
|
||||
//bug
|
||||
//应该可以和刷新一样
|
||||
}
|
||||
|
||||
drawSection(int startIndex, int endIndex, bool isCenter) {
|
||||
if (endIndex > allPointData.length) {
|
||||
return;
|
||||
}
|
||||
if (isCenter) {
|
||||
filterPoint(startIndex, endIndex);
|
||||
} else {}
|
||||
}
|
||||
|
||||
// drawSection(int startIndex, int endIndex, bool isCenter) {
|
||||
// if (startIndex < 0 && endIndex < 0) {
|
||||
// return;
|
||||
// }
|
||||
// //清空屏幕
|
||||
// //bug
|
||||
// // this.ctx.clearRect(0, 0, this.width, this.height);
|
||||
// // this.global.data.fill(0);
|
||||
// updateDeviceVisible();
|
||||
// if (isCenter || drawCtx.zeroDX == 0 || drawCtx.zeroDY == 0) {
|
||||
// if (sportsData[endIndex]["obj"] != null) {
|
||||
// double ox = sportsData[endIndex]["obj"]["x"];
|
||||
// double oy = sportsData[endIndex]["obj"]["y"];
|
||||
|
||||
// num x = ((ox / drawCtx.scale - drawCtx.screenSize.width / 2) -
|
||||
// drawCtx.zeroDX)
|
||||
// .floor()
|
||||
// .abs();
|
||||
// num y = ((oy / drawCtx.scale - drawCtx.screenSize.height / 2) -
|
||||
// drawCtx.zeroDY)
|
||||
// .floor()
|
||||
// .abs();
|
||||
// if (x >= drawCtx.screenSize.width / 2 ||
|
||||
// y >= drawCtx.screenSize.height / 2) {
|
||||
// drawCtx.zeroX = ox;
|
||||
// drawCtx.zeroY = oy;
|
||||
// drawCtx.setCenter(null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// reciveAndFilterPoint(startIndex, endIndex);
|
||||
// //绘制全屏
|
||||
// // this.fillAndDrawImageData(true);
|
||||
// //绘制网格
|
||||
// // this.drawGrid();
|
||||
// //绘制道路边线
|
||||
// // this.drawSideLine(this.roadData);
|
||||
// //获取设备
|
||||
// // let arr = this.getDeviceData();
|
||||
// //绘制设备
|
||||
// // this.drawDevice(arr);
|
||||
// endIndex = endIndex;
|
||||
// startIndex = startIndex;
|
||||
// //监听当前视图状态 播放进度
|
||||
// // this.viewStatus(false);
|
||||
// // this.isPlay = false;
|
||||
// }
|
||||
|
||||
// //筛选出需要绘制的设备
|
||||
// updateDeviceVisible() {
|
||||
// for (int i = 0; i < deviceList.length; i++) {
|
||||
// if (deviceList[i] != null) {
|
||||
// deviceList[i]["show"] = true;
|
||||
// } else {
|
||||
// deviceList[i]["show"] = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// reciveAndFilterPoint(int startIndex, int endIndex) {
|
||||
// if (endIndex == -1) {
|
||||
// endIndex = sportsData.length - 1;
|
||||
// }
|
||||
// for (int i = startIndex; i <= endIndex; i++) {
|
||||
// var isDraw = filterPoint(sportsData[i]);
|
||||
// if (isDraw) {
|
||||
// recivePoint(sportsData[i]);
|
||||
// updateDevices(sportsData[i]);
|
||||
// // this.allowDLPI = index;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//将后端的rgba转换成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;
|
||||
}
|
@ -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,28 +26,28 @@ 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<PassTrack> createState() => _PasstrackState();
|
||||
State<PassTrackWidget> createState() => _PasstrackState();
|
||||
}
|
||||
|
||||
class _PasstrackState extends State<PassTrack> {
|
||||
class _PasstrackState extends State<PassTrackWidget> {
|
||||
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
|
||||
GlobalKey<PopupMenuButtonState<int>>();
|
||||
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
||||
String str = "播放";
|
||||
int sWidth = 0;
|
||||
int bits = -1;
|
||||
int speed = 50;
|
||||
List<int> speedList = [1, 2, 10, 20, 50, 100, 200, 500];
|
||||
int maxLength = 200;
|
||||
// int maxLength = 200;
|
||||
SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0);
|
||||
|
||||
final _passTrackPlugin = PassTrack();
|
||||
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
@ -76,25 +80,30 @@ class _PasstrackState extends State<PassTrack> {
|
||||
// }
|
||||
// });
|
||||
});
|
||||
initPlatformState();
|
||||
controller.getHisFileList(_passTrackPlugin);
|
||||
_passTrackPlugin.generateTile(0, controller.allLen);
|
||||
_passTrackPlugin.waitForTile();
|
||||
_passTrackPlugin.playTrack(0, controller.allLen, true, 0, ffi.nullptr);
|
||||
}
|
||||
|
||||
Future<void> initPlatformState() async {
|
||||
// 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
|
||||
@ -118,7 +127,8 @@ class _PasstrackState extends State<PassTrack> {
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: SfRangeSlider(
|
||||
min: 0.0,
|
||||
max: maxLength,
|
||||
// max: maxLength,
|
||||
max: controller.allLen,
|
||||
values: _rangevalues,
|
||||
showTicks: false,
|
||||
showLabels: false,
|
||||
|
@ -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<String, String> 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
|
||||
|
@ -1,155 +1,80 @@
|
||||
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'];
|
||||
}
|
||||
|
||||
getRcordList(String date, String? dateEnd) async {
|
||||
dateEnd ??= date;
|
||||
Map res = await service.getClient(
|
||||
"/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
|
||||
return res['data'];
|
||||
}
|
||||
|
||||
//获取施工记录的日期
|
||||
getworkDateData() async {
|
||||
Map res = await service.getClient(
|
||||
"/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid");
|
||||
if (res['code'] == 1000) {
|
||||
return res['data'] ?? [];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
//施工详细记录
|
||||
getProcessData(int pileId) async {
|
||||
Map res = await service.getClient(
|
||||
"/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid");
|
||||
return res['data'];
|
||||
}
|
||||
}
|
||||
|
||||
class GetServices {
|
||||
BaseService service = BaseService();
|
||||
// String projCode = 'CJGKJEBYYB';
|
||||
// int tid = 109;
|
||||
// String projType = "hydraulic_tamping";
|
||||
String projCode = 'TEST';
|
||||
int tid = 1000;
|
||||
String projType = "pile_cm";
|
||||
// 道路边线
|
||||
Future getSideLine() async {
|
||||
try {
|
||||
Map res = await service.getClient(
|
||||
'/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType');
|
||||
return res['data'];
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// 设备绑定 --- 获取设备
|
||||
Future getDeviceBind() async {
|
||||
Map res = await service.getClient(
|
||||
'/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode');
|
||||
return res['data'];
|
||||
}
|
||||
|
||||
// 项目列表
|
||||
getproject() async {
|
||||
Map res = await service
|
||||
.getClient('/api/sys/project/list?org_code=a&proj_type=$projType');
|
||||
return res['data'];
|
||||
}
|
||||
|
||||
// 液压夯
|
||||
getRcordData(int page, int size, String date,
|
||||
[String sort = "desc", String order = "tp_id"]) async {
|
||||
Map res = await service.getClient(
|
||||
"/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order");
|
||||
return res['data'];
|
||||
}
|
||||
|
||||
//获取水泥搅拌桩点数据
|
||||
// class PileCmController {
|
||||
// //获取水泥搅拌桩点数据
|
||||
// getRcordData(int page, int size, String date,
|
||||
// [String sort = "desc", String order = "pile_id"]) async {
|
||||
// Map res = await service.getClient(
|
||||
@ -163,82 +88,157 @@ class GetServices {
|
||||
// "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd");
|
||||
// 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;
|
||||
}
|
||||
// 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 {};
|
||||
// }
|
||||
// }
|
||||
|
||||
// 手机号登录
|
||||
phoneLogin(String phone, String smsCode) async {
|
||||
Map res = await service.postClient(
|
||||
"/admin/base/open/phone", {"phone": phone, "smsCode": smsCode});
|
||||
return res;
|
||||
}
|
||||
// // 设备绑定 --- 获取设备
|
||||
// Future getDeviceBind() async {
|
||||
// Map res = await service.getClient(
|
||||
// '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode');
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// 获取用户信息
|
||||
getPerson() async {
|
||||
Map res = await service.getClient("/admin/base/comm/person");
|
||||
return res['data'];
|
||||
}
|
||||
// // 项目列表
|
||||
// getproject() async {
|
||||
// Map res = await service
|
||||
// .getClient('/api/sys/project/list?org_code=a&proj_type=$projType');
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// 验证码
|
||||
getCaptcha() async {
|
||||
Map res =
|
||||
await service.getClient("/admin/base/open/captcha?height=40&width=150");
|
||||
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'];
|
||||
// }
|
||||
|
||||
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;
|
||||
}
|
||||
// //获取水泥搅拌桩点数据
|
||||
// // 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'];
|
||||
// // }
|
||||
|
||||
getRtuLast() async {
|
||||
Map res = await service.getClient(
|
||||
"/api/t2n/rtu/rtu_last?proj_type=$projType&proj_code=$projCode");
|
||||
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 [];
|
||||
// }
|
||||
// }
|
||||
|
||||
getCoordTrans() async {
|
||||
Map res = await service.getClient(
|
||||
"/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode");
|
||||
return res['data'];
|
||||
}
|
||||
}
|
||||
// //获取施工记录的日期
|
||||
// getworkDateData() async {
|
||||
// Map res = await service.getClient(
|
||||
// "/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid");
|
||||
// if (res['code'] == 1000) {
|
||||
// return res['data'] ?? [];
|
||||
// } else {
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// //施工详细记录
|
||||
// getProcessData(int pileId) async {
|
||||
// Map res = await service.getClient(
|
||||
// "/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid");
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// // 验证码
|
||||
// getsmsCode(String phone) async {
|
||||
// Map res =
|
||||
// await service.postClient("/admin/base/open/smsCode", {"phone": phone});
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// // 手机号登录
|
||||
// phoneLogin(String phone, String smsCode) async {
|
||||
// Map res = await service.postClient(
|
||||
// "/admin/base/open/phone", {"phone": phone, "smsCode": smsCode});
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// // 获取用户信息
|
||||
// getPerson() async {
|
||||
// Map res = await service.getClient("/admin/base/comm/person");
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// // 验证码
|
||||
// getCaptcha() async {
|
||||
// Map res =
|
||||
// await service.getClient("/admin/base/open/captcha?height=40&width=150");
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// getAccountLogin(String captchaId, String password, String username,
|
||||
// String verifyCode) async {
|
||||
// Map res = await service.postClient("/admin/base/open/login", {
|
||||
// "captchaId": captchaId,
|
||||
// "password": password,
|
||||
// "username": username,
|
||||
// "verifyCode": verifyCode
|
||||
// });
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// getRtuLast() async {
|
||||
// Map res = await service.getClient(
|
||||
// "/api/t2n/rtu/rtu_last?proj_type=$projType&proj_code=$projCode");
|
||||
// return res['data'];
|
||||
// }
|
||||
|
||||
// getCoordTrans() async {
|
||||
// Map res = await service.getClient(
|
||||
// "/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode");
|
||||
// return res['data'];
|
||||
// }
|
||||
// }
|
||||
|
24
pubspec.lock
24
pubspec.lock
@ -355,18 +355,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_core
|
||||
sha256: "038390d6f633368dc306c250877f93d2e3932de58a781945a3b7ed10c4df5171"
|
||||
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"
|
||||
sha256: "5811b5c6a03f4f23928ce970cb537e5c6bcded5145715a5394ba1b21e805c207"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "26.2.12"
|
||||
version: "26.2.13"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -439,6 +439,22 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket
|
||||
sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.6"
|
||||
web_socket_channel:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: web_socket_channel
|
||||
sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user