Changeset 10586 in josm for trunk/src/org/openstreetmap/josm/gui/MapView.java
- Timestamp:
- 2016-07-22T22:30:54+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r10496 r10586 920 920 synchronized (temporaryLayers) { 921 921 for (MapViewPaintable mvp : temporaryLayers) { 922 mvp.paint(tempG, this, box); 922 try { 923 mvp.paint(tempG, this, box); 924 } catch (RuntimeException e) { 925 throw BugReport.intercept(e).put("mvp", mvp); 926 } 923 927 } 924 928 } 925 929 926 930 // draw world borders 927 tempG.setColor(Color.WHITE); 928 Bounds b = getProjection().getWorldBoundsLatLon(); 929 double lat = b.getMinLat(); 930 double lon = b.getMinLon(); 931 932 Point p = getPoint(b.getMin()); 933 934 GeneralPath path = new GeneralPath(); 935 936 double d = 1.0; 937 path.moveTo(p.x, p.y); 938 double max = b.getMax().lat(); 939 for (; lat <= max; lat += d) { 940 p = getPoint(new LatLon(lat >= max ? max : lat, lon)); 941 path.lineTo(p.x, p.y); 942 } 943 lat = max; max = b.getMax().lon(); 944 for (; lon <= max; lon += d) { 945 p = getPoint(new LatLon(lat, lon >= max ? max : lon)); 946 path.lineTo(p.x, p.y); 947 } 948 lon = max; max = b.getMinLat(); 949 for (; lat >= max; lat -= d) { 950 p = getPoint(new LatLon(lat <= max ? max : lat, lon)); 951 path.lineTo(p.x, p.y); 952 } 953 lat = max; max = b.getMinLon(); 954 for (; lon >= max; lon -= d) { 955 p = getPoint(new LatLon(lat, lon <= max ? max : lon)); 956 path.lineTo(p.x, p.y); 957 } 958 959 int w = getWidth(); 960 int h = getHeight(); 961 962 // Work around OpenJDK having problems when drawing out of bounds 963 final Area border = new Area(path); 964 // Make the viewport 1px larger in every direction to prevent an 965 // additional 1px border when zooming in 966 final Area viewport = new Area(new Rectangle(-1, -1, w + 2, h + 2)); 967 border.intersect(viewport); 968 tempG.draw(border); 931 try { 932 drawWorldBorders(tempG); 933 } catch (RuntimeException e) { 934 throw BugReport.intercept(e).put("bounds", () -> getProjection().getWorldBoundsLatLon()); 935 } 969 936 970 937 if (Main.isDisplayingMapView() && Main.map.filterDialog != null) { … … 1007 974 } 1008 975 976 private void drawWorldBorders(Graphics2D tempG) { 977 tempG.setColor(Color.WHITE); 978 Bounds b = getProjection().getWorldBoundsLatLon(); 979 double lat = b.getMinLat(); 980 double lon = b.getMinLon(); 981 982 Point p = getPoint(b.getMin()); 983 984 GeneralPath path = new GeneralPath(); 985 986 double d = 1.0; 987 path.moveTo(p.x, p.y); 988 double max = b.getMax().lat(); 989 for (; lat <= max; lat += d) { 990 p = getPoint(new LatLon(lat >= max ? max : lat, lon)); 991 path.lineTo(p.x, p.y); 992 } 993 lat = max; max = b.getMax().lon(); 994 for (; lon <= max; lon += d) { 995 p = getPoint(new LatLon(lat, lon >= max ? max : lon)); 996 path.lineTo(p.x, p.y); 997 } 998 lon = max; max = b.getMinLat(); 999 for (; lat >= max; lat -= d) { 1000 p = getPoint(new LatLon(lat <= max ? max : lat, lon)); 1001 path.lineTo(p.x, p.y); 1002 } 1003 lat = max; max = b.getMinLon(); 1004 for (; lon >= max; lon -= d) { 1005 p = getPoint(new LatLon(lat, lon <= max ? max : lon)); 1006 path.lineTo(p.x, p.y); 1007 } 1008 1009 int w = getWidth(); 1010 int h = getHeight(); 1011 1012 // Work around OpenJDK having problems when drawing out of bounds 1013 final Area border = new Area(path); 1014 // Make the viewport 1px larger in every direction to prevent an 1015 // additional 1px border when zooming in 1016 final Area viewport = new Area(new Rectangle(-1, -1, w + 2, h + 2)); 1017 border.intersect(viewport); 1018 tempG.draw(border); 1019 } 1020 1009 1021 /** 1010 1022 * Sets up the viewport to prepare for drawing the view.
Note:
See TracChangeset
for help on using the changeset viewer.