/// <summary>
 /// 计算延长线上的距离
 /// </summary>
 /// <params name="startP"></params>
 /// <params name="endP"></params>
 /// <params name="jjcd"></params>
 /// <returns></returns>
 public IPoint CalculateExtendPointNew(IPolyline plin, IPoint pntTo, double jjcd, out bool bres)
 {
     bres = false;
     IPoint pntOut = new PointClass();
     double distfrom = 0.0, distto = 0.0;
     double outdistfrom = 0.0, outdistto = 0.0;
     bool boolfrom = false;
     plin.QueryPointAndDistance(esriSegmentExtension.esriExtendAtFrom, pntTo, false, pntOut, ref distfrom, ref outdistfrom, ref boolfrom);
     plin.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntTo, false, pntOut, ref distto, ref outdistto, ref boolfrom);
     if (distfrom < distto)//反向的
     {
         bres = true;
         plin.ReverseOrientation();
         plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, pntOut);
     }
     else//正向
     {
         bres = false;
         plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, pntOut);
     }
     return pntOut;
 }
    private void SetPINValue()
    {
      //The Theory.
      //Select polygons that intersect the sketch.
      //Construct one polyline from the boundaries and intersect with sketch.
      //Sort resulting intersection locations (multipoint) by distance of the intersect
      // from the start of the sketch and create new ordered multipoint.
      //Loop through new ordered multipoint, select underlying parcel and calc pin.

      IFeatureLayer featLayer = m_editLayers.CurrentLayer;
      m_curve = m_edSketch.Geometry as IPolyline;

      //Search parcel polys by graphic to get feature cursor
      ISpatialFilter spatialFilter = new SpatialFilter();
      spatialFilter.Geometry = m_curve;
      spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
      spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelCrosses;

      IFeatureCursor featCursor = featLayer.Search(spatialFilter,true);
      IFeature feature = featCursor.NextFeature();

      //If we have no intersects then exit
      if (feature == null)
        return;
  
      //Make a GeomBag of the polygons boundaries (polylines)
      IGeometryCollection geomBag = new GeometryBagClass();
      object missing = Type.Missing;
      while (feature != null)
      {
        ITopologicalOperator poly = feature.Shape as ITopologicalOperator;
        geomBag.AddGeometry(poly.Boundary,ref missing,ref missing);
        feature = featCursor.NextFeature();
      }

      //Make one polyline from the boundaries
      IPolyline polyLineU = new PolylineClass();
      ITopologicalOperator topoOp = polyLineU as ITopologicalOperator;
      topoOp.ConstructUnion(geomBag as IEnumGeometry);

      //Get the intersections of the boundaries and the curve
      IPointCollection pointCol = topoOp.Intersect(m_curve, esriGeometryDimension.esriGeometry0Dimension) as IPointCollection;

      //The point collection is not ordered by distance along the curve so
      //need to create a new collection with this info

      int[] pointOrder = new int[pointCol.PointCount];
      double dac = 0, dfc = 0;
      bool bRS = false;

      for (int i = 0; i < pointCol.PointCount; i++)
      {
        IPoint queryPoint = new PointClass();
        pointCol.QueryPoint(i, queryPoint);
        m_curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, queryPoint, false, null,ref dac,ref dfc,ref bRS);
        pointOrder[i] = (int)dac;
      }

      //use built in bubble sort
      System.Array.Sort(pointOrder);

      //Loop through the sorted array and calc midpoint between parcel boundaries
      IPointCollection midPoints = new MultipointClass();

      for (int i = 0; i < pointOrder.Length -1; i++)
      {
        //Get the midpoint distance
        double midPointDist = (pointOrder[i] + pointOrder[i + 1]) / 2;
        
        //create a point at the distance and store in point collection
        IPoint queryPoint = new PointClass();
        m_curve.QueryPoint(esriSegmentExtension.esriNoExtension, midPointDist, false, queryPoint);
        midPoints.AddPoint(queryPoint,ref missing,ref missing);
      }

      //If ends of sketch are included then add them as points
      if (chkEnds.Checked)
      {
        object before = 0 as object;
        midPoints.AddPoint(m_curve.FromPoint, ref before, ref missing);
        midPoints.AddPoint(m_curve.ToPoint, ref missing, ref missing);
      }

      m_editor.StartOperation();

      //Loop through calculated midpoints, select polygon and calc pin
      for (int i = 0; i < midPoints.PointCount; i++)
      {
        IPoint midPoint = midPoints.get_Point(i);
        spatialFilter = new SpatialFilter();
        spatialFilter.Geometry = midPoint;
        spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
        spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;

        featCursor = featLayer.Search(spatialFilter, false);
        while ((feature = featCursor.NextFeature()) != null)
        {
          feature.set_Value(feature.Fields.FindField(cmbPINField.Text), m_lotNum);
          feature.Store();
          m_lotNum += int.Parse(txtlotinc.Text);
        }
      }
      m_editor.StopOperation("ViperPIN");
      txtlot.Text = m_lotNum.ToString();
    }
