Ignore:
Timestamp:
2009-07-22T20:33:41+02:00 (15 years ago)
Author:
stoecker
Message:

some projection and zoom cleanups - projection classes still need better handling of outside-world coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r1820 r1823  
    1313import java.awt.event.MouseEvent;
    1414import java.awt.event.MouseMotionListener;
     15import java.awt.geom.GeneralPath;
    1516import java.awt.image.BufferedImage;
    1617import java.util.ArrayList;
     
    2930import org.openstreetmap.josm.actions.MoveAction;
    3031import org.openstreetmap.josm.actions.mapmode.MapMode;
     32import org.openstreetmap.josm.data.Bounds;
    3133import org.openstreetmap.josm.data.ProjectionBounds;
    3234import org.openstreetmap.josm.data.SelectionChangedListener;
     
    3537import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3638import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     39import org.openstreetmap.josm.data.coor.LatLon;
    3740import org.openstreetmap.josm.gui.layer.Layer;
    3841import org.openstreetmap.josm.gui.layer.MapViewPaintable;
     
    295298        // draw world borders
    296299        tempG.setColor(Color.WHITE);
    297         ProjectionBounds b = getProjection().getWorldBounds();
    298         Point min = getPoint(b.min);
    299         Point max = getPoint(b.max);
    300         int x1 = Math.min(min.x, max.x);
    301         int y1 = Math.min(min.y, max.y);
    302         int x2 = Math.max(min.x, max.x);
    303         int y2 = Math.max(min.y, max.y);
    304         if (x1 > 0 || y1 > 0 || x2 < getWidth() || y2 < getHeight()) {
    305             tempG.drawRect(x1, y1, x2-x1+1, y2-y1+1);
     300        GeneralPath path = new GeneralPath();
     301        Bounds b = getProjection().getWorldBoundsLatLon();
     302        double lat = b.min.lat();
     303        double lon = b.min.lon();
     304
     305        Point p = getPoint(b.min);
     306        path.moveTo(p.x, p.y);
     307
     308        double max = b.max.lat();
     309        for(; lat <= max; lat += 1.0)
     310        {
     311            p = getPoint(new LatLon(lat >= max ? max : lat, lon));
     312            path.lineTo(p.x, p.y);
     313        }
     314        lat = max; max = b.max.lon();
     315        for(; lon <= max; lon += 1.0)
     316        {
     317            p = getPoint(new LatLon(lat, lon >= max ? max : lon));
     318            path.lineTo(p.x, p.y);
     319        }
     320        lon = max; max = b.min.lat();
     321        for(; lat >= max; lat -= 1.0)
     322        {
     323            p = getPoint(new LatLon(lat <= max ? max : lat, lon));
     324            path.lineTo(p.x, p.y);
     325        }
     326        lat = max; max = b.min.lon();
     327        for(; lon >= max; lon -= 1.0)
     328        {
     329            p = getPoint(new LatLon(lat, lon <= max ? max : lon));
     330            path.lineTo(p.x, p.y);
    306331        }
    307332
     
    309334            playHeadMarker.paint(tempG, this);
    310335        }
     336        tempG.draw(path);
    311337
    312338        g.drawImage(offscreenBuffer, 0, 0, null);
     
    322348        }
    323349        if (box.getBounds() == null) {
    324             box.visit(getProjection().getWorldBounds());
     350            box.visit(getProjection().getWorldBoundsLatLon());
    325351        }
    326352        if (!box.hasExtend()) {
Note: See TracChangeset for help on using the changeset viewer.