阅读:1303回复:3
VC+MapX中添加图元的问题
<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> |
|
1楼#
发布于:2005-03-27 13:53
<P>Sorry!</P><P>上面的m_Map.AutoRedraw(TRUE);应该是m_Map.SetAutoRedraw(TRUE);</P>
|
|
|
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>
|
|
|
3楼#
发布于:2005-03-16 14:38
学习!
|
|