Hi,

I have an error message when I trying to use ZoomIn/ZoomOut tools after
removing all layers from mapPane. I understand that it makes no sense, but
it possible situation.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at org.geotools.swing.JMapPane.equalsFullExtent(JMapPane.java:606)
        at org.geotools.swing.JMapPane.doSetDisplayArea(JMapPane.java:564)
        at org.geotools.swing.JMapPane.setDisplayArea(JMapPane.java:544)
        at 
org.geotools.swing.tool.ZoomInTool.onMouseClicked(ZoomInTool.java:101)
        at
org.geotools.swing.tool.MapToolManager.mouseClicked(MapToolManager.java:130)

        at 
java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
               ...etc...

Reason - "fullExtent" is null during the call "JMapPane.equalsFullExtent()"

I added the following code into ZoomInTool#onMouseClicked:
if( getMapPane().getMapContext().getLayerCount() == 0 ) return;

It's working, 
but I want to ask - what is the right way to delete layer? Maybe I do
something wrong or miss something?

Here is my code:

//adding a layer:
...
MapLayer layer = new DefaultMapLayer( featureSource, style);
getMapContext().addLayer(layer);
...
//and deleting a layer:
getMapContext().removeLayer(layer);


Thank you,
Michael
-- 
View this message in context: 
http://n2.nabble.com/Removing-layers-and-ZoomIn-ZoomOut-tp4773598p4773598.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to