Commit 24af89f7 by liulongfei

3D 鼠标接入

parent 4c6a6318
......@@ -32,7 +32,7 @@ namespace VIZ.H2V.ClipTestTool
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
// 執行加载流程
AppSetupContext context = AppSetup.Load();
AppSetupContext context = AppSetup.Load(this);
if (context.Exception != null)
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Module
{
/// <summary>
/// 手动裁切控制器
/// </summary>
public interface IManualController
{
/// <summary>
/// 获取映射值
/// </summary>
/// <returns>映射值</returns>
int GetMappingValue();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Module
{
/// <summary>
/// 手动裁切控制器支持
/// </summary>
public interface IManualSupport
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Instrumentation;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.H2V.Domain;
namespace VIZ.H2V.Module
{
/// <summary>
/// 手动控制器
/// </summary>
public class ManualController : IManualController
{
/// <summary>
/// 手动控制器
/// </summary>
/// <param name="support"></param>
public ManualController(IManualSupport support)
{
this.Support = support;
}
/// <summary>
/// 支持
/// </summary>
public IManualSupport Support { get; private set; }
//long lScaleData = pEvent->u.spwData.mData[SI_TY];
//long lFuncData = pEvent->u.spwData.mData[SI_RZ];
//long lPosData0 = pEvent->u.spwData.mData[SI_RX];
//long lPosData1 = pEvent->u.spwData.mData[SI_RZ];
//long lRotData0 = pEvent->u.spwData.mData[SI_TX];
//long lRotData1 = pEvent->u.spwData.mData[SI_RY];
/// <summary>
/// 获取映射值
/// </summary>
/// <returns>映射值</returns>
public int GetMappingValue()
{
int symbol = Navigation3DManager.Info.rz >= 0 ? 1 : -1;
int value = Math.Abs(Navigation3DManager.Info.rz);
Navigation3DMapping first = ApplicationDomainEx.CsvContext.Navigation3DMappings.FirstOrDefault();
Navigation3DMapping last = ApplicationDomainEx.CsvContext.Navigation3DMappings.LastOrDefault();
if (value == 0 || value < first.MinValue)
{
return 0;
}
if (value >= last.MaxValue)
{
return last.MappingValue * symbol;
}
Navigation3DMapping mapping = ApplicationDomainEx.CsvContext.Navigation3DMappings.FirstOrDefault(p => value >= p.MinValue && value < p.MaxValue);
if (mapping == null)
return 0;
return mapping.MappingValue * symbol;
}
}
}
......@@ -66,14 +66,6 @@ namespace VIZ.H2V.Module
this.ClipBoxSmooth = new Navigation3DSmooth();
this.ClipBoxSmooth.Init(0, 0, config.ManualSmoothCoeff);
// 是否启用平滑
//SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
//Navigation3DManager.Navigation3DModel.IsUseSmooth = config.IsManualUseSmooth;
// 注册WPF渲染事件,用于处理3D鼠标
//CompositionTarget.Rendering -= CompositionTarget_Rendering;
//CompositionTarget.Rendering += CompositionTarget_Rendering;
}
/// <summary>
......@@ -88,18 +80,6 @@ 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;
// this.UpdateClipBoxWithManual();
//}
/// <summary>
/// 手动模式更新裁切框
/// </summary>
private void UpdateClipBoxWithManual()
......@@ -115,7 +95,8 @@ namespace VIZ.H2V.Module
return;
}
double x = this.ClipBoxTargetX + Navigation3DTcpManager.MappingValue;
//double x = this.ClipBoxTargetX + Navigation3DTcpManager.MappingValue;
double x = this.ClipBoxTargetX + this.ManualController.GetMappingValue();
x = MathHelper.Clip(0d, renderInfo.Frame.Width - this.CLIP_BOX_WIDTH, x);
this.ClipBoxTargetX = x;
this.ClipBoxX = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 1);
......@@ -141,17 +122,8 @@ namespace VIZ.H2V.Module
// 更新画面
view.video.UpdateVideoFrame(e.Frame);
//#if DEBUG
// //Debug.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")} MappingValue {Navigation3DTcpManager.MappingValue}");
// if (this.ViewKey == NDIViewKeys.CAM_1)
// {
// log.Debug($"【渲染视频帧】 时间: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")} 帧时间戳:{e.Frame.TimeStamp}");
// }
//#endif
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
//if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip && Navigation3DManager.Navigation3DModel.IsReady)
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
......
......@@ -98,6 +98,11 @@ namespace VIZ.H2V.Module
/// </summary>
private readonly Dictionary<AlgorithmStrategyType, IAlgorithmController> AlgorithmControllerDic = new Dictionary<AlgorithmStrategyType, IAlgorithmController>();
/// <summary>
/// 手动裁切控制器
/// </summary>
private IManualController ManualController;
// ======================================================================================
// === Property ===
// ======================================================================================
......@@ -269,7 +274,7 @@ namespace VIZ.H2V.Module
#region ClipBoxTargetX -- 裁切框目标X坐标
private double clipBoxTargetX;
private double clipBoxTargetX = 555;
/// <summary>
/// 裁切框目标X坐标
/// </summary>
......
......@@ -15,7 +15,7 @@ namespace VIZ.H2V.Module
/// <summary>
/// NDI视图模型
/// </summary>
public partial class NDIViewModel : ViewModelBase, INDIViewService, IAlgorithmSupport
public partial class NDIViewModel : ViewModelBase, INDIViewService, IAlgorithmSupport, IManualSupport
{
/// <summary>
/// 日志
......@@ -73,6 +73,8 @@ namespace VIZ.H2V.Module
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Sixteen, new AlgorithmController_Sixteen(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Tactics, new AlgorithmController_Tactics(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Cableway, new AlgorithmController_Cableway(this));
this.ManualController = new ManualController(this);
}
/// <summary>
......
......@@ -207,6 +207,9 @@
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Sixteen.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Near.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Single.cs" />
<Compile Include="NDIView\Controller\Manual\IManualController.cs" />
<Compile Include="NDIView\Controller\Manual\IManualSupport.cs" />
<Compile Include="NDIView\Controller\Manual\ManualController.cs" />
<Compile Include="NDIView\Enum\NDIViewScene.cs" />
<Compile Include="NDIView\Info\ChangeStrategyContext.cs" />
<Compile Include="NDIView\Info\ClearVideoControlContext.cs" />
......
......@@ -31,9 +31,13 @@ namespace VIZ.H2V
// 初始化UDP
AppSetup.AppendSetup(new AppSetup_InitUDP());
// 初始化3D鼠标
AppSetup.AppendSetup(new AppSetup_Navigation3D_TCP());
//AppSetup.AppendSetup(new AppSetup_Navigation3D_TCP());
// 初始化系统监控
AppSetup.AppendLoad(new AppSetup_Monitor());
// 初始化3D鼠标
AppSetup.AppendLoad(new AppSetup_Navigation3D());
// 执行启动流程
AppSetupContext context = AppSetup.Setup();
......
......@@ -33,7 +33,7 @@ namespace VIZ.H2V
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
// 執行加载流程
AppSetupContext context = AppSetup.Load();
AppSetupContext context = AppSetup.Load(this);
if (context.Exception != null)
{
......
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