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.
262 lines
9.7 KiB
C#
262 lines
9.7 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;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
|
|
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 WellSandSetsTrack : WellObjectXmlBase
|
|
{
|
|
//public WellSandSetsTrack()
|
|
//{
|
|
// wellPoleContext = new WellPoleContext();
|
|
//}
|
|
private const string SandstoneTrackCategory = "\t\t砂层组道";
|
|
private const string TrackObjectSettingsCategory = "\t道内对象设置";
|
|
private const string OtherCategory = "\t其它";
|
|
|
|
[XmlIgnore]
|
|
[Category(SandstoneTrackCategory)]
|
|
[DisplayName("标题"), PropertyOrder(0)]
|
|
public string Title
|
|
{
|
|
get => WellTrack.Title.Font.Text;
|
|
set => WellTrack.Title.Font.Text = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(SandstoneTrackCategory)]
|
|
[DisplayName("宽度"), PropertyOrder(1)]
|
|
public double Width
|
|
{
|
|
get => WellTrack.Width;
|
|
set => WellTrack.Width = value;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(SandstoneTrackCategory)]
|
|
[DisplayName("充填"), PropertyOrder(2)]
|
|
[TypeConverter(typeof(YesNoConverter))]
|
|
public bool IsFill
|
|
{
|
|
get => WellTrack.BackFill != 0;
|
|
set => WellTrack.BackFill = value ? 1 : 0;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(SandstoneTrackCategory)]
|
|
[DisplayName("背景颜色"), PropertyOrder(3)]
|
|
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
|
|
public Color BackgrondColor
|
|
{
|
|
get => ColorTranslator2.FromHtml(WellTrack.BackColor);
|
|
set => WellTrack.BackColor = ColorTranslator2.ToHtml(value);
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(SandstoneTrackCategory)]
|
|
[DisplayName("道头字体"), PropertyOrder(4)]
|
|
[Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
|
|
public WellFontEx Font
|
|
{
|
|
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 BackgroundColor2
|
|
{
|
|
get => ColorTranslator2.FromHtml(WellTrack.LayerStyle.BackColor);
|
|
set => WellTrack.LayerStyle.BackColor = ColorTranslator2.ToHtml(value);
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(TrackObjectSettingsCategory)]
|
|
[DisplayName("字体"), PropertyOrder(6)]
|
|
[Editor(typeof(PropertyEditorWellFontEx), typeof(UITypeEditor))]
|
|
public WellFontEx Font2
|
|
{
|
|
get => LayerStyleHelper.GetFontEx(WellTrack.LayerStyle);
|
|
set => LayerStyleHelper.SetFontEx(WellTrack.LayerStyle, value);
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(OtherCategory)]
|
|
[DisplayName("分层级别"), PropertyOrder(7)]
|
|
[TypeConverter(typeof(StratificationConverter))]
|
|
public string stratification
|
|
{
|
|
get => WellTrack.Data.RefColId;
|
|
set
|
|
{
|
|
WellTrack.Data.RefColId = value;
|
|
WellTrack.Data.RefTableId = WellObjectBaseInfo.SandSetTableID;
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(OtherCategory)]
|
|
[DisplayName("显示断点信息"), PropertyOrder(8)]
|
|
[TypeConverter(typeof(YesNoConverter))]
|
|
public bool bShowFaultPoint
|
|
{
|
|
get => WellTrack.faultPoint.Enable != 0;
|
|
set => WellTrack.faultPoint.Enable = value ? 1 : 0;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category(OtherCategory)]
|
|
[DisplayName("断点大小"), PropertyOrder(9)]
|
|
public float faultDiameter
|
|
{
|
|
get => WellTrack.faultPoint.diameter;
|
|
set => WellTrack.faultPoint.diameter = value;
|
|
}
|
|
|
|
[Browsable(false)]
|
|
[XmlAttribute("Version")]
|
|
public string Version { get; set; }
|
|
|
|
[Browsable(false)]
|
|
[XmlElement("WellTrack")]
|
|
public WellTrackWellTrack WellTrack { get; set; }
|
|
|
|
//[Browsable(false)]
|
|
//[XmlIgnore]
|
|
//[XmlElement("wellObjHandle")]
|
|
//public UInt64 wellObjHandle { get; set; }
|
|
|
|
//[Browsable(false)]
|
|
//[XmlIgnore]
|
|
//public GeoSigmaWellPoleXY geoWellPole { get; set; }
|
|
|
|
//[Browsable(false)]
|
|
//[XmlIgnore]
|
|
//public WellPoleContext wellPoleContext { get; set; }
|
|
}
|
|
|
|
public class StratificationConverter : GenericStringMapConverter<WellSandSetsTrack>
|
|
{
|
|
protected override Dictionary<string, string> ValueMap => new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
[""] = "",
|
|
["0"] = "一级分层",
|
|
["1"] = "二级分层",
|
|
["2"] = "三级分层",
|
|
["3"] = "四级分层",
|
|
["4"] = "五级分层",
|
|
["5"] = "六级分层"
|
|
};
|
|
|
|
protected override string[] GetOptions(WellSandSetsTrack settings)
|
|
{
|
|
GeoSigmaWellPoleXY.GetWellStratificationClasses(
|
|
settings.wellPoleContext.wellObjHandle,
|
|
out string[] classes);
|
|
return classes;
|
|
}
|
|
}
|
|
|
|
//public static class DataServiceStratification
|
|
//{
|
|
// public static string[] GetStratificationClasses(ulong handle)
|
|
// {
|
|
// // string[] classes = new string[0];
|
|
// GeoSigmaWellPoleXY.GetWellStratificationClasses(handle,out string[] classes);
|
|
// return classes;
|
|
// }
|
|
//}
|
|
|
|
//public class stratificationConverter : TypeConverter
|
|
//{
|
|
// private static readonly Dictionary<string, string> ValueMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
|
// { {"","" }, { "0","一级分层"} ,{ "1","二级分层"},{ "2","三级分层"} ,{ "3","四级分层"},{ "4","五级分层"} ,{ "5","六级分层"} };
|
|
// //private static readonly Dictionary<string, string> ReverseMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
|
// //{ {"","" },{ "一级分层","0"} ,{ "二级分层","1"},{ "三级分层" ,"2"} ,{ "四级分层" ,"3"},{ "五级分层" ,"4"} ,{ "六级分层" ,"5"} };
|
|
// private static readonly Dictionary<string, string> ReverseMap =
|
|
// ValueMap.GroupBy(kvp => kvp.Value)
|
|
// .ToDictionary(g => g.Key, g => g.First().Key);
|
|
// public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
|
|
// public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
|
|
|
|
// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
|
// {
|
|
// return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
|
|
// }
|
|
|
|
// public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
// {
|
|
// if (context?.Instance is WellSandSetsTrack settings)
|
|
// {
|
|
// var options = DataServiceStratification.GetStratificationClasses(settings.wellPoleContext.wellObjHandle);// settings.wellObjHandle);
|
|
// //var options = GetUserSpecificOptions(settings.UserId);
|
|
// return new StandardValuesCollection(options);
|
|
// }
|
|
// return new StandardValuesCollection(new string[0]);
|
|
// }
|
|
|
|
// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
|
// {
|
|
// if (destinationType == typeof(string) && value is string stringValue)
|
|
// {
|
|
// // 将内部值映射为显示值
|
|
// if (ValueMap.TryGetValue(stringValue, out var displayValue))
|
|
// {
|
|
// return displayValue;
|
|
// }
|
|
// return stringValue; // 如果没有映射,返回原值
|
|
// }
|
|
// return base.ConvertTo(context, culture, value, destinationType);
|
|
// }
|
|
|
|
// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
|
// {
|
|
// if (value is string stringValue)
|
|
// {
|
|
// // 将显示值映射回内部值
|
|
// if (ReverseMap.TryGetValue(stringValue, out var internalValue))
|
|
// {
|
|
// return internalValue;
|
|
// }
|
|
// return stringValue; // 如果没有映射,返回原值
|
|
// }
|
|
// return base.ConvertFrom(context, culture, value);
|
|
// }
|
|
// }
|
|
|
|
|
|
#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
|
|
}
|