Пример #1
0
        /// <summary>
        /// PointToSegmentColl - takes a point collection and returns a collection of segments.
        /// </summary>
        /// <param name="pntColl"></param>
        /// <returns>SegmentCollection</returns>
        internal static ESRI.ArcGIS.Geometry.ISegmentCollection PointsToSegmentColl(ESRI.ArcGIS.Geometry.IPointCollection pntColl)
        {
            ESRI.ArcGIS.Geometry.ISegmentCollection segcoll = new ESRI.ArcGIS.Geometry.PolylineClass() as ESRI.ArcGIS.Geometry.ISegmentCollection;
            ESRI.ArcGIS.Geometry.ISegment           segment;
            ESRI.ArcGIS.Geometry.IPoint             frompoint = null;
            ESRI.ArcGIS.Geometry.IPoint             topoint   = null;

            for (int i = 0; i < pntColl.PointCount; i++)
            {
                if (frompoint == null)
                {
                    frompoint = pntColl.get_Point(i);
                    if (pntColl.PointCount >= (i + 1))
                    {
                        topoint = pntColl.get_Point((i + 1));
                        segment = PointsToSegment(frompoint, topoint);
                        segcoll.AddSegment(segment, Type.Missing, Type.Missing);
                    }
                }
                else
                {
                    // to point becomes frompoint after each iteration
                    frompoint = topoint;
                    if (pntColl.PointCount > (i + 1))
                    {
                        topoint = pntColl.get_Point((i + 1));
                        segment = PointsToSegment(frompoint, topoint);
                        segcoll.AddSegment(segment, Type.Missing, Type.Missing);
                    }
                }
            }

            return(segcoll);
        }
