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
2dc9fb79
Commit
2dc9fb79
authored
Aug 22, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 操作日志记录
parent
00c929b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
3 deletions
+125
-3
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
+0
-2
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
+31
-0
VIZ.H2V.Module/Setup/Provider/AppSetup_InitCsv.cs
+24
-0
VIZ.H2V.Storage/CSV/CsvContext.cs
+68
-0
VIZ.H2V.Storage/VIZ.H2V.Storage.csproj
+1
-0
VIZ.H2V/config/config.ini
+1
-1
No files found.
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.Message.cs
View file @
2dc9fb79
...
...
@@ -173,8 +173,6 @@ namespace VIZ.H2V.Module
// 裁切框在手动模式下由客户端控制,不需要处理算法给的裁切框
if
(
msg
.
roi
==
null
||
this
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
)
{
view
.
video
.
ClearClipBox
();
return
;
}
...
...
VIZ.H2V.Module/NDIView/VieweModel/NDIViewModel.cs
View file @
2dc9fb79
...
...
@@ -115,6 +115,9 @@ namespace VIZ.H2V.Module
try
{
// 记录操作日志
this
.
WriteLogOperation
(
context
);
// 停止3D鼠标更新
Navigation3DManager
.
Navigation3DModel
.
IsReady
=
false
;
...
...
@@ -305,5 +308,33 @@ namespace VIZ.H2V.Module
break
;
}
}
/// <summary>
/// 操作日志
/// </summary>
/// <param name="context">切换算法上下文</param>
private
void
WriteLogOperation
(
ChangeStrategyContext
context
)
{
AlgorithmStrategyMode
last_mode
=
this
.
StrategyMode
;
lock
(
ApplicationDomainEx
.
CsvContext
.
LogOperations
)
{
DateTime
now
=
DateTime
.
Now
;
LogOperation
last
=
ApplicationDomainEx
.
CsvContext
.
LogOperations
.
LastOrDefault
();
if
(
last
!=
null
)
{
last
.
EndTime
=
now
;
last
.
Duration
=
now
-
last
.
BeginTime
;
}
LogOperation
log
=
new
LogOperation
();
log
.
ViewKey
=
this
.
ViewKey
;
log
.
Operation
=
last_mode
.
GetDescription
();
log
.
BeginTime
=
now
;
ApplicationDomainEx
.
CsvContext
.
LogOperations
.
Add
(
log
);
}
}
}
}
VIZ.H2V.Module/Setup/Provider/AppSetup_InitCsv.cs
View file @
2dc9fb79
...
...
@@ -38,11 +38,17 @@ namespace VIZ.H2V.Module
string
algorithm_border_scence_path
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"config"
,
"algorithm_border_scene.csv"
);
string
clip_system_path
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"config"
,
"clip_system.csv"
);
// CSV配置
ApplicationDomainEx
.
CsvContext
=
new
CsvContext
();
ApplicationDomainEx
.
CsvContext
.
LoadAlgorithmStrategys
(
algorithm_strategy_path
);
ApplicationDomainEx
.
CsvContext
.
LoadAlgorithmBorderScenes
(
algorithm_border_scence_path
);
ApplicationDomainEx
.
CsvContext
.
LoadClipSystems
(
clip_system_path
);
// 操作日志
ApplicationDomainEx
.
CsvContext
.
OpenLogOperations
();
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitCsv.WriteLogOperations"
,
60
,
this
.
WriteLogOperations
);
return
true
;
}
...
...
@@ -52,7 +58,25 @@ namespace VIZ.H2V.Module
/// <param name="context">应用程序启动上下文</param>
public
override
void
Shutdown
(
AppSetupContext
context
)
{
lock
(
ApplicationDomainEx
.
CsvContext
.
LogOperations
)
{
LogOperation
last
=
ApplicationDomainEx
.
CsvContext
.
LogOperations
.
LastOrDefault
();
if
(
last
!=
null
)
{
last
.
EndTime
=
DateTime
.
Now
;
last
.
Duration
=
last
.
EndTime
-
last
.
BeginTime
;
}
}
ApplicationDomainEx
.
CsvContext
.
CloseLogOperations
();
}
/// <summary>
/// 写入操作日志
/// </summary>
private
void
WriteLogOperations
()
{
ApplicationDomainEx
.
CsvContext
.
FlushLogOperations
();
}
}
}
VIZ.H2V.Storage/CSV/CsvContext.cs
View file @
2dc9fb79
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.IO
;
...
...
@@ -6,6 +7,8 @@ using System.Linq;
using
System.Text
;
using
System.Threading.Tasks
;
using
CsvHelper
;
using
CsvHelper.Configuration
;
using
VIZ.Framework.Storage
;
namespace
VIZ.H2V.Storage
{
...
...
@@ -17,19 +20,28 @@ namespace VIZ.H2V.Storage
/// <summary>
/// 算法信息
/// </summary>
[
Csv
(
Scene
=
CsvScene
.
Read
)]
public
List
<
AlgorithmStrategy
>
AlgorithmStrategys
{
get
;
private
set
;
}
/// <summary>
/// 边线场景
/// </summary>
[
Csv
(
Scene
=
CsvScene
.
Read
)]
public
List
<
AlgorithmBorderScene
>
AlgorithmBorderScenes
{
get
;
private
set
;
}
/// <summary>
/// 裁切系统
/// </summary>
[
Csv
(
Scene
=
CsvScene
.
Read
)]
public
List
<
ClipSystem
>
ClipSystems
{
get
;
private
set
;
}
/// <summary>
/// 操作日志
/// </summary>
[
Csv
(
Scene
=
CsvScene
.
Read
)]
public
List
<
LogOperation
>
LogOperations
{
get
;
private
set
;
}
/// <summary>
/// 加载算法信息
/// </summary>
/// <param name="path">文件路径</param>
...
...
@@ -67,5 +79,61 @@ namespace VIZ.H2V.Storage
this
.
ClipSystems
=
reader
.
GetRecords
<
ClipSystem
>()?.
ToList
();
}
}
// ====================================================================================
// 操作日志
/// <summary>
/// 操作日志输出
/// </summary>
private
CsvWriter
logOperationsWriter
;
/// <summary>
/// 打开操作日志
/// </summary>
public
void
OpenLogOperations
()
{
string
dir
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"log_operation"
);
string
fileName
=
Path
.
Combine
(
dir
,
$"
{
DateTime
.
Now
.
ToString
(
"yyyy_MM_dd__HH_mm_ss"
)}
.csv"
);
if
(!
Directory
.
Exists
(
dir
))
{
Directory
.
CreateDirectory
(
dir
);
}
CsvConfiguration
config
=
new
CsvConfiguration
(
System
.
Threading
.
Thread
.
CurrentThread
.
CurrentCulture
);
CsvWriter
writer
=
new
CsvWriter
(
new
StreamWriter
(
fileName
,
false
,
Encoding
.
Default
),
config
);
writer
.
Context
.
RegisterClassMap
(
new
LogOperationMap
());
this
.
LogOperations
=
new
List
<
LogOperation
>();
this
.
logOperationsWriter
=
writer
;
}
/// <summary>
/// 输出操作日志
/// </summary>
public
void
FlushLogOperations
()
{
if
(
this
.
logOperationsWriter
==
null
||
this
.
LogOperations
==
null
||
this
.
LogOperations
.
Count
==
0
)
return
;
lock
(
this
.
LogOperations
)
{
this
.
logOperationsWriter
.
WriteRecords
(
this
.
LogOperations
);
this
.
LogOperations
.
Clear
();
}
}
/// <summary>
/// 关闭操作日志
/// </summary>
public
void
CloseLogOperations
()
{
this
.
FlushLogOperations
();
this
.
logOperationsWriter
?.
Flush
();
this
.
logOperationsWriter
?.
Dispose
();
this
.
logOperationsWriter
=
null
;
}
}
}
VIZ.H2V.Storage/VIZ.H2V.Storage.csproj
View file @
2dc9fb79
...
...
@@ -115,6 +115,7 @@
<Compile Include="CSV\Algorithm\AlgorithmStrategy.cs" />
<Compile Include="CSV\Clip\ClipSystem.cs" />
<Compile Include="CSV\CsvContext.cs" />
<Compile Include="CSV\Log\LogOperation.cs" />
<Compile Include="Init\Config\AlgorithmConfig.cs" />
<Compile Include="Init\Config\UdpConfig.cs" />
<Compile Include="LiteDB\Algorithm\AlgorithmBase.cs" />
...
...
VIZ.H2V/config/config.ini
View file @
2dc9fb79
...
...
@@ -35,7 +35,7 @@ VIDEO_CLIP_BOX_BORDER_COLOR=#FFFF0000
;视频剪切掩码颜色
VIDEO_CLIP_BOX_MASK_COLOR=#88000000
;视频边线检测多边形区域透明度
VIDEO_SIDE_CHECK_POLYGON_OPACITY
=
0.
2
VIDEO_SIDE_CHECK_POLYGON_OPACITY
=
0.
15
; ============================================================
; === Navigation3D ===
; ============================================================
...
...
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