Commit aaed881f by liulongfei

修复指示灯逻辑

parent f911ad15
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using VIZ.H2V.Domain;
namespace VIZ.H2V.Module.Resource
{
/// <summary>
/// 算法是否拥有目标框转化器
/// values[0] : IsAlgorithmTargetBoxExists
/// values[1] : ViewStatus
/// </summary>
public class AlgorithmTargetBoxExistsConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values == null || values.Length != 2)
return false;
bool isAlgorithmTargetBoxExists = (bool)values[0];
NDIViewStatus viewStatus = (NDIViewStatus)values[1];
// 在裁切状态,且拥有目标框时才显示绿灯,否则为红灯
return viewStatus == NDIViewStatus.CropRoi && isAlgorithmTargetBoxExists;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
......@@ -150,6 +150,7 @@
<Compile Include="Converter\AlgorithmStrategyTagStringConverter.cs" />
<Compile Include="Converter\AlgorithmStrategyType2FootballFieldHeightConverter.cs" />
<Compile Include="Converter\AlgorithmStrategyType2FootballFieldOrientationConverter.cs" />
<Compile Include="Converter\AlgorithmTargetBoxExistsConverter.cs" />
<Compile Include="Converter\ServiceFps2VisibilityConverter.cs" />
<Compile Include="Converter\ServiceFps2SolidBrushConverter.cs" />
<Compile Include="Converter\TallyColor2RadialGradientBrushConverter.cs" />
......
......@@ -117,7 +117,7 @@
<toolkit:DoubleUpDown Grid.Column="1" Minimum="0" Maximum="1000000" Increment="1" Height="40"
Value="{Binding Path=KeepPrevFrame,Mode=TwoWay}"></toolkit:DoubleUpDown>
<TextBlock Text="内" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Column="2"
Margin="10,0,0,0"></TextBlock>
HorizontalAlignment="Right"></TextBlock>
</Grid>
<!-- GPU -->
<Grid Grid.Row="6">
......
......@@ -80,7 +80,7 @@
<toolkit:DoubleUpDown Grid.Column="1" Minimum="0" Maximum="1000000" Increment="1" Height="40"
Value="{Binding Path=KeepPrevFrame,Mode=TwoWay}"></toolkit:DoubleUpDown>
<TextBlock Text="内" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Column="2"
Margin="10,0,0,0"></TextBlock>
HorizontalAlignment="Right"></TextBlock>
</Grid>
<!-- GPU -->
<Grid Grid.Row="4">
......@@ -148,7 +148,7 @@
<toolkit:DoubleUpDown Grid.Column="1" Minimum="0" Maximum="100" Increment="0.01" Height="40"
Value="{Binding Path=AreaCorrectionRatio,Mode=TwoWay}"></toolkit:DoubleUpDown>
<TextBlock Text="%" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Column="2"
Margin="10,0,0,0"></TextBlock>
HorizontalAlignment="Right"></TextBlock>
</Grid>
<!-- 单人机位面积校准置信度 -->
......
......@@ -142,5 +142,10 @@ namespace VIZ.H2V.Module
/// 发送错误标记
/// </summary>
void SendErrorTag();
/// <summary>
/// 当算法停止时处理
/// </summary>
void WhenAlgorithmStop();
}
}
......@@ -70,6 +70,8 @@
ViewStatusListString="CropRoi"
StrategyModeListString="center_mode">
</resource:NDIViewProperty2VisibilityConverter>
<!-- 目标框丢失指示灯 -->
<resource:AlgorithmTargetBoxExistsConverter x:Key="AlgorithmTargetBoxExistsConverter"></resource:AlgorithmTargetBoxExistsConverter>
</ResourceDictionary>
</UserControl.Resources>
......@@ -156,8 +158,14 @@
<!-- 算法目标丢失指示灯, 不可点击 -->
<CheckBox Style="{StaticResource CheckBox_IsAlgorithmTargetBoxExists}"
IsHitTestVisible="False"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,0"
IsChecked="{Binding Path=IsAlgorithmTargetBoxExists,Mode=OneWay}"></CheckBox>
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,0">
<CheckBox.IsChecked>
<MultiBinding Converter="{StaticResource AlgorithmTargetBoxExistsConverter}">
<Binding Path="IsAlgorithmTargetBoxExists"></Binding>
<Binding Path="ViewStatus"></Binding>
</MultiBinding>
</CheckBox.IsChecked>
</CheckBox>
<!-- 算法模式 -->
<RadioButton Content="A" FontSize="16" Foreground="White"
ToolTip="A" Grid.Row="1" Padding="12,0,0,0"
......
......@@ -377,6 +377,7 @@ namespace VIZ.H2V.Module
this.AlgorithmControllerDic[this.StrategyType].StopAlgorithm();
this.ViewStatus = NDIViewStatus.Stop;
this.WhenAlgorithmStop();
});
}
......
......@@ -391,7 +391,12 @@ namespace VIZ.H2V.Module
public bool IsAlgorithmTargetBoxExists
{
get { return isAlgorithmTargetBoxExists; }
set { isAlgorithmTargetBoxExists = value; this.RaisePropertySaveChanged(nameof(IsAlgorithmTargetBoxExists)); }
set
{
isAlgorithmTargetBoxExists = value;
isAlgorithmTargetBoxExists_cache = value;
this.RaisePropertySaveChanged(nameof(IsAlgorithmTargetBoxExists));
}
}
#endregion
......
......@@ -424,6 +424,15 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 当算法停止时处理
/// </summary>
public void WhenAlgorithmStop()
{
// 清理目标跟踪框信息
this.isAlgorithmTargetBoxExists_cache = false;
}
/// <summary>
/// 加载 -- 更新模式属性
/// </summary>
private void UpdateModeProperty()
......
......@@ -108,6 +108,7 @@ namespace VIZ.H2V.Module
return;
service.ViewStatus = NDIViewStatus.Stop;
service.WhenAlgorithmStop();
//====================================================================
// CODE: SYSTEM_LOG | 记录日志
......
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