Пример #2
0
 /// <summary>
 /// PointToPolyLine - Takes a point collection and generates a polyline
 /// </summary>
 /// <param name="pntColl"></param>
 /// <returns>PolyLine</returns>
 public static ESRI.ArcGIS.Geometry.Polyline PointToPolyline(ESRI.ArcGIS.Geometry.IPointCollection pntColl)
 {
     ESRI.ArcGIS.Geometry.Polyline pline = new ESRI.ArcGIS.Geometry.Polyline();
     if (pntColl.PointCount > 0)
     {
         ESRI.ArcGIS.Geometry.ISegmentCollection segColl = PointsToSegmentColl(pntColl);
         if (segColl.SegmentCount >= 0)
         {
             pline = segColl as ESRI.ArcGIS.Geometry.Polyline;
         }
     }
     return(pline);
 }
        // The following CreateXMLLinkElt private procedure is used to create all the expected XML items for a XML LinkFeature related to a HV_Line or LV_Line simple edge feature
        private void CreateXMLLinkElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElements, string inLinkTypeName)
        {
            if (!inFeature.HasOID)
            {
                MessageBox.Show("No OID");
                return;
            }

            MSXML2.IXMLDOMElement xmlLink;
            MSXML2.IXMLDOMElement xmlLink_FromNode;
            MSXML2.IXMLDOMElement xmlLink_ToNode;
            int    indexListPoints;
            string listPoints;
            int    nbVertices;
            string vertices;

            MSXML2.IXMLDOMElement xmlLink_Vertices;
            MSXML2.IXMLDOMElement xmlLink_Vertex;
            MSXML2.IXMLDOMElement xmlLink_XVertex;
            MSXML2.IXMLDOMElement xmlLink_YVertex;
            string xValue;
            string yValue;

            //-------- Feature Section START related to the "infeature" --------
            // Creating the LinkFeature Feature
            xmlLink = outDOMDoc.createElement("LinkFeature");
            outXMLElements.appendChild(xmlLink);

            // Specifying basic XML items for this LinkFeature
            CreateBasicXMLItemsForSchematicElt(inFeature, ref outDOMDoc, ref xmlLink, inLinkTypeName);
            // Specifying its FromNode
            xmlLink_FromNode = outDOMDoc.createElement("FromNode");
            xmlLink.appendChild(xmlLink_FromNode);
            xmlLink_FromNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("FromJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("FromJunctionOID"));
            // Specifying its ToNode
            xmlLink_ToNode = outDOMDoc.createElement("ToNode");
            xmlLink.appendChild(xmlLink_ToNode);
            xmlLink_ToNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("ToJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("ToJunctionOID"));

            //Add Vertices to LinkFeature ---- NEED TO BE COMPLETED
            indexListPoints = inFeature.Fields.FindField("ListPoints");
            if (indexListPoints > 0)
            {
                listPoints = "";
                listPoints = inFeature.get_Value(indexListPoints).ToString();
                if (listPoints != "")
                {
                    int foundChar = listPoints.IndexOf(";", 1);
                    nbVertices = System.Convert.ToInt32(listPoints.Substring(0, foundChar));
                    vertices   = listPoints.Substring(foundChar + 1);
                    if (nbVertices > 0)
                    {
                        // Specifying its Vertices
                        xmlLink_Vertices = outDOMDoc.createElement("Vertices");
                        xmlLink.appendChild(xmlLink_Vertices);

                        int iLoc;
                        for (int i = 1; i <= nbVertices; i++)
                        {
                            xValue = "";
                            yValue = "";
                            iLoc   = vertices.IndexOf(";", 1);
                            if (vertices != "" && (iLoc) > 0)
                            {
                                xValue = vertices.Substring(0, iLoc);
                            }
                            vertices = vertices.Substring(iLoc + 1);
                            iLoc     = vertices.IndexOf(";", 1);
                            if (vertices != ";" && (iLoc) > 0)
                            {
                                yValue = vertices.Substring(0, iLoc);
                            }

                            if (xValue != "" && yValue != "")
                            {
                                xmlLink_Vertex = outDOMDoc.createElement("Vertex");
                                xmlLink_Vertices.appendChild(xmlLink_Vertex);
                                xmlLink_XVertex = outDOMDoc.createElement("X");
                                xmlLink_Vertex.appendChild(xmlLink_XVertex);
                                xmlLink_XVertex.nodeTypedValue = xValue;
                                xmlLink_YVertex = outDOMDoc.createElement("Y");
                                xmlLink_Vertex.appendChild(xmlLink_YVertex);
                                xmlLink_YVertex.nodeTypedValue = yValue;
                                if (vertices.Length - iLoc > 0)
                                {
                                    vertices = vertices.Substring(iLoc + 1);                                     //sVertices.Length - iLoc)
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }
            else
            {            // Retrieving ListPoint from geometry
                ESRI.ArcGIS.Geometry.IPolyline        oPoly   = (ESRI.ArcGIS.Geometry.IPolyline)inFeature.ShapeCopy;
                ESRI.ArcGIS.Geometry.IPointCollection colLink = (ESRI.ArcGIS.Geometry.IPointCollection)oPoly;
                if (colLink != null && colLink.PointCount > 2)
                {
                    ESRI.ArcGIS.Geometry.IPoint oPoint;

                    xmlLink_Vertices = outDOMDoc.createElement("Vertices");
                    xmlLink.appendChild(xmlLink_Vertices);
                    for (int i = 1; i < colLink.PointCount - 1; i++)
                    {
                        oPoint = colLink.get_Point(i);

                        xmlLink_Vertex = outDOMDoc.createElement("Vertex");
                        xmlLink_Vertices.appendChild(xmlLink_Vertex);
                        xmlLink_XVertex = outDOMDoc.createElement("X");
                        xmlLink_Vertex.appendChild(xmlLink_XVertex);
                        xmlLink_XVertex.nodeTypedValue = oPoint.X;
                        xmlLink_YVertex = outDOMDoc.createElement("Y");
                        xmlLink_Vertex.appendChild(xmlLink_YVertex);
                        xmlLink_YVertex.nodeTypedValue = oPoint.Y;
                    }
                }
            }

            //Specifying its properties
            switch (inFeature.Class.AliasName)
            {
            case "LV_Line":
            {
                CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlLink, m_LVLinesPropertiesArray);
                break;
            }
            }
            //-------- Feature Section END related to the "infeature" --------
        }
Пример #4
0
        ///刘宇

        private string Geometry2Json(IGeometry pGeo)
        {
            int wkid = pGeo.SpatialReference.FactoryCode;

            ESRI.ArcGIS.Geometry.IPoint           pPoint = null;
            ESRI.ArcGIS.Geometry.IPointCollection pPoints = null;
            double        x, y;
            StringBuilder sb = new StringBuilder("{");

            sb.Append(@"""geometries""" + ":{");

            switch (pGeo.GeometryType)
            {
                #region Point2Json
            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                pPoint = pGeo as ESRI.ArcGIS.Geometry.IPoint;
                pPoint.QueryCoords(out x, out y);
                string json = @"{""x"":" + x + @",""y"":" + y + @",""spatialReference"":" + @"{""wkid"":" + wkid + "}";
                sb.Append(@"""point"":" + json);

                break;
                #endregion

                #region Polyline2Json
            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                pPoints = pGeo as ESRI.ArcGIS.Geometry.IPointCollection;

                IPolyline pPolyline = pGeo as IPolyline;

                IGeometryCollection pGeoetryCollection = pPolyline as IGeometryCollection;

                if (pGeoetryCollection.GeometryCount >= 1)
                {
                    sb.Append(@"""paths"":[");
                    for (int i = 0; i < pGeoetryCollection.GeometryCount; i++)
                    {
                        //paths可能有多个path,而每一个path是多个点,用两个for循环
                        if (pGeoetryCollection.get_Geometry(i) is IPath)
                        {
                            sb.Append("[");
                            pPoints = pGeoetryCollection.get_Geometry(i) as IPointCollection;

                            for (int j = 0; j < pPoints.PointCount; j++)
                            {
                                pPoint = pPoints.get_Point(j);
                                pPoint.QueryCoords(out x, out y);
                                sb.Append("[" + x + "," + y + "],");
                            }
                            sb.Remove(sb.Length - 1, 1);
                            sb.Append("]");
                        }
                    }
                    sb.Append("]" + @",""spatialReference"":" + @"{""wkid"":" + wkid + "}");
                }
                //else
                //{
                //     sb.Append(@"""paths"":[[");
                //for (int i = 0; i < pPoints.PointCount; i++)
                //{
                //    pPoint = pPoints.get_Point(i);
                //    pPoint.QueryCoords(out x, out y);
                //    sb.Append("[" + x + "," + y + "],");
                //}
                //sb.Remove(sb.Length - 1, 1);
                //sb.Append("]]" + @",""spatialReference"":" + @"{""wkid"":" + wkid + "}");
                //}


                break;

                #endregion

                #region Polygon2Json
            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                pPoints = pGeo as ESRI.ArcGIS.Geometry.IPointCollection;



                IPolygon pPolygon = pGeo as IPolygon;

                //外环和内环?面的构造比较复杂



                IGeometryCollection pGeoetryCollection1 = pPolygon as IGeometryCollection;

                if (pGeoetryCollection1.GeometryCount >= 1)
                {
                    sb.Append(@"""rings"":[");
                    for (int i = 0; i < pGeoetryCollection1.GeometryCount; i++)
                    {
                        if (pGeoetryCollection1.get_Geometry(i) is IRing)
                        {
                            sb.Append("[");
                            pPoints = pGeoetryCollection1.get_Geometry(i) as IPointCollection;
                            for (int j = 0; j < pPoints.PointCount; j++)
                            {
                                pPoint = pPoints.get_Point(j);
                                pPoint.QueryCoords(out x, out y);
                                sb.Append("[" + x + "," + y + "],");
                            }

                            sb.Remove(sb.Length - 1, 1);
                            sb.Append("]");
                        }
                    }
                    sb.Append("]" + @",""spatialReference"":" + @"{""wkid"":" + wkid + "}");
                }
                //else
                //{
                //    sb.Append(@"""rings"":[[");
                //    for (int i = 0; i < pPoints.PointCount; i++)
                //    {
                //        pPoint = pPoints.get_Point(i);
                //        pPoint.QueryCoords(out x, out y);
                //        sb.Append("[" + x + "," + y + "],");
                //    }
                //    sb.Remove(sb.Length - 1, 1);
                //    sb.Append("]]" + @",""spatialReference"":" + @"{""wkid"":" + wkid + "}");
                //}


                break;
                #endregion
            }

            sb.Append("}");

            //添加Geometry

            sb.Append("}");

            return(sb.ToString());
        }
Пример #5
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (this.pPath == null || this.pPath == "")
            {
                MessageBox.Show("请添加数据!", "SUNZ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                IWorkspaceFactory pShpWorkspaceFactory = new ShapefileWorkspaceFactoryClass();

                if (pShpWorkspaceFactory.IsWorkspace(System.IO.Path.GetDirectoryName(this.pPath)))
                {
                    IWorkspace        pWorkspace        = pShpWorkspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(this.pPath), 0);
                    IFeatureWorkspace pFeatureWorkspace = pWorkspace as IFeatureWorkspace;
                    IFeatureClass     pFeatureClass     = pFeatureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(this.pPath));
                    if (pFeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon)
                    {
                        MessageBox.Show("请导入面图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    int GroupID = SgWorld.ProjectTree.FindItem("区域挖开");
                    if (GroupID == 0)
                    {
                        GroupID = SgWorld.ProjectTree.CreateGroup("区域挖开", 0);
                    }
                    IFeatureCursor fc       = pFeatureClass.Search(null, false);
                    IFeature       pFeature = fc.NextFeature();
                    while (pFeature != null)
                    {
                        int sq = 0;
                        ESRI.ArcGIS.Geometry.IGeometry        geo = pFeature.Shape;
                        ESRI.ArcGIS.Geometry.IPointCollection pPointCollection = geo as ESRI.ArcGIS.Geometry.IPointCollection;
                        this.cVerticesArray = new double[(pPointCollection.PointCount - 1) * 3];
                        for (int i = 0; i < pPointCollection.PointCount - 1; i++)
                        {
                            ESRI.ArcGIS.Geometry.IPoint pPoint = pPointCollection.get_Point(i);
                            cVerticesArray[sq] = pPoint.X;
                            sq++;
                            cVerticesArray[sq] = pPoint.Y;
                            sq++;
                            // cVerticesArray[sq] = item[2];
                            cVerticesArray[sq] = 0.1;
                            sq++;
                        }
                        ILinearRing cRing            = SgWorld.Creator.GeometryCreator.CreateLinearRingGeometry(cVerticesArray);
                        IPolygon    cPolygonGeometry = SgWorld.Creator.GeometryCreator.CreatePolygonGeometry(cRing, null);

                        IGeometry geoX = cPolygonGeometry as IGeometry;
                        Creator.CreateHoleOnTerrain(geoX, GroupID, "Hole" + System.Guid.NewGuid().ToString().Substring(0, 6).ToUpper());
                        pFeature = fc.NextFeature();

                        this.Hide();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Пример #6
0
 private void AddASCFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     this.openFileDialog1.Title  = "加载路线数据";
     this.openFileDialog1.Filter = "My file(*.txt)|*.txt|ShapeFile(*.shp)|*.shp";
     if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         this.gridControl1.DataSource = null;
         if (this.PointsDt.Rows.Count != 0)
         {
             this.PointsDt.Clear();
         }
         // int rCount = this.PointsDt.Rows.Count;
         if (this.openFileDialog1.FileName.ToLower().Contains(".txt"))
         {
             string[] CoorPoint = File.ReadAllLines(this.openFileDialog1.FileName, Encoding.ASCII);
             try
             {
                 for (int j = 0; j < CoorPoint.Length; j++)
                 {
                     if (CoorPoint[j] != "" && CoorPoint[j] != null)
                     {
                         DataRow  dr        = PointsDt.NewRow();
                         string[] newStrArr = new string[2];
                         newStrArr = CoorPoint[j].Split(',');
                         dr["X"]   = newStrArr[0];
                         dr["Y"]   = newStrArr[1];
                         PointsDt.Rows.Add(dr);
                     }
                 }
                 this.gridControl1.DataSource = PointsDt;
             }
             catch (Exception ex)
             {
                 MessageBox.Show("加载文件格式不正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 //throw;
             }
         }
         else if (this.openFileDialog1.FileName.ToLower().Contains(".shp"))
         {
             try
             {
                 IWorkspaceFactory pShpWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
                 IWorkspace        pWorkspace           = pShpWorkspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(this.openFileDialog1.FileName), 0);
                 IFeatureWorkspace pFeatureWorkspace    = pWorkspace as IFeatureWorkspace;
                 IFeatureClass     pFeatureClass        = pFeatureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(this.openFileDialog1.FileName));
                 if (pFeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
                 {
                     MessageBox.Show("请导入线图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return;
                 }
                 IFeatureCursor fc       = pFeatureClass.Search(null, false);
                 IFeature       pFeature = fc.NextFeature();
                 if (pFeature != null)
                 {
                     int sq = 0;
                     ESRI.ArcGIS.Geometry.IGeometry        geo = pFeature.Shape;
                     ESRI.ArcGIS.Geometry.IPointCollection pPointCollection = geo as ESRI.ArcGIS.Geometry.IPointCollection;
                     for (int i = 0; i < pPointCollection.PointCount; i++)
                     {
                         ESRI.ArcGIS.Geometry.IPoint pPoint = pPointCollection.get_Point(i);
                         DataRow dr = PointsDt.NewRow();
                         dr["X"] = pPoint.X;
                         dr["Y"] = pPoint.Y;
                         PointsDt.Rows.Add(dr);
                     }
                 }
             }
             catch (Exception)
             {
             }
             if (PointsDt != null)
             {
                 this.gridControl1.DataSource = PointsDt;
             }
         }
         else
         {
             return;
         }
     }
 }
Пример #7
0
        public void UpdateFeature(string featureClasses,
                                  List <FeatureValues> featureValues,
                                  double[] Coordinates,
                                  string sID,
                                  string sFieldName)
        {
            bool          bError = false;
            IFeatureClass fc     = GetFeatureClass(featureClasses);

            IWorkspaceEdit ipWksEdit = ((IDataset)fc).Workspace as IWorkspaceEdit;

            if (null != ipWksEdit)
            {
                try
                {
                    ipWksEdit.StartEditing(true);
                    ipWksEdit.StartEditOperation();
                }
                catch
                {
                    bError = true;
                    return;
                }
            }

            // the meat to update the feature
            foreach (FeatureValues featureValue in featureValues)
            {
                featureValue.Index = fc.Fields.FindField(featureValue.Name);
            }

            IQueryFilter pQueryFilter = (IQueryFilter)_serverContext.CreateObject("esriGeoDatabase.QueryFilter");

            pQueryFilter.WhereClause = sFieldName + "='" + sID + "'";
            IFeatureCursor cursor = fc.Update(pQueryFilter, false);
            IFeature       pFeature;

            while ((pFeature = cursor.NextFeature()) != null)
            {
                if (Coordinates != null && Coordinates.Length == 2)
                {
                    double[] points = Coordinates;
                    ESRI.ArcGIS.Geometry.IPoint pt = (ESRI.ArcGIS.Geometry.IPoint)_serverContext.CreateObject("esriGeometry.Point");
                    pt.PutCoords(points[0], points[1]);

                    pFeature.Shape = pt as ESRI.ArcGIS.Geometry.IPoint;
                }
                else if (Coordinates != null && Coordinates.Length > 2)
                {
                    ESRI.ArcGIS.Geometry.IPointCollection pPointCol = _serverContext.CreateObject("esriGeometry.Polygon") as ESRI.ArcGIS.Geometry.IPointCollection;
                    for (int i = 0; i < Coordinates.Length; i += 2)
                    {
                        ESRI.ArcGIS.Geometry.IPoint pt = (ESRI.ArcGIS.Geometry.IPoint)_serverContext.CreateObject("esriGeometry.Point");
                        pt.PutCoords(Coordinates[i], Coordinates[i + 1]);
                        pPointCol.AddPoints(1, ref pt);
                    }

                    pFeature.Shape = pPointCol as ESRI.ArcGIS.Geometry.IPolygon;
                }
                break;
            }

            pFeature.Store();

            if (null != ipWksEdit)
            {
                try
                {
                    if (bError)
                    {
                        //rollback
                        ipWksEdit.UndoEditOperation();
                        ipWksEdit.StopEditing(false);
                    }
                    else
                    {
                        //commit
                        ipWksEdit.StopEditOperation();
                        ipWksEdit.StopEditing(true);
                    }
                }
                catch
                {
                }
                finally
                {
                    Marshal.ReleaseComObject(ipWksEdit);
                    ipWksEdit = null;
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Returns all features from a given feature class that have a vertex or endpoint coincident with a given point
        /// </summary>
        /// <param name="point">IPoint to use as the spatial filter</param>
        /// <param name="searchFtClass">IFeatureClass to search in</param>
        /// <param name="linearEndpointsOnly">Flag to use only the endpoints of a line instead of all vertices</param>
        /// <param name="buffer">Search geometry buffer in map units</param>
        /// <returns>List of IFeature</returns>
        public static List <ESRI.ArcGIS.Geodatabase.IFeature> GetFeaturesWithCoincidentVertices(ESRI.ArcGIS.Geometry.IPoint point, ESRI.ArcGIS.Geodatabase.IFeatureClass searchFtClass, bool linearEndpointsOnly, double buffer)
        {
            List <ESRI.ArcGIS.Geodatabase.IFeature> result = new List <ESRI.ArcGIS.Geodatabase.IFeature>();

            using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
            {
                ESRI.ArcGIS.Geodatabase.ISpatialFilter filter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();
                releaser.ManageLifetime(filter);

                ESRI.ArcGIS.Geometry.IEnvelope filterGeometry = point.Envelope;
                if (0 < buffer)
                {
                    filterGeometry.Expand(buffer, buffer, false);
                }

                filter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;
                filter.Geometry   = filterGeometry;

                ESRI.ArcGIS.Geodatabase.IFeatureCursor fts = searchFtClass.Search(filter, false);
                releaser.ManageLifetime(fts);

                ESRI.ArcGIS.Geodatabase.IFeature ft = fts.NextFeature();
                while (null != ft)
                {
                    if (searchFtClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                    {
                        result.Add(ft);
                    }
                    else if (searchFtClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline && linearEndpointsOnly)
                    {
                        ESRI.ArcGIS.Geometry.IPolyline           polyline  = (ESRI.ArcGIS.Geometry.IPolyline)ft.Shape;
                        ESRI.ArcGIS.Geometry.IRelationalOperator fromPoint = polyline.FromPoint as ESRI.ArcGIS.Geometry.IRelationalOperator;
                        ESRI.ArcGIS.Geometry.IRelationalOperator toPoint   = polyline.ToPoint as ESRI.ArcGIS.Geometry.IRelationalOperator;

                        if (fromPoint.Equals(point) || toPoint.Equals(point))
                        {
                            result.Add(ft);
                        }
                    }
                    else
                    {
                        ESRI.ArcGIS.Geometry.IPointCollection pointCollection = ft.Shape as ESRI.ArcGIS.Geometry.IPointCollection;
                        if (null != pointCollection)
                        {
                            for (int i = 0; i < pointCollection.PointCount; i++)
                            {
                                ESRI.ArcGIS.Geometry.IRelationalOperator testPoint = pointCollection.get_Point(i) as ESRI.ArcGIS.Geometry.IRelationalOperator;
                                if (testPoint.Equals(point))
                                {
                                    result.Add(ft);
                                    break;
                                }
                            }
                        }
                    }

                    ft = fts.NextFeature();
                }
            }

            return(result);
        }