On 21.10.2017 18:46, Holger Mappt wrote:
Hi,

Is there a plugin that is updated already? I need some examples to see what I should do with the deprecated items. E.g. I have
Main.map.mapView.addMouseListener(mouseAdapter);
in my plugin. Main.map is a deprecated field and should be changed to MainApplication.getMap(). But the access to MainApplication.getMap().mapView is discouraged. The documentation [1] says I should use LayerManager [2] instead.

You can replace "Main.map.mapView.addMouseListener(mouseAdapter);" with
"MainApplication.getMap().mapView.addMouseListener(mouseAdapter);".

The comment in MapFrame.java is misleading: use of the field mapView is only discouraged for accessing methods the have been moved from MapView to LayerManager.

But how do I register a mouse listener with the LayerManager? Or should I use the MainPanel [3] for the mouse listener? If so it would be good to have a direct mapping from Main.map.mapView.addMouseListener() to the corresponding call on the deprecation page [4]. BTW, do I access MainPanel directly (MainPanel.addMouseListener()) or what would be the right way to get a reference to the MainPanel?

You don't normally need the MainPanel instance, but it can be accessed with MainApplication.getMainPanel().

Paul

Reply via email to