Changeset 33720 in osm for applications
- Timestamp:
- 2017-10-19T00:12:02+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/infomode
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/infomode/build.xml
r32680 r33720 5 5 <property name="commit.message" value="InfoMode : for shortcurt parser"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 0580"/>7 <property name="plugin.main.version" value="12630"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoMode.java
r32789 r33720 30 30 import org.openstreetmap.josm.data.gpx.GpxTrackSegment; 31 31 import org.openstreetmap.josm.data.gpx.WayPoint; 32 import org.openstreetmap.josm.gui.Ma pFrame;32 import org.openstreetmap.josm.gui.MainApplication; 33 33 import org.openstreetmap.josm.gui.MapView; 34 34 import org.openstreetmap.josm.gui.layer.GpxLayer; 35 35 import org.openstreetmap.josm.gui.layer.Layer; 36 36 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 37 import org.openstreetmap.josm.tools.Logging; 37 38 import org.openstreetmap.josm.tools.Shortcut; 38 39 … … 50 51 private InfoPanel infoPanel; 51 52 52 InfoMode( MapFrame mapFrame) {53 InfoMode() { 53 54 super(tr("InfoMode"), "infomode.png", tr("GPX info mode"), 54 55 Shortcut.registerShortcut("mapmode:infomode", tr("Mode: {0}", tr("GPX info mode")), KeyEvent.VK_BACK_SLASH, Shortcut.DIRECT), 55 mapFrame,Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));56 Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 56 57 infoPanel = new InfoPanel(); 57 58 } … … 63 64 if (!isEnabled()) return; 64 65 super.enterMode(); 65 mv = Main .map.mapView;66 Main.map.mapView.addMouseListener(this);67 Main.map.mapView.addMouseMotionListener(this);68 Main.map.mapView.addTemporaryLayer(this);66 mv = MainApplication.getMap().mapView; 67 mv.addMouseListener(this); 68 mv.addMouseMotionListener(this); 69 mv.addTemporaryLayer(this); 69 70 /*if (!(Main.main.getActiveLayer() instanceof GpxLayer)) { 70 71 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( … … 75 76 }*/ 76 77 77 Main.map.statusLine.setHelpText(tr("Move the mouse to show trackpoint info for current layer. Hold shift to highlight tracks")); 78 Main.map.statusLine.repaint(); 78 MainApplication.getMap().statusLine.setHelpText( 79 tr("Move the mouse to show trackpoint info for current layer. Hold shift to highlight tracks")); 80 MainApplication.getMap().statusLine.repaint(); 79 81 80 82 try { … … 82 84 AWTEvent.KEY_EVENT_MASK); 83 85 } catch (SecurityException ex) { 84 Main.error(ex);86 Logging.error(ex); 85 87 } 86 88 } … … 89 91 public void exitMode() { 90 92 super.exitMode(); 91 Main .map.mapView.removeMouseListener(this);92 Main .map.mapView.removeMouseMotionListener(this);93 94 Main .map.mapView.removeTemporaryLayer(this);93 MainApplication.getMap().mapView.removeMouseListener(this); 94 MainApplication.getMap().mapView.removeMouseMotionListener(this); 95 96 MainApplication.getMap().mapView.removeTemporaryLayer(this); 95 97 if (oldPopup != null) oldPopup.hide(); 96 98 … … 98 100 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 99 101 } catch (SecurityException ex) { 100 Main.error(ex);102 Logging.error(ex); 101 103 } 102 104 … … 180 182 e.getKeyCode() == KeyEvent.VK_ENTER || 181 183 e.getKeyCode() == KeyEvent.VK_ESCAPE) { 182 Main .map.selectSelectTool(false);184 MainApplication.getMap().selectSelectTool(false); 183 185 } 184 186 } … … 198 200 @Override 199 201 protected void updateStatusLine() { 200 Main .map.statusLine.setHelpText(statusText);201 Main .map.statusLine.repaint();202 MainApplication.getMap().statusLine.setHelpText(statusText); 203 MainApplication.getMap().statusLine.repaint(); 202 204 } 203 205 // </editor-fold> 204 206 205 207 private void repaint() { 206 if (Main.map != null) Main.map.mapView.repaint(); 208 if (MainApplication.getMap() != null) 209 MainApplication.getMap().mapView.repaint(); 207 210 } 208 211 /*private void setStatusLine(String tr) { … … 244 247 oldWp = null; // next segment will have new previous point 245 248 for (WayPoint S : seg.getWayPoints()) { 246 d = S.getEastNorth( ).distance(pos);249 d = S.getEastNorth(Main.getProjection()).distance(pos); 247 250 248 251 if (d < minDist && d < maxD) { … … 268 271 Point oldP = null, curP = null; // next segment will have new previous point 269 272 for (WayPoint S : seg.getWayPoints()) { 270 curP = mv.getPoint(S.getEastNorth( ));273 curP = mv.getPoint(S.getEastNorth(Main.getProjection())); 271 274 if (oldP != null) g.drawLine(oldP.x, oldP.y, curP.x, curP.y); 272 275 oldP = curP; -
applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoModePlugin.java
r32789 r33720 2 2 package org.openstreetmap.josm.plugins.infomode; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.gui.IconToggleButton; 5 import org.openstreetmap.josm.gui.MainApplication; 6 6 import org.openstreetmap.josm.gui.MapFrame; 7 7 import org.openstreetmap.josm.plugins.Plugin; … … 17 17 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 18 18 if (oldFrame == null && newFrame != null) { 19 Main .map.addMapMode(new IconToggleButton(new InfoMode(Main.map)));19 MainApplication.getMap().addMapMode(new IconToggleButton(new InfoMode())); 20 20 } 21 21 } -
applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoPanel.java
r32789 r33720 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.ActionListener; 9 import java.awt.event.MouseAdapter; 9 10 import java.awt.event.MouseEvent; 10 import java.awt.event.MouseListener;11 11 import java.text.DateFormat; 12 12 import java.util.Collection; … … 20 20 import javax.swing.JPanel; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.gpx.GpxTrack; 24 23 import org.openstreetmap.josm.data.gpx.GpxTrackSegment; 25 24 import org.openstreetmap.josm.data.gpx.WayPoint; 25 import org.openstreetmap.josm.gui.MainApplication; 26 26 import org.openstreetmap.josm.tools.GBC; 27 import org.openstreetmap.josm.tools.Logging; 27 28 import org.openstreetmap.josm.tools.OpenBrowser; 28 29 … … 55 56 add(but2, GBC.eop().insets(10, 5, 0, 0)); 56 57 // lightweight hyperlink 57 label6.addMouseListener(new Mouse Listener() {58 label6.addMouseListener(new MouseAdapter() { 58 59 @Override 59 60 public void mouseClicked(MouseEvent e) { … … 61 62 OpenBrowser.displayUrl(s.substring(9, s.length()-11)); 62 63 } 63 64 @Override65 public void mousePressed(MouseEvent e) { }66 67 @Override68 public void mouseReleased(MouseEvent e) { }69 70 @Override71 public void mouseEntered(MouseEvent e) { }72 73 @Override74 public void mouseExited(MouseEvent e) { }75 64 }); 76 65 but1.addActionListener(new ActionListener() { … … 78 67 public void actionPerformed(ActionEvent e) { 79 68 if (tracks != null) tracks.remove(trk); 80 Main .map.mapView.repaint();69 MainApplication.getMap().mapView.repaint(); 81 70 } 82 71 }); … … 109 98 } 110 99 tracks.removeAll(toRemove); 111 Main .map.mapView.repaint();100 MainApplication.getMap().mapView.repaint(); 112 101 } 113 102 }); 114 115 116 103 } 117 104 … … 139 126 s1 = String.format("H=%3.1f ", Double.parseDouble(s)); 140 127 } catch (Exception e) { 141 Main.warn(e);128 Logging.warn(e); 142 129 } 143 130 s1 = s1+"L="+(int) trk.length();
Note:
See TracChangeset
for help on using the changeset viewer.