|
@@ -5,15 +5,17 @@ import 'package:fis_common/logger/logger.dart';
|
|
|
import 'package:fis_jsonrpc/rpc.dart';
|
|
|
import 'package:fis_measure/interfaces/date_types/point.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/types.dart';
|
|
|
-import 'package:fis_measure/process/primitives/urm.dart';
|
|
|
+import 'package:fis_measure/process/primitives/location.dart';
|
|
|
+import 'package:fis_measure/process/primitives/straightline.dart';
|
|
|
+import 'package:fis_measure/process/primitives/urm_rect.dart';
|
|
|
import 'package:fis_measure/process/workspace/rpc_bridge.dart';
|
|
|
import 'package:fis_measure/process/workspace/urm/application.dart';
|
|
|
import 'package:vid/us/vid_us_unit.dart';
|
|
|
|
|
|
import 'calculator.dart';
|
|
|
|
|
|
-class URMCal extends Calculator<URMMeasure, double> {
|
|
|
- URMCal(URMMeasure ref, this.type) : super(ref);
|
|
|
+class URMCal extends Calculator<URMRect, double> {
|
|
|
+ URMCal(URMRect ref, this.type) : super(ref);
|
|
|
String type = '';
|
|
|
@override
|
|
|
void calculate() {
|
|
@@ -55,42 +57,43 @@ class URMCal extends Calculator<URMMeasure, double> {
|
|
|
/// [URM] ✅在此处通知 Server 计算,获取 description
|
|
|
switch (type) {
|
|
|
case MeasureTypes.SRCurvature:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRCurvatureResult(startPoint, endPoint);
|
|
|
break;
|
|
|
case MeasureTypes.SRRoiDensity:
|
|
|
- getSRCurvatureResult(startPoint, endPoint);
|
|
|
+ getSRRoiDensityResult(startPoint, endPoint);
|
|
|
break;
|
|
|
case MeasureTypes.SRRoiFractalDim:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRRoiFractalDimResult(startPoint, endPoint);
|
|
|
break;
|
|
|
case MeasureTypes.SRTraceDensity:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRTraceDensityResult([startPoint, endPoint]);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
case MeasureTypes.SRTraceFD:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRTraceFDResult([startPoint, endPoint]);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
case MeasureTypes.SRLoactionVel:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRLoactionVelResult(startPoint);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
case MeasureTypes.SRRoiVel:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getSRRoiVelResult(startPoint, endPoint);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
case MeasureTypes.URMDensityMeasure:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getURMDensityMeasureResult(startPoint, endPoint);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
case MeasureTypes.URMVelMeasure:
|
|
|
- callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.VesselDiameter:
|
|
|
- callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.VesselDistance:
|
|
|
- callServerMethodToGetResult();
|
|
|
+ getURMVelMeasureResult(startPoint, endPoint);
|
|
|
+ // callServerMethodToGetResult();
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // URM 测量项 1
|
|
|
void getSRCurvatureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
bool success = false;
|
|
|
String description = "URM\n Measuring";
|
|
@@ -102,11 +105,146 @@ class URMCal extends Calculator<URMMeasure, double> {
|
|
|
description = " ";
|
|
|
return;
|
|
|
}
|
|
|
- print("URM Measure leftTopPoint: $startPoint");
|
|
|
- print("URM Measure rightBottomPoint: $endPoint");
|
|
|
description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
updateStringValue(description);
|
|
|
- // updateFloatValue(12.34567, unit: VidUsUnit.mm, useRound: true);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 2
|
|
|
+ void getSRRoiDensityResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 3
|
|
|
+ void getSRRoiFractalDimResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 4
|
|
|
+ void getSRTraceDensityResult(List<DPoint> points) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 5
|
|
|
+ void getSRTraceFDResult(List<DPoint> points) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 6
|
|
|
+ void getSRLoactionVelResult(
|
|
|
+ DPoint point,
|
|
|
+ ) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 7
|
|
|
+ void getSRRoiVelResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 8
|
|
|
+ void getURMDensityMeasureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 9
|
|
|
+ void getURMVelMeasureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
|
|
@@ -147,3 +285,107 @@ class URMCal extends Calculator<URMMeasure, double> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class URMLocationCal extends Calculator<Location, double> {
|
|
|
+ URMLocationCal(Location ref) : super(ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ if (ref.feature == null) return;
|
|
|
+ Size urmResultSize = const Size(0, 0);
|
|
|
+ try {
|
|
|
+ if (ref.application is! URMApplication) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ final URMApplication urmApplication = ref.application as URMApplication;
|
|
|
+ urmResultSize = Size(urmApplication.resultWidth.toDouble(),
|
|
|
+ urmApplication.resultHeight.toDouble());
|
|
|
+ // urmResultWidth = urmApplication.resultWidth;
|
|
|
+ // urmResultHeight = urmApplication.resultHeight;
|
|
|
+ } catch (e) {
|
|
|
+ logger.e('URM Measure error: $e');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ final point = ref.feature!.point.clone();
|
|
|
+ final startPoint = point.scale2Size(urmResultSize);
|
|
|
+ print("URM Measure startPoint: $startPoint");
|
|
|
+ getSRLoactionVelResult(startPoint);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 6
|
|
|
+ void getSRLoactionVelResult(
|
|
|
+ DPoint point,
|
|
|
+ ) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ print("调接口获取测量值");
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class URMStraightLineCal extends Calculator<StraightLine, double> {
|
|
|
+ URMStraightLineCal(StraightLine ref) : super(ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ if (ref.feature == null) return;
|
|
|
+ Size urmResultSize = const Size(0, 0);
|
|
|
+ try {
|
|
|
+ if (ref.application is! URMApplication) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ final URMApplication urmApplication = ref.application as URMApplication;
|
|
|
+ urmResultSize = Size(urmApplication.resultWidth.toDouble(),
|
|
|
+ urmApplication.resultHeight.toDouble());
|
|
|
+ // urmResultWidth = urmApplication.resultWidth;
|
|
|
+ // urmResultHeight = urmApplication.resultHeight;
|
|
|
+ } catch (e) {
|
|
|
+ logger.e('URM Measure error: $e');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ final p1 = ref.feature!.startPoint;
|
|
|
+ final p2 = ref.feature!.endPoint;
|
|
|
+ //左上顶点
|
|
|
+ final leftTopPercent =
|
|
|
+ DPoint(p1.x < p2.x ? p1.x : p2.x, p1.y < p2.y ? p1.y : p2.y);
|
|
|
+ //右下顶点
|
|
|
+ final rightBottomPercent =
|
|
|
+ DPoint(p1.x > p2.x ? p1.x : p2.x, p1.y > p2.y ? p1.y : p2.y);
|
|
|
+ //画布尺寸
|
|
|
+ final canavsSize = ref.application.displaySize;
|
|
|
+
|
|
|
+ final startPoint = leftTopPercent.scale2Size(urmResultSize);
|
|
|
+ final endPoint = rightBottomPercent.scale2Size(urmResultSize);
|
|
|
+
|
|
|
+ getSRCurvatureResult(startPoint, endPoint);
|
|
|
+ }
|
|
|
+
|
|
|
+ // URM 测量项 1
|
|
|
+ void getSRCurvatureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
+ bool success = false;
|
|
|
+ String description = "URM\n Measuring";
|
|
|
+ try {
|
|
|
+ // TODO 换成真实接口
|
|
|
+ // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ print("调接口获取测量值");
|
|
|
+ } catch (e) {
|
|
|
+ success = false;
|
|
|
+ description = " ";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
+ updateStringValue(description);
|
|
|
+ ref.application.updateRenderReady.emit(this, null);
|
|
|
+ }
|
|
|
+}
|