|
|
using IniParser;
|
|
|
using IniParser.Model;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using UtfUnknown;
|
|
|
|
|
|
namespace Construction.BatchCreateMap
|
|
|
{
|
|
|
public class GridCreateParameter: GridCreateParameterBase
|
|
|
{
|
|
|
private double curveSpace = 5;
|
|
|
private int lableSpace = 5;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the automatic.
|
|
|
/// </summary>
|
|
|
/// <value>The automatic.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("自动打开")]
|
|
|
[Browsable(false)]
|
|
|
public int Auto { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the contour.
|
|
|
/// </summary>
|
|
|
/// <value>The contour.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("等值线")]
|
|
|
[Browsable(false)]
|
|
|
public string Contour { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the faultage.
|
|
|
/// </summary>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("断层")]
|
|
|
[ReadOnly(true)]
|
|
|
[Browsable(true)]
|
|
|
//[Editor(
|
|
|
// "DQ.Construction.NewLook.Editor.EditorDropdownFault, Construction",
|
|
|
// typeof(System.Drawing.Design.UITypeEditor))]
|
|
|
//[TypeConverter(typeof(ParameterUtil.Converter.FilePathConverter))]
|
|
|
public string Faultage { get; set; }
|
|
|
///// <summary>
|
|
|
///// Gets or sets the faultage type.
|
|
|
///// </summary>
|
|
|
//[Category("\t文件")]
|
|
|
//[DisplayName("\t断层类型")]
|
|
|
////[Editor(Config.NameSpace + "EditorDropdownFaultType, KEPlatform",
|
|
|
//// typeof(System.Drawing.Design.UITypeEditor))]
|
|
|
////[TypeConverter(typeof(EnumTypeConverter))]
|
|
|
//public string FaultageType { get; set; }
|
|
|
/// <summary>
|
|
|
/// Gets or sets the file path.
|
|
|
/// </summary>
|
|
|
/// <value>The file path.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("参数文件")]
|
|
|
[Browsable(false)]
|
|
|
public string FilePath { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the input.
|
|
|
/// </summary>
|
|
|
/// <value>The input.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("散点")]
|
|
|
[Browsable(true)]
|
|
|
[ReadOnly(true)]
|
|
|
public string Input { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the outline.
|
|
|
/// </summary>
|
|
|
/// <value>The outline.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("\t\t边界")]
|
|
|
[Browsable(true)]
|
|
|
//[Editor("DQ.Construction.NewLook.Editor.EditorDropdownBorder, Construction",
|
|
|
// typeof(System.Drawing.Design.UITypeEditor))]
|
|
|
//[TypeConverter(typeof(ParameterUtil.Converter.FilePathConverter))]
|
|
|
[ReadOnly(true)]
|
|
|
public string Outline { get; set; }
|
|
|
/// <summary>
|
|
|
/// Gets or sets 编辑类型.
|
|
|
/// </summary>
|
|
|
/// <value>
|
|
|
/// 0,数据边界,1层位边界,2,工区边界
|
|
|
/// </value>
|
|
|
//[Category("\t文件")]
|
|
|
//[DisplayName("\t\t\t边界类型")]
|
|
|
////[Editor(Config.NameSpace + "EditorDropdownBorderType, KEPlatform",
|
|
|
//// typeof(System.Drawing.Design.UITypeEditor))]
|
|
|
////[TypeConverter(typeof(EnumTypeConverter))]
|
|
|
//public string OutlineType { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the output.
|
|
|
/// </summary>
|
|
|
/// <value>The output.</value>
|
|
|
[Category("\t文件")]
|
|
|
[DisplayName("结果")]
|
|
|
[Browsable(false)]
|
|
|
public string Output { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 曲线间隔
|
|
|
/// </summary>
|
|
|
[Category("等值线")]
|
|
|
[DisplayName("\t等值线步长")]
|
|
|
public double CurveSpace
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return this.curveSpace;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
this.curveSpace = value;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 标注间隔
|
|
|
/// </summary>
|
|
|
[Category("等值线")]
|
|
|
[DisplayName("标注间隔")]
|
|
|
public int LableSpace
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return this.lableSpace;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
this.lableSpace = value;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 等值线
|
|
|
/// </summary>
|
|
|
[Category("等值线")]
|
|
|
[DisplayName("控制输出范围")]
|
|
|
[ReadOnly(false)]
|
|
|
public ConverLableType IsLableOutType { get; set; } = ConverLableType.否;
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 等值线
|
|
|
/// </summary>
|
|
|
[Category("等值线")]
|
|
|
[DisplayName("最小值")]
|
|
|
[ReadOnly(true)]
|
|
|
public double LableOutMinValue { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 等值线
|
|
|
/// </summary>
|
|
|
[Category("等值线")]
|
|
|
[DisplayName("最大值")]
|
|
|
[ReadOnly(true)]
|
|
|
public double LableOutMaxValue { get; set; } = 0;
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 收敛参数
|
|
|
/// </summary>
|
|
|
[Category("收敛参数")]
|
|
|
[DisplayName("是否收敛处理")]
|
|
|
[ReadOnly(false)]
|
|
|
public ConverType IsConverType { get; set; } = ConverType.否;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 收敛参数
|
|
|
/// </summary>
|
|
|
[Category("收敛参数")]
|
|
|
[DisplayName("收敛半径")]
|
|
|
[ReadOnly(false)]
|
|
|
public double ConvergentRadius { get; set; } = 10;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 收敛参数
|
|
|
/// </summary>
|
|
|
[Category("收敛参数")]
|
|
|
[DisplayName("收敛临界值")]
|
|
|
[ReadOnly(false)]
|
|
|
public double ConvergentFillValue { get; set; } = 0;
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 网格化算法
|
|
|
/// </summary>
|
|
|
[Category("计算参数")]
|
|
|
[DisplayName("网格化\t\t算法")]
|
|
|
//[TypeConverter(typeof(EnumTypeConverter))]
|
|
|
public ModelCreateType CreateType
|
|
|
{
|
|
|
get;
|
|
|
set;
|
|
|
} = ModelCreateType.XY;
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 边界参数
|
|
|
/// </summary>
|
|
|
[Category("边界参数")]
|
|
|
[DisplayName("\t是否计算边界Z值")]
|
|
|
[ReadOnly(false)]
|
|
|
public ConverType IsOutLineZ { get; set; } = ConverType.否;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 边界参数
|
|
|
/// </summary>
|
|
|
[Category("边界参数")]
|
|
|
[DisplayName("边界Z值")]
|
|
|
[ReadOnly(false)]
|
|
|
public double OutLineZ { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 计算参数
|
|
|
/// </summary>
|
|
|
[Category("计算参数")]
|
|
|
[DisplayName("网格化输出控制")]
|
|
|
[ReadOnly(false)]
|
|
|
public ConverGridType IsModelOutType { get; set; } = ConverGridType.否;
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 计算参数
|
|
|
/// </summary>
|
|
|
[Category("计算参数")]
|
|
|
[DisplayName("最小值")]
|
|
|
[ReadOnly(true)]
|
|
|
public double ModelOutMinValue { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 计算参数
|
|
|
/// </summary>
|
|
|
[Category("计算参数")]
|
|
|
[DisplayName("最大值")]
|
|
|
[ReadOnly(true)]
|
|
|
public double ModelOutMaxValue { get; set; } = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets the file path.
|
|
|
/// </summary>
|
|
|
/// <value>The file path.</value>
|
|
|
[Category("其它数据")]
|
|
|
[DisplayName("是否生成井斜")]
|
|
|
public ConverType IsAddSlantWell { get; set; } = ConverType.是;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Gets or sets 深度类型.
|
|
|
/// </summary>
|
|
|
/// <value>The file path.</value>
|
|
|
[Category("其它数据")]
|
|
|
[DisplayName("深度类型")]
|
|
|
[Browsable(false)]
|
|
|
[ReadOnly(true)]
|
|
|
public int DepthType { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 相对路径
|
|
|
/// </summary>
|
|
|
[Browsable(false)]
|
|
|
public string DataRootPath
|
|
|
{
|
|
|
get;
|
|
|
set;
|
|
|
}
|
|
|
public GridCreateParameter() { }
|
|
|
public GridCreateParameter(GridCreateParameter other)
|
|
|
{
|
|
|
if(other == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
this.Input = other.Input;
|
|
|
this.Outline = other.Outline;
|
|
|
this.Faultage = other.Faultage;
|
|
|
this.Output = other.Output;
|
|
|
this.Contour = other.Contour;
|
|
|
this.Smooth = other.Smooth;
|
|
|
|
|
|
this.Times = other.Times;
|
|
|
this.XMin = other.XMin;
|
|
|
this.YMin = other.YMin;
|
|
|
this.XMax = other.XMax;
|
|
|
this.YMax = other.YMax;
|
|
|
this.ZMin = other.ZMin;
|
|
|
this.ZMax = other.ZMax;
|
|
|
this.Auto = other.Auto;
|
|
|
this.CurveSpace = other.CurveSpace;
|
|
|
this.LableSpace = other.LableSpace;
|
|
|
|
|
|
//paraOther.M = this.M;
|
|
|
//paraOther.N = this.N;
|
|
|
this.XStep = other.XStep;
|
|
|
this.YStep = other.YStep;
|
|
|
|
|
|
this.FilePath = other.FilePath;
|
|
|
this.CreateType = other.CreateType;
|
|
|
//this.OutlineType = other.OutlineType;
|
|
|
//this.FaultageType = other.FaultageType;
|
|
|
|
|
|
//paraOther.AddOtherData = this.AddOtherData;
|
|
|
//// Type type = this.OtherData.GetType();
|
|
|
//if (this.OtherData != null)
|
|
|
//{
|
|
|
// paraOther.OtherData = ObjectClone<MergeTemplate, MergeTemplate>.CloneFrom(this.OtherData);
|
|
|
//}
|
|
|
|
|
|
this.DataRootPath = other.DataRootPath;
|
|
|
|
|
|
this.IsModelOutType = other.IsModelOutType;
|
|
|
this.ModelOutMaxValue = other.ModelOutMaxValue;
|
|
|
this.ModelOutMinValue = other.ModelOutMinValue;
|
|
|
|
|
|
this.IsLableOutType = other.IsLableOutType;
|
|
|
this.LableOutMaxValue = other.LableOutMaxValue;
|
|
|
this.LableOutMinValue = other.LableOutMinValue;
|
|
|
|
|
|
this.DepthType = other.DepthType;
|
|
|
|
|
|
this.IsConverType = other.IsConverType;
|
|
|
this.ConvergentFillValue = other.ConvergentFillValue;
|
|
|
this.ConvergentRadius = other.ConvergentRadius;
|
|
|
this.IsAddSlantWell = other.IsAddSlantWell;
|
|
|
this.IsOutLineZ = other.IsOutLineZ;
|
|
|
this.OutLineZ = other.OutLineZ;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// Initializes a new instance of the <see cref="Parameter"/> class.
|
|
|
/// </summary>
|
|
|
/// <param name="filePath">The file path.</param>
|
|
|
public GridCreateParameter(string filePath)
|
|
|
{
|
|
|
this.FilePath = filePath;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Clones 一个新对象.
|
|
|
/// </summary>
|
|
|
public virtual GridCreateParameter Clone()
|
|
|
{
|
|
|
return new GridCreateParameter(this);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Reads the data.
|
|
|
/// </summary>
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
|
public virtual bool ReadData()
|
|
|
{
|
|
|
string strFilePath = this.FilePath;
|
|
|
if (!this.FilePath.StartsWith(this.DataRootPath))
|
|
|
{
|
|
|
strFilePath = Path.Combine(this.DataRootPath, this.FilePath);
|
|
|
}
|
|
|
if (!File.Exists(strFilePath))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
var parser = new FileIniDataParser();
|
|
|
// 自动检测编码
|
|
|
Encoding encoding = Encoding.Default;
|
|
|
var dector = CharsetDetector.DetectFromFile(strFilePath);
|
|
|
if (dector.Detected != null && dector.Detected.HasBOM == true && dector.Detected.Encoding != null)
|
|
|
{
|
|
|
encoding = dector.Detected.Encoding;
|
|
|
}
|
|
|
IniData data = parser.ReadFile(strFilePath, encoding);
|
|
|
this.Input = data["pages"]["input"];// INIHelper.Read("pages", "input", string.Empty, strFilePath);
|
|
|
this.Output = data["pages"]["output"]; // INIHelper.Read("pages", "output", string.Empty, strFilePath);
|
|
|
this.Faultage = data["pages"]["faultage"]; // INIHelper.Read("pages", "faultage", string.Empty, strFilePath);
|
|
|
this.Outline = data["pages"]["outline"]; // INIHelper.Read("pages", "outline", string.Empty, strFilePath);
|
|
|
this.Contour = data["pages"]["contour"]; // INIHelper.Read("pages", "contour", string.Empty, strFilePath);
|
|
|
string strSmooth = data["pages"]["smooth"]; // INIHelper.Read("pages", "smooth", string.Empty, strFilePath);
|
|
|
if (strSmooth.Length > 0)
|
|
|
{
|
|
|
this.Smooth = Convert.ToInt32(strSmooth);
|
|
|
}
|
|
|
|
|
|
string strM = data["pages"]["m"]; // INIHelper.Read("pages", "m", string.Empty, strFilePath);
|
|
|
if (strM.Length > 0)
|
|
|
{
|
|
|
this.M = Convert.ToInt32(strM);
|
|
|
}
|
|
|
|
|
|
string strN = data["pages"]["n"]; // INIHelper.Read("pages", "n", string.Empty, strFilePath);
|
|
|
if (strN.Length > 0)
|
|
|
{
|
|
|
this.N = Convert.ToInt32(strN);
|
|
|
}
|
|
|
|
|
|
string strTimes = data["pages"]["times"]; // INIHelper.Read("pages", "times", string.Empty, strFilePath);
|
|
|
if (strTimes.Length > 0)
|
|
|
{
|
|
|
this.Times = Convert.ToInt32(strTimes);
|
|
|
}
|
|
|
|
|
|
string strXmin = data["pages"]["xmin"]; // INIHelper.Read("pages", "xmin", string.Empty, strFilePath);
|
|
|
if (strXmin.Length > 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.XMin = Convert.ToDouble(strXmin);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.XMin = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strYmin = data["pages"]["ymin"]; // INIHelper.Read("pages", "ymin", string.Empty, strFilePath);
|
|
|
if (strYmin.Length > 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.YMin = Convert.ToDouble(strYmin);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.YMin = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strXmax = data["pages"]["xmax"]; //INIHelper.Read("pages", "xmax", string.Empty, strFilePath);
|
|
|
if (strXmax.Length > 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.XMax = Convert.ToDouble(strXmax);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.XMax = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strYmax = data["pages"]["ymax"]; //INIHelper.Read("pages", "ymax", string.Empty, strFilePath);
|
|
|
if (strYmax.Length > 0)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.YMax = Convert.ToDouble(strYmax);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.YMax = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strZMin = data["pages"]["zmin"]; // INIHelper.Read("pages", "zmin", string.Empty, strFilePath);
|
|
|
if (!string.IsNullOrEmpty(strZMin))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.ZMin = Convert.ToDouble(strZMin);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.ZMin = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strZMax = data["pages"]["zmax"]; // INIHelper.Read("pages", "zmax", string.Empty, strFilePath);
|
|
|
if (!string.IsNullOrEmpty(strZMax))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
this.ZMax = Convert.ToDouble(strZMax);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
this.ZMax = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string strAuto = data["pages"]["auto"];// INIHelper.Read("pages", "auto", string.Empty, strFilePath);
|
|
|
if (strAuto.Length > 0)
|
|
|
{
|
|
|
this.Auto = Convert.ToInt32(strAuto);
|
|
|
}
|
|
|
|
|
|
string strCurveSpace = data["curve"]["curveSpace"]; // INIHelper.Read("curve", "curveSpace", "5", strFilePath);
|
|
|
if (strCurveSpace.Length > 0)
|
|
|
{
|
|
|
if (double.TryParse(strCurveSpace, out this.curveSpace) == false)
|
|
|
{
|
|
|
this.curveSpace = double.NaN;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
curveSpace = 5;
|
|
|
}
|
|
|
|
|
|
string strLableSpace = data["curve"]["lableSpace"];// INIHelper.Read("curve", "lableSpace", "5", strFilePath);
|
|
|
if (strLableSpace.Length > 0)
|
|
|
{
|
|
|
this.lableSpace = Convert.ToInt32(strLableSpace);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.lableSpace = 5;
|
|
|
}
|
|
|
string strCreateType = data["other"]["createType"]; // INIHelper.Read("other", "createType", "0", strFilePath);
|
|
|
if (strCreateType.Length > 0)
|
|
|
{
|
|
|
this.CreateType = (ModelCreateType)Convert.ToInt32(strCreateType);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.CreateType = 0;
|
|
|
}
|
|
|
//string strOutLineType = INIHelper.Read("other", "outlineType", "0", strFilePath);
|
|
|
//if (strOutLineType.Length > 0)
|
|
|
//{
|
|
|
// this.OutlineType = (EnumOutlineType)Convert.ToInt32(strOutLineType);
|
|
|
//}
|
|
|
//string strFaultageType = INIHelper.Read("other", "faultageType", "0", strFilePath);
|
|
|
//if (strFaultageType.Length > 0)
|
|
|
//{
|
|
|
// this.FaultageType = (EnumFaultType)Convert.ToInt32(strFaultageType);
|
|
|
//}
|
|
|
string strAddSlantWell = data["other"]["IsAddSlantWell"];
|
|
|
if (string.IsNullOrEmpty(strAddSlantWell))
|
|
|
{
|
|
|
strAddSlantWell = "是";
|
|
|
}
|
|
|
this.IsAddSlantWell = GetVauleByType<ConverType>(strAddSlantWell);//INIHelper.Read("other", "IsAddSlantWell", "是", strFilePath));
|
|
|
string strTmp = data["other"]["DepthType"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.DepthType = GetVauleByType<int>(strTmp);
|
|
|
strTmp = data["curve"]["outType"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "否";
|
|
|
}
|
|
|
this.IsLableOutType = GetVauleByType<ConverLableType>(strTmp);// INIHelper.Read("curve", "outType", "否", strFilePath));
|
|
|
strTmp = data["curve"]["outMinValue"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.LableOutMinValue = GetVauleByType<double>(strTmp); //INIHelper.Read("curve", "outMinValue", "0", strFilePath));
|
|
|
strTmp = data["curve"]["outMaxValue"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.LableOutMaxValue = GetVauleByType<double>(strTmp);// INIHelper.Read("curve", "outMaxValue", "0", strFilePath));
|
|
|
strTmp = data["model"]["outType"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "否";
|
|
|
}
|
|
|
this.IsModelOutType = GetVauleByType<ConverGridType>(strTmp);// INIHelper.Read("model", "outType", "否", strFilePath));
|
|
|
strTmp = data["model"]["outMinValue"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.ModelOutMinValue = GetVauleByType<double>(strTmp);// INIHelper.Read("model", "outMinValue", "0", strFilePath));
|
|
|
strTmp = data["model"]["outMaxValue"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.ModelOutMaxValue = GetVauleByType<double>(strTmp); // INIHelper.Read("model", "outMaxValue", "0", strFilePath));
|
|
|
strTmp = data["conver"]["converType"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "否";
|
|
|
}
|
|
|
this.IsConverType = GetVauleByType<ConverType>(strTmp); // INIHelper.Read("conver", "converType", "否", strFilePath));
|
|
|
strTmp = data["conver"]["convergentRadius"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.ConvergentRadius = GetVauleByType<double>(strTmp);// INIHelper.Read("conver", "convergentRadius", "0", strFilePath));
|
|
|
strTmp = data["conver"]["convergentFillValue"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.ConvergentFillValue = GetVauleByType<double>(strTmp);// INIHelper.Read("conver", "convergentFillValue", "0", strFilePath));
|
|
|
strTmp = data["curve"]["IsOutLineZ"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "否";
|
|
|
}
|
|
|
this.IsOutLineZ = GetVauleByType<ConverType>(strTmp); // INIHelper.Read("curve", "IsOutLineZ", "否", strFilePath));
|
|
|
strTmp = data["curve"]["OutLineZ"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "0";
|
|
|
}
|
|
|
this.OutLineZ = GetVauleByType<double>(strTmp); // INIHelper.Read("curve", "OutLineZ", "0", strFilePath));
|
|
|
|
|
|
strTmp = data["other"]["IsAddSlantWell"];
|
|
|
if (string.IsNullOrEmpty(strTmp))
|
|
|
{
|
|
|
strTmp = "1";
|
|
|
}
|
|
|
this.IsAddSlantWell = (ConverType)Convert.ToInt32(strTmp);
|
|
|
//string strSlantWell = INIHelper.Read("other", "IsAddSlantWell", "1", strFilePath);
|
|
|
//if (strSlantWell.Length > 0)
|
|
|
//{
|
|
|
// this.IsAddSlantWell = (ConverType)Convert.ToInt32(strSlantWell);
|
|
|
//}
|
|
|
|
|
|
//string strFileName = Path.GetFileNameWithoutExtension(strFilePath);
|
|
|
//string strDir = Path.GetDirectoryName(strFilePath);
|
|
|
//string strFileMerge = Path.Combine(strDir, $"{strFileName}.merge");
|
|
|
//if (File.Exists(strFileMerge))
|
|
|
//{
|
|
|
// MergeTemplate template = null;
|
|
|
// try
|
|
|
// {
|
|
|
// using (XmlReader reader = XmlReader.Create(strFileMerge))
|
|
|
// {
|
|
|
// XmlSerializer formatter = new XmlSerializer(typeof(MergeTemplate));
|
|
|
// template = formatter.Deserialize(reader) as MergeTemplate;
|
|
|
// }
|
|
|
// this.OtherData = template;
|
|
|
// }
|
|
|
// catch
|
|
|
// {
|
|
|
// template = null;
|
|
|
// }
|
|
|
//}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 返回转换后值
|
|
|
/// </summary>
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
/// <param name="input"></param>
|
|
|
/// <returns></returns>
|
|
|
private T GetVauleByType<T>(string input)
|
|
|
{
|
|
|
input = input.Trim();
|
|
|
object obj = default(T);
|
|
|
if (typeof(T) == typeof(double))
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(input))
|
|
|
{
|
|
|
obj = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
obj = Convert.ToDouble(input);
|
|
|
}
|
|
|
}
|
|
|
else if(typeof(T) == typeof(int))
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(input))
|
|
|
{
|
|
|
obj = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
obj = Convert.ToInt32(input);
|
|
|
}
|
|
|
}
|
|
|
else if (typeof(T) == typeof(ConverType))
|
|
|
{
|
|
|
if (input.Equals("是"))
|
|
|
{
|
|
|
obj = ConverType.是;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
obj = ConverType.否;
|
|
|
}
|
|
|
}
|
|
|
else if (typeof(T) == typeof(ConverLableType))
|
|
|
{
|
|
|
if (input.Equals("是"))
|
|
|
{
|
|
|
obj = ConverLableType.是;
|
|
|
}
|
|
|
else if (input.Equals("与网格同步"))
|
|
|
{
|
|
|
obj = ConverLableType.与网格同步;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
obj = ConverLableType.否;
|
|
|
}
|
|
|
}
|
|
|
else if (typeof(T) == typeof(ConverGridType))
|
|
|
{
|
|
|
if (input.Equals("抹平"))
|
|
|
{
|
|
|
obj = ConverGridType.抹平;
|
|
|
}
|
|
|
else if (input.Equals("剔除"))
|
|
|
{
|
|
|
obj = ConverGridType.剔除;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
obj = ConverGridType.否;
|
|
|
}
|
|
|
}
|
|
|
return (T)obj;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Writes the data.
|
|
|
/// </summary>
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
|
public virtual bool WriteData()
|
|
|
{
|
|
|
string strFilePath = this.FilePath;
|
|
|
if (string.IsNullOrEmpty(strFilePath))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
if (!this.FilePath.StartsWith(this.DataRootPath))
|
|
|
{
|
|
|
strFilePath = Path.Combine(this.DataRootPath, this.FilePath);
|
|
|
this.FilePath = strFilePath;
|
|
|
|
|
|
var folder = Directory.GetParent(this.FilePath).FullName;
|
|
|
if (!Directory.Exists(folder))
|
|
|
{
|
|
|
Directory.CreateDirectory(folder);
|
|
|
}
|
|
|
}
|
|
|
using (StreamWriter sw = new StreamWriter(strFilePath, false, Encoding.Default))
|
|
|
{
|
|
|
string strContent =
|
|
|
$@"[pages]
|
|
|
input={this.Input}
|
|
|
output={this.Output}
|
|
|
faultage={this.Faultage}
|
|
|
outline={this.Outline}
|
|
|
contour={this.Contour}
|
|
|
smooth={ this.Smooth}
|
|
|
m={this.M}
|
|
|
n={this.N}
|
|
|
times={this.Times}
|
|
|
xmin={this.XMin}
|
|
|
ymin={this.YMin}
|
|
|
xmax={this.XMax}
|
|
|
ymax={this.YMax}
|
|
|
auto={this.Auto}
|
|
|
zmin={this.ZMin}
|
|
|
zmax={this.ZMax}
|
|
|
[curve]
|
|
|
curveSpace={this.CurveSpace}
|
|
|
lableSpace={this.LableSpace}
|
|
|
outType ={ this.IsLableOutType}
|
|
|
outMinValue ={ this.LableOutMinValue}
|
|
|
outMaxValue ={ this.LableOutMaxValue}
|
|
|
IsOutLineZ ={ this.IsOutLineZ}
|
|
|
OutLineZ ={ this.OutLineZ}
|
|
|
[model]
|
|
|
outType ={ this.IsModelOutType}
|
|
|
outMinValue ={ this.ModelOutMinValue}
|
|
|
outMaxValue ={ this.ModelOutMaxValue}
|
|
|
[other]
|
|
|
createType={(int)this.CreateType}
|
|
|
|
|
|
IsAddSlantWell={(int)this.IsAddSlantWell}
|
|
|
[conver]
|
|
|
converType={this.IsConverType}
|
|
|
convergentFillValue ={this.ConvergentFillValue}
|
|
|
convergentRadius ={this.ConvergentRadius}";
|
|
|
sw.Write(strContent);
|
|
|
}
|
|
|
//outlineType={(int)this.OutlineType}
|
|
|
//faultageType={(int)this.FaultageType}
|
|
|
//WriteTemplate();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
//public bool WriteTemplate()
|
|
|
//{
|
|
|
// string strFilePath = this.FilePath;
|
|
|
// string strFileName = Path.GetFileNameWithoutExtension(strFilePath);
|
|
|
// string strDir = Path.GetDirectoryName(strFilePath);
|
|
|
// string strFileMerge = Path.Combine(strDir, $"{strFileName}.merge");
|
|
|
|
|
|
// XmlWriterSettings settings = new XmlWriterSettings();
|
|
|
// settings.Indent = true;
|
|
|
// settings.IndentChars = " ";
|
|
|
// settings.NewLineChars = "\r\n";
|
|
|
// settings.Encoding = Encoding.Default;
|
|
|
// try
|
|
|
// {
|
|
|
// MemoryStream mem = new MemoryStream();
|
|
|
// using (XmlWriter writer = XmlWriter.Create(mem, settings))
|
|
|
// {
|
|
|
// // 去除默认命名空间xmlns:xsd和xmlns:xsi
|
|
|
// XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
|
|
|
// ns.Add(string.Empty, string.Empty);
|
|
|
|
|
|
// XmlSerializer formatter = new XmlSerializer(typeof(MergeTemplate));
|
|
|
// formatter.Serialize(writer, OtherData, ns);
|
|
|
// }
|
|
|
// string strData = Encoding.Default.GetString(mem.ToArray());
|
|
|
// File.WriteAllText(strFileMerge, strData, Encoding.Default);
|
|
|
// }
|
|
|
// catch (Exception ex)
|
|
|
// {
|
|
|
// Trace.WriteLine(ex.Message);
|
|
|
// }
|
|
|
// return true;
|
|
|
//}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 边界类型
|
|
|
/// </summary>
|
|
|
public enum EnumOutlineType
|
|
|
{
|
|
|
无 = 0,
|
|
|
层位边界,
|
|
|
工区边界
|
|
|
}
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public enum EnumFaultType
|
|
|
{
|
|
|
无 = 0,
|
|
|
层位断层,
|
|
|
}
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public enum ConverType
|
|
|
{
|
|
|
否 = 0,
|
|
|
是
|
|
|
}
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public enum ConverLableType
|
|
|
{
|
|
|
否 = 0,
|
|
|
是,
|
|
|
与网格同步
|
|
|
}
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public enum ConverGridType
|
|
|
{
|
|
|
否 = 0,
|
|
|
剔除 = 1,
|
|
|
抹平 = 2,
|
|
|
抹平固定值 = 3,
|
|
|
}
|
|
|
public enum ModelCreateType
|
|
|
{
|
|
|
[Description("最小张力")]
|
|
|
XY = 0,
|
|
|
[Description("反距离加权")]
|
|
|
IDM = 1,
|
|
|
[Description("自然临近")]
|
|
|
NatureNeighbor = 2,
|
|
|
[Description("最小曲率")]
|
|
|
Curvature = 3,
|
|
|
[Description("快速网格化")]
|
|
|
QuikGrid = 4,
|
|
|
[Description("样条插值法")]
|
|
|
GmtSplineGrid = 5,
|
|
|
}
|
|
|
}
|