예제 #3
0
        public static IPoint get_some_point(IPolyline line, double len)
        {
            IPoint point = new Point();

            line.QueryPoint(esriSegmentExtension.esriExtendAtFrom, len, false, point);
            return(point);
        }
예제 #4
0
        public static IPoint get_mid_point(IPolyline line)
        {
            IPoint point = new Point();

            line.QueryPoint(esriSegmentExtension.esriExtendAtFrom, line.Length / 2, false, point);
            return(point);
        }
예제 #5
0
        public void GetSortInfos(ArrayList pSortInfos)
        {
            pSortInfos.Clear();
            IMap         map         = m_context.FocusMap;
            IEnumFeature enumFeature = (IEnumFeature)map.FeatureSelection;
            IFeature     feature     = enumFeature.Next();

            if (feature != null)
            {
                do
                {
                    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;
                        IEnumFeature  enumFeatures  = pNetworkClass.GeometricNetwork.SearchForNetworkFeature(newCenter,
                                                                                                             esriFeatureType.esriFTSimpleEdge);

                        IEdgeFeature       edgeFeature     = (IEdgeFeature)enumFeatures.Next();
                        ISimpleEdgeFeature simpedgeFeature = (ISimpleEdgeFeature)edgeFeature;
                        pSortInfos.Add(new SortInfo
                        {
                            SmID    = simpedgeFeature.EID,
                            SmFNode = edgeFeature.FromJunctionEID,
                            SmTNode = edgeFeature.ToJunctionEID
                        });
                    }
                    //IEdgeFeature edgeFeature = (IEdgeFeature) feature;
                    //pSortInfos.Add(new SortInfo
                    //{
                    //    SmID = Convert.ToInt32(feature.get_Value(0).ToString()),
                    //    SmFNode = edgeFeature.FromJunctionEID,
                    //    SmTNode = edgeFeature.ToJunctionEID
                    //});
                    feature = enumFeature.Next();
                } while (feature != null);
            }
        }
