You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.9 KiB
C#
104 lines
3.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MeshProcessInterfaceCS
|
|
{
|
|
/// <summary>
|
|
/// The mesh editor.
|
|
/// </summary>
|
|
public class MeshEditor
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the xy.
|
|
/// </summary>
|
|
public IntPtr Xy { get; set; } = IntPtr.Zero;
|
|
/// <summary>
|
|
/// 初始化场景
|
|
/// </summary>
|
|
/// <param name="hwnd"></param>
|
|
/// <param name="imagePath"></param>
|
|
public void InitView(IntPtr hwnd, string imagePath)
|
|
{
|
|
Editor_InitView(hwnd, imagePath);
|
|
}
|
|
public void FreeAll()
|
|
{
|
|
Editor_FreeAll();
|
|
}
|
|
/// <summary>
|
|
/// 绘制一帧
|
|
/// </summary>
|
|
public void RenderView()
|
|
{
|
|
Editor_RenderView();
|
|
}
|
|
/// <summary>
|
|
/// 场景居中
|
|
/// </summary>
|
|
public void ZoomView()
|
|
{
|
|
Editor_ZoomView();
|
|
}
|
|
/// <summary>
|
|
/// 创建网格.
|
|
/// </summary>
|
|
/// <returns>An int.</returns>
|
|
public int CreateMesh(string contourLayer, string faultLayer)
|
|
{
|
|
return Editor_CreateMesh(this.Xy, contourLayer, faultLayer);
|
|
}
|
|
public void StrechUp(int ipx, int ipy, float rad, float per, int type)
|
|
{
|
|
Editor_StrechUp(ipx, ipy, rad, per, type);
|
|
}
|
|
public void StrechDown(int ipx, int ipy, float rad, float per, int type)
|
|
{
|
|
Editor_StrechDown(ipx, ipy, rad, per, type);
|
|
}
|
|
public void StartCommand()
|
|
{
|
|
Editor_StartCommand();
|
|
}
|
|
public void EndCommand()
|
|
{
|
|
Editor_EndCommand();
|
|
}
|
|
#if DEBUG
|
|
/// <summary>
|
|
/// 动态库文件路径.
|
|
/// </summary>
|
|
const string PROCESSLIB = "MeshProcessInterfaceCPP.dll";
|
|
#else
|
|
const string PROCESSLIB = "MeshProcessInterfaceCPP.dll";
|
|
#endif
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_InitView", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_InitView(IntPtr p, string imgPath);
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_FreeAll", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_FreeAll();
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_RenderView", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_RenderView();
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_RenderView", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_ZoomView();
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_CreateMesh", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int Editor_CreateMesh(IntPtr pXy, string contourLayer, string faultLayer);
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_StartCommand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_StartCommand();
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_EndCommand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_EndCommand();
|
|
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_StrechUp", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_StrechUp(int ipx, int ipy, float rad, float per, int type);
|
|
[DllImport(PROCESSLIB, EntryPoint = "Editor_StrechDown", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void Editor_StrechDown(int ipx, int ipy, float rad, float per, int type);
|
|
}
|
|
}
|