阅读:2295回复:2
[求助]急!!!我为什么添加的图层显示不出来?
<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> |
|
1楼#
发布于:2006-06-19 17:23
<P>解决了吗?期待中……我也有类似的问题</P>
<P>newlayer.addFeature(rectangle);</P> <P>试着改成PrimaryKey pk=newlayer.addFeature(rectangle);</P> |
|
2楼#
发布于:2006-07-03 09:16
<P>直接使用addLayer方法,默认是添加到最底层,你的图层被上面的图层覆盖了,当然看不到咯,建议使用insertlayer</P>
|
|