item.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import 'package:fis_common/event/event_type.dart';
  2. import 'package:fis_measure/interfaces/enums/items.dart';
  3. import '../calculators/calculator.dart';
  4. import '../workspace/point_info.dart';
  5. import 'item_feature.dart';
  6. import 'item_metas.dart';
  7. abstract class IMeasureItem {
  8. /// 标签信息
  9. ItemMeta get meta;
  10. /// 外显名称
  11. String get displayName;
  12. /// 描述
  13. String get description;
  14. /// 简短描述
  15. String get briefAnnotation;
  16. /// 测量快照
  17. IMeasureItemFeature? get feature;
  18. /// 已完成测量记录
  19. List<IMeasureItemFeature> get measuredFeatures;
  20. /// 计算器
  21. ICalculator? get calculator;
  22. /// 父级
  23. IMeasureItem? get parent;
  24. /// 测量状态
  25. ItemStates get state;
  26. /// 显示像素/图片像素 缩放比例
  27. double get scaleRatio;
  28. /// 处理输入
  29. bool execute(PointInfo args);
  30. /// 清空
  31. void clear();
  32. /// 完成一次测量
  33. void finishOnce();
  34. /// 取消一次测量
  35. void cancelOnce();
  36. /// 分配新序号
  37. int assignId();
  38. /// 快照变化事件
  39. late final FEventHandler<IMeasureItemFeature?> featureUpdated;
  40. }
  41. /// 组合(包含子项)测量项
  42. abstract class ITopMeasureItem implements IMeasureItem {
  43. /// 子项集合
  44. List<IMeasureItem> get childItems;
  45. /// 工作中子项
  46. IMeasureItem get workingChild;
  47. /// 工作子项变更事件
  48. late final FEventHandler<int> workingChildChanged;
  49. /// 切换制定子项为工作状态
  50. void switchChild(int index);
  51. }