public PipeSection(double width, double height, HorizontalPos horPos, VerticalPos vtPos, double thick) : base(SecShape.RectangleRing) { this._width = width; this._height = height; this._thick = thick; this._horPos = horPos; this._vtPos = vtPos; base._segCount = 4; base._offX = base.HorOffset(this._horPos, this._width); base._offY = base.VtOffset(this._vtPos, this._height); base._vtxs = new double[(base._segCount + 1) * 4]; base._vtxs[0] = this._width / 2.0; base._vtxs[1] = this._height / 2.0; base._vtxs[2] = (this._width / 2.0) - this._thick; base._vtxs[3] = (this._height / 2.0) - this._thick; base._vtxs[4] = this._width / 2.0; base._vtxs[5] = -(this._height / 2.0); base._vtxs[6] = base._offX + ((this._width / 2.0) - this._thick); base._vtxs[7] = -((this._height / 2.0) - this._thick); base._vtxs[8] = -(this._width / 2.0); base._vtxs[9] = -(this._height / 2.0); base._vtxs[10] = -((this._width / 2.0) - this._thick); base._vtxs[11] = -((this._height / 2.0) - this._thick); base._vtxs[12] = -(this._width / 2.0); base._vtxs[13] = this._height / 2.0; base._vtxs[14] = -((this._width / 2.0) - this._thick); base._vtxs[15] = (this._height / 2.0) - this._thick; base._vtxs[0x10] = this._width / 2.0; base._vtxs[0x11] = this._height / 2.0; base._vtxs[0x12] = (this._width / 2.0) - this._thick; base._vtxs[0x13] = (this._height / 2.0) - this._thick; }
private double _width; // 管线管径宽度 // Methods #region 管线截面构造函数 public PipeSection(IPolygon SecGeometry, double Thick) : base(SecShape.PolygonRing) { this._horPos = HorizontalPos.Center; this._vtPos = VerticalPos.Center; base._offX = 0.0; base._offY = 0.0; }
/// <summary> /// 计算垂直偏移 /// </summary> /// <param name="vtPos"></param> /// <param name="height"></param> /// <returns></returns> protected double VtOffset(VerticalPos vtPos, double height) { switch (vtPos) { case VerticalPos.Top: return(-0.5 * height); case VerticalPos.Bottom: return(0.5 * height); } return(0.0); }
public PipeSection(double dia, int segCount, HorizontalPos horPos, VerticalPos vtPos, double thick) : base(SecShape.CircleRing) { this._width = dia; this._height = 0.0; this._thick = thick; this._horPos = horPos; this._vtPos = vtPos; base._segCount = segCount; base._offX = base.HorOffset(this._horPos, this._width); base._offY = base.VtOffset(this._vtPos, this._width); double num = 6.2831853071795862; double num2 = 6.2831853071795862 / ((double)base.SegCount); base._vtxs = new double[(base._segCount + 1) * 4]; for (int i = 0; i <= base._segCount; i++) { base._vtxs[i * 4] = Math.Cos(num - (i * num2)) * (this._width / 2.0); base._vtxs[(i * 4) + 1] = Math.Sin(num - (i * num2)) * (this._width / 2.0); base._vtxs[(i * 4) + 2] = Math.Cos(num - (i * num2)) * ((this._width / 2.0) - this._thick); base._vtxs[(i * 4) + 3] = Math.Sin(num - (i * num2)) * ((this._width / 2.0) - this._thick); } }
public override void Init() { try { base.Init(); FacilityClass fac = this._facClassReg.FacilityType; if (fac == null) { return; } #region 设置管径 bool bHaveDia1 = false; bool bHaveDia2 = false; bool bHaveDia = false; DFDataConfig.Class.FieldInfo fiDiameter1 = fac.GetFieldInfoBySystemName("Diameter1"); if (fiDiameter1 != null) { int indexDiameter1 = this._rowInfo.FieldIndex(fiDiameter1.Name); if (indexDiameter1 != -1) { string diaInfo1 = ""; if (!this._rowInfo.IsNull(indexDiameter1) && !string.IsNullOrEmpty(diaInfo1 = this._rowInfo.GetValue(indexDiameter1).ToString())) { this._dia1 = double.Parse(diaInfo1) * 0.001; bHaveDia1 = true; } } } DFDataConfig.Class.FieldInfo fiDiameter2 = fac.GetFieldInfoBySystemName("Diameter2"); if (fiDiameter2 != null) { int indexDiameter2 = this._rowInfo.FieldIndex(fiDiameter2.Name); if (indexDiameter2 != -1) { string diaInfo2 = ""; if (!this._rowInfo.IsNull(indexDiameter2) && !string.IsNullOrEmpty(diaInfo2 = this._rowInfo.GetValue(indexDiameter2).ToString())) { this._dia2 = double.Parse(diaInfo2) * 0.001; bHaveDia2 = true; } } } if (bHaveDia1 && bHaveDia2) { bHaveDia = true; } else { DFDataConfig.Class.FieldInfo fiDiameter = fac.GetFieldInfoBySystemName("Diameter"); if (fiDiameter != null) { int indexDiameter = this._rowInfo.FieldIndex(fiDiameter.Name); if (indexDiameter != -1) { string diaInfo = ""; string coverstyle = ""; if (!this._rowInfo.IsNull(indexDiameter) && !string.IsNullOrEmpty(diaInfo = this._rowInfo.GetValue(indexDiameter).ToString())) { DFDataConfig.Class.FieldInfo fiCoverStyle = fac.GetFieldInfoBySystemName("CoverStyle"); if (fiCoverStyle != null) { int indexCoverStyle = this._rowInfo.FieldIndex(fiCoverStyle.Name); if (indexCoverStyle != -1 && !this._rowInfo.IsNull(indexCoverStyle)) { coverstyle = this._rowInfo.GetValue(indexCoverStyle).ToString(); } } SplitDiameter(diaInfo, coverstyle, out this._dia1, out this._dia2); if (this._rowInfo.FieldIndex(fiDiameter.Name + "1") != -1) { this._rowInfo.SetValue(this._rowInfo.FieldIndex(fiDiameter.Name + "1"), this._dia1); } if (this._rowInfo.FieldIndex(fiDiameter.Name + "2") != -1) { this._rowInfo.SetValue(this._rowInfo.FieldIndex(fiDiameter.Name + "2"), this._dia1); } bHaveDia = true; this._dia1 *= 0.001; this._dia2 *= 0.001; } } } } if (!bHaveDia || (this._dia1 < 0.000001 && this._dia2 < 0.000001)) { this._dia1 = 0.05; this._dia2 = 0.0; } this._segtype = GetSegType(this._dia1, this._dia2); #endregion // 设置管线对象二维Shape数据-顶点坐标\高程信息 IPolyline route = null; if ((this._style != null) && (this._style is PipeLineStyleClass)) { PipeLineStyleClass style = this._style as PipeLineStyleClass; switch (style.HeightParam) { case HeightParam.PipeHeight: DFDataConfig.Class.FieldInfo fiStartHeight = fac.GetFieldInfoBySystemName("StartHeight"); if (fiStartHeight != null) { int indexStartHeight = this._rowInfo.FieldIndex(fiStartHeight.Name); if (indexStartHeight != -1) { this._sheight = Fac.GetDouble(base._rowInfo, indexStartHeight); if (double.IsNaN(this._sheight)) { this._sheight = 0.0; } } } DFDataConfig.Class.FieldInfo fiEndHeight = fac.GetFieldInfoBySystemName("EndHeight"); if (fiEndHeight != null) { int indexEndHeight = this._rowInfo.FieldIndex(fiEndHeight.Name); if (indexEndHeight != -1) { this._eheight = Fac.GetDouble(base._rowInfo, indexEndHeight); } if (double.IsNaN(this._eheight)) { this._eheight = 0.0; } } // 根据管线起始点高程计算中间点高程,并替换设施对象中Shape二维数据 if (this.GetPipeLineVertexs(base._geoGroup[2], this._sheight, this._eheight, out route)) { base._geoGroup[1] = route; base.SetValue("Shape", base._geoGroup[1]); } break; case HeightParam.LineSurfH2Deep: DFDataConfig.Class.FieldInfo fiStartSurfHeight = fac.GetFieldInfoBySystemName("StartSurfHeight"); if (fiStartSurfHeight != null) { int indexStartSurfHeight = this._rowInfo.FieldIndex(fiStartSurfHeight.Name); if (indexStartSurfHeight != -1) { this._ssurfh = Fac.GetDouble(base._rowInfo, indexStartSurfHeight); if (double.IsNaN(this._ssurfh)) { this._ssurfh = 0.0; } } } DFDataConfig.Class.FieldInfo fiStartDepth = fac.GetFieldInfoBySystemName("StartDepth"); if (fiStartDepth != null) { int indexStartDepth = this._rowInfo.FieldIndex(fiStartDepth.Name); if (indexStartDepth != -1) { this._sdeep = Fac.GetDouble(base._rowInfo, indexStartDepth); if (double.IsNaN(this._sdeep)) { this._sdeep = 0.0; } } } DFDataConfig.Class.FieldInfo fiEndSurfHeight = fac.GetFieldInfoBySystemName("EndSurfHeight"); if (fiEndSurfHeight != null) { int indexEndSurfHeight = this._rowInfo.FieldIndex(fiEndSurfHeight.Name); if (indexEndSurfHeight != -1) { this._esurfh = Fac.GetDouble(base._rowInfo, indexEndSurfHeight); if (double.IsNaN(this._esurfh)) { this._esurfh = 0.0; } } } DFDataConfig.Class.FieldInfo fiEndDepth = fac.GetFieldInfoBySystemName("EndDepth"); if (fiEndDepth != null) { int indexEndDepth = this._rowInfo.FieldIndex(fiEndDepth.Name); if (indexEndDepth != -1) { this._edeep = Fac.GetDouble(base._rowInfo, indexEndDepth); if (double.IsNaN(this._edeep)) { this._edeep = 0.0; } } } this._sheight = this._ssurfh - this._sdeep; this._eheight = this._esurfh - this._edeep; // 根据管线起始点高程计算中间点高程,并替换设施对象中Shape二维数据 if (this.GetPipeLineVertexs(base._geoGroup[2], this._sheight, this._eheight, out route)) { base._geoGroup[1] = route; base.SetValue("Shape", base._geoGroup[1]); } break; case HeightParam.PipeVertexHeight: this.GetPipeLineVertexs(base._geoGroup[1], out route); this._sheight = double.IsNaN(route.StartPoint.Z) ? 0.0 : route.StartPoint.Z; this._eheight = double.IsNaN(route.EndPoint.Z) ? 0.0 : route.EndPoint.Z; // 替换设施对象中缓存行\Shape二维数据 base._geoGroup[1] = route; base.SetValue("Shape", route); break; case HeightParam.Unkown: this._sheight = double.IsNaN(route.StartPoint.Z) ? 0.0 : route.StartPoint.Z; this._eheight = double.IsNaN(route.EndPoint.Z) ? 0.0 : route.EndPoint.Z; this.SimplifyPolyline(base._geoGroup[1], out route); // 替换设施对象中缓存行\Shape二维数据 base._geoGroup[1] = route; base.SetValue("Shape", route); break; } switch (style.HeightMode) { case HeightMode.Top: this._vPos = VerticalPos.Top; break; case HeightMode.Bottom: this._vPos = VerticalPos.Bottom; break; default: this._vPos = VerticalPos.Center; break; } // 重新设置高程选项,针对同类管线中高程设置不一致的情况 DFDataConfig.Class.FieldInfo fiHLB = fac.GetFieldInfoBySystemName("HLB"); if (fiHLB != null) { int indexHLB = this._rowInfo.FieldIndex(fiHLB.Name); if (indexHLB != -1) { string hlb = base._rowInfo.GetValue(indexHLB).ToString(); if (hlb.Contains("内")) { this._vPos = VerticalPos.Bottom; } else if (hlb.Contains("外")) { this._vPos = VerticalPos.Top; } else { this._vPos = VerticalPos.Center; } } } } } catch (Exception exception) { } }
public PipeSection(double width, double height, HorizontalPos horPos, VerticalPos vtPos, double thick, int flag) { this._width = width; this._height = height; this._thick = thick; this._horPos = horPos; this._vtPos = vtPos; if (height == 0.0) { // 根据管径分配片面数 FX 2014.09.18 //base._segCount = DrawGeometry.PipeSegments; //base._segCount = Int32.Parse(Config.GetConfigValue("PipeSegCount")); //if (width <= 0.05) //{ // base._segCount = 3; //} //else if (0.05 < width && width <= 0.1) //{ // base._segCount = 5; //} //else if (0.1 < width && width <= 1) //{ // base._segCount = 6; //} //else if (width > 1) //{ // base._segCount = 8; //} if (width <= 0.1) { base._segCount = 5; } else if (0.1 < width && width <= 1) { base._segCount = 6; } else if (width > 1) { base._segCount = 8; } base._secShape = SecShape.CircleRing; base._offX = base.HorOffset(this._horPos, this._width); base._offY = base.VtOffset(this._vtPos, this._width); double num = 6.2831853071795862; double num2 = 6.2831853071795862 / ((double)base.SegCount); base._vtxs = new double[(base._segCount + 1) * 4]; for (int i = 0; i <= base._segCount; i++) { base._vtxs[i * 4] = Math.Cos(num - (i * num2)) * (this._width / 2.0); base._vtxs[(i * 4) + 1] = Math.Sin(num - (i * num2)) * (this._width / 2.0); base._vtxs[(i * 4) + 2] = Math.Cos(num - (i * num2)) * ((this._width / 2.0) - this._thick); base._vtxs[(i * 4) + 3] = Math.Sin(num - (i * num2)) * ((this._width / 2.0) - this._thick); } } else { base._segCount = 4; base._secShape = SecShape.RectangleRing; base._offX = base.HorOffset(this._horPos, this._width); base._offY = base.VtOffset(this._vtPos, this._height); base._vtxs = new double[(base._segCount + 1) * 4]; base._vtxs[0] = this._width / 2.0; base._vtxs[1] = this._height / 2.0; base._vtxs[2] = (this._width / 2.0) - this._thick; base._vtxs[3] = (this._height / 2.0) - this._thick; base._vtxs[4] = this._width / 2.0; base._vtxs[5] = -(this._height / 2.0); base._vtxs[6] = base._offX + ((this._width / 2.0) - this._thick); base._vtxs[7] = -((this._height / 2.0) - this._thick); base._vtxs[8] = -(this._width / 2.0); base._vtxs[9] = -(this._height / 2.0); base._vtxs[10] = -((this._width / 2.0) - this._thick); base._vtxs[11] = -((this._height / 2.0) - this._thick); base._vtxs[12] = -(this._width / 2.0); base._vtxs[13] = this._height / 2.0; base._vtxs[14] = -((this._width / 2.0) - this._thick); base._vtxs[15] = (this._height / 2.0) - this._thick; base._vtxs[0x10] = this._width / 2.0; base._vtxs[0x11] = this._height / 2.0; base._vtxs[0x12] = (this._width / 2.0) - this._thick; base._vtxs[0x13] = (this._height / 2.0) - this._thick; } }