Browse Source

update(measure): support Doppler multitrace

gavin.chen 2 years ago
parent
commit
693c7243d9

+ 719 - 0
assets/items.json

@@ -1,4 +1,723 @@
 [
+    {
+        "Name": "TAMAX",
+        "Description": "Mean Vel(Max Mode)",
+        "BriefAnnotation": "",
+        "MeasureTypeName": "SemiManualTrace",
+        "Categories": [
+            "Common"
+        ],
+        "Calculator": {
+            "AvailableOutputs": [
+                {
+                    "Name": "Placeholder",
+                    "Description": "Placeholder",
+                    "Unit": 0,
+                    "IsWorking": true
+                },
+                {
+                    "Name": "TAMAX",
+                    "Description": "Mean Vel(Max Mode)",
+                    "Unit": 70,
+                    "IsWorking": true
+                },
+                {
+                    "Name": "TAMEAN",
+                    "Description": "Mean Vel(Mean Mode)",
+                    "Unit": 70
+                },
+                {
+                    "Name": "PS",
+                    "Description": "PS",
+                    "Unit": 70
+                },
+                {
+                    "Name": "ED",
+                    "Description": "ED",
+                    "Unit": 70
+                },
+                {
+                    "Name": "MD",
+                    "Description": "MD",
+                    "Unit": 70
+                },
+                {
+                    "Name": "HR",
+                    "Description": "HR",
+                    "Unit": 132
+                },
+                {
+                    "Name": "Acceleration",
+                    "Description": "Acceleration",
+                    "Unit": 80
+                },
+                {
+                    "Name": "AT",
+                    "Description": "AT",
+                    "Unit": 27
+                },
+                {
+                    "Name": "PS/ED",
+                    "Description": "PS/ED",
+                    "Unit": 0
+                },
+                {
+                    "Name": "ED/PS",
+                    "Description": "ED/PS",
+                    "Unit": 0
+                },
+                {
+                    "Name": "PI",
+                    "Description": "PI",
+                    "Unit": 0
+                },
+                {
+                    "Name": "PI(MD)",
+                    "Description": "PI(MD)",
+                    "Unit": 0
+                },
+                {
+                    "Name": "RI",
+                    "Description": "RI",
+                    "Unit": 0
+                },
+                {
+                    "Name": "RI(MD)",
+                    "Description": "RI(MD)",
+                    "Unit": 0
+                },
+                {
+                    "Name": "Max PG",
+                    "Description": "PG Rel",
+                    "Unit": 110
+                },
+                {
+                    "Name": "Vmax",
+                    "Description": "Vmax",
+                    "Unit": 70
+                },
+                {
+                    "Name": "Vmean",
+                    "Description": "Vmean",
+                    "Unit": 70
+                },
+                {
+                    "Name": "Peak PG",
+                    "Description": "Peak PG",
+                    "Unit": 110
+                },
+                {
+                    "Name": "VTI",
+                    "Description": "VTI",
+                    "Unit": 10
+                },
+                {
+                    "Name": "VTI(Mean)",
+                    "Description": "VTI(Mean)",
+                    "Unit": 10
+                },
+                {
+                    "Name": "MPG",
+                    "Description": "Mean PG(Max Mode)",
+                    "Unit": 110
+                },
+                {
+                    "Name": "MMPG",
+                    "Description": "Mean PG(Mean Mode)",
+                    "Unit": 110
+                },
+                {
+                    "Name": "Ti Env",
+                    "Description": "E. Time",
+                    "Unit": 27
+                },
+                {
+                    "Name": "Vel E",
+                    "Description": "Vel E",
+                    "Unit": 70
+                },
+                {
+                    "Name": "Vel A",
+                    "Description": "Vel A",
+                    "Unit": 70
+                },
+                {
+                    "Name": "V E/A",
+                    "Description": "V E/A",
+                    "Unit": 0
+                },
+                {
+                    "Name": "DT",
+                    "Description": "DT",
+                    "Unit": 27
+                },
+                {
+                    "Name": "PHT",
+                    "Description": "PHT",
+                    "Unit": 27
+                },
+                {
+                    "Name": "VA",
+                    "Description": "VA",
+                    "Unit": 50
+                },
+                {
+                    "Name": "A Dur",
+                    "Description": "A Dur",
+                    "Unit": 27
+                },
+                {
+                    "Name": "AT/DT",
+                    "Description": "AT/DT",
+                    "Unit": 0
+                },
+                {
+                    "Name": "AT/ET",
+                    "Description": "AT/ET",
+                    "Unit": 0
+                },
+                {
+                    "Name": "Trace",
+                    "Description": "Trace",
+                    "Unit": 0
+                }
+            ]
+        },
+        "MultiMethodItems": [
+            {
+                "Name": "Auto",
+                "Description": "Auto",
+                "IsWorking": false,
+                "ChildItems": [],
+                "Calculator": {
+                    "AvailableOutputs": [
+                        {
+                            "Name": "Placeholder",
+                            "Description": "Placeholder",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "TAMAX",
+                            "Description": "Mean Vel(Max Mode)",
+                            "Unit": 70,
+                            "IsWorking": true
+                        },
+                        {
+                            "Name": "TAMEAN",
+                            "Description": "Mean Vel(Mean Mode)",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "PS",
+                            "Description": "PS",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "ED",
+                            "Description": "ED",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "MD",
+                            "Description": "MD",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "HR",
+                            "Description": "HR",
+                            "Unit": 132
+                        },
+                        {
+                            "Name": "Acceleration",
+                            "Description": "Acceleration",
+                            "Unit": 80
+                        },
+                        {
+                            "Name": "AT",
+                            "Description": "AT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PS/ED",
+                            "Description": "PS/ED",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "ED/PS",
+                            "Description": "ED/PS",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI",
+                            "Description": "PI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI(MD)",
+                            "Description": "PI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI",
+                            "Description": "RI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI(MD)",
+                            "Description": "RI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Max PG",
+                            "Description": "PG Rel",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Vmax",
+                            "Description": "Vmax",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vmean",
+                            "Description": "Vmean",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Peak PG",
+                            "Description": "Peak PG",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "VTI",
+                            "Description": "VTI",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "VTI(Mean)",
+                            "Description": "VTI(Mean)",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "MPG",
+                            "Description": "Mean PG(Max Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "MMPG",
+                            "Description": "Mean PG(Mean Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Ti Env",
+                            "Description": "E. Time",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "AT/DT",
+                            "Description": "AT/DT",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "AT/ET",
+                            "Description": "AT/ET",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Vel E",
+                            "Description": "Vel E",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vel A",
+                            "Description": "Vel A",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "V E/A",
+                            "Description": "V E/A",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "DT",
+                            "Description": "DT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PHT",
+                            "Description": "PHT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "VA",
+                            "Description": "VA",
+                            "Unit": 50
+                        },
+                        {
+                            "Name": "A Dur",
+                            "Description": "A Dur",
+                            "Unit": 27
+                        }
+                    ]
+                },
+                "MeasureTypeName": "AutoDopplerTrace"
+            },
+            {
+                "Name": "Semiauto",
+                "Description": "Semiauto",
+                "IsWorking": false,
+                "ChildItems": [],
+                "Calculator": {
+                    "AvailableOutputs": [
+                        {
+                            "Name": "Placeholder",
+                            "Description": "Placeholder",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "TAMAX",
+                            "Description": "Mean Vel(Max Mode)",
+                            "Unit": 70,
+                            "IsWorking": true
+                        },
+                        {
+                            "Name": "TAMEAN",
+                            "Description": "Mean Vel(Mean Mode)",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "PS",
+                            "Description": "PS",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "ED",
+                            "Description": "ED",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "MD",
+                            "Description": "MD",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "HR",
+                            "Description": "HR",
+                            "Unit": 132
+                        },
+                        {
+                            "Name": "Acceleration",
+                            "Description": "Acceleration",
+                            "Unit": 80
+                        },
+                        {
+                            "Name": "AT",
+                            "Description": "AT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PS/ED",
+                            "Description": "PS/ED",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "ED/PS",
+                            "Description": "ED/PS",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI",
+                            "Description": "PI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI(MD)",
+                            "Description": "PI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI",
+                            "Description": "RI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI(MD)",
+                            "Description": "RI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Max PG",
+                            "Description": "PG Rel",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Vmax",
+                            "Description": "Vmax",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vmean",
+                            "Description": "Vmean",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Peak PG",
+                            "Description": "Peak PG",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "VTI",
+                            "Description": "VTI",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "VTI(Mean)",
+                            "Description": "VTI(Mean)",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "MPG",
+                            "Description": "Mean PG(Max Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "MMPG",
+                            "Description": "Mean PG(Mean Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Ti Env",
+                            "Description": "E. Time",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "AT/DT",
+                            "Description": "AT/DT",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "AT/ET",
+                            "Description": "AT/ET",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Vel E",
+                            "Description": "Vel E",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vel A",
+                            "Description": "Vel A",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "V E/A",
+                            "Description": "V E/A",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "DT",
+                            "Description": "DT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PHT",
+                            "Description": "PHT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "VA",
+                            "Description": "VA",
+                            "Unit": 50
+                        },
+                        {
+                            "Name": "A Dur",
+                            "Description": "A Dur",
+                            "Unit": 27
+                        }
+                    ]
+                },
+                "MeasureTypeName": "SemiautoTrace"
+            },
+            {
+                "Name": "Manual",
+                "Description": "Manual",
+                "IsWorking": true,
+                "ChildItems": [],
+                "Calculator": {
+                    "AvailableOutputs": [
+                        {
+                            "Name": "Placeholder",
+                            "Description": "Placeholder",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "TAMAX",
+                            "Description": "Mean Vel(Max Mode)",
+                            "Unit": 70,
+                            "IsWorking": true
+                        },
+                        {
+                            "Name": "TAMEAN",
+                            "Description": "Mean Vel(Mean Mode)",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "PS",
+                            "Description": "PS",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "ED",
+                            "Description": "ED",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "MD",
+                            "Description": "MD",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "HR",
+                            "Description": "HR",
+                            "Unit": 132
+                        },
+                        {
+                            "Name": "Acceleration",
+                            "Description": "Acceleration",
+                            "Unit": 80
+                        },
+                        {
+                            "Name": "AT",
+                            "Description": "AT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PS/ED",
+                            "Description": "PS/ED",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "ED/PS",
+                            "Description": "ED/PS",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI",
+                            "Description": "PI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "PI(MD)",
+                            "Description": "PI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI",
+                            "Description": "RI",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "RI(MD)",
+                            "Description": "RI(MD)",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Max PG",
+                            "Description": "PG Rel",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Vmax",
+                            "Description": "Vmax",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vmean",
+                            "Description": "Vmean",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Peak PG",
+                            "Description": "Peak PG",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "VTI",
+                            "Description": "VTI",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "VTI(Mean)",
+                            "Description": "VTI(Mean)",
+                            "Unit": 10
+                        },
+                        {
+                            "Name": "MPG",
+                            "Description": "Mean PG(Max Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "MMPG",
+                            "Description": "Mean PG(Mean Mode)",
+                            "Unit": 110
+                        },
+                        {
+                            "Name": "Ti Env",
+                            "Description": "E. Time",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "AT/DT",
+                            "Description": "AT/DT",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "AT/ET",
+                            "Description": "AT/ET",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "Vel E",
+                            "Description": "Vel E",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "Vel A",
+                            "Description": "Vel A",
+                            "Unit": 70
+                        },
+                        {
+                            "Name": "V E/A",
+                            "Description": "V E/A",
+                            "Unit": 0
+                        },
+                        {
+                            "Name": "DT",
+                            "Description": "DT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "PHT",
+                            "Description": "PHT",
+                            "Unit": 27
+                        },
+                        {
+                            "Name": "VA",
+                            "Description": "VA",
+                            "Unit": 50
+                        },
+                        {
+                            "Name": "A Dur",
+                            "Description": "A Dur",
+                            "Unit": 27
+                        }
+                    ]
+                },
+                "MeasureTypeName": "DopplerTrace"
+            }
+        ],
+        "MethodChildItems": []
+    },
     {
         "Name": "Slope",
         "Description": "Slope",

+ 5 - 2
lib/interfaces/process/items/types.dart

@@ -96,7 +96,6 @@ class MeasureTypes {
   static const TwoDistanceBase = "TwoDistanceBase";
   static const TwoVerticalDistance = "TwoVerticalDistance";
 
-  /// 残余尿
   static const ResidualUrine = "ResidualUrine";
   static const EfCube = "EfCube";
   static const EfTeich = "EfTeich";
@@ -105,8 +104,12 @@ class MeasureTypes {
   static const MVcf = "MVcf";
   static const Ef = "Ef";
   static const FS = "FS";
-/* Two StraightLine  [end] */
+  /* Two StraightLine  [end] */
 
   static const TimeSpan = "TimeSpan";
   static const Slope = "Slope";
+
+  /* Doppler */
+  static const SemiManualTrace = "SemiManualTrace";
+  static const DopplerTrace = "DopplerTrace";
 }

+ 2 - 0
lib/measure_page_test.dart

@@ -368,6 +368,7 @@ class _MeasureLeftBoardState extends State<_MeasureLeftBoard> {
     MeasureTerms.Stenosis,
     MeasureTerms.AbRatio,
     MeasureTerms.Slope,
+    MeasureTerms.TAMAX,
     "Qp/Qs",
   ];
 
@@ -410,6 +411,7 @@ class _MeasureLeftBoardState extends State<_MeasureLeftBoard> {
       final item = ItemMetaConverter(dto).output();
       workingItems.add(item);
     }
+    print("workingItems: ${workingItems.length}");
   }
 
   void _visualAreaChanged(sender, IVisualArea e) {

+ 3 - 0
lib/process/items/factory.dart

@@ -9,6 +9,7 @@ import 'package:fis_measure/process/primitives/combos/two_area.dart';
 import 'package:fis_measure/process/primitives/combos/two_straightline.dart';
 import 'package:fis_measure/process/primitives/ellipse.dart';
 import 'package:fis_measure/process/primitives/location.dart';
+import 'package:fis_measure/process/primitives/multi_method/multiple_trace.dart';
 import 'package:fis_measure/process/primitives/polyline.dart';
 import 'package:fis_measure/process/primitives/polyline_angle.dart';
 import 'package:fis_measure/process/primitives/ray.dart';
@@ -113,6 +114,8 @@ class MeasureItemFactory {
     _singleton._register(MeasureTypes.AbRatioTwoVerticalDistance,
         TwoStraightLine.createAbRatioTwoVerticalDistance);
     _singleton._register(MeasureTypes.Slope, StraightLine.createSlope);
+    _singleton._register(
+        MeasureTypes.DopplerTrace, MultiTrace.createCurveLength);
 
     // Area Perimeter
     _singleton._register(

+ 1 - 1
lib/process/primitives/location.dart

@@ -62,7 +62,7 @@ class Location extends MeasureItem<LocationFeature> {
   }
 
   void handleTissueTM(VidUsModeType mode, DPoint point) {
-    if (mode == VidUsModeType.TissueTM) {
+    if (mode == VidUsModeType.TissueTM || mode == VidUsModeType.Doppler) {
       feature = LocationFeature(this, point);
     }
   }

+ 197 - 0
lib/process/primitives/multi_method/multiple_trace.dart

@@ -0,0 +1,197 @@
+import 'dart:ui';
+
+import 'package:fis_measure/interfaces/date_types/point.dart';
+import 'package:fis_measure/interfaces/enums/items.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/workspace/point_info.dart';
+import 'package:fis_measure/process/calcuators/curve.dart';
+import 'package:fis_measure/process/items/item.dart';
+import 'package:fis_measure/process/items/item_feature.dart';
+import 'package:path_drawing/path_drawing.dart';
+import '../area_abstract.dart';
+
+/// 手势轨迹图形
+class MultiTrace extends TraceItemAbstract {
+  PointInfo? _firstPoint;
+
+  MultiTrace(ItemMeta meta, IMeasureItem? parent) : super(meta, parent);
+
+  @override
+  bool onExecuteMouse(PointInfo args) {
+    if (state == ItemStates.finished) {
+      if (args.pointType == PointInfoType.mouseDown) {
+        state = ItemStates.waiting;
+      }
+    }
+
+    if (state == ItemStates.waiting) {
+      if (args.pointType == PointInfoType.mouseDown) {
+        handleMouseDownWhileWaiting(args);
+      }
+    } else if (state == ItemStates.running) {
+      if (args.pointType == PointInfoType.mouseUp) return false;
+
+      feature?.adopt(args);
+      doCalculate();
+      if (args.pointType == PointInfoType.mouseDown) {
+        doFeatureFinish();
+      } else {
+        // checkAutoSnap(args);
+      }
+    }
+    return true;
+  }
+
+  @override
+  void doFeatureFinish() {
+    super.doFeatureFinish();
+    _firstPoint = null;
+  }
+
+  void handleMouseDownWhileWaiting(PointInfo args) {
+    // TODO: 判断是否当前area
+    // 转换为Area逻辑位置
+    feature = MultiTraceFeature(this);
+    if (args.hostVisualArea != null) {
+      feature!.hostVisualArea = args.hostVisualArea;
+    }
+    final point = args.toAreaLogicPoint();
+    feature!.adopt(point);
+    _firstPoint = args;
+    state = ItemStates.running;
+  }
+
+  PointInfo? startPoint;
+  @override
+  bool onExecuteTouch(PointInfo args) {
+    if (state == ItemStates.finished) {
+      if (args.pointType == PointInfoType.touchDown) {
+        state = ItemStates.waiting;
+      }
+    }
+
+    if (state == ItemStates.waiting) {
+      switch (args.pointType) {
+        case PointInfoType.touchDown:
+          startPoint = args; // 设置线段起点
+          break;
+        case PointInfoType.touchUp:
+          break; // 按下立即抬起无事发生
+        case PointInfoType.touchMove:
+          handleMouseDownWhileWaiting(startPoint!); // 通过设置的起点开始一个绘制事件
+          break;
+        default:
+          break;
+      }
+    } else if (state == ItemStates.running) {
+      if (args.pointType == PointInfoType.touchUp) {
+        doFeatureFinish();
+      }
+      if (args.pointType == PointInfoType.touchMove) {
+        feature?.adopt(args);
+        doCalculate();
+        // checkAutoSnap(args);
+      }
+    }
+    return true;
+  }
+
+  static MultiTrace createCurveLength(
+    ItemMeta meta, [
+    IMeasureItem? parent,
+  ]) {
+    print("createCurveLength temperature");
+    MultiTrace trace = MultiTrace(meta, parent);
+    // trace.calculator = CurveLengthCal(trace);
+    trace.isFinished = false;
+    return trace;
+  }
+}
+
+class MultiTraceFeature extends TraceItemFeatureAbstract {
+  MultiTraceFeature(TraceItemAbstract refItem) : super(refItem);
+
+  final greenPen = Paint()
+    ..color = const Color.fromARGB(255, 0, 255, 0)
+    ..isAntiAlias = true
+    ..strokeWidth = 1
+    ..style = PaintingStyle.stroke;
+
+  @override
+  void paint(Canvas canvas, Size size) {
+    if (innerPoints.isEmpty) return;
+
+    drawId(canvas, size);
+
+    final points = innerPoints.map((e) => convert2ViewPoint(size, e)).toList();
+    final startPoint = points.first;
+    drawVertex(canvas, startPoint.toOffset(), points.length == 1);
+
+    if (points.length > 1) {
+      final Path path = Path();
+      path.moveTo(startPoint.x, startPoint.y);
+      for (var i = 1; i < points.length; i++) {
+        final point = points[i];
+        path.lineTo(point.x, point.y);
+      }
+      if (isFinished) {
+        path.lineTo(startPoint.x, startPoint.y);
+      }
+      canvas.drawPath(
+        path,
+        greenPen,
+      );
+    }
+
+    drawVertex(canvas, points.last.toOffset(), isActive);
+  }
+}
+
+abstract class TraceItemFeatureAbstract extends MeasureItemFeature {
+  bool isSnapped = false;
+  TraceItemFeatureAbstract(TraceItemAbstract refItem) : super(refItem);
+
+  @override
+  TraceItemAbstract get refItem => super.refItem as TraceItemAbstract;
+
+  bool get isFinished => refItem.isFinished;
+
+  DPoint get startPoint => innerPoints.first;
+  DPoint get endPoint => innerPoints.last;
+
+  /// 接收新坐标
+  void adopt(DPoint point) {
+    if (innerPoints.isEmpty) {
+      innerPoints.add(point);
+    }
+    if (point.x < innerPoints.last.x) {
+      clearRight(point.x);
+      // innerPoints.clear();
+      // 清理之前的点
+    } else {
+      innerPoints.add(point);
+    }
+  }
+
+  void clearRight(double X) {
+    if (innerPoints.isEmpty) return;
+    for (var i = innerPoints.length - 1; i >= 0; i--) {
+      if (innerPoints[i].x > X) {
+        innerPoints.removeAt(i);
+      }
+    }
+  }
+}
+
+abstract class TraceItemAbstract extends MeasureItem<TraceItemFeatureAbstract> {
+  bool _isFinished = false;
+  TraceItemAbstract(ItemMeta meta, IMeasureItem? parent) : super(meta, parent);
+
+  bool get isFinished => _isFinished;
+  set isFinished(bool val) {
+    if (val != _isFinished) {
+      _isFinished = val;
+    }
+  }
+}

+ 1 - 1
lib/process/primitives/straightline.dart

@@ -128,7 +128,7 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
 
   /// 处理TissueTimeMotion模式
   void handleTissueTM(VidUsModeType mode, DPoint point) {
-    if (mode == VidUsModeType.TissueTM) {
+    if (mode == VidUsModeType.TissueTM || mode == VidUsModeType.Doppler) {
       switch (meta.measureType) {
         case MeasureTypes.TimeSpan:
           feature = StraightLineTimeMotionFeature(this, point, point,