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/SigmaDrawerElement/WellTextSettingsTrack.cs

213 lines
5.7 KiB
C#

1 month ago
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;
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
/// <summary>
/// 射孔道
/// </summary>
[XmlRoot("Pcg")]
[TypeConverter(typeof(PropertySorter))]
public class WellTextSettingsTrack : baseInTrackObj
{
private static Dictionary<HorizontalAlignment, string> AlignMap = new Dictionary<HorizontalAlignment, string>()
{
{ 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)]
public string Text
{
get => WellText.Font.Text;
set => WellText.Font.Text = value;
}
[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("Text")]
[Browsable(false)]
public WellTrackText WellText { get; set; }
}
public class WellBackBrush
{
[XmlAttribute("Style")]
public int Style { get; set; }
[XmlAttribute("BackColor")]
public string BackColor { get; set; }
[XmlAttribute("ForeColor")]
public string ForeColor { get; set; }
}
public class WellHunkContent
{
[XmlAttribute("HunkContentStyle")]
public string HunkContentStyle { get; set; }
[XmlAttribute("TopContentExtend ")]
public double TopContentExtend { get; set; }
[XmlAttribute("BottomContentExtend ")]
public double BottomContentExtend { get; set; }
}
public class WellTrackText
{
[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; }
}
#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 VerticalDepth
{
[XmlAttribute("IsVertical")]
public int vid { get; set; }
[XmlAttribute("vtop")]
public double top { get; set; }
[XmlAttribute("vbottom")]
public double bottom { get; set; }
}
public class baseInTrackObj
{
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; }
}
}