예제 #6
0
        public static IPoint GetFeatureCenterPoint(IFeature pFeatCity)
        {
            if (pFeatCity.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                return(pFeatCity.Shape as IPoint);
            }

            else if (pFeatCity.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
            {
                IGeometry5 centerPoint = pFeatCity.Shape as IGeometry5;
                return(centerPoint.CentroidEx);
            }

            else if (pFeatCity.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
            {
                IPoint    centerPoint = new PointClass();
                IPolyline pl          = pFeatCity.Shape as IPolyline;
                pl.QueryPoint(esriSegmentExtension.esriExtendAtFrom, 0.5, true, centerPoint);
                return(centerPoint);
            }
            return(null);
        }
예제 #7
0
        /// <summary>
        /// 求每段延长线上的点坐标
        /// </summary>
        /// <returns></returns>
        private List <IPolyline> GetExtendPnts(List <IPolyline> polylines)
        {
            List <IPolyline> reslist = new List <IPolyline>();

            for (int i = 0; i < polylines.Count; i++)
            {
                IPolyline plin = polylines[i];
                //求延长线上指定长度的坐标
                IPoint outpto = new PointClass();
                outpto.SpatialReference = Global.spatialref;
                IPoint outpfrom = new PointClass();
                outpfrom.SpatialReference = Global.spatialref;
                if (i == 0)
                {
                    double distance = Math.Sqrt(Math.Pow(plin.ToPoint.X - polylines[i + 1].FromPoint.X, 2) + Math.Pow(plin.ToPoint.Y - polylines[i + 1].FromPoint.Y, 2));

                    plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, distance / 3.0 + plin.Length, false, outpto);
                    plin.QueryPoint(esriSegmentExtension.esriExtendAtFrom, -distance / 3.0, false, outpfrom);
                }
                else if (i == polylines.Count - 1)
                {
                    double distance1 = Math.Sqrt(Math.Pow(plin.FromPoint.X - polylines[i - 1].ToPoint.X, 2) + Math.Pow(plin.FromPoint.Y - polylines[i - 1].ToPoint.Y, 2));

                    plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, distance1 / 3.0 + plin.Length, false, outpto);
                    plin.QueryPoint(esriSegmentExtension.esriExtendAtFrom, -distance1 / 3.0, false, outpfrom);
                }
                else
                {
                    double distance2 = Math.Sqrt(Math.Pow(plin.ToPoint.X - polylines[i + 1].FromPoint.X, 2) + Math.Pow(plin.ToPoint.Y - polylines[i + 1].FromPoint.Y, 2));
                    double distance3 = Math.Sqrt(Math.Pow(plin.ToPoint.X - polylines[i - 1].FromPoint.X, 2) + Math.Pow(plin.ToPoint.Y - polylines[i - 1].FromPoint.Y, 2));

                    plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, distance2 / 3.0 + plin.Length, false, outpto);
                    plin.QueryPoint(esriSegmentExtension.esriExtendAtFrom, -distance3 / 3.0, false, outpfrom);
                }
                IPolyline plinnew = new PolylineClass();
                plinnew.FromPoint = outpfrom;
                plinnew.ToPoint   = outpto;
                reslist.Add(plinnew);
            }
            return(reslist);
        }
