private void createContainer()
{
// Get references to required classes:
// -- m_stationNamesTbl holds a reference to the table with all station names
// -- m_pipesFC holds a reference to the pipes feature class
// -- m_containerFC holds a reference to the container feature class
if (InitClasses() == false)
return;
// Start the edit operation.. assumes we're already editing
m_pEditor.StartOperation();
// Get a cursor on the station names class and iterate through all stations
IQueryFilter pStationQF = new QueryFilter();
ICursor pStationCur = m_stationNamesTbl.Search(pStationQF, true);
IRow pStationRow = pStationCur.NextRow();
while (pStationRow != null)
{
string stationName = Convert.ToString(pStationRow.get_Value(m_stationNameFI));
// Get all pipes in the station and return it as a point collection
IPolyline stationPipes = GetStationPipePolyline(stationName);
// Create our polygon using the station pipes extent
ITopologicalOperator4 pTopoOp = (ITopologicalOperator4)stationPipes;
IPolygon stationBoundary = (IPolygon)pTopoOp.ConvexHull();
// Create the container feature and assign the extent geometry
IFeature containerFea = m_containerFC.CreateFeature();
containerFea.Shape = stationBoundary;
containerFea.Store();
pStationRow = pStationCur.NextRow();
}
m_pEditor.StopOperation("Create container polygons");
}