|
@@ -1,3 +1,4 @@
|
|
|
+import 'package:fis_measure/interfaces/date_types/vector.dart';
|
|
|
import 'package:fis_measure/interfaces/process/calculators/values.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/terms.dart';
|
|
|
import 'package:fis_measure/process/calcuators/formulas/urology.dart';
|
|
@@ -92,3 +93,86 @@ class TwoDistanceVolumeCal extends Calculator<TwoStraightLine, double> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class TwoDistanceSumCal extends Calculator<TwoStraightLine, double> {
|
|
|
+ TwoDistanceSumCal(TwoStraightLine ref) : super(ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ if (ref.feature == null) return;
|
|
|
+
|
|
|
+ final f1 = findChildFeature(ref.child1);
|
|
|
+ final f2 = findChildFeature(ref.child2);
|
|
|
+ if (f1 == null || f2 == null) return;
|
|
|
+
|
|
|
+ final feature = ref.feature!;
|
|
|
+
|
|
|
+ final val1 = f1.value?.pickFloat() ?? 0;
|
|
|
+ final val2 = f2.value?.pickFloat() ?? 0;
|
|
|
+
|
|
|
+ var unitY = f1.hostVisualArea!.viewport!.yUnit;
|
|
|
+ if (unitY == VidUsUnit.None) {
|
|
|
+ if (f1.value != null) {
|
|
|
+ unitY = f1.value!.unit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var ouput in ref.meta.outputs) {
|
|
|
+ if (ouput.name == MeasureTerms.Distance) {
|
|
|
+ var dis = val1 + val2;
|
|
|
+ feature.updateFloatValue(
|
|
|
+ ouput,
|
|
|
+ roundDouble(dis, ouput.fractionalDigits),
|
|
|
+ unitY,
|
|
|
+ );
|
|
|
+ } else if (ouput.name == MeasureTerms.AvgDistance) {
|
|
|
+ double avg = (val1 + val2) / 2;
|
|
|
+ feature.updateFloatValue(
|
|
|
+ ouput,
|
|
|
+ roundDouble(avg, ouput.fractionalDigits),
|
|
|
+ unitY,
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class TwoStraightLineAngleCal extends Calculator<TwoStraightLine, double> {
|
|
|
+ TwoStraightLineAngleCal(TwoStraightLine ref) : super(ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ if (ref.feature == null) return;
|
|
|
+
|
|
|
+ final f1 = findChildFeature(ref.child1);
|
|
|
+ final f2 = findChildFeature(ref.child2);
|
|
|
+ if (f1 == null || f2 == null) return;
|
|
|
+
|
|
|
+ if (f1.innerPoints.length == f2.innerPoints.length) {
|
|
|
+ var l1 = f1.innerPoints[0] - f1.innerPoints[1];
|
|
|
+ var l2 = f2.innerPoints[0] - f2.innerPoints[1];
|
|
|
+ var value = (DVector.angleBetween(l1, l2)).abs();
|
|
|
+ updateFloatValue(value, unit: VidUsUnit.degree, useRound: true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class IvsThckCal extends Calculator<TwoStraightLine, double> {
|
|
|
+ IvsThckCal(TwoStraightLine ref) : super(ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ if (ref.feature == null) return;
|
|
|
+
|
|
|
+ final len1 = pickChildFloatValue(ref.child1) ?? 0;
|
|
|
+ final len2 = pickChildFloatValue(ref.child2) ?? 0;
|
|
|
+ final ivs = calcIvs(len1, len2);
|
|
|
+ updateFloatValue(ivs, unit: VidUsUnit.percent, useRound: true);
|
|
|
+ }
|
|
|
+
|
|
|
+ static double calcIvs(double ivsd, double ivss) {
|
|
|
+ if (ivsd == 0) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return (ivss - ivsd) / ivsd * 100;
|
|
|
+ }
|
|
|
+}
|