Changeset 32033 in osm for applications/editors
- Timestamp:
- 2016-01-31T11:37:54+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31983 r32033 51 51 * Creates a new object in the given position and with the given direction. 52 52 * 53 * @param lat 54 * The latitude where the picture was taken. 55 * @param lon 56 * The longitude where the picture was taken. 57 * @param ca 58 * The direction of the picture (0 means north). 59 */ 60 protected MapillaryAbstractImage(final double lat, final double lon, final double ca) { 61 this.latLon = new LatLon(lat, lon); 53 * @param latLon The latitude and longitude where the picture was taken. 54 * @param ca The direction of the picture (0 means north). 55 */ 56 protected MapillaryAbstractImage(final LatLon latLon, final double ca) { 57 this.latLon = latLon; 62 58 this.tempLatLon = this.latLon; 63 59 this.movingLatLon = this.latLon; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31882 r32033 4 4 import java.util.ArrayList; 5 5 import java.util.List; 6 7 import org.openstreetmap.josm.data.coor.LatLon; 6 8 7 9 /** … … 25 27 * Main constructor of the class MapillaryImage 26 28 * 27 * @param key 28 * The unique identifier of the image. 29 * @param lat 30 * The latitude where it is positioned. 31 * @param lon 32 * The longitude where it is positioned. 33 * @param ca 34 * The direction of the images in degrees, meaning 0 north. 29 * @param key The unique identifier of the image. 30 * @param latLon The latitude and longitude where it is positioned. 31 * @param ca The direction of the images in degrees, meaning 0 north. 35 32 */ 36 public MapillaryImage( String key, double lat, double lon,double ca) {37 super(lat , lon, ca);33 public MapillaryImage(final String key, final LatLon latLon, final double ca) { 34 super(latLon, ca); 38 35 this.key = key; 39 36 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31882 r32033 9 9 import javax.imageio.ImageIO; 10 10 11 import org.openstreetmap.josm.data.coor.LatLon; 11 12 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 12 13 … … 27 28 * Using when the EXIF tags doesn't contain that info. 28 29 * 29 * @param lat 30 * Latitude where the picture was taken. 31 * @param lon 32 * Longitude where the picture was taken. 33 * @param ca 34 * Direction of the picture (0 means north). 35 * @param file 36 * The file containing the picture. 30 * @param latLon The latitude and longitude where the picture was taken. 31 * @param ca Direction of the picture (0 means north). 32 * @param file The file containing the picture. 37 33 */ 38 public MapillaryImportedImage( double lat, double lon, double ca,File file) {39 this(lat , lon, ca, file, MapillaryUtils.currentDate());34 public MapillaryImportedImage(final LatLon latLon, final double ca, final File file) { 35 this(latLon, ca, file, MapillaryUtils.currentDate()); 40 36 } 41 37 … … 43 39 * Main constructor of the class. 44 40 * 45 * @param lat 46 * Latitude where the picture was taken. 47 * @param lon 48 * Longitude where the picture was taken. 49 * @param ca 50 * Direction of the picture (0 means north), 51 * @param file 52 * The file containing the picture. 53 * @param datetimeOriginal 54 * The date the picture was taken. 41 * @param latLon Latitude and Longitude where the picture was taken. 42 * @param ca Direction of the picture (0 means north), 43 * @param file The file containing the picture. 44 * @param datetimeOriginal The date the picture was taken. 55 45 */ 56 public MapillaryImportedImage(double lat, double lon, double ca, File file, 57 String datetimeOriginal) { 58 super(lat, lon, ca); 46 public MapillaryImportedImage(final LatLon latLon, final double ca, final File file, final String datetimeOriginal) { 47 super(latLon, ca); 59 48 this.file = file; 60 49 try { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java
r31909 r32033 16 16 import org.openstreetmap.josm.Main; 17 17 import org.openstreetmap.josm.data.Bounds; 18 import org.openstreetmap.josm.data.coor.LatLon; 18 19 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; 19 20 import org.openstreetmap.josm.plugins.mapillary.MapillaryData; … … 71 72 for (int j = 0; j < cas.size(); j++) { 72 73 try { 73 images.add(new MapillaryImage(keys.getString(j), coords 74 .getJsonArray(j).getJsonNumber(1).doubleValue(), coords 75 .getJsonArray(j).getJsonNumber(0).doubleValue(), cas 76 .getJsonNumber(j).doubleValue())); 74 images.add(new MapillaryImage( 75 keys.getString(j), 76 new LatLon( 77 coords.getJsonArray(j).getJsonNumber(1).doubleValue(), 78 coords.getJsonArray(j).getJsonNumber(0).doubleValue() 79 ), 80 cas.getJsonNumber(j).doubleValue())); 77 81 } catch (IndexOutOfBoundsException e) { 78 82 Main.warn("Mapillary bug at " + MapillaryURL.searchSequenceURL(bounds, page)); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31983 r32033 280 280 caValue = ((RationalNumber) ca.getValue()).doubleValue(); 281 281 if (datetimeOriginal != null) { 282 return new MapillaryImportedImage( latValue, lonValue, caValue, file, datetimeOriginal.getStringValue());283 } 284 return new MapillaryImportedImage( latValue, lonValue, caValue, file);282 return new MapillaryImportedImage(new LatLon(latValue, lonValue), caValue, file, datetimeOriginal.getStringValue()); 283 } 284 return new MapillaryImportedImage(new LatLon(latValue, lonValue), caValue, file); 285 285 } 286 286 throw new IllegalStateException("Invalid format."); … … 323 323 ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 324 324 if (datetimeOriginal == null) { 325 return new MapillaryImportedImage(pos .lat(), pos.lon(), 0, file);325 return new MapillaryImportedImage(pos, 0, file); 326 326 } 327 327 try { 328 return new MapillaryImportedImage(pos .lat(), pos.lon(), 0, file, datetimeOriginal.getStringValue());328 return new MapillaryImportedImage(pos, 0, file, datetimeOriginal.getStringValue()); 329 329 } catch (ImageReadException e) { 330 330 Main.error(e); 331 331 } 332 332 } 333 return new MapillaryImportedImage(pos .lat(), pos.lon(), 0, file);333 return new MapillaryImportedImage(pos, 0, file); 334 334 } 335 335 -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java
r31512 r32033 40 40 @Test(expected = IIOException.class) 41 41 public void testInvalidFiles() throws IOException { 42 MapillaryImportedImage img = new MapillaryImportedImage( 0, 0, 0, null);42 MapillaryImportedImage img = new MapillaryImportedImage(new LatLon(0, 0), 0, null); 43 43 assertEquals(null, img.getImage()); 44 44 assertEquals(null, img.getFile()); 45 45 46 img = new MapillaryImportedImage( 0, 0, 0, new File(""));46 img = new MapillaryImportedImage(new LatLon(0, 0), 0, new File("")); 47 47 assertEquals(new File(""), img.getFile()); 48 48 img.getImage(); -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImageTest.java
r31460 r32033 10 10 import org.junit.Test; 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.data.coor.LatLon; 12 13 13 14 /** … … 23 24 TimeZone.setDefault(TimeZone.getTimeZone("GMT+0745")); 24 25 25 MapillaryAbstractImage mai = new MapillaryImportedImage( 0, 0, 0, null);26 MapillaryAbstractImage mai = new MapillaryImportedImage(new LatLon(0, 0), 0, null); 26 27 mai.setCapturedAt(1044087606000l); // in timezone GMT+0745 this is Saturday, February 1, 2003 16:05:06 27 28 -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryDataTest.java
r31909 r32033 9 9 import org.junit.Before; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm.data.coor.LatLon; 11 12 12 13 /** … … 31 32 @Before 32 33 public void setUp() { 33 this.img1 = new MapillaryImage("key1", 0.1, 0.1, 90);34 this.img2 = new MapillaryImage("key2", 0.2, 0.2, 90);35 this.img3 = new MapillaryImage("key3", 0.3, 0.3, 90);36 this.img4 = new MapillaryImage("key4", 0.4, 0.4, 90);34 this.img1 = new MapillaryImage("key1", new LatLon(0.1, 0.1), 90); 35 this.img2 = new MapillaryImage("key2", new LatLon(0.2, 0.2), 90); 36 this.img3 = new MapillaryImage("key3", new LatLon(0.3, 0.3), 90); 37 this.img4 = new MapillaryImage("key4", new LatLon(0.4, 0.4), 90); 37 38 this.seq = new MapillarySequence(); 38 39 … … 74 75 public void sizeTest() { 75 76 assertEquals(4, this.data.size()); 76 this.data.add(new MapillaryImage("key5", 0.1, 0.1, 90));77 this.data.add(new MapillaryImage("key5", new LatLon(0.1, 0.1), 90)); 77 78 assertEquals(5, this.data.size()); 78 79 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceTest.java
r31460 r32033 8 8 import org.junit.Before; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm.data.coor.LatLon; 10 11 11 12 /** … … 29 30 @Before 30 31 public void setUp() { 31 this.img1 = new MapillaryImage("key1", 0.1, 0.1, 90);32 this.img2 = new MapillaryImage("key2", 0.2, 0.2, 90);33 this.img3 = new MapillaryImage("key3", 0.3, 0.3, 90);34 this.img4 = new MapillaryImage("key4", 0.4, 0.4, 90);32 this.img1 = new MapillaryImage("key1", new LatLon(0.1, 0.1), 90); 33 this.img2 = new MapillaryImage("key2", new LatLon(0.2, 0.2), 90); 34 this.img3 = new MapillaryImage("key3", new LatLon(0.3, 0.3), 90); 35 this.img4 = new MapillaryImage("key4", new LatLon(0.4, 0.4), 90); 35 36 this.seq = new MapillarySequence(); 36 37 … … 63 64 // that is not in the sequence. 64 65 try { 65 this.seq.next(new MapillaryImage("key5", 0.5, 0.5, 90));66 this.seq.next(new MapillaryImage("key5", new LatLon(0.5, 0.5), 90)); 66 67 fail(); 67 68 } catch (IllegalArgumentException e) { … … 72 73 // image that is not in the sequence. 73 74 try { 74 this.seq.previous(new MapillaryImage("key5", 0.5, 0.5, 90));75 this.seq.previous(new MapillaryImage("key5", new LatLon(0.5, 0.5), 90)); 75 76 fail(); 76 77 } catch (IllegalArgumentException e) { -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordTest.java
r31909 r32033 11 11 import org.junit.Before; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm.data.coor.LatLon; 13 14 import org.openstreetmap.josm.plugins.mapillary.AbstractTest; 14 15 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; … … 43 44 public void setUp() { 44 45 this.record = new MapillaryRecord(); 45 this.img1 = new MapillaryImage("key1", 0.1, 0.1, 0.1);46 this.img2 = new MapillaryImage("key2", 0.2, 0.2, 0.2);47 this.img3 = new MapillaryImage("key3", 0.3, 0.3, 0.3);46 this.img1 = new MapillaryImage("key1", new LatLon(0.1, 0.1), 0.1); 47 this.img2 = new MapillaryImage("key2", new LatLon(0.2, 0.2), 0.2); 48 this.img3 = new MapillaryImage("key3", new LatLon(0.3, 0.3), 0.3); 48 49 MapillaryLayer.getInstance().getData().getImages().clear(); 49 50 }
Note:
See TracChangeset
for help on using the changeset viewer.