예제 #8
0
        private void DrawFlowDirection(IFeature feature, IMapControlDefault mapc, esriFlowDirection flowdir)
        {
            //获取线段中点
            IPolyline polyline = feature.Shape as IPolyline;
            IPoint    midpoint = new PointClass();

            polyline.QueryPoint(esriSegmentExtension.esriNoExtension, polyline.Length / 2, false, midpoint);
            //绘制特征符号
            IArrowMarkerSymbol  arrowSymbol  = new ArrowMarkerSymbolClass();
            ISimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbolClass();

            IElement element = null;

            //绘制沿顺着数字化流向
            if (flowdir == esriFlowDirection.esriFDWithFlow)
            {
                arrowSymbol.Size  = 12;
                arrowSymbol.Color = ExportMap.Getcolor(0, 0, 0);
                arrowSymbol.Angle = GetlineAngle(polyline.FromPoint, polyline.ToPoint);

                //绘制

                element          = new MarkerElementClass();
                element.Geometry = midpoint;
                ((IMarkerElement)element).Symbol = arrowSymbol;
                //设置绘制元素名称
                ((IElementProperties)element).Name = "Flow";
            }
            //方向顺着逆数字化的
            if (flowdir == esriFlowDirection.esriFDAgainstFlow)
            {
                arrowSymbol.Size  = 12;
                arrowSymbol.Color = ExportMap.Getcolor(0, 0, 0);
                arrowSymbol.Angle = GetlineAngle(polyline.FromPoint, polyline.ToPoint);

                //绘制

                element          = new MarkerElementClass();
                element.Geometry = midpoint;
                ((IMarkerElement)element).Symbol = arrowSymbol;
                //设置绘制元素名称
                ((IElementProperties)element).Name = "Flow";
            }
            //方向未初始化的
            if (flowdir == esriFlowDirection.esriFDUninitialized)
            {
                markerSymbol.Color = ExportMap.Getcolor(0, 0, 0);
                markerSymbol.Size  = 8;

                element          = new MarkerElementClass();
                element.Geometry = midpoint;
                ((IMarkerElement)element).Symbol = markerSymbol;
                //设置绘制元素名称
                ((IElementProperties)element).Name = "Flow";
            }
            //方向未定义的
            if (flowdir == esriFlowDirection.esriFDIndeterminate)
            {
                markerSymbol.Color = ExportMap.Getcolor(0, 0, 0);
                markerSymbol.Size  = 8;

                element          = new MarkerElementClass();
                element.Geometry = midpoint;
                ((IMarkerElement)element).Symbol = markerSymbol;
                //设置绘制元素名称
                ((IElementProperties)element).Name = "Flow";
            }
            mapc.ActiveView.GraphicsContainer.AddElement(element, 0);
        }
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication    app = DF2DApplication.Application;
            IGraphicsContainer gc  = app.Current2DMapControl.Map as IGraphicsContainer;

            gc.DeleteAllElements();
            bool ready = true;

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

            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;

                    ISimpleFillSymbol pFillSym = new SimpleFillSymbol();

                    pFillSym.Color   = pColor;
                    pFillSym.Style   = esriSimpleFillStyle.esriSFSDiagonalCross;
                    pFillSym.Outline = pLineSym;

                    object      symbol = pFillSym as object;
                    IRubberBand band   = new RubberRectangularPolygonClass();
                    IGeometry   geo    = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(geo, ref symbol);
                    WaitForm.Start("正在查询...", "请稍后");

                    if (geo.IsEmpty)
                    {
                        IPoint searchPoint = new PointClass();
                        searchPoint.PutCoords(mapX, mapY);
                        geo = PublicFunction.DoBuffer(searchPoint, PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                        //m_ActiveView.FocusMap.SelectByShape(geo, s, false);
                    }
                    if (ready)
                    {
                        foreach (MajorClass mc in LogicDataStructureManage2D.Instance.GetAllMajorClass())
                        {
                            if (mc.Alias == "电力" || mc.Alias == "通信" || mc.Alias == "架空")
                            {
                                continue;
                            }
                            string[] arrFc2DId = mc.Fc2D.Split(';');
                            if (arrFc2DId == null)
                            {
                                continue;
                            }
                            foreach (SubClass sc in mc.SubClasses)
                            {
                                if (!sc.Visible2D)
                                {
                                    continue;
                                }
                                foreach (string fc2DId in arrFc2DId)
                                {
                                    DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                                    if (dffc == null)
                                    {
                                        continue;
                                    }
                                    FacilityClass facc = dffc.GetFacilityClass();
                                    IFeatureClass fc   = dffc.GetFeatureClass();
                                    if (fc == null || facc == null || facc.Name != "PipeLine")
                                    {
                                        continue;
                                    }
                                    DFDataConfig.Class.FieldInfo fiDirection = facc.GetFieldInfoBySystemName("FlowDirection");
                                    if (fiDirection == null)
                                    {
                                        continue;
                                    }

                                    IFields pFields = fc.Fields;
                                    //string[] name = new string[pFields.FieldCount];
                                    //for (int i = 0; i < pFields.FieldCount; i++)
                                    //{
                                    //    name[i] = pFields.get_Field(i).Name;
                                    //}
                                    int indexDirection = pFields.FindField(fiDirection.Name);
                                    if (indexDirection < 0)
                                    {
                                        continue;
                                    }
                                    IField         pField = pFields.get_Field(indexDirection);
                                    ISpatialFilter filter = new SpatialFilter();
                                    filter.Geometry    = geo;
                                    filter.SubFields   = pField.Name;
                                    filter.WhereClause = mc.ClassifyField + " =  '" + sc.Name + "'";
                                    filter.SpatialRel  = esriSpatialRelEnum.esriSpatialRelIntersects;
                                    if (fc == null || geo == null)
                                    {
                                        return;
                                    }

                                    IFeatureCursor pFeatureCursor = null;
                                    IFeature       pFeature       = null;


                                    try
                                    {
                                        pFeatureCursor = fc.Search(filter, false);
                                        esriFlowDirection flowDirection = new esriFlowDirection();
                                        while ((pFeature = pFeatureCursor.NextFeature()) != null)
                                        {
                                            object tempobj = pFeature.get_Value(indexDirection);
                                            int    dtemp;
                                            if (tempobj != null && Int32.TryParse(tempobj.ToString(), out dtemp))
                                            {
                                                switch (dtemp)
                                                {
                                                case 0:
                                                    flowDirection = esriFlowDirection.esriFDWithFlow;
                                                    break;

                                                case 1:
                                                    flowDirection = esriFlowDirection.esriFDAgainstFlow;
                                                    break;
                                                }
                                            }
                                            else
                                            {
                                                flowDirection = esriFlowDirection.esriFDIndeterminate;
                                            }
                                            IPolyline polyline    = pFeature.Shape as IPolyline;
                                            IPoint    middlePoint = new PointClass();
                                            polyline.QueryPoint(esriSegmentExtension.esriNoExtension, polyline.Length / 2, false, middlePoint);

                                            IArrowMarkerSymbol  arrowMarkerSymbol  = new ArrowMarkerSymbolClass();
                                            ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
                                            IElement            element            = null;
                                            if (flowDirection == esriFlowDirection.esriFDWithFlow)
                                            {
                                                arrowMarkerSymbol.Angle = GetLineAngleFrom2Points(polyline.FromPoint, polyline.ToPoint);
                                                arrowMarkerSymbol.Color = GetColorByRGBValue(0, 0, 0);
                                                arrowMarkerSymbol.Size  = 12;
                                                element          = new MarkerElementClass();
                                                element.Geometry = middlePoint;
                                                ((IMarkerElement)element).Symbol   = arrowMarkerSymbol;
                                                ((IElementProperties)element).Name = "Flow";
                                            }
                                            else if (flowDirection == esriFlowDirection.esriFDAgainstFlow)
                                            {
                                                simpleMarkerSymbol.Angle = GetLineAngleFrom2Points(polyline.ToPoint, polyline.FromPoint);
                                                arrowMarkerSymbol.Color  = GetColorByRGBValue(0, 0, 0);
                                                arrowMarkerSymbol.Size   = 12;
                                                element          = new MarkerElementClass();
                                                element.Geometry = middlePoint;
                                                ((IMarkerElement)element).Symbol   = arrowMarkerSymbol;
                                                ((IElementProperties)element).Name = "Flow";
                                            }
                                            else if (flowDirection == esriFlowDirection.esriFDIndeterminate)
                                            {
                                                simpleMarkerSymbol.Color = GetColorByRGBValue(0, 0, 0);
                                                simpleMarkerSymbol.Size  = 8;
                                                element          = new MarkerElementClass();
                                                element.Geometry = middlePoint;
                                                ((IMarkerElement)element).Symbol   = simpleMarkerSymbol;
                                                ((IElementProperties)element).Name = "Flow";
                                            }
                                            else
                                            {
                                                simpleMarkerSymbol.Color = GetColorByRGBValue(255, 0, 0);
                                                simpleMarkerSymbol.Size  = 8;
                                                element          = new MarkerElementClass();
                                                element.Geometry = middlePoint;
                                                ((IMarkerElement)element).Symbol   = simpleMarkerSymbol;
                                                ((IElementProperties)element).Name = "Flow";
                                            }
                                            gc.AddElement(element, 0);
                                        }
                                    }
                                    catch (System.Exception ex)
                                    {
                                    }
                                }
                            }
                        }
                        WaitForm.Stop();
                        app.Current2DMapControl.ActiveView.Refresh();
                    }
                }
            }
            catch (System.Exception ex)
            {
            }
        }
