Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. IFeatureClass Building = pfwspace.OpenFeatureClass("CO_Building");
  2. IFeatureCursor bld_cur = Building.Search(null, false);
  3. IFeature bld_F = bld_cur.NextFeature();
  4. int BF = Building.FindField("BUILDINGFORM");
  5. int BU = Building.FindField("BUILDINGUSE");
  6. DataTable dt = new DataTable();
  7. dt.Columns.Add("ObjectID");
  8. dt.Columns.Add("Feature Class");
  9. dt.Columns.Add("TGID");
  10. dt.Columns.Add("Error Comment");
  11. int tgid = Building.FindField("TGID");
  12. ITopologicalOperator ptopo = bld_F.Shape as ITopologicalOperator;
  13. IGeometry pgeo = ptopo.Buffer(1);
  14. ISpatialFilter pslt = new SpatialFilterClass();
  15. pslt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
  16. int count = Building.FeatureCount(null);
  17. pslt.Geometry = pgeo;
  18. while (bld_F != null)
  19. {
  20. string BF_val = bld_F.get_Value(BF).ToString();
  21. string BU_val = bld_F.get_Value(BU).ToString();
  22. string TGID_val = bld_F.get_Value(tgid).ToString();
  23. if (BF_val == "9" && BU_val == "31")
  24. {
  25. IFeatureCursor f_cur1 = Building.Search(pslt, false);
  26. IFeature feature1 = f_cur1.NextFeature();
  27. IRelationalOperator relop = bld_F.Shape as IRelationalOperator;
  28. relop.Overlaps(feature1.Shape);
  29. if (Building.FeatureCount(pslt) > 0)
  30. {
  31.  
  32.  
  33. dt.Rows.Add(bld_F.OID);
  34. }
  35. System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
  36. }
  37. bld_F = bld_cur.NextFeature();
  38. }
  39.  
  40. if (BF_val == "9" && BU_val == "31")
  41. {
  42. IFeatureCursor f_cur1 = Building.Search(pslt, false);
  43. IFeature feature1 = f_cur1.NextFeature();
  44. IRelationalOperator relop = bld_F.Shape as IRelationalOperator;
  45. relop.Overlaps(feature1.Shape);
  46. if (Building.FeatureCount(pslt) > 0)
  47. {
  48. dt.Rows.Add(bld_F.OID);
  49. }
  50. System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
  51. }
  52.  
  53. if (BF_val == "9" && BU_val == "31")
  54. {
  55. IFeatureCursor f_cur1 = Building.Search(pslt, false);
  56. IFeature feature1 = f_cur1.NextFeature();
  57. IRelationalOperator relop = bld_F.ShapeCopy as IRelationalOperator; // use ShapeCopy not Shape
  58.  
  59. if (!relop.Disjoint(feature1.ShapeCopy)) // use not Disjoint to indicate intersection
  60. {
  61. dt.Rows.Add(bld_F.OID);
  62. }
  63. System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement