kyky1234
路人甲
路人甲
  • 注册日期2005-01-18
  • 发帖数4
  • QQ
  • 铜币142枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1302回复:3

VC+MapX中添加图元的问题

楼主#
更多 发布于:2005-03-15 09:40
<TABLE  width="90%" border=0>

<TR>
<TD  width="100%"><IMG src="http://www.lbschina.com.cn/forum/face/face1.gif" border=0> <B>VC+mapx中添加图元的问题</B>
如何在打开的gst地图上编程实现添加图元?
参考了一段MapX online Help上的例程序:


<P>void CSampleProjectView::CreateEllipse()
{
  // TOD Add your command handler code here
  // FeatureFactory.CreateEllipticalRegion Method</P>
<P>    // Create a new ellipse region and add it to a temporary features layer
    CMapXRectangle rect;
    CMapXFeature createdEllipse;
    if(!rect.CreateDispatch(rect.GetClsid()))
   {
      TRACE0("Failed to Create rectangle object");
      return;
   }</P>
<P>    try
 {
        rect.Set(m_Map.GetCenterX(),m_Map.GetCenterY  (),m_Map.GetCenterX()  
       +100,m_Map.GetCenterY()+110);</P>
<P>        createdEllipse = m_Map.GetFeatureFactory().CreateEllipticalRegion(rect);</P>
<P>        m_Map.GetLayers().Item(" temp layer").AddFeature(createdEllipse);
        
   }
 catch(COleDispatchException* e)
 {
        e->ReportError();
        e->Delete();
  }
  catch(COleException* e)
 {
       e->ReportError();
       e->Delete();
  }
 
}
可以编译通过并执行,但是代码执行后,</P>
<P>地图上没有看到添加的椭圆图元,为什么?(相应图层已设为可编辑状态)
盼望哪位大侠赐教,多谢!</P></TD></TR></TABLE>
喜欢0 评分0
ch308
路人甲
路人甲
  • 注册日期2004-11-23
  • 发帖数48
  • QQ
  • 铜币203枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-03-16 14:38
学习!
举报 回复(0) 喜欢(0)     评分
nudtlarry
路人甲
路人甲
  • 注册日期2004-12-05
  • 发帖数319
  • QQ
  • 铜币770枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-03-27 13:50
<P>在</P><P>....</P><P>m_Map.GetLayers().Item(" temp layer").AddFeature(createdEllipse); </P><P>之后添加</P><P>m_Map.AutoRedraw(TRUE);</P><P>m_Map.GetLayers().Item(" temp layer").Refresh();</P><P>试试看能不能行!</P>
---------------------------------------------- E-Mail: nudtlarry@163.com ----------------------------------------------
举报 回复(0) 喜欢(0)     评分
nudtlarry
路人甲
路人甲
  • 注册日期2004-12-05
  • 发帖数319
  • QQ
  • 铜币770枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-03-27 13:53
<P>Sorry!</P><P>上面的m_Map.AutoRedraw(TRUE);应该是m_Map.SetAutoRedraw(TRUE);</P>
---------------------------------------------- E-Mail: nudtlarry@163.com ----------------------------------------------
举报 回复(0) 喜欢(0)     评分
游客

返回顶部