private void OnSketchFinished() { //Use the geometry from the sketch and make a narrow buffer to search for fabric lines contained within the buffer IBufferConstruction pBuffConst = new BufferConstruction(); IGeometry pGeom = pBuffConst.Buffer(m_edSketch.Geometry, 0.1); ISpatialFilter pSpatFilter = new SpatialFilter(); pSpatFilter.Geometry = pGeom; pSpatFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; //set up for reporting information about the lines string sReportString = ""; int iTotalLineCount = 0; int iCurveCount = 0; int iMultiSegmentCount = 0; //Create a feature cursor to query the fabric lines table IFeatureCursor pFeatCurs = m_pFabricLines.Search(pSpatFilter, false); IFeature pFeat = pFeatCurs.NextFeature(); while (pFeat != null) { //loop through the found lines //count all the lines iTotalLineCount++; ISegmentCollection pSegColl = (ISegmentCollection)pFeat.Shape; if (pSegColl.SegmentCount > 1) //count lines that have more than 1 segment { iMultiSegmentCount++; } else { if (pSegColl.get_Segment(0) is ICircularArc) { iCurveCount++; //count lines that have a single circular arc geometry segment } } Marshal.ReleaseComObject(pFeat); pFeat = pFeatCurs.NextFeature(); } Marshal.ReleaseComObject(pFeatCurs); //report the results sReportString += "\nTotal parcel lines: " + iTotalLineCount.ToString(); sReportString += "\nCurve parcel lines: " + iCurveCount.ToString(); sReportString += "\nMulti segment parcel lines: " + iMultiSegmentCount.ToString(); MessageBox.Show(sReportString, "Sample: Trace Report"); }
private void OnSketchFinished() { //Use the geometry from the sketch and make a narrow buffer to search for fabric lines contained within the buffer IBufferConstruction pBuffConst = new BufferConstruction(); IGeometry pGeom = pBuffConst.Buffer(m_edSketch.Geometry, 0.1); ISpatialFilter pSpatFilter = new SpatialFilter(); pSpatFilter.Geometry = pGeom; pSpatFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; //set up for reporting information about the lines string sReportString = ""; int iTotalLineCount = 0; int iCurveCount = 0; int iMultiSegmentCount = 0; //Create a feature cursor to query the fabric lines table IFeatureCursor pFeatCurs = m_pFabricLines.Search(pSpatFilter, false); IFeature pFeat = pFeatCurs.NextFeature(); while (pFeat != null) { //loop through the found lines //count all the lines iTotalLineCount++; ISegmentCollection pSegColl = (ISegmentCollection)pFeat.Shape; if (pSegColl.SegmentCount > 1) //count lines that have more than 1 segment iMultiSegmentCount++; else { if (pSegColl.get_Segment(0) is ICircularArc) iCurveCount++; //count lines that have a single circular arc geometry segment } Marshal.ReleaseComObject(pFeat); pFeat = pFeatCurs.NextFeature(); } Marshal.ReleaseComObject(pFeatCurs); //report the results sReportString += "\nTotal parcel lines: " + iTotalLineCount.ToString(); sReportString += "\nCurve parcel lines: " + iCurveCount.ToString(); sReportString += "\nMulti segment parcel lines: " + iMultiSegmentCount.ToString(); MessageBox.Show(sReportString, "Sample: Trace Report"); }