import 'package:fis_common/event/event_type.dart';
import 'package:flutter/painting.dart';
import 'package:vid/us/vid_us_image.dart';

import '../items/item.dart';
import '../modes/mode.dart';
import '../viewports/viewport.dart';
import '../visuals/visual.dart';
import '../visuals/visual_area.dart';
import 'point_info.dart';

/// 测量应用
abstract class IApplication {
  /// 应用名称
  String get applicationName;

  /// 分类名称
  String get categoryName;

  /// 当前帧
  VidUsImage? get frameData;

  /// 图像幅集合
  List<IVisual> get visuals;

  /// 当前图像幅
  IVisual get currentVisual;

  /// 当前幅图像区域
  IVisualArea get currentVisualArea;

  /// 当前视口
  IViewPort get currentViewPort;

  /// 当前模式
  IMode get currentMode;

  /// 所有Visual下可用模式
  List<IMode> get avaliableModes;

  /// 当前是否可测量
  bool get canMeasure;
  set canMeasure(bool value);

  /// 活动测量项
  IMeasureItem? get activeItem;

  /// 测量项集合
  Set<IMeasureItem> get items;

  /// 显示尺寸
  Size get displaySize;
  set displaySize(Size value);

  /// 当前模式变化事件
  late FEventHandler<IMode> currentModeChanged;

  /// 图像幅区域变化事件
  late FEventHandler<IVisualArea> visualAreaChanged;

  /// 是否可测量状态变更事件
  late FEventHandler<bool> canMeasureChanged;

  /// 活动测量项变更事件
  late FEventHandler<IMeasureItem?> activeItemChanged;

  /// 测量准备重新渲染
  late FEventHandler<void> measureRerenderReady;

  /// 加载帧
  void loadFrame(VidUsImage frame);

  /// 转换为相对坐标点(百分比:0-1)
  PointInfo createPointInfo(Offset offset, PointInfoType type);

  /// 根据名称切换测量项
  void switchItemByName(String name);
}
