Commit bda464cd by liulongfei

边线检测 设置

parent 9874ab1a
...@@ -69,20 +69,6 @@ namespace VIZ.H2V.Common ...@@ -69,20 +69,6 @@ namespace VIZ.H2V.Common
#endregion #endregion
#region IsShowBorder -- 是否显示边框
private bool isShowBorder;
/// <summary>
/// 是否显示边框
/// </summary>
public bool IsShowBorder
{
get { return isShowBorder; }
set { isShowBorder = value; this.RaisePropertyChanged(nameof(IsShowBorder)); }
}
#endregion
/// <summary> /// <summary>
/// 是否有选中的项 /// 是否有选中的项
/// </summary> /// </summary>
......
...@@ -46,7 +46,34 @@ ...@@ -46,7 +46,34 @@
</Setter> </Setter>
</Style> </Style>
<Style x:Key="CheckBox_Eye" TargetType="CheckBox"> <Style x:Key="CheckBox_Eye_Red" TargetType="CheckBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Width" Value="30"></Setter>
<Setter Property="Height" Value="30"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Border x:Name="border" Background="Transparent">
<Ellipse Width="12" Height="12" x:Name="ellipse" Fill="#44ff0000"
HorizontalAlignment="Center" VerticalAlignment="Center"></Ellipse>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ellipse" Property="Fill" Value="#aaff0000"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="ellipse" Property="Opacity" Value="0.7"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#11ffffff"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CheckBox_Eye_Yellow" TargetType="CheckBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Width" Value="30"></Setter> <Setter Property="Width" Value="30"></Setter>
<Setter Property="Height" Value="30"></Setter> <Setter Property="Height" Value="30"></Setter>
...@@ -72,5 +99,4 @@ ...@@ -72,5 +99,4 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
\ No newline at end of file
...@@ -171,11 +171,7 @@ ...@@ -171,11 +171,7 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
</Grid> </Grid>
<!-- 是否启用边线检测 -->
<TextBlock Text="启用边线检测" Foreground="White" FontSize="18" Grid.Row="8" VerticalAlignment="Center"></TextBlock>
<CheckBox HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CheckBox_Setting}"
IsChecked="{Binding Path=IsBorderEnabled,Mode=TwoWay}" Grid.Row="8"></CheckBox>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -172,10 +172,6 @@ ...@@ -172,10 +172,6 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<!-- 是否启用边线检测 -->
<TextBlock Text="启用边线检测" Foreground="White" FontSize="18" Grid.Row="8" VerticalAlignment="Center"></TextBlock>
<CheckBox HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CheckBox_Setting}"
IsChecked="{Binding Path=IsBorderEnabled,Mode=TwoWay}" Grid.Row="8"></CheckBox>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
...@@ -134,10 +134,6 @@ ...@@ -134,10 +134,6 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<!-- 是否启用边线检测 -->
<TextBlock Text="启用边线检测" Foreground="White" FontSize="18" Grid.Row="6" VerticalAlignment="Center"></TextBlock>
<CheckBox HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CheckBox_Setting}"
IsChecked="{Binding Path=IsBorderEnabled,Mode=TwoWay}" Grid.Row="6"></CheckBox>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
...@@ -172,10 +172,6 @@ ...@@ -172,10 +172,6 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<!-- 是否启用边线检测 -->
<TextBlock Text="启用边线检测" Foreground="White" FontSize="18" Grid.Row="8" VerticalAlignment="Center"></TextBlock>
<CheckBox HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CheckBox_Setting}"
IsChecked="{Binding Path=IsBorderEnabled,Mode=TwoWay}" Grid.Row="8"></CheckBox>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -172,10 +172,6 @@ ...@@ -172,10 +172,6 @@
</ComboBox> </ComboBox>
</Grid> </Grid>
<!-- 是否启用边线检测 -->
<TextBlock Text="启用边线检测" Foreground="White" FontSize="18" Grid.Row="8" VerticalAlignment="Center"></TextBlock>
<CheckBox HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CheckBox_Setting}"
IsChecked="{Binding Path=IsBorderEnabled,Mode=TwoWay}" Grid.Row="8"></CheckBox>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module ...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module
// 场景信息 // 场景信息
this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault(); this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault();
this.IsBorderEnabled = config.IsBorderEnabled;
} }
/// <summary> /// <summary>
...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module ...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module
if (this.SelectedBorderScence.Key != this.Config.BorderScene) if (this.SelectedBorderScence.Key != this.Config.BorderScene)
return true; return true;
if (this.IsBorderEnabled != this.Config.IsBorderEnabled)
return true;
return false; return false;
} }
...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module ...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module
this.Config.SmoothCoeff = this.SmoothCoeff; this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame; this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.Config.BorderScene = this.SelectedBorderScence.Key; this.Config.BorderScene = this.SelectedBorderScence.Key;
this.Config.IsBorderEnabled = this.IsBorderEnabled;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0; this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmCableway.Upsert(this.Config); ApplicationDomainEx.LiteDbContext.AlgorithmCableway.Upsert(this.Config);
......
...@@ -144,7 +144,6 @@ namespace VIZ.H2V.Module ...@@ -144,7 +144,6 @@ namespace VIZ.H2V.Module
// 场景信息 // 场景信息
this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault(); this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault();
this.IsBorderEnabled = config.IsBorderEnabled;
} }
/// <summary> /// <summary>
...@@ -186,9 +185,6 @@ namespace VIZ.H2V.Module ...@@ -186,9 +185,6 @@ namespace VIZ.H2V.Module
if (this.SelectedBorderScence.Key != this.Config.BorderScene) if (this.SelectedBorderScence.Key != this.Config.BorderScene)
return true; return true;
if (this.IsBorderEnabled != this.Config.IsBorderEnabled)
return true;
return false; return false;
} }
...@@ -226,7 +222,6 @@ namespace VIZ.H2V.Module ...@@ -226,7 +222,6 @@ namespace VIZ.H2V.Module
this.Config.SmoothCoeff = this.SmoothCoeff; this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame; this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.Config.BorderScene = this.SelectedBorderScence.Key; this.Config.BorderScene = this.SelectedBorderScence.Key;
this.Config.IsBorderEnabled = this.IsBorderEnabled;
ApplicationDomainEx.LiteDbContext.AlgorithmNear.Upsert(this.Config); ApplicationDomainEx.LiteDbContext.AlgorithmNear.Upsert(this.Config);
......
...@@ -118,20 +118,6 @@ namespace VIZ.H2V.Module ...@@ -118,20 +118,6 @@ namespace VIZ.H2V.Module
#endregion #endregion
#region IsBorderEnabled -- 是否启用边线检测
private bool isBorderEnabled;
/// <summary>
/// 是否启用边线检测
/// </summary>
public bool IsBorderEnabled
{
get { return isBorderEnabled; }
set { isBorderEnabled = value; this.RaisePropertyChanged(nameof(IsBorderEnabled)); }
}
#endregion
#region KeepPrevFrame -- 维持上一帧位置 #region KeepPrevFrame -- 维持上一帧位置
private int keepPrevFrame; private int keepPrevFrame;
......
...@@ -43,7 +43,6 @@ namespace VIZ.H2V.Module ...@@ -43,7 +43,6 @@ namespace VIZ.H2V.Module
// 场景信息 // 场景信息
this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault(); this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault();
this.IsBorderEnabled = config.IsBorderEnabled;
} }
/// <summary> /// <summary>
...@@ -67,9 +66,6 @@ namespace VIZ.H2V.Module ...@@ -67,9 +66,6 @@ namespace VIZ.H2V.Module
if (this.SelectedBorderScence.Key != this.Config.BorderScene) if (this.SelectedBorderScence.Key != this.Config.BorderScene)
return true; return true;
if (this.IsBorderEnabled != this.Config.IsBorderEnabled)
return true;
return false; return false;
} }
...@@ -94,7 +90,6 @@ namespace VIZ.H2V.Module ...@@ -94,7 +90,6 @@ namespace VIZ.H2V.Module
this.Config.SmoothCoeff = this.SmoothCoeff; this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame; this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.Config.BorderScene = this.SelectedBorderScence.Key; this.Config.BorderScene = this.SelectedBorderScence.Key;
this.Config.IsBorderEnabled = this.IsBorderEnabled;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0; this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmSingle.Upsert(this.Config); ApplicationDomainEx.LiteDbContext.AlgorithmSingle.Upsert(this.Config);
......
...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module ...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module
// 场景信息 // 场景信息
this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault(); this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault();
this.IsBorderEnabled = config.IsBorderEnabled;
} }
/// <summary> /// <summary>
...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module ...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module
if (this.SelectedBorderScence.Key != this.Config.BorderScene) if (this.SelectedBorderScence.Key != this.Config.BorderScene)
return true; return true;
if (this.IsBorderEnabled != this.Config.IsBorderEnabled)
return true;
return false; return false;
} }
...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module ...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module
this.Config.SmoothCoeff = this.SmoothCoeff; this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame; this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.Config.BorderScene = this.SelectedBorderScence.Key; this.Config.BorderScene = this.SelectedBorderScence.Key;
this.Config.IsBorderEnabled = this.IsBorderEnabled;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0; this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmSixteen.Upsert(this.Config); ApplicationDomainEx.LiteDbContext.AlgorithmSixteen.Upsert(this.Config);
......
...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module ...@@ -142,7 +142,6 @@ namespace VIZ.H2V.Module
// 场景信息 // 场景信息
this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault(); this.SelectedBorderScence = this.BorderScences?.FirstOrDefault(p => p.Key == this.Config.BorderScene) ?? this.BorderScences?.FirstOrDefault();
this.IsBorderEnabled = config.IsBorderEnabled;
} }
/// <summary> /// <summary>
...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module ...@@ -184,9 +183,6 @@ namespace VIZ.H2V.Module
if (this.SelectedBorderScence.Key != this.Config.BorderScene) if (this.SelectedBorderScence.Key != this.Config.BorderScene)
return true; return true;
if (this.IsBorderEnabled != this.Config.IsBorderEnabled)
return true;
return false; return false;
} }
...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module ...@@ -224,7 +220,6 @@ namespace VIZ.H2V.Module
this.Config.SmoothCoeff = this.SmoothCoeff; this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame; this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.Config.BorderScene = this.SelectedBorderScence.Key; this.Config.BorderScene = this.SelectedBorderScence.Key;
this.Config.IsBorderEnabled = this.IsBorderEnabled;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0; this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmTactics.Upsert(this.Config); ApplicationDomainEx.LiteDbContext.AlgorithmTactics.Upsert(this.Config);
......
...@@ -204,6 +204,12 @@ namespace VIZ.H2V.Module ...@@ -204,6 +204,12 @@ namespace VIZ.H2V.Module
public abstract AlgorithmBase GetConfig(); public abstract AlgorithmBase GetConfig();
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public abstract void SaveConfig(AlgorithmBase config);
/// <summary>
/// 执行重启算法 /// 执行重启算法
/// </summary> /// </summary>
/// <returns>是否成功重启</returns> /// <returns>是否成功重启</returns>
......
...@@ -98,5 +98,11 @@ namespace VIZ.H2V.Module ...@@ -98,5 +98,11 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
/// <returns>配置信息</returns> /// <returns>配置信息</returns>
AlgorithmBase GetConfig(); AlgorithmBase GetConfig();
/// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
void SaveConfig(AlgorithmBase config);
} }
} }
...@@ -48,13 +48,7 @@ namespace VIZ.H2V.Module ...@@ -48,13 +48,7 @@ namespace VIZ.H2V.Module
/// <param name="context">切换模式上下文</param> /// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context) public override void ChangeAutoMode(ChangeStrategyContext context)
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey); this.SetParams();
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params), option);
} }
/// <summary> /// <summary>
...@@ -95,7 +89,13 @@ namespace VIZ.H2V.Module ...@@ -95,7 +89,13 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public override void SetParams() public override void SetParams()
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params), option);
} }
/// <summary> /// <summary>
...@@ -117,6 +117,19 @@ namespace VIZ.H2V.Module ...@@ -117,6 +117,19 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public override void SaveConfig(AlgorithmBase config)
{
AlgorithmCableway entity = config as AlgorithmCableway;
if (entity == null)
return;
ApplicationDomainEx.LiteDbContext.AlgorithmCableway.Update(entity);
}
/// <summary>
/// 构建数据包 /// 构建数据包
/// </summary> /// </summary>
/// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param> /// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param>
......
...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module ...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module
/// <param name="context">切换模式上下文</param> /// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context) public override void ChangeAutoMode(ChangeStrategyContext context)
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey); this.SetParams();
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module ...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public override void SetParams() public override void SetParams()
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module ...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public override void SaveConfig(AlgorithmBase config)
{
AlgorithmNear entity = config as AlgorithmNear;
if (entity == null)
return;
ApplicationDomainEx.LiteDbContext.AlgorithmNear.Update(entity);
}
/// <summary>
/// 构建数据包 /// 构建数据包
/// </summary> /// </summary>
/// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param> /// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param>
......
...@@ -139,6 +139,19 @@ namespace VIZ.H2V.Module ...@@ -139,6 +139,19 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public override void SaveConfig(AlgorithmBase config)
{
AlgorithmSingle entity = config as AlgorithmSingle;
if (entity == null)
return;
ApplicationDomainEx.LiteDbContext.AlgorithmSingle.Update(entity);
}
/// <summary>
/// 构建数据包 /// 构建数据包
/// </summary> /// </summary>
/// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param> /// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param>
......
...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module ...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module
/// <param name="context">切换模式上下文</param> /// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context) public override void ChangeAutoMode(ChangeStrategyContext context)
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey); this.SetParams();
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module ...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public override void SetParams() public override void SetParams()
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module ...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public override void SaveConfig(AlgorithmBase config)
{
AlgorithmSixteen entity = config as AlgorithmSixteen;
if (entity == null)
return;
ApplicationDomainEx.LiteDbContext.AlgorithmSixteen.Update(entity);
}
/// <summary>
/// 构建数据包 /// 构建数据包
/// </summary> /// </summary>
/// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param> /// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param>
......
...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module ...@@ -49,13 +49,7 @@ namespace VIZ.H2V.Module
/// <param name="context">切换模式上下文</param> /// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context) public override void ChangeAutoMode(ChangeStrategyContext context)
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey); this.SetParams();
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module ...@@ -96,7 +90,13 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public override void SetParams() public override void SetParams()
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.set_params, null), option);
} }
/// <summary> /// <summary>
...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module ...@@ -128,6 +128,19 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 保存配置
/// </summary>
/// <param name="config">配置</param>
public override void SaveConfig(AlgorithmBase config)
{
AlgorithmTactics entity = config as AlgorithmTactics;
if (entity == null)
return;
ApplicationDomainEx.LiteDbContext.AlgorithmTactics.Update(entity);
}
/// <summary>
/// 构建数据包 /// 构建数据包
/// </summary> /// </summary>
/// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param> /// <param name="cmd">命令<see cref="AlgorithmAutoModeCmd"/></param>
......
...@@ -173,13 +173,30 @@ ...@@ -173,13 +173,30 @@
</Border> </Border>
<!-- 显示组 --> <!-- 显示组 -->
<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,5"> <StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,0,5" Orientation="Horizontal">
<CheckBox Style="{StaticResource CheckBox_Eye}" Width="30" Height="30" <CheckBox Style="{StaticResource CheckBox_Eye_Red}" Width="30" Height="30"
ToolTip="是否启用边线检测"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}" IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=FootballFieldPanelModel.IsShowBorder,Mode=TwoWay}"> IsChecked="{Binding Path=AlgorithmConfig.IsBorderEnabled,Mode=TwoWay}">
<behaviors:Interaction.Triggers> <behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
<CheckBox Style="{StaticResource CheckBox_Eye_Yellow}" Width="30" Height="30"
ToolTip="是否显示边线检测区域"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=AlgorithmConfig.IsShowBorder,Mode=TwoWay}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked"> <behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding ClearSideCheckPolygonCommand}" /> <behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
</behaviors:EventTrigger> </behaviors:EventTrigger>
</behaviors:Interaction.Triggers> </behaviors:Interaction.Triggers>
</CheckBox> </CheckBox>
......
...@@ -289,22 +289,51 @@ namespace VIZ.H2V.Module ...@@ -289,22 +289,51 @@ namespace VIZ.H2V.Module
#endregion #endregion
#region ClearSideCheckPolygonCommand -- 清理边线检测多边形命令 #region IsBorderShowChangedCommand -- 边线检测区域是否显示改变命令
/// <summary> /// <summary>
/// 清理边线检测多边形命令 /// 边线检测区域是否显示改变命令
/// </summary> /// </summary>
public VCommand ClearSideCheckPolygonCommand { get; set; } public VCommand IsBorderShowChangedCommand { get; set; }
/// <summary> /// <summary>
/// 清理边线检测多边形 /// 边线检测区域是否显示改变
/// </summary> /// </summary>
private void ClearSideCheckPolygon() private void IsBorderShowChanged()
{ {
ClearVideoControlContext clear_context = new ClearVideoControlContext(false); // 清理显示框
clear_context.IsClearSideCheckPolygon = true; if (!this.AlgorithmConfig.IsShowBorder)
{
ClearVideoControlContext clear_context = new ClearVideoControlContext(false);
clear_context.IsClearSideCheckPolygon = true;
this.ClearVideoControl(clear_context); this.ClearVideoControl(clear_context);
}
this.AlgorithmControllerDic[this.StrategyType].SaveConfig(this.AlgorithmConfig);
}
#endregion
#region IsBorderEnabledChangedCommand -- 边线检测算法可用改变命令
/// <summary>
/// 边线检测算法可用改变命令
/// </summary>
public VCommand IsBorderEnabledChangedCommand { get; set; }
/// <summary>
/// 边线检测算法可用改变
/// </summary>
private void IsBorderEnabledChanged()
{
this.AlgorithmControllerDic[this.StrategyType].SaveConfig(this.AlgorithmConfig);
// 算法未准备完毕不需要向算法发送指令
if (!this.IsViewStatusReady())
return;
this.AlgorithmControllerDic[this.StrategyType].SetParams();
} }
#endregion #endregion
......
...@@ -248,7 +248,7 @@ namespace VIZ.H2V.Module ...@@ -248,7 +248,7 @@ namespace VIZ.H2V.Module
/// <param name="view">视图</param> /// <param name="view">视图</param>
private void OnAlgorithmMessage__crop_roi__borderline(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view) private void OnAlgorithmMessage__crop_roi__borderline(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view)
{ {
if (msg.borderline == null || !this.FootballFieldPanelModel.IsShowBorder) if (msg.borderline == null || !this.AlgorithmConfig.IsShowBorder)
{ {
view.video.ClearSideCheckPolygon(); view.video.ClearSideCheckPolygon();
......
...@@ -58,7 +58,8 @@ namespace VIZ.H2V.Module ...@@ -58,7 +58,8 @@ namespace VIZ.H2V.Module
this.SettingCommand = new VCommand<string>(this.Setting); this.SettingCommand = new VCommand<string>(this.Setting);
this.DetectCommand = new VCommand(this.Detect); this.DetectCommand = new VCommand(this.Detect);
this.RestartCommand = new VCommand(this.Restart); this.RestartCommand = new VCommand(this.Restart);
this.ClearSideCheckPolygonCommand = new VCommand(this.ClearSideCheckPolygon); this.IsBorderShowChangedCommand = new VCommand(this.IsBorderShowChanged);
this.IsBorderEnabledChangedCommand = new VCommand(this.IsBorderEnabledChanged);
} }
/// <summary> /// <summary>
...@@ -337,5 +338,17 @@ namespace VIZ.H2V.Module ...@@ -337,5 +338,17 @@ namespace VIZ.H2V.Module
ApplicationDomainEx.CsvContext.LogOperations.Enqueue(log); ApplicationDomainEx.CsvContext.LogOperations.Enqueue(log);
} }
} }
/// <summary>
/// 视图状态是否准备完毕
/// </summary>
/// <returns>算法是否准备完毕</returns>
private bool IsViewStatusReady()
{
return !(this.ViewStatus == NDIViewStatus.WaitSetup ||
this.ViewStatus == NDIViewStatus.WaitStop ||
this.ViewStatus == NDIViewStatus.Stop ||
this.ViewStatus == NDIViewStatus.WaitCheckOK);
}
} }
} }
...@@ -43,5 +43,10 @@ namespace VIZ.H2V.Storage ...@@ -43,5 +43,10 @@ namespace VIZ.H2V.Storage
/// 是否启用边线检测 /// 是否启用边线检测
/// </summary> /// </summary>
public bool IsBorderEnabled { get; set; } = true; public bool IsBorderEnabled { get; set; } = true;
/// <summary>
/// 是否显示边线检测
/// </summary>
public bool IsShowBorder { get; set; } = true;
} }
} }
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