Commit f911ad15 by liulongfei

1. 添加目标框丢失指示灯

2. 部分样式调整
parent d57b0cc6
......@@ -72,9 +72,7 @@
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#11ffffff"></Setter>
<Setter TargetName="rect1" Property="Fill" Value="#ffff0000"></Setter>
<Setter TargetName="rect2" Property="Fill" Value="#ffff0000"></Setter>
<Setter TargetName="bd" Property="Background" Value="#66ff0000"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
......
......@@ -174,4 +174,30 @@
</Setter>
</Style>
<Style x:Key="CheckBox_IsAlgorithmTargetBoxExists" TargetType="CheckBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Width" Value="32"></Setter>
<Setter Property="Height" Value="32"></Setter>
<Setter Property="IsHitTestVisible" Value="False"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid x:Name="border" Background="Transparent" UseLayoutRounding="True">
<Ellipse Width="20" Height="20" x:Name="e_false" Visibility="Visible" Fill="Red"
HorizontalAlignment="Center" VerticalAlignment="Center">
</Ellipse>
<Ellipse Width="20" Height="20" x:Name="e_true" Visibility="Collapsed" Fill="Green"
HorizontalAlignment="Center" VerticalAlignment="Center"></Ellipse>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="e_false" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="e_true" Property="Visibility" Value="Visible"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -5,6 +5,7 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="Padding" Value="10,0,0,0"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
......@@ -19,7 +20,7 @@
<Ellipse x:Name="ellipse_inner" Width="12" Height="12" Fill="#00f79b00"></Ellipse>
</Grid>
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1"
Margin="10,0,0,0"></ContentPresenter>
Margin="{TemplateBinding Padding}"></ContentPresenter>
</Grid>
</Border>
<ControlTemplate.Triggers>
......
......@@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace VIZ.H2V.Module
{
/// <summary>
/// 3D鼠标支持
/// 循环支持
/// </summary>
public interface INavigation3DCheckSupport
public interface ILoopSupport
{
}
}
......@@ -11,45 +11,47 @@ using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 3D鼠标检测控制器
/// 循环控制器
/// 1. 3D鼠标触碰检测
/// 2. 更新目标框丢失指示灯
/// </summary>
public class Navigation3DCheckController : IDisposable
public class LoopController : IDisposable
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(Navigation3DCheckController));
private readonly static ILog log = LogManager.GetLogger(typeof(LoopController));
/// <summary>
/// 3D鼠标检测控制器
/// 循环控制器
/// </summary>
/// <param name="support">支持</param>
public Navigation3DCheckController(INavigation3DCheckSupport support)
public LoopController(ILoopSupport support)
{
// 注册到对象池
ApplicationDomainEx.ObjectPoolManager.Add("Navigation3DCheckController", this);
ApplicationDomainEx.ObjectPoolManager.Add("LoopController", this);
SystemConfig systemConfig = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
if (systemConfig != null)
{
this.IsEnabled = systemConfig.IsWhenNavigationTouchedChangeToManualMode;
this.Is3DNavigationCheckEnabled = systemConfig.IsWhenNavigationTouchedChangeToManualMode;
}
this.Support = support;
this.taskInfo = new TaskInfo();
this.executeTask = Task.Run(this.ExecuteCheck);
this.executeTask = Task.Run(this.ExecuteLoop);
}
/// <summary>
/// 支持
/// </summary>
public INavigation3DCheckSupport Support { get; private set; }
public ILoopSupport Support { get; private set; }
/// <summary>
/// 是否启用
/// 是否启用3D鼠标检测
/// </summary>
public bool IsEnabled { get; set; }
public bool Is3DNavigationCheckEnabled { get; set; }
/// <summary>
/// 任务信息
......@@ -64,7 +66,7 @@ namespace VIZ.H2V.Module
/// <summary>
/// 执行检测
/// </summary>
private void ExecuteCheck()
private void ExecuteLoop()
{
TaskInfo info = this.taskInfo;
......@@ -72,8 +74,13 @@ namespace VIZ.H2V.Module
{
try
{
this._executeCheck();
// 检测3D鼠标值
this.Check3DNavigation();
// 更新算法是否拥有目标框
this.UpdateIsAlgorithmTargetBoxExists();
// 等待
Task.Delay(100).Wait();
}
catch (Exception ex)
......@@ -84,12 +91,12 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 执行检测
/// 检测3D鼠标
/// </summary>
private void _executeCheck()
private void Check3DNavigation()
{
// 如果未启用,那么不处理
if (!this.IsEnabled)
if (!this.Is3DNavigationCheckEnabled)
return;
List<Navigation3DMapping> mappingList = ApplicationDomainEx.Navigation3DMapping.Mappings;
......@@ -118,6 +125,7 @@ namespace VIZ.H2V.Module
if (service.ViewStatus != NDIViewStatus.CropRoi && service.ViewStatus != NDIViewStatus.Detect)
return;
// 切换手动模式
WPFHelper.BeginInvoke(() =>
{
ChangeStrategyContext context = new ChangeStrategyContext();
......@@ -130,6 +138,18 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 更新算法是否拥有目标框
/// </summary>
private void UpdateIsAlgorithmTargetBoxExists()
{
List<INDIViewService> services = ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>();
if (services == null)
return;
services.ForEach(p => p.UpdateIsAlgorithmTargetBoxExists());
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
......
......@@ -49,12 +49,12 @@
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top">
<CheckBox Height="30" Style="{StaticResource ResourceKey=CheckBox_Eye}"
IsChecked="{Binding Path=IsShowAlgorithmTargetBox,Mode=TwoWay}"></CheckBox>
<Rectangle Width="2" Fill="#EEFFFFFF" Height="18" Margin="20,0,20,0"></Rectangle>
<Rectangle Width="2" Fill="#88FFFFFF" Height="18" Margin="20,0,20,0"></Rectangle>
<Button Command="{Binding Path=InitTallyCommand}" ToolTip="初始Tally"
Style="{StaticResource Button_Tally}" Height="30"></Button>
<Button Command="{Binding Path=InitNavigation3DCommand}" ToolTip="初始化摇杆"
Style="{StaticResource Button_Navigation3D}" Height="30"></Button>
<Rectangle Width="2" Fill="#EEFFFFFF" Height="18" Margin="20,0,20,0"></Rectangle>
<Rectangle Width="2" Fill="#88FFFFFF" Height="18" Margin="20,0,20,0"></Rectangle>
<Button Command="{Binding Path=SettingCommand}" ToolTip="系统设置"
Style="{StaticResource Button_Setting}" Height="30"></Button>
<Button Command="{Binding Path=MinCommand}" ToolTip="最小化"
......@@ -64,7 +64,7 @@
</StackPanel>
</Grid>
<!-- 主体 -->
<Grid Grid.Row="1" Margin="0,0,20,0">
<Grid Grid.Row="1" Margin="25,10,25,10">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
......@@ -73,10 +73,10 @@
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:NDIView x:Name="view_CAM_1" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="30"></local:NDIView>
<local:NDIView x:Name="view_CAM_2" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="30"></local:NDIView>
<local:NDIView x:Name="view_CAM_3" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="30"></local:NDIView>
<local:NDIView x:Name="view_CAM_4" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="30"></local:NDIView>
<local:NDIView x:Name="view_CAM_1" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="5,5,20,5"></local:NDIView>
<local:NDIView x:Name="view_CAM_2" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="5,5,20,5"></local:NDIView>
<local:NDIView x:Name="view_CAM_3" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="20,5,5,5"></local:NDIView>
<local:NDIView x:Name="view_CAM_4" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="20,5,5,5"></local:NDIView>
</Grid>
<!-- 底部 -->
<Border Grid.Row="2" Background="#ff12202d">
......@@ -89,6 +89,7 @@
</Grid.ColumnDefinitions>
<!-- 算法服务监控 -->
<StackPanel Orientation="Horizontal" Background="Transparent"
Visibility="{Binding Path=IsShowAlgorithmTargetBox,Converter={StaticResource Bool2VisibilityConverter}}"
ToolTipService.Placement="Top" ToolTipService.HasDropShadow="True"
ToolTipService.HorizontalOffset="-65">
<StackPanel.ToolTip>
......@@ -133,6 +134,7 @@
</StackPanel>
<!-- 剪切服务监控 -->
<StackPanel Orientation="Horizontal" Background="Transparent" Grid.Column="1"
Visibility="{Binding Path=IsShowAlgorithmTargetBox,Converter={StaticResource Bool2VisibilityConverter}}"
ToolTipService.Placement="Top" ToolTipService.HasDropShadow="True"
ToolTipService.HorizontalOffset="-65">
<StackPanel.ToolTip>
......@@ -176,7 +178,8 @@
<TextBlock Text="界面" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="10,0,0,0"></TextBlock>
</StackPanel>
<!-- 计算机监控 -->
<StackPanel Orientation="Horizontal" Grid.Column="2">
<StackPanel Orientation="Horizontal" Grid.Column="2"
Visibility="{Binding Path=IsShowAlgorithmTargetBox,Converter={StaticResource Bool2VisibilityConverter}}">
<!-- CPU -->
<TextBlock Text="CPU:" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="10,0,0,0"></TextBlock>
<TextBlock Text="{Binding Path=SystemMonitorModel.CpuUsedPercentage,StringFormat=P}" VerticalAlignment="Center" Foreground="White" FontSize="12" Margin="10,0,0,0"
......
......@@ -21,7 +21,7 @@ namespace VIZ.H2V.Module
/// <summary>
/// NDI主视图模型
/// </summary>
public class NDIMainViewModel : ViewModelBase, INDIMainViewService, IHotkeySupport, IGpioSupport, INavigation3DCheckSupport
public class NDIMainViewModel : ViewModelBase, INDIMainViewService, IHotkeySupport, IGpioSupport, ILoopSupport
{
/// <summary>
/// 日志
......@@ -91,7 +91,7 @@ namespace VIZ.H2V.Module
{
this.hotkeyController = new HotkeyController(this);
this.gpioController = new GpioController(this);
this.navigation3DCheckController = new Navigation3DCheckController(this);
this.loopController = new LoopController(this);
}
/// <summary>
......@@ -129,9 +129,9 @@ namespace VIZ.H2V.Module
private GpioController gpioController;
/// <summary>
/// 3D鼠标检测控制器
/// 循环控制器
/// </summary>
private Navigation3DCheckController navigation3DCheckController;
private LoopController loopController;
// ======================================================================================
// === Property ===
......@@ -376,7 +376,7 @@ namespace VIZ.H2V.Module
/// <param name="isEnabled">是否生效</param>
public void SetNavigation3DCheckEnabled(bool isEnabled)
{
this.navigation3DCheckController.IsEnabled = isEnabled;
this.loopController.Is3DNavigationCheckEnabled = isEnabled;
}
// ======================================================================================
......
......@@ -117,6 +117,11 @@ namespace VIZ.H2V.Module
void UpdateIsShowAlgorithmTargetBox(bool isShow);
/// <summary>
/// 更新算法是否拥有目标框
/// </summary>
void UpdateIsAlgorithmTargetBoxExists();
/// <summary>
/// 停止算法
/// </summary>
void StopAlgorithm();
......
......@@ -85,7 +85,7 @@
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
......@@ -135,11 +135,11 @@
<Grid IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="180"></RowDefinition>
<RowDefinition Height="240"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<!-- ************************************************************ -->
<!-- 该无意义,暂时注释 -->
<!-- 该无意义,暂时注释 -->
<!--<CheckBox FontSize="16" Content="裁切策略:" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"
IsChecked="{Binding Path=IsUseClip,Mode=TwoWay}"
Style="{StaticResource CheckBox_NdiView}"></CheckBox>-->
......@@ -151,19 +151,28 @@
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<!-- 算法目标丢失指示灯, 不可点击 -->
<CheckBox Style="{StaticResource CheckBox_IsAlgorithmTargetBoxExists}"
IsHitTestVisible="False"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,0"
IsChecked="{Binding Path=IsAlgorithmTargetBoxExists,Mode=OneWay}"></CheckBox>
<!-- 算法模式 -->
<RadioButton Content="A" FontSize="16" Foreground="White"
ToolTip="A" Grid.Row="0"
ToolTip="A" Grid.Row="1" Padding="12,0,0,0"
Style="{StaticResource RadioButton_NdiView}"
IsChecked="{Binding IsAutoModeChecked,Mode=TwoWay}">
</RadioButton>
<RadioButton Content="M" FontSize="16" Foreground="White"
ToolTip="M" Grid.Row="1"
<!-- 居中模式 -->
<RadioButton Content="C" FontSize="16" Foreground="White"
ToolTip="C" Grid.Row="2" Padding="12,0,0,0"
Style="{StaticResource RadioButton_NdiView}"
IsChecked="{Binding IsCenterModeChecked,Mode=TwoWay}">
</RadioButton>
<RadioButton Content="H" FontSize="16" Foreground="White"
ToolTip="H" Grid.Row="2"
<!-- 手动模式 -->
<RadioButton Content="M" FontSize="16" Foreground="White"
ToolTip="M" Grid.Row="3"
IsChecked="{Binding Path=IsManualModeChecked,Mode=TwoWay}"
Style="{StaticResource RadioButton_NdiView}">
</RadioButton>
......@@ -175,7 +184,7 @@
<Grid Grid.Row="1">
<!-- 单人机位 ===== 目标检测按钮 -->
<Button Grid.Row="1" VerticalAlignment="Bottom" Style="{StaticResource Button_Setting}"
Height="40" Width="120" HorizontalAlignment="Right" Margin="0,0,10,0"
Height="40" Width="100" HorizontalAlignment="Right" Margin="0,0,10,0"
Command="{Binding Path=DetectCommand}">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource NDIViewProperty2BoolConverter_DetectButton}">
......
......@@ -286,7 +286,7 @@ namespace VIZ.H2V.Module
private void Setting(string key)
{
NDISettingView view = new NDISettingView(key, this.ID);
NoneWindow window = new NoneWindow(1200, 1150, view);
NoneWindow window = new NoneWindow(1200, 1050, view);
window.Owner = this.GetWindow();
window.ShowDialog();
......
......@@ -221,6 +221,9 @@ namespace VIZ.H2V.Module
/// <param name="view">视图</param>
private void OnAlgorithmMessage__crop_roi__target_bbox(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view)
{
// 当前是否拥有目标框
this.isAlgorithmTargetBoxExists_cache = msg.target_bbox != null;
// 没有目标框 || 配置是否显示目标框
if (msg.target_bbox == null || !this.IsShowAlgorithmTargetBox)
{
......
......@@ -380,6 +380,22 @@ namespace VIZ.H2V.Module
#endregion
#region IsAlgorithmTargetBoxExists -- 算法目标框是否存在
private bool isAlgorithmTargetBoxExists_cache;
private bool isAlgorithmTargetBoxExists;
/// <summary>
/// 算法目标框是否存在
/// </summary>
public bool IsAlgorithmTargetBoxExists
{
get { return isAlgorithmTargetBoxExists; }
set { isAlgorithmTargetBoxExists = value; this.RaisePropertySaveChanged(nameof(IsAlgorithmTargetBoxExists)); }
}
#endregion
// --------------------------------------------------------------------------------------
#region IsUseClip -- 是否使用裁切
......
......@@ -23,6 +23,7 @@ namespace VIZ.H2V.Module
/// IAlgorithmSupport -- 算法支持
/// IManualSupport -- 手动控制支持
/// IRecordingSupport -- 录制支持
/// ILoopSupport -- 循环支持
/// </remarks>
public partial class NDIViewModel : ViewModelBase, INDIViewService, IAlgorithmSupport, IManualSupport, IRecordingSupport
{
......@@ -96,7 +97,6 @@ namespace VIZ.H2V.Module
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Cableway, new AlgorithmController_Cableway(this));
this.ManualController = new ManualController(this);
}
/// <summary>
......@@ -397,6 +397,17 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 更新算法是否拥有目标框
/// </summary>
public void UpdateIsAlgorithmTargetBoxExists()
{
if (this.IsAlgorithmTargetBoxExists == this.isAlgorithmTargetBoxExists_cache)
return;
this.IsAlgorithmTargetBoxExists = this.isAlgorithmTargetBoxExists_cache;
}
/// <summary>
/// 停止算法
/// </summary>
public void StopAlgorithm()
......
......@@ -202,8 +202,8 @@
<Compile Include="NDIMainView\Controller\Gpio\IGpioSupport.cs" />
<Compile Include="NDIMainView\Controller\Hotkey\HotkeyController.cs" />
<Compile Include="NDIMainView\Controller\Hotkey\IHotkeySupport.cs" />
<Compile Include="NDIMainView\Controller\Navigation3DCheck\INavigation3DCheckSupport.cs" />
<Compile Include="NDIMainView\Controller\Navigation3DCheck\Navigation3DCheckController.cs" />
<Compile Include="NDIMainView\Controller\Loop\ILoopSupport.cs" />
<Compile Include="NDIMainView\Controller\Loop\LoopController.cs" />
<Compile Include="NDIMainView\Service\INDIMainViewService.cs" />
<Compile Include="NDISettingView\ViewModel\Algorithm\AlgorithmCablewayPanelViewModel.cs" />
<Compile Include="NDISettingView\ViewModel\Algorithm\AlgorithmTacticsPanelViewModel.cs" />
......
......@@ -10,6 +10,9 @@
Icon="logo.ico"
Title="AI横转竖智能裁切系统" Height="450" Width="800">
<Grid>
<!--<Viewbox>
<module:NDIMainView Width="2560" Height="1440"></module:NDIMainView>
</Viewbox>-->
<module:NDIMainView></module:NDIMainView>
</Grid>
</Window>
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