|
@@ -1,11 +1,13 @@
|
|
|
+import 'package:fis_measure/interfaces/enums/items.dart';
|
|
|
import 'package:fis_measure/interfaces/process/calculators/values.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/item.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/item_metas.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/terms.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/workspace/point_info.dart';
|
|
|
import 'package:fis_measure/process/calcuators/rvsp.dart';
|
|
|
+import 'package:fis_measure/process/calcuators/velocity.dart';
|
|
|
import 'package:fis_measure/process/items/top_item.dart';
|
|
|
import 'package:fis_measure/process/items/top_item_feature.dart';
|
|
|
-import 'package:fis_measure/process/primitives/empty.dart';
|
|
|
import 'package:vid/us/vid_us_unit.dart';
|
|
|
|
|
|
import 'location.dart';
|
|
@@ -18,21 +20,14 @@ class Rvsp extends TopMeasureItem<RvspFeature> {
|
|
|
|
|
|
Rvsp(super.meta) {
|
|
|
final tRVmaxMeta = meta.getChildByName(tRVmaxKey)!;
|
|
|
- tRVmax = Location.createVelocity(tRVmaxMeta, this);
|
|
|
+ tRVmax = _TRVmaxLocation(tRVmaxMeta, this);
|
|
|
+ tRVmax.calculator = VelocityCal(tRVmax);
|
|
|
childItems.add(tRVmax);
|
|
|
|
|
|
final rapOutputMeta =
|
|
|
ItemOutputMeta(MeasureTerms.RAP, "RAP", VidUsUnit.mmHg);
|
|
|
|
|
|
_rap = FloatValue(rapOutputMeta, 0.0, rapOutputMeta.unit);
|
|
|
- // final rapMeta = ItemMeta(
|
|
|
- // MeasureTerms.RAP,
|
|
|
- // measureType: MeasureTerms.Placeholder,
|
|
|
- // description: "RAP",
|
|
|
- // outputs: [rapOutputMeta],
|
|
|
- // );
|
|
|
- // final rapPlaceholder = Empty.createEmpty(rapMeta, this);
|
|
|
- // childItems.add(rapPlaceholder);
|
|
|
}
|
|
|
|
|
|
FloatValue get rap => _rap;
|
|
@@ -46,6 +41,28 @@ class Rvsp extends TopMeasureItem<RvspFeature> {
|
|
|
@override
|
|
|
RvspFeature buildFeature() => RvspFeature(this);
|
|
|
|
|
|
+ @override
|
|
|
+ bool onExecuteMouse(PointInfo args) {
|
|
|
+ if (feature == null) {
|
|
|
+ feature = buildFeature();
|
|
|
+ listenChildrenUpdate();
|
|
|
+ }
|
|
|
+ if (args.pointType == PointInfoType.mouseDown) {
|
|
|
+ if (childrenAllDone) {
|
|
|
+ workingChild.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ feature?.hostVisualArea = args.hostVisualArea;
|
|
|
+ if (!childrenAllDone) {
|
|
|
+ final result = workingChild.execute(args);
|
|
|
+ if (result) {
|
|
|
+ doCalculate();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
void updateRap(double val) {
|
|
|
_rap.value = val;
|
|
|
calculator?.calculate();
|
|
@@ -67,3 +84,28 @@ class RvspFeature extends TopMeasureItemFeature {
|
|
|
ITopMeasureItem refItem,
|
|
|
) : super(refItem);
|
|
|
}
|
|
|
+
|
|
|
+class _TRVmaxLocation extends Location {
|
|
|
+ _TRVmaxLocation(super.meta, super.parent);
|
|
|
+
|
|
|
+ @override
|
|
|
+ bool onExecuteMouse(PointInfo args) {
|
|
|
+ if (state == ItemStates.finished || state == ItemStates.waiting) {
|
|
|
+ if (args.pointType == PointInfoType.mouseDown) {
|
|
|
+ measuredFeatures.clear();
|
|
|
+ } else if (args.pointType == PointInfoType.mouseMove) {
|
|
|
+ handleMouseMoveWhileFinish(args);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (state == ItemStates.running) {
|
|
|
+ if (args.pointType == PointInfoType.mouseUp) return false;
|
|
|
+
|
|
|
+ feature?.point = args;
|
|
|
+ doCalculate();
|
|
|
+ if (args.pointType == PointInfoType.mouseDown) {
|
|
|
+ doFeatureFinish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|