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
894b93d7
Commit
894b93d7
authored
Oct 19, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 居中模式处理
parent
ad452264
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
190 deletions
+39
-190
VIZ.H2V.Domain/Model/NDI/NDIStreamInfoModel.cs
+14
-0
VIZ.H2V.Module/NDISettingView/ViewModel/NDISettingPanelViewModel.cs
+3
-0
VIZ.H2V.Module/NDIView/Controller/Manual/IManualController.cs
+1
-13
VIZ.H2V.Module/NDIView/Controller/Manual/IManualSupport.cs
+0
-5
VIZ.H2V.Module/NDIView/Controller/Manual/ManualController.cs
+16
-98
VIZ.H2V.Module/NDIView/View/NDIView.xaml
+1
-24
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Command.cs
+0
-17
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Property.cs
+0
-14
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
+4
-19
No files found.
VIZ.H2V.Domain/Model/NDI/NDIStreamInfoModel.cs
View file @
894b93d7
...
...
@@ -25,5 +25,19 @@ namespace VIZ.H2V.Domain
}
#
endregion
#
region
IsLocalStream
--
是否是本机流
private
bool
isLocalStream
;
/// <summary>
/// 是否是本机流
/// </summary>
public
bool
IsLocalStream
{
get
{
return
isLocalStream
;
}
set
{
isLocalStream
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsLocalStream
));
}
}
#
endregion
}
}
VIZ.H2V.Module/NDISettingView/ViewModel/NDISettingPanelViewModel.cs
View file @
894b93d7
...
...
@@ -196,10 +196,13 @@ namespace VIZ.H2V.Module
if
(
ndiStream
.
StreamInfos
!=
null
&&
ndiStream
.
StreamInfos
.
Count
>
0
)
{
string
localName
=
System
.
Net
.
Dns
.
GetHostName
();
foreach
(
NDIStreamInfo
info
in
ndiStream
.
StreamInfos
)
{
NDIStreamInfoModel
model
=
new
NDIStreamInfoModel
();
model
.
FullName
=
info
.
FullName
;
model
.
IsLocalStream
=
info
.
Machine
==
localName
;
if
(
model
.
FullName
==
ndiStream
.
RemoteSenderName
)
{
selected
=
model
;
...
...
VIZ.H2V.Module/NDIView/Controller/Manual/IManualController.cs
View file @
894b93d7
...
...
@@ -23,17 +23,10 @@ namespace VIZ.H2V.Module
double
ClipBoxTargetX
{
get
;
set
;
}
/// <summary>
/// 裁切框居中模式下的X坐标
/// </summary>
double
ClipBoxCenterX
{
get
;
set
;
}
/// <summary>
/// 移动至
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <param name="targetX">目标值</param>
void
MoveTo
(
double
min
,
double
max
,
double
targetX
);
void
MoveTo
(
double
targetX
);
/// <summary>
/// 获取映射值
...
...
@@ -54,10 +47,5 @@ namespace VIZ.H2V.Module
/// </summary>
/// <param name="clipX">剪切X值</param>
void
Reset
(
double
clipX
);
/// <summary>
/// 重置自动移动
/// </summary>
void
ResetAutoMoving
();
}
}
VIZ.H2V.Module/NDIView/Controller/Manual/IManualSupport.cs
View file @
894b93d7
...
...
@@ -26,10 +26,5 @@ namespace VIZ.H2V.Module
/// 是否被激活
/// </summary>
bool
IsActive
{
get
;
}
/// <summary>
/// 居中模式移动至中间是否可用
/// </summary>
bool
IsCenterModeMoveToCenterEnabled
{
get
;
set
;
}
}
}
VIZ.H2V.Module/NDIView/Controller/Manual/ManualController.cs
View file @
894b93d7
...
...
@@ -43,48 +43,19 @@ namespace VIZ.H2V.Module
public
double
ClipBoxTargetX
{
get
;
set
;
}
=
555
;
/// <summary>
/// 裁切框居中模式下的X坐标
/// </summary>
public
double
ClipBoxCenterX
{
get
;
set
;
}
=
555
;
/// <summary>
/// 支持
/// </summary>
public
IManualSupport
Support
{
get
;
private
set
;
}
/// <summary>
/// 裁切框自动移动帧数
/// </summary>
private
int
ClipBoxAutoMovingFrame
;
/// <summary>
/// 裁切框是否正在自动移动中
/// </summary>
private
bool
IsClipBoxAutoMoving
;
/// <summary>
/// 剪切框自动移动速度(单位:像素/帧)
/// </summary>
private
static
readonly
int
VIDEO_CLIP_BOX_AUTO_MOVE_SPEED
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_CLIP_BOX_AUTO_MOVE_SPEED
);
/// <summary>
/// 剪切框自动移动持续帧数(单位:帧数)
/// </summary>
private
static
readonly
int
VIDEO_CLIP_BOX_AUTO_MOVE_DURATION_FRAME
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
VideoConfig
,
int
>(
p
=>
p
.
VIDEO_CLIP_BOX_AUTO_MOVE_DURATION_FRAME
);
/// <summary>
/// 移动至
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <param name="targetX">目标值</param>
public
void
MoveTo
(
double
min
,
double
max
,
double
targetX
)
public
void
MoveTo
(
double
targetX
)
{
this
.
Support
.
IsCenterModeMoveToCenterEnabled
=
false
;
this
.
Reset
(
this
.
Support
.
ClipBoxX
);
this
.
ClipBoxCenterX
=
MathHelper
.
Clip
(
min
,
max
,
targetX
);
this
.
ClipBoxAutoMovingFrame
=
0
;
this
.
IsClipBoxAutoMoving
=
true
;
this
.
ClipBoxTargetX
=
targetX
;
}
/// <summary>
...
...
@@ -95,48 +66,21 @@ namespace VIZ.H2V.Module
/// <returns>计算值</returns>
public
double
GetCalculationValue
(
double
min
,
double
max
)
{
if
(
this
.
IsClipBoxAutoMoving
)
{
if
(
this
.
ClipBoxAutoMovingFrame
==
VIDEO_CLIP_BOX_AUTO_MOVE_DURATION_FRAME
||
(
int
)
this
.
Support
.
ClipBoxX
==
(
int
)
this
.
ClipBoxCenterX
)
{
this
.
IsClipBoxAutoMoving
=
false
;
this
.
ClipBoxAutoMovingFrame
=
0
;
// 重置手动裁切
this
.
Reset
(
this
.
Support
.
ClipBoxX
);
this
.
Support
.
IsCenterModeMoveToCenterEnabled
=
true
;
}
++
this
.
ClipBoxAutoMovingFrame
;
}
// 居中模式直接返回居中位置
if
(
this
.
Support
.
StrategyMode
==
AlgorithmStrategyMode
.
center_mode
)
{
// 居中模式自动移动过程
if
(
this
.
IsClipBoxAutoMoving
)
{
double
result
=
this
.
GetCalculationValue_Center
(
min
,
max
);
return
result
;
}
if
(
this
.
Support
.
IsActive
)
{
double
result
=
this
.
GetCalculationValue_Manual
(
min
,
max
);
return
result
;
}
else
{
return
this
.
ClipBoxTargetX
;
}
return
this
.
GetCalculationValue_Auto
(
min
,
max
);
}
else
if
(
this
.
Support
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
&&
this
.
Support
.
IsActive
)
// 手动模式 且 处于激活状态下进行计算
if
(
this
.
Support
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
&&
this
.
Support
.
IsActive
)
{
return
this
.
GetCalculationValue_Manual
(
min
,
max
);
}
else
{
return
this
.
ClipBoxTargetX
;
}
// 其他情况不处理
return
this
.
ClipBoxTargetX
;
}
/// <summary>
...
...
@@ -185,36 +129,14 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 重置自动移动
/// </summary>
public
void
ResetAutoMoving
()
{
this
.
IsClipBoxAutoMoving
=
false
;
this
.
ClipBoxAutoMovingFrame
=
0
;
this
.
Support
.
IsCenterModeMoveToCenterEnabled
=
true
;
}
/// <summary>
/// 获取居中模式计算值
/// 获取手动模式计算值
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <returns>计算值</returns>
private
double
GetCalculationValue_
Center
(
double
min
,
double
max
)
private
double
GetCalculationValue_
Manual
(
double
min
,
double
max
)
{
double
x
=
this
.
ClipBoxTargetX
;
if
((
int
)
x
<
(
int
)
this
.
ClipBoxCenterX
)
{
x
+=
VIDEO_CLIP_BOX_AUTO_MOVE_SPEED
;
x
=
x
>
this
.
ClipBoxCenterX
?
this
.
ClipBoxCenterX
:
x
;
}
else
if
((
int
)
x
>
(
int
)
this
.
ClipBoxCenterX
)
{
x
-=
VIDEO_CLIP_BOX_AUTO_MOVE_SPEED
;
x
=
x
<
this
.
ClipBoxCenterX
?
this
.
ClipBoxCenterX
:
x
;
}
double
x
=
this
.
ClipBoxTargetX
+
this
.
GetMappingValue
();
x
=
MathHelper
.
Clip
(
min
,
max
,
x
);
this
.
ClipBoxTargetX
=
x
;
...
...
@@ -224,17 +146,13 @@ namespace VIZ.H2V.Module
}
/// <summary>
/// 获取
手动模式
计算值
/// 获取
自动移动时的
计算值
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <returns>计算值</returns>
private
double
GetCalculationValue_
Manual
(
double
min
,
double
max
)
private
double
GetCalculationValue_
Auto
(
double
min
,
double
max
)
{
double
x
=
this
.
ClipBoxTargetX
+
this
.
GetMappingValue
();
x
=
MathHelper
.
Clip
(
min
,
max
,
x
);
this
.
ClipBoxTargetX
=
x
;
double
result
=
this
.
ClipBoxSmooth
.
Call
(
this
.
ClipBoxTargetX
,
0.6d
);
return
result
;
...
...
VIZ.H2V.Module/NDIView/View/NDIView.xaml
View file @
894b93d7
...
...
@@ -133,7 +133,7 @@
Style="{StaticResource CheckBox_NdiView}"></CheckBox>
<Rectangle Grid.Row="1" Grid.RowSpan="10" Fill="#ff181d2b"></Rectangle>
<Border Grid.Row="1" IsEnabled="{Binding IsUseClip,Mode=OneWay}">
<Grid
IsEnabled="{Binding Path=IsCenterModeMoveToCenterEnabled}"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
...
...
@@ -175,28 +175,6 @@
</MultiBinding>
</Button.Visibility>
</Button>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<!-- 居中模式 按钮组-->
<Grid Grid.Row="1" Background="{x:Null}">
<Grid.Visibility>
<MultiBinding Converter="{StaticResource NDIViewProperty2VisibilityConverter_CenterMode}">
<Binding Path="ViewStatus"></Binding>
<Binding Path="StrategyMode"></Binding>
<Binding Path="StrategyType"></Binding>
</MultiBinding>
</Grid.Visibility>
<Button Style="{StaticResource Button_Setting}" Content="裁切框居中"
IsEnabled="{Binding Path=IsCenterModeMoveToCenterEnabled,Mode=OneWay}"
Command="{Binding Path=CenterModeMoveToCenterCommand}"
Height="40" Width="120" HorizontalAlignment="Right" Margin="0,0,10,0"></Button>
</Grid>
</Grid>
</Grid>
<!-- 视频区域 -->
<Border BorderBrush="Transparent" BorderThickness="0" Grid.Row="1" Grid.Column="1">
...
...
@@ -306,7 +284,6 @@
<!-- AI功能区 -->
<StackPanel Orientation="Vertical" VerticalAlignment="Bottom" Grid.Row="1">
<TextBlock Text="AI" Foreground="#AAFFFFFF" HorizontalAlignment="Center"></TextBlock>
<Rectangle Height="2" Width="30" Fill="#AAFFFFFF" Margin="0,2,0,0"></Rectangle>
<Border Margin="0,10,0,0" ToolTip="重启算法" Background="Transparent">
<Button Width="32" Height="32"
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Command.cs
View file @
894b93d7
...
...
@@ -472,22 +472,5 @@ namespace VIZ.H2V.Module
}
#
endregion
#
region
CenterModeMoveToCenterCommand
--
居中模式移动裁切框至中间命令
/// <summary>
/// 居中模式移动裁切框至中间命令
/// </summary>
public
VCommand
CenterModeMoveToCenterCommand
{
get
;
set
;
}
/// <summary>
/// 居中模式移动裁切框至中间
/// </summary>
private
void
CenterModeMoveToCenter
()
{
this
.
MoveClipBoxTo
(
555
);
}
#
endregion
}
}
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Property.cs
View file @
894b93d7
...
...
@@ -519,20 +519,6 @@ namespace VIZ.H2V.Module
#
endregion
#
region
IsCenterModeMoveToCenterEnabled
--
居中模式移动至中间是否可用
private
bool
isCenterModeMoveToCenterEnabled
=
true
;
/// <summary>
/// 居中模式移动至中间是否可用
/// </summary>
public
bool
IsCenterModeMoveToCenterEnabled
{
get
{
return
isCenterModeMoveToCenterEnabled
;
}
set
{
isCenterModeMoveToCenterEnabled
=
value
;
this
.
RaisePropertySaveChanged
(
nameof
(
IsCenterModeMoveToCenterEnabled
));
}
}
#
endregion
// --------------------------------------------------------------------------------------
#
region
ClipFPS
--
NDI
FPS
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
View file @
894b93d7
...
...
@@ -71,7 +71,6 @@ namespace VIZ.H2V.Module
this
.
IsBorderEnabledChangedCommand
=
new
VCommand
(
this
.
IsBorderEnabledChanged
);
this
.
IsAreaCorrectionEnabledChangedCommand
=
new
VCommand
(
this
.
IsAreaCorrectionEnabledChanged
);
this
.
SaveAlgorithmConfigCommand
=
new
VCommand
(
this
.
SaveAlgorithmConfig
);
this
.
CenterModeMoveToCenterCommand
=
new
VCommand
(
this
.
CenterModeMoveToCenter
);
}
/// <summary>
...
...
@@ -138,9 +137,6 @@ namespace VIZ.H2V.Module
// 停止3D鼠标更新
this
.
ManualController
.
ClipBoxSmooth
.
IsEnabled
=
false
;
// 重置自动移动状态
this
.
ManualController
.
ResetAutoMoving
();
// 如果之前的模式为居中模式,那么记录居中模式的裁切框位置
if
(
this
.
StrategyMode
==
AlgorithmStrategyMode
.
center_mode
)
{
...
...
@@ -248,24 +244,13 @@ namespace VIZ.H2V.Module
/// <summary>
/// 移动裁切框至X
/// </summary>
/// <remarks>
/// 切换至居中模式时使用
/// </remarks>
/// <param name="targetX">目标X</param>
public
void
MoveClipBoxTo
(
double
targetX
)
{
NDIView
view
=
this
.
GetView
<
NDIView
>();
if
(
view
==
null
)
{
this
.
IsCenterModeMoveToCenterEnabled
=
true
;
return
;
}
VideoRenderInfo
renderInfo
=
view
.
video
.
GetRenderInfo
();
if
(
renderInfo
==
null
||
renderInfo
.
Frame
==
null
)
{
this
.
IsCenterModeMoveToCenterEnabled
=
true
;
return
;
}
this
.
ManualController
.
MoveTo
(
0
,
renderInfo
.
Frame
.
Width
,
targetX
);
this
.
ManualController
.
MoveTo
(
targetX
);
}
/// <summary>
...
...
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