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.

913 lines
41 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeoSigmaViewer
{
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct Point2D
{
public string pointName;
public double x;
public double y;
public double angle;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct MouseMoveResult
{
//当选中图元后,显示出tracker.tracker有九个控制点.如下图:
// HandleTopLeft HandleTop HandleTopRight
// 0 1 2
// *-----------*-----------*
// | |
// | |
// HandleLeft 7 * * 8 * 3 HandleRight
// | HandleCenter |
// | |
// *-----------*-----------*
// 6 5 4
// HandleBottomLeft HandleBottom HandleBottomRight
public int handleKind;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct ProportionData
{
public double x;
public double y;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct RectangularCSGridData
{
public int showMode; //曲线=0 交点=1 空=2
public double stepX; //网格步长
public double stepY; //网格步长
public int gridColorR;
public int gridColorG;
public int gridColorB;
public int textHeight;
public int textScale; //地理 = 0, 数学=1, 地理1=2, 地理2全部=3
public int notatioinMode; //所有边=0, 左边上边=1,上边右边=2,右边下边=3,下边左边=4
public double baseX; //基数x
public double baseY; //基数y
public double coefficientX; //系数x
public double coefficientY; //系数y
public double left; //坐标范围左
public double top; //坐标范围上
public double right; //坐标范围右
public double bottom; //坐标范围底
public int isShowOutBorder; //是否显示外边框
public int borderThickness; //边框厚度
public int blackOutterBorder; //是否显示为黑边框
public int borderColorR;
public int borderColorG;
public int borderColorB;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct TextInformation
{
public string text;
public double textHeight;
public double textWidth;
public double angle;
public int bUpDown; //是否按上下角标方式显示
public int r;
public int g;
public int b;
}
public class GeoSigma : IDisposable
{
IntPtr pView = IntPtr.Zero;
public GeoSigma()
{
pView = GeoSigmaLib.CreateView();
}
public GeoSigma(IntPtr hMemDC, int left, int top, int right, int bottom)
{
pView = GeoSigmaLib.CreateViewWithDC(hMemDC, left, top, right, bottom);
}
public bool OpenDocument(string fileName)
{
return GeoSigmaLib.OpenDocument(pView, fileName, false);
}
public bool Initialize(IntPtr hMemDC, int x, int y, int width, int height)
{
GeoSigmaLib.Initialize(pView, hMemDC, x, y, width, height);
return true;
}
//public bool Redraw()
//{
// return GeoSigmaLib.Redraw(pView);
//}
public bool DrawMem()
{
return GeoSigmaLib.DrawMem(pView);
}
public bool DrawDC()
{
return GeoSigmaLib.DrawDC(pView);
}
public void SetDC(IntPtr hMemDC, int left, int top, int right, int bottom)
{
GeoSigmaLib.SetDC(pView, hMemDC, left, top, right, bottom);
}
public IntPtr GetDC()
{
return GeoSigmaLib.GetDC(pView);
}
public void EnableRedraw(bool enable)
{
GeoSigmaLib.EnableRedraw(pView, enable);
}
public void SetHWND(IntPtr hwnd)
{
GeoSigmaLib.SetHWND(pView, hwnd);
}
public void GetMapRange(ref double left, ref double top, ref double right, ref double bottom)
{
GeoSigmaLib.GetMapRange(pView, ref left, ref top, ref right, ref bottom);
}
public void GetScreenReal(int leftS, int topS, int rightS, int bottomS, ref double left, ref double top, ref double right, ref double bottom)
{
GeoSigmaLib.GetScreenReal(pView, leftS, topS, rightS, bottomS, ref left, ref top, ref right, ref bottom);
}
public void GetRealScreen(double leftS, double topS, double rightS, double bottomS, ref int left, ref int top, ref int right, ref int bottom)
{
GeoSigmaLib.GetRealScreen(pView, leftS, topS, rightS, bottomS, ref left, ref top, ref right, ref bottom);
}
public double GetRealHeight(int height)
{
return GeoSigmaLib.GetRealHeight(pView, height);
}
public double GetRealWidth(int width)
{
return GeoSigmaLib.GetRealWidth(pView, width);
}
public int GetScreenHeight(double height)
{
return GeoSigmaLib.GetScreenHeight(pView, height);
}
public int GetScreenWidth(double width)
{
return GeoSigmaLib.GetScreenWidth(pView, width);
}
public void SetScrollBar(ref int hMax, ref int vMax, ref int hPage, ref int vPage, ref int hPos, ref int vPos)
{
GeoSigmaLib.SetScrollBar(pView, ref hMax, ref vMax, ref hPage, ref vPage, ref hPos, ref vPos);
}
public void HScroll( int nSBCode, int nPos, int nScrollMax)
{
GeoSigmaLib.HScroll(pView, nSBCode, nPos, nScrollMax);
}
public void Scroll(int orientation, double offset)
{
GeoSigmaLib.Scroll(pView, orientation, offset);
}
public int GetElementCount()
{
return GeoSigmaLib.GetElementCount(pView);
}
public void ViewEnlarge()
{
GeoSigmaLib.ViewEnlarge(pView);
}
public void ViewReduce()
{
GeoSigmaLib.ViewReduce(pView);
}
public void ViewAll()
{
GeoSigmaLib.ViewExtend(pView);
}
public void SetViewPan()
{
GeoSigmaLib.SetViewPan(pView);
}
public void SetViewWindow()
{
GeoSigmaLib.SetViewWindow(pView);
}
public void SetItem(int itemType)
{
GeoSigmaLib.SetItem(pView, itemType);
}
protected virtual void Dispose(bool disposing)
{
if (pView != null)
{
GeoSigmaLib.DestroyView(pView);
pView = IntPtr.Zero;
}
GC.SuppressFinalize(this);
}
#region 图层管理
public string GetLayers()
{
if (pView==null)
{
return null;
}
int nDesLen = GeoSigmaLib.GetLayersLength(pView);
if (nDesLen<=0) return null;
byte[] btDest = new byte[nDesLen];
GeoSigmaLib.GetLayers(pView, btDest, nDesLen);
string strOut = System.Text.Encoding.Default.GetString(btDest);
return strOut;
}
public string GetCurrentLayer()
{
StringBuilder strLayer=new StringBuilder();
if (pView==null)
{
return null;
}
//Marshal.PtrToStringAuto(strLayer) ;
byte[] byteOutput = new byte[1024];
int nLen = GeoSigmaLib.GetCurrentLayer(pView, byteOutput);
return System.Text.Encoding.Default.GetString(byteOutput, 0, nLen);
}
public void SetCurrentLayer(string layerName)
{
GeoSigmaLib.SetCurrentLayer(pView, layerName);
}
public void SetLayerState(string layerName, LayerStatus status)
{
GeoSigmaLib.SetLayerState(pView, layerName, (int)status);
}
public void FindAddLayer(string layerName, bool doActive)
{
GeoSigmaLib.FindAddLayer(pView, layerName, doActive);
}
public void DeleteLayer(string[] layers)
{
GeoSigmaLib.DeleteLayer(pView, layers, layers.Length);
}
public bool GetLayerStyleData(string layerName, ref string curveStyle, ref string pointStyle)
{
long pCurve = 0, pPoint = 0;
int nCurveLen = 0, nPointLen = 0;
bool bSuccess = GeoSigmaLib.GetLayerStyleData(pView, layerName, ref pCurve, ref nCurveLen, ref pPoint, ref nPointLen);
if (bSuccess!=true) return false;
if (nCurveLen==0)
{
curveStyle="";
}
else
{
byte[] btCurve = new byte[nCurveLen];
Marshal.Copy((IntPtr)pCurve, btCurve, 0, nCurveLen);
curveStyle=System.Text.Encoding.Default.GetString(btCurve);
}
if (nPointLen==0)
{
pointStyle="";
}
else
{
byte[] btPoint = new byte[nPointLen];
Marshal.Copy((IntPtr)pPoint, btPoint, 0, nPointLen);
pointStyle=System.Text.Encoding.Default.GetString(btPoint);
}
return true;
}
public bool RemoveCurveStyle(string layerName, int index)
{
bool bSuccess = GeoSigmaLib.RemoveCurveStyle(pView, layerName, index);
return bSuccess;
}
public bool RemovePointStyle(string layerName)
{
bool bSuccess = GeoSigmaLib.RemovePointStyle(pView, layerName);
return bSuccess;
}
public bool SetLayerHowtoViewPoint(string layerName, string data)
{
IntPtr pBuff = Marshal.StringToHGlobalAnsi(data);
int nLen = Encoding.Default.GetByteCount(data);
//textBox2.Text=Marshal.PtrToStringAnsi(outit);
bool bSuccess = GeoSigmaLib.SetLayerHowtoViewPoint(pView, layerName, pBuff, nLen);
Marshal.FreeHGlobal(pBuff);
return bSuccess;
}
public bool SetLayerHowtoViewCurve(string layerName, string data, int index)
{
IntPtr pBuff = Marshal.StringToHGlobalAnsi(data);
int nLen = Encoding.Default.GetByteCount(data);
bool bSuccess = GeoSigmaLib.SetLayerHowtoViewCurve(pView, layerName, pBuff, nLen, index);
Marshal.FreeHGlobal(pBuff);
return bSuccess;
}
#endregion 图层管理
// Implement IDisposable.
// Do not make this method virtual.
// A derived class should not be able to override this method.
public void Dispose()
{
Dispose(true);
}
public int GetPoint2DFromItem(out Point2D ptOut)
{
if (pView == null)
{
ptOut.pointName = null;
ptOut.x = ptOut.y = ptOut.angle = 0;
return 0;
}
GeoSigmaLib.GetPoint2DFromItem(pView, out ptOut);
return 1;
}
public void CancelDisplayPointInItem()
{
if (pView != null)
{
GeoSigmaLib.CancelDisplayPointInItem(pView);
}
}
public void ChangePointAddedMode(int mode)
{
if (pView == null)
return;
GeoSigmaLib.ChangePointAddedMode(pView, mode);
}
public int AddPoint2DToDoc(ref Point2D pt)
{
if (pView == null)
return 0;
return GeoSigmaLib.AddPoint2DToDoc(pView, ref pt);
}
public int AddPointNameToItem(string pointName)
{
if (pView == null)
return 0;
return GeoSigmaLib.AddPointNameToItem(pView, pointName);
}
public int ChangeAnglgeToItem(double angle)
{
if (pView == null)
return 0;
return GeoSigmaLib.ChangeAnglgeToItem(pView, angle);
}
#region 鼠标事件
public void OnLButtonDown(int mouseX, int mouseY)
{
if (pView!=null)
GeoSigmaLib.OnLButtonDown(pView, mouseX, mouseY);
}
public void OnLButtonUp(int mouseX, int mouseY)
{
if (pView!=null)
GeoSigmaLib.OnLButtonUp(pView, mouseX, mouseY);
}
public void ItemMouseMove(IntPtr hMemDC, int mouseX, int mouseY, ref MouseMoveResult mmResult)
{
if (pView != null)
GeoSigmaLib.ItemMouseMove(pView, hMemDC, mouseX, mouseY, ref mmResult);
}
public void MouseSelect(int mouseX, int mouseY)
{
if (pView!=null)
{
GeoSigmaLib.MouseSelect(pView, mouseX, mouseY);
}
}
public void ViewMouseDown(int mouseX, int mouseY)
{
if (pView!=null)
{
GeoSigmaLib.ViewMouseDown(pView, mouseX, mouseY);
}
}
public void ViewMouseMove(IntPtr hMemDC, int mouseX, int mouseY)
{
if (pView!=null)
{
GeoSigmaLib.ViewMouseMove(pView, hMemDC, mouseX, mouseY);
}
}
public void ViewMouseUp(int mouseX, int mouseY)
{
if (pView!=null)
{
GeoSigmaLib.ViewMouseUp(pView, mouseX, mouseY);
}
}
#endregion 鼠标事件
#region 绘制曲线接口
public int EndCurve()
{
if (pView == null)
return -10;
return GeoSigmaLib.EndCurve(pView);
}
public int CancelCurve()
{
if (pView == null)
return -10;
return GeoSigmaLib.CancelCurve(pView);
}
public int AutoCloseCurve()
{
if (pView == null)
return -10;
return GeoSigmaLib.AutoCloseCurve(pView);
}
public int ChangeCurveMergeState()
{
if (pView == null)
return -10;
return GeoSigmaLib.ChangeCurveMergeState(pView);
}
public int DrawNextCurve()
{
if (pView == null)
return -10;
return GeoSigmaLib.DrawNextCurve(pView);
}
#endregion 绘制曲线接口
//0--左下箭头 1--垂直箭头 2--右下箭头 3--水平箭头
//4--旋转箭头 5--水平剪切箭头 6--垂直剪切箭头 7--平移箭头
//-1 出错
public int GetTrackerHandleCursorType(int mouseX, int mouseY)
{
if (pView == null)
return -1;
return GeoSigmaLib.GetTrackerHandleCursorType(pView, mouseX, mouseY);
}
#region 比例尺
public int CreateProportion()
{
if (pView == null)
return -1;
return GeoSigmaLib.CreateProportion(pView);
}
public int Proportion_ChangeScaleLength(int length)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeScaleLength(pView, length);
}
public int Proportion_ChangeNumber(int number)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeNumber(pView, number);
}
//mode 0--普通式 1--现代式 2--流行式
public int Proportion_ChangeShowMode(int mode)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeShowMode(pView, mode);
}
public int Proportion_ChangeUnit(int unit)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeUnit(pView, unit);
}
public int Proportion_ChangeColor(int r, int g, int b)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeColor(pView, r, g, b); ;
}
public int Proportion_ChangeTextScale(int scale)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeTextScale(pView, scale);
}
public int Proportion_ChangeAlign(int align)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeAlign(pView, align);
}
public int Proportion_ChangeTextHeight(int height)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeTextHeight(pView, height);
}
public int Proportion_ChangeTextWidth(int width)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeTextWidth(pView, width);
}
public int Proportion_ChangeTextHeightAlone(int alone)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeTextHeightAlone(pView, alone);
}
public int Proportion_ChangeCoordinate(double x, double y)
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_ChangeCoordinate(pView, x, y);
}
public int Proportion_Create()
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_Create(pView);
}
public int Proportion_GetScale()
{
if (pView == null)
return -1;
return GeoSigmaLib.Proportion_GetScale(pView);
}
public int Proportion_GetData(ref ProportionData data)
{
return GeoSigmaLib.Proportion_GetData(pView, ref data);
}
#endregion
#region 直角网
public int RectangularCSGrid_Create(ref RectangularCSGridData data)
{
if (pView == null)
return -1;
return GeoSigmaLib.RectangularCSGrid_Create(pView, ref data);
}
public int RectangularCSGrid_GetStepAndRange(ref RectangularCSGridData data)
{
if (pView == null)
return -1;
return GeoSigmaLib.RectangularCSGrid_GetStepAndRange(pView, ref data);
}
#endregion
#region 画圆弧
//type:0--圆弧 1--弦 2--扇形
public int Arc_SetType(int type)
{
if (pView == null)
return -1;
return GeoSigmaLib.Arc_SetType(pView, type);
}
#endregion
#region 绘制文本
public int Text_SetTextInfo(ref TextInformation info)
{
if (pView == null)
return -1;
return GeoSigmaLib.Text_SetTextInfo(pView, ref info);
}
public int Text_SetFont(ref SigmaDrawerStyle.LogFont logFont)
{
if (pView == null)
return -1;
return GeoSigmaLib.Text_SetFont(pView, ref logFont);
}
public int Text_Create()
{
if (pView == null)
return -1;
return GeoSigmaLib.Text_Create(pView);
}
#endregion
#region 曲线打断
public int BreakCurve_IsBreaked()
{
if (pView == null)
return -1;
return GeoSigmaLib.BreakCurve_IsBreaked(pView);
}
public int BreakCurve_GetSelectCount()
{
if (pView == null)
return -1;
return GeoSigmaLib.BreakCurve_GetSelectCount(pView);
}
#endregion
#region 删除
public int Delete_SetType(int type)
{
if (pView == null)
return -1;
return GeoSigmaLib.Delete_SetType(pView, type);
}
public int Delete_GetCountSelected()
{
if (pView == null)
return -1;
return GeoSigmaLib.Delete_GetCountSelected(pView);
}
public int Delete_ClearCountSelected()
{
if (pView == null)
return -1;
return GeoSigmaLib.Delete_ClearCountSelected(pView);
}
#endregion
~GeoSigma()
{
Dispose();
}
}
public class GeoSigmaLib
{
//const string DRAWLIB = "DrawLib.dll";
#if DEBUG
//const string DRAWLIB = "DrawLibD.dll";
const string SIGMALIB = "GeoSigmaDraw.dll";
#else
//const string DRAWLIB = "DrawLib.dll";
const string SIGMALIB = "GeoSigmaDraw.dll";
#endif
////////////////////////////////////////////////////////////
[DllImport(SIGMALIB, EntryPoint = "TestFunSigma", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int TestFunSigma(string strInput);
[DllImport(SIGMALIB, EntryPoint = "CreateView", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CreateView();
[DllImport(SIGMALIB, EntryPoint = "CreateViewWithDC", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr CreateViewWithDC(IntPtr hMemDC,int left, int top, int right, int bottom);
[DllImport(SIGMALIB, EntryPoint = "GetViewDC", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GetDC(IntPtr viewAddress);
[DllImport(SIGMALIB, EntryPoint = "SetViewDC", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetDC(IntPtr viewAddress, IntPtr hMemDC,int left, int top, int right, int bottom);
[DllImport(SIGMALIB, EntryPoint = "Initialize", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void Initialize(IntPtr viewAddress,IntPtr hMemDC, int x, int y, int width, int height);
[DllImport(SIGMALIB, EntryPoint = "EnableRedraw", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void EnableRedraw(IntPtr viewAddress,bool enable);
[DllImport(SIGMALIB, EntryPoint = "SetHWND", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetHWND(IntPtr viewAddress, IntPtr hwnd);
[DllImport(SIGMALIB, EntryPoint = "DestroyView", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool DestroyView(IntPtr viewAddress);
//[DllImport(SIGMALIB, EntryPoint = "Redraw", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
//public static extern bool Redraw(IntPtr viewAddress);
[DllImport(SIGMALIB, EntryPoint = "DrawMem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool DrawMem(IntPtr viewAddress);
[DllImport(SIGMALIB, EntryPoint = "DrawDC", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool DrawDC(IntPtr viewAddress);
[DllImport(SIGMALIB, EntryPoint = "GetMapRange", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void GetMapRange(IntPtr viewAddress, ref double left, ref double top, ref double right, ref double bottom);
[DllImport(SIGMALIB, EntryPoint = "GetScreenReal", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void GetScreenReal(IntPtr pView, int leftS, int topS, int rightS, int bottomS, ref double left, ref double top, ref double right, ref double bottom);
[DllImport(SIGMALIB, EntryPoint = "GetRealScreen", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void GetRealScreen(IntPtr pView, double leftS, double topS, double rightS, double bottomS, ref int left, ref int top, ref int right, ref int bottom);
[DllImport(SIGMALIB, EntryPoint = "GetScreenHeight", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetScreenHeight(IntPtr pView, double width);
[DllImport(SIGMALIB, EntryPoint = "GetRealHeight", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern double GetRealHeight(IntPtr pView, int height);
[DllImport(SIGMALIB, EntryPoint = "GetScreenWidth", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetScreenWidth(IntPtr pView, double width);
[DllImport(SIGMALIB, EntryPoint = "GetRealWidth", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern double GetRealWidth(IntPtr pView, int width);
[DllImport(SIGMALIB, EntryPoint = "OpenDocument", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool OpenDocument(IntPtr pView, string lpszFileName, bool bMergeFile);
[DllImport(SIGMALIB, EntryPoint = "GetElementCount", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
#region layer manager
public static extern int GetElementCount(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "TestLayersLength", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetLayersLength(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "GetLayers", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool GetLayers(IntPtr pView, byte[] destBuffer, int destLen);
[DllImport(SIGMALIB, EntryPoint = "GetCurrentLayer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetCurrentLayer(IntPtr pView, byte[] layerName);
[DllImport(SIGMALIB, EntryPoint = "SetCurrentLayer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetCurrentLayer(IntPtr pView, string layerName);
[DllImport(SIGMALIB, EntryPoint = "SetLayerState", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetLayerState(IntPtr pView, string layerName, int status);
[DllImport(SIGMALIB, EntryPoint = "FindAddLayer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void FindAddLayer(IntPtr pView, string layerName, bool doActive);
[DllImport(SIGMALIB, EntryPoint = "DeleteLayer", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void DeleteLayer(IntPtr pView, [MarshalAs(UnmanagedType.LPArray)]string[] layers, int length);
[DllImport(SIGMALIB, EntryPoint = "GetLayerStyleData", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool GetLayerStyleData(IntPtr pView,string layerName, ref Int64 bufferCurve, ref int lenCurve, ref Int64 bufferPoint, ref int lenPoint);
[DllImport(SIGMALIB, EntryPoint = "RemoveCurveStyle", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool RemoveCurveStyle(IntPtr pView, string layerName,int index);
[DllImport(SIGMALIB, EntryPoint = "RemovePointStyle", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool RemovePointStyle(IntPtr pView, string layerName);
[DllImport(SIGMALIB, EntryPoint = "SetLayerHowtoViewPoint", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetLayerHowtoViewPoint(IntPtr pView, string layerName, IntPtr buffer, int bufferLen);
[DllImport(SIGMALIB, EntryPoint = "SetLayerHowtoViewCurve", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetLayerHowtoViewCurve(IntPtr pView, string layerName, IntPtr buffer, int bufferLen, int index);
#endregion layer manager
[DllImport(SIGMALIB, EntryPoint = "SetScrollBar", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetScrollBar(IntPtr pView, ref int hMax, ref int vMax, ref int hPage, ref int vPage, ref int hPos, ref int vPos);
[DllImport(SIGMALIB, EntryPoint = "HScroll", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void HScroll(IntPtr pView, int nSBCode, int nPos, int nScrollMax);
[DllImport(SIGMALIB, EntryPoint = "Scroll", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern bool Scroll(IntPtr pView, int orientation, double offset);
[DllImport(SIGMALIB, EntryPoint = "ViewEnlarge", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewEnlarge(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "ViewReduce", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewReduce(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "ViewExtend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewExtend(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "SetViewPan", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetViewPan(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "SetViewWindow", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetViewWindow(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "OnLButtonUp", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void OnLButtonUp(IntPtr pView, int mouseX, int mouseY);
[DllImport(SIGMALIB, EntryPoint = "ItemMouseMove", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ItemMouseMove(IntPtr pView, IntPtr hMemDC, int mouseX, int mouseY, ref MouseMoveResult mmResult);
[DllImport(SIGMALIB, EntryPoint = "SetItem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetItem(IntPtr pView, int itemType);
[DllImport(SIGMALIB, EntryPoint = "GetPoint2DFromItem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetPoint2DFromItem(IntPtr pView, out Point2D pt);
[DllImport(SIGMALIB, EntryPoint = "CancelDisplayPointInItem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void CancelDisplayPointInItem(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "ChangePointAddedMode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ChangePointAddedMode(IntPtr pView, int mode);
[DllImport(SIGMALIB, EntryPoint = "AddPoint2DToDoc", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int AddPoint2DToDoc(IntPtr pView, ref Point2D pt);
[DllImport(SIGMALIB, EntryPoint = "AddPointNameToItem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int AddPointNameToItem(IntPtr pView, string pointName);
[DllImport(SIGMALIB, EntryPoint = "ChangeAnglgeToItem", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int ChangeAnglgeToItem(IntPtr pView, double angle);
[DllImport(SIGMALIB, EntryPoint = "OnLButtonDown", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void OnLButtonDown(IntPtr pView, int mouseX, int mouseY);
[DllImport(SIGMALIB, EntryPoint = "ViewMouseDown", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewMouseDown(IntPtr pView, int mouseX, int mouseY);
[DllImport(SIGMALIB, EntryPoint = "ViewMouseMove", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewMouseMove(IntPtr pView, IntPtr hMemDC, int mouseX, int mouseY);
[DllImport(SIGMALIB, EntryPoint = "ViewMouseUp", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void ViewMouseUp(IntPtr pView, int mouseX, int mouseY);
#region 绘制曲线接口
[DllImport(SIGMALIB, EntryPoint = "EndCurve", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int EndCurve(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "CancelCurve", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int CancelCurve(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "AutoCloseCurve", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int AutoCloseCurve(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "ChangeCurveMergeState", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int ChangeCurveMergeState(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "DrawNextCurve", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int DrawNextCurve(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "GetTrackerHandleCursorType", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetTrackerHandleCursorType(IntPtr pView, int mouseX, int mouseY);
#endregion 绘制曲线接口
////////////////////////////////////////////////////////////////////////////////////////////////
[DllImport(SIGMALIB, EntryPoint = "AddWell", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void AddWell(string wellName, double locationX, double locationY);
[DllImport(SIGMALIB, EntryPoint = "SetWellStratiUnits", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWellStratiUnits(string wellName, int count
, string[] stratiNames, double[] tops, double[] bottoms, string[] unitNames);
[DllImport(SIGMALIB, EntryPoint = "DrawBend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int DrawBend(IntPtr pView, string leftWell
, string leftStrati, string rightWellName, string RightStrati);
[DllImport(SIGMALIB, EntryPoint = "MouseSelect", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int MouseSelect(IntPtr pView, int mouseX, int mouseY);
#region 比例尺
[DllImport(SIGMALIB, EntryPoint = "CreateProportion", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int CreateProportion(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeScaleLength", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeScaleLength(IntPtr pView, int length);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeNumber", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeNumber(IntPtr pView, int number);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeShowMode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeShowMode(IntPtr pView, int mode);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeUnit", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeUnit(IntPtr pView, int unit);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeColor", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeColor(IntPtr pView, int r, int g, int b);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeTextScale", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeTextScale(IntPtr pView, int scale);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeAlign", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeAlign(IntPtr pView, int align);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeTextHeight", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeTextHeight(IntPtr pView, int height);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeTextWidth", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeTextWidth(IntPtr pView, int width);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeTextHeightAlone", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeTextHeightAlone(IntPtr pView, int alone);
[DllImport(SIGMALIB, EntryPoint = "Proportion_ChangeCoordinate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_ChangeCoordinate(IntPtr pView, double x, double y);
[DllImport(SIGMALIB, EntryPoint = "Proportion_Create", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_Create(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "Proportion_GetScale", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_GetScale(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "Proportion_GetData", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Proportion_GetData(IntPtr pView, ref ProportionData data);
#endregion
#region 直角网
[DllImport(SIGMALIB, EntryPoint = "RectangularCSGrid_Create", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int RectangularCSGrid_Create(IntPtr pView, ref RectangularCSGridData data);
[DllImport(SIGMALIB, EntryPoint = "RectangularCSGrid_GetStepAndRange", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int RectangularCSGrid_GetStepAndRange(IntPtr pView, ref RectangularCSGridData data);
#endregion
#region 绘制圆弧
[DllImport(SIGMALIB, EntryPoint = "Arc_SetType", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Arc_SetType(IntPtr pView, int type);
#endregion
#region 绘制文本
[DllImport(SIGMALIB, EntryPoint = "Text_SetTextInfo", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Text_SetTextInfo(IntPtr pView, ref TextInformation info);
[DllImport(SIGMALIB, EntryPoint = "Text_SetFont", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Text_SetFont(IntPtr pView, ref SigmaDrawerStyle.LogFont font);
[DllImport(SIGMALIB, EntryPoint = "Text_Create", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Text_Create(IntPtr pView);
#endregion
#region 曲线打断
[DllImport(SIGMALIB, EntryPoint = "BreakCurve_IsBreaked", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int BreakCurve_IsBreaked(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "BreakCurve_GetSelectCount", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int BreakCurve_GetSelectCount(IntPtr pView);
#endregion
#region 删除
[DllImport(SIGMALIB, EntryPoint = "Delete_SetType", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Delete_SetType(IntPtr pView, int type);
[DllImport(SIGMALIB, EntryPoint = "Delete_GetCountSelected", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Delete_GetCountSelected(IntPtr pView);
[DllImport(SIGMALIB, EntryPoint = "Delete_ClearCountSelected", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int Delete_ClearCountSelected(IntPtr pView);
#endregion
}
public enum LayerStatus
{
VIEW_EDIT=10,
VIEW_NOT_EDIT=11,
NOT_VIEW_NOT_EDIT=12
}
}