Browse Source

Merge branch 'master' of http://git.ius.plus/melon.yin/fis_lib_measure

melon.yin 2 years ago
parent
commit
92f560bec3

+ 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,7 +104,7 @@ class MeasureTypes {
   static const MVcf = "MVcf";
   static const Ef = "Ef";
   static const FS = "FS";
-/* Two StraightLine  [end] */
+  /* Two StraightLine  [end] */
 
 /* OB  [begin] */
   static const HcBpdOfd = "HcBpdOfd";
@@ -127,4 +126,8 @@ class MeasureTypes {
 
   static const TimeSpan = "TimeSpan";
   static const Slope = "Slope";
+
+  /* Doppler */
+  static const SemiManualTrace = "SemiManualTrace";
+  static const DopplerTrace = "DopplerTrace";
 }

+ 7 - 2
lib/measure_page_test.dart

@@ -99,7 +99,8 @@ class _MeasureTestPageState extends State<MeasureTestPage> {
       // "http://cdn-bj.fis.plus/9F066341FA874E21B48CDE247C13D495.vid"; //B TVI TD
       // "http://cdn-bj.fis.plus/974BABA5113640639FD749E06DD7DA5B.vid"; //B CF CW
       // "http://cdn-bj.fis.plus/0B344F48BA574ECD82B7FEDB8848421A.vid"; //单幅TM
-      "http://cdn-bj.fis.plus/3379F38302884C2991D90FBDFB0DEA7E.dat"; //单幅TM(2)
+      // "http://cdn-bj.fis.plus/3379F38302884C2991D90FBDFB0DEA7E.dat"; //单幅TM(2)
+      "http://cdn-bj.fis.plus/6A99AD2530864616B64355A8EA9AE3EC.vid";
   // "http://cdn-bj.fis.plus/F26C6E5D57A7472A97E9EB543DF0D16C.vid"; // 单幅Convex
   // "http://cdn-bj.fis.plus/6B6E069659D14E7299EB9F6EFCDE9C8C.vid"; //双幅单TissueConvex
   // "http://cdn-bj.fis.plus/062643B82365437DB95F3811580AF3ED.vid"; //四幅单模式
@@ -367,6 +368,7 @@ class _MeasureLeftBoardState extends State<_MeasureLeftBoard> {
     MeasureTerms.Stenosis,
     MeasureTerms.AbRatio,
     MeasureTerms.Slope,
+    MeasureTerms.TAMAX,
     "Qp/Qs",
   ];
 
@@ -399,7 +401,9 @@ class _MeasureLeftBoardState extends State<_MeasureLeftBoard> {
 
   void loadItems() {
     workingItems = [];
-    var names = modeType == "TissueTM" ? C_SUPPORTED_M_ITEMS : passeItems;
+    var names = (modeType == "TissueTM" || modeType == "Doppler")
+        ? C_SUPPORTED_M_ITEMS
+        : passeItems;
     final workingItemDtos =
         MeasureTestPage.MetaDTOList.where((e) => names.contains(e['Name']));
     for (var map in workingItemDtos) {
@@ -407,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) {

+ 5 - 1
lib/process/calcuators/time_motion.dart

@@ -3,6 +3,7 @@ import 'package:fis_measure/interfaces/process/items/terms.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/two_length.dart';
+import 'package:vid/us/vid_us_unit.dart';
 
 import '../primitives/straightline.dart';
 import 'calculator.dart';
@@ -22,7 +23,10 @@ class VerticalDistanceCal extends Calculator<StraightLine, double> {
     final pp2 = viewport.convert(p2);
 
     final value = (pp2.y - pp1.y).abs();
-    updateFloatValue(value);
+    // updateFloatValue(value);
+    final ouput = ref.meta.outputs.first;
+    feature.updateFloatValue(
+        ouput, roundDouble(value, ouput.fractionalDigits), VidUsUnit.cm);
   }
 }
 

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

@@ -10,6 +10,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';
@@ -127,6 +128,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(

+ 10 - 20
lib/process/language/measure_language.dart

@@ -1,27 +1,17 @@
 import 'dart:convert';
 
-import 'package:fis_measure/process/workspace/measure_data_controller.dart';
-import 'package:get/get.dart';
+class MeasureLanguage {
+  static var _map = {};
 
-class Language {
-  Map<String, String>? language;
-  Language({
-    this.language,
-  });
-  factory Language.fromjson(data) {
-    Language lan = Language();
-    lan.language = data['language'];
-    return lan;
+  static void load(String mapJson) {
+    _map = jsonDecode(mapJson)["Language"];
   }
-}
-
-class MeasureLanguage {
-  late MeasureDataController measureData = Get.find<MeasureDataController>();
-  late var measureLanguage =
-      jsonDecode(measureData.measureLanguage)["Language"];
-  // late Language lan = Language.fromjson(measureLanguage["Language"]);
 
-  String? languageValue(String code) {
-    return measureLanguage?[code] ?? code;
+  static String t(String code) {
+    if (_map.containsKey(code)) {
+      return _map[code]!;
+    } else {
+      return code;
+    }
   }
 }

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

@@ -62,8 +62,7 @@ class Location extends MeasureItem<LocationFeature> {
   }
 
   void handleTissueTM(VidUsModeType mode, DPoint point) {
-    if (mode == VidUsModeType.TissueTM) {
-      ///TODO [Gavin] 写一个新的 feature 处理 M 模式
+    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,

+ 2 - 1
lib/view/gesture/mouse_gesture.dart

@@ -137,7 +137,8 @@ class _MeasureMouseGesturePanelState extends State<MeasureMouseGesturePanel> {
     final displaySize = application.displaySize;
     for (var visual in application.visuals) {
       for (var area in visual.visualAreas) {
-        if (area.visualAreaType == VidUsVisualAreaType.TissueTimeMotion) {
+        if (area.visualAreaType == VidUsVisualAreaType.TissueTimeMotion ||
+            area.visualAreaType == VidUsVisualAreaType.Doppler) {
           ifContainerTissueTM = true;
 
           ///TODO 由于布局问题 Left 定位给不准,这里放宽到边界

+ 8 - 8
lib/view/measure/measure_config/measure_configuation_page.dart

@@ -289,14 +289,14 @@ class _HasSelectedModulePage extends StatelessWidget implements FWidget {
     required this.chooseMeasureList,
   });
 
-  /// 根据语言包翻译
-  ///
-  /// [code] 翻译编码
-  String getValues(String code) {
-    final value = MeasureLanguage().languageValue(code);
+  // /// 根据语言包翻译
+  // ///
+  // /// [code] 翻译编码
+  // String getValues(String code) {
+  //   final value = MeasureLanguage().languageValue(code);
 
-    return value ?? code;
-  }
+  //   return value ?? code;
+  // }
 
   @override
   FWidget build(BuildContext context) {
@@ -349,7 +349,7 @@ class _HasSelectedModulePage extends StatelessWidget implements FWidget {
                             ),
                           ),
                           FText(
-                            getValues(
+                            MeasureLanguage.t(
                               chooseMeasureList[index].toString(),
                             ),
                             style: const TextStyle(

+ 19 - 19
lib/view/measure/measure_config/widgets/measurement_tool_selection.dart

@@ -26,13 +26,13 @@ class _SelectModulePageState extends FState<SelectModulePage> {
   /// 数据
   final measureData = Get.find<MeasureDataController>();
 
-  /// 根据语言包翻译
-  ///
-  /// [code] 翻译编码
-  String getValues(String code) {
-    final value = MeasureLanguage().languageValue(code);
-    return value ?? code;
-  }
+  // /// 根据语言包翻译
+  // ///
+  // /// [code] 翻译编码
+  // String getValues(String code) {
+  //   final value = MeasureLanguage().languageValue(code);
+  //   return value ?? code;
+  // }
 
   /// 新增测量项目
   ///
@@ -105,9 +105,7 @@ class _SelectModulePageState extends FState<SelectModulePage> {
               itemMetaGroupTitle,
             ),
             FText(
-              getValues(
-                itemMetaGroupTitle,
-              ),
+              MeasureLanguage.t(itemMetaGroupTitle),
             ),
           ],
         ),
@@ -139,9 +137,7 @@ class _SelectModulePageState extends FState<SelectModulePage> {
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
               FText(
-                getValues(
-                  e.name ?? '',
-                ),
+                MeasureLanguage.t(e.name ?? ''),
                 style: const TextStyle(
                   color: Colors.white,
                   fontSize: 14,
@@ -171,7 +167,7 @@ class _SelectModulePageState extends FState<SelectModulePage> {
       },
       child: FContainer(
         width: 180,
-        height: 60,
+        height: 65,
         decoration: BoxDecoration(
           border: Border.all(
             width: 0.5,
@@ -183,9 +179,7 @@ class _SelectModulePageState extends FState<SelectModulePage> {
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
               FText(
-                getValues(
-                  e.name ?? '',
-                ),
+                MeasureLanguage.t(e.name ?? ''),
                 style: const TextStyle(
                   color: Colors.black,
                   fontSize: 14,
@@ -218,9 +212,15 @@ class _SelectModulePageState extends FState<SelectModulePage> {
             if (widget.chooseMeasureList.contains(
               e.name,
             )) {
-              return _buildSlected(e);
+              return FMouseRegion(
+                cursor: SystemMouseCursors.click,
+                child: _buildSlected(e),
+              );
             } else {
-              return _buildNoSlected(e);
+              return FMouseRegion(
+                cursor: SystemMouseCursors.click,
+                child: _buildNoSlected(e),
+              );
             }
           }).toList()),
     );

+ 55 - 19
lib/view/measure/measure_tool.dart

@@ -222,9 +222,9 @@ class LeftSiderSelectMeasureState extends FState<LeftSiderSelectMeasure> {
     }
   }
 
-  String getValue(String code) {
-    return MeasureLanguage().languageValue(code) ?? code;
-  }
+  // String getValue(String code) {
+  //   return MeasureLanguage().languageValue(code) ?? code;
+  // }
 
   FWidget _buildComboItem(ItemMeta itemMeta, int index) {
     FWidget child;
@@ -306,7 +306,7 @@ class LeftSiderSelectMeasureState extends FState<LeftSiderSelectMeasure> {
     return FGridView.count(
       shrinkWrap: true,
       crossAxisCount: 2,
-      childAspectRatio: 3,
+      childAspectRatio: 2.5,
       controller: ScrollController(),
       children: itemMeta.map((e) {
         if (e.name == activeName) {
@@ -334,31 +334,67 @@ class LeftSiderSelectMeasureState extends FState<LeftSiderSelectMeasure> {
     if (e.name == activeName) {
       measure = FElevatedButton(
         onPressed: () => onTap.call(),
-        child: FText(
-          i18nBook.isCurrentChinese ? getValue(e.name) : e.name,
-          style: TextStyle(
-            fontFamily: fontFamily,
-          ),
-        ),
+        child: i18nBook.isCurrentChinese && MeasureLanguage.t(e.name) != e.name
+            ? FColumn(
+                mainAxisAlignment: MainAxisAlignment.center,
+                children: [
+                  FText(
+                    MeasureLanguage.t(e.name),
+                    maxLines: 1,
+                    overflow: TextOverflow.ellipsis,
+                    style: TextStyle(
+                      fontFamily: fontFamily,
+                      fontSize: 12,
+                    ),
+                  ),
+                  FText(
+                    e.name,
+                  ),
+                ],
+              )
+            : FText(
+                e.name,
+              ),
         style: ElevatedButton.styleFrom(
           fixedSize: const Size.fromHeight(
-            40,
+            50,
           ),
         ),
       );
     } else {
       measure = FOutlinedButton(
         onPressed: () => onTap.call(),
-        child: FText(
-          i18nBook.isCurrentChinese ? getValue(e.name) : e.name,
-          style: TextStyle(
-            color: Colors.white,
-            fontFamily: fontFamily,
-          ),
-        ),
+        child: i18nBook.isCurrentChinese && MeasureLanguage.t(e.name) != e.name
+            ? FColumn(
+                mainAxisAlignment: MainAxisAlignment.center,
+                children: [
+                  FText(
+                    MeasureLanguage.t(e.name),
+                    maxLines: 1,
+                    overflow: TextOverflow.ellipsis,
+                    style: TextStyle(
+                      color: Colors.white,
+                      fontFamily: fontFamily,
+                      fontSize: 12,
+                    ),
+                  ),
+                  FText(
+                    e.name,
+                    style: const TextStyle(
+                      color: Colors.white,
+                    ),
+                  ),
+                ],
+              )
+            : FText(
+                e.name,
+                style: const TextStyle(
+                  color: Colors.white,
+                ),
+              ),
         style: OutlinedButton.styleFrom(
           fixedSize: const Size.fromHeight(
-            40,
+            50,
           ),
           side: const BorderSide(
             color: Color.fromRGBO(124, 124, 124, 1),

+ 2 - 0
lib/view/measure/measure_view.dart

@@ -5,6 +5,7 @@ import 'package:fis_measure/interfaces/process/player/play_controller.dart';
 import 'package:fis_measure/interfaces/process/workspace/application.dart';
 import 'package:fis_measure/interfaces/process/workspace/exam_info.dart';
 import 'package:fis_measure/interfaces/process/workspace/measure_3d_view_controller.dart';
+import 'package:fis_measure/process/language/measure_language.dart';
 import 'package:fis_measure/process/layout/configuration.dart';
 import 'package:fis_measure/process/workspace/measure_controller.dart';
 import 'package:fis_measure/process/workspace/measure_data_controller.dart';
@@ -103,6 +104,7 @@ class _MeasureMainPageState extends State<MeasureMainPage> {
       selectedImageIndex = examImageInfoList.indexOf(selectedImage);
       measureController.examInfo.selectedImageIndex = selectedImageIndex;
     }
+    MeasureLanguage.load(measureData.measureLanguage);
   }
 
   void changeImage(sender, e) {