예제 #10
0
        //!在这儿进行修改,将对高程埋深数据存储在不同位置进行统一处理
        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);
        }
        private void SetPINValue()
        {
            //The Theory.
            //Select polygons that intersect the sketch.
            //Construct one polyline from the boundaries and intersect with sketch.
            //Sort resulting intersection locations (multipoint) by distance of the intersect
            // from the start of the sketch and create new ordered multipoint.
            //Loop through new ordered multipoint, select underlying parcel and calc pin.

            IFeatureLayer featLayer = m_editLayers.CurrentLayer;

            m_curve = m_edSketch.Geometry as IPolyline;

            //Search parcel polys by graphic to get feature cursor
            ISpatialFilter spatialFilter = new SpatialFilter();

            spatialFilter.Geometry      = m_curve;
            spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
            spatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelCrosses;

            IFeatureCursor featCursor = featLayer.Search(spatialFilter, true);
            IFeature       feature    = featCursor.NextFeature();

            //If we have no intersects then exit
            if (feature == null)
            {
                return;
            }

            //Make a GeomBag of the polygons boundaries (polylines)
            IGeometryCollection geomBag = new GeometryBagClass();
            object missing = Type.Missing;

            while (feature != null)
            {
                ITopologicalOperator poly = feature.Shape as ITopologicalOperator;
                geomBag.AddGeometry(poly.Boundary, ref missing, ref missing);
                feature = featCursor.NextFeature();
            }

            //Make one polyline from the boundaries
            IPolyline            polyLineU = new PolylineClass();
            ITopologicalOperator topoOp    = polyLineU as ITopologicalOperator;

            topoOp.ConstructUnion(geomBag as IEnumGeometry);

            //Get the intersections of the boundaries and the curve
            IPointCollection pointCol = topoOp.Intersect(m_curve, esriGeometryDimension.esriGeometry0Dimension) as IPointCollection;

            //The point collection is not ordered by distance along the curve so
            //need to create a new collection with this info

            int[]  pointOrder = new int[pointCol.PointCount];
            double dac = 0, dfc = 0;
            bool   bRS = false;

            for (int i = 0; i < pointCol.PointCount; i++)
            {
                IPoint queryPoint = new PointClass();
                pointCol.QueryPoint(i, queryPoint);
                m_curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, queryPoint, false, null, ref dac, ref dfc, ref bRS);
                pointOrder[i] = (int)dac;
            }

            //use built in bubble sort
            System.Array.Sort(pointOrder);

            //Loop through the sorted array and calc midpoint between parcel boundaries
            IPointCollection midPoints = new MultipointClass();

            for (int i = 0; i < pointOrder.Length - 1; i++)
            {
                //Get the midpoint distance
                double midPointDist = (pointOrder[i] + pointOrder[i + 1]) / 2;

                //create a point at the distance and store in point collection
                IPoint queryPoint = new PointClass();
                m_curve.QueryPoint(esriSegmentExtension.esriNoExtension, midPointDist, false, queryPoint);
                midPoints.AddPoint(queryPoint, ref missing, ref missing);
            }

            //If ends of sketch are included then add them as points
            if (chkEnds.Checked)
            {
                object before = 0 as object;
                midPoints.AddPoint(m_curve.FromPoint, ref before, ref missing);
                midPoints.AddPoint(m_curve.ToPoint, ref missing, ref missing);
            }

            m_editor.StartOperation();

            //Loop through calculated midpoints, select polygon and calc pin
            for (int i = 0; i < midPoints.PointCount; i++)
            {
                IPoint midPoint = midPoints.get_Point(i);
                spatialFilter               = new SpatialFilter();
                spatialFilter.Geometry      = midPoint;
                spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
                spatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelWithin;

                featCursor = featLayer.Search(spatialFilter, false);
                while ((feature = featCursor.NextFeature()) != null)
                {
                    feature.set_Value(feature.Fields.FindField(cmbPINField.Text), m_lotNum);
                    feature.Store();
                    m_lotNum += int.Parse(txtlotinc.Text);
                }
            }
            m_editor.StopOperation("ViperPIN");
            txtlot.Text = m_lotNum.ToString();
        }
