Changeset 12630 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2017-08-24T00:15:51+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NoteImporter.java
r12620 r12630 12 12 import org.openstreetmap.josm.actions.ExtensionFileFilter; 13 13 import org.openstreetmap.josm.data.notes.Note; 14 import org.openstreetmap.josm.gui.MainApplication; 14 15 import org.openstreetmap.josm.gui.layer.NoteLayer; 15 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 63 64 final List<Note> fileNotes = new NoteReader(in).parse(); 64 65 List<NoteLayer> noteLayers = null; 65 if (Main .map!= null) {66 if (MainApplication.getMap() != null) { 66 67 noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class); 67 68 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r12620 r12630 30 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 31 31 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 32 import org.openstreetmap.josm.gui.MainApplication; 32 33 import org.openstreetmap.josm.gui.layer.ImageryLayer; 33 34 import org.openstreetmap.josm.gui.layer.Layer; … … 241 242 * to load the layers in the first place because they would have 242 243 * been disabled! */ 243 if (Main .isDisplayingMapView()) {244 if (MainApplication.isDisplayingMapView()) { 244 245 for (Layer l : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 245 246 if (((ImageryLayer) l).getInfo().isBlacklisted()) { -
trunk/src/org/openstreetmap/josm/io/WMSLayerExporter.java
r10345 r12630 7 7 import java.io.ObjectOutputStream; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.Preferences; 11 10 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryPreferenceEntry; 11 import org.openstreetmap.josm.gui.MainApplication; 12 12 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 13 13 import org.openstreetmap.josm.gui.layer.Layer; … … 40 40 try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) { 41 41 oos.writeInt(CURRENT_FILE_VERSION); // file version 42 oos.writeObject(Main .map.mapView.getCenter());42 oos.writeObject(MainApplication.getMap().mapView.getCenter()); 43 43 ImageryPreferenceEntry entry = new ImageryPreferenceEntry(((AbstractTileSourceLayer) layer).getInfo()); 44 44 oos.writeObject(Preferences.serializeStruct(entry, ImageryPreferenceEntry.class)); -
trunk/src/org/openstreetmap/josm/io/WMSLayerImporter.java
r10615 r12630 17 17 import org.openstreetmap.josm.data.imagery.ImageryInfo; 18 18 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryPreferenceEntry; 19 import org.openstreetmap.josm.gui.MainApplication; 19 20 import org.openstreetmap.josm.gui.layer.ImageryLayer; 20 21 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 88 89 Main.getLayerManager().addLayer(layer); 89 90 if (zoomTo != null) { 90 Main .map.mapView.zoomTo(zoomTo);91 MainApplication.getMap().mapView.zoomTo(zoomTo); 91 92 } 92 93 }); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r12620 r12630 14 14 import org.openstreetmap.josm.data.osm.Node; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm.gui.MainApplication; 17 import org.openstreetmap.josm.gui.MapView; 16 18 import org.openstreetmap.josm.gui.util.GuiHelper; 17 19 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; … … 85 87 Node node = null; 86 88 87 if (Main.isDisplayingMapView()) { 88 Point p = Main.map.mapView.getPoint(ll); 89 node = Main.map.mapView.getNearestNode(p, OsmPrimitive::isUsable); 89 if (MainApplication.isDisplayingMapView()) { 90 MapView mapView = MainApplication.getMap().mapView; 91 Point p = mapView.getPoint(ll); 92 node = mapView.getNearestNode(p, OsmPrimitive::isUsable); 90 93 if (node != null && node.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remotecontrol.tolerance", 0.1)) { 91 94 node = null; // node is too far … … 103 106 AutoScaleAction.autoScale("selection"); 104 107 } else { 105 Main .map.mapView.repaint();108 MainApplication.getMap().mapView.repaint(); 106 109 } 107 110 // parse parameter addtags=tag1=value1|tag2=vlaue2 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
r10716 r12630 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Point;7 6 import java.util.ArrayList; 8 7 import java.util.Arrays; … … 23 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 23 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm.gui.MapView; 25 26 import org.openstreetmap.josm.gui.util.GuiHelper; 26 27 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; … … 125 126 Node nd = null; 126 127 127 if (Main .isDisplayingMapView()) {128 Point p = Main.map.mapView.getPoint(ll);129 nd = Main.map.mapView.getNearestNode(p, OsmPrimitive::isUsable);128 if (MainApplication.isDisplayingMapView()) { 129 MapView mapView = MainApplication.getMap().mapView; 130 nd = mapView.getNearestNode(mapView.getPoint(ll), OsmPrimitive::isUsable); 130 131 if (nd != null && nd.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remote.tolerance", 0.1)) { 131 132 nd = null; // node is too far … … 171 172 AutoScaleAction.autoScale("selection"); 172 173 } else { 173 Main .map.mapView.repaint();174 MainApplication.getMap().mapView.repaint(); 174 175 } 175 176 return way; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
r12620 r12630 10 10 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 11 11 import org.openstreetmap.josm.data.imagery.ImageryLayerInfo; 12 import org.openstreetmap.josm.gui.MainApplication; 12 13 import org.openstreetmap.josm.gui.layer.ImageryLayer; 13 14 import org.openstreetmap.josm.gui.util.GuiHelper; … … 95 96 protected void handleRequest() throws RequestHandlerErrorException { 96 97 final ImageryInfo imgInfo = buildImageryInfo(); 97 if (Main .isDisplayingMapView()) {98 if (MainApplication.isDisplayingMapView()) { 98 99 for (ImageryLayer layer : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 99 100 if (layer.getInfo().equals(imgInfo)) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r12620 r12630 26 26 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 27 27 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 28 import org.openstreetmap.josm.gui.MainApplication; 29 import org.openstreetmap.josm.gui.MapFrame; 28 30 import org.openstreetmap.josm.gui.util.GuiHelper; 29 31 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; … … 184 186 ds.setSelected(newSel); 185 187 zoom(newSel, bbox); 186 if (Main.isDisplayingMapView() && Main.map.relationListDialog != null) { 187 Main.map.relationListDialog.selectRelations(null); // unselect all relations to fix #7342 188 Main.map.relationListDialog.dataChanged(null); 189 Main.map.relationListDialog.selectRelations(Utils.filteredCollection(newSel, Relation.class)); 188 MapFrame map = MainApplication.getMap(); 189 if (MainApplication.isDisplayingMapView() && map.relationListDialog != null) { 190 map.relationListDialog.selectRelations(null); // unselect all relations to fix #7342 191 map.relationListDialog.dataChanged(null); 192 map.relationListDialog.selectRelations(Utils.filteredCollection(newSel, Relation.class)); 190 193 } 191 194 }); … … 233 236 if (!"download".equals(args.get("zoom_mode")) && !primitives.isEmpty()) { 234 237 AutoScaleAction.autoScale("selection"); 235 } else if (Main .isDisplayingMapView()) {238 } else if (MainApplication.isDisplayingMapView()) { 236 239 // make sure this isn't called unless there *is* a MapView 237 240 GuiHelper.executeByMainWorkerInEDT(() -> { 238 241 BoundingXYVisitor bbox1 = new BoundingXYVisitor(); 239 242 bbox1.visit(bbox); 240 Main .map.mapView.zoomTo(bbox1);243 MainApplication.getMap().mapView.zoomTo(bbox1); 241 244 }); 242 245 } -
trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
r12620 r12630 32 32 import org.openstreetmap.josm.data.coor.LatLon; 33 33 import org.openstreetmap.josm.data.projection.Projections; 34 import org.openstreetmap.josm.gui.MainApplication; 35 import org.openstreetmap.josm.gui.MapView; 34 36 import org.openstreetmap.josm.gui.layer.GpxLayer; 35 37 import org.openstreetmap.josm.gui.layer.Layer; … … 262 264 Element centerEl = doc.createElement("center"); 263 265 viewportEl.appendChild(centerEl); 264 EastNorth center = Main.map.mapView.getCenter(); 266 MapView mapView = MainApplication.getMap().mapView; 267 EastNorth center = mapView.getCenter(); 265 268 LatLon centerLL = Projections.inverseProject(center); 266 269 centerEl.setAttribute("lat", Double.toString(centerLL.lat())); … … 268 271 Element scale = doc.createElement("scale"); 269 272 viewportEl.appendChild(scale); 270 double dist100px = Main.map.mapView.getDist100Pixel();273 double dist100px = mapView.getDist100Pixel(); 271 274 scale.setAttribute("meter-per-pixel", Double.toString(dist100px / 100)); 272 275 }
Note:
See TracChangeset
for help on using the changeset viewer.