[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-devel] AddLayerCommand
|
ApplicationGIS.addLayersToMap() ?
On Mon, 2007-06-18 at 11:56 +0000, James Anderson wrote:
> I've spent the past four days attempting to add a layer through using a
> customised plug-in icon. However every time I've tried I've kept getting a
> null pointer exception from the new layer that I've been attempting to add.
>
> The actual code that adds the layer can be found on the Internet called
> AddLayerCommand, however, I've been calling it from another class with the
> extension AbstractCommand that enables the customised plug-in icon to
> trigger an event, within this class my run method contains the following
> code:
>
> IMap map;
> map.sendCommandASync(new AddLayerCommand(layer) );
>
> However, the map variable has not been initialised so when the user clicks
> the button nothing happens. If I add the following code to my run method:
>
> IMap map = ApplicationGIS.getActiveMap();
> map.sendCommandASync(new AddLayerCommand(layer) );
>
> When the user clicks on the icon it triggers an event, however, it displays
> the following error message:
>
> An internal error occurred during: "Map command executing"
>
> It's obvious I'm initialising the map variable incorrectly but if anyone
> knows how to initialise the variable correctly then please reply to this
> email as soon as possible. I'll keep looking over the Internet for an
> answer myself while I wait for a reply.
>
> James.
>
> _________________________________________________________________
> Win tickets to the sold out Live Earth concert! http://liveearth.uk.msn.com
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel