Changeset 115 in josm for src/org/openstreetmap
- Timestamp:
- 2006-07-19T01:44:25+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 2 added
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/MainApplication.java
r113 r115 13 13 import java.util.LinkedList; 14 14 import java.util.List; 15 import java.util.Locale; 15 16 import java.util.Map; 16 17 … … 70 71 Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler()); 71 72 73 // construct argument table 72 74 List<String> argList = Arrays.asList(argArray); 73 if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) {74 System.out.println(tr("Java OpenStreetMap Editor\n\n"+75 "usage:\n"+76 "\tjava -jar josm.jar <option> <option> <option>...\n\n"+77 "options:\n"+78 "\t--help|-?|-h Show this help\n"+79 "\t--geometry=widthxheight(+|-)x(+|-)y Standard unix geometry argument\n"+80 "\t[--download=]minlat,minlon,maxlat,maxlon Download the bounding box\n"+81 "\t[--download=]<url> Download the location at the url (with lat=x&lon=y&zoom=z)\n"+82 "\t[--download=]<filename> Open file (as raw gps, if .gpx or .csv)\n"+83 "\t--downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw gps\n"+84 "\t--selection=<searchstring> Select with the given search\n"+85 "\t--no-fullscreen Don't launch in fullscreen mode\n"+86 "\t--reset-preferences Reset the preferences to default\n\n"+87 "examples:\n"+88 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+89 "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+90 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+91 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n\n"+92 93 "Parameters are read in the order they are specified, so make sure you load\n"+94 "some data before --selection\n\n"+95 "Instead of --download=<bbox> you may specify osm://<bbox>\n"));96 System.exit(0);97 }98 99 final File prefDir = new File(Main.pref.getPreferencesDir());100 if (prefDir.exists() && !prefDir.isDirectory()) {101 JOptionPane.showMessageDialog(null, tr("Cannot open preferences directory: {0}",Main.pref.getPreferencesDir()));102 return;103 }104 if (!prefDir.exists())105 prefDir.mkdirs();106 107 // construct argument table108 75 Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 109 76 for (String arg : argArray) { … … 120 87 } 121 88 89 // very first thing to do is to setup the locale 90 if (args.containsKey("language") && !args.get("language").isEmpty() && args.get("language").iterator().next().length() >= 2) { 91 String s = args.get("language").iterator().next(); 92 Locale l = null; 93 if (s.length() <= 2 || s.charAt(2) != '_') 94 l = new Locale(s); 95 else if (s.length() <= 5 || s.charAt(5) != '.') 96 l = new Locale(s.substring(0,2), s.substring(3)); 97 else 98 l = new Locale(s.substring(0,2), s.substring(3,5), s.substring(6)); 99 Locale.setDefault(l); 100 } 101 102 if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) { 103 System.out.println(tr("Java OpenStreetMap Editor")+"\n\n"+ 104 tr("usage")+":\n"+ 105 "\tjava -jar josm.jar <option> <option> <option>...\n\n"+ 106 tr("options")+":\n"+ 107 "\t--help|-?|-h "+tr("Show this help")+"\n"+ 108 "\t--geometry=widthxheight(+|-)x(+|-)y "+tr("Standard unix geometry argument")+"\n"+ 109 "\t[--download=]minlat,minlon,maxlat,maxlon "+tr("Download the bounding box")+"\n"+ 110 "\t[--download=]<url> "+tr("Download the location at the url (with lat=x&lon=y&zoom=z)")+"\n"+ 111 "\t[--download=]<filename> "+tr("Open file (as raw gps, if .gpx or .csv)")+"\n"+ 112 "\t--downloadgps=minlat,minlon,maxlat,maxlon "+tr("Download the bounding box as raw gps")+"\n"+ 113 "\t--selection=<searchstring> "+tr("Select with the given search")+"\n"+ 114 "\t--no-fullscreen "+tr("Don't launch in fullscreen mode")+"\n"+ 115 "\t--reset-preferences "+tr("Reset the preferences to default")+"\n\n"+ 116 "\t--language=<language> "+tr("Set the language. Example: ")+"\n\n"+ 117 tr("examples")+":\n"+ 118 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+ 119 "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+ 120 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+ 121 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n\n"+ 122 123 tr("Parameters are read in the order they are specified, so make sure you load\n"+ 124 "some data before --selection")+"\n\n"+ 125 tr("Instead of --download=<bbox> you may specify osm://<bbox>\n")); 126 System.exit(0); 127 } 128 129 final File prefDir = new File(Main.pref.getPreferencesDir()); 130 if (prefDir.exists() && !prefDir.isDirectory()) { 131 JOptionPane.showMessageDialog(null, tr("Cannot open preferences directory: {0}",Main.pref.getPreferencesDir())); 132 return; 133 } 134 if (!prefDir.exists()) 135 prefDir.mkdirs(); 136 122 137 preConstructorInit(args); 123 138 JFrame mainFrame = new JFrame(tr("Java Open Street Map - Editor")); -
src/org/openstreetmap/josm/gui/MapView.java
r113 r115 8 8 import java.awt.event.ComponentAdapter; 9 9 import java.awt.event.ComponentEvent; 10 import java.awt.event.MouseAdapter;11 import java.awt.event.MouseEvent;12 import java.beans.PropertyChangeEvent;13 import java.beans.PropertyChangeListener;14 10 import java.util.ArrayList; 15 11 import java.util.Collection; … … 18 14 19 15 import javax.swing.JOptionPane; 20 import javax.swing.JSlider;21 import javax.swing.event.ChangeEvent;22 import javax.swing.event.ChangeListener;23 16 24 17 import org.openstreetmap.josm.Main; … … 87 80 88 81 89 private final class Scaler extends JSlider implements PropertyChangeListener, ChangeListener {90 boolean clicked = false;91 public Scaler() {92 super(0, 20);93 addMouseListener(new MouseAdapter(){94 @Override public void mousePressed(MouseEvent e) {95 clicked = true;96 }97 @Override public void mouseReleased(MouseEvent e) {98 clicked = false;99 }100 });101 MapView.this.addPropertyChangeListener("scale", this);102 addChangeListener(this);103 }104 public void propertyChange(PropertyChangeEvent evt) {105 if (!getModel().getValueIsAdjusting())106 setValue(zoom());107 }108 public void stateChanged(ChangeEvent e) {109 if (!clicked)110 return;111 EastNorth pos = world;112 for (int zoom = 0; zoom < getValue(); ++zoom)113 pos = new EastNorth(pos.east()/2, pos.north()/2);114 if (MapView.this.getWidth() < MapView.this.getHeight())115 zoomTo(center, pos.east()*2/(MapView.this.getWidth()-20));116 else117 zoomTo(center, pos.north()*2/(MapView.this.getHeight()-20));118 }119 }120 121 82 public MapView(AutoScaleAction autoScaleAction) { 122 83 this.autoScaleAction = autoScaleAction; … … 134 95 } 135 96 }); 136 Scaler zoomScaler = new Scaler(); 137 zoomScaler.setOpaque(false); 138 add(zoomScaler); 139 zoomScaler.setBounds(0,0, 100, 30); 97 98 MapSlider zoomSlider = new MapSlider(this); 99 add(zoomSlider); 100 zoomSlider.setBounds(0,0, 100, 30); 101 102 MapScaler scaler = new MapScaler(this); 103 add(scaler); 104 scaler.setLocation(10,30); 140 105 } 141 106 -
src/org/openstreetmap/josm/gui/PreferenceDialog.java
r113 r115 78 78 Main.pref.put("draw.rawgps.lines", drawRawGpsLines.isSelected()); 79 79 Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected()); 80 Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected()); 80 81 Main.pref.put("draw.segment.direction", directionHint.isSelected()); 81 82 … … 157 158 */ 158 159 private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported.")); 160 private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points.")); 159 161 private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 160 162 private JTable colors; … … 220 222 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force")); 221 223 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 224 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large")); 225 largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points.")); 222 226 directionHint.setToolTipText(tr("Draw direction hints for all segments.")); 223 227 directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction")); … … 296 300 display.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0)); 297 301 display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0)); 302 display.add(largeGpsPoints, GBC.eop().insets(20,0,0,0)); 298 303 display.add(directionHint, GBC.eop().insets(20,0,0,0)); 299 304 display.add(new JLabel(tr("Colors")), GBC.eol()); -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r113 r115 234 234 public void actionPerformed(ActionEvent e) { 235 235 int sel = propertyTable.getSelectedRow(); 236 if (e.getActionCommand().equals( tr("Add")))236 if (e.getActionCommand().equals("Add")) 237 237 add(); 238 else if (e.getActionCommand().equals( tr("Edit"))) {238 else if (e.getActionCommand().equals("Edit")) { 239 239 if (sel == -1) 240 240 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit.")); 241 241 else 242 242 edit(sel); 243 } else if (e.getActionCommand().equals( tr("Delete"))) {243 } else if (e.getActionCommand().equals("Delete")) { 244 244 if (sel == -1) 245 245 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete.")); -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r110 r115 41 41 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 42 42 import org.openstreetmap.josm.io.OsmIdReader; 43 import org.openstreetmap.josm.io.Progress Reader;43 import org.openstreetmap.josm.io.ProgressInputStream; 44 44 import org.openstreetmap.josm.tools.GBC; 45 45 import org.openstreetmap.josm.tools.ImageProvider; … … 74 74 try { 75 75 URLConnection con = url.openConnection(); 76 InputStream in = new Progress Reader(con, progress, currentAction);76 InputStream in = new ProgressInputStream(con, progress, currentAction); 77 77 currentAction.setText(tr("Downloading...")); 78 78 Map<Long, String> ids = idReader.parseIds(in); -
src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r113 r115 112 112 g.setColor(Color.GRAY); 113 113 Point old = null; 114 115 boolean force = Main.pref.getBoolean("draw.rawgps.lines.force"); 116 boolean lines = Main.pref.getBoolean("draw.rawgps.lines"); 117 boolean large = Main.pref.getBoolean("draw.rawgps.large"); 114 118 for (Collection<GpsPoint> c : data) { 115 if (! Main.pref.getBoolean("draw.rawgps.lines.force"))119 if (!force) 116 120 old = null; 117 121 for (GpsPoint p : c) { 118 122 Point screen = mv.getPoint(p.eastNorth); 119 if ( Main.pref.getBoolean("draw.rawgps.lines")&& old != null)123 if (lines && old != null) 120 124 g.drawLine(old.x, old.y, screen.x, screen.y); 121 else 125 else if (!large) 122 126 g.drawRect(screen.x, screen.y, 0, 0); 127 if (large) 128 g.fillRect(screen.x-1, screen.y-1, 3, 3); 123 129 old = screen; 124 130 } -
src/org/openstreetmap/josm/io/OsmServerReader.java
r104 r115 30 30 if (isAuthCancelled() && activeConnection.getResponseCode() == 401) 31 31 return null; 32 return new Progress Reader(activeConnection, progress, currentAction);32 return new ProgressInputStream(activeConnection, progress, currentAction); 33 33 } 34 34 } -
src/org/openstreetmap/josm/io/ProgressInputStream.java
r109 r115 12 12 * @author Imi 13 13 */ 14 public class Progress Readerextends InputStream {14 public class ProgressInputStream extends InputStream { 15 15 16 16 private final InputStream in; … … 21 21 private final URLConnection connection; 22 22 23 public Progress Reader(URLConnection con, BoundedRangeModel progress, JLabel currentAction) throws IOException {23 public ProgressInputStream(URLConnection con, BoundedRangeModel progress, JLabel currentAction) throws IOException { 24 24 this.connection = con; 25 25 this.in = con.getInputStream(); -
src/org/openstreetmap/josm/tools/I18n.java
r112 r115 20 20 i18n = I18nFactory.getI18n(Main.class); 21 21 } catch (MissingResourceException e) { 22 System.out.println("Locale '"+Locale.getDefault() .getLanguage()+"' not found. Using default.");22 System.out.println("Locale '"+Locale.getDefault()+"' not found. Using default."); 23 23 } 24 24 }
Note:
See TracChangeset
for help on using the changeset viewer.