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.
kev/Drawer/UCDraw/SigmaDrawerWellStyle/WellCurveStyleManager.cs

58 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using GeoSigmaDrawLib;
namespace GeoSigma.SigmaDrawerStyle
{
/// <summary>
/// 曲线样式管理类,说是管理,其实目前仅处理获取
/// </summary>
public class WellCurveStyleManager
{
private static readonly Lazy<WellCurveStyleManager> LazyInstance =
new Lazy<WellCurveStyleManager>(() => new WellCurveStyleManager());
/// <summary>
/// 单例
/// </summary>
public static WellCurveStyleManager Instance => LazyInstance.Value;
private WellCurveStyleManager()
{
}
public string[] GetNames()
{
if (!GeoSigmaWellPoleXY.GetCurveFillSymbolNames(out string[] names))
{
return names;
}
return new string[] { };
}
/// <summary>
/// 获取曲线样式
/// </summary>
/// <param name="name">曲线样式名称</param>
/// <param name="width">width</param>
/// <param name="height">height</param>
/// <returns>曲线样式</returns>
public Bitmap DrawStyle(string name, int width, int height)
{
var bitmap = new Bitmap(width, height);
Graphics graphics = Graphics.FromImage(bitmap);
IntPtr hdc = graphics.GetHdc();
if (GeoSigmaWellPoleXY.GetDrawCurveFillSymbol(name, hdc, width, height))
{
return bitmap;
}
graphics.ReleaseHdc();
return null;
}
}
}