108 lines
2.8 KiB
C#
108 lines
2.8 KiB
C#
using Autodesk.Revit.DB;
|
|
|
|
namespace GeologyToolkit
|
|
{
|
|
internal class SoilLayer
|
|
{
|
|
public double TopElev => GetTopElev();
|
|
public double BottomElev => GetBottomElev();
|
|
public Borehole Ower { get; set; }
|
|
|
|
/// <summary>
|
|
/// 土层厚度
|
|
/// </summary>
|
|
public double Thickness { get; set; }
|
|
|
|
public FamilyInstance RvInstance { get; set; }
|
|
|
|
/// <summary>
|
|
/// 土层序号
|
|
/// </summary>
|
|
public int SerialNum { get; set; }
|
|
|
|
public string Color { get; set; }
|
|
|
|
/// <summary>
|
|
/// 风化程度
|
|
/// </summary>
|
|
public string DegreeofWeathering { get; set; }
|
|
|
|
/// <summary>
|
|
/// 其他描述
|
|
/// </summary>
|
|
public string OtherDescription { get; set; }
|
|
|
|
/// <summary>
|
|
/// 颜色代码
|
|
/// </summary>
|
|
public string MaterialCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 钻孔编号
|
|
/// </summary>
|
|
public string BoreholeNum { get; set; }
|
|
|
|
/// <summary>
|
|
/// 土层名称
|
|
/// </summary>
|
|
public string Name { get; set; }
|
|
|
|
private double GetBottomElev()
|
|
{
|
|
double bottom = Ower.Elev;
|
|
for (int i = 0; i < Ower.SoilLayers.Count; i++)
|
|
{
|
|
if (i > SerialNum)
|
|
{
|
|
break;
|
|
}
|
|
|
|
bottom -= Ower.SoilLayers[i].Thickness;
|
|
}
|
|
|
|
return bottom;
|
|
}
|
|
|
|
private double GetTopElev()
|
|
{
|
|
double top = Ower.Elev;
|
|
for (int i = 0; i < Ower.SoilLayers.Count; i++)
|
|
{
|
|
if (i == SerialNum)
|
|
{
|
|
break;
|
|
}
|
|
|
|
top -= Ower.SoilLayers[i].Thickness;
|
|
}
|
|
|
|
return top;
|
|
}
|
|
|
|
///// <summary>
|
|
///// 相等操作为于土层编号相等,与土层位置无关
|
|
///// </summary>
|
|
///// <param name="obj"></param>
|
|
///// <returns></returns>
|
|
//public override bool Equals(object obj)
|
|
//{
|
|
// if (obj == null)//步骤1
|
|
// return false;
|
|
// if (this.GetType() != obj.GetType())//步骤3
|
|
// return false;
|
|
// if (ReferenceEquals(this, obj))
|
|
// return true;
|
|
// if (this.MaterialCode == ((SoilLayer)obj).MaterialCode)
|
|
// {
|
|
// return true;
|
|
// }
|
|
// return Equals((SoilLayer)obj);//步骤4
|
|
// //return base.Equals(obj);
|
|
//}
|
|
|
|
//public override int GetHashCode()
|
|
//{
|
|
// return MaterialCode != null ? StringComparer.InvariantCulture.GetHashCode(MaterialCode) : 0;
|
|
//}
|
|
}
|
|
} |