Changeset 10806 in josm for trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
- Timestamp:
- 2016-08-15T14:57:06+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r10788 r10806 13 13 import java.awt.GraphicsEnvironment; 14 14 import java.awt.GridBagLayout; 15 import java.awt.Point;16 15 import java.awt.Rectangle; 17 16 import java.awt.TexturePaint; 18 17 import java.awt.event.ActionEvent; 19 18 import java.awt.geom.Area; 19 import java.awt.geom.Rectangle2D; 20 20 import java.awt.image.BufferedImage; 21 21 import java.io.File; … … 52 52 import org.openstreetmap.josm.data.conflict.Conflict; 53 53 import org.openstreetmap.josm.data.conflict.ConflictCollection; 54 import org.openstreetmap.josm.data.coor.EastNorth; 54 55 import org.openstreetmap.josm.data.coor.LatLon; 55 56 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 82 83 import org.openstreetmap.josm.gui.ExtendedDialog; 83 84 import org.openstreetmap.josm.gui.MapView; 85 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 84 86 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 85 87 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; … … 111 113 */ 112 114 public class OsmDataLayer extends AbstractModifiableLayer implements Listener, SelectionChangedListener { 115 private static final int HATCHED_SIZE = 15; 113 116 /** Property used to know if this layer has to be saved on disk */ 114 117 public static final String REQUIRES_SAVE_TO_DISK_PROP = OsmDataLayer.class.getName() + ".requiresSaveToDisk"; … … 304 307 305 308 /** 306 * a painttexture for non-downloaded area307 */ 308 private static volatile TexturePainthatched;309 * a texture for non-downloaded area 310 */ 311 private static volatile BufferedImage hatched; 309 312 310 313 static { … … 332 335 */ 333 336 public static void createHatchTexture() { 334 BufferedImage bi = new BufferedImage( 15, 15, BufferedImage.TYPE_INT_ARGB);337 BufferedImage bi = new BufferedImage(HATCHED_SIZE, HATCHED_SIZE, BufferedImage.TYPE_INT_ARGB); 335 338 Graphics2D big = bi.createGraphics(); 336 339 big.setColor(getBackgroundColor()); 337 340 Composite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); 338 341 big.setComposite(comp); 339 big.fillRect(0, 0, 15, 15);342 big.fillRect(0, 0, HATCHED_SIZE, HATCHED_SIZE); 340 343 big.setColor(getOutsideColor()); 341 344 big.drawLine(-1, 6, 6, -1); 342 345 big.drawLine(4, 16, 16, 4); 343 Rectangle r = new Rectangle(0, 0, 15, 15); 344 hatched = new TexturePaint(bi, r); 346 hatched = bi; 345 347 } 346 348 … … 408 410 continue; 409 411 } 410 Point p1 = mv.getPoint(bounds.getMin()); 411 Point p2 = mv.getPoint(bounds.getMax()); 412 Rectangle r = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), Math.abs(p2.x-p1.x), Math.abs(p2.y-p1.y)); 413 a.subtract(new Area(r)); 412 a.subtract(mv.getState().getArea(bounds)); 414 413 } 415 414 416 415 // paint remainder 417 g.setPaint(hatched); 416 MapViewPoint anchor = mv.getState().getPointFor(new EastNorth(0, 0)); 417 Rectangle2D anchorRect = new Rectangle2D.Double(anchor.getInView().getX() % HATCHED_SIZE, 418 anchor.getInView().getY() % HATCHED_SIZE, HATCHED_SIZE, HATCHED_SIZE); 419 g.setPaint(new TexturePaint(hatched, anchorRect)); 418 420 g.fill(a); 419 421 }
Note:
See TracChangeset
for help on using the changeset viewer.