예제 #12
0
        public ProfileSession GenerateProfile(
            string profileSource,
            IEnumerable <IPolyline> profileLines,
            ProfileSettingsTypeEnum profileSettingsTypeEnum,
            int sessionId, string sessionName, double observHeight, string azimuthes)
        {
            string profileSourceName = GdbAccess.Instance.AddProfileLinesToCalculation(profileLines);

            var action = new ActionParam <string>()
            {
                ParamName = ActionParamNamesCore.Action,
                Value     = ActionsEnum.bsp.ToString()
            };


            string sdtnow    = MilSpace.DataAccess.Helper.GetTemporaryNameSuffix();
            var    resuTable = $"{MilSpaceConfiguration.ConnectionProperty.TemporaryGDBConnection}\\StackProfile{sdtnow}";
            var    profileLineFeatureClass = GdbAccess.Instance.GetProfileLinesFeatureClass(profileSourceName);


            var prm = new List <IActionParam>
            {
                action,
                new ActionParam <string>()
                {
                    ParamName = ActionParameters.FeatureClass, Value = profileLineFeatureClass
                },
                new ActionParam <string>()
                {
                    ParamName = ActionParameters.ProfileSource, Value = profileSource
                },
                new ActionParam <string>()
                {
                    ParamName = ActionParameters.DataWorkSpace, Value = resuTable
                },
                new ActionParam <string>()
                {
                    ParamName = ActionParameters.OutGraphName, Value = ""
                }
            };


            var procc = new ActionProcessor(prm);
            var res   = procc.Process <BoolResult>();

            if (!res.Result)
            {
                if (res.Exception != null)
                {
                    throw res.Exception;
                }
                //TODO: Log error
                throw new Exception(res.ErrorMessage);
            }


            //Take the table and import the data
            ISpatialReference currentSpatialreference = profileLines.First().SpatialReference;

            try
            {
                string        tempTableName = $"StackProfile{sdtnow}";
                ITable        profiletable  = GdbAccess.Instance.GetProfileTable(tempTableName);
                IFeatureClass lines         = GdbAccess.Instance.GetCalcProfileFeatureClass(profileSourceName);

                IQueryFilter queryFilter = new QueryFilter()
                {
                    WhereClause = WhereAllRecords
                };

                ICursor featureCursor = profiletable.Search(queryFilter, true);
                IRow    profileRow;

                int distanceFld = profiletable.FindField(FIRST_DIST_Field);
                int zFld        = profiletable.FindField(FIRST_Z_Field);
                int idFld       = profiletable.FindField(LINE_ID_Field);


                List <ProfileSurface> profileSurfaces = new List <ProfileSurface>();

                ProfileSession session = new ProfileSession()
                {
                    ProfileSurfaces  = profileSurfaces.ToArray(),
                    ProfileLines     = GetProfileLines(lines).ToArray(),
                    SessionId        = sessionId,
                    SessionName      = sessionName,
                    DefinitionType   = profileSettingsTypeEnum,
                    ObserverHeight   = observHeight,
                    SurfaceLayerName = profileSource,
                    CreatedBy        = Environment.UserName,
                    CreatedOn        = DateTime.Now,
                    Shared           = false,
                    Azimuth          = azimuthes
                };


                Dictionary <int, List <ProfileSurfacePoint> > surface = new Dictionary <int, List <ProfileSurfacePoint> >();

                int                  curLine = -1;
                IPolyline            line    = null;
                IEnumerable <IPoint> verticesCache;
                Dictionary <IPoint, ProfileSurfacePoint> mapProfilePointToVertex = new Dictionary <IPoint, ProfileSurfacePoint>();
                Dictionary <IPoint, double> mapProfilePointToDistance            = new Dictionary <IPoint, double>();
                ProfileLine profileLine = null;
                verticesCache = new IPoint[0];

                int pointsCount = 0;

                while ((profileRow = featureCursor.NextRow()) != null)
                {
                    int lineId = Convert.ToInt32(profileRow.Value[idFld]);

                    pointsCount++;

                    if (!session.ProfileLines.Any(l => l.Id == lineId))
                    {
                        throw new MilSpaceProfileLineNotFound(lineId, profileLineFeatureClass);
                    }

                    List <ProfileSurfacePoint> points;
                    if (!surface.ContainsKey(lineId))
                    {
                        points = new List <ProfileSurfacePoint>();
                        surface.Add(lineId, points);
                    }
                    else
                    {
                        points = surface[lineId];
                    }

                    if (curLine != lineId) // data for new line
                    {
                        curLine     = lineId;
                        profileLine = session.ProfileLines.FirstOrDefault(l => l.Id == lineId);

                        line = lines.GetFeature(profileLine.Id).Shape as IPolyline;

                        verticesCache = line.Vertices();

                        mapProfilePointToVertex.ToList().ForEach(v =>
                        {
                            if (!v.Value.IsEmpty)
                            {
                                v.Value.isVertex = true;
                            }
                        });

                        mapProfilePointToVertex   = verticesCache.ToDictionary(k => k, t => new ProfileSurfacePoint());
                        mapProfilePointToDistance = verticesCache.ToDictionary(k => k, t => - 1.0);
                    }

                    //Returns the point with Origin (Taken from firstPoint) Spatial reference
                    //var profilePointSource = EsriTools.GetPointFromAngelAndDistance(firstPoint, profileLine.Angel, (double)profileRow.Value[distanceFld]);
                    //var profilePoint = profilePointSource.CloneWithProjecting();

                    // Try to define if this point is close to a vertex

                    double distance = (double)profileRow.Value[distanceFld];

                    ProfileSurfacePoint newSurface = new ProfileSurfacePoint
                    {
                        Distance = distance,
                        Z        = (double)profileRow.Value[zFld],
                        //X = profilePoint.X,
                        //Y = profilePoint.Y
                    };



                    IPoint point = new Point();
                    line.QueryPoint(esriSegmentExtension.esriNoExtension, newSurface.Distance, false, point);
                    IProximityOperator proximity = point as IProximityOperator;

                    foreach (var vertx in verticesCache)
                    {
                        var profilePoint = mapProfilePointToVertex[vertx];
                        if (mapProfilePointToDistance[vertx] == 0)// profilePoint.isVertex)
                        {
                            continue;
                        }

                        double localDistance = proximity.ReturnDistance(vertx);
                        if (mapProfilePointToDistance[vertx] == -1 || mapProfilePointToDistance[vertx] > localDistance)
                        {
                            mapProfilePointToDistance[vertx] = localDistance;
                            mapProfilePointToVertex[vertx]   = newSurface;
                            if (localDistance == 0)
                            {
                                newSurface.isVertex = true;
                            }
                        }
                    }


                    var projected = point.CloneWithProjecting();

                    newSurface.X = projected.X;
                    newSurface.Y = projected.Y;

                    points.Add(newSurface);
                }

                mapProfilePointToVertex.ToList().ForEach(v =>
                {
                    if (!v.Value.IsEmpty)
                    {
                        v.Value.isVertex = true;
                    }
                });

                //Delete temp table form the GDB
                GdbAccess.Instance.DeleteTemporarSource(tempTableName, profileSourceName);

                Marshal.ReleaseComObject(featureCursor);

                //TODO: Clean memo using Marhsaling IRow

                session.ProfileSurfaces = surface.Select(r => new ProfileSurface
                {
                    LineId = r.Key,
                    ProfileSurfacePoints = r.Value.ToArray()
                }
                                                         ).ToArray();

                return(session);
            }
            catch (MilSpaceCanotDeletePrifileCalcTable ex)
            {
                //TODO: Log error
                throw ex;
            }
            catch (MilSpaceDataException ex)
            {
                //TODO: Log error
                throw ex;
            }
            catch (Exception ex)
            {
                //TODO: Log error
                throw ex;
            }
        }
