Commit bb3b8139 by liulongfei

1. 添加聚焦热键

parent 1d0922c8
...@@ -112,6 +112,10 @@ namespace VIZ.H2V.Module ...@@ -112,6 +112,10 @@ namespace VIZ.H2V.Module
// 手动裁切 // 手动裁切
if (this.ExecuteManual(hotkey)) if (this.ExecuteManual(hotkey))
return; return;
// 窗口焦点
if (this.ExecuteActive(hotkey))
return;
} }
/// <summary> /// <summary>
...@@ -248,5 +252,39 @@ namespace VIZ.H2V.Module ...@@ -248,5 +252,39 @@ namespace VIZ.H2V.Module
return true; return true;
} }
/// <summary>
/// 处理窗口焦点
/// </summary>
/// <param name="hotkey">热键</param>
/// <returns>是否处理完成</returns>
private bool ExecuteActive(string hotkey)
{
INDIViewService service = null;
if (string.Equals(this.Support.HotkeyConfig.ActiveCAM1, hotkey))
{
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_1);
}
if (string.Equals(this.Support.HotkeyConfig.ActiveCAM2, hotkey))
{
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_2);
}
if (string.Equals(this.Support.HotkeyConfig.ActiveCAM3, hotkey))
{
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_3);
}
if (string.Equals(this.Support.HotkeyConfig.ActiveCAM4, hotkey))
{
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_4);
}
if (service == null)
return false;
service.IsActive = true;
return true;
}
} }
} }
...@@ -217,7 +217,7 @@ namespace VIZ.H2V.Module ...@@ -217,7 +217,7 @@ namespace VIZ.H2V.Module
private void Setting() private void Setting()
{ {
SystemSettingView view = new SystemSettingView(); SystemSettingView view = new SystemSettingView();
NoneWindow window = new NoneWindow(1200, 900, view); NoneWindow window = new NoneWindow(1200, 1000, view);
window.Owner = this.GetWindow(); window.Owner = this.GetWindow();
window.ShowDialog(); window.ShowDialog();
......
...@@ -30,6 +30,11 @@ namespace VIZ.H2V.Module ...@@ -30,6 +30,11 @@ namespace VIZ.H2V.Module
bool IsUseClip { get; } bool IsUseClip { get; }
/// <summary> /// <summary>
/// 是否被激活
/// </summary>
bool IsActive { get; set; }
/// <summary>
/// 算法类型 /// 算法类型
/// </summary> /// </summary>
AlgorithmStrategyType StrategyType { get; set; } AlgorithmStrategyType StrategyType { get; set; }
......
...@@ -51,22 +51,6 @@ namespace VIZ.H2V.Module ...@@ -51,22 +51,6 @@ namespace VIZ.H2V.Module
this.ManualController.ClipBoxSmooth.Init(555, 555, config.ManualSmoothCoeff); this.ManualController.ClipBoxSmooth.Init(555, 555, config.ManualSmoothCoeff);
this.ManualController.ClipBoxTargetX = 555; this.ManualController.ClipBoxTargetX = 555;
CompositionTarget.Rendering -= CompositionTarget_Rendering;
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
/// <summary>
/// 渲染处理
/// </summary>
private void CompositionTarget_Rendering(object sender, EventArgs e)
{
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
}
} }
/// <summary> /// <summary>
...@@ -119,6 +103,13 @@ namespace VIZ.H2V.Module ...@@ -119,6 +103,13 @@ namespace VIZ.H2V.Module
// 更新画面 // 更新画面
view.video.UpdateVideoFrame(e.Frame); view.video.UpdateVideoFrame(e.Frame);
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
}
// 如果当前模式为手动模式且处于接收裁切信号状态,并且需要进行裁切,那么发送手动裁切信号 // 如果当前模式为手动模式且处于接收裁切信号状态,并且需要进行裁切,那么发送手动裁切信号
if (e.Frame != null && this.ViewConfig.StrategyMode == AlgorithmStrategyMode.manual_mode && this.ViewStatus == NDIViewStatus.CropRoi && this.IsUseClip) if (e.Frame != null && this.ViewConfig.StrategyMode == AlgorithmStrategyMode.manual_mode && this.ViewStatus == NDIViewStatus.CropRoi && this.IsUseClip)
{ {
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
<RowDefinition Height="120"></RowDefinition> <RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="60"></RowDefinition> <RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="120"></RowDefinition> <RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 算法裁切快捷键 --> <!-- 算法裁切快捷键 -->
...@@ -65,6 +67,7 @@ ...@@ -65,6 +67,7 @@
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=AutoCAM4,Mode=TwoWay}" Height="30" Grid.Row="1" <fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=AutoCAM4,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox> Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
</Grid> </Grid>
<!-- 居中裁切快捷键 --> <!-- 居中裁切快捷键 -->
<TextBlock Text="居中裁切快捷键" Foreground="White" FontSize="20" VerticalAlignment="Center" Grid.Row="2"></TextBlock> <TextBlock Text="居中裁切快捷键" Foreground="White" FontSize="20" VerticalAlignment="Center" Grid.Row="2"></TextBlock>
<Rectangle Grid.Row="2" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle> <Rectangle Grid.Row="2" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle>
...@@ -96,6 +99,7 @@ ...@@ -96,6 +99,7 @@
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=CenterCAM4,Mode=TwoWay}" Height="30" Grid.Row="1" <fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=CenterCAM4,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox> Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
</Grid> </Grid>
<!-- 手动裁切快捷键 --> <!-- 手动裁切快捷键 -->
<TextBlock Text="手动裁切快捷键" Foreground="White" FontSize="20" VerticalAlignment="Center" Grid.Row="4"></TextBlock> <TextBlock Text="手动裁切快捷键" Foreground="White" FontSize="20" VerticalAlignment="Center" Grid.Row="4"></TextBlock>
<Rectangle Grid.Row="4" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle> <Rectangle Grid.Row="4" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle>
...@@ -127,6 +131,38 @@ ...@@ -127,6 +131,38 @@
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ManualCAM4,Mode=TwoWay}" Height="30" Grid.Row="1" <fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ManualCAM4,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox> Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
</Grid> </Grid>
<!-- 窗口聚焦快捷键 -->
<TextBlock Text="窗口聚焦快捷键" Foreground="White" FontSize="20" VerticalAlignment="Center" Grid.Row="6"></TextBlock>
<Rectangle Grid.Row="6" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle>
<Grid Grid.Row="7">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- CAM 1 -->
<TextBlock Text="CAM 1" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="0"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ActiveCAM1,Mode=TwoWay}" Height="30"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 2 -->
<TextBlock Text="CAM 2" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2"></TextBlock>
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ActiveCAM2,Mode=TwoWay}" Height="30" Grid.Row="0"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 3 -->
<TextBlock Text="CAM 3" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="1"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ActiveCAM3,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 4 -->
<TextBlock Text="CAM 4" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"></TextBlock>
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ActiveCAM4,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
</Grid>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -289,6 +289,93 @@ namespace VIZ.H2V.Module ...@@ -289,6 +289,93 @@ namespace VIZ.H2V.Module
#endregion #endregion
// -----------------------------------------------------------------------
// 窗口聚焦
#region ActiveCAM1 -- 窗口聚焦 视图1
private string activeCAM1;
/// <summary>
/// 窗口聚焦 视图1
/// </summary>
[HotkeyProperty]
public string ActiveCAM1
{
get { return activeCAM1; }
set
{
activeCAM1 = value;
activeCAM1 = value;
this.RaisePropertyChanged(nameof(ActiveCAM1));
this.CheckHotkey(nameof(ActiveCAM1), value);
}
}
#endregion
#region ActiveCAM2 -- 窗口聚焦 视图2
private string activeCAM2;
/// <summary>
/// 窗口聚焦 视图2
/// </summary>
[HotkeyProperty]
public string ActiveCAM2
{
get { return activeCAM2; }
set
{
activeCAM2 = value;
activeCAM2 = value;
this.RaisePropertyChanged(nameof(ActiveCAM2));
this.CheckHotkey(nameof(ActiveCAM2), value);
}
}
#endregion
#region ActiveCAM3 -- 窗口聚焦 视图3
private string activeCAM3;
/// <summary>
/// 窗口聚焦 视图3
/// </summary>
[HotkeyProperty]
public string ActiveCAM3
{
get { return activeCAM3; }
set
{
activeCAM3 = value;
activeCAM3 = value;
this.RaisePropertyChanged(nameof(ActiveCAM3));
this.CheckHotkey(nameof(ActiveCAM3), value);
}
}
#endregion
#region ActiveCAM4 -- 窗口聚焦 视图4
private string activeCAM4;
/// <summary>
/// 窗口聚焦 视图4
/// </summary>
[HotkeyProperty]
public string ActiveCAM4
{
get { return activeCAM4; }
set
{
activeCAM4 = value;
activeCAM4 = value;
this.RaisePropertyChanged(nameof(ActiveCAM4));
this.CheckHotkey(nameof(ActiveCAM4), value);
}
}
#endregion
// ====================================================================================== // ======================================================================================
// === Commond === // === Commond ===
// ====================================================================================== // ======================================================================================
...@@ -324,6 +411,11 @@ namespace VIZ.H2V.Module ...@@ -324,6 +411,11 @@ namespace VIZ.H2V.Module
this.ManualCAM2 = this.HotkeyConfig.ManualCAM2; this.ManualCAM2 = this.HotkeyConfig.ManualCAM2;
this.ManualCAM3 = this.HotkeyConfig.ManualCAM3; this.ManualCAM3 = this.HotkeyConfig.ManualCAM3;
this.ManualCAM4 = this.HotkeyConfig.ManualCAM4; this.ManualCAM4 = this.HotkeyConfig.ManualCAM4;
this.ActiveCAM1 = this.HotkeyConfig.ActiveCAM1;
this.ActiveCAM2 = this.HotkeyConfig.ActiveCAM2;
this.ActiveCAM3 = this.HotkeyConfig.ActiveCAM3;
this.ActiveCAM4 = this.HotkeyConfig.ActiveCAM4;
} }
#endregion #endregion
...@@ -361,6 +453,15 @@ namespace VIZ.H2V.Module ...@@ -361,6 +453,15 @@ namespace VIZ.H2V.Module
if (this.ManualCAM4 != this.HotkeyConfig.ManualCAM4) if (this.ManualCAM4 != this.HotkeyConfig.ManualCAM4)
return true; return true;
if (this.ActiveCAM1 != this.HotkeyConfig.ActiveCAM1)
return true;
if (this.ActiveCAM2 != this.HotkeyConfig.ActiveCAM2)
return true;
if (this.ActiveCAM3 != this.HotkeyConfig.ActiveCAM3)
return true;
if (this.ActiveCAM4 != this.HotkeyConfig.ActiveCAM4)
return true;
return false; return false;
} }
...@@ -385,6 +486,11 @@ namespace VIZ.H2V.Module ...@@ -385,6 +486,11 @@ namespace VIZ.H2V.Module
this.HotkeyConfig.ManualCAM3 = this.ManualCAM3; this.HotkeyConfig.ManualCAM3 = this.ManualCAM3;
this.HotkeyConfig.ManualCAM4 = this.ManualCAM4; this.HotkeyConfig.ManualCAM4 = this.ManualCAM4;
this.HotkeyConfig.ActiveCAM1 = this.ActiveCAM1;
this.HotkeyConfig.ActiveCAM2 = this.ActiveCAM2;
this.HotkeyConfig.ActiveCAM3 = this.ActiveCAM3;
this.HotkeyConfig.ActiveCAM4 = this.ActiveCAM4;
ApplicationDomainEx.LiteDbContext.HotkeyConfig.Upsert(this.HotkeyConfig); ApplicationDomainEx.LiteDbContext.HotkeyConfig.Upsert(this.HotkeyConfig);
INDIMainViewService service = ApplicationDomainEx.ServiceManager.GetService<INDIMainViewService>(NDIViewKeys.MainView); INDIMainViewService service = ApplicationDomainEx.ServiceManager.GetService<INDIMainViewService>(NDIViewKeys.MainView);
......
...@@ -76,5 +76,25 @@ namespace VIZ.H2V.Storage ...@@ -76,5 +76,25 @@ namespace VIZ.H2V.Storage
/// 手动裁切 视图4 /// 手动裁切 视图4
/// </summary> /// </summary>
public string ManualCAM4 { get; set; } = "D4"; public string ManualCAM4 { get; set; } = "D4";
/// <summary>
/// 窗口聚焦 视图1
/// </summary>
public string ActiveCAM1 { get; set; } = "F1";
/// <summary>
/// 窗口聚焦 视图2
/// </summary>
public string ActiveCAM2 { get; set; } = "F2";
/// <summary>
/// 窗口聚焦 视图3
/// </summary>
public string ActiveCAM3 { get; set; } = "F3";
/// <summary>
/// 窗口聚焦 视图4
/// </summary>
public string ActiveCAM4 { get; set; } = "F4";
} }
} }
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