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/ListBoxEditorFactory.cs

328 lines
9.3 KiB
C#

1 month ago
using GeoSigmaDrawLib;
using System;
using System.Linq;
using System.Windows.Forms;
namespace GeoSigma.SigmaDrawerStyle
{
/// <summary>
/// ListBox 子类
/// </summary>
public static class ListBoxEditorFactory
{
/// <summary>
/// 创建不同子类的 ListBox
/// </summary>
/// <param name="controlKey">控件关键字</param>
/// <returns>ListBox</returns>
public static ListBox Create(string controlKey)
{
switch (controlKey)
{
case "Lithology":
return new SymbolListBox(new LithologyListBoxProvider());
case "PointType":
return new SymbolListBox(new PointTypeListBoxProvider());
case "LineType":
return new SymbolListBox(new LineTypeListBoxProvider());
case "LithFront":
return new SymbolListBox(new LithFrontListBoxProvider());
case "LithConstitution":
return new SymbolListBox(new LithConstitutionListBoxProvider());
case "OilGas":
return new SymbolListBox(new OilGasListBoxProvider());
case "LithContent":
return new SymbolListBox(new LithContentListBoxProvider());
case "LithologyColor":
return new SymbolListBox(new LithologyColorListBoxProvider());
case "Symbol":
return new SymbolListBox(new SymbolListBoxProvider());
case "InterpResult":
return new SymbolListBox(new InterpResultListBoxProvider());
case "Stratigraphic":
return new SymbolListBox(new StratigraphicListBoxProvider());
case "BendStyle":
return new SymbolListBox(new BendStyleListBoxProvider());
default:
throw new NotSupportedException($"Unknown ListBox editor type: {controlKey}");
}
}
}
/// <summary>
/// 含油气性
/// </summary>
public class LithologyColorListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithologyColor(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithologyColor(out string[] names))
{
return new[] { string.Empty }.Concat(names).ToArray();
}
return new string[] { };
}
}
/// <summary>
/// 含油气性
/// </summary>
public class OilGasListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithOilGas(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithOilGas(out string[] names))
{
return new[] { string.Empty }.Concat(names).ToArray();
}
return new string[] { };
}
}
/// <summary>
/// 含有物
/// </summary>
public class LithContentListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithContent(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithContent(out string[] names))
{
return new[] { string.Empty }.Concat(names).ToArray();
}
return new string[] { };
}
}
/// <summary>
/// 构造
/// </summary>
public class LithConstitutionListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithConstitution(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithConstitution(out string[] names))
{
return new[] { string.Empty }.Concat(names).ToArray();
}
return new string[] { };
}
}
/// <summary>
/// 岩性前缀
/// </summary>
public class LithFrontListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithFront(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithFront(out string[] names))
{
return new[] { string.Empty }.Concat(names).ToArray();
}
return new string[] { };
}
}
/// <summary>
/// 点符号
/// </summary>
public class PointTypeListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawCurvePointSymbol(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetCurvePointSymbolNames(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 线型
/// </summary>
public class LineTypeListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawWellCurveLine(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetWellCurveLineNames(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 岩性
/// </summary>
public class LithologyListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForLithology(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForLithology(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 符号
/// </summary>
public class SymbolListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawNormalSymbol(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetNormalSymbolNames(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 解释结果
/// </summary>
public class InterpResultListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolForResult(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetSymbolNamesForResult(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 解释结果
/// </summary>
public class StratigraphicListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawStratumLith(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetStratumLithNames(out string[] names))
{
return names;
}
return new string[] { };
}
}
/// <summary>
/// 连层样式
/// </summary>
public class BendStyleListBoxProvider : ISymbolListBoxProvider
{
/// <inheritdoc/>
public bool Draw(string name, IntPtr hdc, int width, int height)
{
return GeoSigmaWellPoleXY.GetDrawSymbolBendStyle(name, hdc, width, height);
}
/// <inheritdoc/>
public string[] GetNames()
{
if (GeoSigmaWellPoleXY.GetStratumBendStyleNames(out string[] names))
{
return names;
}
return new string[] { };
}
}
}