public double DistanceToPipePoint(PipePoint ppDst) { double num = ppDst.x - this.x; double num2 = ppDst.y - this.y; return(Math.Sqrt(num * num + num2 * num2)); }
private void method_3(ArrayList arrayList, ArrayList arrayList2) { int count = arrayList2.Count; int num = 0; for (int i = 0; i < count; i++) { PipeLine pipeLine = (PipeLine)arrayList2[i]; int num2 = pipeLine.Size(); if (i == 0) { PipePoint pipePoint = (PipePoint)arrayList[num]; pipePoint.x = pipeLine[i].X; pipePoint.y = pipeLine[i].Y; pipePoint.z = pipeLine[i].Z; pipePoint.m = pipeLine[i].M; pipePoint.strPipeWidthHeight = pipeLine.PipeWidthHeight; num++; } PipePoint pipePoint2 = (PipePoint)arrayList[num]; pipePoint2.x = pipeLine[num2 - 1].X; pipePoint2.y = pipeLine[num2 - 1].Y; pipePoint2.z = pipeLine[num2 - 1].Z; pipePoint2.m = pipeLine[num2 - 1].M; pipePoint2.strPipeWidthHeight = pipeLine.PipeWidthHeight; num++; } }
private void method_5(ArrayList arrayList, ArrayList arrayList2) { int count = arrayList2.Count; arrayList.Clear(); for (int i = 0; i < count; i++) { PipePoint deepCopy = ((PipePoint)arrayList2[i]).GetDeepCopy(); arrayList.Add(deepCopy); } }
public override void SectionInfo(out ArrayList pArrInfo) { pArrInfo = new ArrayList(); int count = this.m_arrPipePoints.Count; if (this.m_nSelectIndex != -1) { int num = 0; for (int i = 0; i < count; i++) { PipePoint pipePoint = (PipePoint)this.m_arrPipePoints[i]; if (pipePoint.PointType == PipePoint.SectionPointType.sptPipe) { if (num == this.m_nSelectIndex) { SectionInfoStore sectionInfoStore; sectionInfoStore.strField = "数据集名称"; sectionInfoStore.strVal = pipePoint.bstrDatasetName; pArrInfo.Add(sectionInfoStore); SectionInfoStore sectionInfoStore2; sectionInfoStore2.strField = "ID"; sectionInfoStore2.strVal = pipePoint.nID.ToString(); pArrInfo.Add(sectionInfoStore2); SectionInfoStore sectionInfoStore3; sectionInfoStore3.strField = "材质"; sectionInfoStore3.strVal = pipePoint.strMaterial.Trim(); pArrInfo.Add(sectionInfoStore3); SectionInfoStore sectionInfoStore4; sectionInfoStore4.strField = "规格"; sectionInfoStore4.strVal = pipePoint.strPipeWidthHeight.Trim(); pArrInfo.Add(sectionInfoStore4); SectionInfoStore sectionInfoStore5; sectionInfoStore5.strField = "横坐标"; sectionInfoStore5.strVal = pipePoint.x.ToString("f3"); pArrInfo.Add(sectionInfoStore5); SectionInfoStore sectionInfoStore6; sectionInfoStore6.strField = "纵坐标"; sectionInfoStore6.strVal = pipePoint.y.ToString("f3"); pArrInfo.Add(sectionInfoStore6); SectionInfoStore sectionInfoStore7; sectionInfoStore7.strField = "管线高程"; sectionInfoStore7.strVal = pipePoint.z.ToString("f3"); pArrInfo.Add(sectionInfoStore7); SectionInfoStore sectionInfoStore8; sectionInfoStore8.strField = "地面高程"; sectionInfoStore8.strVal = pipePoint.m.ToString("f3"); pArrInfo.Add(sectionInfoStore8); break; } num++; } } } }
public override void OpenSectionFile(string strFileName) { XmlReader xmlReader = XmlReader.Create(strFileName); xmlReader.ReadToFollowing("TranSectionAnalyse"); string attribute = xmlReader.GetAttribute("SectionType"); if (attribute != "TranSectionType") { MessageBox.Show("不是横断面保存文件!"); } else { this.m_pSectionDisp.Title = xmlReader.GetAttribute("Title"); this.m_pSectionDisp.RoadName = xmlReader.GetAttribute("RoadName"); this.m_pSectionDisp.SectionNo = xmlReader.GetAttribute("SectionNo"); xmlReader.ReadToFollowing("PipePoints"); int num = Convert.ToInt32(xmlReader.GetAttribute("PipePointCount")); this.m_arrPipePoints.Clear(); for (int i = 0; i < num; i++) { xmlReader.ReadToFollowing("PipePoint"); PipePoint pipePoint = new PipePoint(); PipePoint.SectionPointType pointType = (PipePoint.SectionPointType)Convert.ToInt32(xmlReader.GetAttribute("PointType")); pipePoint.PointType = pointType; pipePoint.nID = Convert.ToInt32(xmlReader.GetAttribute("ID")); pipePoint.x = Convert.ToDouble(xmlReader.GetAttribute("X")); pipePoint.y = Convert.ToDouble(xmlReader.GetAttribute("Y")); pipePoint.z = Convert.ToDouble(xmlReader.GetAttribute("Z")); pipePoint.m = Convert.ToDouble(xmlReader.GetAttribute("M")); pipePoint.bstrDatasetName = xmlReader.GetAttribute("DatasetName"); pipePoint.nID = Convert.ToInt32(xmlReader.GetAttribute("ID")); pipePoint.strMaterial = xmlReader.GetAttribute("Material"); pipePoint.strPipeWidthHeight = xmlReader.GetAttribute("PipeWidthAndHeight"); pipePoint.Red = Convert.ToInt32(xmlReader.GetAttribute("Red")); pipePoint.Green = Convert.ToInt32(xmlReader.GetAttribute("Green")); pipePoint.Blue = Convert.ToInt32(xmlReader.GetAttribute("Blue")); this.m_arrPipePoints.Add(pipePoint); } this.method_5(this.m_arrPipePointsDraw, this.m_arrPipePoints); this.method_4(); this.method_7(this.m_arrPipePointsDraw); base.Paint(); } }
private void method_7(ArrayList arrayList) { int count = arrayList.Count; int num = 0; for (int i = 0; i < count; i++) { PipePoint pipePoint = (PipePoint)arrayList[i]; if (pipePoint.PointType == PipePoint.SectionPointType.sptPipe || pipePoint.PointType == PipePoint.SectionPointType.sptDrawPoint) { if (num == 0) { this.m_dMinX = (this.m_dMaxX = pipePoint.x); if (pipePoint.z.ToString() == "非数字" || pipePoint.m.ToString() == "非数字") { num++; } else { this.m_dMinY = Math.Min(pipePoint.z, pipePoint.m); this.m_dMaxY = Math.Max(pipePoint.z, pipePoint.m); num++; } } else { this.m_dMinX = Math.Min(this.m_dMinX, pipePoint.x); this.m_dMaxX = Math.Max(this.m_dMaxX, pipePoint.x); if (pipePoint.z.ToString() == "非数字" || pipePoint.m.ToString() == "非数字") { num++; } else { this.m_dMinY = Math.Min(this.m_dMinY, Math.Min(pipePoint.z, pipePoint.m)); this.m_dMaxY = Math.Max(this.m_dMaxY, Math.Max(pipePoint.z, pipePoint.m)); num++; } } } } this.m_pSectionDisp.SetDataBound(this.m_dMinX, this.m_dMaxX, this.m_dMinY, this.m_dMaxY); }
public override void SaveSectionFile(string strFileName) { int count = this.m_arrPipePoints.Count; XmlTextWriter xmlTextWriter = new XmlTextWriter(strFileName, null); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteComment("SectionSaveFile"); xmlTextWriter.WriteStartElement("TranSectionAnalyse"); xmlTextWriter.WriteAttributeString("SectionType", "TranSectionType"); string title = this.m_pSectionDisp.Title; string roadName = this.m_pSectionDisp.RoadName; string sectionNo = this.m_pSectionDisp.SectionNo; xmlTextWriter.WriteAttributeString("Title", title); xmlTextWriter.WriteAttributeString("RoadName", roadName); xmlTextWriter.WriteAttributeString("SectionNo", sectionNo); xmlTextWriter.WriteStartElement("PipePoints"); xmlTextWriter.WriteAttributeString("PipePointCount", count.ToString()); for (int i = 0; i < count; i++) { PipePoint pipePoint = (PipePoint)this.m_arrPipePoints[i]; xmlTextWriter.WriteStartElement("PipePoint"); xmlTextWriter.WriteAttributeString("PointType", ((int)pipePoint.PointType).ToString()); xmlTextWriter.WriteAttributeString("X", pipePoint.x.ToString("f3")); xmlTextWriter.WriteAttributeString("Y", pipePoint.y.ToString("f3")); xmlTextWriter.WriteAttributeString("Z", pipePoint.z.ToString("f3")); xmlTextWriter.WriteAttributeString("M", pipePoint.m.ToString("f3")); xmlTextWriter.WriteAttributeString("DatasetName", pipePoint.bstrDatasetName); xmlTextWriter.WriteAttributeString("ID", pipePoint.nID.ToString()); xmlTextWriter.WriteAttributeString("PipePointKind", pipePoint.bstrPointKind); xmlTextWriter.WriteAttributeString("Material", pipePoint.strMaterial); xmlTextWriter.WriteAttributeString("PipeWidthAndHeight", pipePoint.strPipeWidthHeight); xmlTextWriter.WriteAttributeString("Red", pipePoint.Red.ToString()); xmlTextWriter.WriteAttributeString("Green", pipePoint.Green.ToString()); xmlTextWriter.WriteAttributeString("Blue", pipePoint.Blue.ToString()); xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndElement(); xmlTextWriter.Flush(); xmlTextWriter.Close(); }
private void method_4() { int count = this.m_arrPipePointsDraw.Count; PipePoint pipePoint = new PipePoint(); double num = 0.0; double num2 = 0.0; for (int i = 0; i < count; i++) { PipePoint pipePoint2 = (PipePoint)this.m_arrPipePointsDraw[i]; if (i < count - 1) { PipePoint deepCopy = ((PipePoint)this.m_arrPipePointsDraw[i + 1]).GetDeepCopy(); num = pipePoint2.DistanceToPipePoint(deepCopy); } if (i != 0) { pipePoint2.x = pipePoint.x + num2; } num2 = num; pipePoint = pipePoint2.GetDeepCopy(); } }
private void fEswZsmwIx(PipePoint ppDst) { if (this.m_arrPipePoints.Count != 0) { int count = this.m_arrPipePoints.Count; for (int i = count - 1; i > 0; i--) { for (int j = 0; j < i; j++) { PipePoint pipePoint = (PipePoint)this.m_arrPipePoints[j]; PipePoint pipePoint2 = (PipePoint)this.m_arrPipePoints[j + 1]; double num = pipePoint.DistanceToPipePoint(ppDst); double num2 = pipePoint2.DistanceToPipePoint(ppDst); if (num > num2) { PipePoint value = pipePoint; this.m_arrPipePoints[j] = pipePoint2; this.m_arrPipePoints[j + 1] = value; } } } } }
public override void OpenSectionFile(string strFileName) { XmlReader xmlReader = XmlReader.Create(strFileName); xmlReader.ReadToFollowing("VerSectionAnalyse"); string attribute = xmlReader.GetAttribute("SectionType"); if (attribute != "VerSectionType") { MessageBox.Show("不是纵断面保存文件!"); } else { this.m_pSectionDisp.Title = xmlReader.GetAttribute("Title"); this.m_pSectionDisp.RoadName = xmlReader.GetAttribute("RoadName"); this.m_pSectionDisp.SectionNo = xmlReader.GetAttribute("SectionNo"); xmlReader.ReadToFollowing("PipeLines"); int num = Convert.ToInt32(xmlReader.GetAttribute("PipeLineCount")); this.arrayList_1.Clear(); for (int i = 0; i < num; i++) { xmlReader.ReadToFollowing("PipeLine"); PipeLine pipeLine = new PipeLine(); pipeLine.DatasetName = xmlReader.GetAttribute("DatasetName"); pipeLine.ID = Convert.ToInt32(xmlReader.GetAttribute("ID")); pipeLine.Material = xmlReader.GetAttribute("Material"); pipeLine.PipeWidthHeight = xmlReader.GetAttribute("PipeWidthAndHeight"); pipeLine.Red = Convert.ToInt32(xmlReader.GetAttribute("Red")); pipeLine.Green = Convert.ToInt32(xmlReader.GetAttribute("Green")); pipeLine.Blue = Convert.ToInt32(xmlReader.GetAttribute("Blue")); int num2 = Convert.ToInt32(xmlReader.GetAttribute("PointCount")); for (int j = 0; j < num2; j++) { xmlReader.ReadToFollowing("Point"); pipeLine.PushBack(new GPoint { X = (double)Convert.ToSingle(xmlReader.GetAttribute("X")), Y = (double)Convert.ToSingle(xmlReader.GetAttribute("Y")), Z = (double)Convert.ToSingle(xmlReader.GetAttribute("Z")), M = (double)Convert.ToSingle(xmlReader.GetAttribute("M")) }); } this.arrayList_1.Add(pipeLine); } xmlReader.ReadToFollowing("PipePoints"); int num3 = Convert.ToInt32(xmlReader.GetAttribute("PipePointCount")); this.arrayList_2.Clear(); for (int k = 0; k < num3; k++) { xmlReader.ReadToFollowing("PipePoint"); PipePoint pipePoint = new PipePoint(); pipePoint.x = (double)Convert.ToSingle(xmlReader.GetAttribute("X")); pipePoint.y = (double)Convert.ToSingle(xmlReader.GetAttribute("Y")); pipePoint.z = (double)Convert.ToSingle(xmlReader.GetAttribute("Z")); pipePoint.m = (double)Convert.ToSingle(xmlReader.GetAttribute("M")); pipePoint.bstrDatasetName = xmlReader.GetAttribute("DatasetName"); pipePoint.nID = Convert.ToInt32(xmlReader.GetAttribute("ID")); pipePoint.bstrPointKind = xmlReader.GetAttribute("PipePointKind"); pipePoint.Red = Convert.ToInt32(xmlReader.GetAttribute("Red")); pipePoint.Green = Convert.ToInt32(xmlReader.GetAttribute("Green")); pipePoint.Blue = Convert.ToInt32(xmlReader.GetAttribute("Blue")); this.arrayList_2.Add(pipePoint); } this.method_4(this.arrayList_3, this.arrayList_1); this.method_5(this.arrayList_4, this.arrayList_2); this.method_6(); this.method_7(this.arrayList_3); base.Paint(); } }
public override void SaveSectionFile(string strFileName) { int count = this.arrayList_1.Count; XmlTextWriter xmlTextWriter = new XmlTextWriter(strFileName, null); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteComment("SectionSaveFile"); xmlTextWriter.WriteStartElement("VerSectionAnalyse"); xmlTextWriter.WriteAttributeString("SectionType", "VerSectionType"); string title = this.m_pSectionDisp.Title; string roadName = this.m_pSectionDisp.RoadName; string sectionNo = this.m_pSectionDisp.SectionNo; xmlTextWriter.WriteAttributeString("Title", title); xmlTextWriter.WriteAttributeString("RoadName", roadName); xmlTextWriter.WriteAttributeString("SectionNo", sectionNo); xmlTextWriter.WriteStartElement("PipeLines"); xmlTextWriter.WriteAttributeString("PipeLineCount", count.ToString()); for (int i = 0; i < count; i++) { PipeLine pipeLine = (PipeLine)this.arrayList_1[i]; int num = pipeLine.Size(); xmlTextWriter.WriteStartElement("PipeLine"); xmlTextWriter.WriteAttributeString("DatasetName", pipeLine.DatasetName); xmlTextWriter.WriteAttributeString("ID", pipeLine.ID.ToString()); xmlTextWriter.WriteAttributeString("Material", pipeLine.Material); xmlTextWriter.WriteAttributeString("PipeWidthAndHeight", pipeLine.PipeWidthHeight); xmlTextWriter.WriteAttributeString("PointCount", pipeLine.Size().ToString()); xmlTextWriter.WriteAttributeString("Red", pipeLine.Red.ToString()); xmlTextWriter.WriteAttributeString("Green", pipeLine.Green.ToString()); xmlTextWriter.WriteAttributeString("Blue", pipeLine.Blue.ToString()); for (int j = 0; j < num; j++) { GPoint gPoint = pipeLine[j]; xmlTextWriter.WriteStartElement("Point"); xmlTextWriter.WriteAttributeString("X", gPoint.X.ToString("f3")); xmlTextWriter.WriteAttributeString("Y", gPoint.Y.ToString("f3")); xmlTextWriter.WriteAttributeString("Z", gPoint.Z.ToString("f3")); xmlTextWriter.WriteAttributeString("M", gPoint.M.ToString("f3")); xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); int count2 = this.arrayList_2.Count; xmlTextWriter.WriteStartElement("PipePoints"); xmlTextWriter.WriteAttributeString("PipePointCount", count2.ToString()); for (int k = 0; k < count2; k++) { PipePoint pipePoint = (PipePoint)this.arrayList_2[k]; xmlTextWriter.WriteStartElement("PipePoint"); xmlTextWriter.WriteAttributeString("X", pipePoint.x.ToString("f3")); xmlTextWriter.WriteAttributeString("Y", pipePoint.y.ToString("f3")); xmlTextWriter.WriteAttributeString("Z", pipePoint.z.ToString("f3")); xmlTextWriter.WriteAttributeString("M", pipePoint.m.ToString("f3")); xmlTextWriter.WriteAttributeString("DatasetName", pipePoint.bstrDatasetName); xmlTextWriter.WriteAttributeString("ID", pipePoint.nID.ToString()); xmlTextWriter.WriteAttributeString("PipePointKind", pipePoint.bstrPointKind); xmlTextWriter.WriteAttributeString("Red", pipePoint.Red.ToString()); xmlTextWriter.WriteAttributeString("Green", pipePoint.Green.ToString()); xmlTextWriter.WriteAttributeString("Blue", pipePoint.Blue.ToString()); xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndElement(); xmlTextWriter.Flush(); xmlTextWriter.Close(); }
public override void SectionInfo(out ArrayList pArrInfo) { pArrInfo = new ArrayList(); int count = this.arrayList_1.Count; if (this.m_nSelectIndex != -1) { if (this.m_nSelectIndex < count) { PipeLine pipeLine = (PipeLine)this.arrayList_1[this.m_nSelectIndex]; SectionInfoStore sectionInfoStore; sectionInfoStore.strField = "数据集名称"; sectionInfoStore.strVal = pipeLine.DatasetName; pArrInfo.Add(sectionInfoStore); SectionInfoStore sectionInfoStore2; sectionInfoStore2.strField = "ID"; sectionInfoStore2.strVal = pipeLine.ID.ToString(); pArrInfo.Add(sectionInfoStore2); SectionInfoStore sectionInfoStore3; sectionInfoStore3.strField = "材质"; sectionInfoStore3.strVal = pipeLine.Material; pArrInfo.Add(sectionInfoStore3); SectionInfoStore sectionInfoStore4; sectionInfoStore4.strField = "规格"; sectionInfoStore4.strVal = pipeLine.PipeWidthHeight; pArrInfo.Add(sectionInfoStore4); SectionInfoStore sectionInfoStore5; sectionInfoStore5.strField = "管点数"; sectionInfoStore5.strVal = pipeLine.Size().ToString(); pArrInfo.Add(sectionInfoStore5); SectionInfoStore sectionInfoStore6; sectionInfoStore6.strField = "管线长度"; sectionInfoStore6.strVal = pipeLine.Length.ToString(); pArrInfo.Add(sectionInfoStore6); } else { PipePoint pipePoint = (PipePoint)this.arrayList_2[this.m_nSelectIndex - count]; SectionInfoStore sectionInfoStore7; sectionInfoStore7.strField = "数据集名称"; sectionInfoStore7.strVal = pipePoint.bstrDatasetName; pArrInfo.Add(sectionInfoStore7); SectionInfoStore sectionInfoStore8; sectionInfoStore8.strField = "ID"; sectionInfoStore8.strVal = pipePoint.nID.ToString(); pArrInfo.Add(sectionInfoStore8); SectionInfoStore sectionInfoStore9; sectionInfoStore9.strField = "点性"; sectionInfoStore9.strVal = pipePoint.bstrPointKind; pArrInfo.Add(sectionInfoStore9); SectionInfoStore sectionInfoStore10; sectionInfoStore10.strField = "横坐标"; sectionInfoStore10.strVal = pipePoint.x.ToString("f3"); pArrInfo.Add(sectionInfoStore10); SectionInfoStore sectionInfoStore11; sectionInfoStore11.strField = "纵坐标"; sectionInfoStore11.strVal = pipePoint.y.ToString("f3"); pArrInfo.Add(sectionInfoStore11); SectionInfoStore sectionInfoStore12; sectionInfoStore12.strField = "地面高程"; sectionInfoStore12.strVal = pipePoint.m.ToString("f3"); pArrInfo.Add(sectionInfoStore12); } } }
//!在这儿进行修改,将对高程埋深数据存储在不同位置进行统一处理 private void method_2() { IMap map = m_context.FocusMap; IEnumFeature enumFeature = (IEnumFeature)map.FeatureSelection; IFeature feature = enumFeature.Next(); bool isMUsing = false; int qdgcIndex = -1; int qdmsIndex = -1; int zdgcIndex = -1; int zdmsIndex = -1; if (feature == null) { return; } if (feature.FeatureType != esriFeatureType.esriFTSimpleEdge) { return; } this.arrayList_1.Clear(); this.arrayList_2.Clear(); int num = 0; while (feature != null) { IPolyline egLine = feature.Shape as IPolyline; IPoint newCenter = new PointClass(); egLine.QueryPoint(esriSegmentExtension.esriNoExtension, 0.01, true, newCenter); IEdgeFeature pEgFeature = feature as IEdgeFeature; IFeatureClass pClass = feature.Class as IFeatureClass; INetworkClass pNetworkClass = pClass as INetworkClass; INetElements network = pNetworkClass.GeometricNetwork.Network as INetElements; IEnumFeature enumFeatures = pNetworkClass.GeometricNetwork.SearchForNetworkFeature(newCenter, esriFeatureType.esriFTSimpleEdge); ISimpleEdgeFeature simpleEdgeFeature = enumFeatures.Next() as ISimpleEdgeFeature; IFeature realFeature = null; int userClassID, userID, userSubID; network.QueryIDs(simpleEdgeFeature.EID, esriElementType.esriETEdge, out userClassID, out userID, out userSubID); if (pClass.FeatureClassID == userClassID) { realFeature = pClass.GetFeature(userID); } else { IEnumDataset dses = pNetworkClass.FeatureDataset.Subsets; dses.Reset(); IDataset ds = dses.Next(); while (ds != null) { if (ds is IFeatureClass) { IFeatureClass pClass2 = ds as IFeatureClass; if (pClass2.FeatureClassID == userClassID) { realFeature = pClass2.GetFeature(userID); break; } } } } IMAware mAware = realFeature.Shape as IMAware; isMUsing = mAware.MAware; IFeatureLayer pLayer = MapHelper.GetLayerByFeature(map as IBasicMap, realFeature); IBasicLayerInfo lineConfig = PipeConfig.GetBasicLayerInfo(realFeature.Class.AliasName) as IBasicLayerInfo; if (!isMUsing) { qdgcIndex = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDGC)); qdmsIndex = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.QDMS)); zdgcIndex = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDGC)); zdmsIndex = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.ZDMS)); } PipeLine pipeLine = new PipeLine(); IPolyline polyline = (IPolyline)feature.Shape; IPointCollection pointCollection = (IPointCollection)polyline; int pointCount = pointCollection.PointCount; pipeLine.Clear(); if (isMUsing) { for (int i = 0; i < pointCount; i++) { IPoint point = new ESRI.ArcGIS.Geometry.Point(); if (((SortInfo)this.arrayList_0[num]).bRightDirection) { point = pointCollection.get_Point(i); } else { point = pointCollection.get_Point(pointCount - i - 1); } if (double.IsNaN(point.M)) { pipeLine.PushBack(point.X, point.Y, point.Z, point.Z + 1.0); } else { pipeLine.PushBack(point.X, point.Y, point.Z - point.M, point.Z); } } } else { double height = 0; double qdgc = GetDoubleValue(realFeature, qdgcIndex, out height); double zdgc = GetDoubleValue(realFeature, zdgcIndex, out height); double qdms = GetDoubleValue(realFeature, qdmsIndex, out height); double zdms = GetDoubleValue(realFeature, zdmsIndex, out height); if (qdms == 0) { qdms = 1; } if (zdms == 0) { zdms = 1; } IPoint startPoint = pointCollection.Point[0]; IPoint endPoint = pointCollection.Point[pointCollection.PointCount - 1]; pipeLine.PushBack(startPoint.X, startPoint.Y, qdgc - qdms, qdgc); pipeLine.PushBack(endPoint.X, endPoint.Y, zdgc - zdms, zdgc); } //string text = "管线性质"; string text = lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ) == "" ? "管线性质" : lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ); int num2 = realFeature.Fields.FindField(text); string text2 = ""; if (num2 != -1) { object obj = realFeature.get_Value(num2); if (obj == null || Convert.IsDBNull(obj)) { text2 = ""; } else { text2 = obj.ToString(); } } pipeLine.ID = Convert.ToInt32(realFeature.get_Value(0).ToString()); pipeLine.DatasetName = text2; int num3 = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GXCZ)); pipeLine.Material = num3 == -1 ? "" : realFeature.get_Value(num3).ToString(); //管径 num3 = realFeature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GJ)); string text3 = num3 == -1 ? "" : realFeature.get_Value(num3).ToString(); //断面尺寸 num3 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.DMCC)); string text4 = num3 == -1 ? "" : realFeature.get_Value(num3).ToString(); Color featureColor = CommonUtils.GetFeatureColor(map, realFeature.Class.AliasName, realFeature); pipeLine.Red = (int)featureColor.R; pipeLine.Green = (int)featureColor.G; pipeLine.Blue = (int)featureColor.B; if (text3 != "") { pipeLine.PipeWidthHeight = text3; } if (text4 != "") { pipeLine.PipeWidthHeight = text4; } if (pipeLine.PipeWidthHeight == null) { pipeLine.PipeWidthHeight = ""; } this.arrayList_1.Add(pipeLine); IFeature feature2 = (IFeature)((IEdgeFeature)realFeature).FromJunctionFeature; IFeature feature3 = (IFeature)((IEdgeFeature)realFeature).ToJunctionFeature; IFeature feature4; if (num == 0) { PipePoint pipePoint = new PipePoint(); if (((SortInfo)this.arrayList_0[num]).bRightDirection) { feature4 = feature2; } else { feature4 = feature3; } pipePoint.nID = Convert.ToInt32(feature4.get_Value(0)); pipePoint.nAtPipeSegID = pipeLine.ID; pipePoint.bstrDatasetName = text2; IBasicLayerInfo pointConfig = PipeConfig.GetBasicLayerInfo(feature4.Class.AliasName) as IBasicLayerInfo; num3 = feature4.Fields.FindField(pointConfig.GetFieldName(PipeConfigWordHelper.PointWords.FSW)); if (num3 == -1) { pipePoint.bstrPointKind = ""; } else { pipePoint.bstrPointKind = feature4.get_Value(num3).ToString(); } Color featureColor2 = CommonUtils.GetFeatureColor(map, feature4.Class.AliasName, feature4); pipePoint.Red = (int)featureColor2.R; pipePoint.Green = (int)featureColor2.G; pipePoint.Blue = (int)featureColor2.B; this.arrayList_2.Add(pipePoint); } PipePoint pipePoint2 = new PipePoint(); if (((SortInfo)this.arrayList_0[num]).bRightDirection) { feature4 = feature3; } else { feature4 = feature2; } pipePoint2.nID = Convert.ToInt32(feature4.get_Value(0)); pipePoint2.nAtPipeSegID = pipeLine.ID; pipePoint2.bstrDatasetName = text2; IBasicLayerInfo pointConfig3 = PipeConfig.GetBasicLayerInfo(feature4.Class.AliasName) as IBasicLayerInfo; num3 = feature4.Fields.FindField(pointConfig3.GetFieldName(PipeConfigWordHelper.PointWords.FSW)); if (num3 == -1) { pipePoint2.bstrPointKind = ""; } else { pipePoint2.bstrPointKind = feature4.get_Value(num3).ToString(); } Color featureColor3 = CommonUtils.GetFeatureColor(map, feature4.Class.AliasName, feature4); pipePoint2.Red = (int)featureColor3.R; pipePoint2.Green = (int)featureColor3.G; pipePoint2.Blue = (int)featureColor3.B; this.arrayList_2.Add(pipePoint2); feature = enumFeature.Next(); num++; } this.method_3(this.arrayList_2, this.arrayList_1); this.method_4(this.arrayList_3, this.arrayList_1); this.method_5(this.arrayList_4, this.arrayList_2); this.method_6(); this.method_7(this.arrayList_3); }
public override void GetSelectedData() { this.method_3(); IMap map = this.m_context.FocusMap; ITopologicalOperator topologicalOperator = (ITopologicalOperator)this.m_pBaseLine; IGeometry geometry = topologicalOperator.Buffer(0.0); map.ClearSelection(); ISelectionEnvironment selectionEnvironment = new SelectionEnvironment(); map.SelectByShape(geometry, selectionEnvironment, false); IEnumFeature enumFeature = (IEnumFeature)map.FeatureSelection; IFeature feature = enumFeature.Next(); while (feature != null) { if (feature.FeatureType == esriFeatureType.esriFTSimpleEdge) { IPolyline egLine = feature.Shape as IPolyline; IPoint newCenter = new PointClass(); egLine.QueryPoint(esriSegmentExtension.esriNoExtension, 0.01, true, newCenter); IEdgeFeature pEgFeature = feature as IEdgeFeature; IFeatureClass pClass = feature.Class as IFeatureClass; INetworkClass pNetworkClass = pClass as INetworkClass; INetElements network = pNetworkClass.GeometricNetwork.Network as INetElements; IPointToEID pntEID = new PointToEIDClass(); pntEID.GeometricNetwork = pNetworkClass.GeometricNetwork; pntEID.SourceMap = m_context.FocusMap; pntEID.SnapTolerance = CommonHelper.ConvertPixelsToMapUnits(m_context.ActiveView, 5.0); double percent; int edgeID; IPoint location; pntEID.GetNearestEdge(newCenter, out edgeID, out location, out percent); if (percent == 0) { feature = enumFeature.Next(); continue; } int userClassID, userID, userSubID; network.QueryIDs(edgeID, esriElementType.esriETEdge, out userClassID, out userID, out userSubID); if (pClass.FeatureClassID == userClassID) { feature = pClass.GetFeature(userID); } else { IEnumDataset dses = pNetworkClass.FeatureDataset.Subsets; dses.Reset(); IDataset ds = dses.Next(); while (ds != null) { if (ds is IFeatureClass) { IFeatureClass pClass2 = ds as IFeatureClass; if (pClass2.FeatureClassID == userClassID) { feature = pClass2.GetFeature(userID); break; } } } } } string smpClassName = CommonUtils.GetSmpClassName(feature.Class.AliasName); IMAware mWAware = feature.Shape as IMAware; bool isMUsing = mWAware.MAware; IBasicLayerInfo lineConfig = PipeConfig.GetBasicLayerInfo(feature.Class.AliasName) as IBasicLayerInfo; if (lineConfig == null && !smpClassName.ToUpper().Contains("JT_JT_L") && !smpClassName.ToUpper().Contains("SY_ZX_L") && !smpClassName.ToUpper().Contains("ZB_LD_R")) { feature = enumFeature.Next(); } else { IGeometry shape = feature.Shape; if (shape.GeometryType != esriGeometryType.esriGeometryPolyline && shape.GeometryType != esriGeometryType.esriGeometryPolygon) { feature = enumFeature.Next(); } else { IPolyline polyline; if (shape.GeometryType == esriGeometryType.esriGeometryPolygon) { polyline = this.PolygonToPolyline((IPolygon)shape); } else { polyline = (IPolyline)shape; } GPoints gPoints = null; if (isMUsing) { gPoints = this.CalculateIntersections(this.m_pBaseLine, polyline); } else { gPoints = this.CalculateIntersections(this.m_pBaseLine, feature, lineConfig); } //string text = "管线性质"; string text = lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GDXZ); string bstrDatasetName = ""; int num = feature.Fields.FindField(text); if (num != -1) { object obj = feature.get_Value(num); if (obj == null || Convert.IsDBNull(obj)) { bstrDatasetName = ""; } else { bstrDatasetName = obj.ToString(); } } if (gPoints == null) { feature = enumFeature.Next(); } else { int num2 = gPoints.Size(); for (int i = 0; i < num2; i++) { GPoint gPoint = gPoints[i]; PipePoint pipePoint = new PipePoint(); if (smpClassName.ToUpper().Contains("JT_JT_L")) { pipePoint.PointType = PipePoint.SectionPointType.sptRoadBorder; } else if (smpClassName.ToUpper().Contains("SY_ZX_L")) { pipePoint.PointType = PipePoint.SectionPointType.sptMidRoadLine; } else if (smpClassName.ToUpper().Contains("ZB_LD_R")) { pipePoint.PointType = PipePoint.SectionPointType.sptMidGreen; } else { pipePoint.PointType = PipePoint.SectionPointType.sptPipe; } pipePoint.x = gPoint.X; pipePoint.y = gPoint.Y; pipePoint.z = gPoint.Z; pipePoint.m = gPoint.M; pipePoint.bstrDatasetName = bstrDatasetName; // int num3 = feature.Fields.FindField(base.PipeConfig.get_Material()); int num3 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GXCZ)); if (num3 == -1) { pipePoint.strMaterial = ""; } else { object obj2 = feature.get_Value(num3); if (obj2 != null) { pipePoint.strMaterial = feature.get_Value(num3).ToString(); } else { pipePoint.strMaterial = ""; } } // num3 = feature.Fields.FindField(base.PipeConfig.get_Diameter()); num3 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.GJ)); string text2; if (num3 != -1 && feature.get_Value(num3) != null) { text2 = feature.get_Value(num3).ToString(); } else { text2 = ""; } num3 = feature.Fields.FindField(lineConfig.GetFieldName(PipeConfigWordHelper.LineWords.DMCC)); string text3; if (num3 != -1 && feature.get_Value(num3) != null) { text3 = feature.get_Value(num3).ToString(); } else { text3 = ""; } if (text2 != "") { pipePoint.strPipeWidthHeight = text2; } if (text3 != "") { pipePoint.strPipeWidthHeight = text3; } Color featureColor = CommonUtils.GetFeatureColor(map, feature.Class.AliasName, feature); pipePoint.Red = (int)featureColor.R; pipePoint.Green = (int)featureColor.G; pipePoint.Blue = (int)featureColor.B; this.m_arrPipePoints.Add(pipePoint); } feature = enumFeature.Next(); } } } } map.ClearSelection(); IPointCollection pointCollection = (IPointCollection)this.m_pBaseLine; int pointCount = pointCollection.PointCount; if (pointCount != 0) { for (int j = 0; j < pointCount; j++) { IPoint point = pointCollection.get_Point(j); double x = point.X; double y = point.Y; PipePoint pipePoint2 = new PipePoint(); pipePoint2.x = x; pipePoint2.y = y; pipePoint2.PointType = PipePoint.SectionPointType.sptDrawPoint; this.m_arrPipePoints.Add(pipePoint2); } this.fEswZsmwIx((PipePoint)this.m_arrPipePoints[this.m_arrPipePoints.Count - 2]); this.method_1(); if (this.method_2()) { this.method_5(this.m_arrPipePointsDraw, this.m_arrPipePoints); this.method_4(); this.method_7(this.m_arrPipePointsDraw); } } }