Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. private IPolyline GetStationPipePointCol(string stationName)
  2. {
  3.    IPolyline result = (IPolyline) new Polyline();
  4.    IGeoDataset pGDS = (IGeoDataset) m_pipesFC;
  5.    result.SpatialReference = pGDS.SpatialReference;
  6.    IPointCollection pipePointCol = (IPointCollection)result;
  7.  
  8.    // Get all pipes in the named station
  9.    IQueryFilter pPipeQF = new QueryFilter();
  10.    pPipeQF.WhereClause = "StationName = '" + stationName + "'";
  11.    IFeatureCursor pPipeCur = m_pipesFC.Search(pPipeQF, true);
  12.    IFeature pPipeFea = pPipeCur.NextFeature();
  13.    while (pPipeFea != null)
  14.    {
  15.       // Add all points from each pipe to the station-wide point collection
  16.       IPolyline pDiscretePipePline = (IPolyline)pPipeFea.ShapeCopy;
  17.       IPointCollection pDiscretePipePtCol = (IPointCollection)pDiscretePipePline;
  18.       for (int idx = 0; idx < pDiscretePipePtCol.PointCount; idx++)
  19.          pipePointCol.AddPoint(pDiscretePipePtCol.Point[idx]);
  20.          pPipeFea = pPipeCur.NextFeature();
  21.    }
  22.    Marshal.ReleaseComObject(pPipeCur);
  23.    return result;
  24. }