using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; using System.Xml.Serialization; using GeoSigma.SigmaDrawerStyle; using GeoSigma.SigmaDrawerStyle.Converter; using SigmaDrawerElement; using SigmaDrawerStyle; using GeoSigmaDrawLib; 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 WellInTrackFacies: WellObjectXmlBase { private static Dictionary AlignMap = new Dictionary() { { HorizontalAlignment.Left, "Left" }, { HorizontalAlignment.Right, "Right" }, { HorizontalAlignment.Center, "Center" }, }; private const string ShotTrackCategory = "\t\t设置沉积相"; [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("顶深")] [PropertyOrder(0)] public double TopDepth { get => WellText.Top; set => WellText.Top = value; } [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("底深")] [PropertyOrder(1)] public double BottomDepth { get => WellText.Bottom; set => WellText.Bottom = value; } [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("背景颜色")] [PropertyOrder(3)] [Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] public Color BackgroundColor { get => ColorTranslator2.FromHtml(WellText.BackBrush.BackColor); set => WellText.BackBrush.BackColor = ColorTranslator2.ToHtml(value); } [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("文本")] [PropertyOrder(4)] [TypeConverter(typeof(faciesNamesConverter))] public string Text { get => WellText.Font.Text; set { WellText.Font.Text = value; WellText.Name = value; WellText.bsetTExt = true; Color fclr = BackgroundColor;// ColorTranslator2.FromHtml(WellText.BackBrush.BackColor); GeoSigmaWellPoleXY.GetFaciesColor(value, ref fclr); // WellText.BackBrush.BackColor = ColorTranslator2.ToHtml(fclr); BackgroundColor = fclr; } } [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("字体")] [PropertyOrder(5)] [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))] public WellFontEx HeaderFont { get => WellText.Font; set => WellText.Font = value; } [XmlIgnore] [Category(ShotTrackCategory)] [DisplayName("水平位置")] [PropertyOrder(7)] public HorizontalAlignment HorizontalAlign { get => DictionaryHelper.Reverse(AlignMap)[WellText.Align]; set => WellText.Align = AlignMap[value]; } [XmlAttribute] [Browsable(false)] public int Version { get; set; } [XmlElement("FaciesLayer")] [Browsable(false)] public WellInTrackFaciesEntity WellText { get; set; } private const string vDepthCategory = "\t垂深"; [XmlIgnore] [Category(vDepthCategory)] [DisplayName("顶深")] [ReadOnly(true)] [PropertyOrder(1)] public string topStr { get { if (vdpeth.vid == 0) return ""; else return vdpeth.top.ToString(); } } [XmlIgnore] [Category(vDepthCategory)] [DisplayName("底深")] [ReadOnly(true)] [PropertyOrder(2)] public string bottomStr { get { if (vdpeth.vid == 0) return ""; else return vdpeth.bottom.ToString(); } } [XmlElement("VerticalDepth")] [Browsable(false)] public VerticalDepth vdpeth { get; set; } } public class WellInTrackFaciesEntity { [XmlAttribute] public string Name { get; set; } [XmlAttribute] public double Top { get; set; } [XmlAttribute] public double Bottom { get; set; } [XmlAttribute] public string Align { get; set; } [XmlElement("Font")] public WellFontEx Font { get; set; } [XmlElement("HunkContent")] public WellHunkContent HunkContent { get; set; } [XmlElement("BackBrush")] public WellBackBrush BackBrush { get; set; } [XmlElement("RenderStyle")] public WellRenderStyle RenderStyle { get; set; } [XmlIgnore] public bool bsetTExt = false; } public static class DataServiceFaciesNames { public static string[] GetAvailableOptions(Object param1) { string[] names = new string[0]; if (param1 is WellInTrackFacies settings) { if (GeoSigmaWellPoleXY.GetFaciesNames(out string[] NamesArr) == true) { List slist = new List(NamesArr); return slist.ToArray(); } } return names; } } public class faciesNamesConverter : GenericWellOptionsConverter { public faciesNamesConverter() : base(settings => DataServiceFaciesNames.GetAvailableOptions(settings)) { } } #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 }