IRelationResult.RelationElement property does not work in VBA - returns "Invalid use of property" compile error.
上次发布: August 19, 2020ArcGIS for Desktop
漏洞 ID 编号
NIM056080
已提交
April 6, 2010
上次修改时间
June 5, 2024
适用范围
ArcGIS for Desktop
找到的版本
9.3.1
编程语言
VBA
操作系统
Windows OS
操作系统版本
XP
状态
Will Not Be Addressed
开发团队已考虑过该问题或请求,并决定不会解决该问题。 问题的“其他信息”部分可能包含进一步说明。
附加信息
We apologize that we were unable to address this issue within the current product support cycle. If the issue continues to affect your work in a supported release, please contact Technical Support.
解决办法
Use C# code: public void OnClick() { try { IWorkspaceFactory wsFact = new FileGDBWorkspaceFactoryClass(); IFeatureWorkspace featWS = (IFeatureWorkspace)wsFact.OpenFromFile(@"<a href="file:C:/incidents/792309/Test.gdb" target="_blank">C:\incidents\792309\Test.gdb</a>", 0); IFeatureClass featClsPoly = featWS.OpenFeatureClass("Polygon"); IFeatureClass featClsLine = featWS.OpenFeatureClass("Polyline"); object obj = Type.Missing; IGeometryCollection geomCollGon = new GeometryBagClass() as IGeometryCollection; IFeatureCursor featCur = featClsPoly.Search(null, false); IFeature feat = featCur.NextFeature(); while (feat != null) { geomCollGon.AddGeometry(feat.ShapeCopy, ref obj, ref obj); feat = featCur.NextFeature(); } IGeometryCollection geomCollLine = new GeometryBagClass() as IGeometryCollection; featCur = featClsLine.Search(null, false); feat = featCur.NextFeature(); while (feat != null) { geomCollLine.AddGeometry(feat.ShapeCopy, ref obj, ref obj); feat = featCur.NextFeature(); } IRelationalOperatorNxM relOpNxM = geomCollGon as IRelationalOperatorNxM; IRelationResult relRes = relOpNxM.Crosses(geomCollLine as IGeometryBag); int count = relRes.RelationElementCount; int left, right; for (int i = 0; i < count; i++) { relRes.RelationElement(i, out left, out right); IGeometry geomGon = geomCollGon.get_Geometry(left); IGeometry geomLine = geomCollLine.get_Geometry(right); } } catch (Exception e) { MessageBox.Show(e.Message); } }