use Spatial filter tool running time take more

المشرف العام

Administrator
طاقم الإدارة
HI i want check any 3 way junction or 4 way junction features snapping or not i have used spatial filer it is taking more time for running could you please tell me any way to improve tool running speed.

IWorkspaceFactory pfwf = new AccessWorkspaceFactoryClass(); IWorkspace pwork = pfwf.OpenFromFile(PGDBpath, 0); IFeatureWorkspace pfwspace = pwork as IFeatureWorkspace; IFeatureClass cenline = pfwspace.OpenFeatureClass("Centerlines"); IFeatureCursor cen_cur = cenline.Search(null, false); IFeature cen_F = cen_cur.NextFeature(); int cnt = 0; int count = cenline.FeatureCount(null); while (cen_F != null) { cnt++; label3.Text = cen_F.Class.AliasName + " " + cnt.ToString() + "/" + count.ToString(); Application.DoEvents(); IPolyline pline = cen_F.Shape as IPolyline; IPointCollection ppcol = pline as IPointCollection; for (int i = 0; i < ppcol.PointCount; i++) { IPoint ppoint = ppcol.get_Point(i); ITopologicalOperator ptopo = ppoint as ITopologicalOperator; IGeometry pgeo = ptopo.Buffer(0.1);
ISpatialFilter pslt = new SpatialFilterClass(); pslt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pslt.Geometry = pgeo; IFeatureCursor pfcur = cenline.Search(pslt, false); IFeature cen_F_1 = pfcur.NextFeature(); double dist = 0.0; bool chk = false; IProximityOperator prox = cen_F.Shape as IProximityOperator; while (cen_F_1 != null) { if (cen_F.OID != cen_F_1.OID) { dist = prox.ReturnDistance(cen_F_1.Shape); if (dist != 0.0) { chk = true; } } cen_F_1 = pfcur.NextFeature(); } if (chk == true) { wr.WriteLine(cen_F.OID + "," + cen_F.Class.AliasName + "," + dist + "," + "CenterLine Not snapped"); } System.Runtime.InteropServices.Marshal.ReleaseComObject(pfcur); } cen_F = cen_cur.NextFeature(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(cen_cur); wr.Close(); MessageBox.Show("Completed"); } catch (Exception ex) { MessageBox.Show(ex.Message); }



أكثر...
 
أعلى