|
@@ -13,6 +13,7 @@ import 'package:fis_measure/interfaces/process/viewports/viewport.dart';
|
|
|
import 'package:fis_measure/interfaces/process/modes/mode.dart';
|
|
|
import 'package:fis_common/event/event_type.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/workspace/cross_frame.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/point_info.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/recorder.dart';
|
|
|
import 'package:fis_measure/process/annotations/arrow_annotation.dart';
|
|
@@ -25,6 +26,7 @@ import 'package:flutter/painting.dart';
|
|
|
import 'package:vid/us/vid_us_image.dart';
|
|
|
import 'package:vid/us/vid_us_probe.dart';
|
|
|
import 'dart:math';
|
|
|
+import 'cross_frame.dart';
|
|
|
import 'recorder.dart';
|
|
|
import 'third_part/application.dart';
|
|
|
import 'visual_loader.dart';
|
|
@@ -35,7 +37,6 @@ class Application implements IApplication {
|
|
|
|
|
|
late VidUsProbe _probe;
|
|
|
VidUsImage? _frame;
|
|
|
- VidUsImage? _subFrame;
|
|
|
List<IVisual>? _visuals;
|
|
|
IMeasureItem? _activeMeasureItem;
|
|
|
IAnnotationItem? _activeAnnotationItem;
|
|
@@ -48,6 +49,7 @@ class Application implements IApplication {
|
|
|
final List<IMeasureItem> _measureItems = [];
|
|
|
final Set<IAnnotationItem> _annotationItems = {};
|
|
|
late final _recorder = MeasureRecorder(this);
|
|
|
+ ICrossFrameContext? _crossFrameContext;
|
|
|
|
|
|
final emptyItem = ItemMeta(
|
|
|
"EmptyItem",
|
|
@@ -67,6 +69,8 @@ class Application implements IApplication {
|
|
|
operateTypeChanged = FEventHandler<MeasureOperateType>();
|
|
|
visualsLoaded = FEventHandler<void>();
|
|
|
displaySizeChanged = FEventHandler<Size>();
|
|
|
+ crossFrameTriggered = FEventHandler<void>();
|
|
|
+ crossFrameAdded = FEventHandler<int>();
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -107,7 +111,7 @@ class Application implements IApplication {
|
|
|
IVisualArea get currentVisualArea => currentVisual.activeArea!;
|
|
|
|
|
|
@override
|
|
|
- VidUsImage? get frameData => _subFrame ?? _frame;
|
|
|
+ VidUsImage? get frameData => _crossFrameContext?.currentFrame ?? _frame;
|
|
|
|
|
|
@override
|
|
|
List<IVisual> get visuals => _visuals ?? [];
|
|
@@ -204,11 +208,19 @@ class Application implements IApplication {
|
|
|
// 添加活动测量项事件监听
|
|
|
_activeMeasureItem!.featureUpdated
|
|
|
.addListener(_onActiveMeasureItemFeatureUpdated);
|
|
|
- }
|
|
|
- if (_subFrame != null) {
|
|
|
- // 清除附帧并恢复原始帧的Visual状态
|
|
|
- _subFrame = null;
|
|
|
- loadVisuals();
|
|
|
+
|
|
|
+ if (crossFrameContext != null) {
|
|
|
+ // TODO:!!!!!!!!!!!
|
|
|
+ // 清除附帧并恢复原始帧的Visual状态
|
|
|
+ crossFrameContext!.measureOver.emit(this, null);
|
|
|
+ crossFrameContext = null;
|
|
|
+ loadVisuals();
|
|
|
+ } else {
|
|
|
+ if ((value! is ITopMeasureItem) &&
|
|
|
+ (value as ITopMeasureItem).isCrossFrameMode) {
|
|
|
+ crossFrameTriggered.emit(this, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 通知更新事件
|
|
@@ -244,6 +256,15 @@ class Application implements IApplication {
|
|
|
@override
|
|
|
IMeasureRecorder get recorder => _recorder;
|
|
|
|
|
|
+ @override
|
|
|
+ ICrossFrameContext? get crossFrameContext => _crossFrameContext;
|
|
|
+ @override
|
|
|
+ set crossFrameContext(ICrossFrameContext? val) {
|
|
|
+ if (val != _crossFrameContext) {
|
|
|
+ _crossFrameContext = val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
late final FEventHandler<IMode> currentModeChanged;
|
|
|
|
|
@@ -270,6 +291,12 @@ class Application implements IApplication {
|
|
|
@override
|
|
|
late final FEventHandler<Size> displaySizeChanged;
|
|
|
|
|
|
+ @override
|
|
|
+ late final FEventHandler<void> crossFrameTriggered;
|
|
|
+
|
|
|
+ @override
|
|
|
+ late final FEventHandler<int> crossFrameAdded;
|
|
|
+
|
|
|
@override
|
|
|
void loadFrame(VidUsImage frame, [bool clearable = true]) {
|
|
|
if (_frame == null) {
|
|
@@ -287,21 +314,13 @@ class Application implements IApplication {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (activeMeasureItem != null && activeMeasureItem! is ITopMeasureItem) {
|
|
|
- if ((activeMeasureItem as ITopMeasureItem).isCrossFrameMode) {
|
|
|
- // _frame = VidUsImage(
|
|
|
- // _frame!.index,
|
|
|
- // frame.width,
|
|
|
- // frame.height,
|
|
|
- // frame.imageData,
|
|
|
- // );
|
|
|
- // TODO: 暂不支持直接改index
|
|
|
- _subFrame = frame;
|
|
|
- // 仅更新frame数据
|
|
|
- loadVisuals();
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (crossFrameContext != null) {
|
|
|
+ // 仅更新frame数据
|
|
|
+ crossFrameContext!.switchFrame(frame);
|
|
|
+ loadVisuals();
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
_frame = frame;
|
|
|
if (clearable) {
|
|
|
_resetFrameCache();
|