btunicorn
路人甲
路人甲
  • 注册日期2004-11-10
  • 发帖数1
  • QQ
  • 铜币114枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:805回复:0

C#+AO求助

楼主#
更多 发布于:2004-11-19 16:35
<P>小弟在以下编码中遇到困难,百思不得其解</P>
<P>主要功能:用户拖动一个矩形框,在矩形框范围内和指定的图层中搜索feature并以IFeatureCursor返回</P>
<P> private void map_OnMouseDown(object sender, AxesriMapControl.IMapControlEvents2_OnMouseDownEvent e)
  {
  
   IEnvelope envelope = map.TrackRectangle();
   if (envelope != null)
   {

    map.Extent = envelope;
    IFeatureLayer ifl=(FeatureLayer)map.get_Layer(0);
    IFeatureClass ifc=ifl.FeatureClass;
    IFeatureIndex2 fi2=new FeatureIndexClass();
    fi2.FeatureClass=ifc;
    IGeoDataset igd=(IGeoDataset)ifc;
    
    fi2.Index(null,igd.Extent);
    
    IIndexQuery2 iq=(FeatureIndexClass)fi2;
    IFeatureCursor ifd;
    ifd=iq.get_Within(envelope);

    ArrayList a=new ArrayList();
    IFeature tmpf;
   <FONT color=#ff3333> tmpf=ifd.NextFeature();  //tmpf返回null</FONT>
    while (tmpf!=null)
    {</P>
<P><FONT color=#000000>     tmpf=ifd.NextFeature();</FONT>
     a.Add(tmpf);
    }

   }</P>
<P>  }</P>
<P>为什么我的ifd中一个feature也没有,小弟困惑已久,望各位大侠不吝赐教,感激不尽!</P>
喜欢0 评分0
游客

返回顶部