|
@@ -2,33 +2,77 @@ import 'dart:ui';
|
|
|
|
|
|
import 'package:fis_measure/interfaces/process/items/item.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/item_metas.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/items/types.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/point_info.dart';
|
|
|
+import 'package:fis_measure/process/calcuators/volume.dart';
|
|
|
import 'package:fis_measure/process/items/item_feature.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';
|
|
|
|
|
|
-class LWHStraightline extends TopMeasureItem<LWHStraightlineFeature> {
|
|
|
- LWHStraightline(ItemMeta meta) : super(meta);
|
|
|
+class LWHStraightLine extends TopMeasureItem<LWHStraightlineFeature> {
|
|
|
+ static const String _lineLKey = "L";
|
|
|
+ static const String _lineWKey = "W";
|
|
|
+ static const String _lineHKey = "H";
|
|
|
+
|
|
|
+ late final StraightLine l;
|
|
|
+ late final StraightLine w;
|
|
|
+ late final StraightLine h;
|
|
|
+
|
|
|
+ LWHStraightLine(ItemMeta meta) : super(meta) {
|
|
|
+ final metaL = meta.getChildByName(_lineLKey)!;
|
|
|
+ final metaH = meta.getChildByName(_lineHKey)!;
|
|
|
+ final metaW = meta.getChildByName(_lineWKey)!;
|
|
|
+ l = StraightLine.createDistance(metaL, this);
|
|
|
+ w = StraightLine.createDistance(metaW, this);
|
|
|
+ h = StraightLine.createDistance(metaH, this);
|
|
|
+ childItems.add(l);
|
|
|
+ childItems.add(w);
|
|
|
+ childItems.add(h);
|
|
|
+ listenChildrenUpdate();
|
|
|
+ feature = LWHStraightlineFeature(this);
|
|
|
+ }
|
|
|
|
|
|
@override
|
|
|
bool onExecuteMouse(PointInfo args) {
|
|
|
-
|
|
|
- throw UnimplementedError();
|
|
|
+ if (args.pointType == PointInfoType.mouseDown) {
|
|
|
+ if (childrenAllDone) {
|
|
|
+ workingChild.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ final result = workingChild.execute(args);
|
|
|
+ doCalculate();
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
bool onExecuteTouch(PointInfo args) {
|
|
|
-
|
|
|
- throw UnimplementedError();
|
|
|
+ return workingChild.execute(args);
|
|
|
+ }
|
|
|
+
|
|
|
+ static LWHStraightLine createVolume(ItemMeta meta, [IMeasureItem? parent]) {
|
|
|
+ if (meta.measureType != MeasureTypes.Volume || meta.multiMethod != "LWH") {
|
|
|
+ throw ArgumentError();
|
|
|
+ }
|
|
|
+ var lwh = LWHStraightLine(meta);
|
|
|
+ lwh.calculator = VolumeThreeDistanceCal(lwh);
|
|
|
+
|
|
|
+ return lwh;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-class LWHStraightlineFeature extends MeasureItemFeature {
|
|
|
+class LWHStraightlineFeature extends TopMeasureItemFeature {
|
|
|
LWHStraightlineFeature(
|
|
|
- IMeasureItem refItem,
|
|
|
+ ITopMeasureItem refItem,
|
|
|
) : super(refItem);
|
|
|
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
-
|
|
|
+ for (var item in refItem.childItems) {
|
|
|
+ for (var feature in item.measuredFeatures) {
|
|
|
+ feature.paint(canvas, size);
|
|
|
+ }
|
|
|
+ item.feature?.paint(canvas, size);
|
|
|
+ }
|
|
|
}
|
|
|
}
|