|
@@ -5,7 +5,9 @@ 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/items/types.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/point_info.dart';
|
|
|
+import 'package:fis_measure/process/calcuators/distance.dart';
|
|
|
import 'package:fis_measure/process/calcuators/lv_study.dart';
|
|
|
+import 'package:fis_measure/process/calcuators/time_motion.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/straightline.dart';
|
|
@@ -35,14 +37,19 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
LvStudy(ItemMeta meta, {this.ifVertical = false, this.ifTimeSpan = false})
|
|
|
: super(meta) {
|
|
|
for (final childMeta in meta.childItems) {
|
|
|
- StraightLine childItem;
|
|
|
+ _LvStudyStraightLine childItem;
|
|
|
if (childMeta.measureType == "VerticalDistance") {
|
|
|
// measureType
|
|
|
- childItem = StraightLine.createVerticalDistance(childMeta, this);
|
|
|
+ // childItem = StraightLine.createVerticalDistance(childMeta, this);
|
|
|
+ childItem = _LvStudyStraightLine(childMeta, this);
|
|
|
+ childItem.calculator = VerticalDistanceCal(childItem);
|
|
|
+ childItem.ifVertical = true;
|
|
|
} else if (ifTimeSpan) {
|
|
|
- childItem = StraightLine.createTimeSpan(childMeta, this);
|
|
|
+ childItem = _LvStudyStraightLine(childMeta, this);
|
|
|
+ childItem.calculator = TimeSpanCal(childItem);
|
|
|
} else {
|
|
|
- childItem = StraightLine.createDistance(childMeta, this);
|
|
|
+ childItem = _LvStudyStraightLine(childMeta, this);
|
|
|
+ childItem.calculator = DistanceCal(childItem);
|
|
|
}
|
|
|
childItems.add(childItem);
|
|
|
|
|
@@ -97,11 +104,11 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
}
|
|
|
|
|
|
void _onWorkingChildChanged(_, int e) {
|
|
|
- final isMBelow =
|
|
|
- ["m", "pw"].contains(application.currentMode.name.toLowerCase());
|
|
|
- if (!isMBelow) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ // final isMBelow =
|
|
|
+ // ["m", "pw"].contains(application.currentMode.name.toLowerCase());
|
|
|
+ // if (!isMBelow) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
if (_lastChild != null) {
|
|
|
_lastChild!.onItemStatesChanged.removeListener(_onChildItemStatesChanged);
|
|
@@ -109,13 +116,14 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
workingChild.onItemStatesChanged.addListener(_onChildItemStatesChanged);
|
|
|
_lastChild = workingChild;
|
|
|
|
|
|
- final childItem = workingChild as StraightLine;
|
|
|
+ final childItem = workingChild as _LvStudyStraightLine;
|
|
|
if (_dChildItems.contains(childItem)) {
|
|
|
final point = _findDPoint(childItem);
|
|
|
if (point != null) {
|
|
|
final offset = point.toOffset();
|
|
|
final pointInfo = PointInfo.fromOffset(offset, PointInfoType.mouseDown);
|
|
|
pointInfo.hostVisualArea = application.currentVisualArea;
|
|
|
+ childItem.refPoint = pointInfo;
|
|
|
childItem.execute(pointInfo);
|
|
|
}
|
|
|
}
|
|
@@ -125,6 +133,7 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
final offset = point.toOffset();
|
|
|
final pointInfo = PointInfo.fromOffset(offset, PointInfoType.mouseDown);
|
|
|
pointInfo.hostVisualArea = application.currentVisualArea;
|
|
|
+ childItem.refPoint = pointInfo;
|
|
|
childItem.execute(pointInfo);
|
|
|
}
|
|
|
}
|
|
@@ -145,7 +154,7 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
}
|
|
|
|
|
|
void _onChildItemMeasured() {
|
|
|
- final childItem = workingChild as StraightLine;
|
|
|
+ final childItem = workingChild as _LvStudyStraightLine;
|
|
|
if (_dChildItems.contains(childItem)) {
|
|
|
_handleDChildMeasured(childItem);
|
|
|
}
|
|
@@ -154,20 +163,21 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void _handleDChildMeasured(StraightLine childItem) {
|
|
|
+ void _handleDChildMeasured(_LvStudyStraightLine childItem) {
|
|
|
childItem.changeCrossIndicatorStyle(CrossIndicatorStyle.horizontal);
|
|
|
}
|
|
|
|
|
|
- void _handleSChildMeasured(StraightLine childItem) {
|
|
|
+ void _handleSChildMeasured(_LvStudyStraightLine childItem) {
|
|
|
childItem.changeCrossIndicatorStyle(CrossIndicatorStyle.horizontal);
|
|
|
}
|
|
|
|
|
|
- DPoint? _findDPoint(StraightLine item) =>
|
|
|
+ DPoint? _findDPoint(_LvStudyStraightLine item) =>
|
|
|
_findPointFromItems(_dChildItems, item);
|
|
|
- DPoint? _findSPoint(StraightLine item) =>
|
|
|
+ DPoint? _findSPoint(_LvStudyStraightLine item) =>
|
|
|
_findPointFromItems(_sChildItems, item);
|
|
|
|
|
|
- DPoint? _findPointFromItems(List<StraightLine> items, StraightLine currItem) {
|
|
|
+ DPoint? _findPointFromItems(
|
|
|
+ List<StraightLine> items, _LvStudyStraightLine currItem) {
|
|
|
final lastIndex = workingChildIndex - 1;
|
|
|
if (lastIndex < 0) {
|
|
|
return null;
|
|
@@ -176,20 +186,11 @@ class LvStudy extends TopMeasureItem<StraightLineGroupFeature> {
|
|
|
if (items.contains(lastItem)) {
|
|
|
if (lastItem.measuredFeatures.isNotEmpty) {
|
|
|
final feature = (lastItem as StraightLine).measuredFeatures.first;
|
|
|
- final point = feature.endPoint;
|
|
|
+ final point =
|
|
|
+ currItem.ifVertical ? feature.startPoint : feature.endPoint;
|
|
|
return point;
|
|
|
}
|
|
|
}
|
|
|
- // for (var item in items) {
|
|
|
- // if (item == currItem) {
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // if (item.measuredFeatures.isNotEmpty) {
|
|
|
- // final feature = item.measuredFeatures.first;
|
|
|
- // final point = feature.endPoint;
|
|
|
- // return point;
|
|
|
- // }
|
|
|
- // }
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
@@ -199,3 +200,18 @@ class StraightLineGroupFeature extends TopMeasureItemFeature {
|
|
|
ITopMeasureItem refItem,
|
|
|
) : super(refItem);
|
|
|
}
|
|
|
+
|
|
|
+class _LvStudyStraightLine extends StraightLine {
|
|
|
+ _LvStudyStraightLine(super.meta, super.parent);
|
|
|
+
|
|
|
+ DPoint? refPoint;
|
|
|
+ bool ifVertical = false;
|
|
|
+
|
|
|
+ @override
|
|
|
+ bool onExecuteMouse(PointInfo args) {
|
|
|
+ if (ifVertical && refPoint != null) {
|
|
|
+ args.x = refPoint!.x;
|
|
|
+ }
|
|
|
+ return super.onExecuteMouse(args);
|
|
|
+ }
|
|
|
+}
|