Commit 5ecff6c6 by liulongfei

1. 添加算法配置分组,设置界面添加分组选项

parent 3f2501e4
......@@ -3,22 +3,42 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Domain
{
/// <summary>
/// 剪切算法切换至手动消息
/// 算法策略分组模型
/// </summary>
public class AlgorithmStrategyChangedToManualMessage
public class AlgorithmStrategyGroupModel : ModelBase
{
#region GroupName -- 分组名称
private string groupName;
/// <summary>
/// 触发源
/// 分组名称
/// </summary>
public object Source { get; set; }
public string GroupName
{
get { return groupName; }
set { groupName = value; this.RaisePropertyChanged(nameof(GroupName)); }
}
#endregion
#region Items -- 子项集合
private List<AlgorithmStrategyModel> items = new List<AlgorithmStrategyModel>();
/// <summary>
/// 是否切换至手动
/// 子项集合
/// </summary>
public bool IsChangedToManual { get; set; }
public List<AlgorithmStrategyModel> Items
{
get { return items; }
set { items = value; this.RaisePropertyChanged(nameof(Items)); }
}
#endregion
}
}
......@@ -41,16 +41,16 @@ namespace VIZ.H2V.Domain
#endregion
#region Tag -- 标记
#region Group -- 分组
private string tag;
private string group;
/// <summary>
/// 标记
/// 分组
/// </summary>
public string Tag
public string Group
{
get { return tag; }
set { tag = value; this.RaisePropertyChanged(nameof(Tag)); }
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
......
......@@ -74,9 +74,9 @@
<Compile Include="Message\Algorithm\Implementation\AlgorithmMessage__crop_roi.cs" />
<Compile Include="Message\Algorithm\Implementation\AlgorithmMessage__checked_ok.cs" />
<Compile Include="Message\Algorithm\Interface\IAlgorithmMessage__roi.cs" />
<Compile Include="Message\NDI\AlgorithmStrategyChangedToManualMessage.cs" />
<Compile Include="Model\Algorithm\AlgorithmProcessModel.cs" />
<Compile Include="Model\Algorithm\AlgorithmBorderScenceModel.cs" />
<Compile Include="Model\Algorithm\AlgorithmStrategyGroupModel.cs" />
<Compile Include="Model\Algorithm\AlgorithmStrategyModel.cs" />
<Compile Include="Model\Navigation3D\Navigation3DMappingDomainModel.cs" />
<Compile Include="Model\Navigation3D\Navigation3DMappingGroupModel.cs" />
......
......@@ -182,7 +182,7 @@ namespace VIZ.H2V.Module
public int AlgorithmStatusMinFps
{
get { return algorithmStatusMinFps; }
set { algorithmStatusMinFps = value; this.RaisePropertyChanged(nameof(AlgorithmStatusMinFps)); }
set { algorithmStatusMinFps = value; this.RaisePropertySaveChanged(nameof(AlgorithmStatusMinFps)); }
}
#endregion
......@@ -196,7 +196,7 @@ namespace VIZ.H2V.Module
public int ClipStatusMinFps
{
get { return clipStatusMinFps; }
set { clipStatusMinFps = value; this.RaisePropertyChanged(nameof(ClipStatusMinFps)); }
set { clipStatusMinFps = value; this.RaisePropertySaveChanged(nameof(ClipStatusMinFps)); }
}
#endregion
......@@ -463,7 +463,7 @@ namespace VIZ.H2V.Module
service.ClipFPS.OnFpsChanged += ClipFpsChanged;
}
this.NDIViewServices = services;
this.NDIViewServices = services.OrderBy(p => p.ViewKey).ToList();
break;
}
......
......@@ -33,28 +33,38 @@
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="机位策略" Foreground="White" FontSize="18" VerticalAlignment="Center" Margin="45,0,40,0" Grid.Row="1"></TextBlock>
<ComboBox Style="{StaticResource ComboBox_Setting}" Grid.Row="2" Margin="45,0,40,0" Height="40"
<!-- 模块 -->
<TextBlock Text="模块" Foreground="White" FontSize="18" VerticalAlignment="Center" Margin="45,0,40,0" Grid.Row="0"></TextBlock>
<ComboBox Style="{StaticResource ComboBox_Setting}" Grid.Row="1" Margin="45,0,40,0" Height="40"
ItemsSource="{Binding Path=AlgorithmGroups,Mode=OneWay}"
SelectedValue="{Binding Path=SelectedAlgorithmGroup,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Border Background="Transparent" IsHitTestVisible="False">
<TextBlock Text="{Binding Path=GroupName}" Foreground="White" FontSize="16"></TextBlock>
</Border>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- 机位策略 -->
<TextBlock Text="机位策略" Foreground="White" FontSize="18" VerticalAlignment="Center" Margin="45,0,40,0" Grid.Row="2"></TextBlock>
<ComboBox Style="{StaticResource ComboBox_Setting}" Grid.Row="3" Margin="45,0,40,0" Height="40"
ItemsSource="{Binding Path=AlgorithmStrategys,Mode=OneWay}"
SelectedValue="{Binding Path=SelectedAlgorithmStrategy,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Border Background="Transparent" IsHitTestVisible="False">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="{Binding Path=DisplayName}" Foreground="White" FontSize="16"></TextBlock>
<TextBlock Text="{Binding Path=Tag,Mode=OneWay,Converter={StaticResource AlgorithmStrategyTagStringConverter}}"
Foreground="White" FontSize="16" Margin="10,0,0,0"></TextBlock>
</StackPanel>
<TextBlock Text="{Binding Path=DisplayName}" Foreground="White" FontSize="16"></TextBlock>
</Border>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<fcommon:NavigationControl Grid.Row="3"
ItemsSource="{Binding Path=AlgorithmStrategys}"
<fcommon:NavigationControl Grid.Row="4"
ItemsSource="{Binding Path=AllAlgorithmStrategys}"
SelectedValue="{Binding Path=SelectedAlgorithmStrategy,Mode=OneWay}">
</fcommon:NavigationControl>
......
......@@ -61,6 +61,54 @@ namespace VIZ.H2V.Module
#endregion
#region AllAlgorithmStrategys -- 所有的算法分类集合
private List<AlgorithmStrategyModel> allAlgorithmStrategys;
/// <summary>
/// 所有的算法分类集合
/// </summary>
public List<AlgorithmStrategyModel> AllAlgorithmStrategys
{
get { return allAlgorithmStrategys; }
set { allAlgorithmStrategys = value; this.RaisePropertyChanged(nameof(AllAlgorithmStrategys)); }
}
#endregion
#region AlgorithmGroups -- 算法分组集合
private List<AlgorithmStrategyGroupModel> algorithmGroups;
/// <summary>
/// 算法分组集合
/// </summary>
public List<AlgorithmStrategyGroupModel> AlgorithmGroups
{
get { return algorithmGroups; }
set { algorithmGroups = value; this.RaisePropertyChanged(nameof(AlgorithmGroups)); }
}
#endregion
#region SelectedAlgorithmGroup -- 选中的算法分组
private AlgorithmStrategyGroupModel selectedAlgorithmGroup;
/// <summary>
/// 选中的算法分组
/// </summary>
public AlgorithmStrategyGroupModel SelectedAlgorithmGroup
{
get { return selectedAlgorithmGroup; }
set
{
selectedAlgorithmGroup = value;
this.RaisePropertyChanged(nameof(SelectedAlgorithmGroup));
this.AlgorithmStrategys = value?.Items;
}
}
#endregion
#region AlgorithmStrategys -- 算法分类集合
private List<AlgorithmStrategyModel> algorithmStrategys;
......@@ -119,29 +167,37 @@ namespace VIZ.H2V.Module
if (ApplicationDomainEx.CsvContext.AlgorithmStrategys == null)
return;
List<AlgorithmStrategyModel> list = new List<AlgorithmStrategyModel>();
AlgorithmStrategyModel selected = null;
List<AlgorithmStrategyModel> all = new List<AlgorithmStrategyModel>();
List<AlgorithmStrategyGroupModel> groups = new List<AlgorithmStrategyGroupModel>();
foreach (AlgorithmStrategy entity in ApplicationDomainEx.CsvContext.AlgorithmStrategys)
{
AlgorithmStrategyModel model = new AlgorithmStrategyModel();
model.ID = entity.ID;
model.Group = entity.Group;
model.Type = entity.Type;
model.Tag = entity.Tag;
model.Name = entity.Name;
model.DisplayName = entity.DisplayName;
model.MainPath = entity.MainPath;
model.ViewType = this.GetViewType(entity.Type);
if (selected == null)
AlgorithmStrategyGroupModel group = groups.FirstOrDefault(p => p.GroupName == model.Group);
if (group == null)
{
selected = (entity.ID == strategyID) ? model : null;
group = new AlgorithmStrategyGroupModel();
group.GroupName = model.Group;
groups.Add(group);
}
list.Add(model);
group.Items.Add(model);
all.Add(model);
}
this.AlgorithmStrategys = list;
this.SelectedAlgorithmStrategy = selected;
this.oldAlgorithmStrategy = selected;
this.AllAlgorithmStrategys = all;
this.AlgorithmGroups = groups;
this.SelectedAlgorithmGroup = groups.FirstOrDefault(p => p.Items.Any(i => i.ID == strategyID));
this.SelectedAlgorithmStrategy = this.SelectedAlgorithmGroup == null ? null : this.SelectedAlgorithmGroup.Items.FirstOrDefault(p => p.ID == strategyID);
this.oldAlgorithmStrategy = this.SelectedAlgorithmStrategy;
this.oldGpu = this.ViewConfig.GPU;
}
......
......@@ -247,6 +247,8 @@ namespace VIZ.H2V.Module
}
}
none.IsLocalStream = true;
this.NDIStreamInfos = list;
this.NDIStreamInfosView = CollectionViewSource.GetDefaultView(this.NDIStreamInfos);
this.NDIStreamInfosView.Filter = o => this.NDIStreamInfosViewFilter(o as NDIStreamInfoModel);
......@@ -423,7 +425,7 @@ namespace VIZ.H2V.Module
private bool NDIStreamInfosViewFilter(NDIStreamInfoModel model)
{
if (model == null)
return false;
return true;
if (!this.IsShowLocalStream)
return true;
......
......@@ -138,9 +138,6 @@ namespace VIZ.H2V.Module
if (manager == null)
return;
// 移动裁切框至居中模式值
this.Support.MoveClipBoxToCenterMode();
// 更新裁切框样式
this.Support.UpdateClipBoxToAutoOrCenterStyle();
}
......@@ -159,7 +156,6 @@ namespace VIZ.H2V.Module
List<int> roi = this.Support.GetManulRoi();
// TODO: 平滑系数读取
AlgorithmSender.ManualMode(manager, this.Support.ID, this.Support.ViewConfig.IsSendToCrop, roi, this.Support.AlgorithmConfig.SmoothCoeff);
}
......@@ -446,20 +442,25 @@ namespace VIZ.H2V.Module
sb.Append($"{kv.Key}=\"{kv.Value}\" ");
}
string fileName = path;
string fileNameArgs = string.Empty;
if (System.IO.Path.GetExtension(fileName).ToLower() == ".py")
string fileName = null;
string arguments = null;
if (System.IO.Path.GetExtension(path).ToLower() == ".py")
{
// 如果是 .py 文件那么 采用 CMD 启动python程序
fileName = "python";
fileNameArgs = path;
arguments = $"\"{path}\" {sb}";
}
else
{
// 否则采用直接启动的方式启动
fileName = path;
arguments = $"{sb}";
}
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = path;
//proc.StartInfo.Arguments = $"\"{fullPath}\" --port=\"{port}\" --ndi_name=\"{ndi_name}\" --id=\"{id}\" --device=\"{device}\" --vis_port=\"{CLIENT_PORT}\"";
proc.StartInfo.Arguments = $"{fileNameArgs} {sb}";
proc.StartInfo.FileName = fileName;
proc.StartInfo.Arguments = arguments;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
return proc;
......
......@@ -81,17 +81,6 @@ namespace VIZ.H2V.Module
List<int> GetManulRoi();
/// <summary>
/// 移动裁切框至X
/// </summary>
/// <param name="targetX">目标X</param>
void MoveClipBoxTo(double targetX);
/// <summary>
/// 移动裁切框至居中模式的值
/// </summary>
void MoveClipBoxToCenterMode();
/// <summary>
/// 重置3D鼠标
/// </summary>
void Reset3DMouse();
......
......@@ -23,12 +23,6 @@ namespace VIZ.H2V.Module
double ClipBoxTargetX { get; set; }
/// <summary>
/// 移动至
/// </summary>
/// <param name="targetX">目标值</param>
void MoveTo(double targetX);
/// <summary>
/// 获取映射值
/// </summary>
/// <returns>映射值</returns>
......
......@@ -24,6 +24,11 @@ namespace VIZ.H2V.Module
private static readonly ILog log = LogManager.GetLogger(typeof(ManualController));
/// <summary>
/// 自动移动时每帧最多移动多少像素
/// </summary>
private const int AUTO_MOVE_SPEED = 40;
/// <summary>
/// 手动控制器
/// </summary>
/// <param name="support">控制器支持</param>
......@@ -48,17 +53,6 @@ namespace VIZ.H2V.Module
public IManualSupport Support { get; private set; }
/// <summary>
/// 移动至
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <param name="targetX">目标值</param>
public void MoveTo(double targetX)
{
this.ClipBoxTargetX = targetX;
}
/// <summary>
/// 获取计算值
/// </summary>
/// <param name="min">最小值</param>
......@@ -69,7 +63,7 @@ namespace VIZ.H2V.Module
// 居中模式直接返回居中位置
if (this.Support.StrategyMode == AlgorithmStrategyMode.center_mode)
{
return this.GetCalculationValue_Auto(min, max);
return this.GetCalculationValue_Auto(min, max, 555);
}
// 手动模式 且 处于激活状态下进行计算
......@@ -150,12 +144,24 @@ namespace VIZ.H2V.Module
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <param name="target">目标位置</param>
/// <returns>计算值</returns>
private double GetCalculationValue_Auto(double min, double max)
private double GetCalculationValue_Auto(double min, double max, double target)
{
double result = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 0.6d);
double x = this.ClipBoxTargetX;
if (x < target)
{
x += (target - x) >= AUTO_MOVE_SPEED ? AUTO_MOVE_SPEED : (target - x);
}
else if (x > target)
{
x -= (x - target) >= AUTO_MOVE_SPEED ? AUTO_MOVE_SPEED : (x - target);
}
return result;
x = MathHelper.Clip(min, max, x);
this.ClipBoxTargetX = x;
return x;
}
}
}
......@@ -15,6 +15,11 @@ namespace VIZ.H2V.Module
public interface INDIViewService : IService
{
/// <summary>
/// 视图键
/// </summary>
string ViewKey { get; }
/// <summary>
/// 显示名称
/// </summary>
string DisplayName { get; set; }
......@@ -106,11 +111,6 @@ namespace VIZ.H2V.Module
void UpdateTallyConfig(GPIOModel gpioModel);
/// <summary>
/// 保存居中模式裁切框至算法配置
/// </summary>
void SaveCenterClipBoxToAlgorithmConfig();
/// <summary>
/// 停止算法
/// </summary>
void StopAlgorithm();
......
......@@ -26,7 +26,7 @@
<fcore:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></fcore:Bool2VisibilityConverter>
<fcore:Bool2BoolConverter x:Key="Bool2BoolConverter"></fcore:Bool2BoolConverter>
<fcore:StringAppendConverter x:Key="StringAppendConverter"></fcore:StringAppendConverter>
<resource:TallyColor2RadialGradientBrushConverter x:Key="TallyColor2RadialGradientBrushConverter"></resource:TallyColor2RadialGradientBrushConverter>
<fcore:Color2SolidColorBrushConverter x:Key="Color2SolidColorBrushConverter"></fcore:Color2SolidColorBrushConverter>
<resource:NDIViewStatus2BoolConverter x:Key="NDIViewStatus2IsEnabledConverter" TrueListString="Detect,CropRoi"></resource:NDIViewStatus2BoolConverter>
<resource:NDIViewStatus2BoolConverter x:Key="NDIViewStatus2IsEnabledConverter_SettingButton" TrueListString="Stop,Detect,CropRoi"></resource:NDIViewStatus2BoolConverter>
<resource:NDIViewStatus2BoolConverter x:Key="NDIViewStatus2IsEnabledConverter_StopButton" TrueListString="WaitSetup,WaitCheckOK,Detect,CropRoi"></resource:NDIViewStatus2BoolConverter>
......@@ -122,7 +122,7 @@
<!-- 信号1 -->
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Visibility="{Binding Path=TallyPartViewModel.Tally1.PinValue,Converter={StaticResource Bool2VisibilityConverter}}"
Fill="{Binding Path=TallyPartViewModel.Color1,Converter={StaticResource TallyColor2RadialGradientBrushConverter}}"></Rectangle>
Fill="{Binding Path=TallyPartViewModel.Color1,Converter={StaticResource Color2SolidColorBrushConverter}}"></Rectangle>
<TextBlock Text="{Binding Path=DisplayName,Mode=OneWay}"
ToolTip="{Binding Path=DisplayName,Mode=OneWay}"
......@@ -151,13 +151,14 @@
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<RadioButton Content="{Binding Path=StrategyDisplayName,Mode=OneWay}" Grid.Row="0" FontSize="16" Foreground="White"
Style="{StaticResource RadioButton_NdiView}" IsChecked="{Binding IsAutoModeChecked,Mode=TwoWay}">
Style="{StaticResource RadioButton_NdiView}"
IsChecked="{Binding IsAutoModeChecked,Mode=TwoWay}">
</RadioButton>
<RadioButton Content="居中" Grid.Row="1" FontSize="16" Foreground="White"
Style="{StaticResource RadioButton_NdiView}" IsChecked="{Binding IsCenterModeChecked,Mode=TwoWay}">
Style="{StaticResource RadioButton_NdiView}"
IsChecked="{Binding IsCenterModeChecked,Mode=TwoWay}">
</RadioButton>
<RadioButton Content="手动" Grid.Row="2" FontSize="16" Foreground="White"
IsEnabled="{Binding Path=IsManualModeEnabled,Mode=OneWay}"
IsChecked="{Binding Path=IsManualModeChecked,Mode=TwoWay}"
Style="{StaticResource RadioButton_NdiView}">
</RadioButton>
......@@ -238,33 +239,33 @@
</CheckBox>
</Border>
<!-- 启用边线过滤 -->
<Border ToolTip="启用边线过滤" Background="Transparent" Margin="0,0,10,0">
<CheckBox Style="{StaticResource CheckBox_IsBorderEnabled}" Width="32" Height="32"
<!-- 显示边线 -->
<Border ToolTip="显示边线" Background="Transparent" Margin="0,0,10,0">
<CheckBox Style="{StaticResource CheckBox_IsBorderShow}" Width="32" Height="32"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=AlgorithmConfig.IsBorderEnabled,Mode=TwoWay}">
IsChecked="{Binding Path=AlgorithmConfig.IsShowBorder,Mode=TwoWay}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
</Border>
<!-- 显示边线 -->
<Border ToolTip="显示边线" Background="Transparent" Margin="0,0,0,0">
<CheckBox Style="{StaticResource CheckBox_IsBorderShow}" Width="32" Height="32"
<!-- 启用边线过滤 -->
<Border ToolTip="启用边线过滤" Background="Transparent" Margin="0,0,0,0">
<CheckBox Style="{StaticResource CheckBox_IsBorderEnabled}" Width="32" Height="32"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=AlgorithmConfig.IsShowBorder,Mode=TwoWay}">
IsChecked="{Binding Path=AlgorithmConfig.IsBorderEnabled,Mode=TwoWay}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding IsBorderShowChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorderEnabledChangedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
......
......@@ -103,8 +103,6 @@ namespace VIZ.H2V.Module
this.StrategyType = this.ViewConfig.StrategyType;
// 裁切模式
this.StrategyMode = this.ViewConfig.StrategyMode;
// 居中模式下的裁切框位置
this.ClipBoxX_CenterMode = this.AlgorithmConfig.CenterClipBoxX;
// 初始化Tally
this.InitTally(systemConfig);
......@@ -288,7 +286,7 @@ namespace VIZ.H2V.Module
private void Setting(string key)
{
NDISettingView view = new NDISettingView(key, this.ID);
NoneWindow window = new NoneWindow(1200, 1050, view);
NoneWindow window = new NoneWindow(1200, 1150, view);
window.Owner = this.GetWindow();
window.ShowDialog();
......
......@@ -20,18 +20,6 @@ namespace VIZ.H2V.Module
public partial class NDIViewModel
{
/// <summary>
/// 处理算法切换至手动消息
/// </summary>
/// <param name="msg">消息</param>
private void OnAlgorithmStrategyChangedToManualMessage(AlgorithmStrategyChangedToManualMessage msg)
{
if (msg.Source == this)
return;
this.IsManualModeEnabled = !msg.IsChangedToManual;
}
/// <summary>
/// 处理算法初始化完成消息
/// </summary>
/// <param name="msg">消息</param>
......@@ -71,12 +59,6 @@ namespace VIZ.H2V.Module
break;
}
}
// 校验当前手动模式选项是否可用
List<INDIViewService> services = ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>();
INDIViewService service = services.FirstOrDefault(p => p.ViewConfig.StrategyMode == AlgorithmStrategyMode.manual_mode);
this.IsManualModeEnabled = service == null || service == this;
}
/// <summary>
......
......@@ -316,20 +316,6 @@ namespace VIZ.H2V.Module
#endregion
#region ClipBoxX_CenterMode -- 居中模式裁切框位置
private double clipBoxX_CenterMode = 555;
/// <summary>
/// 居中模式裁切框位置
/// </summary>
public double ClipBoxX_CenterMode
{
get { return clipBoxX_CenterMode; }
set { clipBoxX_CenterMode = value; this.RaisePropertyChanged(nameof(ClipBoxX_CenterMode)); }
}
#endregion
#region FootballFiledPanelModel -- 足球场视图模型
private FootballFieldPanelModel footballFieldPanelModel = new FootballFieldPanelModel();
......@@ -505,20 +491,6 @@ namespace VIZ.H2V.Module
#endregion
#region IsManualModeEnabled -- 手动模式是否可用
private bool isManualModeEnabled;
/// <summary>
/// 手动模式是否可用
/// </summary>
public bool IsManualModeEnabled
{
get { return isManualModeEnabled; }
set { isManualModeEnabled = value; this.RaisePropertySaveChanged(nameof(IsManualModeEnabled)); }
}
#endregion
// --------------------------------------------------------------------------------------
#region ClipFPS -- NDI FPS
......
......@@ -102,8 +102,6 @@ namespace VIZ.H2V.Module
/// </summary>
private void InitMessage()
{
// 切换手动消息
ApplicationDomainEx.MessageManager.Register<AlgorithmStrategyChangedToManualMessage>(this, this.OnAlgorithmStrategyChangedToManualMessage);
// 算法初始化完成消息
ApplicationDomainEx.MessageManager.Register<AlgorithmMessage__checked_ok>(this, this.OnAlgorithmMessage__checked_ok);
// 算法跟踪消息
......@@ -146,12 +144,6 @@ namespace VIZ.H2V.Module
// 停止3D鼠标更新
this.ManualController.ClipBoxSmooth.IsEnabled = false;
// 如果之前的模式为居中模式,那么记录居中模式的裁切框位置
if (this.StrategyMode == AlgorithmStrategyMode.center_mode)
{
this.ClipBoxX_CenterMode = this.ClipBoxX;
}
// ----------------------------------------------------------------------------------------------
// Step 1. 更新属性 & 缓存
// ----------------------------------------------------------------------------------------------
......@@ -175,12 +167,6 @@ namespace VIZ.H2V.Module
clear_context.IsClearClipBox = this.ViewStatus != NDIViewStatus.CropRoi && this.ViewStatus != NDIViewStatus.Detect;
this.ClearVideoControl(clear_context);
// 发送切换手动消息
AlgorithmStrategyChangedToManualMessage msg = new AlgorithmStrategyChangedToManualMessage();
msg.Source = this;
msg.IsChangedToManual = this.StrategyMode == AlgorithmStrategyMode.manual_mode;
ApplicationDomainEx.MessageManager.Send(msg);
// ----------------------------------------------------------------------------------------------
// Step 3. 校验视图状态
// ----------------------------------------------------------------------------------------------
......@@ -233,6 +219,9 @@ namespace VIZ.H2V.Module
{
// 启动3D鼠标更新
this.ManualController.ClipBoxSmooth.IsEnabled = true;
// 聚焦切换的窗口
this.IsActive = true;
}
}
......@@ -251,26 +240,6 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 移动裁切框至X
/// </summary>
/// <remarks>
/// 切换至居中模式时使用
/// </remarks>
/// <param name="targetX">目标X</param>
public void MoveClipBoxTo(double targetX)
{
this.ManualController.MoveTo(targetX);
}
/// <summary>
/// 移动裁切框至居中模式的值
/// </summary>
public void MoveClipBoxToCenterMode()
{
this.MoveClipBoxTo(this.ClipBoxX_CenterMode);
}
/// <summary>
/// 清理视频控件
/// </summary>
/// <param name="context">清理视频控件上下文</param>
......@@ -344,26 +313,6 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 保存居中模式裁切框至算法配置
/// </summary>
public void SaveCenterClipBoxToAlgorithmConfig()
{
// 居中模式下 该裁切框为当前裁切框
if (this.StrategyMode == AlgorithmStrategyMode.center_mode)
{
this.AlgorithmConfig.CenterClipBoxX = this.ClipBoxX;
}
// 其他模式则采用居中模式裁切框的值
else
{
this.AlgorithmConfig.CenterClipBoxX = this.ClipBoxX_CenterMode;
}
// 保存配置
this.AlgorithmControllerDic[this.StrategyType].SaveConfig(this.AlgorithmConfig);
}
/// <summary>
/// 更新裁切框样式至自动或居中模式的样式
/// </summary>
public void UpdateClipBoxToAutoOrCenterStyle()
......
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Module;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 应用程序启动 -- 保存居中模式裁切框
/// </summary>
public class AppSetup_SaveCenterClipBox : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_SaveCenterClipBox));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 保存居中模式裁切框";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
// 注册每30秒记录一次居中模式裁切坐标
ApplicationDomainEx.LoopManager.Register("AppSetup_CenterClipBoxSave.Setup", 30, () => this.Save());
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
this.Save();
}
/// <summary>
/// 保存
/// </summary>
private void Save()
{
List<INDIViewService> list = ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>();
if (list == null || list.Count == 0)
return;
foreach (INDIViewService service in list)
{
// 保存居中模式裁切框位置至算法模式
service.SaveCenterClipBoxToAlgorithmConfig();
}
}
}
}
......@@ -258,7 +258,6 @@
<Compile Include="Setup\Provider\AppSetup_Algorithm.cs" />
<Compile Include="Setup\Provider\AppSetup_Recording.cs" />
<Compile Include="Setup\Provider\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\AppSetup_SaveCenterClipBox.cs" />
<Compile Include="SystemSetting\Model\TallyCamSignalModel.cs" />
<Compile Include="SystemSetting\ViewModel\HotkeySettingPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\AboutPanelViewModel.cs" />
......
......@@ -22,14 +22,14 @@ namespace VIZ.H2V.Storage
public bool IsEnabled { get; set; }
/// <summary>
/// 标记
/// 算法类型
/// </summary>
public string Tag { get; set; }
public AlgorithmStrategyType Type { get; set; }
/// <summary>
/// 算法类型
/// 分组
/// </summary>
public AlgorithmStrategyType Type { get; set; }
public string Group { get; set; }
/// <summary>
/// 名称
......
......@@ -58,19 +58,7 @@ namespace VIZ.H2V.Storage
using (StreamReader sr = new StreamReader(path, Encoding.Default))
using (CsvReader reader = new CsvReader(sr, CultureInfo.InvariantCulture))
{
List<AlgorithmStrategy> list = new List<AlgorithmStrategy>();
foreach (AlgorithmStrategy item in reader.GetRecords<AlgorithmStrategy>())
{
if (!item.IsEnabled)
continue;
if (!isDebug && item.Tag == "DEBUG")
continue;
list.Add(item);
}
this.AlgorithmStrategys = list;
this.AlgorithmStrategys = reader.GetRecords<AlgorithmStrategy>().Where(p => p.IsEnabled).ToList();
}
}
......
......@@ -41,8 +41,6 @@ namespace VIZ.H2V
AppSetup.AppendLoad(new AppSetup_Navigation3D());
// 初始化Tally
AppSetup.AppendLoad(new AppSetup_GPIO2USB());
// 保存居中模式裁切框
AppSetup.AppendLoad(new AppSetup_SaveCenterClipBox());
// 调试窗口
//AppSetup.AppendLoad(new AppSetup_DebugWindow());
......
ID,IsEnabled,Tag,Type,Name,DisplayName,MainPath,
1,TRUE,,Single,单人机位,单人机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
2,TRUE,,Near,近景机位,近景机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
3,TRUE,,Sixteen,16米机位,16米机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
4,TRUE,,Tactics,战术机位,战术机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
5,TRUE,,Cableway,索道机位,索道机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
6,TRUE,DEBUG,Single,单人机位,单人机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
ID,IsEnabled,Group,Type,Name,DisplayName,MainPath,
1,TRUE,世界杯,Single,单人机位,单人机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
2,TRUE,世界杯,Near,近景机位,近景机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
3,TRUE,世界杯,Sixteen,16米机位,16米机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
4,TRUE,世界杯,Tactics,战术机位,战术机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
5,TRUE,世界杯,Cableway,索道机位,索道机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
6,TRUE,世界杯,Single,单人机位,单人机位_对照算法,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
\ No newline at end of file
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