|
@@ -1,7 +1,10 @@
|
|
|
+import 'package:fis_common/index.dart';
|
|
|
import 'package:fis_measure/interfaces/process/calculators/output.dart';
|
|
|
import 'package:fis_measure/interfaces/process/calculators/values.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/items/item_metas.dart';
|
|
|
import 'package:fis_measure/process/calcuators/formulas/general.dart';
|
|
|
import 'package:fis_measure/process/items/item.dart';
|
|
|
+import 'package:fis_measure/process/primitives/combos/sv.dart';
|
|
|
import 'package:fis_measure/process/primitives/combos/two_area.dart';
|
|
|
import 'package:fis_measure/process/primitives/combos/two_length.dart';
|
|
|
import 'package:fis_measure/process/primitives/trace.dart';
|
|
@@ -43,7 +46,71 @@ class ABRatioCal extends Calculator<TwoLengthAbstract, double> {
|
|
|
value = item.feature!.value;
|
|
|
}
|
|
|
if (value != null) {
|
|
|
- return (value as FloatValue).value ?? 0;
|
|
|
+ if (value is FloatValue) {
|
|
|
+ return value.value ?? 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class QpQsCal extends ABRatioCal {
|
|
|
+ QpQsCal(super.ref);
|
|
|
+
|
|
|
+ @override
|
|
|
+ void calculate() {
|
|
|
+ final mianVal = _getQpQsValue();
|
|
|
+ if (mianVal == null) {
|
|
|
+ updateStringValue("");
|
|
|
+ }
|
|
|
+
|
|
|
+ super.calculate();
|
|
|
+
|
|
|
+ if (ref.feature == null) return;
|
|
|
+
|
|
|
+ final feature = ref.feature!;
|
|
|
+
|
|
|
+ final qp = ref.child1 as Sv;
|
|
|
+ final qs = ref.child2 as Sv;
|
|
|
+ final qpValues = qp.feature?.values;
|
|
|
+ final qsValues = qs.feature?.values;
|
|
|
+
|
|
|
+ if (qpValues != null) {
|
|
|
+ for (var val in qpValues) {
|
|
|
+ if (val.name != qp.meta.name) {
|
|
|
+ if (val is FloatValue) {
|
|
|
+ final meta = val.meta;
|
|
|
+ final output = ItemOutputMeta(
|
|
|
+ "${meta.name}(ROVT)", meta.description, meta.unit);
|
|
|
+ feature.updateFloatValue(output, val.value!, val.unit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (qsValues != null) {
|
|
|
+ for (var val in qsValues) {
|
|
|
+ if (val.name != qs.meta.name) {
|
|
|
+ if (val is FloatValue) {
|
|
|
+ final meta = val.meta;
|
|
|
+ final output = ItemOutputMeta(
|
|
|
+ "${meta.name}(LOVT)", meta.description, meta.unit);
|
|
|
+ feature.updateFloatValue(output, val.value!, val.unit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ValueBase? _getQpQsValue() {
|
|
|
+ final values = ref.feature?.values;
|
|
|
+ if (values == null || values.isEmpty) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ final matchValue =
|
|
|
+ values.firstWhereNullable((e) => e.name == ref.meta.name);
|
|
|
+ if (matchValue != null && matchValue is FloatValue) {
|
|
|
+ return matchValue;
|
|
|
}
|
|
|
return null;
|
|
|
}
|