|
From: Zekeng l. <ken...@ho...> - 2005-07-14 17:36:47
|
Hi,
When I tried to remove the layers from the MapContext, update the layers and
then add them back to the MapContext, it has the "SEVERE: Error adding map
layer" problem. It says:
java.lang.NullPointerException
at
org.geotools.renderer.j2d.StyledMapRenderer.addLayer(StyledMapRendere
r.java:180)
at
org.geotools.renderer.j2d.StyledMapRenderer$1.layerAdded(StyledMapRen
derer.java:135)
at
org.geotools.map.DefaultMapContext.fireMapLayerListListenerLayerAdded
(DefaultMapContext.java:701)
at
org.geotools.map.DefaultMapContext.addLayers(DefaultMapContext.java:2
62)
at SpearfishMySQL.loadFeatures(SpearfishMySQL.java:709)
at SpearfishMySQL$1.zoomChanged(SpearfishMySQL.java:457)
at
org.geotools.gui.swing.ZoomPane.fireZoomChanged0(ZoomPane.java:1387)
at
org.geotools.gui.swing.ZoomPane.fireZoomChanged(ZoomPane.java:1360)
at org.geotools.gui.swing.ZoomPane.transform(ZoomPane.java:1167)
at org.geotools.gui.swing.ZoomPane.transform(ZoomPane.java:1313)
at org.geotools.gui.swing.ZoomPane.access$600(ZoomPane.java:212)
at
org.geotools.gui.swing.ZoomPane$3.actionPerformed(ZoomPane.java:734)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown
Source)
......
It has no probelm if I dont remove the layers but add the updated layers
into the MapContext directly. But this approach will increase the using
memory as the times to add the layers to the MapContext increases, and the
program will be very slow in the end. Can anyone give some hints ?
Regards
zekeng
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|