void ReleaseDesignerOutlets() { if (SegService != null) { SegService.Dispose(); SegService = null; } if (txtTemp != null) { txtTemp.Dispose(); txtTemp = null; } if (btnConvert != null) { btnConvert.Dispose(); btnConvert = null; } if (lblResult != null) { lblResult.Dispose(); lblResult = null; } if (SegType != null) { SegType.Dispose(); SegType = null; } }
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) { } }