Changeset 3808 in josm
- Timestamp:
- 2011-01-23T17:13:30+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java
r3747 r3808 88 88 g.setFont(tempFont); 89 89 g.setColor(Color.BLACK); 90 g.drawString(tr("Not in cache"), 10, img.getHeight()/2); 90 String text = tr("Not in cache"); 91 g.drawString(text, (img.getWidth() - g.getFontMetrics().stringWidth(text)) / 2, img.getHeight()/2); 91 92 g.setFont(font); 92 93 this.image = img; … … 100 101 101 102 private BufferedImage createImage() { 102 return new BufferedImage(layer.get BaseImageWidth(), layer.getBaseImageHeight(), BufferedImage.TYPE_INT_RGB);103 return new BufferedImage(layer.getImageSize(), layer.getImageSize(), BufferedImage.TYPE_INT_RGB); 103 104 } 104 105 -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r3737 r3808 201 201 g.setFont(g.getFont().deriveFont(Font.PLAIN).deriveFont(36.0f)); 202 202 g.setColor(Color.BLACK); 203 g.drawString(tr("ERROR"), 30, img.getHeight()/2); 203 204 String text = tr("ERROR"); 205 g.drawString(text, (img.getWidth() + g.getFontMetrics().stringWidth(text)) / 2, img.getHeight()/2); 204 206 } 205 207 } -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r3749 r3808 8 8 import java.awt.Graphics2D; 9 9 import java.awt.event.ActionEvent; 10 import java.awt.image.BufferedImage; 10 11 import java.io.File; 11 12 import java.io.FileInputStream; … … 275 276 276 277 public int getImageWidth(int xIndex) { 277 int overlap = (int)(PROP_OVERLAP.get()?PROP_OVERLAP_EAST.get() * imageSize * getPPD() / info.getPixelPerDegree() / 100:0); 278 return getImageX(xIndex + 1) - getImageX(xIndex) + overlap; 278 return getImageX(xIndex + 1) - getImageX(xIndex); 279 279 } 280 280 281 281 public int getImageHeight(int yIndex) { 282 int overlap = (int)(PROP_OVERLAP.get()?PROP_OVERLAP_NORTH.get() * imageSize * getPPD() / info.getPixelPerDegree() / 100:0); 283 return getImageY(yIndex + 1) - getImageY(yIndex) + overlap; 282 return getImageY(yIndex + 1) - getImageY(yIndex); 284 283 } 285 284 … … 300 299 int overlap = (PROP_OVERLAP.get()?PROP_OVERLAP_NORTH.get() * imageSize / 100:0); 301 300 return imageSize + overlap; 301 } 302 303 public int getImageSize() { 304 return imageSize; 305 } 306 307 /** 308 * 309 * @return When overlapping is enabled, return visible part of tile. Otherwise return original image 310 */ 311 public BufferedImage normalizeImage(BufferedImage img) { 312 if (WMSLayer.PROP_OVERLAP.get() && (WMSLayer.PROP_OVERLAP_EAST.get() > 0 || WMSLayer.PROP_OVERLAP_NORTH.get() > 0)) { 313 BufferedImage copy = img; 314 img = new BufferedImage(imageSize, imageSize, copy.getType()); 315 img.createGraphics().drawImage(copy, 0, 0, imageSize, imageSize, 316 0, copy.getHeight() - imageSize, imageSize, copy.getHeight(), null); 317 } 318 return img; 302 319 } 303 320 -
trunk/src/org/openstreetmap/josm/io/imagery/HTMLGrabber.java
r3747 r3808 43 43 } 44 44 45 BufferedImage img = ImageIO.read(browser.getInputStream());45 BufferedImage img = layer.normalizeImage(ImageIO.read(browser.getInputStream())); 46 46 cache.saveImg(urlstring, img); 47 47 return img; -
trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
r3747 r3808 181 181 182 182 InputStream is = new ProgressInputStream(conn, null); 183 BufferedImage img = ImageIO.read(is);183 BufferedImage img = layer.normalizeImage(ImageIO.read(is)); 184 184 is.close(); 185 185
Note:
See TracChangeset
for help on using the changeset viewer.