wensen138
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数6
  • QQ
  • 铜币120枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2309回复:5

各位高手!如何编程实现搜索出一个特定图层的所有图元相关问题

楼主#
更多 发布于:2006-11-21 21:29
<P>如何用编程实现搜索出一个特定图层的所有图元,并修改每个图元的indic属性列(自己定义)的值,用编程实现,这将用到什么样的函数,具体怎么用.还有就是我怎么找不到Feature.Update 的函数啊,在mapxtreme for java 中.</P>
<P>                               <BR></P>
喜欢0 评分0
gis_qxz
路人甲
路人甲
  • 注册日期2005-12-03
  • 发帖数33
  • QQ
  • 铜币246枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-12-01 19:23
<P>MapX中的图层对象提供了查询检索的功能函数,其中包括条件查询和区域查询,具体函数你可以查一下有关资料。对于修改图元属性,可以通过数据绑定的模式,取得字段对象,然后取得要修改的字段,并将其设置为图元所在图层对象的关键字段,再利用图元对象的取值接口或设值接口就可解决了。以下为实例代码(VC6.0 + MapX)</P>
<P><FONT face="Times New Roman">void CSampleProjectView::ModifyByPoint(double X,double Y) </FONT></P>
<P><FONT face="Times New Roman">{<BR>     // This example assumes that you have a layer named "Customer Layer"<BR>     // with a field named "CUST_NAME". If there is a feature underneath<BR>the point<BR>// (X,Y), the CUST_NAME field is changed to "MapInfo Corp"<BR>try {<BR>    CMapXLayer srcLayer = m_Map.GetLayers.Item("Customer Layer");<BR>    CMapXFeatures ftrsUnderPoint;<BR>    CMapXPoint pt;<BR>    if(!pt.CreateDispatch(pt.GetClsid()) {<BR>       TRACE0("Failed to Create Point object");<BR>       return;<BR>     }<BR>     pt.Set(X,Y);<BR>     //Find all of the features underneath the point (X,Y) in "Customer Layer"<BR>   ftrsUnderPoint = srcLayer.SearchAtPoint(pt);<BR>     //Now, all feature.KeyValue changes will deal with the CUST_NAME field<BR>     <STRONG>srcLayer.SetKeyField("CUST_NAME");</STRONG><BR>     for(long i=1;i<=ftrsUnderPoint.GetCount();i++) {<BR>        AfxMessageBox("Old Value: " + ftrsUnderPoint.Item(i).GetName() + "\nNew Value: MapInfo Corp");<BR>        // change the value in the table to "MapInfo Corp"<BR>        <STRONG>ftrsUnderPoint.Item(i).SetKeyValue("MapInfo Corp");<BR></STRONG>        ftrsUnderPoint.Item(i).Update();<BR>     }<BR>   }catch (COleDispatchException *e) {<BR>     e->ReportError();<BR>     e->Delete();<BR>   } catch (COleException *e) {<BR>     e->ReportError();<BR>     e->Delete();</FONT></P>
<P><FONT face="Times New Roman">   }</FONT></P>
<P><FONT face="Times New Roman"> }</FONT></P>
举报 回复(0) 喜欢(0)     评分
wensen138
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数6
  • QQ
  • 铜币120枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-11-22 23:37
<P>各位大哥,帮帮我</P>
<img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
wensen138
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数6
  • QQ
  • 铜币120枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-11-22 10:49
各位大哥,mapxtreme是否支持sqlserver呢,我只看到支持orale8i <img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
wensen138
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数6
  • QQ
  • 铜币120枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-11-22 10:37
<img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
wensen138
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数6
  • QQ
  • 铜币120枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2006-11-22 10:36
<img src="images/post/smile/dvbbs/em03.gif" /><img src="images/post/smile/dvbbs/em08.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部