goldeagle
路人甲
路人甲
  • 注册日期2006-04-06
  • 发帖数7
  • QQ
  • 铜币126枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2179回复:2

[求助]急!!!我为什么添加的图层显示不出来?

楼主#
更多 发布于:2006-04-08 18:02
<P>添加图层代码如下:<BR>private void addfeature()<BR>    {<BR>        try<BR>        {<BR>            Attribute att[] = new Attribute[1];<BR>            att[0] = new Attribute("Feature1");<BR>            AnnotationTableDescHelper annTableDesc = new AnnotationTableDescHelper(<BR>                    "newlayer");<BR>            AnnotationDataProviderHelper dpHelper = new AnnotationDataProviderHelper();<BR>            LocalDataProviderRef dpRef = new LocalDataProviderRef(dpHelper);<BR>            Layer newlayer = (Layer) mymap.getLayers().addLayer(dpRef,<BR>                    annTableDesc, "newlayer");<BR>            PrimaryKey pkey = new PrimaryKey(att[0]);</P>
<P>            FeatureFactory ff = mymap.getFeatureFactory();<BR>            double newrectangle[] = { 200, 100, 400, 100, 400, 200, 200, 200 };<BR>            Rendition rend = new RenditionImpl();<BR>            rend.setValue(Rendition.STROKE, Color.green);<BR>            Feature rectangle = ff.createPolyLine(newrectangle, rend, null, att,<BR>                    pkey);<BR>            newlayer.addFeature(rectangle);<BR>        } catch (Exception e)<BR>        {<BR>            System.out.println(e.getMessage());<BR>        }<BR>    }</P>
<P>哪里没写对啊?望高手指教,急需解答,不然要死人的~~</P>
喜欢0 评分0
olive_simple
路人甲
路人甲
  • 注册日期2006-06-19
  • 发帖数4
  • QQ
  • 铜币111枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-06-19 17:23
<P>解决了吗?期待中……我也有类似的问题</P>
<P>newlayer.addFeature(rectangle);</P>
<P>试着改成PrimaryKey pk=newlayer.addFeature(rectangle);</P>
举报 回复(0) 喜欢(0)     评分
goldeagle
路人甲
路人甲
  • 注册日期2006-04-06
  • 发帖数7
  • QQ
  • 铜币126枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-07-03 09:16
<P>直接使用addLayer方法,默认是添加到最底层,你的图层被上面的图层覆盖了,当然看不到咯,建议使用insertlayer</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部