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.
193 lines
6.5 KiB
C#
193 lines
6.5 KiB
C#
using System;
|
|
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
|
|
|
|
/// <summary>
|
|
/// 地层单位道
|
|
/// </summary>
|
|
[XmlRoot("Pcg")]
|
|
[TypeConverter(typeof(PropertySorter))]
|
|
public class WellStratigraphicUnitTrack : WellObjectXmlBase
|
|
{
|
|
//public WellStratigraphicUnitTrack()
|
|
//{
|
|
// wellPoleContext = new WellPoleContext();
|
|
//}
|
|
|
|
private const string StratUnitCategory = "\t\t地层单位道";
|
|
private const string TrackObjectSettingsCategory = "\t道内对象设置";
|
|
private const string OtherCategory = "\t其它";
|
|
|
|
[XmlIgnore]
|
|
[PropertyOrder(0)]
|
|
[Category(StratUnitCategory)]
|
|
[DisplayName("标题")]
|
|
public string Title
|
|
{
|
|
get => WellTrack.Title.Font.Text;
|
|
set => WellTrack.Title.Font.Text = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[PropertyOrder(1)]
|
|
[Category(StratUnitCategory)]
|
|
[DisplayName("宽度")]
|
|
public double Width
|
|
{
|
|
get => WellTrack.Width;
|
|
set => WellTrack.Width = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[PropertyOrder(2)]
|
|
[Category(StratUnitCategory)]
|
|
[DisplayName("填充")]
|
|
[TypeConverter(typeof(YesNoConverter))]
|
|
public bool IsFilled
|
|
{
|
|
get => WellTrack.BackFill != 0;
|
|
set => WellTrack.BackFill = value ? 1 : 0;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[PropertyOrder(3)]
|
|
[Category(StratUnitCategory)]
|
|
[DisplayName("背景颜色")]
|
|
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
|
|
public Color BackgroundColor
|
|
{
|
|
get => ColorTranslator2.FromHtml(WellTrack.BackColor);
|
|
set => WellTrack.BackColor = ColorTranslator2.ToHtml(value);
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[PropertyOrder(4)]
|
|
[Category(StratUnitCategory)]
|
|
[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 WellBorderLine { 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(PropertyEditorWellFontEx), typeof(UITypeEditor))]
|
|
public WellFontEx ObjectFont
|
|
{
|
|
get => LayerStyleHelper.GetFontEx(WellTrack.LayerStyle);
|
|
set => LayerStyleHelper.SetFontEx(WellTrack.LayerStyle, value);
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(OtherCategory)]
|
|
[DisplayName("地层级别"), PropertyOrder(8)]
|
|
[TypeConverter(typeof(StratumDivisionConverter))]
|
|
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; }
|
|
|
|
//[Browsable(false)]
|
|
//[XmlIgnore]
|
|
//public WellPoleContext wellPoleContext { get; set; }
|
|
}
|
|
|
|
public static class DataServiceStratumDivision
|
|
{
|
|
public static string[] GetAvailableOptions(Object param1)
|
|
{
|
|
if(param1 is WellStratigraphicUnitTrack settings)
|
|
{
|
|
GeoSigmaWellPoleXY.GetWellStratumClasses(settings.wellPoleContext.wellObjHandle, out string[] classes);
|
|
return classes;
|
|
}
|
|
else
|
|
return Array.Empty<string>();
|
|
}
|
|
}
|
|
|
|
public class StratumDivisionConverter: GenericWellOptionsConverter<WellStratigraphicUnitTrack>
|
|
{
|
|
public StratumDivisionConverter() : base(settings => DataServiceStratumDivision.GetAvailableOptions(settings)) //使用 lambda表达式直接定义了内部的函数指针
|
|
{ }
|
|
}
|
|
|
|
//public static class DataServiceStratumDivision
|
|
//{
|
|
// public static string[] GetStratumClasses(ulong handle)
|
|
// {
|
|
// // string[] classes = new string[0];
|
|
// GeoSigmaWellPoleXY.GetWellStratumClasses(handle, out string[] classes);
|
|
// return classes;
|
|
// }
|
|
//}
|
|
|
|
//public class StratumDivisionConverter : TypeConverter
|
|
//{
|
|
// public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
|
|
// public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
|
|
|
|
// public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
// {
|
|
// if (context?.Instance is WellStratigraphicUnitTrack settings)
|
|
// {
|
|
// var options = DataServiceStratumDivision.GetStratumClasses(settings.wellPoleContext.wellObjHandle);
|
|
// //var options = GetUserSpecificOptions(settings.UserId);
|
|
// return new StandardValuesCollection(options);
|
|
// }
|
|
// return new StandardValuesCollection(new string[0]);
|
|
// }
|
|
//}
|
|
#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
|
|
}
|