Commit 47d911a0 by liulongfei

日志输出

parent 2bf973a3
......@@ -5,6 +5,8 @@ using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Domain;
using VIZ.Framework.Connection;
using log4net;
using Newtonsoft.Json;
namespace VIZ.H2V.Connection
{
......
......@@ -38,6 +38,9 @@ namespace VIZ.H2V.Module
/// </summary>
public void ExecuteSpaceDown()
{
if (this.focusNDIViewModel != null)
return;
this.focusNDIViewModel = NDIViewModel.ActiveViewModel;
if (this.focusNDIViewModel == null)
return;
......
......@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using log4net;
using Newtonsoft.Json;
using SharpDX.Mathematics.Interop;
using VIZ.Framework.Common;
using VIZ.Framework.Connection;
......@@ -45,7 +46,7 @@ namespace VIZ.H2V.Module
double p = (renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) / (2 * Navigation3DManager.Navigation3DModel.MaxX);
double x = this.ClipBoxX.Value / p - Navigation3DManager.Navigation3DModel.MaxX;
Navigation3DManager.Navigation3DModel.Reset(x);
Navigation3DManager.Navigation3DModel.Reset((int)x);
#if DEBUG
Debug.WriteLine($"========== Reset3DMouse | ClipBoxX={this.ClipBoxX.Value} | x={x} ==========");
......@@ -62,8 +63,8 @@ namespace VIZ.H2V.Module
Navigation3DManager.Navigation3DModel.IsUseSmooth = config.IsManualUseSmooth;
// 注册WPF渲染事件,用于处理3D鼠标
CompositionTarget.Rendering -= CompositionTarget_Rendering;
CompositionTarget.Rendering += CompositionTarget_Rendering;
//CompositionTarget.Rendering -= CompositionTarget_Rendering;
//CompositionTarget.Rendering += CompositionTarget_Rendering;
// 如果是DEBUG模式,那么开启手动裁切FPS统计
if (ApplicationDomainEx.IS_DEBUG)
......@@ -87,14 +88,14 @@ namespace VIZ.H2V.Module
/// <summary>
/// WPF渲染事件
/// </summary>
private void CompositionTarget_Rendering(object sender, EventArgs e)
{
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode != AlgorithmStrategyMode.manual_mode || !this.IsUseClip || !Navigation3DManager.Navigation3DModel.IsReady)
return;
//private void CompositionTarget_Rendering(object sender, EventArgs e)
//{
// // 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
// if (this.StrategyMode != AlgorithmStrategyMode.manual_mode || !this.IsUseClip || !Navigation3DManager.Navigation3DModel.IsReady)
// return;
this.UpdateClipBoxWithManual();
}
// this.UpdateClipBoxWithManual();
//}
/// <summary>
/// 手动模式更新裁切框
......@@ -114,6 +115,11 @@ namespace VIZ.H2V.Module
double p = (renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) / (2 * Navigation3DManager.Navigation3DModel.MaxX);
////////////////////////////////////////////////////////////////////////
// DEBUG
double test_1 = this.clipBoxX ?? 0;
////////////////////////////////////////////////////////////////////////
Navigation3DManager.UpdateRenderTime();
Navigation3DManager.Navigation3DModel.UpdateSmooth();
if (this.ClipBoxX == null)
......@@ -121,7 +127,7 @@ namespace VIZ.H2V.Module
this.ClipBoxX = renderInfo.Frame.Width / 2d - this.CLIP_BOX_WIDTH / 2d;
}
this.ClipBoxX = (Navigation3DManager.Navigation3DModel.SmoothCamera.Position.X + Navigation3DManager.Navigation3DModel.MaxX) * p;
this.ClipBoxX = ((Navigation3DManager.Navigation3DModel.SmoothCamera.Position.X + Navigation3DManager.Navigation3DModel.MaxX) * p);
ClipBoxInfo clipBox = new ClipBoxInfo();
clipBox.DrawingBorderWidth = this.CLIP_BOX_BORDER_WIDTH;
......@@ -130,6 +136,13 @@ namespace VIZ.H2V.Module
clipBox.MaskColor = this.CLIP_BOX_MASK_COLOR;
view.video.UpdateClipBox(clipBox);
////////////////////////////////////////////////////////////////////////
// DEBUG
double test_2 = this.clipBoxX ?? 0;
Debug.WriteLine($"计算: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {test_1}, {test_2} ] 差值:{test_2 - test_1}");
log.Debug($"计算: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {test_1}, {test_2} ] 差值:{test_2 - test_1}");
////////////////////////////////////////////////////////////////////////
}
/// <summary>
......@@ -141,8 +154,16 @@ namespace VIZ.H2V.Module
if (view == null)
return;
// 更新画面
view.video.UpdateVideoFrame(e.Frame);
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip && Navigation3DManager.Navigation3DModel.IsReady)
{
this.UpdateClipBoxWithManual();
}
// 如果当前模式为手动模式且处于接收裁切信号状态,并且需要进行裁切,那么发送手动裁切信号
if (e.Frame != null && this.ViewConfig.StrategyMode == AlgorithmStrategyMode.manual_mode && this.ViewStatus == NDIViewStatus.CropRoi && this.IsUseClip)
{
......@@ -157,6 +178,9 @@ namespace VIZ.H2V.Module
return;
this.ManualFPS.CalcFps();
Debug.WriteLine($"发送: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {this.clipBoxX} ]");
log.Debug($"发送: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {this.clipBoxX} ]");
}
}
}
......
......@@ -156,9 +156,21 @@ namespace VIZ.H2V.Module
info.DrawingBorderColor = this.StrategyMode == AlgorithmStrategyMode.manual_mode ? this.ClipBoxStrokeColor_Manual : this.ClipBoxStrokeColor_Normal;
info.MaskColor = this.CLIP_BOX_MASK_COLOR;
//////////////////////////////////////////////////////////////////////////////
/// DEBUG
double test_1 = this.ClipBoxX ?? 0;
//////////////////////////////////////////////////////////////////////////////
this.ClipBoxX = rect.Left;
view.video.UpdateClipBox(info);
//////////////////////////////////////////////////////////////////////////////
/// DEBUG
double test_2 = this.ClipBoxX ?? 0;
Debug.WriteLine($"自动裁切: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {test_1}, {test_2} ] 差值: {test_2 - test_1}");
log.Debug($"自动裁切: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} | [ {test_1}, {test_2} ] 差值: {test_2 - test_1}");
//////////////////////////////////////////////////////////////////////////////
}
else
{
......
......@@ -62,6 +62,9 @@
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference>
......
......@@ -4,5 +4,6 @@
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net48" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="SharpDX" version="4.2.0" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -39,7 +39,7 @@ VIDEO_CLIP_BOX_MASK_COLOR=#88000000
; ============================================================
[Navigation3D]
;3D鼠标X轴偏移最大值
NAVIGATION3D_MAX_VALUE=3
NAVIGATION3D_MAX_VALUE=555
;3D鼠标配置名称
NAVIGATION3D_PROFILE_NAME=VIZ.H2V
; ============================================================
......
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