Commit c995120d by liulongfei

1. 居中模式逻辑调整

parent 91b2a119
...@@ -132,7 +132,7 @@ namespace VIZ.H2V.Module ...@@ -132,7 +132,7 @@ namespace VIZ.H2V.Module
/// <summary> /// <summary>
/// 切换居中模式 /// 切换居中模式
/// </summary> /// </summary>
public void ChangeCenterMode() public virtual void ChangeCenterMode()
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey); UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
if (manager == null) if (manager == null)
...@@ -148,7 +148,7 @@ namespace VIZ.H2V.Module ...@@ -148,7 +148,7 @@ namespace VIZ.H2V.Module
/// <summary> /// <summary>
/// 切换手动模式 /// 切换手动模式
/// </summary> /// </summary>
public void ChangeManualMode() public virtual void ChangeManualMode()
{ {
// 重置3D鼠标 // 重置3D鼠标
this.Support.Reset3DMouse(); this.Support.Reset3DMouse();
......
...@@ -60,9 +60,37 @@ namespace VIZ.H2V.Module ...@@ -60,9 +60,37 @@ namespace VIZ.H2V.Module
// 其他方式触发则切换为检测模式 // 其他方式触发则切换为检测模式
this.Detect(); this.Detect();
// 更新裁切框样式
this.Support.UpdateClipBoxToAutoOrCenterStyle();
// 清理视图控件 // 清理视图控件
ClearVideoControlContext clear_context = new ClearVideoControlContext(false, true); //ClearVideoControlContext clear_context = new ClearVideoControlContext(false, true);
//this.Support.ClearVideoControl(clear_context);
}
/// <summary>
/// 切换居中模式
/// </summary>
public override void ChangeCenterMode()
{
base.ChangeCenterMode();
// 单人机位在切换居中模式后需要清理跟踪框
ClearVideoControlContext clear_context = new ClearVideoControlContext(false, false);
clear_context.IsClearTrackingBox = true;
this.Support.ClearVideoControl(clear_context);
}
/// <summary>
/// 切换手动模式
/// </summary>
public override void ChangeManualMode()
{
base.ChangeManualMode();
// 单人机位在切换居中模式后需要清理跟踪框
ClearVideoControlContext clear_context = new ClearVideoControlContext(false, false);
clear_context.IsClearTrackingBox = true;
this.Support.ClearVideoControl(clear_context); this.Support.ClearVideoControl(clear_context);
} }
......
...@@ -97,7 +97,7 @@ namespace VIZ.H2V.Module ...@@ -97,7 +97,7 @@ namespace VIZ.H2V.Module
{ {
if (this.IsClipBoxAutoMoving) if (this.IsClipBoxAutoMoving)
{ {
if (this.ClipBoxAutoMovingFrame == VIDEO_CLIP_BOX_AUTO_MOVE_DURATION_FRAME) if (this.ClipBoxAutoMovingFrame == VIDEO_CLIP_BOX_AUTO_MOVE_DURATION_FRAME || (int)this.Support.ClipBoxX == (int)this.ClipBoxCenterX)
{ {
this.IsClipBoxAutoMoving = false; this.IsClipBoxAutoMoving = false;
this.ClipBoxAutoMovingFrame = 0; this.ClipBoxAutoMovingFrame = 0;
...@@ -191,6 +191,7 @@ namespace VIZ.H2V.Module ...@@ -191,6 +191,7 @@ namespace VIZ.H2V.Module
{ {
this.IsClipBoxAutoMoving = false; this.IsClipBoxAutoMoving = false;
this.ClipBoxAutoMovingFrame = 0; this.ClipBoxAutoMovingFrame = 0;
this.Support.IsCenterModeMoveToCenterEnabled = true;
} }
/// <summary> /// <summary>
...@@ -203,12 +204,12 @@ namespace VIZ.H2V.Module ...@@ -203,12 +204,12 @@ namespace VIZ.H2V.Module
{ {
double x = this.ClipBoxTargetX; double x = this.ClipBoxTargetX;
if (x < this.ClipBoxCenterX) if ((int)x < (int)this.ClipBoxCenterX)
{ {
x += VIDEO_CLIP_BOX_AUTO_MOVE_SPEED; x += VIDEO_CLIP_BOX_AUTO_MOVE_SPEED;
x = x > this.ClipBoxCenterX ? this.ClipBoxCenterX : x; x = x > this.ClipBoxCenterX ? this.ClipBoxCenterX : x;
} }
else if (x > this.ClipBoxCenterX) else if ((int)x > (int)this.ClipBoxCenterX)
{ {
x -= VIDEO_CLIP_BOX_AUTO_MOVE_SPEED; x -= VIDEO_CLIP_BOX_AUTO_MOVE_SPEED;
x = x < this.ClipBoxCenterX ? this.ClipBoxCenterX : x; x = x < this.ClipBoxCenterX ? this.ClipBoxCenterX : x;
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
Style="{StaticResource CheckBox_NdiView}"></CheckBox> Style="{StaticResource CheckBox_NdiView}"></CheckBox>
<Rectangle Grid.Row="1" Grid.RowSpan="10" Fill="#ff181d2b"></Rectangle> <Rectangle Grid.Row="1" Grid.RowSpan="10" Fill="#ff181d2b"></Rectangle>
<Border Grid.Row="1" IsEnabled="{Binding IsUseClip,Mode=OneWay}"> <Border Grid.Row="1" IsEnabled="{Binding IsUseClip,Mode=OneWay}">
<Grid> <Grid IsEnabled="{Binding Path=IsCenterModeMoveToCenterEnabled}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition> <RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition> <RowDefinition Height="60"></RowDefinition>
......
...@@ -282,8 +282,8 @@ namespace VIZ.H2V.Module ...@@ -282,8 +282,8 @@ namespace VIZ.H2V.Module
return; return;
// 清理视频控件 // 清理视频控件
ClearVideoControlContext clear_context = new ClearVideoControlContext(false, true); //ClearVideoControlContext clear_context = new ClearVideoControlContext(false, true);
this.ClearVideoControl(clear_context); //this.ClearVideoControl(clear_context);
// 切换自动模式 // 切换自动模式
ChangeStrategyContext context = new ChangeStrategyContext(); ChangeStrategyContext context = new ChangeStrategyContext();
......
...@@ -230,6 +230,7 @@ namespace VIZ.H2V.Module ...@@ -230,6 +230,7 @@ namespace VIZ.H2V.Module
/// <param name="view">视图</param> /// <param name="view">视图</param>
private void OnAlgorithmMessage__crop_roi__target_bbox(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view) private void OnAlgorithmMessage__crop_roi__target_bbox(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view)
{ {
// 没有目标框 || 配置是否显示目标框
if (msg.target_bbox == null || !this.ALGORITHM_IS_SHOW_TARGET_BOX) if (msg.target_bbox == null || !this.ALGORITHM_IS_SHOW_TARGET_BOX)
{ {
view.video.ClearTrackingBox(); view.video.ClearTrackingBox();
...@@ -237,6 +238,14 @@ namespace VIZ.H2V.Module ...@@ -237,6 +238,14 @@ namespace VIZ.H2V.Module
return; return;
} }
// 当前算法模式为单人机位模式 & ( 处于居中模式 | 处于手动模式 ) 时不显示
if (this.StrategyType == AlgorithmStrategyType.Single && (this.StrategyMode == AlgorithmStrategyMode.center_mode || this.StrategyMode == AlgorithmStrategyMode.manual_mode))
{
view.video.ClearTrackingBox();
return;
}
RawRectangleF rect = RawRectangleFExpand.ClipInVideoFrame(msg.target_bbox.Value, 0, 0, renderInfo.Frame.Width, renderInfo.Frame.Height); RawRectangleF rect = RawRectangleFExpand.ClipInVideoFrame(msg.target_bbox.Value, 0, 0, renderInfo.Frame.Width, renderInfo.Frame.Height);
if (!RawRectangleFExpand.IsEffective(rect)) if (!RawRectangleFExpand.IsEffective(rect))
......
...@@ -383,6 +383,9 @@ namespace VIZ.H2V.Module ...@@ -383,6 +383,9 @@ namespace VIZ.H2V.Module
isUseClip = value; isUseClip = value;
this.RaisePropertyChanged(nameof(IsUseClip)); this.RaisePropertyChanged(nameof(IsUseClip));
// 当前窗口获取焦点
this.IsActive = true;
ChangeStrategyContext context = new ChangeStrategyContext(); ChangeStrategyContext context = new ChangeStrategyContext();
context.IsUseClip = value; context.IsUseClip = value;
context.Mode = this.StrategyMode; context.Mode = this.StrategyMode;
...@@ -411,6 +414,9 @@ namespace VIZ.H2V.Module ...@@ -411,6 +414,9 @@ namespace VIZ.H2V.Module
if (!value) if (!value)
return; return;
// 当前窗口获取焦点
this.IsActive = true;
ChangeStrategyContext context = new ChangeStrategyContext(); ChangeStrategyContext context = new ChangeStrategyContext();
context.IsUseClip = this.IsUseClip; context.IsUseClip = this.IsUseClip;
context.Mode = AlgorithmStrategyMode.auto_mode; context.Mode = AlgorithmStrategyMode.auto_mode;
...@@ -439,6 +445,9 @@ namespace VIZ.H2V.Module ...@@ -439,6 +445,9 @@ namespace VIZ.H2V.Module
if (!value) if (!value)
return; return;
// 当前窗口获取焦点
this.IsActive = true;
ChangeStrategyContext context = new ChangeStrategyContext(); ChangeStrategyContext context = new ChangeStrategyContext();
context.IsUseClip = this.IsUseClip; context.IsUseClip = this.IsUseClip;
context.Mode = AlgorithmStrategyMode.center_mode; context.Mode = AlgorithmStrategyMode.center_mode;
...@@ -467,6 +476,9 @@ namespace VIZ.H2V.Module ...@@ -467,6 +476,9 @@ namespace VIZ.H2V.Module
if (!value) if (!value)
return; return;
// 当前窗口获取焦点
this.IsActive = true;
ChangeStrategyContext context = new ChangeStrategyContext(); ChangeStrategyContext context = new ChangeStrategyContext();
context.IsUseClip = this.IsUseClip; context.IsUseClip = this.IsUseClip;
context.Mode = AlgorithmStrategyMode.manual_mode; context.Mode = AlgorithmStrategyMode.manual_mode;
...@@ -495,7 +507,7 @@ namespace VIZ.H2V.Module ...@@ -495,7 +507,7 @@ namespace VIZ.H2V.Module
#region IsCenterModeMoveToCenterEnabled -- 居中模式移动至中间是否可用 #region IsCenterModeMoveToCenterEnabled -- 居中模式移动至中间是否可用
private bool isCenterModeMoveToCenterEnabled; private bool isCenterModeMoveToCenterEnabled = true;
/// <summary> /// <summary>
/// 居中模式移动至中间是否可用 /// 居中模式移动至中间是否可用
/// </summary> /// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment