Beispiel #1
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app = DF2DApplication.Application;

            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            IActiveView    m_ActiveView = app.Current2DMapControl.ActiveView;
            IScreenDisplay m_Display    = app.Current2DMapControl.ActiveView.ScreenDisplay;
            IGeometry      pGeo         = null;

            try
            {
                if (button == 1)
                {
                    ISimpleLineSymbol pLineSym = new SimpleLineSymbol();
                    IRgbColor         pColor   = new RgbColorClass();
                    pColor.Red     = 255;
                    pColor.Green   = 255;
                    pColor.Blue    = 0;
                    pLineSym.Color = pColor;
                    pLineSym.Style = esriSimpleLineStyle.esriSLSSolid;
                    pLineSym.Width = 2;
                    IRubberBand pRubberBand;
                    pRubberBand = new RubberLineClass();
                    IGeometry pLine = pRubberBand.TrackNew(m_Display, null);

                    object symbol = pLineSym as object;
                    app.Current2DMapControl.DrawShape(pLine, ref symbol);


                    if ((pLine as IPolyline).Length > 500)
                    {
                        XtraMessageBox.Show("横断面线超过500米,分析效率很低,请重新绘制", "提示");
                        return;
                    }
                    WaitForm.Start("正在进行横断面分析...", "请稍后");
                    pGeo = pLine;
                    if (pGeo == null)
                    {
                        return;
                    }

                    string          road1          = "";
                    string          road2          = "";
                    bool            bAlert         = false;
                    double          hmax           = double.MinValue;
                    double          hmin           = double.MaxValue;
                    List <PPLine2D> pplines        = new List <PPLine2D>();
                    IFeatureCursor  pFeatureCursor = null;
                    IFeature        pFeature       = null;

                    foreach (MajorClass mc in LogicDataStructureManage2D.Instance.GetAllMajorClass())
                    {
                        foreach (SubClass sc in mc.SubClasses)
                        {
                            if (!sc.Visible2D)
                            {
                                continue;
                            }
                            string[] arrFc2DId = mc.Fc2D.Split(';');
                            if (arrFc2DId == null)
                            {
                                continue;
                            }
                            foreach (string fc2DId in arrFc2DId)
                            {
                                DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                                if (dffc == null)
                                {
                                    continue;
                                }
                                IFeatureClass fc = dffc.GetFeatureClass();
                                if (fc == null)
                                {
                                    continue;
                                }
                                FacilityClass facc = dffc.GetFacilityClass();
                                if (facc.Name != "PipeLine")
                                {
                                    continue;
                                }

                                //查找管径长宽字段,获得该要素类下字段索引值,若为圆管,则长宽相等
                                DFDataConfig.Class.FieldInfo fiDia  = facc.GetFieldInfoBySystemName("Diameter");
                                DFDataConfig.Class.FieldInfo fiDia1 = facc.GetFieldInfoBySystemName("Diameter1");
                                DFDataConfig.Class.FieldInfo fiDia2 = facc.GetFieldInfoBySystemName("Diameter2");
                                int indexDia       = fc.Fields.FindField(fiDia.Name);
                                int indexDiaWith   = fc.Fields.FindField(fiDia1.Name);
                                int indexDiaHeight = fc.Fields.FindField(fiDia2.Name);
                                if (indexDiaWith == -1 || indexDiaHeight == -1 || indexDia == -1)
                                {
                                    continue;
                                }
                                //查找道路字段索引
                                DFDataConfig.Class.FieldInfo fiRoad = facc.GetFieldInfoBySystemName("Road");
                                int indexRoad = fc.Fields.FindField(fiRoad.Name);
                                //查找管线高类别索引
                                DFDataConfig.Class.FieldInfo fiHLB = facc.GetFieldInfoBySystemName("HLB");
                                int indexHLB = fc.Fields.FindField(fiHLB.Name);
                                //二级分类名索引
                                int indexClassify = fc.Fields.FindField(mc.ClassifyField);

                                ISpatialFilter pSpatialFilter = new SpatialFilter();
                                pSpatialFilter.Geometry    = pGeo;
                                pSpatialFilter.SpatialRel  = esriSpatialRelEnum.esriSpatialRelIntersects;
                                pSpatialFilter.WhereClause = UpOrDown.DecorateWhereClasuse(fc) + mc.ClassifyField + " =  '" + sc.Name + "'";
                                int count = fc.FeatureCount(pSpatialFilter);
                                if (count == 0)
                                {
                                    continue;
                                }
                                pFeatureCursor = fc.Search(pSpatialFilter, true);
                                while ((pFeature = pFeatureCursor.NextFeature()) != null)
                                {
                                    if (indexRoad != -1)
                                    {
                                        if (road2 == "")
                                        {
                                            road1 = pFeature.get_Value(indexRoad).ToString();
                                            road2 = pFeature.get_Value(indexRoad).ToString();
                                        }
                                        else
                                        {
                                            road1 = pFeature.get_Value(indexRoad).ToString();
                                            if (road1 != road2)
                                            {
                                                if (!bAlert)
                                                {
                                                    XtraMessageBox.Show("横断面线跨越多条道路,当前只绘制在【" + road2 + "】上的管线横断面图。", "提示");
                                                    bAlert = true;
                                                }
                                                continue;
                                            }
                                        }
                                    }
                                    //查找管线的起点终点地面高
                                    double startSurfHeight = double.MaxValue;
                                    double endSurfHeight   = double.MaxValue;
                                    DFDataConfig.Class.FieldInfo fiStartSurfHeight = facc.GetFieldInfoBySystemName("StartSurfH");
                                    if (fiStartSurfHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexStartSurfHeight = pFeature.Fields.FindField(fiStartSurfHeight.Name);
                                    if (indexStartSurfHeight == -1)
                                    {
                                        continue;
                                    }

                                    DFDataConfig.Class.FieldInfo fiEndSurfHeight = facc.GetFieldInfoBySystemName("EndSurfH");
                                    if (fiEndSurfHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexEndSurfHeight = pFeature.Fields.FindField(fiEndSurfHeight.Name);
                                    if (indexEndSurfHeight == -1)
                                    {
                                        continue;
                                    }

                                    //若管线属性地面高字段为null,则从DEM取值
                                    if (pFeature.get_Value(indexStartSurfHeight).ToString() == "" || pFeature.get_Value(indexEndSurfHeight).ToString() == "")
                                    {
                                        startSurfHeight = ReadDemRaster.GetH((pFeature.Shape as IPolyline).FromPoint);
                                        endSurfHeight   = ReadDemRaster.GetH((pFeature.Shape as IPolyline).ToPoint);
                                    }
                                    else
                                    {
                                        startSurfHeight = Convert.ToDouble(pFeature.get_Value(indexStartSurfHeight).ToString());
                                        endSurfHeight   = Convert.ToDouble(pFeature.get_Value(indexEndSurfHeight).ToString());
                                    }

                                    //查找管线起点高程和终点高程
                                    double startDepthHeight = double.MaxValue;
                                    double endDepthHeight   = double.MaxValue;
                                    DFDataConfig.Class.FieldInfo fiStartDepthHeight = facc.GetFieldInfoBySystemName("StartHeight2D");
                                    if (fiStartDepthHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexStartDepthHeight = pFeature.Fields.FindField(fiStartDepthHeight.Name);
                                    if (indexStartDepthHeight == -1)
                                    {
                                        continue;
                                    }

                                    DFDataConfig.Class.FieldInfo fiEndDepthHeight = facc.GetFieldInfoBySystemName("EndHeight");
                                    if (fiEndDepthHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexEndDepthHeight = pFeature.Fields.FindField(fiEndDepthHeight.Name);
                                    if (indexEndDepthHeight == -1)
                                    {
                                        continue;
                                    }
                                    startDepthHeight = Convert.ToDouble(pFeature.get_Value(indexStartDepthHeight).ToString());
                                    endDepthHeight   = Convert.ToDouble(pFeature.get_Value(indexEndDepthHeight).ToString());


                                    //计算管线和断面的交点
                                    IGeometry            ppGeo        = pFeature.Shape;
                                    ITopologicalOperator pTopo        = ppGeo as ITopologicalOperator;
                                    IGeometry            geoIntersect = pTopo.Intersect(pGeo, esriGeometryDimension.esriGeometry0Dimension);
                                    if (geoIntersect == null)
                                    {
                                        continue;
                                    }
                                    PPLine2D ppline = new PPLine2D();
                                    if (indexClassify == -1)
                                    {
                                        ppline.facType = mc.Name;
                                    }
                                    else
                                    {
                                        ppline.facType = pFeature.get_Value(indexClassify).ToString();
                                    }
                                    //查找管线的管径,判断其是方管还是圆管
                                    string diameter  = pFeature.get_Value(indexDia).ToString();
                                    string diameter1 = pFeature.get_Value(indexDiaWith).ToString();
                                    string diameter2 = pFeature.get_Value(indexDiaHeight).ToString();

                                    if (diameter.Trim() == "")
                                    {
                                        continue;
                                    }
                                    ppline.dia = diameter;
                                    int indexSplit = diameter.IndexOf('*');
                                    if (indexSplit != -1)
                                    {
                                        ppline.isrect = true;
                                        int  iDia1;
                                        bool bDia1 = int.TryParse(diameter.Substring(0, indexSplit), out iDia1);
                                        if (!bDia1)
                                        {
                                            continue;
                                        }
                                        int  iDia2;
                                        bool bDia2 = int.TryParse(diameter.Substring(indexSplit + 1, diameter.Length - indexSplit - 1), out iDia2);
                                        if (!bDia2)
                                        {
                                            continue;
                                        }
                                        ppline.gj.Add(iDia1);
                                        ppline.gj.Add(iDia2);
                                    }
                                    else
                                    {
                                        ppline.isrect = false;
                                        int  iDia;
                                        bool bDia = int.TryParse(diameter, out iDia);
                                        if (!bDia)
                                        {
                                            continue;
                                        }
                                        ppline.gj.Add(iDia);
                                        ppline.gj.Add(iDia);
                                    }
                                    //判断管线高方式
                                    int hlb = 0;
                                    if (indexHLB != -1)
                                    {
                                        string strhlb = pFeature.get_Value(indexHLB).ToString();
                                        if (strhlb.Contains("内"))
                                        {
                                            hlb = 1;
                                        }
                                        else if (strhlb.Contains("外"))
                                        {
                                            hlb = -1;
                                        }
                                        else
                                        {
                                            hlb = 0;
                                        }
                                        ppline.hlb = hlb;
                                    }
                                    #region  交点为一个
                                    if (geoIntersect.GeometryType == esriGeometryType.esriGeometryPoint)
                                    {
                                        IPolyline polyline    = pFeature.Shape as IPolyline;
                                        IPoint    ptIntersect = geoIntersect as IPoint;
                                        ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y);
                                        ppline.clh        = GetInterPointHeight(ptIntersect, polyline, startDepthHeight, endDepthHeight);
                                        if (ppline.clh > hmax)
                                        {
                                            hmax = ppline.clh;
                                        }
                                        if (ppline.clh < hmin)
                                        {
                                            hmin = ppline.clh;
                                        }
                                        ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight)
                                                     * Math.Sqrt((polyline.FromPoint.X - ptIntersect.X) * (polyline.FromPoint.X - ptIntersect.X)
                                                                 + (polyline.FromPoint.Y - ptIntersect.Y) * (polyline.FromPoint.Y - ptIntersect.Y)) / polyline.Length;
                                        if (ppline.cgh > hmax)
                                        {
                                            hmax = ppline.cgh;
                                        }
                                        if (ppline.cgh < hmin)
                                        {
                                            hmin = ppline.cgh;
                                        }
                                        // 辅助画图
                                        IPolyline l = pGeo as IPolyline;
                                        ppline.startPt = new PPPoint(l.FromPoint.X, l.FromPoint.Y);
                                        pplines.Add(ppline);
                                    }

                                    #endregion
                                    #region  交点为多个
                                    else if (geoIntersect.GeometryType == esriGeometryType.esriGeometryMultipoint)
                                    {
                                        IPolyline        polyline = pFeature.Shape as IPolyline;
                                        IPointCollection geoCol   = geoIntersect as IPointCollection;
                                        for (int i = 0; i < geoCol.PointCount; i++)
                                        {
                                            IPoint ptIntersect = geoCol.get_Point(i);
                                            ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y);
                                            ppline.clh        = GetInterPointHeight(ptIntersect, polyline, startDepthHeight, endDepthHeight);
                                            if (ppline.clh > hmax)
                                            {
                                                hmax = ppline.clh;
                                            }
                                            if (ppline.clh < hmin)
                                            {
                                                hmin = ppline.clh;
                                            }
                                            ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight)
                                                         * Math.Sqrt((polyline.FromPoint.X - ptIntersect.X) * (polyline.FromPoint.X - ptIntersect.X)
                                                                     + (polyline.FromPoint.Y - ptIntersect.Y) * (polyline.FromPoint.Y - ptIntersect.Y)) / polyline.Length;
                                            if (ppline.cgh > hmax)
                                            {
                                                hmax = ppline.cgh;
                                            }
                                            if (ppline.cgh < hmin)
                                            {
                                                hmin = ppline.cgh;
                                            }
                                            // 辅助画图
                                            IPolyline l = pGeo as IPolyline;
                                            ppline.startPt = new PPPoint(l.FromPoint.X, l.FromPoint.Y);
                                            pplines.Add(ppline);
                                        }
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                    WaitForm.Stop();
                    if (pplines.Count < 2)
                    {
                        XtraMessageBox.Show("相交管线少于2个", "提示");
                        return;
                    }
                    pplines.Sort(new PPLineCompare2D());
                    double spacesum = 0.0;
                    for (int i = 1; i < pplines.Count; i++)
                    {
                        PPLine2D line1 = pplines[i - 1];
                        PPLine2D line2 = pplines[i];
                        line2.space = Math.Sqrt((line1.interPoint.X - line2.interPoint.X) * (line1.interPoint.X - line2.interPoint.X)
                                                + (line1.interPoint.Y - line2.interPoint.Y) * (line1.interPoint.Y - line2.interPoint.Y));
                        spacesum += line2.space;
                    }
                    ;
                    var                str1    = (pplines[0].interPoint.X / 1000).ToString("0.00");
                    var                str2    = (pplines[0].interPoint.Y / 1000).ToString("0.00");
                    string             mapNum  = str2 + "-" + str1;
                    string             mapName = SystemInfo.Instance.SystemFullName + "横断面图";
                    FrmSectionAnalysis dialog  = new FrmSectionAnalysis("横断面分析结果", 0);
                    dialog.SetInfo(mapName, mapNum, pplines, hmax, hmin, spacesum, road2);
                    dialog.Show();
                }
            }
            catch
            {
                WaitForm.Stop();
            }
        }
Beispiel #2
0
        private void LineQuery()
        {
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                IGeometry geo = this._drawTool.GetGeo();
                if (geo == null || geo.GeometryType != gviGeometryType.gviGeometryPolyline)
                {
                    return;
                }
                IPolyline line = geo as IPolyline;
                IPolyline l    = line.Clone2(gviVertexAttribute.gviVertexAttributeNone) as IPolyline;
                if (l.Length > 500)
                {
                    XtraMessageBox.Show("横断面线超过500米,分析效率很低,请重新绘制", "提示");
                    return;
                }
                WaitForm.Start("正在进行横断面分析...", "请稍后");
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }

                List <MajorClass> list = LogicDataStructureManage3D.Instance.GetAllMajorClass();
                if (list == null)
                {
                    return;
                }
                string        road1   = "";
                string        road2   = "";
                bool          bAlert  = false;
                double        hmax    = double.MinValue;
                double        hmin    = double.MaxValue;
                List <PPLine> pplines = new List <PPLine>();
                foreach (MajorClass mc in list)
                {
                    foreach (SubClass sc in mc.SubClasses)
                    {
                        if (!sc.Visible3D)
                        {
                            continue;
                        }
                        string[] arrFc3DId = mc.Fc3D.Split(';');
                        if (arrFc3DId == null)
                        {
                            continue;
                        }
                        foreach (string fc3DId in arrFc3DId)
                        {
                            DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId);
                            if (dffc == null)
                            {
                                continue;
                            }
                            IFeatureClass fc  = dffc.GetFeatureClass();
                            FacilityClass fac = dffc.GetFacilityClass();
                            if (fc == null || fac == null || fac.Name != "PipeLine")
                            {
                                continue;
                            }

                            IFieldInfoCollection fields = fc.GetFields();
                            int indexShape = fields.IndexOf("Shape");
                            if (indexShape == -1)
                            {
                                continue;
                            }
                            int indexFootPrint = fields.IndexOf("FootPrint");
                            if (indexFootPrint == -1)
                            {
                                continue;
                            }
                            DFDataConfig.Class.FieldInfo fiDiameter = fac.GetFieldInfoBySystemName("Diameter");
                            if (fiDiameter == null)
                            {
                                continue;
                            }
                            int indexDiameter = fields.IndexOf(fiDiameter.Name);
                            if (indexDiameter == -1)
                            {
                                continue;
                            }
                            DFDataConfig.Class.FieldInfo fiRoad = fac.GetFieldInfoBySystemName("Road");
                            int indexRoad = -1;
                            if (fiRoad != null)
                            {
                                indexRoad = fields.IndexOf(fiRoad.Name);
                            }
                            DFDataConfig.Class.FieldInfo fiHLB = fac.GetFieldInfoBySystemName("HLB");
                            int indexHLB = -1;
                            if (fiHLB != null)
                            {
                                indexHLB = fields.IndexOf(fiHLB.Name);
                            }
                            int indexClassify = fields.IndexOf(mc.ClassifyField);

                            ISpatialFilter pSpatialFilter = new SpatialFilter();
                            pSpatialFilter.Geometry      = l;
                            pSpatialFilter.GeometryField = "FootPrint";
                            pSpatialFilter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                            pSpatialFilter.WhereClause   = mc.ClassifyField + " = '" + sc.Name + "'";

                            cursor = fc.Search(pSpatialFilter, false);
                            while ((row = cursor.NextRow()) != null)
                            {
                                if (indexRoad != -1 && !row.IsNull(indexRoad))
                                {
                                    if (road2 == "")
                                    {
                                        road1 = row.GetValue(indexRoad).ToString();
                                        road2 = row.GetValue(indexRoad).ToString();
                                    }
                                    else
                                    {
                                        road1 = row.GetValue(indexRoad).ToString();
                                        if (road1 != road2)
                                        {
                                            if (!bAlert)
                                            {
                                                XtraMessageBox.Show("横断面线跨越多条道路,当前只绘制在【" + road2 + "】上的管线横断面图。", "提示");
                                                bAlert = true;
                                            }
                                            continue;
                                        }
                                    }
                                }


                                double startSurfHeight = double.MaxValue;
                                double endSurfHeight   = double.MaxValue;
                                if (!app.Current3DMapControl.Terrain.IsRegistered)
                                {
                                    DFDataConfig.Class.FieldInfo fiStartSurfHeight = fac.GetFieldInfoBySystemName("StartSurfHeight");
                                    if (fiStartSurfHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexStartSurfHeight = fields.IndexOf(fiStartSurfHeight.Name);
                                    if (indexStartSurfHeight == -1)
                                    {
                                        continue;
                                    }
                                    DFDataConfig.Class.FieldInfo fiEndSurfHeight = fac.GetFieldInfoBySystemName("EndSurfHeight");
                                    if (fiEndSurfHeight == null)
                                    {
                                        continue;
                                    }
                                    int indexEndSurfHeight = fields.IndexOf(fiEndSurfHeight.Name);
                                    if (indexEndSurfHeight == -1)
                                    {
                                        continue;
                                    }
                                    if (!row.IsNull(indexStartSurfHeight))
                                    {
                                        startSurfHeight = double.Parse(row.GetValue(indexStartSurfHeight).ToString());
                                    }
                                    if (!row.IsNull(indexEndSurfHeight))
                                    {
                                        endSurfHeight = double.Parse(row.GetValue(indexEndSurfHeight).ToString());
                                    }
                                }
                                if (!row.IsNull(indexShape) && !row.IsNull(indexFootPrint))
                                {
                                    object objFootPrint = row.GetValue(indexFootPrint);
                                    object objShape     = row.GetValue(indexShape);
                                    if (objFootPrint is IPolyline && objShape is IPolyline)
                                    {
                                        IPolyline polylineFootPrint = objFootPrint as IPolyline;
                                        IPolyline polylineShape     = objShape as IPolyline;
                                        IGeometry geoIntersect      = (geo as ITopologicalOperator2D).Intersection2D(polylineFootPrint);
                                        if (geoIntersect == null)
                                        {
                                            continue;
                                        }
                                        PPLine ppline = new PPLine();
                                        if (indexClassify == -1 || row.IsNull(indexClassify))
                                        {
                                            ppline.facType = mc.Name;
                                        }
                                        else
                                        {
                                            ppline.facType = row.GetValue(indexClassify).ToString();
                                        }
                                        if (!row.IsNull(indexDiameter))
                                        {
                                            string diameter = row.GetValue(indexDiameter).ToString();
                                            if (diameter.Trim() == "")
                                            {
                                                continue;
                                            }
                                            ppline.dia = diameter;
                                            int indexDia = diameter.IndexOf('*');
                                            if (indexDia != -1)
                                            {
                                                ppline.isrect = true;
                                                int  iDia1;
                                                bool bDia1 = int.TryParse(diameter.Substring(0, indexDia), out iDia1);
                                                if (!bDia1)
                                                {
                                                    continue;
                                                }
                                                int  iDia2;
                                                bool bDia2 = int.TryParse(diameter.Substring(indexDia + 1, diameter.Length - indexDia - 1), out iDia2);
                                                if (!bDia2)
                                                {
                                                    continue;
                                                }
                                                ppline.gj.Add(iDia1);
                                                ppline.gj.Add(iDia2);
                                            }
                                            else
                                            {
                                                ppline.isrect = false;
                                                int  iDia;
                                                bool bDia = int.TryParse(diameter, out iDia);
                                                if (!bDia)
                                                {
                                                    continue;
                                                }
                                                ppline.gj.Add(iDia);
                                                ppline.gj.Add(iDia);
                                            }
                                        }
                                        int hlb = 0;
                                        if (indexHLB != -1 && !row.IsNull(indexHLB))
                                        {
                                            string strhlb = row.GetValue(indexHLB).ToString();
                                            if (strhlb.Contains("内"))
                                            {
                                                hlb = 1;
                                            }
                                            else if (strhlb.Contains("外"))
                                            {
                                                hlb = -1;
                                            }
                                            else
                                            {
                                                hlb = 0;
                                            }
                                            ppline.hlb = hlb;
                                        }
                                        #region  交点为一个
                                        if (geoIntersect.GeometryType == gviGeometryType.gviGeometryPoint) //交点为1个
                                        {
                                            IPoint ptIntersect = geoIntersect as IPoint;
                                            ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y, ptIntersect.Z);
                                            ppline.clh        = GetInterPointHeight(ptIntersect, polylineShape, polylineFootPrint);
                                            if (ppline.clh > hmax)
                                            {
                                                hmax = ppline.clh;
                                            }
                                            if (ppline.clh < hmin)
                                            {
                                                hmin = ppline.clh;
                                            }

                                            if (app.Current3DMapControl.Terrain.IsRegistered)
                                            {
                                                ppline.cgh = app.Current3DMapControl.Terrain.GetElevation(ptIntersect.X, ptIntersect.Y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase);
                                            }
                                            else
                                            {
                                                ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight)
                                                             * Math.Sqrt((polylineFootPrint.StartPoint.X - ptIntersect.X) * (polylineFootPrint.StartPoint.X - ptIntersect.X)
                                                                         + (polylineFootPrint.StartPoint.Y - ptIntersect.Y) * (polylineFootPrint.StartPoint.Y - ptIntersect.Y)) / polylineFootPrint.Length;
                                            }
                                            if (ppline.cgh > hmax)
                                            {
                                                hmax = ppline.cgh;
                                            }
                                            if (ppline.cgh < hmin)
                                            {
                                                hmin = ppline.cgh;
                                            }
                                            // 辅助画图
                                            ppline.startPt = new PPPoint(l.StartPoint.X, l.StartPoint.Y, l.StartPoint.Z);
                                            pplines.Add(ppline);
                                        }
                                        #endregion

                                        #region 交点为多个
                                        else if (geoIntersect.GeometryType == gviGeometryType.gviGeometryMultiPoint) //交点为多个
                                        {
                                            IMultiPoint multiPts = geoIntersect as IMultiPoint;
                                            for (int m = 0; m < multiPts.GeometryCount; m++)
                                            {
                                                IPoint ptIntersect = multiPts.GetPoint(m);
                                                ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y, ptIntersect.Z);
                                                ppline.clh        = GetInterPointHeight(ptIntersect, polylineShape, polylineFootPrint);
                                                if (ppline.clh > hmax)
                                                {
                                                    hmax = ppline.clh;
                                                }
                                                if (ppline.clh < hmin)
                                                {
                                                    hmin = ppline.clh;
                                                }

                                                if (app.Current3DMapControl.Terrain.IsRegistered)
                                                {
                                                    ppline.cgh = app.Current3DMapControl.Terrain.GetElevation(ptIntersect.X, ptIntersect.Y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase);
                                                }
                                                else
                                                {
                                                    ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight)
                                                                 * Math.Sqrt((polylineFootPrint.StartPoint.X - ptIntersect.X) * (polylineFootPrint.StartPoint.X - ptIntersect.X)
                                                                             + (polylineFootPrint.StartPoint.Y - ptIntersect.Y) * (polylineFootPrint.StartPoint.Y - ptIntersect.Y)) / polylineFootPrint.Length;
                                                }
                                                if (ppline.cgh > hmax)
                                                {
                                                    hmax = ppline.cgh;
                                                }
                                                if (ppline.cgh < hmin)
                                                {
                                                    hmin = ppline.cgh;
                                                }

                                                // 辅助画图
                                                ppline.startPt = new PPPoint(l.StartPoint.X, l.StartPoint.Y, l.StartPoint.Z);
                                                pplines.Add(ppline);
                                            }
                                        }
                                        #endregion

                                        else
                                        {
                                            continue;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                WaitForm.Stop();
                if (pplines.Count < 2)
                {
                    XtraMessageBox.Show("相交管线少于2个", "提示");
                    return;
                }
                pplines.Sort(new PPLineCompare());
                double spacesum = 0.0;
                for (int i = 1; i < pplines.Count; i++)
                {
                    PPLine line1 = pplines[i - 1];
                    PPLine line2 = pplines[i];
                    line2.space = Math.Sqrt((line1.interPoint.X - line2.interPoint.X) * (line1.interPoint.X - line2.interPoint.X)
                                            + (line1.interPoint.Y - line2.interPoint.Y) * (line1.interPoint.Y - line2.interPoint.Y));
                    spacesum += line2.space;
                }
                ;
                var                str1    = (pplines[0].interPoint.X / 1000).ToString("0.00");
                var                str2    = (pplines[0].interPoint.Y / 1000).ToString("0.00");
                string             mapNum  = str2 + "-" + str1;
                string             mapName = SystemInfo.Instance.SystemFullName + "横断面图";
                FrmSectionAnalysis dialog  = new FrmSectionAnalysis("横断面分析结果", 0);
                dialog.SetInfo(mapName, mapNum, pplines, hmax, hmin, spacesum, road2);
                dialog.Show();
            }
            catch (Exception ex)
            {
                WaitForm.Stop();
            }
            finally
            {
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
                if (row != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                    row = null;
                }
            }
        }
Beispiel #3
0
        private void btnAnalysis_Click(object sender, EventArgs e)
        {
            try
            {
                if (this._dt.Rows.Count < 2)
                {
                    XtraMessageBox.Show("点数少于2个", "提示");
                    return;
                }
                IPoint startPt = this._dt.Rows[0]["InterPoint"] as IPoint;
                if (startPt == null)
                {
                    return;
                }

                WaitForm.Start("正在进行纵断面分析...", "请稍后");
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }

                string        road1   = "";
                string        road2   = "";
                bool          bAlert  = false;
                double        hmax    = double.MinValue;
                double        hmin    = double.MaxValue;
                List <PPLine> pplines = new List <PPLine>();
                foreach (DataRow dr in this._dt.Rows)
                {
                    IFeatureClass fc = dr["FeatureClass"] as IFeatureClass;
                    MajorClass    mc = dr["PipeType"] as MajorClass;
                    if (fc == null || mc == null)
                    {
                        continue;
                    }
                    DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc.GuidString);
                    if (dffc == null)
                    {
                        continue;
                    }
                    FacilityClass fac = dffc.GetFacilityClass();
                    if (fac == null || fac.Name != "PipeLine")
                    {
                        continue;
                    }

                    IFieldInfoCollection fields = fc.GetFields();
                    int indexShape = fields.IndexOf("Shape");
                    if (indexShape == -1)
                    {
                        continue;
                    }
                    int indexFootPrint = fields.IndexOf("FootPrint");
                    if (indexFootPrint == -1)
                    {
                        continue;
                    }
                    DFDataConfig.Class.FieldInfo fiDiameter = fac.GetFieldInfoBySystemName("Diameter");
                    if (fiDiameter == null)
                    {
                        continue;
                    }
                    int indexDiameter = fields.IndexOf(fiDiameter.Name);
                    if (indexDiameter == -1)
                    {
                        continue;
                    }
                    DFDataConfig.Class.FieldInfo fiRoad = fac.GetFieldInfoBySystemName("Road");
                    int indexRoad = -1;
                    if (fiRoad != null)
                    {
                        indexRoad = fields.IndexOf(fiRoad.Name);
                    }
                    DFDataConfig.Class.FieldInfo fiHLB = fac.GetFieldInfoBySystemName("HLB");
                    int indexHLB = -1;
                    if (fiHLB != null)
                    {
                        indexHLB = fields.IndexOf(fiHLB.Name);
                    }
                    int indexClassify = fields.IndexOf(mc.ClassifyField);

                    int        fid    = int.Parse(dr["Fid"].ToString());
                    IFdeCursor cursor = null;
                    IRowBuffer row    = null;
                    try
                    {
                        IQueryFilter filter = new QueryFilter();
                        filter.WhereClause = "oid=" + fid;
                        cursor             = fc.Search(filter, false);
                        if ((row = cursor.NextRow()) != null)
                        {
                            if (indexRoad != -1 && !row.IsNull(indexRoad))
                            {
                                if (road2 == "")
                                {
                                    road1 = row.GetValue(indexRoad).ToString();
                                    road2 = row.GetValue(indexRoad).ToString();
                                }
                                else
                                {
                                    road1 = row.GetValue(indexRoad).ToString();
                                    if (road1 != road2)
                                    {
                                        if (!bAlert)
                                        {
                                            XtraMessageBox.Show("跨越多条道路,当前只绘制在【" + road2 + "】上的管线纵断面图。", "提示");
                                            bAlert = true;
                                        }
                                        continue;
                                    }
                                }
                            }


                            double startSurfHeight = double.MaxValue;
                            double endSurfHeight   = double.MaxValue;
                            if (!app.Current3DMapControl.Terrain.IsRegistered)
                            {
                                DFDataConfig.Class.FieldInfo fiStartSurfHeight = fac.GetFieldInfoBySystemName("StartSurfHeight");
                                if (fiStartSurfHeight == null)
                                {
                                    continue;
                                }
                                int indexStartSurfHeight = fields.IndexOf(fiStartSurfHeight.Name);
                                if (indexStartSurfHeight == -1)
                                {
                                    continue;
                                }
                                DFDataConfig.Class.FieldInfo fiEndSurfHeight = fac.GetFieldInfoBySystemName("EndSurfHeight");
                                if (fiEndSurfHeight == null)
                                {
                                    continue;
                                }
                                int indexEndSurfHeight = fields.IndexOf(fiEndSurfHeight.Name);
                                if (indexEndSurfHeight == -1)
                                {
                                    continue;
                                }
                                if (!row.IsNull(indexStartSurfHeight))
                                {
                                    startSurfHeight = double.Parse(row.GetValue(indexStartSurfHeight).ToString());
                                }
                                if (!row.IsNull(indexEndSurfHeight))
                                {
                                    endSurfHeight = double.Parse(row.GetValue(indexEndSurfHeight).ToString());
                                }
                            }
                            if (!row.IsNull(indexShape) && !row.IsNull(indexFootPrint))
                            {
                                object objFootPrint = row.GetValue(indexFootPrint);
                                object objShape     = row.GetValue(indexShape);
                                if (objFootPrint is IPolyline && objShape is IPolyline)
                                {
                                    IPolyline polylineFootPrint = objFootPrint as IPolyline;
                                    IPolyline polylineShape     = objShape as IPolyline;
                                    PPLine    ppline            = new PPLine();
                                    if (indexClassify == -1 || row.IsNull(indexClassify))
                                    {
                                        ppline.facType = mc.Name;
                                    }
                                    else
                                    {
                                        ppline.facType = row.GetValue(indexClassify).ToString();
                                    }
                                    if (!row.IsNull(indexDiameter))
                                    {
                                        string diameter = row.GetValue(indexDiameter).ToString();
                                        if (diameter.Trim() == "")
                                        {
                                            continue;
                                        }
                                        ppline.dia = diameter;
                                        int indexDia = diameter.IndexOf('*');
                                        if (indexDia != -1)
                                        {
                                            ppline.isrect = true;
                                            int  iDia1;
                                            bool bDia1 = int.TryParse(diameter.Substring(0, indexDia), out iDia1);
                                            if (!bDia1)
                                            {
                                                continue;
                                            }
                                            int  iDia2;
                                            bool bDia2 = int.TryParse(diameter.Substring(indexDia + 1, diameter.Length - indexDia - 1), out iDia2);
                                            if (!bDia2)
                                            {
                                                continue;
                                            }
                                            ppline.gj.Add(iDia1);
                                            ppline.gj.Add(iDia2);
                                        }
                                        else
                                        {
                                            ppline.isrect = false;
                                            int  iDia;
                                            bool bDia = int.TryParse(diameter, out iDia);
                                            if (!bDia)
                                            {
                                                continue;
                                            }
                                            ppline.gj.Add(iDia);
                                            ppline.gj.Add(iDia);
                                        }
                                    }
                                    int hlb = 0;
                                    if (indexHLB != -1 && !row.IsNull(indexHLB))
                                    {
                                        string strhlb = row.GetValue(indexHLB).ToString();
                                        if (strhlb.Contains("内"))
                                        {
                                            hlb = 1;
                                        }
                                        else if (strhlb.Contains("外"))
                                        {
                                            hlb = -1;
                                        }
                                        else
                                        {
                                            hlb = 0;
                                        }
                                        ppline.hlb = hlb;
                                    }
                                    IPoint ptIntersect = dr["InterPoint"] as IPoint;
                                    ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y, ptIntersect.Z);
                                    ppline.clh        = GetInterPointHeight(ptIntersect, polylineShape, polylineFootPrint);
                                    if (ppline.clh > hmax)
                                    {
                                        hmax = ppline.clh;
                                    }
                                    if (ppline.clh < hmin)
                                    {
                                        hmin = ppline.clh;
                                    }
                                    if (app.Current3DMapControl.Terrain.IsRegistered)
                                    {
                                        ppline.cgh = app.Current3DMapControl.Terrain.GetElevation(ptIntersect.X, ptIntersect.Y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase);
                                    }
                                    else
                                    {
                                        ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight)
                                                     * Math.Sqrt((polylineFootPrint.StartPoint.X - ptIntersect.X) * (polylineFootPrint.StartPoint.X - ptIntersect.X)
                                                                 + (polylineFootPrint.StartPoint.Y - ptIntersect.Y) * (polylineFootPrint.StartPoint.Y - ptIntersect.Y)) / polylineFootPrint.Length;
                                    }
                                    if (ppline.cgh > hmax)
                                    {
                                        hmax = ppline.cgh;
                                    }
                                    if (ppline.cgh < hmin)
                                    {
                                        hmin = ppline.cgh;
                                    }
                                    // 辅助画图
                                    ppline.startPt = new PPPoint(startPt.X, startPt.Y, startPt.Z);
                                    pplines.Add(ppline);
                                }
                            }
                        }
                    }
                    catch (Exception ex) { }
                    finally
                    {
                        if (cursor != null)
                        {
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                            cursor = null;
                        }
                        if (row != null)
                        {
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                            row = null;
                        }
                    }
                }
                WaitForm.Stop();
                if (pplines.Count < 2)
                {
                    XtraMessageBox.Show("点数少于2个", "提示");
                    return;
                }
                pplines.Sort(new PPLineCompare());
                double spacesum = 0.0;
                for (int i = 1; i < pplines.Count; i++)
                {
                    PPLine line1 = pplines[i - 1];
                    PPLine line2 = pplines[i];
                    line2.space = Math.Sqrt((line1.interPoint.X - line2.interPoint.X) * (line1.interPoint.X - line2.interPoint.X)
                                            + (line1.interPoint.Y - line2.interPoint.Y) * (line1.interPoint.Y - line2.interPoint.Y));
                    spacesum += line2.space;
                }
                ;
                var                str1    = (pplines[0].interPoint.X / 1000).ToString("0.00");
                var                str2    = (pplines[0].interPoint.Y / 1000).ToString("0.00");
                string             mapNum  = str2 + "-" + str1;
                string             mapName = SystemInfo.Instance.SystemFullName + "纵断面图";
                FrmSectionAnalysis dialog  = new FrmSectionAnalysis("纵断面分析结果", 1);
                dialog.SetInfo(mapName, mapNum, pplines, hmax, hmin, spacesum, road2);
                dialog.Show();
            }
            catch (Exception ex)
            {
                WaitForm.Stop();
            }
            finally
            {
            }
        }
Beispiel #4
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app = DF2DApplication.Application;

            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            IActiveView    m_ActiveView   = app.Current2DMapControl.ActiveView;
            IScreenDisplay m_Display      = app.Current2DMapControl.ActiveView.ScreenDisplay;
            IGeometry      pGeo           = null;
            IFeatureCursor pFeatureCursor = null;
            IFeature       pFeature       = null;

            try
            {
                if (button == 1)
                {
                    PointClass searchPoint = new PointClass();
                    searchPoint.PutCoords(mapX, mapY);
                    pGeo = PublicFunction.DoBuffer(searchPoint,
                                                   PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                    if (pGeo == null)
                    {
                        return;
                    }

                    WaitForm.Start("正在进行纵断面分析...", "请稍后");
                    string          road1   = "";
                    string          road2   = "";
                    bool            bAlert  = false;
                    double          hmax    = double.MinValue;
                    double          hmin    = double.MaxValue;
                    List <PPLine2D> pplines = new List <PPLine2D>();

                    bool haveone             = false;
                    List <MajorClass> listMC = LogicDataStructureManage2D.Instance.GetAllMajorClass();
                    foreach (MajorClass mc in listMC)
                    {
                        if (haveone)
                        {
                            break;
                        }
                        foreach (SubClass sc in mc.SubClasses)
                        {
                            if (haveone)
                            {
                                break;
                            }
                            if (!sc.Visible2D)
                            {
                                continue;
                            }
                            string[] arrFc2DId = mc.Fc2D.Split(';');
                            if (arrFc2DId == null)
                            {
                                continue;
                            }
                            foreach (string fc2DId in arrFc2DId)
                            {
                                if (haveone)
                                {
                                    break;
                                }
                                DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                                if (dffc == null)
                                {
                                    continue;
                                }
                                IFeatureClass fc   = dffc.GetFeatureClass();
                                FacilityClass facc = dffc.GetFacilityClass();
                                if (facc.Name != "PipeLine")
                                {
                                    continue;
                                }
                                if (fc == null || pGeo == null)
                                {
                                    continue;
                                }
                                ISpatialFilter pSpatialFilter = new SpatialFilter();
                                pSpatialFilter.Geometry    = pGeo;
                                pSpatialFilter.SpatialRel  = esriSpatialRelEnum.esriSpatialRelIntersects;
                                pSpatialFilter.WhereClause = UpOrDown.DecorateWhereClasuse(fc) + sc.Parent.ClassifyField + " =  '" + sc.Name + "'";
                                pFeatureCursor             = fc.Search(pSpatialFilter, true);
                                if (pFeatureCursor == null)
                                {
                                    continue;
                                }
                                pFeature = pFeatureCursor.NextFeature();
                                if (pFeature == null)
                                {
                                    continue;
                                }

                                //查找管径长宽字段,获得该要素类下字段索引值,若为圆管,则长宽相等
                                DFDataConfig.Class.FieldInfo fiDia  = facc.GetFieldInfoBySystemName("Diameter");
                                DFDataConfig.Class.FieldInfo fiDia1 = facc.GetFieldInfoBySystemName("Diameter1");
                                DFDataConfig.Class.FieldInfo fiDia2 = facc.GetFieldInfoBySystemName("Diameter2");
                                int indexDia       = fc.Fields.FindField(fiDia.Name);
                                int indexDiaWith   = fc.Fields.FindField(fiDia1.Name);
                                int indexDiaHeight = fc.Fields.FindField(fiDia2.Name);
                                if (indexDiaWith == -1 || indexDiaHeight == -1 || indexDia == -1)
                                {
                                    continue;
                                }
                                //查找道路字段索引
                                DFDataConfig.Class.FieldInfo fiRoad = facc.GetFieldInfoBySystemName("Road");
                                int indexRoad = fc.Fields.FindField(fiRoad.Name);
                                //查找管线高类别索引
                                DFDataConfig.Class.FieldInfo fiHLB = facc.GetFieldInfoBySystemName("HLB");
                                int indexHLB = fc.Fields.FindField(fiHLB.Name);
                                //二级分类名索引
                                int indexClassify = fc.Fields.FindField(mc.ClassifyField);

                                if (indexRoad != -1)
                                {
                                    if (road2 == "")
                                    {
                                        road1 = pFeature.get_Value(indexRoad).ToString();
                                        road2 = pFeature.get_Value(indexRoad).ToString();
                                    }
                                    else
                                    {
                                        road1 = pFeature.get_Value(indexRoad).ToString();
                                        if (road1 != road2)
                                        {
                                            if (!bAlert)
                                            {
                                                XtraMessageBox.Show("横断面线跨越多条道路,当前只绘制在【" + road2 + "】上的管线纵断面图。", "提示");
                                                bAlert = true;
                                            }
                                            continue;
                                        }
                                    }
                                }

                                //查找管线的起点终点地面高
                                double startSurfHeight = double.MaxValue;
                                double endSurfHeight   = double.MaxValue;
                                DFDataConfig.Class.FieldInfo fiStartSurfHeight = facc.GetFieldInfoBySystemName("StartSurfH");
                                if (fiStartSurfHeight == null)
                                {
                                    continue;
                                }
                                int indexStartSurfHeight = pFeature.Fields.FindField(fiStartSurfHeight.Name);
                                if (indexStartSurfHeight == -1)
                                {
                                    continue;
                                }

                                DFDataConfig.Class.FieldInfo fiEndSurfHeight = facc.GetFieldInfoBySystemName("EndSurfH");
                                if (fiEndSurfHeight == null)
                                {
                                    continue;
                                }
                                int indexEndSurfHeight = pFeature.Fields.FindField(fiEndSurfHeight.Name);
                                if (indexEndSurfHeight == -1)
                                {
                                    continue;
                                }
                                //若管线属性地面高字段为null,则从DEM取值
                                if (pFeature.get_Value(indexStartSurfHeight).ToString() == "" || pFeature.get_Value(indexEndSurfHeight).ToString() == "")
                                {
                                    startSurfHeight = ReadDemRaster.GetH((pFeature.Shape as IPolyline).FromPoint);
                                    endSurfHeight   = ReadDemRaster.GetH((pFeature.Shape as IPolyline).ToPoint);
                                }
                                else
                                {
                                    startSurfHeight = Convert.ToDouble(pFeature.get_Value(indexStartSurfHeight).ToString());
                                    endSurfHeight   = Convert.ToDouble(pFeature.get_Value(indexEndSurfHeight).ToString());
                                }

                                //查找管线起点高程和终点高程
                                double startDepthHeight = double.MaxValue;
                                double endDepthHeight   = double.MaxValue;
                                DFDataConfig.Class.FieldInfo fiStartDepthHeight = facc.GetFieldInfoBySystemName("StartHeight2D");
                                if (fiStartDepthHeight == null)
                                {
                                    continue;
                                }
                                int indexStartDepthHeight = pFeature.Fields.FindField(fiStartDepthHeight.Name);
                                if (indexStartDepthHeight == -1)
                                {
                                    continue;
                                }

                                DFDataConfig.Class.FieldInfo fiEndDepthHeight = facc.GetFieldInfoBySystemName("EndHeight");
                                if (fiEndDepthHeight == null)
                                {
                                    continue;
                                }
                                int indexEndDepthHeight = pFeature.Fields.FindField(fiEndDepthHeight.Name);
                                if (indexEndDepthHeight == -1)
                                {
                                    continue;
                                }

                                startDepthHeight = Convert.ToDouble(pFeature.get_Value(indexStartDepthHeight).ToString());
                                endDepthHeight   = Convert.ToDouble(pFeature.get_Value(indexEndDepthHeight).ToString());


                                //查找管线的管径,判断其是方管还是圆管
                                string diameter  = pFeature.get_Value(indexDia).ToString();
                                string diameter1 = pFeature.get_Value(indexDiaWith).ToString();
                                string diameter2 = pFeature.get_Value(indexDiaHeight).ToString();

                                IPolyline pline      = pFeature.Shape as IPolyline;
                                IPoint    startpoint = pline.FromPoint;
                                IPoint    endpoint   = pline.ToPoint;
                                IPoint[]  points     = new IPoint[] { startpoint, endpoint };
                                for (int i = 0; i < points.Length; i++)
                                {
                                    PPLine2D ppline = new PPLine2D();
                                    if (indexClassify == -1)
                                    {
                                        ppline.facType = mc.Name;
                                    }
                                    else
                                    {
                                        ppline.facType = pFeature.get_Value(indexClassify).ToString();
                                    }
                                    if (diameter.Trim() == "")
                                    {
                                        continue;
                                    }
                                    ppline.dia = diameter;
                                    int indexSplit = diameter.IndexOf('*');
                                    if (indexSplit != -1)
                                    {
                                        ppline.isrect = true;
                                        int  iDia1;
                                        bool bDia1 = int.TryParse(diameter.Substring(0, indexSplit), out iDia1);
                                        if (!bDia1)
                                        {
                                            continue;
                                        }
                                        int  iDia2;
                                        bool bDia2 = int.TryParse(diameter.Substring(indexSplit + 1, diameter.Length - indexDia - 1), out iDia2);
                                        if (!bDia2)
                                        {
                                            continue;
                                        }
                                        ppline.gj.Add(iDia1);
                                        ppline.gj.Add(iDia2);
                                    }
                                    else
                                    {
                                        ppline.isrect = false;
                                        int  iDia;
                                        bool bDia = int.TryParse(diameter, out iDia);
                                        if (!bDia)
                                        {
                                            continue;
                                        }
                                        ppline.gj.Add(iDia);
                                        ppline.gj.Add(iDia);
                                    }
                                    //判断管线高方式
                                    int hlb = 0;
                                    if (indexHLB != -1)
                                    {
                                        string strhlb = pFeature.get_Value(indexHLB).ToString();
                                        if (strhlb.Contains("内"))
                                        {
                                            hlb = 1;
                                        }
                                        else if (strhlb.Contains("外"))
                                        {
                                            hlb = -1;
                                        }
                                        else
                                        {
                                            hlb = 0;
                                        }
                                        ppline.hlb = hlb;
                                    }
                                    ppline.interPoint = new PPPoint(points[i].X, points[i].Y);
                                    if (i == 0)
                                    {
                                        ppline.clh = startDepthHeight;
                                        UpdateH(ppline.clh, ref hmax, ref hmin);
                                        ppline.cgh = startSurfHeight;
                                        UpdateH(ppline.cgh, ref hmax, ref hmin);
                                    }
                                    else
                                    {
                                        ppline.clh = endDepthHeight;
                                        UpdateH(ppline.clh, ref hmax, ref hmin);
                                        ppline.cgh = endSurfHeight;
                                        UpdateH(ppline.cgh, ref hmax, ref hmin);
                                    }
                                    // 辅助画图
                                    double deltaX = points[1].X - points[0].X;
                                    double deltaY = points[1].Y - points[0].Y;
                                    ppline.startPt = new PPPoint(points[0].X - deltaX, points[0].Y - deltaY);
                                    pplines.Add(ppline);
                                }
                            }
                        }
                    }
                    WaitForm.Stop();
                    pplines.Sort(new PPLineCompare2D());
                    double spacesum = 0.0;
                    for (int i = 1; i < pplines.Count; i++)
                    {
                        PPLine2D line1 = pplines[i - 1];
                        PPLine2D line2 = pplines[i];
                        line2.space = Math.Sqrt((line1.interPoint.X - line2.interPoint.X) * (line1.interPoint.X - line2.interPoint.X)
                                                + (line1.interPoint.Y - line2.interPoint.Y) * (line1.interPoint.Y - line2.interPoint.Y));
                        spacesum += line2.space;
                    }
                    ;
                    var                str1    = (pplines[0].interPoint.X / 1000).ToString("0.00");
                    var                str2    = (pplines[0].interPoint.Y / 1000).ToString("0.00");
                    string             mapNum  = str2 + "-" + str1;
                    string             mapName = SystemInfo.Instance.SystemFullName + "纵断面图";
                    FrmSectionAnalysis dialog  = new FrmSectionAnalysis("纵断面分析结果", 1);
                    dialog.SetInfo(mapName, mapNum, pplines, hmax, hmin, spacesum, road2);
                    dialog.Show();
                }
            }
            catch (System.Exception ex)
            {
                WaitForm.Stop();
            }
            finally
            {
                if (pFeatureCursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
                    pFeatureCursor = null;
                }
                if (pFeature != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeature);
                    pFeature = null;
                }
            }
        }