Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.H2V
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.H2V
Commits
5ecff6c6
Commit
5ecff6c6
authored
Oct 20, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 添加算法配置分组,设置界面添加分组选项
parent
3f2501e4
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
197 additions
and
299 deletions
+197
-299
VIZ.H2V.Domain/Model/Algorithm/AlgorithmStrategyGroupModel.cs
+26
-6
VIZ.H2V.Domain/Model/Algorithm/AlgorithmStrategyModel.cs
+6
-6
VIZ.H2V.Domain/VIZ.H2V.Domain.csproj
+1
-1
VIZ.H2V.Module/NDIMainView/ViewModel/NDIMainViewModel.cs
+3
-3
VIZ.H2V.Module/NDISettingView/View/AlgorithmSettingPanelView.xaml
+20
-10
VIZ.H2V.Module/NDISettingView/ViewModel/AlgorithmSettingPanelViewModel.cs
+65
-9
VIZ.H2V.Module/NDISettingView/ViewModel/NDISettingPanelViewModel.cs
+3
-1
VIZ.H2V.Module/NDIView/Controller/Algorithm/AlgorithmControllerBase.cs
+12
-11
VIZ.H2V.Module/NDIView/Controller/Algorithm/IAlgorithmSupport.cs
+0
-11
VIZ.H2V.Module/NDIView/Controller/Manual/IManualController.cs
+0
-6
VIZ.H2V.Module/NDIView/Controller/Manual/ManualController.cs
+21
-15
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
+5
-5
VIZ.H2V.Module/NDIView/View/NDIView.xaml
+18
-17
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Command.cs
+1
-3
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
+0
-18
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Property.cs
+0
-28
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
+3
-54
VIZ.H2V.Module/Setup/Provider/AppSetup_SaveCenterClipBox.cs
+0
-68
VIZ.H2V.Module/VIZ.H2V.Module.csproj
+0
-1
VIZ.H2V.Storage/CSV/Algorithm/AlgorithmStrategy.cs
+4
-4
VIZ.H2V.Storage/CSV/CsvContext.cs
+1
-13
VIZ.H2V/App.xaml.cs
+0
-2
VIZ.H2V/config/algorithm_strategy.csv
+8
-7
No files found.
VIZ.H2V.Domain/M
essage/NDI/AlgorithmStrategyChangedToManualMessage
.cs
→
VIZ.H2V.Domain/M
odel/Algorithm/AlgorithmStrategyGroupModel
.cs
View file @
5ecff6c6
...
...
@@ -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
AlgorithmStrategy
ChangedToManualMessag
e
public
class
AlgorithmStrategy
GroupModel
:
ModelBas
e
{
#
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
}
}
VIZ.H2V.Domain/Model/Algorithm/AlgorithmStrategyModel.cs
View file @
5ecff6c6
...
...
@@ -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
...
...
VIZ.H2V.Domain/VIZ.H2V.Domain.csproj
View file @
5ecff6c6
...
...
@@ -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" />
...
...
VIZ.H2V.Module/NDIMainView/ViewModel/NDIMainViewModel.cs
View file @
5ecff6c6
...
...
@@ -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
.
RaiseProperty
Save
Changed
(
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
.
RaiseProperty
Save
Changed
(
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
;
}
...
...
VIZ.H2V.Module/NDISettingView/View/AlgorithmSettingPanelView.xaml
View file @
5ecff6c6
...
...
@@ -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=Al
lAl
gorithmStrategys}"
SelectedValue="{Binding Path=SelectedAlgorithmStrategy,Mode=OneWay}">
</fcommon:NavigationControl>
...
...
VIZ.H2V.Module/NDISettingView/ViewModel/AlgorithmSettingPanelViewModel.cs
View file @
5ecff6c6
...
...
@@ -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
;
}
...
...
VIZ.H2V.Module/NDISettingView/ViewModel/NDISettingPanelViewModel.cs
View file @
5ecff6c6
...
...
@@ -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
fals
e
;
return
tru
e
;
if
(!
this
.
IsShowLocalStream
)
return
true
;
...
...
VIZ.H2V.Module/NDIView/Controller/Algorithm/AlgorithmControllerBase.cs
View file @
5ecff6c6
...
...
@@ -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
;
...
...
VIZ.H2V.Module/NDIView/Controller/Algorithm/IAlgorithmSupport.cs
View file @
5ecff6c6
...
...
@@ -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
();
...
...
VIZ.H2V.Module/NDIView/Controller/Manual/IManualController.cs
View file @
5ecff6c6
...
...
@@ -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>
...
...
VIZ.H2V.Module/NDIView/Controller/Manual/ManualController.cs
View file @
5ecff6c6
...
...
@@ -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
;
}
}
}
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
View file @
5ecff6c6
...
...
@@ -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
();
...
...
VIZ.H2V.Module/NDIView/View/NDIView.xaml
View file @
5ecff6c6
...
...
@@ -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:TallyColor2RadialGradient
BrushConverter>
<
fcore:Color2SolidColorBrushConverter x:Key="Color2SolidColorBrushConverter"></fcore:Color2SolidColor
BrushConverter>
<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
TallyColor2RadialGradient
BrushConverter}}"></Rectangle>
Fill="{Binding Path=TallyPartViewModel.Color1,Converter={StaticResource
Color2SolidColor
BrushConverter}}"></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_IsBorder
Enabled
}" Width="32" Height="32"
<!--
显示边线
-->
<Border ToolTip="
显示边线
" Background="Transparent" Margin="0,0,10,0">
<CheckBox Style="{StaticResource CheckBox_IsBorder
Show
}" Width="32" Height="32"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=AlgorithmConfig.Is
BorderEnabled
,Mode=TwoWay}">
IsChecked="{Binding Path=AlgorithmConfig.Is
ShowBorder
,Mode=TwoWay}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Enabled
ChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Show
ChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Enabled
ChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Show
ChangedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
</Border>
<!--
显示边线
-->
<Border ToolTip="
显示边线
" Background="Transparent" Margin="0,0,0,0">
<CheckBox Style="{StaticResource CheckBox_IsBorder
Show
}" Width="32" Height="32"
<!--
启用边线过滤
-->
<Border ToolTip="
启用边线过滤
" Background="Transparent" Margin="0,0,0,0">
<CheckBox Style="{StaticResource CheckBox_IsBorder
Enabled
}" Width="32" Height="32"
IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"
IsChecked="{Binding Path=AlgorithmConfig.Is
ShowBorder
,Mode=TwoWay}">
IsChecked="{Binding Path=AlgorithmConfig.Is
BorderEnabled
,Mode=TwoWay}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Show
ChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Enabled
ChangedCommand}" />
</behaviors:EventTrigger>
<behaviors:EventTrigger EventName="Unchecked">
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Show
ChangedCommand}" />
<behaviors:InvokeCommandAction Command="{Binding IsBorder
Enabled
ChangedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Command.cs
View file @
5ecff6c6
...
...
@@ -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
,
1
0
50
,
view
);
NoneWindow
window
=
new
NoneWindow
(
1200
,
1
1
50
,
view
);
window
.
Owner
=
this
.
GetWindow
();
window
.
ShowDialog
();
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
View file @
5ecff6c6
...
...
@@ -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>
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Property.cs
View file @
5ecff6c6
...
...
@@ -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
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
View file @
5ecff6c6
...
...
@@ -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
()
...
...
VIZ.H2V.Module/Setup/Provider/AppSetup_SaveCenterClipBox.cs
deleted
100644 → 0
View file @
3f2501e4
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
();
}
}
}
}
VIZ.H2V.Module/VIZ.H2V.Module.csproj
View file @
5ecff6c6
...
...
@@ -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" />
...
...
VIZ.H2V.Storage/CSV/Algorithm/AlgorithmStrategy.cs
View file @
5ecff6c6
...
...
@@ -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>
/// 名称
...
...
VIZ.H2V.Storage/CSV/CsvContext.cs
View file @
5ecff6c6
...
...
@@ -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
();
}
}
...
...
VIZ.H2V/App.xaml.cs
View file @
5ecff6c6
...
...
@@ -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());
...
...
VIZ.H2V/config/algorithm_strategy.csv
View file @
5ecff6c6
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment