浏览代码

update(measure): support Pht

gavin.chen 2 年之前
父节点
当前提交
e9fe3d6fe6

+ 46 - 0
assets/items.json

@@ -1,4 +1,50 @@
 [
 [
+    {
+        "Name": "MV PHT",
+        "Description": "MV PHT",
+        "BriefAnnotation": "",
+        "MeasureTypeName": "Pht",
+        "Categories": [
+            "CARD"
+        ],
+        "Calculator": {
+            "AvailableOutputs": [
+                {
+                    "Name": "Timespan",
+                    "Description": "Time",
+                    "Unit": 20,
+                    "IsWorking": true
+                },
+                {
+                    "Name": "Area",
+                    "Description": "Area",
+                    "Unit": 50
+                },
+                {
+                    "Name": "Vmax",
+                    "Description": "Vmax",
+                    "Unit": 70
+                },
+                {
+                    "Name": "Max PG",
+                    "Description": "Max PG",
+                    "Unit": 110
+                },
+                {
+                    "Name": "Slope",
+                    "Description": "Slope",
+                    "Unit": 70
+                },
+                {
+                    "Name": "DT",
+                    "Description": "DT",
+                    "Unit": 27
+                }
+            ]
+        },
+        "MultiMethodItems": [],
+        "MethodChildItems": []
+    },
     {
     {
         "Name": "Max PG",
         "Name": "Max PG",
         "Description": "Max PG",
         "Description": "Max PG",

+ 1 - 0
lib/interfaces/date_types/rect_region.dart

@@ -66,6 +66,7 @@ class RectRegion {
   DPoint get topRight => DPoint(right, top);
   DPoint get topRight => DPoint(right, top);
   DPoint get bottomLeft => DPoint(left, bottom);
   DPoint get bottomLeft => DPoint(left, bottom);
   DPoint get bottomRight => DPoint(right, bottom);
   DPoint get bottomRight => DPoint(right, bottom);
+  DPoint get center => DPoint((_left + _right) / 2, (_top + _bottom) / 2);
 
 
   /// 是否包含点
   /// 是否包含点
   ///
   ///

+ 2 - 0
lib/measure_page_test.dart

@@ -374,6 +374,8 @@ class _MeasureLeftBoardState extends State<_MeasureLeftBoard> {
     MeasureTerms.PSED,
     MeasureTerms.PSED,
     MeasureTerms.RI,
     MeasureTerms.RI,
     MeasureTerms.MaxPG,
     MeasureTerms.MaxPG,
+    // MeasureTerms.PHT,
+    "MV PHT",
     "Qp/Qs",
     "Qp/Qs",
   ];
   ];
 
 

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

@@ -140,6 +140,7 @@ class MeasureItemFactory {
         MeasureTypes.SlopeDoppler, StraightLine.createSlopeDoppler);
         MeasureTypes.SlopeDoppler, StraightLine.createSlopeDoppler);
     _singleton._register(MeasureTypes.Velocity, Location.createVelocity);
     _singleton._register(MeasureTypes.Velocity, Location.createVelocity);
     _singleton._register(MeasureTypes.DopplerTrace, MultiTrace.createTrace);
     _singleton._register(MeasureTypes.DopplerTrace, MultiTrace.createTrace);
+    _singleton._register(MeasureTypes.Pht, StraightLine.createTimeSpan);
 
 
     // Area Perimeter
     // Area Perimeter
     _singleton._register(
     _singleton._register(

+ 29 - 0
lib/process/primitives/straightline.dart

@@ -154,6 +154,11 @@ class StraightLine extends MeasureItem<StraightLineFeature> {
         case MeasureTypes.SlopeDoppler:
         case MeasureTypes.SlopeDoppler:
           feature = StraightLineSlopeFeature(this, point, point);
           feature = StraightLineSlopeFeature(this, point, point);
           break;
           break;
+        case MeasureTypes.Pht:
+          feature = StraightLinePhtFeature(this, point, point);
+          mouseState.crossIndicatorStyleChanged
+              .emit(this, CrossIndicatorStyle.vertical);
+          break;
         default:
         default:
       }
       }
     } else {
     } else {
@@ -243,3 +248,27 @@ class StraightLineSlopeFeature extends StraightLineFeature {
     drawVertex(canvas, endOffset, isActive);
     drawVertex(canvas, endOffset, isActive);
   }
   }
 }
 }
+
+class StraightLinePhtFeature extends StraightLineFeature {
+  StraightLinePhtFeature(
+      IMeasureItem refItem, DPoint startPoint, DPoint endPoint)
+      : super(refItem, startPoint, endPoint);
+  DPoint get regionCenter => hostVisualArea!.displayRegion.center;
+
+  @override
+  void paint(Canvas canvas, Size size) {
+    if (startPoint == endPoint) return;
+    var idText = '$id';
+    drawId(canvas, size, idText);
+    final distanceToCenter = (startPoint.y - regionCenter.y);
+    //TODO:[Gavin] 偏移量比例系数待精确
+    final endPointY = startPoint.y - distanceToCenter / 4;
+
+    final startOffset = convert2ViewPoint(size, startPoint).toOffset();
+    final endOffset =
+        convert2ViewPoint(size, DPoint(endPoint.x, endPointY)).toOffset();
+    drawVertex(canvas, startOffset, false);
+    canvas.drawDashLine(startOffset, endOffset, 1, 10, paintPan);
+    drawVertex(canvas, endOffset, isActive);
+  }
+}