using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace MeshProcessInterfaceCS { /// /// The mesh editor. /// public class MeshEditor { /// /// Gets or sets the xy. /// public IntPtr Xy { get; set; } = IntPtr.Zero; /// /// 初始化场景 /// /// /// public void InitView(IntPtr hwnd, string imagePath) { Editor_InitView(hwnd, imagePath); } public void FreeAll() { Editor_FreeAll(); } /// /// 绘制一帧 /// public void RenderView() { Editor_RenderView(); } /// /// 场景居中 /// public void ZoomView() { Editor_ZoomView(); } /// /// 创建网格. /// /// An int. 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 /// /// 动态库文件路径. /// 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); } }