How can I handle changing of layers projection programmatically?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I handle changing of layers projection programmatically?

Artemij Amanzi

 

Hi,

 

How can I handle changing of layers projection programmatically?

(I selected Properties of necessary Layer and in projection tab changed CRS. Can I handle changing of CRS in my code? Maybe add some listener?)

 

Thanks

Artemij

 

 


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I handle changing of layers projection programmatically?

Jody Garnett-2
<base href="x-msg://250/">
Well I suspect there is a command .. since any change to Map/Layer stuff needs to be done via a command or we deadlock.

Not sure; let us look at how that operation does.... 

Looks like CRSPropertyPage has a applyCoordinateReferenceSystem method with the following:

UndoableComposite commands=new UndoableComposite();
List<MapCommand> commandList = commands.getCommands();
commandList.add(new SetLayerCRSCommand(layer, crs));

...

layer.getMap().sendCommandASync(commands);            


Since you just have one command; there is no need to do the UndoableComposte() thing.

On 08/06/2010, at 6:05 PM, Artemij Amanzi wrote: 
Hi,
 
How can I handle changing of layers projection programmatically?
(I selected Properties of necessary Layer and in projection tab changed CRS. Can I handle changing of CRS in my code? Maybe add some listener?)
 
Thanks
Artemij
 
 
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I handle changing of layers projection programmatically?

Artemij Amanzi

Thanks for answer,

But I mean – Can I create listener for handling  SetLayerCRSCommand ? Because if layer  gets this command I need to do additional stuff (for example: save new CRS in database).

 Artemij



2010/6/8 Jody Garnett <[hidden email]>
Well I suspect there is a command .. since any change to Map/Layer stuff needs to be done via a command or we deadlock.

Not sure; let us look at how that operation does.... 

Looks like CRSPropertyPage has a applyCoordinateReferenceSystem method with the following:

UndoableComposite commands=new UndoableComposite();
List<MapCommand> commandList = commands.getCommands();
commandList.add(new SetLayerCRSCommand(layer, crs));

...

layer.getMap().sendCommandASync(commands);            


Since you just have one command; there is no need to do the UndoableComposte() thing.

On 08/06/2010, at 6:05 PM, Artemij Amanzi wrote: 
Hi,
 
How can I handle changing of layers projection programmatically?
(I selected Properties of necessary Layer and in projection tab changed CRS. Can I handle changing of CRS in my code? Maybe add some listener?)
 
Thanks
Artemij
 
 
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel