private IPolyline GetStationPipePointCol(string stationName)
{
IPolyline result = (IPolyline) new Polyline();
IGeoDataset pGDS = (IGeoDataset) m_pipesFC;
result.SpatialReference = pGDS.SpatialReference;
IPointCollection pipePointCol = (IPointCollection)result;
// Get all pipes in the named station
IQueryFilter pPipeQF = new QueryFilter();
pPipeQF.WhereClause = "StationName = '" + stationName + "'";
IFeatureCursor pPipeCur = m_pipesFC.Search(pPipeQF, true);
IFeature pPipeFea = pPipeCur.NextFeature();
while (pPipeFea != null)
{
// Add all points from each pipe to the station-wide point collection
IPolyline pDiscretePipePline = (IPolyline)pPipeFea.ShapeCopy;
IPointCollection pDiscretePipePtCol = (IPointCollection)pDiscretePipePline;
for (int idx = 0; idx < pDiscretePipePtCol.PointCount; idx++)
pipePointCol.AddPoint(pDiscretePipePtCol.Point[idx]);
pPipeFea = pPipeCur.NextFeature();
}
Marshal.ReleaseComObject(pPipeCur);
return result;
}