lanhong0201
路人甲
路人甲
  • 注册日期2006-03-30
  • 发帖数23
  • QQ
  • 铜币178枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1567回复:1

[求助]〔求助〕关于AO中的SpatialFilter问题!!!!!!!!!

楼主#
更多 发布于:2007-06-08 21:25
<DIV ><FONT size=4><FONT color=sienna>       我现在在做VBA+AO的开发,现在要完成一个功能是这样的:选择地图上已经存在的一个多边形,点击工具栏上的按钮就可以统计出这个多边形内的所有要素。我知道自己画多边形或矩形来选择其中的设备是将所画的多边形作为一个SpatialFilter对象,然后用IFeatureSelection接口的SelectFeatures方法来选择要素。不知道对于地图上已经存在的多边形用什么语句可以将它作为一个SpatialFilter,也用同样的方法来选择它。还是要用其他的方法,请高手指点,不胜感激!!!!</FONT></FONT></DIV>
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2007-06-09 11:21
<P>获取到你画的矩形或者多边形,然后仿照下面的方法就行了</P>
<P>The following code excerpt shows how to get a reference to an ISpatialFilter interface, set the necessary values and execute the search.</P>
<P>NOTE: All three of the ISpatialFilter methods Geometry, GeometryField and SpatialEnum are required.</P>
<P>Create a point to use for the search:</P><PRE><CODE>  Dim pPoint As IPoint
  Set pPoint = New esriGeometry.Point
  pPoint.PutCoords -117.946, 35.823</PRE></CODE>
<P>Getting a reference:</P><CODE><PRE>  Dim pFilter As IspatialFilter
  Set pFilter = New SpatialFilter </PRE></CODE>
<P>Setting the Geometry, GeometryField and SpatialRel parameters:</P><CODE><PRE>  With pFilter
    Set .Geometry = pPoint
    .GeometryField = "SHAPE"
    .SpatialRel = esriSpatialRelIntersects
  End With </PRE></CODE>
<P>Execute the filter:</P><CODE><PRE>  Dim pFeatureCursor As IfeatureCursor
  Set pFeatureCursor = pFeatureClass.Search(pFilter, False) </PRE></CODE>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部