Changeset 8660 in josm for trunk/src/org
- Timestamp:
- 2015-08-12T23:30:18+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer/geoimage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r8658 r8660 451 451 @Override 452 452 public int getSize() { 453 return yLayer.data .size();453 return yLayer.data != null ? yLayer.data.size() : 0; 454 454 } 455 455 }); … … 824 824 // The selection of images we are about to correlate may have changed. 825 825 // So reset all images. 826 for (ImageEntry ie: yLayer.data) { 827 ie.tmp = null; 826 if (yLayer.data != null) { 827 for (ImageEntry ie: yLayer.data) { 828 ie.tmp = null; 829 } 828 830 } 829 831 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r8658 r8660 367 367 int tagged = 0; 368 368 int newdata = 0; 369 for (ImageEntry e : data) { 370 if (e.getPos() != null) { 371 tagged++; 372 } 373 if (e.hasNewGpsData()) { 374 newdata++; 369 int n = 0; 370 if (data != null) { 371 n = data.size(); 372 for (ImageEntry e : data) { 373 if (e.getPos() != null) { 374 tagged++; 375 } 376 if (e.hasNewGpsData()) { 377 newdata++; 378 } 375 379 } 376 380 } 377 381 return "<html>" 378 + trn("{0} image loaded.", "{0} images loaded.", data.size(), data.size())382 + trn("{0} image loaded.", "{0} images loaded.", n, n) 379 383 + " " + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", tagged, tagged) 380 384 + (newdata > 0 ? "<br>" + trn("{0} has updated GPS data.", "{0} have updated GPS data.", newdata, newdata) : "") … … 405 409 l.stopLoadThumbs(); 406 410 407 final ImageEntry selected = l.currentPhoto >= 0 ? l.data.get(l.currentPhoto) : null; 408 409 data.addAll(l.data); 411 final ImageEntry selected = l.data != null && l.currentPhoto >= 0 ? l.data.get(l.currentPhoto) : null; 412 413 if (l.data != null) { 414 data.addAll(l.data); 415 } 410 416 Collections.sort(data); 411 417 … … 492 498 tempG.setComposite(saveComp); 493 499 494 for (ImageEntry e : data) { 495 if (e.getPos() == null) { 496 continue; 500 if (data != null) { 501 for (ImageEntry e : data) { 502 if (e.getPos() == null) { 503 continue; 504 } 505 Point p = mv.getPoint(e.getPos()); 506 if (e.thumbnail != null) { 507 Dimension d = scaledDimension(e.thumbnail); 508 Rectangle target = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height); 509 if (clip.intersects(target)) { 510 tempG.drawImage(e.thumbnail, target.x, target.y, target.width, target.height, null); 511 } 512 } else { // thumbnail not loaded yet 513 icon.paintIcon(mv, tempG, 514 p.x - icon.getIconWidth() / 2, 515 p.y - icon.getIconHeight() / 2); 516 } 497 517 } 498 Point p = mv.getPoint(e.getPos());499 if (e.thumbnail != null) {500 Dimension d = scaledDimension(e.thumbnail);501 Rectangle target = new Rectangle(p.x - d.width / 2, p.y - d.height / 2, d.width, d.height);502 if (clip.intersects(target)) {503 tempG.drawImage(e.thumbnail, target.x, target.y, target.width, target.height, null);504 }505 } else { // thumbnail not loaded yet506 icon.paintIcon(mv, tempG,507 p.x - icon.getIconWidth() / 2,508 p.y - icon.getIconHeight() / 2);509 }510 518 } 511 519 updateOffscreenBuffer = false; 512 520 } 513 521 g.drawImage(offscreenBuffer, 0, 0, null); 514 } else {522 } else if (data != null) { 515 523 for (ImageEntry e : data) { 516 524 if (e.getPos() == null) { … … 1022 1030 MapFrame.removeMapModeChangeListener(mapModeListener); 1023 1031 currentPhoto = -1; 1024 data.clear(); 1032 if (data != null) { 1033 data.clear(); 1034 } 1025 1035 data = null; 1026 1036 // stop listening to layer change events
Note:
See TracChangeset
for help on using the changeset viewer.