Commit 068d8380 by liulongfei

1. 手动裁切控制

2. 手动裁切测试工具
parent 4bcedeee
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<Application x:Class="VIZ.H2V.ClipTestTool.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VIZ.H2V.ClipTestTool"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Module;
using VIZ.H2V.Module;
namespace VIZ.H2V.ClipTestTool
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
public App()
{
AppSetup.AppendSetup(new AppSetup_InitCsv());
AppSetup.AppendSetup(new AppSetup_Navigation3D_TCP());
AppSetupContext context = AppSetup.Setup();
if (context.Exception != null)
{
MessageBox.Show($"执行 {context.ProviderDetail} 失败\r\n{context.Exception.Message}");
}
if (!context.IsSuccess)
{
Environment.Exit(-1);
}
}
}
}
\ No newline at end of file
<Window x:Class="VIZ.H2V.ClipTestTool.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VIZ.H2V.ClipTestTool"
mc:Ignorable="d"
Title="MainWindow" Height="900" Width="1200">
<Grid>
<local:MainView></local:MainView>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Module;
namespace VIZ.H2V.ClipTestTool
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Closed += MainWindow_Closed;
this.Loaded += MainWindow_Loaded;
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
// 執行加载流程
AppSetupContext context = AppSetup.Load();
if (context.Exception != null)
{
MessageBox.Show($"执行 {context.ProviderDetail} 失败\r\n{context.Exception.Message}");
}
if (!context.IsSuccess)
{
Environment.Exit(-1);
}
}
/// <summary>
/// 窗口关闭触发
/// </summary>
private void MainWindow_Closed(object sender, EventArgs e)
{
AppSetup.ShutDown();
}
}
}
\ No newline at end of file
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VIZ.H2V.ClipTestTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VIZ.H2V.ClipTestTool")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.H2V.ClipTestTool.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VIZ.H2V.ClipTestTool.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.H2V.ClipTestTool.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{16CDC661-A7D8-49DA-A269-0F9F4E798977}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>VIZ.H2V.ClipTestTool</RootNamespace>
<AssemblyName>VIZ.H2V.ClipTestTool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Gma.System.MouseKeyHook, Version=5.6.130.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="View\MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="config\algorithm_border_scene.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\algorithm_strategy.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\clip_system.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\config.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="config\log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\navigation_3d_mapping.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
<Project>{76ef480a-e486-41b7-b7a5-2a849fc8d5bf}</Project>
<Name>VIZ.Framework.Common.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common\VIZ.Framework.Common.csproj">
<Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project>
<Name>VIZ.Framework.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Connection\VIZ.Framework.Connection.csproj">
<Project>{e07528dd-9dee-47c2-b79d-235ecfa6b003}</Project>
<Name>VIZ.Framework.Connection</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Module\VIZ.Framework.Module.csproj">
<Project>{47CF6FB0-E37D-4EF1-AFC7-03DB2BCA8892}</Project>
<Name>VIZ.Framework.Module</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.H2V.Connection\VIZ.H2V.Connection.csproj">
<Project>{94C95C0F-070F-4827-83FC-8DDA63BAB177}</Project>
<Name>VIZ.H2V.Connection</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.H2V.Domain\VIZ.H2V.Domain.csproj">
<Project>{3C61290E-D9C3-4F00-83CB-AE5F64C3298C}</Project>
<Name>VIZ.H2V.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.H2V.Module\VIZ.H2V.Module.csproj">
<Project>{A3B594B2-27C0-4255-9999-0B4CF3A683D4}</Project>
<Name>VIZ.H2V.Module</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.H2V.Storage\VIZ.H2V.Storage.csproj">
<Project>{CFABFB6E-0257-4D73-B75E-BC0CE3B4A2FD}</Project>
<Name>VIZ.H2V.Storage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<UserControl x:Class="VIZ.H2V.ClipTestTool.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.H2V.ClipTestTool"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
mc:Ignorable="d" Background="White" Loaded="UserControl_Loaded"
d:DesignHeight="800" d:DesignWidth="1200">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 输入源 -->
<TextBlock Text="输入源:" Foreground="Black" FontSize="18" VerticalAlignment="Center"></TextBlock>
<ComboBox Grid.Column="1" Height="40"
ItemsSource="{Binding Path=NDIStreamInfos,Mode=OneWay}"
SelectedValue="{Binding Path=SelectedNDIStreamInfo,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Border Background="Transparent" IsHitTestVisible="False">
<TextBlock Text="{Binding Path=FullName}" Foreground="Black" FontSize="16"></TextBlock>
</Border>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Grid.Column="2" Content="刷新NDI流" Command="{Binding Path=RefreshNdiCommand}"></Button>
<Button Grid.Column="3" Grid.RowSpan="2" Content="开始" Command="{Binding Path=StartCommand}"></Button>
<!-- 每帧移动距离 -->
<TextBlock Text="每帧移动距离:" Foreground="Black" FontSize="18" VerticalAlignment="Center" Grid.Row="1"></TextBlock>
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
</Grid.ColumnDefinitions>
<fcommon:NumberBox MinValue="0" MaxValue="200" Interval="1"
Value="{Binding Path=MoveValue,Mode=TwoWay}"></fcommon:NumberBox>
<TextBlock Text="像素" Foreground="Black" FontSize="18" VerticalAlignment="Center" Grid.Column="1" Margin="10,0,0,0"></TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
</Grid.ColumnDefinitions>
<fcommon:NumberBox MinValue="0.001" MaxValue="0.05" Interval="0.0001"
Value="{Binding Path=SmoothValue,Mode=TwoWay}"></fcommon:NumberBox>
<Button Content="刷新平滑系数" Foreground="Black" FontSize="12" Grid.Column="1" Command="{Binding Path=UpdateSmoothCommand}"></Button>
</Grid>
</Grid>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Row="1">
<TextBlock Text="NDI FPS:" Foreground="Red" FontSize="20"></TextBlock>
<TextBlock Text="25" Foreground="Red" FontSize="20" Margin="10,0,0,0"></TextBlock>
</StackPanel>
<Border BorderBrush="Transparent" BorderThickness="1" Grid.Row="2">
<fcommon:VideoControl x:Name="video" IsShowFPS="True"></fcommon:VideoControl>
</Border>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
namespace VIZ.H2V.ClipTestTool
{
/// <summary>
/// MainView.xaml 的交互逻辑
/// </summary>
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new MainViewModel());
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// 裁切框插件
ClipBoxPlugin clipBoxPlugin = new ClipBoxPlugin(this.video);
this.video.AttachPlugin(clipBoxPlugin);
}
}
}
using Gma.System.MouseKeyHook;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Common;
using VIZ.Framework.Connection;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
using VIZ.Framework.Module;
using VIZ.H2V.Connection;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
using log4net;
using System.Diagnostics;
namespace VIZ.H2V.ClipTestTool
{
/// <summary>
/// 主视图模型
/// </summary>
public class MainViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(MainViewModel));
/// <summary>
/// 主视图模型
/// </summary>
public MainViewModel()
{
// 初始化命令
this.initCommand();
// 初始化CSV
this.initCSV();
// 初始化NDI
this.initNDI();
// 初始化UDP
this.initUDP();
// 注册关闭消息
ApplicationDomain.MessageManager.Register<AppShutDownMessage>(this, this.Dispose);
this.smooth.Init(0, 0, 0.001);
}
/// <summary>
/// 初始化NDI
/// </summary>
private void initNDI()
{
string localrecvname = System.Net.Dns.GetHostName() + "_TRTC_0";
NDIStreamOption option = new NDIStreamOption();
this.ndiStream = new NDIStream(localrecvname, null, option);
this.ndiStream.ExecuteVideoFrame += NdiStream_ExecuteVideoFrame;
this.ndiStream.Start();
}
/// <summary>
/// 初始化命令
/// </summary>
private void initCommand()
{
this.RefreshNdiCommand = new VCommand(this.refreshNdi);
this.StartCommand = new VCommand(this.start);
this.UpdateSmoothCommand = new VCommand(this.UpdateSmooth);
}
/// <summary>
/// 初始化CSV
/// </summary>
private void initCSV()
{
string clip_system_path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config", "clip_system.csv");
ApplicationDomainEx.CsvContext = new CsvContext();
ApplicationDomainEx.CsvContext.LoadClipSystems(clip_system_path);
}
/// <summary>
/// 初始化UDP
/// </summary>
private void initUDP()
{
this.conn = new UdpConnection();
// -----------------------------------------------------------------
// 客户端
string clientIP = "127.0.0.1";
int clientPort = 8102;
conn.Binding(clientIP, clientPort);
conn.Start();
}
#region NDIStreamInfos -- NDI流信息
private List<NDIStreamInfoModel> nDIStreamInfos;
/// <summary>
/// NDI流信息
/// </summary>
public List<NDIStreamInfoModel> NDIStreamInfos
{
get { return nDIStreamInfos; }
set { nDIStreamInfos = value; this.RaisePropertyChanged(nameof(NDIStreamInfos)); }
}
#endregion
#region SelectedNDIStreamInfo -- 选中的NDI流信息
private NDIStreamInfoModel selectedNDIStreamInfo;
/// <summary>
/// 选中的NDI流信息
/// </summary>
public NDIStreamInfoModel SelectedNDIStreamInfo
{
get { return selectedNDIStreamInfo; }
set { selectedNDIStreamInfo = value; this.RaisePropertyChanged(nameof(SelectedNDIStreamInfo)); }
}
#endregion
#region SmoothValue -- 平滑值
private double smoothValue = 0.02;
/// <summary>
/// 平滑值
/// </summary>
public double SmoothValue
{
get { return smoothValue; }
set { smoothValue = value; this.RaisePropertyChanged(nameof(SmoothValue)); }
}
#endregion
/// <summary>
/// NDI流
/// </summary>
private NDIStream ndiStream;
/// <summary>
/// UDP连接
/// </summary>
private UdpConnection conn;
/// <summary>
/// 裁切X坐标
/// </summary>
private int ClipX;
/// <summary>
/// 目标X
/// </summary>
private int TargetX;
/// <summary>
/// 平滑
/// </summary>
private Navigation3DSmooth smooth = new Navigation3DSmooth();
#region RefreshNdiCommand -- 刷新NDI流命令
/// <summary>
/// 刷新NDI流命令
/// </summary>
public VCommand RefreshNdiCommand { get; set; }
/// <summary>
/// 刷新NDI流
/// </summary>
private void refreshNdi()
{
List<NDIStreamInfoModel> list = new List<NDIStreamInfoModel>();
NDIStreamInfoModel selected = null;
foreach (NDIStreamInfo info in ndiStream.StreamInfos)
{
NDIStreamInfoModel model = new NDIStreamInfoModel();
model.FullName = info.FullName;
if (model.FullName == ndiStream.RemoteSenderName)
{
selected = model;
}
list.Add(model);
}
this.NDIStreamInfos = list;
this.SelectedNDIStreamInfo = selected;
}
#endregion
#region StartCommand -- 开始命令
/// <summary>
/// 开始命令
/// </summary>
public VCommand StartCommand { get; set; }
/// <summary>
/// 开始
/// </summary>
private void start()
{
if (this.SelectedNDIStreamInfo == null)
return;
this.ndiStream.ChangeRemoteSenderName(this.SelectedNDIStreamInfo.FullName);
conn.RemoveEndpointManager("UDP");
ClipSystem clipSystem = ApplicationDomainEx.CsvContext.ClipSystems.FirstOrDefault(p => this.SelectedNDIStreamInfo.FullName.Contains(p.NDI_NAME));
if (clipSystem == null)
return;
UdpEndpointManager manager = new UdpEndpointManager("UDP", "127.0.0.1", clipSystem.UDP_PORT);
conn.AddEndpointManager(manager);
}
#endregion
#region UpdateSmoothCommand -- 更新平滑命令
/// <summary>
/// 更新平滑命令
/// </summary>
public VCommand UpdateSmoothCommand { get; set; }
/// <summary>
/// 更新平滑
/// </summary>
private void UpdateSmooth()
{
this.smooth.Init(this.TargetX, 0, this.SmoothValue);
}
#endregion
/// <summary>
/// 销毁
/// </summary>
public void Dispose(AppShutDownMessage msg)
{
this.ndiStream?.Dispose();
this.conn?.Dispose();
}
/// <summary>
/// 处理NDI帧
/// </summary>
private void NdiStream_ExecuteVideoFrame(object sender, VideoFrameEventArgs e)
{
MainView view = this.GetView<MainView>();
if (view == null)
return;
view.video.UpdateVideoFrame(e.Frame);
//this.ClipX = (int)this.smooth.Call(this.TargetX, 1);
int x = (int)(this.ClipX + Navigation3DTcpManager.MappingValue);
x = x <= 0 ? 0 : x;
x = x >= e.Frame.Width - 810 ? e.Frame.Width - 810 : x;
this.ClipX = x;
ClipBoxInfo info = new ClipBoxInfo();
info.DrawingBorderWidth = 4;
info.DrawingBorderColor = SharpDxColorHelper.FromString("#ffff0000");
info.MaskColor = SharpDxColorHelper.FromString("#88000000");
info.SrcRect = new SharpDX.Mathematics.Interop.RawRectangleF(this.ClipX, 0, this.ClipX + 810, e.Frame.Height);
view.video.UpdateClipBox(info);
#if DEBUG
Debug.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")} MappingValue {Navigation3DTcpManager.MappingValue}");
#endif
UdpEndpointManager manager = conn.GetEndpointManager("UDP");
if (manager == null)
return;
log.Debug($"发送: {this.ClipX}, || {e.Frame.TimeStamp}");
ClipSender.CropRoi(manager, 0, new List<int> { this.ClipX, 0, this.ClipX + 810, e.Frame.Height }, 810, e.Frame.Height, e.Frame.TimeStamp);
}
}
}
ID,Key,DisplayName
1,single_person,单人
2,close_up,近景
3,16m_left,16米左
4,16m_right,16米右
5,tactical,战术
6,fly_cat,索道
ID,Name,DisplayName,SetupPath
1,单人机位,单人机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
2,近景机位,近景机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
3,16米机位,16米机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
4,战术机位,战术机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
5,索道机位,索道机位,E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
ID,NDI_NAME,UDP_PORT,
1,NDIOutput1,5001,
2,NDIOutput2,5002,
3,NDIOutput3,5003,
4,NDIOutput4,5004,
; ============================================================
; === Application ===
; ============================================================
[Application]
;是否是调试模式
APPLICATION_IS_DEBUG=true
;3D鼠标平滑系数
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT=0.015
;3D鼠标TCP监听IP
APPLICATION_3D_MOUSE_TCP_IP=127.0.0.1
;3D鼠标TCP监听端口
APPLICATION_3D_MOUSE_TCP_PORT=8201
; ============================================================
; === Video ===
; ============================================================
[Video]
;视频是否显示FPS
VIDEO_IS_SHOW_FPS=false
;视频渲染等待(单位:毫秒)
VIDEO_RENDER_WAIT=10
;视频背景颜色
VIDEO_BACKGROUND_COLOR=#FF172532
;视频框边框宽度(单位:像素)
VIDEO_RECTANGLE_BORDER_WIDTH=4
;视频框边框颜色(格式:#AARRGGBB)
VIDEO_RECTANGLE_BORDER_COLOR=#FFFF0000
;视频跟踪框边框宽度(单位:像素)
VIDEO_TRACKING_BOX_BORDER_WIDTH=2
;视频跟踪框边框颜色
VIDEO_TRACKING_BOX_BORDER_COLOR=#FFFF0000
;视频框选边框宽度(单位:像素)
VIDEO_FRAME_SELECTION_BORDER_WIDTH=4
;视频框选边框颜色(格式:#AARRGGBB)
VIDEO_FRAME_SELECTION_BORDER_COLOR=#FFFF6D87
;视频剪切宽度(单位:像素)
VIDEO_CLIP_BOX_WIDTH=810
;视频剪切边框宽度(单位:像素)
VIDEO_CLIP_BOX_BORDER_WIDTH=4
;视频剪切边框颜色
VIDEO_CLIP_BOX_BORDER_COLOR=#FFFF0000
;视频剪切掩码颜色
VIDEO_CLIP_BOX_MASK_COLOR=#88000000
;视频边线检测多边形区域透明度
VIDEO_SIDE_CHECK_POLYGON_OPACITY=0.15
; ============================================================
; === Navigation3D ===
; ============================================================
[Navigation3D]
;3D鼠标X轴偏移最大值
NAVIGATION3D_MAX_VALUE=555
;3D鼠标配置名称
NAVIGATION3D_PROFILE_NAME=VIZ.H2V
; ============================================================
; === UDP ===
; ============================================================
[UDP]
;UDP本机绑定IP
UDP_BINDING_IP=127.0.0.1
;UDP本机绑定端口
UDP_BINDING_PORT=8101
; ============================================================
; === Algorithm ===
; ============================================================
[Algorithm]
;算法python.exe路径(绝对路径)或者 python 命令
;ALGORITHM_PYTHON_PATH=python
ALGORITHM_PYTHON_PATH=E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.H2V.UdpTestTool.exe
;算法停止超时时间(单位:毫秒)
ALGORITHM_STOP_TIMEOUT=5000
;是否显示目标框
ALGORITHM_IS_SHOW_TARGET_BOX=true
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="errorAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="ERROR" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\err.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="infoAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\info.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="debugAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="DEBUG" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\debug.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="perfAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\perf.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="errorAppender" />
<appender-ref ref="infoAppender" />
<appender-ref ref="debugAppender" />
</root>
<logger name="Performance" additivity="false">
<level value="ALL" />
<appender-ref ref="perfAppender" />
</logger>
</log4net>
\ No newline at end of file
ID,MinValue,MaxValue,MappingValue
1,100,200,1
2,200,300,2
3,300,400,3
4,400,500,4
5,500,600,5
6,600,700,6
7,700,800,7
8,800,900,8
9,900,1000,9
10,1000,1100,10
11,1100,1200,12
12,1200,1300,14
13,1300,1400,16
14,1400,1500,18
15,1500,1600,20
16,1600,1700,22
17,1700,1800,24
18,1800,1900,26
19,1900,2000,28
20,2000,2100,30
21,2100,2200,32
22,2200,2300,34
23,2300,2400,36
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.15" targetFramework="net48" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Connection;
using log4net;
namespace VIZ.H2V.Connection
{
......@@ -13,6 +14,11 @@ namespace VIZ.H2V.Connection
public static class ClipSender
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(ClipSender));
/// <summary>
/// UDP终结点管理器
/// </summary>
/// <param name="manager">UDP终结点管理器</param>
......@@ -20,15 +26,22 @@ namespace VIZ.H2V.Connection
/// <param name="roi">裁切框</param>
/// <param name="width">宽度</param>
/// <param name="height">高度</param>
public static void CropRoi(UdpEndpointManager manager, int id, List<int> roi, int width, int height)
/// <param name="timeCode">时间码</param>
public static void CropRoi(UdpEndpointManager manager, int id, List<int> roi, int width, int height, long timeCode)
{
ClipPackage__crop_roi package = new ClipPackage__crop_roi();
package.id = id;
package.roi = roi;
package.width = width;
package.height = height;
package.timecode = timeCode;
manager.SendJson(package);
#if DEBUG
log.Debug($"{Newtonsoft.Json.JsonConvert.SerializeObject(package)} || {DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss.fffffff")}");
#endif
}
}
}
......@@ -35,5 +35,10 @@ namespace VIZ.H2V.Connection
/// 编号
/// </summary>
public int id { get; set; }
/// <summary>
/// 时间码
/// </summary>
public long timecode { get; set; }
}
}
......@@ -53,7 +53,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid x:Name="border" Background="Transparent">
<Grid x:Name="border" Background="Transparent" UseLayoutRounding="True">
<Image x:Name="img" Visibility="Visible" Width="24" Height="24"
VerticalAlignment="Center" HorizontalAlignment="Center"
Source="/VIZ.H2V.Module.Resource;component/Icons/footbal_field_24x24.png"></Image>
......@@ -85,7 +85,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid x:Name="border" Background="Transparent">
<Grid x:Name="border" Background="Transparent" UseLayoutRounding="True">
<Image x:Name="img" Visibility="Visible" Width="24" Height="24"
VerticalAlignment="Center" HorizontalAlignment="Center"
Source="/VIZ.H2V.Module.Resource;component/Icons/filter_24x24.png"></Image>
......
......@@ -27,30 +27,30 @@ namespace VIZ.H2V.Module
/// </summary>
public void Reset3DMouse()
{
NDIView view = this.GetView<NDIView>();
if (view == null)
return;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
{
view.video.ClearClipBox();
return;
}
if (this.ClipBoxX == null)
{
this.ClipBoxX = renderInfo.Frame.Width / 2d - this.CLIP_BOX_WIDTH / 2d;
}
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((int)x);
#if DEBUG
Debug.WriteLine($"========== Reset3DMouse | ClipBoxX={this.ClipBoxX.Value} | x={x} ==========");
#endif
//NDIView view = this.GetView<NDIView>();
//if (view == null)
// return;
//VideoRenderInfo renderInfo = view.video.GetRenderInfo();
//if (renderInfo == null)
//{
// view.video.ClearClipBox();
// return;
//}
//if (this.ClipBoxX == null)
//{
// this.ClipBoxX = renderInfo.Frame.Width / 2d - this.CLIP_BOX_WIDTH / 2d;
//}
//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((int)x);
//#if DEBUG
// Debug.WriteLine($"========== Reset3DMouse | ClipBoxX={this.ClipBoxX.Value} | x={x} ==========");
//#endif
}
/// <summary>
......@@ -59,12 +59,12 @@ namespace VIZ.H2V.Module
private void InitManual()
{
// 是否启用平滑
SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
Navigation3DManager.Navigation3DModel.IsUseSmooth = config.IsManualUseSmooth;
//SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
//Navigation3DManager.Navigation3DModel.IsUseSmooth = config.IsManualUseSmooth;
// 注册WPF渲染事件,用于处理3D鼠标
CompositionTarget.Rendering -= CompositionTarget_Rendering;
CompositionTarget.Rendering += CompositionTarget_Rendering;
//CompositionTarget.Rendering -= CompositionTarget_Rendering;
//CompositionTarget.Rendering += CompositionTarget_Rendering;
}
/// <summary>
......@@ -81,14 +81,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>
/// 手动模式更新裁切框
......@@ -106,21 +106,26 @@ namespace VIZ.H2V.Module
return;
}
double p = (renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) / (2 * Navigation3DManager.Navigation3DModel.MaxX);
//double p = (renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) / (2 * Navigation3DManager.Navigation3DModel.MaxX);
////////////////////////////////////////////////////////////////////////
// DEBUG
//double test_1 = this.clipBoxX ?? 0;
////////////////////////////////////////////////////////////////////////
double diff = Navigation3DManager.UpdateRenderTime();
Navigation3DManager.Navigation3DModel.UpdateSmooth(diff / 5d);
//double diff = Navigation3DManager.UpdateRenderTime();
//Navigation3DManager.Navigation3DModel.UpdateSmooth(diff / 5d);
if (this.ClipBoxX == null)
{
this.ClipBoxX = renderInfo.Frame.Width / 2d - this.CLIP_BOX_WIDTH / 2d;
}
//if (this.ClipBoxX == null)
//{
// 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);
int x = (int)(this.ClipBoxX + Navigation3DTcpManager.MappingValue);
x = x <= 0 ? 0 : x;
x = x >= (renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) ? (int)(renderInfo.Frame.Width - this.CLIP_BOX_WIDTH) : x;
this.ClipBoxX = x;
ClipBoxInfo clipBox = new ClipBoxInfo();
clipBox.DrawingBorderWidth = this.CLIP_BOX_BORDER_WIDTH;
......@@ -129,13 +134,6 @@ 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>
......@@ -152,7 +150,8 @@ namespace VIZ.H2V.Module
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip && Navigation3DManager.Navigation3DModel.IsReady)
//if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip && Navigation3DManager.Navigation3DModel.IsReady)
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
}
......@@ -173,7 +172,7 @@ namespace VIZ.H2V.Module
UdpEndpointManager manager_clip = ConnectionManager.UdpConnection.GetEndpointManager($"{this.ViewKey}__CLIP");
if (manager_clip != null)
{
ClipSender.CropRoi(manager_clip, 0, this.GetManulRoi(), (int)CLIP_BOX_WIDTH, e.Frame.Height);
ClipSender.CropRoi(manager_clip, 0, this.GetManulRoi(), (int)CLIP_BOX_WIDTH, e.Frame.Height, e.Frame.TimeStamp);
}
}
}
......
......@@ -250,7 +250,7 @@ namespace VIZ.H2V.Module
#region ClipBoxX -- 裁切框X坐标
private double? clipBoxX;
private double? clipBoxX = 555;
/// <summary>
/// 裁切框X坐标
/// </summary>
......
......@@ -122,7 +122,7 @@ namespace VIZ.H2V.Module
this.WriteLogOperation();
// 停止3D鼠标更新
Navigation3DManager.Navigation3DModel.IsReady = false;
//Navigation3DManager.Navigation3DModel.IsReady = false;
// ----------------------------------------------------------------------------------------------
// Step 1. 更新属性 & 缓存
......@@ -204,7 +204,7 @@ namespace VIZ.H2V.Module
finally
{
// 启动3D鼠标更新
Navigation3DManager.Navigation3DModel.IsReady = true;
//Navigation3DManager.Navigation3DModel.IsReady = true;
}
}
......
......@@ -37,6 +37,7 @@ namespace VIZ.H2V.Module
string algorithm_strategy_path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config", "algorithm_strategy.csv");
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");
string navigation_3d_mapping_path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config", "navigation_3d_mapping.csv");
// CSV配置
......@@ -44,6 +45,7 @@ namespace VIZ.H2V.Module
ApplicationDomainEx.CsvContext.LoadAlgorithmStrategys(algorithm_strategy_path);
ApplicationDomainEx.CsvContext.LoadAlgorithmBorderScenes(algorithm_border_scence_path);
ApplicationDomainEx.CsvContext.LoadClipSystems(clip_system_path);
ApplicationDomainEx.CsvContext.LoadNavigation3DMappings(navigation_3d_mapping_path);
// 操作日志
ApplicationDomainEx.CsvContext.OpenLogOperations();
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
using VIZ.Framework.Connection;
using VIZ.Framework.Storage;
using System.Windows.Media;
using VIZ.Framework.Module;
using System.Net.Sockets;
using VIZ.H2V.Domain;
namespace VIZ.H2V.Module
{
/// <summary>
/// 应用程序启动 -- 3D鼠标_TCP数据
/// </summary>
public class AppSetup_Navigation3D_TCP : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_Navigation3D_TCP));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 3D鼠标_TCP数据";
/// <summary>
/// 3D 鼠标TCP监听地址
/// </summary>
public static readonly string APPLICATION_3D_MOUSE_TCP_IP = ApplicationDomain.IniStorage.GetValue<ApplicationConfig, string>(p => p.APPLICATION_3D_MOUSE_TCP_IP);
/// <summary>
/// 3D 鼠标TCP监听端口
/// </summary>
public static readonly int APPLICATION_3D_MOUSE_TCP_PORT = ApplicationDomain.IniStorage.GetValue<ApplicationConfig, int>(p => p.APPLICATION_3D_MOUSE_TCP_PORT);
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
Navigation3DTcpListener listener = new Navigation3DTcpListener(APPLICATION_3D_MOUSE_TCP_IP, APPLICATION_3D_MOUSE_TCP_PORT, ApplicationDomainEx.CsvContext.Navigation3DMappings);
ConnectionManager.TcpConnectionListeners[Navigation3DTcpListener.LISTENER_KEY] = listener;
listener.Start();
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
ConnectionManager.TcpConnectionListeners[Navigation3DTcpListener.LISTENER_KEY].Dispose();
}
}
}
......@@ -180,7 +180,7 @@ namespace VIZ.H2V.Module
// 应用
ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>().ForEach(p => p.LoadStyle());
Navigation3DManager.Navigation3DModel.IsUseSmooth = this.IsManualUseSmooth;
//Navigation3DManager.Navigation3DModel.IsUseSmooth = this.IsManualUseSmooth;
// 返回
return true;
......
......@@ -217,6 +217,7 @@
<Compile Include="NDIView\VieweModel\NDIViewModel.cs" />
<Compile Include="Setup\Provider\AppSetup_Algorithm.cs" />
<Compile Include="Setup\Provider\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\AppSetup_Navigation3D_TCP.cs" />
<Compile Include="SystemSetting\ViewModel\HotkeySettingPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\AboutPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\ISystemSetting.cs" />
......
......@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using CsvHelper;
using CsvHelper.Configuration;
using VIZ.Framework.Core;
using VIZ.Framework.Storage;
namespace VIZ.H2V.Storage
......@@ -36,6 +37,12 @@ namespace VIZ.H2V.Storage
public List<ClipSystem> ClipSystems { get; private set; }
/// <summary>
/// 3D鼠标映射
/// </summary>
[Csv(Scene = CsvScene.Read)]
public List<Navigation3DMapping> Navigation3DMappings { get; private set; }
/// <summary>
/// 操作日志
/// </summary>
[Csv(Scene = CsvScene.Write)]
......@@ -80,6 +87,19 @@ namespace VIZ.H2V.Storage
}
}
/// <summary>
/// 加载3D鼠标映射
/// </summary>
/// <param name="path">文件路径</param>
public void LoadNavigation3DMappings(string path)
{
using (StreamReader sr = new StreamReader(path, Encoding.Default))
using (CsvReader reader = new CsvReader(sr, CultureInfo.InvariantCulture))
{
this.Navigation3DMappings = reader.GetRecords<Navigation3DMapping>()?.ToList();
}
}
// ====================================================================================
// 操作日志
......
......@@ -63,6 +63,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.H2V.Common", "VIZ.H2V.C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Framework.MacTool", "..\VIZ.Framework\VIZ.Framework.MacTool\VIZ.Framework.MacTool.csproj", "{6B864E7B-164B-4B1E-B7D6-1563D824F567}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.H2V.ClipTestTool", "VIZ.H2V.ClipTestTool\VIZ.H2V.ClipTestTool.csproj", "{16CDC661-A7D8-49DA-A269-0F9F4E798977}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -223,6 +225,14 @@ Global
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|Any CPU.Build.0 = Release|Any CPU
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|x64.ActiveCfg = Release|x64
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|x64.Build.0 = Release|x64
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x64.ActiveCfg = Debug|x64
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x64.Build.0 = Debug|x64
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|Any CPU.Build.0 = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x64.ActiveCfg = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -247,6 +257,7 @@ Global
{8FC38D2A-D2E5-44D0-86E4-7136A6D19F2E} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
{750ECE65-60DD-425A-B1D3-68E5158B6E9B} = {CB121805-63D4-4D8E-9F37-2C3CDE7733D1}
{6B864E7B-164B-4B1E-B7D6-1563D824F567} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
{16CDC661-A7D8-49DA-A269-0F9F4E798977} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {665C67CB-147B-44CB-B16D-EA1246EC8333}
......
......@@ -20,8 +20,6 @@ namespace VIZ.H2V
{
public App()
{
// 初始化3D鼠标
AppSetup.AppendSetup(new AppSetup_Navigation3D());
// 初始化LiteDB
AppSetup.AppendSetup(new AppSetup_InitLiteDb());
// 初始化CSV
......@@ -32,7 +30,8 @@ namespace VIZ.H2V
AppSetup.AppendSetup(new AppSetup_Algorithm());
// 初始化UDP
AppSetup.AppendSetup(new AppSetup_InitUDP());
// 初始化3D鼠标
AppSetup.AppendSetup(new AppSetup_Navigation3D_TCP());
// 初始化系统监控
AppSetup.AppendLoad(new AppSetup_Monitor());
......
......@@ -152,6 +152,9 @@
<None Include="config\algorithm_strategy.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\navigation_3d_mapping.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\clip_system.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
......@@ -4,6 +4,12 @@
[Application]
;是否是调试模式
APPLICATION_IS_DEBUG=true
;3D鼠标平滑系数
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT=0.015
;3D鼠标TCP监听IP
APPLICATION_3D_MOUSE_TCP_IP=127.0.0.1
;3D鼠标TCP监听端口
APPLICATION_3D_MOUSE_TCP_PORT=8201
; ============================================================
; === Video ===
; ============================================================
......
ID,MinValue,MaxValue,MappingValue
1,50,200,1
2,200,400,2
3,400,600,3
4,600,800,5
5,800,1000,7
6,1000,1200,10
7,1200,1400,13
8,1400,1600,17
9,1800,2000,21
10,2000,2200,26
12,2200,2400,31
13,2400,9000,37
\ No newline at end of file
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