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/SigmaDrawerWellElement/WellCycleLayerSetting.cs

128 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Drawing.Design;
using System.Xml.Serialization;
using GeoSigma.SigmaDrawerStyle;
using SigmaDrawerStyle;
using System.Drawing;
namespace GeoSigma.SigmaDrawerElement
{
#pragma warning disable SA1402 // File may only contain a single type
#pragma warning disable SA1600 // Elements should be documented
#pragma warning disable SA1649 // File name should match first type name
[XmlRoot("Pcg")]
[TypeConverter(typeof(PropertySorter))]
public class WellCycleLayerSetting : baseInTrackObj
{
private const string cycleLayerCategory = "\t\t设置旋回";
[XmlIgnore]
[Category(cycleLayerCategory)]
[DisplayName("顶深")]
[PropertyOrder(0)]
public double TopDepth
{
get => cycleLayer.Top;
set => cycleLayer.Top = value;
}
[XmlIgnore]
[Category(cycleLayerCategory)]
[DisplayName("底深")]
[PropertyOrder(1)]
public double BottomDepth
{
get => cycleLayer.Bottom;
set => cycleLayer.Bottom = value;
}
[XmlIgnore]
[Category(cycleLayerCategory)]
[DisplayName("类型")]
[PropertyOrder(2)]
[TypeConverter(typeof(cycleTypeConverter))]
public string type
{
get => cycleLayer.Type;
set => cycleLayer.Type = value;
}
[XmlIgnore]
[Category(cycleLayerCategory)]
[DisplayName("背景颜色")]
[PropertyOrder(3)]
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
public Color BackgroundColor
{
get => ColorTranslator2.FromHtml(cycleLayer.Style.BackColor);
set => cycleLayer.Style.BackColor = ColorTranslator2.ToHtml(value);
}
[XmlIgnore]
[Category(cycleLayerCategory)]
[DisplayName("线型")]
[PropertyOrder(4)]
[Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))]
public WellLineStyle BorderLine
{
get => LayerStyleHelper.GetWellLineStyle(cycleLayer.Style);
set => LayerStyleHelper.SetWellLineStyle(cycleLayer.Style, value);
}
[XmlAttribute("Version")]
[Browsable(false)]
public int Version { get; set; }
[XmlElement("CycleLayer")]
[Browsable(false)]
public WellCycleLayerEntity cycleLayer { get; set; }
}
public class WellCycleLayerEntity
{
[XmlAttribute("Type")]
public string Type { get; set; }
[XmlAttribute("Top")]
public double Top { get; set; }
[XmlAttribute("Bottom")]
public double Bottom { get; set; }
[XmlElement("Style")]
public WellLayerStyle Style { get; set; }
}
public static class DataServiceCycleType
{
public static string[] GetAvailableOptions(Object param1)
{
if (param1 is WellCycleLayerSetting settings)
{
return (new[]{"正旋回","反旋回"});
}
else
return Array.Empty<string>();
}
}
public class cycleTypeConverter : GenericWellOptionsConverter<WellCycleLayerSetting>
{
public cycleTypeConverter() : base(settings => DataServiceCycleType.GetAvailableOptions(settings)) //使用 lambda表达式直接定义了内部的函数指针
{ }
}
#pragma warning restore SA1649 // File name should match first type name
#pragma warning restore SA1600 // Elements should be documented
#pragma warning restore SA1402 // File may only contain a single type
}