migrate
This commit is contained in:
parent
1065c86824
commit
b68c5618ae
@ -13,6 +13,15 @@ using Hi.Geom;
|
|||||||
namespace Hi.Wpf.Disp
|
namespace Hi.Wpf.Disp
|
||||||
{
|
{
|
||||||
#region WPF Rendering Canvas
|
#region WPF Rendering Canvas
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a WPF rendering canvas for 3D visualization of HiAPI components.
|
||||||
|
/// Handles user interactions, rendering, and integration with the DispEngine system.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This canvas provides the core rendering capabilities for WPF applications using HiAPI.
|
||||||
|
/// It manages mouse, keyboard, and touch events, and transforms them into appropriate
|
||||||
|
/// actions in the 3D environment.
|
||||||
|
/// </remarks>
|
||||||
public class RenderingCanvas : UserControl, IDisposable
|
public class RenderingCanvas : UserControl, IDisposable
|
||||||
{
|
{
|
||||||
#region Core_Properties
|
#region Core_Properties
|
||||||
|
@ -11,6 +11,9 @@ namespace Hi.Wpf.Disp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RenderingWindow : Window, IGetDispEngine
|
public class RenderingWindow : Window, IGetDispEngine
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the rendering canvas control used for displaying 3D content.
|
||||||
|
/// </summary>
|
||||||
public RenderingCanvas RenderingCanvas => Content as RenderingCanvas;
|
public RenderingCanvas RenderingCanvas => Content as RenderingCanvas;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -35,29 +38,19 @@ namespace Hi.Wpf.Disp
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public DispEngine GetDispEngine() => RenderingCanvas.DispEngine;
|
public DispEngine GetDispEngine() => RenderingCanvas.DispEngine;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run a simple <see cref="RenderingWindow"/> application with given <paramref name="displayees"/>.
|
/// Gets or sets the current displayable 3D object.
|
||||||
|
/// When setting a new displayee, the view will be reset to home position if no previous displayee was set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title">Title</param>
|
public IDisplayee Displayee
|
||||||
/// <param name="displayees">displayees</param>
|
|
||||||
/// <returns>return value of <see cref="Application"/>.<see cref="Application.Run(Window)"/></returns>
|
|
||||||
public static int RunApplication(string title, params IDisplayee[] displayees)
|
|
||||||
{
|
{
|
||||||
License.LogInAll();
|
get => GetDispEngine().Displayee;
|
||||||
DispEngine.Init();
|
set
|
||||||
|
|
||||||
Application app = new Application
|
|
||||||
{
|
{
|
||||||
ShutdownMode = ShutdownMode.OnMainWindowClose
|
var preDisplayee = GetDispEngine().Displayee;
|
||||||
};
|
GetDispEngine().Displayee = value;
|
||||||
app.Exit += (o, e) =>
|
if (preDisplayee == null)
|
||||||
{
|
RenderingCanvas.DispEngine.SetViewToHomeView();
|
||||||
DispEngine.FinishDisp();
|
}
|
||||||
License.LogOutAll();
|
|
||||||
};
|
|
||||||
RenderingWindow window = new RenderingWindow() { Title = title };
|
|
||||||
window.RenderingCanvas.DispEngine.Displayee = new DispList(displayees);
|
|
||||||
window.RenderingCanvas.DispEngine.SetViewToHomeView();
|
|
||||||
return app.Run(window);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,18 @@
|
|||||||
HiAPI samples for windows platform.
|
HiAPI samples for windows platform.
|
||||||
</Description>
|
</Description>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<VersionBuild>3</VersionBuild>
|
<VersionBuild>15</VersionBuild>
|
||||||
<VersionPrefix>1.4.$(VersionBuild)</VersionPrefix>
|
<VersionPrefix>1.4.$(VersionBuild)</VersionPrefix>
|
||||||
|
<PackageTags>HiAPI</PackageTags>
|
||||||
|
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||||
<Product>$(AssemblyName)</Product>
|
<Product>$(AssemblyName)</Product>
|
||||||
<ApplicationIcon>techcoordinate.ico</ApplicationIcon>
|
<ApplicationIcon>techcoordinate.ico</ApplicationIcon>
|
||||||
<Copyright>Copyright 2022 Tech Coordinate Co., Ltd.</Copyright>
|
<Copyright>Copyright 2025 Tech Coordinate Co., Ltd.</Copyright>
|
||||||
<Company>Tech Coordinate Co., Ltd.</Company>
|
<Company>Tech Coordinate Co., Ltd.</Company>
|
||||||
<Authors>Tech Coordinate Co., Ltd.</Authors>
|
<Authors>Tech Coordinate Co., Ltd.</Authors>
|
||||||
<OutputPath>bin\$(Platform).$(Configuration)\</OutputPath>
|
|
||||||
<StartupObject>Hi.Wpf.Program</StartupObject>
|
<StartupObject>Hi.Wpf.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<Import Project="..\acc\common_info.props" />
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<ProjectReference Include="..\HiDisp\HiDisp.csproj" />
|
<ProjectReference Include="..\HiDisp\HiDisp.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -37,4 +39,5 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<Import Project="..\acc\deploy_local_nupkg.targets" Condition="'$(Configuration)'=='Release'" />
|
||||||
</Project>
|
</Project>
|
21
Program.cs
21
Program.cs
@ -1,19 +1,36 @@
|
|||||||
using Hi.Disp;
|
using Hi.Disp;
|
||||||
using Hi.Disp.Flag;
|
using Hi.Disp.Flag;
|
||||||
using Hi.Geom;
|
using Hi.Geom;
|
||||||
|
using Hi.Licenses;
|
||||||
using Hi.Wpf.Disp;
|
using Hi.Wpf.Disp;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace Hi.Wpf
|
namespace Hi.Wpf
|
||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
|
License.LogInAll();
|
||||||
DispEngine.Init();
|
DispEngine.Init();
|
||||||
RenderingWindow.RunApplication("test",
|
|
||||||
|
Application app = new Application
|
||||||
|
{
|
||||||
|
ShutdownMode = ShutdownMode.OnMainWindowClose
|
||||||
|
};
|
||||||
|
app.Exit += (o, e) =>
|
||||||
|
{
|
||||||
|
DispEngine.FinishDisp();
|
||||||
|
License.LogOutAll();
|
||||||
|
Console.WriteLine($"App exit.");
|
||||||
|
};
|
||||||
|
RenderingWindow window = new RenderingWindow() { Title = "Demo WPF RenderingCanvas" };
|
||||||
|
window.RenderingCanvas.DispEngine.Displayee = new DispList(
|
||||||
new CoordinateDrawing(), new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
|
new CoordinateDrawing(), new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
|
||||||
|
window.RenderingCanvas.DispEngine.SetViewToHomeView();
|
||||||
|
return app.Run(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user