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/SigmaDrawerStyle/ContourGenerationProperty.cs

159 lines
5.4 KiB
C#

1 month ago
using System;
using System.ComponentModel;
1 month ago
#if WEB_SERVICE
#else
1 month ago
using System.Drawing.Design;
using System.Windows.Forms;
1 month ago
#endif
1 month ago
using GeoSigma.SigmaDrawerStyle.Converter;
namespace GeoSigma.SigmaDrawerStyle
{
public enum ContourFaultKind
{
,
,
}
public class ContourGenerationProperty
{
private double interval; //等值线间隔
private int step; //等值线上数步长
private double zMax;
private double zMin;
private string categoryNameA;//等值线上数类别名
private string categoryNameB;//等值线非上数类别名
private ContourFaultKind faultKind = ContourFaultKind.; //断层存在方式
private string faultFile = string.Empty; //断层文件
// private LayerNamesWrapper layerNamesWrapper = new LayerNamesWrapper();
[Category("\t\t间隔"), DisplayName("\t\t\t\t\t\t等值线间隔"), ReadOnly(false)]
public double Interval { get => interval; set => interval = value; }
[Category("\t\t间隔"), DisplayName("\t\t\t\t\t\t等值线上数步长"), ReadOnly(false)]
public int Step { get => step; set => step = value; }
[Category("\tZ值范围"), DisplayName("\t\t\t\t\t\t最小"), ReadOnly(false)]
public double ZMin { get => zMin; set => zMin = value; }
[Category("\tZ值范围"), DisplayName("\t\t\t\t\t\t最大"), ReadOnly(false)]
public double ZMax { get => zMax; set => zMax = value; }
[Category("\t层位"), DisplayName("\t\t\t\t\t\t带标注"), ReadOnly(false)]
public string CategoryNameA { get => categoryNameA; set => categoryNameA = value; }
[Category("\t层位"), DisplayName("\t\t\t\t\t\t无标注"), ReadOnly(false)]
public string CategoryNameB { get => categoryNameB; set => categoryNameB = value; }
[Category("\t断层"), DisplayName("\t\t\t\t\t\t断层存在方式"), ReadOnly(false)]
public ContourFaultKind FaultKind { get => faultKind; set => faultKind = value; }
[Category("\t断层"), DisplayName("\t\t\t断层文件"), ReadOnly(true)]
//[Editor("UCDraw.PropertyGrids.PropertyGridOpenFile, UCDraw", typeof(UITypeEditor))]
1 month ago
#if WEB_SERVICE
#else
1 month ago
[Editor(typeof(UIFilenameEditor), typeof(System.Drawing.Design.UITypeEditor))]
1 month ago
#endif
1 month ago
public string FaultFile
{
get
{
return faultFile;
}
set
{
faultFile = value;
}
}
[Category("\t断层"), DisplayName("\t\t\t断层类别")]
1 month ago
#if WEB_SERVICE
#else
1 month ago
[Editor(typeof(DropDownTypeEditor), typeof(UITypeEditor)), ReadOnly(true)]
1 month ago
#endif
1 month ago
public DropdownPropertyWrapper LayerNames { get; set; } = new DropdownPropertyWrapper();
}
1 month ago
#if WEB_SERVICE
#else
1 month ago
public class UIFilenameEditor : System.Drawing.Design.UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
if (!context.PropertyDescriptor.IsReadOnly)
{
return UITypeEditorEditStyle.Modal;
}
}
return UITypeEditorEditStyle.DropDown;
}
[RefreshProperties(RefreshProperties.All)]
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
{
if (context == null || provider == null || context.Instance == null)
{
return base.EditValue(provider, value);
}
FileDialog fileDlg;
if (context.PropertyDescriptor.Attributes[typeof(SaveFileAttribute)] == null)
{
fileDlg = new OpenFileDialog();
}
else
{
fileDlg = new SaveFileDialog();
}
fileDlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
fileDlg.FileName = (string)value;
FileDialogFilterAttribute filterAtt = (FileDialogFilterAttribute)context.PropertyDescriptor.Attributes[typeof(FileDialogFilterAttribute)];
if (filterAtt != null)
{
fileDlg.Filter = filterAtt.Filter;
}
if (fileDlg.ShowDialog() == DialogResult.OK)
{
value = fileDlg.FileName;
}
fileDlg.Dispose();
return value;
}
[AttributeUsage(AttributeTargets.Property)]
public class FileDialogFilterAttribute : Attribute
{
private string _filter;
public string Filter
{
get
{
return this._filter;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="FileDialogFilterAttribute"/> class.
/// </summary>
/// <param name="filter"></param>
public FileDialogFilterAttribute(string filter)
{
this._filter = filter;
}
}
[AttributeUsage(AttributeTargets.Property)]
public class SaveFileAttribute : Attribute
{
}
public enum FileDialogType
{
LoadFileDialog,
SaveFileDialog
}
}
1 month ago
#endif
1 month ago
}