Changeset 75 in josm


Ignore:
Timestamp:
2006-03-29T19:11:37+02:00 (18 years ago)
Author:
imi
Message:
  • added editable colors
  • changed preferences format (again)
Location:
src/org/openstreetmap/josm
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r74 r75  
    3535import org.openstreetmap.josm.data.Preferences;
    3636import org.openstreetmap.josm.data.osm.DataSet;
     37import org.openstreetmap.josm.data.projection.Epsg4263;
    3738import org.openstreetmap.josm.data.projection.Projection;
    3839import org.openstreetmap.josm.gui.MapFrame;
     
    222223                        } else
    223224                                pref.load();
    224                 } catch (RuntimeException x) {
    225                         //TODO: Temporary code to update user preferences.
    226                         if (x.getMessage().equals("old version")) {
    227                                 int answer = JOptionPane.showConfirmDialog(
    228                                                 null,
    229                                                 "The preferences - file format has changed.\nThe settings will be reset to default.",
    230                                                 "Information",
    231                                                 JOptionPane.OK_CANCEL_OPTION);
    232                                 if (answer == JOptionPane.CANCEL_OPTION)
    233                                         System.exit(0);
    234                                 pref.resetToDefault();
    235                                 try {
    236                                         pref.save();
    237                                 } catch (IOException e) {
    238                                         e.printStackTrace();
    239                                         errMsg = "Preferences could not be loaded. Reverting to default.";
    240                                 }
    241                         }
    242225                } catch (IOException e1) {
    243226                        e1.printStackTrace();
     
    258241                } catch (Exception e) {
    259242                        e.printStackTrace();
    260                         JOptionPane.showMessageDialog(null, "The projection could not be initialized. Aborting.");
    261                         System.exit(1);
     243                        JOptionPane.showMessageDialog(null, "The projection could not be read from preferences. Using EPSG:4263.");
     244                        proj = new Epsg4263();
    262245                }
    263246               
  • src/org/openstreetmap/josm/actions/DownloadAction.java

    r74 r75  
    5555public class DownloadAction extends JosmAction {
    5656
    57     private enum DownloadStatus {FINISHED, REDISPLAY}
    58 
    5957    /**
    6058     * minlat, minlon, maxlat, maxlon
     
    7775        public void actionPerformed(ActionEvent e) {
    7876               
    79                 String osmDataServer = Main.pref.get("osmDataServer");
     77                String osmDataServer = Main.pref.get("osm-server.url");
    8078                //TODO: Remove this in later versions (temporary only)
    8179                if (osmDataServer.endsWith("/0.2") || osmDataServer.endsWith("/0.2/")) {
     
    9088                                return;
    9189                        int cutPos = osmDataServer.endsWith("/0.2") ? 4 : 5;
    92                         Main.pref.put("osmDataServer", osmDataServer.substring(0, osmDataServer.length()-cutPos));
     90                        Main.pref.put("osm-server.url", osmDataServer.substring(0, osmDataServer.length()-cutPos));
    9391                        try {
    9492                                Main.pref.save();
     
    244242                        if (r != JOptionPane.OK_OPTION)
    245243                                return;
    246                         if (startDownload() == DownloadStatus.FINISHED)
     244                        if (startDownload())
    247245                                break;
    248246                }
     
    251249        /**
    252250         * Read the values from the edit fields and from the download.
    253          */
    254         private DownloadStatus startDownload() {
     251         * @return <code>true</code> for a success, <code>false</code> redisplay
     252         */
     253        private boolean startDownload() {
    255254                Bookmark b = readBookmark();
    256255                if (b == null) {
    257256                        JOptionPane.showMessageDialog(Main.main, "Please enter the desired coordinates or click on a bookmark.");
    258                         return DownloadStatus.REDISPLAY;
     257                        return false;
    259258                }
    260259
     
    264263                double maxlat = b.latlon[3];
    265264                download(rawGps.isSelected(), minlon, minlat, maxlon, maxlat);
    266                 return DownloadStatus.FINISHED;
     265                return true;
    267266        }
    268267       
  • src/org/openstreetmap/josm/actions/UploadAction.java

    r74 r75  
    4040        public void actionPerformed(ActionEvent e) {
    4141               
    42                 String osmDataServer = Main.pref.get("osmDataServer");
     42                String osmDataServer = Main.pref.get("osm-server.url");
    4343                //TODO: Remove this in later versions (temporary only)
    4444                if (osmDataServer.endsWith("/0.2") || osmDataServer.endsWith("/0.2/")) {
     
    5353                                return;
    5454                        int cutPos = osmDataServer.endsWith("/0.2") ? 4 : 5;
    55                         Main.pref.put("osmDataServer", osmDataServer.substring(0, osmDataServer.length()-cutPos));
     55                        Main.pref.put("osm-server.url", osmDataServer.substring(0, osmDataServer.length()-cutPos));
    5656                        try {
    5757                                Main.pref.save();
  • src/org/openstreetmap/josm/data/Preferences.java

    r74 r75  
    11package org.openstreetmap.josm.data;
    22
     3import java.awt.Color;
     4import java.io.BufferedReader;
    35import java.io.FileReader;
    46import java.io.FileWriter;
     
    68import java.io.PrintWriter;
    79import java.util.ArrayList;
     10import java.util.Collection;
     11import java.util.LinkedList;
    812import java.util.SortedMap;
    913import java.util.TreeMap;
    1014import java.util.Map.Entry;
    1115
    12 import org.openstreetmap.josm.tools.XmlWriter;
    13 import org.xml.sax.Attributes;
    14 import org.xml.sax.SAXException;
    15 
    16 import uk.co.wilson.xml.MinML2;
     16import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor;
     17import org.openstreetmap.josm.tools.ColorHelper;
    1718
    1819
     
    5960                return properties.get(key);
    6061        }
     62        synchronized public String get(String key, String def) {
     63                String prop = properties.get(key);
     64                if (prop == null || prop.equals(""))
     65                        return def;
     66                return prop;
     67        }
     68        synchronized public Collection<Entry<String, String>> getAllPrefix(String prefix) {
     69                LinkedList<Entry<String,String>> all = new LinkedList<Entry<String,String>>();
     70                for (Entry<String,String> e : properties.entrySet())
     71                        if (e.getKey().startsWith(prefix))
     72                                all.add(e);
     73                return all;
     74        }
    6175        synchronized public boolean getBoolean(String key) {
    6276                return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : false;
    6377        }
    64        
    65        
     78
     79
    6680        synchronized public void put(String key, String value) {
    6781                if (value == null)
     
    8397        public void save() throws IOException {
    8498                PrintWriter out = new PrintWriter(new FileWriter(getPreferencesDir()+"preferences"));
    85                 out.println(XmlWriter.header());
    86                 out.println("<josm>");
    87                 for (Entry<String, String> e : properties.entrySet()) {
    88                         out.print("  <"+e.getKey());
     99                for (Entry<String, String> e : properties.entrySet())
    89100                        if (!e.getValue().equals(""))
    90                                 out.print(" value='"+XmlWriter.encode(e.getValue())+"'");
    91                         out.println(" />");
    92                 }
    93                 out.println("</josm>");
     101                                out.println(e.getKey()+"="+e.getValue());
    94102                out.close();
    95103        }
     
    97105
    98106        public void load() throws IOException {
    99                 MinML2 reader = new MinML2(){
    100                         @Override public void startElement(String ns, String name, String qName, Attributes attr) {
    101                                 if (name.equals("josm-settings"))
    102                                         throw new RuntimeException("old version");
    103                                 String v = attr.getValue("value");
    104                                 if (!name.equals("josm"))
    105                                         properties.put(name, v == null ? "" : v);
    106                         }
    107                 };
    108                 try {
    109                         reader.parse(new FileReader(getPreferencesDir()+"preferences"));
    110                 } catch (SAXException e) {
    111                         e.printStackTrace();
    112                         throw new IOException("Error in preferences file");
     107                properties.clear();
     108                BufferedReader in = new BufferedReader(new FileReader(getPreferencesDir()+"preferences"));
     109                int lineNumber = 0;
     110                for (String line = in.readLine(); line != null; line = in.readLine(), lineNumber++) {
     111                        int i = line.indexOf('=');
     112                        if (i == -1 || i == 0)
     113                                throw new IOException("Malformed config file at line "+lineNumber);
     114                        properties.put(line.substring(0,i), line.substring(i+1));
    113115                }
    114116        }
     
    118120                properties.put("laf", "javax.swing.plaf.metal.MetalLookAndFeel");
    119121                properties.put("projection", "org.openstreetmap.josm.data.projection.Epsg4263");
    120                 properties.put("osmDataServer", "http://www.openstreetmap.org/api");
     122                properties.put("osm-server.url", "http://www.openstreetmap.org/api");
     123                properties.put("color.node", ColorHelper.color2html(Color.red));
     124                properties.put("color.segment", ColorHelper.color2html(SimplePaintVisitor.darkgreen));
     125                properties.put("color.way", ColorHelper.color2html(SimplePaintVisitor.darkblue));
     126                properties.put("color.incomplete way", ColorHelper.color2html(SimplePaintVisitor.darkerblue));
     127                properties.put("color.selected", ColorHelper.color2html(Color.white));
     128                properties.put("color.gps point", ColorHelper.color2html(Color.gray));
    121129        }
    122130}
  • src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r71 r75  
    55import java.awt.Point;
    66
     7import org.openstreetmap.josm.Main;
    78import org.openstreetmap.josm.data.osm.LineSegment;
    89import org.openstreetmap.josm.data.osm.Node;
    910import org.openstreetmap.josm.data.osm.Way;
    1011import org.openstreetmap.josm.gui.NavigatableComponent;
     12import org.openstreetmap.josm.tools.ColorHelper;
    1113
    1214/**
     
    1820public class SimplePaintVisitor implements Visitor {
    1921
    20         private final static Color darkerblue = new Color(0,0,96);
    21         private final static Color darkblue = new Color(0,0,128);
    22         private final static Color darkgreen = new Color(0,128,0);
     22        public final static Color darkerblue = new Color(0,0,96);
     23        public final static Color darkblue = new Color(0,0,128);
     24        public final static Color darkgreen = new Color(0,128,0);
    2325
    2426        /**
     
    4850         */
    4951        public void visit(Node n) {
    50                 drawNode(n, n.isSelected() ? Color.WHITE : Color.RED);
     52                drawNode(n, n.isSelected() ? getPreferencesColor("selected", Color.WHITE)
     53                                : getPreferencesColor("node", Color.RED));
    5154        }
    5255
     
    5659         */
    5760        public void visit(LineSegment ls) {
    58                 drawLineSegment(ls, darkgreen);
     61                drawLineSegment(ls, getPreferencesColor("segment", darkgreen));
    5962        }
    6063
     
    6568        public void visit(Way t) {
    6669                // only to overwrite with blue
    67                 Color wayColor = darkblue;
     70                Color wayColor = getPreferencesColor("way", darkblue);
    6871                for (LineSegment ls : t.segments) {
    6972                        if (ls.incomplete) {
    70                                 wayColor = darkerblue;
     73                                wayColor = getPreferencesColor("incomplete way", darkerblue);
    7174                                break;
    7275                        }
     
    7477                for (LineSegment ls : t.segments)
    7578                        if (!ls.isSelected()) // selected already in good color
    76                                 drawLineSegment(ls, t.isSelected() ? Color.WHITE : wayColor);
     79                                drawLineSegment(ls, t.isSelected() ? getPreferencesColor("selected", Color.WHITE) : wayColor);
    7780        }
    7881
     
    9699                        return;
    97100                if (ls.isSelected())
    98                         col = Color.WHITE;
     101                        col = getPreferencesColor("selected", Color.WHITE);
    99102                g.setColor(col);
    100103                Point p1 = nc.getPoint(ls.from.eastNorth);
     
    102105                g.drawLine(p1.x, p1.y, p2.x, p2.y);
    103106        }
     107       
     108        private Color getPreferencesColor(String colName, Color def) {
     109                String colStr = Main.pref.get("color."+colName);
     110                if (colStr.equals(""))
     111                        return def;
     112                return ColorHelper.html2color(colStr);
     113        }
    104114}
  • src/org/openstreetmap/josm/gui/PreferenceDialog.java

    r74 r75  
    11package org.openstreetmap.josm.gui;
    22
     3import java.awt.Color;
    34import java.awt.Component;
    45import java.awt.Dimension;
     
    89import java.awt.event.ActionListener;
    910import java.io.IOException;
     11import java.util.Collection;
     12import java.util.Vector;
     13import java.util.Map.Entry;
    1014
    1115import javax.swing.AbstractAction;
     
    1519import javax.swing.JButton;
    1620import javax.swing.JCheckBox;
     21import javax.swing.JColorChooser;
    1722import javax.swing.JComboBox;
    1823import javax.swing.JDialog;
     
    2227import javax.swing.JPanel;
    2328import javax.swing.JPasswordField;
     29import javax.swing.JScrollPane;
    2430import javax.swing.JTabbedPane;
     31import javax.swing.JTable;
    2532import javax.swing.JTextField;
    2633import javax.swing.ListCellRenderer;
     34import javax.swing.ListSelectionModel;
    2735import javax.swing.UIManager;
    2836import javax.swing.UIManager.LookAndFeelInfo;
     37import javax.swing.table.TableCellRenderer;
    2938
    3039import org.openstreetmap.josm.Main;
    3140import org.openstreetmap.josm.data.projection.Projection;
     41import org.openstreetmap.josm.tools.ColorHelper;
    3242import org.openstreetmap.josm.tools.GBC;
    3343import org.openstreetmap.josm.tools.ImageProvider;
     
    5262                        Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName());
    5363                        Main.pref.put("projection", projectionCombo.getSelectedItem().getClass().getName());
    54                         Main.pref.put("osmDataServer", osmDataServer.getText());
    55                         Main.pref.put("osmDataUsername", osmDataUsername.getText());
     64                        Main.pref.put("osm-server.url", osmDataServer.getText());
     65                        Main.pref.put("osm-server.username", osmDataUsername.getText());
    5666                        String pwd = String.valueOf(osmDataPassword.getPassword());
    5767                        if (pwd.equals(""))
    5868                                pwd = null;
    59                         Main.pref.put("osmDataPassword", pwd);
     69                        Main.pref.put("osm-server.password", pwd);
    6070                        Main.pref.put("csvImportString", csvImportString.getText());
    6171                        Main.pref.put("drawRawGpsLines", drawRawGpsLines.isSelected());
    6272                        Main.pref.put("forceRawGpsLines", forceRawGpsLines.isSelected());
     73
     74                        for (int i = 0; i < colors.getRowCount(); ++i) {
     75                                String name = (String)colors.getValueAt(i, 0);
     76                                Color col = (Color)colors.getValueAt(i, 1);
     77                                Main.pref.put("color."+name, ColorHelper.color2html(col));
     78                        }
     79
    6380                        try {
    6481                                Main.pref.save();
     
    6986                        if (requiresRestart)
    7087                                JOptionPane.showMessageDialog(PreferenceDialog.this, "You have to restart JOSM for some settings to take effect.");
     88                        Main.main.repaint();
    7189                        setVisible(false);
    7290                }
     
    130148        JCheckBox forceRawGpsLines = new JCheckBox("Force lines if no line segments imported.");
    131149
     150        JTable colors;
     151       
     152       
    132153        /**
    133154         * Create a preference setting dialog from an preferences-file. If the file does not
     
    140161
    141162                // look and feel combo box
    142                 lafCombo.setSelectedItem(Main.pref.get("laf"));
     163                String laf = Main.pref.get("laf");
     164                for (int i = 0; i < lafCombo.getItemCount(); ++i) {
     165                        if (((LookAndFeelInfo)lafCombo.getItemAt(i)).getClassName().equals(laf)) {
     166                                lafCombo.setSelectedIndex(i);
     167                                break;
     168                        }
     169                }
    143170                final ListCellRenderer oldRenderer = lafCombo.getRenderer();
    144171                lafCombo.setRenderer(new DefaultListCellRenderer(){
     
    175202                });
    176203
    177                
     204                osmDataServer.setText(Main.pref.get("osm-server.url"));
     205                osmDataUsername.setText(Main.pref.get("osm-server.username"));
     206                osmDataPassword.setText(Main.pref.get("osm-server.password"));
     207                csvImportString.setText(Main.pref.get("csvImportString"));
     208                drawRawGpsLines.setSelected(Main.pref.getBoolean("drawRawGpsLines"));
     209                forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information.");
     210                forceRawGpsLines.setSelected(Main.pref.getBoolean("forceRawGpsLines"));
     211                forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected());
     212
     213               
     214                Collection<Entry<String,String>> c = Main.pref.getAllPrefix("color.");
     215                Vector<Vector<Object>> rows = new Vector<Vector<Object>>();
     216                for (Entry<String,String> e : c) {
     217                        Vector<Object> row = new Vector<Object>(2);
     218                        row.add(e.getKey().substring("color.".length()));
     219                        row.add(ColorHelper.html2color(e.getValue()));
     220                        rows.add(row);
     221                }
     222                Vector<Object> cols = new Vector<Object>(2);
     223                cols.add("Color");
     224                cols.add("Name");
     225                colors = new JTable(rows, cols){
     226                        @Override public boolean isCellEditable(int row, int column) {
     227                                return false;
     228                        }
     229                };
     230                colors.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     231                JButton colorEdit = new JButton("Choose");
     232                colorEdit.addActionListener(new ActionListener(){
     233                        public void actionPerformed(ActionEvent e) {
     234                                if (colors.getSelectedRowCount() == 0) {
     235                                        JOptionPane.showMessageDialog(PreferenceDialog.this, "Please select a color.");
     236                                        return;
     237                                }
     238                                int sel = colors.getSelectedRow();
     239                                JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1));
     240                                int answer = JOptionPane.showConfirmDialog(PreferenceDialog.this, chooser, "Choose a color for "+colors.getValueAt(sel, 0), JOptionPane.OK_CANCEL_OPTION);
     241                                if (answer == JOptionPane.OK_OPTION)
     242                                        colors.setValueAt(chooser.getColor(), sel, 1);
     243                        }
     244                });
     245                final TableCellRenderer oldColorsRenderer = colors.getDefaultRenderer(Object.class);
     246                colors.setDefaultRenderer(Object.class, new TableCellRenderer(){
     247                        public Component getTableCellRendererComponent(JTable t, Object o, boolean selected, boolean focus, int row, int column) {
     248                                if (column == 1) {
     249                                        JLabel l = new JLabel(ColorHelper.color2html((Color)o));
     250                                        l.setBackground((Color)o);
     251                                        l.setOpaque(true);
     252                                        return l;
     253                                }
     254                                return oldColorsRenderer.getTableCellRendererComponent(t,o,selected,focus,row,column);
     255                        }
     256                });
     257                colors.getColumnModel().getColumn(1).setWidth(100);
     258
     259                // setting tooltips
    178260                osmDataServer.setToolTipText("The base URL to the OSM server (REST API)");
    179261                osmDataUsername.setToolTipText("Login name (email) to the OSM account.");
     
    186268                                "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>");
    187269                drawRawGpsLines.setToolTipText("If your gps device draw to few lines, select this to draw lines along your way.");
    188                 drawRawGpsLines.setSelected(Main.pref.getBoolean("drawRawGpsLines"));
    189                 forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information.");
    190                 forceRawGpsLines.setSelected(Main.pref.getBoolean("forceRawGpsLines"));
    191                 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected());
    192 
    193                 osmDataServer.setText(Main.pref.get("osmDataServer"));
    194                 osmDataUsername.setText(Main.pref.get("osmDataUsername"));
    195                 osmDataPassword.setText(Main.pref.get("osmDataPassword"));
    196                 csvImportString.setText(Main.pref.get("csvImportString"));
    197 
     270                colors.setToolTipText("Colors used by different objects in JOSM.");
     271               
     272                // creating the gui
     273               
    198274                // Display tab
    199275                JPanel display = createPreferenceTab("display", "Display Settings", "Various settings that influence the visual representation of the whole program.");
     
    202278                display.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL));
    203279                display.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0));
    204                 display.add(forceRawGpsLines, GBC.eol().insets(40,0,0,0));
    205                 display.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
     280                display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0));
     281                display.add(new JLabel("Colors"), GBC.eol());
     282                colors.setPreferredScrollableViewportSize(new Dimension(100,112));
     283                display.add(new JScrollPane(colors), GBC.eol().fill(GBC.BOTH));
     284                display.add(colorEdit, GBC.eol().anchor(GBC.EAST));
     285                //display.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
    206286
    207287                // Connection tab
     
    221301                con.add(new JLabel("CSV import specification (empty: read from first line in data)"), GBC.eol());
    222302                con.add(csvImportString, GBC.eop().fill(GBC.HORIZONTAL));
     303                con.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
    223304               
    224305                // Map tab
  • src/org/openstreetmap/josm/gui/dialogs/LayerList.java

    r71 r75  
    3030import org.openstreetmap.josm.gui.layer.Layer;
    3131import org.openstreetmap.josm.tools.ImageProvider;
     32import org.openstreetmap.josm.tools.ImageProvider.OverlayPosition;
    3233
    3334/**
     
    8687                                Icon icon = layer.getIcon();
    8788                                if (!layer.visible)
    88                                         icon = ImageProvider.overlay(icon, invisible, ImageProvider.OverlayPosition.SOUTHEAST);
     89                                        icon = ImageProvider.overlay(icon, invisible, OverlayPosition.SOUTHEAST);
    8990                                label.setIcon(icon);
    9091                                label.setToolTipText(layer.getToolTipText());
  • src/org/openstreetmap/josm/gui/layer/RawGpsDataLayer.java

    r74 r75  
    1616import org.openstreetmap.josm.data.projection.Projection;
    1717import org.openstreetmap.josm.gui.MapView;
     18import org.openstreetmap.josm.tools.ColorHelper;
    1819import org.openstreetmap.josm.tools.ImageProvider;
    1920
     
    6263        @Override
    6364        public void paint(Graphics g, MapView mv) {
    64                 g.setColor(Color.GRAY);
     65                String gpsCol = Main.pref.get("color.gps point");
     66                if (gpsCol.equals(""))
     67                        g.setColor(Color.GRAY);
     68                else
     69                        g.setColor(ColorHelper.html2color(gpsCol));
    6570                Point old = null;
    6671                for (Collection<EastNorth> c : eastNorth) {
  • src/org/openstreetmap/josm/io/OsmConnection.java

    r74 r75  
    3939                @Override
    4040                protected PasswordAuthentication getPasswordAuthentication() {
    41                         String username = Main.pref.get("osmDataUsername");
    42                         String password = Main.pref.get("osmDataPassword");
     41                        String username = Main.pref.get("osm-server.username");
     42                        String password = Main.pref.get("osm-server.password");
    4343                        if (passwordtried || username.equals("") || password.equals("")) {
    4444                                JPanel p = new JPanel(new GridBagLayout());
  • src/org/openstreetmap/josm/io/OsmServerReader.java

    r74 r75  
    4848         */
    4949        public Collection<Collection<LatLon>> parseRawGps() throws IOException, JDOMException {
    50                 String url = Main.pref.get("osmDataServer")+"/0.3/trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page=";
     50                String url = Main.pref.get("osm-server.url")+"/0.3/trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page=";
    5151                Collection<Collection<LatLon>> data = new LinkedList<Collection<LatLon>>();
    5252                Collection<LatLon> list = new LinkedList<LatLon>();
     
    8080         */
    8181        public DataSet parseOsm() throws SAXException, IOException {
    82                 Reader r = getReader(Main.pref.get("osmDataServer")+"/0.3/map?bbox="+lon1+","+lat1+","+lon2+","+lat2);
     82                Reader r = getReader(Main.pref.get("osm-server.url")+"/0.3/map?bbox="+lon1+","+lat1+","+lon2+","+lat2);
    8383                if (r == null)
    8484                        return null;
  • src/org/openstreetmap/josm/io/OsmServerWriter.java

    r74 r75  
    136136                        OsmPrimitive osm, boolean addBody) {
    137137                try {
    138                         URL url = new URL(Main.pref.get("osmDataServer") + "/0.3/" + urlSuffix + "/" + osm.id);
     138                        URL url = new URL(Main.pref.get("osm-server.url") + "/0.3/" + urlSuffix + "/" + osm.id);
    139139                        System.out.println("upload to: "+url);
    140140                        HttpURLConnection con = (HttpURLConnection) url.openConnection();
  • src/org/openstreetmap/josm/tools/ImageProvider.java

    r71 r75  
    2525         * @author imi
    2626         */
    27         public enum OverlayPosition {NORTHWEST, NORTHEAST, SOUTHWEST, SOUTHEAST}
     27        public final static class OverlayPosition {
     28                private OverlayPosition() {}
     29                public static OverlayPosition NORTHWEST = new OverlayPosition();
     30                public static OverlayPosition NORTHEAST = new OverlayPosition();
     31                public static OverlayPosition SOUTHWEST = new OverlayPosition();
     32                public static OverlayPosition SOUTHEAST = new OverlayPosition();
     33        }
     34       
    2835       
    2936        /**
     
    7885                ground.paintIcon(null, g, 0, 0);
    7986                int x = 0, y = 0;
    80                 switch (pos) {
    81                 case NORTHWEST: x = 0;          y = 0;          break;
    82                 case NORTHEAST: x = w-wo;       y = 0;          break;
    83                 case SOUTHWEST: x = 0;          y = h-ho;       break;
    84                 case SOUTHEAST: x = w-wo;       y = h-ho;       break;
     87                if (pos == OverlayPosition.NORTHWEST) {
     88                        x = 0;
     89                        y = 0;
     90                } else if (pos == OverlayPosition.NORTHEAST) {
     91                        x = w-wo;
     92                        y = 0;
     93                } else if (pos == OverlayPosition.SOUTHWEST) {
     94                        x = 0;
     95                        y = h-ho;
     96                } else if (pos == OverlayPosition.SOUTHEAST) {
     97                        x = w-wo;
     98                        y = h-ho;
    8599                }
    86100                overlay.paintIcon(null, g, x, y);
Note: See TracChangeset for help on using the changeset viewer.