using GeoSigma; using GeoSigma.SigmaDrawerElement; using GeoSigma.SigmaDrawerStyle; using GeoSigma.SigmaDrawerStyle.Converter; using SigmaDrawerStyle; using SqlSugar; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Reflection; using System.Xml.Serialization; using WorkData; using WorkData.Entity; //using PropertyEditorColor = GeoSigma.SigmaDrawerStyle.PropertyEditorColor; namespace 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 WellCommonDataTrack { private const string WellTrackCategory = "\t\t\t数据道"; private const string TrackObjectSettingsCategory = "\t道内对象设置"; [XmlIgnore] [Category(WellTrackCategory)] [DisplayName("标题")] [PropertyOrder(0)] public string Title { get => WellTrack.Title.Font.Text; set => WellTrack.Title.Font.Text = value; } [XmlIgnore] [Category(WellTrackCategory)] [DisplayName("宽度")] [PropertyOrder(1)] public double Width { get => WellTrack.Width; set => WellTrack.Width = value; } [XmlIgnore] [Category(WellTrackCategory)] [DisplayName("填充")] [PropertyOrder(2)] [TypeConverter(typeof(YesNoConverter))] public bool IsFilled { get => WellTrack.BackFill != 0; set => WellTrack.BackFill = value ? 1 : 0; } [XmlIgnore] [Category(WellTrackCategory)] [DisplayName("背景颜色")] [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))] [PropertyOrder(3)] [Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] public Color BackgroundColor { get => ColorTranslator2.FromHtml(WellTrack.BackColor); set => WellTrack.BackColor = ColorTranslator2.ToHtml(value); } [XmlIgnore] [Category(WellTrackCategory)] [DisplayName("道头字体")] [PropertyOrder(4)] [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))] public WellFontEx HeaderFont { get => WellTrack.Title.Font; set => WellTrack.Title.Font = value; } // 通内对象设置 [XmlIgnore] [Category(TrackObjectSettingsCategory)] [DisplayName("边框线")] [PropertyOrder(5)] [Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))] public WellLineStyle BorderLine { get => LayerStyleHelper.GetWellLineStyle(WellTrack.LayerStyle); set => LayerStyleHelper.SetWellLineStyle(WellTrack.LayerStyle, value); } //[XmlIgnore] //[Category(TrackObjectSettingsCategory)] //[DisplayName("背景颜色")] //[PropertyOrder(6)] //[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] //public Color ObjectBackgroundColor //{ // get => ColorTranslator2.FromHtml(WellTrack.LayerStyle.BackColor); // set => WellTrack.LayerStyle.BackColor = ColorTranslator2.ToHtml(value); //} //[XmlIgnore] //[Category(TrackObjectSettingsCategory)] //[DisplayName("字体")] //[PropertyOrder(7)] //[Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))] //public WellFontEx ObjectFont //{ // get => LayerStyleHelper.GetFontEx(WellTrack.LayerStyle); // set => LayerStyleHelper.SetFontEx(WellTrack.LayerStyle, value); //} [XmlIgnore] [Category("\t\t数据设置")] [ReadOnly(true)] [DisplayName("数据源"), PropertyOrder(7)] public string TableSource { get => tableInfoQuery.tableChsName(WellTrack.DataItems.RefTableId); set { WellTrack.DataItems.RefTableId = value; } } [XmlIgnore] [Category("数据设置")] [DisplayName("字段设置"), PropertyOrder(7)] [Editor(typeof(PropertyEditorCommonDataTrackSetData), typeof(UITypeEditor))] public DataItems dataItems { get { return WellTrack.DataItems; } set { WellTrack.DataItems.SetValue(value); WellTrack.Data.RefTableId = WellTrack.DataItems.RefTableId; WellTrack.bRefreshWorkAreaData = true; } } [XmlAttribute("Version")] [Browsable(false)] public string Version { get; set; } [XmlElement("WellTrack")] [Browsable(false)] public WellTrackCommonData WellTrack { get; set; } } #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 public class WellTrackCommonData { public WellTrackCommonData() // { bRefreshWorkAreaData = false; } [XmlAttribute("Name")] public string Name { get; set; } [XmlAttribute("Type")] public string Type { get; set; } [XmlAttribute("Width")] public double Width { get; set; } [XmlAttribute("BackFill")] public int BackFill { get; set; } [XmlAttribute("BackColor")] public string BackColor { get; set; } [XmlElement("Title")] public WellTrackTitle Title { get; set; } [XmlElement("LayerStyle")] public WellLayerStyle LayerStyle { get; set; } [XmlIgnore] public bool bRefreshWorkAreaData { get; set; } //修改了属性数据后,是否需要重新刷一下工区数据 [XmlElement("DataItems")] public DataItems DataItems { get; set; } [XmlElement("Data")] public WellTrackData Data { get; set; } } public class DataItems { [XmlAttribute("DepthSegmentMode")] public string DepthSegmentMode { get; set; } [XmlAttribute("Display")] public string Display { get; set; } [XmlAttribute("RefTableId")] public string RefTableId { get; set; } [XmlElement("DataItem")] public List DataItem { get; set; } = new List(); public override string ToString() { //string rstr = RefTableId; //rstr = tableInfoQuery.tableChsName(rstr); string rstr = ""; foreach(DataItem item in DataItem) { rstr = rstr+' '+ tableInfoQuery.getColumnChsNameFromEngName(RefTableId,item.RefColId); } rstr = rstr.TrimStart(' '); return rstr; } public void SetValue(DataItems tDataItems) { RefTableId = tDataItems.RefTableId; DepthSegmentMode = tDataItems.DepthSegmentMode; Display = tDataItems.Display; DataItem = new List(); for (int i = 0; i < tDataItems.DataItem.Count; i++) { DataItem item = new DataItem(); item.RefColId = tDataItems.DataItem[i].RefColId; item.TextFace = tDataItems.DataItem[i].TextFace; item.ColType = tDataItems.DataItem[i].ColType; item.ShowContent = tDataItems.DataItem[i].ShowContent; item.TextRect = tDataItems.DataItem[i].TextRect; item.SymbolRect = tDataItems.DataItem[i].SymbolRect; item.TextColor = tDataItems.DataItem[i].TextColor; item.TextSize = tDataItems.DataItem[i].TextSize; item.TextFace = tDataItems.DataItem[i].TextFace; item.WidthAllocation = tDataItems.DataItem[i].WidthAllocation; // item.ColorRect = tDataItems.DataItem[i].ColorRect; item.sn = i + 1; DataItem.Add(item); } } } public class DataItem { [XmlAttribute("RefColId")] public string RefColId { get; set; } [XmlAttribute("ColType")] public string ColType { get; set; } [XmlAttribute("ShowContent")] public string ShowContent { get; set; } [XmlAttribute("TextRect")] public string TextRect { get; set; } [XmlAttribute("SymbolRect")] public string SymbolRect { get; set; } [XmlAttribute("TextColor")] public string TextColor { get; set; } [XmlAttribute("TextSize")] public float TextSize { get; set; } [XmlAttribute("TextFace")] public string TextFace { get; set; } [XmlAttribute("WidthAllocation")] public double WidthAllocation { get; set; } [XmlIgnore] public int sn { get; set; } } }