Skip to content

Commit

Permalink
update to JOSM 12671
Browse files Browse the repository at this point in the history
  • Loading branch information
don-vip committed Aug 27, 2017
1 parent 5f01517 commit 159c2ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion openvisible/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="Changed the constructor signature of the plugin main class; updated build.xml"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
<property name="plugin.main.version" value="10580"/>
<property name="plugin.main.version" value="12671"/>

<!-- Configure these properties (replace "..." accordingly).
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.MapView;
import org.openstreetmap.josm.gui.io.importexport.GpxImporter;
import org.openstreetmap.josm.gui.io.importexport.OsmImporter;
import org.openstreetmap.josm.gui.layer.GpxLayer;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.io.GpxImporter;
import org.openstreetmap.josm.io.GpxReader;
import org.openstreetmap.josm.io.IllegalDataException;
import org.openstreetmap.josm.io.OsmImporter;
import org.openstreetmap.josm.io.OsmReader;
import org.openstreetmap.josm.tools.Shortcut;
import org.xml.sax.SAXException;
Expand All @@ -54,12 +55,13 @@ public OpenVisibleAction() {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
@Override
public void actionPerformed(ActionEvent e) {
if(Main.map == null || Main.map.mapView == null) {
if(!MainApplication.isDisplayingMapView()) {
JOptionPane.showMessageDialog(Main.parent, tr("No view open - cannot determine boundaries!"));
return;
}
MapView view = Main.map.mapView;
MapView view = MainApplication.getMap().mapView;
Rectangle bounds = view.getBounds();
LatLon bottomLeft = view.getLatLon(bounds.x, bounds.y + bounds.height);
LatLon topRight = view.getLatLon(bounds.x + bounds.width, bounds.y);
Expand Down Expand Up @@ -108,7 +110,7 @@ private void openAsData(File file) throws SAXException, IOException, FileNotFoun
if (new OsmImporter().acceptFile(file)) {
DataSet dataSet = OsmReader.parseDataSet(new FileInputStream(file), NullProgressMonitor.INSTANCE);
OsmDataLayer layer = new OsmDataLayer(dataSet, fn, file);
Main.getLayerManager().addLayer(layer);
MainApplication.getLayerManager().addLayer(layer);
}
else
JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("Unknown file extension: {0}", fn.substring(fn.lastIndexOf('.')+1)));
Expand All @@ -130,8 +132,8 @@ private void openFileAsGpx(File file) throws SAXException, IOException, FileNotF
}
r.getGpxData().storageFile = file;
GpxLayer gpxLayer = new GpxLayer(r.getGpxData(), fn);
Main.getLayerManager().addLayer(gpxLayer);
Main.getLayerManager().addLayer(new MarkerLayer(r.getGpxData(), tr("Markers from {0}", fn), file, gpxLayer));
MainApplication.getLayerManager().addLayer(gpxLayer);
MainApplication.getLayerManager().addLayer(new MarkerLayer(r.getGpxData(), tr("Markers from {0}", fn), file, gpxLayer));

} else {
throw new IllegalStateException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
package at.dallermassl.josm.plugin.openvisible;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.MainMenu;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;
Expand All @@ -16,7 +16,7 @@ public class OpenVisiblePlugin extends Plugin {

public OpenVisiblePlugin(PluginInformation info) {
super(info);
MainMenu.add(Main.main.menu.gpsMenu, new OpenVisibleAction());
MainMenu.add(MainApplication.getMenu().gpsMenu, new OpenVisibleAction());
}

}

0 comments on commit 159c2ca

Please sign in to comment.