Changeset 31460 in osm for applications/editors/josm/plugins
- Timestamp:
- 2015-08-06T16:55:15+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 4 added
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31445 r31460 21 21 22 22 /** 23 * Lock that locks next() and previous() methods. Used when downloading images 24 * to prevent concurrency problems. 23 * Lock that locks {@link MapillaryAbstractImage#next()} and 24 * {@link MapillaryAbstractImage#previous()} methods. Used when downloading 25 * images to prevent concurrency problems. 25 26 */ 26 27 public static Lock LOCK = new ReentrantLock(); … … 213 214 * Returns the date the picture was taken in the given format. 214 215 * 215 * @param format Format of the date. See {@link SimpleDateFormat}. 216 * @param format 217 * Format of the date. See {@link SimpleDateFormat}. 216 218 * @return A String containing the date the picture was taken using the given 217 219 * format. -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31459 r31460 117 117 * @return The image under the mouse cursor. 118 118 */ 119 public MapillaryAbstractImage getHighlighted () {119 public MapillaryAbstractImage getHighlightedImage() { 120 120 return this.highlightedImage; 121 121 } … … 239 239 public void selectPrevious(boolean moveToPicture) { 240 240 if (getSelectedImage() == null) 241 return;241 throw new IllegalStateException(); 242 242 if (getSelectedImage().getSequence() == null) 243 243 throw new IllegalStateException(); … … 277 277 this.multiSelectedImages.clear(); 278 278 this.multiSelectedImages.add(image); 279 if (image != null ) {279 if (image != null && Main.main != null) { 280 280 if (image instanceof MapillaryImage) { 281 281 MapillaryImage mapillaryImage = (MapillaryImage) image; … … 284 284 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next()); 285 285 if (mapillaryImage.next().next() != null) 286 CacheUtils 287 . downloadPicture((MapillaryImage) mapillaryImage.next().next());286 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next() 287 .next()); 288 288 } 289 289 if (mapillaryImage.previous() != null) { 290 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous()); 290 CacheUtils 291 .downloadPicture((MapillaryImage) mapillaryImage.previous()); 291 292 if (mapillaryImage.previous().previous() != null) 292 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage .previous()293 .previous() );293 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage 294 .previous().previous()); 294 295 } 295 296 } 296 297 } 297 if (zoom )298 if (zoom && Main.main != null) 298 299 Main.map.mapView.zoomTo(getSelectedImage().getLatLon()); 299 300 if (Main.main != null) … … 325 326 this.setSelectedImage(image); 326 327 } 327 Main.map.mapView.repaint(); 328 if (Main.main != null) 329 Main.map.mapView.repaint(); 328 330 } 329 331 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31459 r31460 415 415 g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2), 416 416 Main.map.mapView); 417 if (this.data.getHighlighted () == image) {417 if (this.data.getHighlightedImage() == image) { 418 418 drawPointHighlight(g, p, 16); 419 419 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r31457 r31460 139 139 return this.images.get(i - 1); 140 140 } 141 142 /**143 * Returns the difference of index between two {@link MapillaryAbstractImage}144 * objects belonging to the same {@link MapillarySequence}.145 *146 * @param image1147 * The first image.148 * @param image2149 * The second image.150 * @return The distance between two {@link MapillaryAbstractImage} objects151 * belonging to the same {@link MapillarySequence}.152 */153 public int getDistance(MapillaryAbstractImage image1,154 MapillaryAbstractImage image2) {155 if (!this.images.contains(image1) || !this.images.contains(image2))156 throw new IllegalArgumentException();157 return Math.abs(this.images.indexOf(image1) - this.images.indexOf(image2));158 }159 141 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31457 r31460 22 22 */ 23 23 public class WalkThread extends Thread implements MapillaryDataListener { 24 private int interval;25 private MapillaryData data;26 private Lock lock = new ReentrantLock();24 private final int interval; 25 private final MapillaryData data; 26 private final Lock lock; 27 27 private boolean end = false; 28 28 private final boolean waitForFullQuality; … … 53 53 this.data = MapillaryLayer.getInstance().getData(); 54 54 this.data.addListener(this); 55 this.lock = new ReentrantLock(); 55 56 } 56 57 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
r31459 r31460 45 45 public final static String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 46 46 /** Executor that will run the petitions. */ 47 private static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(3, 5, 48 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50)); 47 private static ThreadPoolExecutor EXECUTOR; 49 48 50 49 /** … … 63 62 queryStringParts.put("max_lat", maxLatLon.lat()); 64 63 queryStringParts.put("max_lon", maxLatLon.lon()); 64 EXECUTOR = new ThreadPoolExecutor(3, 5, 100, TimeUnit.SECONDS, 65 new ArrayBlockingQueue<Runnable>(50)); 65 66 run(new MapillarySquareDownloadManagerThread(queryStringParts)); 66 67 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
r31451 r31460 33 33 protected JOptionPane optionPane; 34 34 /** Button to export all downloaded images. */ 35 public JRadioButton all;35 public final JRadioButton all; 36 36 /** 37 37 * Button to export all images in the sequence of the selected MapillaryImage. 38 38 */ 39 public JRadioButton sequence;39 public final JRadioButton sequence; 40 40 /** 41 41 * Button to export all images belonging to the selected 42 42 * {@link MapillaryImage} objects. 43 43 */ 44 public JRadioButton selected;44 public final JRadioButton selected; 45 45 /** Button to rewrite all imported images. */ 46 public JRadioButton rewrite;46 public final JRadioButton rewrite; 47 47 /** Group of button containing all the options. */ 48 public ButtonGroup group;49 private JButton choose;50 private JLabel path;48 public final ButtonGroup group; 49 private final JButton choose; 50 private final JLabel path; 51 51 /** File chooser. */ 52 52 public JFileChooser chooser; 53 53 protected String exportDirectory; 54 private JButton ok;54 private final JButton ok; 55 55 56 56 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31445 r31460 57 57 private Rectangle selectedRect = null; 58 58 59 /** HyperlinkLabel shown in the bottom right corner. */ 59 60 protected HyperlinkLabel hyperlink; 60 61 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java
r31445 r31460 37 37 @Override 38 38 public void mousePressed(MouseEvent e) { 39 if (this.data.getHighlighted () == null)39 if (this.data.getHighlightedImage() == null) 40 40 return; 41 41 if (this.lastClick == null 42 && this.data.getHighlighted () instanceof MapillaryImportedImage) {43 this.lastClick = (MapillaryImportedImage) this.data.getHighlighted ();42 && this.data.getHighlightedImage() instanceof MapillaryImportedImage) { 43 this.lastClick = (MapillaryImportedImage) this.data.getHighlightedImage(); 44 44 } else if (this.lastClick != null 45 && this.data.getHighlighted () instanceof MapillaryImportedImage) {46 if (((this.data.getHighlighted ().previous() == null && this.lastClick.next() == null) || (this.data47 .getHighlighted ().next() == null && this.lastClick.previous() == null))48 && (this.data.getHighlighted ().getSequence() != this.lastClick.getSequence() || this.lastClick45 && this.data.getHighlightedImage() instanceof MapillaryImportedImage) { 46 if (((this.data.getHighlightedImage().previous() == null && this.lastClick.next() == null) || (this.data 47 .getHighlightedImage().next() == null && this.lastClick.previous() == null)) 48 && (this.data.getHighlightedImage().getSequence() != this.lastClick.getSequence() || this.lastClick 49 49 .getSequence() == null)) { 50 join(this.lastClick, (MapillaryImportedImage) this.data.getHighlighted ());51 } else if (this.lastClick.next() == this.data.getHighlighted ()52 || this.lastClick.previous() == this.data.getHighlighted ())53 unjoin(this.lastClick, (MapillaryImportedImage) this.data.getHighlighted ());50 join(this.lastClick, (MapillaryImportedImage) this.data.getHighlightedImage()); 51 } else if (this.lastClick.next() == this.data.getHighlightedImage() 52 || this.lastClick.previous() == this.data.getHighlightedImage()) 53 unjoin(this.lastClick, (MapillaryImportedImage) this.data.getHighlightedImage()); 54 54 this.lastClick = null; 55 55 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r31445 r31460 182 182 } 183 183 184 if (this.data.getHighlighted () != closestTemp && closestTemp != null) {184 if (this.data.getHighlightedImage() != closestTemp && closestTemp != null) { 185 185 this.data.setHighlightedImage(closestTemp); 186 186 MapillaryMainDialog.getInstance().setImage(closestTemp); 187 187 MapillaryMainDialog.getInstance().updateImage(false); 188 } else if (this.data.getHighlighted () != closestTemp && closestTemp == null) {188 } else if (this.data.getHighlightedImage() != closestTemp && closestTemp == null) { 189 189 this.data.setHighlightedImage(null); 190 190 MapillaryMainDialog.getInstance().setImage(this.data.getSelectedImage()); -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java
r31456 r31460 12 12 public abstract class AbstractTest { 13 13 14 private static boolean started = false;15 16 14 /** 17 15 * Initiates the basic parts of JOSM. -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java
r31456 r31460 10 10 import javax.imageio.IIOException; 11 11 12 import org.apache.commons.imaging.common.RationalNumber;13 import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;14 12 import org.openstreetmap.josm.data.coor.LatLon; 15 13 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction; 16 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;17 14 18 15 /** … … 51 48 img.getImage(); 52 49 } 53 54 /**55 * Test degMinSecToDouble method.56 */57 @Test58 public void degMinSecToDoubleTest() {59 RationalNumber[] num = new RationalNumber[3];60 num[0] = new RationalNumber(1, 1);61 num[1] = new RationalNumber(0, 1);62 num[2] = new RationalNumber(0, 1);63 String ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH;64 assertEquals(1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);65 ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH;66 assertEquals(-1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);67 num[0] = new RationalNumber(180, 1);68 assertEquals(-180, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);69 num[0] = new RationalNumber(190, 1);70 assertEquals(170, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);71 }72 50 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImageTest.java
r31445 r31460 42 42 } 43 43 44 private void testGetDate(String expected, MapillaryAbstractImage img,44 private static void testGetDate(String expected, MapillaryAbstractImage img, 45 45 boolean isoDates, boolean displayHour, boolean format24) { 46 46 Main.pref.put("iso.dates", isoDates); -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/oauth/UploadTest.java
r31459 r31460 1 package org.openstreetmap.josm.plugins.mapillary ;1 package org.openstreetmap.josm.plugins.mapillary.oauth; 2 2 3 3 import static org.junit.Assert.assertEquals; … … 18 18 import org.junit.Test; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.plugins.mapillary.AbstractTest; 21 import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage; 20 22 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction; 21 23 import org.openstreetmap.josm.plugins.mapillary.oauth.UploadUtils; 22 24 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 23 25 26 /** 27 * Tests the {@link UploadUtils} class. 28 * 29 * @author nokutu 30 * @see UploadUtils 31 */ 24 32 public class UploadTest extends AbstractTest { 25 33 26 34 /** 27 * Tests the updateFile method from {@link MapillaryImportAction} class.35 * Tests the {@link UploadUtils#updateFile(MapillaryImportedImage)} method. 28 36 */ 29 37 @Test -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/TestUtil.java
r31456 r31460 1 1 package org.openstreetmap.josm.plugins.mapillary.utils; 2 2 3 import java.io.File;4 3 5 4 import org.openstreetmap.josm.Main; 6 5 import org.openstreetmap.josm.data.projection.Projections; 7 import org.openstreetmap.josm.plugins.PluginException;8 import org.openstreetmap.josm.plugins.PluginInformation;9 6 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 10 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;11 7 import org.openstreetmap.josm.tools.I18n; 12 8
Note:
See TracChangeset
for help on using the changeset viewer.