Changeset 73 in josm for src


Ignore:
Timestamp:
2006-03-28T17:45:45+02:00 (18 years ago)
Author:
imi
Message:

fixed bug where lat/lon was exchanged in download dialog and quick fix for Java6 - gui problem

Location:
src/org/openstreetmap/josm
Files:
14 edited

Legend:

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

    r71 r73  
    3535import org.openstreetmap.josm.data.Preferences.PreferencesException;
    3636import org.openstreetmap.josm.data.osm.DataSet;
     37import org.openstreetmap.josm.data.projection.Projection;
    3738import org.openstreetmap.josm.gui.MapFrame;
    3839import org.openstreetmap.josm.gui.ShowModifiers;
     
    5354         */
    5455        public static Main main;
     56
     57        public static Projection proj;
    5558
    5659        /**
     
    183186                });
    184187                setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
     188               
     189                proj = pref.getProjection();
    185190        }
    186191
  • src/org/openstreetmap/josm/actions/DownloadAction.java

    r71 r73  
    5858    private enum DownloadStatus {FINISHED, REDISPLAY}
    5959
     60    /**
     61     * minlat, minlon, maxlat, maxlon
     62     */
    6063        JTextField[] latlon = new JTextField[]{
    6164                        new JTextField(9),
     
    6871                super("Download from OSM", "download", "Download map data from the OSM server.", "Ctrl-Shift-D",
    6972                                KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
     73                // TODO remove when bug in Java6 is fixed
     74                for (JTextField f : latlon)
     75                        f.setMinimumSize(new Dimension(100,new JTextField().getMinimumSize().height));
    7076        }
    7177
  • src/org/openstreetmap/josm/command/MoveCommand.java

    r71 r73  
    7878                for (Node n : objects) {
    7979                        n.eastNorth = new EastNorth(n.eastNorth.east()+x, n.eastNorth.north()+y);
    80                         n.coor = Main.pref.getProjection().eastNorth2latlon(n.eastNorth);
     80                        n.coor = Main.proj.eastNorth2latlon(n.eastNorth);
    8181                }
    8282                this.x += x;
     
    8787                for (Node n : objects) {
    8888                        n.eastNorth = new EastNorth(n.eastNorth.east()+x, n.eastNorth.north()+y);
    89                         n.coor = Main.pref.getProjection().eastNorth2latlon(n.eastNorth);
     89                        n.coor = Main.proj.eastNorth2latlon(n.eastNorth);
    9090                        n.modified = true;
    9191                }
  • src/org/openstreetmap/josm/data/Bounds.java

    r71 r73  
    3434                max = new LatLon(Projection.MAX_LAT, Projection.MAX_LON);
    3535        }
     36       
     37        @Override
     38        public String toString() {
     39                return "Bounds["+min.lat()+","+min.lon()+","+max.lat()+","+max.lon()+"]";
     40        }
    3641}
  • src/org/openstreetmap/josm/data/osm/Node.java

    r71 r73  
    1919        public Node(LatLon latlon) {
    2020                this.coor = latlon;
    21                 eastNorth = Main.pref.getProjection().latlon2eastNorth(latlon);
     21                eastNorth = Main.proj.latlon2eastNorth(latlon);
    2222        }
    2323
  • src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r71 r73  
    5353                if (min == null || max == null)
    5454                        return null;
    55                 return new Bounds(Main.pref.getProjection().eastNorth2latlon(min), Main.pref.getProjection().eastNorth2latlon(max));
     55                return new Bounds(Main.proj.eastNorth2latlon(min), Main.proj.eastNorth2latlon(max));
    5656        }
    5757}
  • src/org/openstreetmap/josm/data/projection/Mercator.java

    r71 r73  
    2323        public LatLon eastNorth2latlon(EastNorth p) {
    2424                return new LatLon(
    25                         p.east()*180/Math.PI,
    26                         Math.atan(Math.sinh(p.north()))*180/Math.PI);
     25                        Math.atan(Math.sinh(p.north()))*180/Math.PI,
     26                        p.east()*180/Math.PI);
    2727        }
    2828
  • src/org/openstreetmap/josm/gui/BookmarkList.java

    r71 r73  
    3232        public static class Bookmark {
    3333                public String name;
    34                 public double[] latlon = new double[4];
     34                public double[] latlon = new double[4]; // minlat, minlon, maxlat, maxlon
    3535                public boolean rawgps;
    3636                @Override public String toString() {
  • src/org/openstreetmap/josm/gui/MapView.java

    r71 r73  
    1919import org.openstreetmap.josm.data.Bounds;
    2020import org.openstreetmap.josm.data.coor.EastNorth;
     21import org.openstreetmap.josm.data.coor.LatLon;
    2122import org.openstreetmap.josm.data.osm.DataSet;
    2223import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    228229                        if (v.min == null || v.max == null) {
    229230                                // no bounds means standard scale and center
    230                                 center = new EastNorth(51.526447, -0.14746371);
     231                                center = Main.proj.latlon2eastNorth(new LatLon(51.526447, -0.14746371));
    231232                                scale = 10;
    232233                        } else {
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r72 r73  
    248248         */
    249249        protected Projection getProjection() {
    250                 return Main.pref.getProjection();
     250                return Main.proj;
    251251        }
    252252}
  • src/org/openstreetmap/josm/gui/PreferenceDialog.java

    r71 r73  
    9090         * Indicate, that the application has to be restarted for the settings to take effect.
    9191         */
    92         boolean requiresRestart = false;
     92        private boolean requiresRestart = false;
    9393        /**
    9494         * ComboBox with all look and feels.
     
    149149                lafCombo.addActionListener(new ActionListener(){
    150150                        public void actionPerformed(ActionEvent e) {
    151                                 setRequiresRestart();
     151                                requiresRestart = true;
    152152                        }});
    153153
     
    159159                        }
    160160                }
     161                projectionCombo.addActionListener(new ActionListener(){
     162                        public void actionPerformed(ActionEvent e) {
     163                                requiresRestart = true;
     164                        }
     165                });
    161166               
    162167                // drawRawGpsLines
     
    265270                return p;
    266271        }
    267        
    268         /**
    269          * Remember, that the settings made requires a restart of the application.
    270          * Called from various actionListener - classes
    271          */
    272         protected void setRequiresRestart() {
    273                 requiresRestart = true;
    274         }
    275272}
  • src/org/openstreetmap/josm/gui/WorldChooser.java

    r71 r73  
    6969                        public LatLon eastNorth2latlon(EastNorth p) {
    7070                                return new LatLon(
    71                                                 p.east()*360/world.getIconWidth() - 180,
    72                                                 p.north()*180/world.getIconHeight() - 90);
     71                                                p.north()*180/world.getIconHeight() - 90,
     72                                                p.east()*360/world.getIconWidth() - 180);
    7373                        }
    7474                        @Override
     
    7777                        }
    7878                };
     79                setMinimumSize(new Dimension(350, 350/2));
    7980        }
    8081
     
    120121        @Override
    121122        public void zoomTo(EastNorth newCenter, double scale) {
    122                 if (getWidth() != 0 && scale > scaleMax)
     123                if (getWidth() != 0 && scale > scaleMax) {
    123124                        scale = scaleMax;
     125                        newCenter = center;
     126                }
    124127                super.zoomTo(newCenter, scale);
    125128        }
     
    202205                        }
    203206                }
    204                 markerMin = new EastNorth(v[0], v[1]);
    205                 markerMax = new EastNorth(v[2], v[3]);
     207                markerMin = getProjection().latlon2eastNorth(new LatLon(v[0], v[1]));
     208                markerMax = getProjection().latlon2eastNorth(new LatLon(v[2], v[3]));
    206209                repaint();
    207210        }
  • src/org/openstreetmap/josm/gui/layer/RawGpsDataLayer.java

    r71 r73  
    112112                        Collection<EastNorth> eastNorthList = new LinkedList<EastNorth>();
    113113                        for (LatLon ll : c)
    114                                 eastNorthList.add(Main.pref.getProjection().latlon2eastNorth(ll));
     114                                eastNorthList.add(Main.proj.latlon2eastNorth(ll));
    115115                        this.eastNorth.add(eastNorthList);
    116116                }
  • src/org/openstreetmap/josm/io/OsmServerReader.java

    r71 r73  
    101101                HttpURLConnection con = (HttpURLConnection)url.openConnection();
    102102                con.setConnectTimeout(20000);
    103                 System.out.println("response: "+con.getResponseCode());
    104103                if (con.getResponseCode() == 401 && isCancelled())
    105104                        return null;
Note: See TracChangeset for help on using the changeset viewer.