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.

410 lines
12 KiB
C#

1 month ago
using GeoSigma.SigmaDrawerElement.Converter;
using GeoSigma.SigmaDrawerStyle;
using SigmaDrawerElement;
using SigmaDrawerStyle;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Xml.Serialization;
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 WellPole
{
private const string BasePropertyCategory = "\t\t\t\t\t基本属性";
private const string SpaceSettingsCategory = "\t\t\t\t间隔设置";
private const string FontCategory = "\t\t\t字体";
private const string LinePropertyCategory = "\t\t线属性";
private const string ColumnStyleCategory = "\t井柱显示";
// 基本属性
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("标题"), PropertyOrder(0)]
public string Title
{
get => Head.Title;
set => Head.Title = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("井名"), PropertyOrder(1)]
public string WellName
{
get => Head.WellName;
set => Head.WellName = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("补心海拔"), PropertyOrder(2)]
public double KB
{
get => Head.BushingLevel;
set => Head.BushingLevel = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("深度比例尺"), PropertyOrder(3)]
public double DepthScale
{
get => Styles.DepthScale;
set => Styles.DepthScale = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("起始深度"), PropertyOrder(4)]
public double StartDepth
{
get => Styles.Top;
set => Styles.Top = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("结束深度"), PropertyOrder(5)]
public double EndDepth
{
get => Styles.Bottom;
set => Styles.Bottom = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("左右边距"), PropertyOrder(6)]
public double HorizontalMargin
{
get => Styles.Track.LRMargin;
set => Styles.Track.LRMargin = value;
}
[XmlIgnore]
[Category(BasePropertyCategory), DisplayName("上下边距"), PropertyOrder(7)]
public double VerticalMargin
{
get => Styles.Track.TBMargin;
set => Styles.Track.TBMargin = value;
}
// 间隔设置
[XmlIgnore]
[Category(SpaceSettingsCategory), DisplayName("主刻度"), PropertyOrder(8)]
public double MajorTick
{
get => Styles.Grid.Major.Space;
set => Styles.Grid.Major.Space = value;
}
[XmlIgnore]
[Category(SpaceSettingsCategory), DisplayName("副刻度"), PropertyOrder(9)]
public double MinorTick
{
get => Styles.Grid.Minor.Space;
set => Styles.Grid.Minor.Space = value;
}
// 字体
[Category(FontCategory), DisplayName("标题字体"), PropertyOrder(10)]
[Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
public WellFontEx TitleFont
{
get => Styles.Title.Font;
set => Styles.Title.Font = value;
}
// [Category(FontCategory), DisplayName("道头字体"), PropertyOrder(11)]
// [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
// public WellFontEx HeaderFont
// {
// get => Styles.Title.Font;
// set => Styles.Title.Font = value;
// }
[Category(FontCategory), DisplayName("道头刻度字体"), PropertyOrder(12)]
[Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
public WellFontEx MajorFont
{
get => Styles.Track.TrackHeadMark.Font;
set => Styles.Track.TrackHeadMark.Font = value;
}
// 暂时没用
// [Category(FontCategory), DisplayName("深度刻度字体"), PropertyOrder(13)]
// [TypeConverter(typeof(WellFontExConverter))]
// [Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
// public WellFontEx DepthFont { get; set; }
[Category(LinePropertyCategory), DisplayName("井边框线"), PropertyOrder(14)]
[Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))]
public WellLineStyle WellBorderLine
{
get => Styles.Border;
set => Styles.Border = value;
}
[Category(LinePropertyCategory), DisplayName("道边框线"), PropertyOrder(15)]
[Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))]
public WellLineStyle TrackBorderLine
{
get => Styles.SplitLine;
set => Styles.SplitLine = value;
}
[Category(LinePropertyCategory), DisplayName("主刻度格线"), PropertyOrder(16)]
[Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))]
public WellLineStyle MajorLine
{
get => new WellLineStyle()
{
Width = Styles.Grid.Major.Width,
Color = Styles.Grid.Major.Color,
Style = Styles.Grid.Major.Style,
};
set
{
Styles.Grid.Major.Width = value.Width;
Styles.Grid.Major.Color = value.Color;
Styles.Grid.Major.Style = value.Style;
}
}
[Category(LinePropertyCategory), DisplayName("次刻度格线"), PropertyOrder(17)]
[Editor(typeof(PropertyEditorWellCurveStyle), typeof(UITypeEditor))]
public WellLineStyle MinorLine
{
get => new WellLineStyle()
{
Width = Styles.Grid.Minor.Width,
Color = Styles.Grid.Minor.Color,
Style = Styles.Grid.Minor.Style,
};
set
{
Styles.Grid.Minor.Width = value.Width;
Styles.Grid.Minor.Color = value.Color;
Styles.Grid.Minor.Style = value.Style;
}
}
[Category(ColumnStyleCategory), DisplayName("样式"), PropertyOrder(18)]
[TypeConverter(typeof(WellColumnStyleConverter))]
public string ColumnStyle
{
get => Styles.ColumnStyle;
set
{
Styles.ColumnStyle = value;
}
}
[XmlAttribute("Version")]
[Browsable(false)]
public string Version { get; set; }
[XmlElement("Head")]
[Browsable(false)]
public WellTrackHead Head { get; set; }
[XmlElement("PrintTemplate")]
[Browsable(false)]
public WellTrackPrintTemplate PrintTemplate { get; set; }
[XmlElement("Styles")]
[Browsable(false)]
public WellTrackStyles Styles { get; set; }
}
public class WellColumnStyleConverter : GenericStringMapConverter<WellPole>
{
protected override Dictionary<string, string> ValueMap => new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["Incline"] = "轨迹显示",
["Straight"] = "测深显示",
["VerticalDepth"] = "垂深显示"
};
protected override string[] GetOptions(WellPole wellPole)
{
return new[] { "轨迹显示", "测深显示", "垂深显示" };
}
}
public class WellTrackHead
{
[XmlAttribute("WellName")]
public string WellName { get; set; }
[XmlAttribute("Field")]
public string Field { get; set; }
[XmlAttribute("BushingLevel")]
public double BushingLevel { get; set; }
[XmlAttribute("Depth")]
public double Depth { get; set; }
[XmlAttribute("X")]
public double X { get; set; }
[XmlAttribute("Y")]
public double Y { get; set; }
[XmlAttribute("Title")]
public string Title { get; set; }
[XmlAttribute("Version")]
public string Version { get; set; }
[XmlAttribute("CopyrightName")]
public string CopyrightName { get; set; }
[XmlAttribute("SoftwareVersion")]
public string SoftwareVersion { get; set; }
[XmlAttribute("DepthDisplayRatio")]
public double DepthDisplayRatio { get; set; }
}
public class WellTrackPrintTemplate
{
[XmlElement("Scale")]
public WellTrackScale Scale { get; set; }
[XmlElement("Margin")]
public WellTrackMargin Margin { get; set; }
[XmlElement("Paper")]
public string Paper { get; set; }
}
public class WellTrackScale
{
[XmlAttribute("X")]
public double X { get; set; }
[XmlAttribute("Y")]
public double Y { get; set; }
}
public class WellTrackMargin
{
[XmlAttribute("Top")]
public string Top { get; set; }
[XmlAttribute("Right")]
public string Right { get; set; }
[XmlAttribute("Bottom")]
public string Bottom { get; set; }
[XmlAttribute("Left")]
public string Left { get; set; }
}
public class WellTrackStyles
{
[XmlAttribute("DepthScale")]
public double DepthScale { get; set; }
[XmlAttribute("DisplayScale")]
public double DisplayScale { get; set; }
[XmlAttribute("Top")]
public double Top { get; set; }
[XmlAttribute("Bottom")]
public double Bottom { get; set; }
[XmlElement("Title")]
public WellTrackTitle Title { get; set; }
[XmlElement("Grid")]
public WellTrackGrid Grid { get; set; }
[XmlElement("Border")]
public WellLineStyle Border { get; set; }
[XmlElement("SplitLine")]
public WellLineStyle SplitLine { get; set; }
[XmlElement("Track")]
public WellTrackTrack Track { get; set; }
[XmlAttribute("ColumnStyle")]
public string ColumnStyle { get; set; }
[XmlAttribute("ProjectAngle")]
public double ProjectAngle { get; set; }
}
public class WellTrackGrid
{
[XmlElement("Major")]
public WellTrackArguments Major { get; set; }
[XmlElement("Minor")]
public WellTrackArguments Minor { get; set; }
}
public class WellTrackArguments
{
[XmlAttribute("Space")]
public double Space { get; set; }
[XmlAttribute("Width")]
public double Width { get; set; }
[XmlAttribute("Color")]
public string ColorString
{
get => ColorTranslator2.ToHtml(Color);
set => Color = ColorTranslator2.FromHtml(value);
}
[XmlIgnore]
public Color Color { get; set; }
[XmlAttribute("Style")]
public string Style { get; set; }
}
public class WellTrackTrack
{
[XmlAttribute("LRMargin")]
public double LRMargin { get; set; }
[XmlAttribute("TBMargin")]
public double TBMargin { get; set; }
[XmlAttribute("HdHeight")]
public double HdHeight { get; set; }
[XmlAttribute("TitleHeight")]
public double TitleHeight { get; set; }
[XmlElement("TrackHeadMark")]
public WellTrackTrackHeadMark TrackHeadMark { get; set; }
}
public class WellTrackTrackHeadMark
{
[XmlAttribute("MarkPos")]
public string MarkPos { get; set; }
[XmlElement("Font")]
public WellFontEx Font { 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
}