예제 #13
0
        public override void OnMouseDown(int button, int Shift, int x, int y)
        {
            if (button != 1)
            {
                return;
            }

            this.SelectByClick(x, y);
            IMap         map         = _context.FocusMap;
            IEnumFeature enumFeature = (IEnumFeature)map.FeatureSelection;
            IFeature     feature     = enumFeature.Next();

            if (feature == null)
            {
                if (Shift == 1)
                {
                    this.m_SectionControl.RebuildSelection();
                }
                else
                {
                    this.m_SectionControl.LayerName = "";
                    this.m_SectionControl.Clear();
                    this._context.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, _context.ActiveView.Extent);
                }
            }
            else
            {
                string aliasName = feature.Class.AliasName;
                int    oID;
                if (feature.HasOID)
                {
                    oID = feature.OID;
                }
                else
                {
                    if (feature.FeatureType == esriFeatureType.esriFTSimpleEdge ||
                        feature.FeatureType == esriFeatureType.esriFTComplexEdge)
                    {
                        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        = _context.FocusMap;
                        pntEID.SnapTolerance    = CommonHelper.ConvertPixelsToMapUnits(_context.ActiveView, 5.0);
                        double percent;
                        int    edgeID;
                        IPoint location;
                        pntEID.GetNearestEdge(newCenter, out edgeID, out location, out percent);
                        if (percent == 0)
                        {
                            return;
                        }

                        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;
                                    }
                                }
                            }
                        }
                    }

                    oID = feature.OID;
                }
                if (Shift != 1)
                {
                    this.m_SectionControl.Clear();
                    this.m_SectionControl.LayerName = aliasName;
                    this.m_SectionControl.Add(oID);
                }
                else if (this.m_SectionControl.Count == 0)
                {
                    this.m_SectionControl.LayerName = aliasName;
                    this.m_SectionControl.Add(oID);
                }
                else if (this.m_SectionControl.IsInSameLayer(aliasName))
                {
                    this.m_SectionControl.LayerName = aliasName;
                    this.m_SectionControl.Add(oID);
                }
            }
        }
예제 #14
0
        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);
                }
            }
        }