using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Xml.Serialization; using GeoSigma.SigmaDrawerStyle; using GeoSigma.SigmaDrawerStyle.Converter; 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 WellOilLayerTrack : WellObjectXmlBase { private const string OilLayerCategory = "\t\t\t油层组"; private const string TrackObjectSettingsCategory = "\t道内对象设置"; private const string OtherCategory = "\t其它"; // === 试采道 === [XmlIgnore] [PropertyOrder(0)] [Category(OilLayerCategory)] [DisplayName("标题")] public string Title { get => WellTrack.Title.Font.Text; set => WellTrack.Title.Font.Text = value; } [XmlIgnore] [PropertyOrder(1)] [Category(OilLayerCategory)] [DisplayName("宽度")] public double Width { get => WellTrack.Width; set => WellTrack.Width = value; } [XmlIgnore] [PropertyOrder(2)] [Category(OilLayerCategory)] [DisplayName("填充")] [TypeConverter(typeof(YesNoConverter))] public bool IsFill { get => WellTrack.BackFill != 0; set => WellTrack.BackFill = value ? 1 : 0; } [XmlIgnore] [PropertyOrder(3)] [Category(OilLayerCategory)] [DisplayName("背景颜色")] [Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] public Color BackgroundColor { get => ColorTranslator2.FromHtml(WellTrack.BackColor); set => WellTrack.BackColor = ColorTranslator2.ToHtml(value); } [XmlIgnore] [PropertyOrder(4)] [Category(OilLayerCategory)] [DisplayName("道头字体")] [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))] public WellFontEx HeaderFont { get => WellTrack.Title.Font; set => WellTrack.Title.Font = value; } // === 道内对象设置 === [XmlIgnore] [PropertyOrder(5)] [Category(TrackObjectSettingsCategory)] [DisplayName("边框线")] [Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))] public string BorderLine { get; set; } [XmlIgnore] [PropertyOrder(6)] [Category(TrackObjectSettingsCategory)] [DisplayName("背景颜色")] [Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] public Color ObjectBackgroundColor { get => ColorTranslator2.FromHtml(WellTrack.LayerStyle.BackColor); set => WellTrack.LayerStyle.BackColor = ColorTranslator2.ToHtml(value); } [XmlIgnore] [PropertyOrder(7)] [Category(TrackObjectSettingsCategory)] [DisplayName("字体")] [Editor(typeof(FontEditor), typeof(UITypeEditor))] public Font ObjectFont { get => new Font(WellTrack.LayerStyle.TextFace ?? "宋体", WellTrack.LayerStyle.TextSize); set { if (value != null) { WellTrack.LayerStyle.TextFace = value.FontFamily.Name; WellTrack.LayerStyle.TextSize = value.Size; } } } [XmlIgnore] [Category(OtherCategory)] [DisplayName("分层级别"), PropertyOrder(7)] [TypeConverter(typeof(OilLayerStratificationConverter))] public string stratification { get => WellTrack.Data.RefColId; set { WellTrack.Data.RefColId = value; WellTrack.Data.RefTableId = WellObjectBaseInfo.SandSetTableID; } } [Browsable(false)] [XmlAttribute("Version")] public string Version { get; set; } [Browsable(false)] [XmlElement("WellTrack")] public WellTrackWellTrack WellTrack { get; set; } } public class OilLayerStratificationConverter : GenericStringMapConverter { protected override Dictionary ValueMap => new Dictionary(StringComparer.OrdinalIgnoreCase) { [""] = "", ["0"] = "一级分层", ["1"] = "二级分层", ["2"] = "三级分层", ["3"] = "四级分层", ["4"] = "五级分层", ["5"] = "六级分层" }; protected override string[] GetOptions(WellOilLayerTrack settings) { GeoSigmaWellPoleXY.GetWellStratificationClasses( settings.wellPoleContext.wellObjHandle, out string[] classes); return classes; } } #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 }