阅读:1366回复:0
关于在图层画线的程序出错,请大家帮我看看这段程序有什么问题
<P ><FONT face="Times New Roman">CMapXLayer layer = m_ctrlMapX.GetLayers().Item("huhu");</FONT></P>
<P ><FONT face="Times New Roman"> CMapXFeature obj,newobj;</FONT></P> <P ><FONT face="Times New Roman"> CMapXPoints pts;</FONT></P> <P ><FONT face="Times New Roman"> CMapXPoint p,pt;</FONT></P> <P ><FONT face="Times New Roman"> CMapXStyle style;</FONT></P> <P ><FONT face="Times New Roman"> style.CreateDispatch (style.GetClsid ());</FONT></P> <P ><FONT face="Times New Roman"> style.PickLine();</FONT></P> <P ><FONT face="Times New Roman"> newobj.CreateDispatch(newobj.GetClsid());</FONT></P> <P ><FONT face="Times New Roman"> newobj.Attach(m_ctrlMapX.GetDispatch());</FONT></P> <P ><FONT face="Times New Roman"> newobj.SetType(miFeatureTypeLine);</FONT></P> <P ><FONT face="Times New Roman"> newobj.SetStyle(m_ctrlMapX.GetDefaultStyle());</FONT></P> <P ><FONT face="Times New Roman"> pt.CreateDispatch (pt.GetClsid ());</FONT></P> <P ><FONT face="Times New Roman">pts.CreateDispatch (pts.GetClsid ());</FONT></P> <P ><FONT face="Times New Roman"> pt.Set(m_ctrlMapX.GetCenterX()+10.0,m_ctrlMapX.GetCenterY());</FONT></P> <P ><FONT face="Times New Roman"> pts.Add(pt);</FONT></P> <P ><FONT face="Times New Roman"> pt.Set(m_ctrlMapX.GetCenterX()+11.0,m_ctrlMapX.GetCenterY() + 4.0);</FONT></P> <P ><FONT face="Times New Roman"> pts.Add(pt);</FONT></P> <P ><FONT face="Times New Roman"> pt.Set(m_ctrlMapX.GetCenterX()+9.0,m_ctrlMapX.GetCenterY()-11.0);</FONT></P> <P ><FONT face="Times New Roman"> pts.Add(pt);</FONT></P> <P ><FONT face="Times New Roman"> newobj.GetParts().Add(pts);</FONT></P> <P ><FONT face="Times New Roman"> layer.AddFeature(newobj); </FONT></P> <P ><FONT face="Times New Roman">我用这段程序在huhu这个图层上添加一些线条,程序运行没有出错,但就是加不进去,请大家帮我看看哪里出问题了,是不是还缺少什么</FONT></P> <P ><FONT face="Times New Roman"> </FONT></P> |
|