Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IFeatureClass Building = pfwspace.OpenFeatureClass("CO_Building");
- IFeatureCursor bld_cur = Building.Search(null, false);
- IFeature bld_F = bld_cur.NextFeature();
- int BF = Building.FindField("BUILDINGFORM");
- int BU = Building.FindField("BUILDINGUSE");
- DataTable dt = new DataTable();
- dt.Columns.Add("ObjectID");
- dt.Columns.Add("Feature Class");
- dt.Columns.Add("TGID");
- dt.Columns.Add("Error Comment");
- int tgid = Building.FindField("TGID");
- ITopologicalOperator ptopo = bld_F.Shape as ITopologicalOperator;
- IGeometry pgeo = ptopo.Buffer(1);
- ISpatialFilter pslt = new SpatialFilterClass();
- pslt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
- int count = Building.FeatureCount(null);
- pslt.Geometry = pgeo;
- while (bld_F != null)
- {
- string BF_val = bld_F.get_Value(BF).ToString();
- string BU_val = bld_F.get_Value(BU).ToString();
- string TGID_val = bld_F.get_Value(tgid).ToString();
- if (BF_val == "9" && BU_val == "31")
- {
- IFeatureCursor f_cur1 = Building.Search(pslt, false);
- IFeature feature1 = f_cur1.NextFeature();
- IRelationalOperator relop = bld_F.Shape as IRelationalOperator;
- relop.Overlaps(feature1.Shape);
- if (Building.FeatureCount(pslt) > 0)
- {
- dt.Rows.Add(bld_F.OID);
- }
- System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
- }
- bld_F = bld_cur.NextFeature();
- }
- if (BF_val == "9" && BU_val == "31")
- {
- IFeatureCursor f_cur1 = Building.Search(pslt, false);
- IFeature feature1 = f_cur1.NextFeature();
- IRelationalOperator relop = bld_F.Shape as IRelationalOperator;
- relop.Overlaps(feature1.Shape);
- if (Building.FeatureCount(pslt) > 0)
- {
- dt.Rows.Add(bld_F.OID);
- }
- System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
- }
- if (BF_val == "9" && BU_val == "31")
- {
- IFeatureCursor f_cur1 = Building.Search(pslt, false);
- IFeature feature1 = f_cur1.NextFeature();
- IRelationalOperator relop = bld_F.ShapeCopy as IRelationalOperator; // use ShapeCopy not Shape
- if (!relop.Disjoint(feature1.ShapeCopy)) // use not Disjoint to indicate intersection
- {
- dt.Rows.Add(bld_F.OID);
- }
- System.Runtime.InteropServices.Marshal.ReleaseComObject(f_cur1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement