Changeset 2662 in josm for trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
- Timestamp:
- 2009-12-19T18:56:45+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r2646 r2662 79 79 private int currentPhoto = -1; 80 80 81 // These are used by the auto-guess function to store the result,82 // so when the dialig is re-opened the users modifications don't83 // get overwritten84 public boolean hasTimeoffset = false;85 public long timeoffset = 0;86 87 81 boolean useThumbs = false; 88 82 ThumbsLoader thumbsloader; 83 boolean thumbsLoaded = false; 89 84 private BufferedImage offscreenBuffer; 90 85 boolean updateOffscreenBuffer = true; 91 92 /*93 * Stores info about each image94 */95 96 static final class ImageEntry implements Comparable<ImageEntry> {97 File file;98 Date time;99 LatLon exifCoor;100 CachedLatLon pos;101 Image thumbnail;102 /** Speed in kilometer per second */103 Double speed;104 /** Elevation (altitude) in meters */105 Double elevation;106 107 public void setCoor(LatLon latlon)108 {109 pos = new CachedLatLon(latlon);110 }111 public int compareTo(ImageEntry image) {112 if (time != null && image.time != null)113 return time.compareTo(image.time);114 else if (time == null && image.time == null)115 return 0;116 else if (time == null)117 return -1;118 else119 return 1;120 }121 }122 86 123 87 /** Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing. … … 277 241 boolean noGeotagFound = true; 278 242 for (ImageEntry e : layer.data) { 279 if (e. pos!= null) {243 if (e.getPos() != null) { 280 244 noGeotagFound = false; 281 245 } … … 344 308 int i = 0; 345 309 for (ImageEntry e : data) 346 if (e. pos!= null) {310 if (e.getPos() != null) { 347 311 i++; 348 312 } … … 397 361 private Dimension scaledDimension(Image thumb) { 398 362 final double d = Main.map.mapView.getDist100Pixel(); 399 final double size = 40 /*meter*/; /* size of the photo on the map */363 final double size = 10 /*meter*/; /* size of the photo on the map */ 400 364 double s = size * 100 /*px*/ / d; 401 365 … … 441 405 442 406 for (ImageEntry e : data) { 443 if (e. pos== null) {407 if (e.getPos() == null) { 444 408 continue; 445 409 } 446 Point p = mv.getPoint(e. pos);410 Point p = mv.getPoint(e.getPos()); 447 411 if (e.thumbnail != null) { 448 412 Dimension d = scaledDimension(e.thumbnail); … … 464 428 else { 465 429 for (ImageEntry e : data) { 466 if (e. pos== null) {430 if (e.getPos() == null) { 467 431 continue; 468 432 } 469 Point p = mv.getPoint(e. pos);433 Point p = mv.getPoint(e.getPos()); 470 434 icon.paintIcon(mv, g, 471 435 p.x - icon.getIconWidth() / 2, … … 477 441 ImageEntry e = data.get(currentPhoto); 478 442 479 if (e. pos!= null) {480 Point p = mv.getPoint(e. pos);443 if (e.getPos() != null) { 444 Point p = mv.getPoint(e.getPos()); 481 445 482 446 if (e.thumbnail != null) { … … 496 460 public void visitBoundingBox(BoundingXYVisitor v) { 497 461 for (ImageEntry e : data) { 498 v.visit(e. pos);462 v.visit(e.getPos()); 499 463 } 500 464 } … … 549 513 550 514 e.setCoor(new LatLon(lat, lon)); 551 e.exifCoor = e. pos;515 e.exifCoor = e.getPos(); 552 516 553 517 } catch (Exception p) { 554 e.pos = null; 518 e.exifCoor = null; 519 e.setPos(null); 555 520 } 556 521 } … … 614 579 new String[] {tr("Cancel"), tr("Delete")}) 615 580 .setButtonIcons(new String[] {"cancel.png", "dialogs/delete.png"}) 616 .setContent(new JLabel(tr("<html><h3>Delete the file {0} from thedisk?<p>The image file will be permanently lost!"581 .setContent(new JLabel(tr("<html><h3>Delete the file {0} from disk?<p>The image file will be permanently lost!" 617 582 ,toDelete.file.getName()), ImageProvider.get("dialogs/geoimage/deletefromdisk"),SwingConstants.LEFT)) 618 583 .toggleEnable("geoimage.deleteimagefromdisk") … … 674 639 for (int i = data.size() - 1; i >= 0; --i) { 675 640 ImageEntry e = data.get(i); 676 if (e. pos== null) {641 if (e.getPos() == null) { 677 642 continue; 678 643 } 679 Point p = Main.map.mapView.getPoint(e. pos);644 Point p = Main.map.mapView.getPoint(e.getPos()); 680 645 Rectangle r; 681 646 if (e.thumbnail != null) { … … 744 709 } 745 710 } 711 712 public void loadThumbs() { 713 if (useThumbs && !thumbsLoaded) { 714 thumbsLoaded = true; 715 thumbsloader = new ThumbsLoader(this); 716 Thread t = new Thread(thumbsloader); 717 t.setPriority(Thread.MIN_PRIORITY); 718 t.start(); 719 } 720 } 721 722 public void updateBufferAndRepaint() { 723 updateOffscreenBuffer = true; 724 Main.map.mapView.repaint(); 725 } 746 726 }
Note:
See TracChangeset
for help on using the changeset viewer.
