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
6fb354a7
Commit
6fb354a7
authored
Jul 28, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修复切换到手动模式时裁切框位置不正确的问题
parent
6c3f28dc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
65 deletions
+95
-65
VIZ.H2V.Module/NDIMainView/Controller/Hotkey/HotkeyController.cs
+4
-0
VIZ.H2V.Module/NDIMainView/View/NDIMainView.xaml
+2
-2
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
+5
-0
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Manual_NDI.cs
+7
-2
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
+1
-0
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
+76
-61
No files found.
VIZ.H2V.Module/NDIMainView/Controller/Hotkey/HotkeyController.cs
View file @
6fb354a7
...
@@ -80,6 +80,7 @@ namespace VIZ.H2V.Module
...
@@ -80,6 +80,7 @@ namespace VIZ.H2V.Module
return
false
;
return
false
;
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
context
.
IsUseClip
=
service
.
IsUseClip
;
context
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
context
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
context
.
IsNeedRestart
=
false
;
context
.
IsNeedRestart
=
false
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
...
@@ -119,6 +120,7 @@ namespace VIZ.H2V.Module
...
@@ -119,6 +120,7 @@ namespace VIZ.H2V.Module
return
false
;
return
false
;
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
context
.
IsUseClip
=
service
.
IsUseClip
;
context
.
Mode
=
AlgorithmStrategyMode
.
center_mode
;
context
.
Mode
=
AlgorithmStrategyMode
.
center_mode
;
context
.
IsNeedRestart
=
false
;
context
.
IsNeedRestart
=
false
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
...
@@ -164,6 +166,7 @@ namespace VIZ.H2V.Module
...
@@ -164,6 +166,7 @@ namespace VIZ.H2V.Module
.
ForEach
(
p
=>
.
ForEach
(
p
=>
{
{
ChangeStrategyContext
cxt
=
new
ChangeStrategyContext
();
ChangeStrategyContext
cxt
=
new
ChangeStrategyContext
();
cxt
.
IsUseClip
=
p
.
IsUseClip
;
cxt
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
cxt
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
cxt
.
IsNeedRestart
=
false
;
cxt
.
IsNeedRestart
=
false
;
cxt
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
cxt
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
...
@@ -172,6 +175,7 @@ namespace VIZ.H2V.Module
...
@@ -172,6 +175,7 @@ namespace VIZ.H2V.Module
});
});
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
context
.
IsUseClip
=
service
.
IsUseClip
;
context
.
Mode
=
AlgorithmStrategyMode
.
manual_mode
;
context
.
Mode
=
AlgorithmStrategyMode
.
manual_mode
;
context
.
IsNeedRestart
=
false
;
context
.
IsNeedRestart
=
false
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
context
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
...
...
VIZ.H2V.Module/NDIMainView/View/NDIMainView.xaml
View file @
6fb354a7
...
@@ -53,9 +53,9 @@
...
@@ -53,9 +53,9 @@
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="30"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="30"></local:NDIView>
<
!--<
local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="30"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="30"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="30"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="30"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="30"></local:NDIView>
-->
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="30"></local:NDIView>
</Grid>
</Grid>
<!-- 底部 -->
<!-- 底部 -->
<Border Grid.Row="2" Background="#ff12202d">
<Border Grid.Row="2" Background="#ff12202d">
...
...
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
View file @
6fb354a7
...
@@ -25,6 +25,11 @@ namespace VIZ.H2V.Module
...
@@ -25,6 +25,11 @@ namespace VIZ.H2V.Module
string
StrategyDisplayName
{
get
;
set
;
}
string
StrategyDisplayName
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 是否使用裁切
/// </summary>
bool
IsUseClip
{
get
;
}
/// <summary>
/// 算法类型
/// 算法类型
/// </summary>
/// </summary>
AlgorithmStrategyType
StrategyType
{
get
;
set
;
}
AlgorithmStrategyType
StrategyType
{
get
;
set
;
}
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Manual_NDI.cs
View file @
6fb354a7
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -45,6 +46,10 @@ namespace VIZ.H2V.Module
...
@@ -45,6 +46,10 @@ namespace VIZ.H2V.Module
double
x
=
this
.
ClipBoxX
.
Value
/
p
-
Navigation3DManager
.
Navigation3DModel
.
MaxX
;
double
x
=
this
.
ClipBoxX
.
Value
/
p
-
Navigation3DManager
.
Navigation3DModel
.
MaxX
;
Navigation3DManager
.
Navigation3DModel
.
Reset
(
x
);
Navigation3DManager
.
Navigation3DModel
.
Reset
(
x
);
#if DEBUG
Debug
.
WriteLine
(
$"========== Reset3DMouse | ClipBoxX=
{
this
.
ClipBoxX
.
Value
}
| x=
{
x
}
=========="
);
#endif
}
}
/// <summary>
/// <summary>
...
@@ -77,8 +82,8 @@ namespace VIZ.H2V.Module
...
@@ -77,8 +82,8 @@ namespace VIZ.H2V.Module
/// </summary>
/// </summary>
private
void
CompositionTarget_Rendering
(
object
sender
,
EventArgs
e
)
private
void
CompositionTarget_Rendering
(
object
sender
,
EventArgs
e
)
{
{
// 仅手动模式下处理
且 需要进行裁切
时才处理
// 仅手动模式下处理
& 需要进行裁切 & 3D鼠标准备完毕
时才处理
if
(
this
.
StrategyMode
!=
AlgorithmStrategyMode
.
manual_mode
||
!
this
.
IsUseClip
)
if
(
this
.
StrategyMode
!=
AlgorithmStrategyMode
.
manual_mode
||
!
this
.
IsUseClip
||
!
Navigation3DManager
.
Navigation3DModel
.
IsReady
)
return
;
return
;
this
.
UpdateClipBoxWithManual
();
this
.
UpdateClipBoxWithManual
();
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
View file @
6fb354a7
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
View file @
6fb354a7
...
@@ -101,74 +101,89 @@ namespace VIZ.H2V.Module
...
@@ -101,74 +101,89 @@ namespace VIZ.H2V.Module
return
;
return
;
}
}
// ----------------------------------------------------------------------------------------------
try
// Step 1. 更新属性 & 缓存
// ----------------------------------------------------------------------------------------------
// 设置当前模式
this
.
StrategyMode
=
context
.
Mode
;
this
.
ViewConfig
.
StrategyMode
=
context
.
Mode
;
this
.
ViewConfig
.
IsUseClip
=
this
.
IsUseClip
;
ApplicationDomainEx
.
LiteDbContext
.
ViewConfig
.
Update
(
this
.
ViewConfig
);
// 更新模式属性
this
.
UpdateModeProperty
();
// ----------------------------------------------------------------------------------------------
// Step 2. 清理界面状态 & 发送手动裁切消息
// ----------------------------------------------------------------------------------------------
// 清理视频控件
this
.
ClearVideoControl
();
// 发送切换手动消息
AlgorithmStrategyChangedToManualMessage
msg
=
new
AlgorithmStrategyChangedToManualMessage
();
msg
.
Source
=
this
;
msg
.
IsChangedToManual
=
this
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
;
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
// ----------------------------------------------------------------------------------------------
// Step 3. 校验视图状态
// ----------------------------------------------------------------------------------------------
// 如果当前状态为停止状态,那么重启算法 || 指定需要重启算法
if
(
this
.
ViewStatus
==
NDIViewStatus
.
Stop
||
context
.
IsNeedRestart
)
{
{
controller
.
RestartAlgorithm
();
// 停止3D鼠标更新
return
;
Navigation3DManager
.
Navigation3DModel
.
IsReady
=
false
;
}
// 1. 当前状态处于等待启动、等待停止、等待初始化完成状态是不需要处理的
// ----------------------------------------------------------------------------------------------
// 2. 算法在CheckOK之后会获取最新的设置,所以不需要后续处理
// Step 1. 更新属性 & 缓存
if
(
this
.
ViewStatus
==
NDIViewStatus
.
WaitSetup
||
this
.
ViewStatus
==
NDIViewStatus
.
WaitStop
||
this
.
ViewStatus
==
NDIViewStatus
.
WaitCheckOK
)
// ----------------------------------------------------------------------------------------------
return
;
// 设置当前模式
this
.
StrategyMode
=
context
.
Mode
;
this
.
ViewConfig
.
StrategyMode
=
context
.
Mode
;
this
.
ViewConfig
.
IsUseClip
=
this
.
IsUseClip
;
ApplicationDomainEx
.
LiteDbContext
.
ViewConfig
.
Update
(
this
.
ViewConfig
);
// 更新模式属性
this
.
UpdateModeProperty
();
// ----------------------------------------------------------------------------------------------
// Step 2. 清理界面状态 & 发送手动裁切消息
// ----------------------------------------------------------------------------------------------
// 清理视频控件
this
.
ClearVideoControl
();
// 发送切换手动消息
AlgorithmStrategyChangedToManualMessage
msg
=
new
AlgorithmStrategyChangedToManualMessage
();
msg
.
Source
=
this
;
msg
.
IsChangedToManual
=
this
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
;
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
// ----------------------------------------------------------------------------------------------
// Step 3. 校验视图状态
// ----------------------------------------------------------------------------------------------
// 如果当前状态为停止状态,那么重启算法 || 指定需要重启算法
if
(
this
.
ViewStatus
==
NDIViewStatus
.
Stop
||
context
.
IsNeedRestart
)
{
controller
.
RestartAlgorithm
();
return
;
}
// 1. 当前状态处于等待启动、等待停止、等待初始化完成状态是不需要处理的
// 2. 算法在CheckOK之后会获取最新的设置,所以不需要后续处理
if
(
this
.
ViewStatus
==
NDIViewStatus
.
WaitSetup
||
this
.
ViewStatus
==
NDIViewStatus
.
WaitStop
||
this
.
ViewStatus
==
NDIViewStatus
.
WaitCheckOK
)
return
;
// ----------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
// Step 4. 执行切换
// Step 4. 执行切换
// ----------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------
if
(!
this
.
IsUseClip
)
if
(!
this
.
IsUseClip
)
{
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
controller
.
ChangeNoMode
();
return
;
}
else
{
switch
(
context
.
Mode
)
{
case
AlgorithmStrategyMode
.
center_mode
:
controller
.
ChangeCenterMode
();
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
break
;
case
AlgorithmStrategyMode
.
manual_mode
:
controller
.
ChangeManualMode
();
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
break
;
case
AlgorithmStrategyMode
.
auto_mode
:
controller
.
ChangeAutoMode
(
context
);
break
;
}
}
}
catch
(
Exception
ex
)
{
{
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
log
.
Error
(
ex
);
controller
.
ChangeNoMode
();
return
;
}
}
else
finally
{
{
switch
(
context
.
Mode
)
// 启动3D鼠标更新
{
Navigation3DManager
.
Navigation3DModel
.
IsReady
=
true
;
case
AlgorithmStrategyMode
.
center_mode
:
controller
.
ChangeCenterMode
();
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
break
;
case
AlgorithmStrategyMode
.
manual_mode
:
controller
.
ChangeManualMode
();
this
.
ViewStatus
=
NDIViewStatus
.
CropRoi
;
break
;
case
AlgorithmStrategyMode
.
auto_mode
:
controller
.
ChangeAutoMode
(
context
);
break
;
}
}
}
}
}
...
...
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