Changeset 32383 in osm for applications/editors/josm/plugins
- Timestamp:
- 2016-06-23T17:42:43+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r32382 r32383 65 65 66 66 /** 67 * Returns the direction towards the image has been taken.67 * Returns the original direction towards the image has been taken. 68 68 * 69 69 * @return The direction of the image (0 means north and goes clockwise). 70 70 */ 71 71 public double getCa() { 72 return this. movingCa;72 return this.ca; 73 73 } 74 74 … … 121 121 122 122 /** 123 * Returns a LatLon object containing the original coordinates of the object. 124 * 125 * @return The LatLon object with the position of the object. 126 */ 127 public LatLon getLatLon() { 128 return latLon; 129 } 130 131 /** 132 * Returns the direction towards the image has been taken. 133 * 134 * @return The direction of the image (0 means north and goes clockwise). 135 */ 136 public double getMovingCa() { 137 return this.movingCa; 138 } 139 140 /** 123 141 * Returns a LatLon object containing the current coordinates of the object. 124 142 * When you are dragging the image this changes. … … 126 144 * @return The LatLon object with the position of the object. 127 145 */ 128 public LatLon get LatLon() {129 return this.movingLatLon;146 public LatLon getMovingLatLon() { 147 return movingLatLon; 130 148 } 131 149 … … 168 186 */ 169 187 public boolean isModified() { 170 return !this.get LatLon().equals(this.latLon) || Math.abs(this.getCa() - this.ca) > EPSILON;188 return !this.getMovingLatLon().equals(this.latLon) || Math.abs(this.getMovingCa() - this.ca) > EPSILON; 171 189 } 172 190 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r32373 r32383 376 376 } 377 377 if (zoom && Main.main != null) 378 Main.map.mapView.zoomTo(getSelectedImage().get LatLon());378 Main.map.mapView.zoomTo(getSelectedImage().getMovingLatLon()); 379 379 if (Main.main != null) 380 380 Main.map.mapView.repaint(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r32374 r32383 299 299 if (this.data.getSelectedImage() != null) { 300 300 MapillaryImage[] closestImages = getClosestImagesFromDifferentSequences(); 301 Point selected = mv.getPoint(this.data.getSelectedImage().get LatLon());301 Point selected = mv.getPoint(this.data.getSelectedImage().getMovingLatLon()); 302 302 if (closestImages[0] != null) { 303 303 blue = closestImages[0]; 304 304 g.setColor(Color.BLUE); 305 final Point p = mv.getPoint(closestImages[0].get LatLon());305 final Point p = mv.getPoint(closestImages[0].getMovingLatLon()); 306 306 g.draw(new Line2D.Double(p.getX(), p.getY(), selected.getX(), selected.getY())); 307 307 MapillaryMainDialog.getInstance().blueButton.setEnabled(true); … … 310 310 red = closestImages[1]; 311 311 g.setColor(Color.RED); 312 final Point p = mv.getPoint(closestImages[1].get LatLon());312 final Point p = mv.getPoint(closestImages[1].getMovingLatLon()); 313 313 g.draw(new Line2D.Double(p.getX(), p.getY(), selected.getX(), selected.getY())); 314 314 MapillaryMainDialog.getInstance().redButton.setEnabled(true); … … 331 331 } 332 332 for (MapillaryAbstractImage imageAbs : this.data.getImages()) { 333 if (imageAbs.isVisible() && Main.map.mapView.contains(Main.map.mapView.getPoint(imageAbs.get LatLon()))) {334 final Point p = mv.getPoint(imageAbs.get LatLon());333 if (imageAbs.isVisible() && Main.map.mapView.contains(Main.map.mapView.getPoint(imageAbs.getMovingLatLon()))) { 334 final Point p = mv.getPoint(imageAbs.getMovingLatLon()); 335 335 ImageIcon icon = MapillaryPlugin.MAP_ICON; 336 336 if (getData().getMultiSelectedImages().contains(imageAbs)) { … … 393 393 394 394 // Rotate the image 395 double rotationRequired = Math.toRadians(image.get Ca());395 double rotationRequired = Math.toRadians(image.getMovingCa()); 396 396 double locationX = width / 2d; 397 397 double locationY = height / 2d; … … 446 446 SEQUENCE_MAX_JUMP_DISTANCE 447 447 }; 448 LatLon selectedCoords = this.data.getSelectedImage().get LatLon();448 LatLon selectedCoords = this.data.getSelectedImage().getMovingLatLon(); 449 449 for (MapillaryAbstractImage imagePrev : this.data.getImages()) { 450 450 if (!(imagePrev instanceof MapillaryImage)) … … 453 453 continue; 454 454 MapillaryImage image = (MapillaryImage) imagePrev; 455 if (image.get LatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE455 if (image.getMovingLatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE 456 456 && selected.getSequence() != image.getSequence()) { 457 457 if ( 458 458 ret[0] == null && ret[1] == null 459 || image.get LatLon().greatCircleDistance(selectedCoords) < distances[0]459 || image.getMovingLatLon().greatCircleDistance(selectedCoords) < distances[0] 460 460 && (ret[1] == null || image.getSequence() != ret[1].getSequence()) 461 461 ) { 462 462 ret[0] = image; 463 distances[0] = image.get LatLon().greatCircleDistance(selectedCoords);464 } else if ((ret[1] == null || image.get LatLon().greatCircleDistance(463 distances[0] = image.getMovingLatLon().greatCircleDistance(selectedCoords); 464 } else if ((ret[1] == null || image.getMovingLatLon().greatCircleDistance( 465 465 selectedCoords) < distances[1]) 466 466 && image.getSequence() != ret[0].getSequence()) { 467 467 ret[1] = image; 468 distances[1] = image.get LatLon().greatCircleDistance(selectedCoords);468 distances[1] = image.getMovingLatLon().greatCircleDistance(selectedCoords); 469 469 } 470 470 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryTrafficSignLayer.java
r32067 r32383 99 99 for (MapillaryAbstractImage img : MapillaryLayer.getInstance().getData().getImages()) { 100 100 if (img instanceof MapillaryImage) { 101 g.fillOval(mv.getPoint(img.get LatLon()).x - 3, mv.getPoint(img.getLatLon()).y - 3, 6, 6);101 g.fillOval(mv.getPoint(img.getMovingLatLon()).x - 3, mv.getPoint(img.getMovingLatLon()).y - 3, 6, 6); 102 102 if (!((MapillaryImage) img).getSigns().isEmpty()) { 103 Point imgLoc = mv.getPoint(img.get LatLon());103 Point imgLoc = mv.getPoint(img.getMovingLatLon()); 104 104 // TODO: Paint a sign from the image 105 105 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
r32373 r32383 43 43 throw new IllegalStateException(); 44 44 Main.map.mapView.zoomTo(MapillaryLayer.getInstance().getData() 45 .getSelectedImage().get LatLon());45 .getSelectedImage().getMovingLatLon()); 46 46 } 47 47 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java
r32069 r32383 130 130 private static boolean isInside(MapillaryAbstractImage image) { 131 131 for (Bounds b : MapillaryLayer.getInstance().getData().getBounds()) { 132 if (b.contains(image.get LatLon())) {132 if (b.contains(image.getMovingLatLon())) { 133 133 return true; 134 134 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
r32373 r32383 124 124 gpsDirectory.removeField(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION); 125 125 gpsDirectory.add(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION, 126 RationalNumber.valueOf(mimg.get Ca()));126 RationalNumber.valueOf(mimg.getMovingCa())); 127 127 128 128 exifDirectory.removeField(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); … … 134 134 ((MapillaryImage) mimg).getDate("yyyy/MM/dd HH/mm/ss")); 135 135 } 136 outputSet.setGPSInDegrees(mimg.get LatLon().lon(), mimg.getLatLon().lat());136 outputSet.setGPSInDegrees(mimg.getMovingLatLon().lon(), mimg.getMovingLatLon().lat()); 137 137 OutputStream os = new BufferedOutputStream(new FileOutputStream(finalPath + ".jpg")); 138 138 new ExifRewriter().updateExifMetadataLossless(imageBytes, os, outputSet); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
r31972 r32383 42 42 MapillaryAbstractImage closest = null; 43 43 for (MapillaryAbstractImage image : this.data.getImages()) { 44 Point imagePoint = Main.map.mapView.getPoint(image.get LatLon());44 Point imagePoint = Main.map.mapView.getPoint(image.getMovingLatLon()); 45 45 imagePoint.setLocation(imagePoint.getX(), imagePoint.getY()); 46 46 double dist = clickPoint.distanceSq(imagePoint); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java
r32329 r32383 82 82 if (this.lastClick != null) { 83 83 g.setColor(Color.WHITE); 84 Point p0 = mv.getPoint(this.lastClick.get LatLon());84 Point p0 = mv.getPoint(this.lastClick.getMovingLatLon()); 85 85 Point p1 = this.lastPos.getPoint(); 86 86 g.drawLine(p0.x, p0.y, p1.x, p1.y); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r32373 r32383 136 136 if (this.data.getSelectedImage() == null) 137 137 return; 138 if (this.data.getSelectedImage().getTempCa() != this.data.getSelectedImage().get Ca()) {138 if (this.data.getSelectedImage().getTempCa() != this.data.getSelectedImage().getMovingCa()) { 139 139 double from = this.data.getSelectedImage().getTempCa(); 140 double to = this.data.getSelectedImage().get Ca();140 double to = this.data.getSelectedImage().getMovingCa(); 141 141 this.record.addCommand(new CommandTurn(this.data.getMultiSelectedImages(), to 142 142 - from)); 143 143 } else if (this.data.getSelectedImage().getTempLatLon() != this.data 144 .getSelectedImage().get LatLon()) {144 .getSelectedImage().getMovingLatLon()) { 145 145 LatLon from = this.data.getSelectedImage().getTempLatLon(); 146 LatLon to = this.data.getSelectedImage().get LatLon();146 LatLon to = this.data.getSelectedImage().getMovingLatLon(); 147 147 this.record.addCommand(new CommandMove(this.data.getMultiSelectedImages(), to 148 148 .getX() - from.getX(), to.getY() - from.getY())); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31987 r32383 178 178 gpsDirectory.removeField(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION); 179 179 gpsDirectory.add(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION, 180 RationalNumber.valueOf(image.get Ca()));180 RationalNumber.valueOf(image.getMovingCa())); 181 181 182 182 exifDirectory.removeField(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); … … 187 187 rootDirectory.removeField(TiffTagConstants.TIFF_TAG_IMAGE_DESCRIPTION); 188 188 189 outputSet.setGPSInDegrees(image.get LatLon().lon(), image.getLatLon().lat());189 outputSet.setGPSInDegrees(image.getMovingLatLon().lon(), image.getMovingLatLon().lat()); 190 190 File tempFile = File.createTempFile("imagetoupload_" + c, ".tmp"); 191 191 c++; … … 216 216 public static void upload(MapillaryImportedImage image, UUID uuid) { 217 217 String key = MapillaryUser.getUsername() + "/" + uuid.toString() + "/" 218 + image.get LatLon().lat() + "_" + image.getLatLon().lon() + "_"219 + image.get Ca() + "_" + image.getCapturedAt() + ".jpg";218 + image.getMovingLatLon().lat() + "_" + image.getMovingLatLon().lon() + "_" 219 + image.getMovingCa() + "_" + image.getCapturedAt() + ".jpg"; 220 220 221 221 String policy; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapViewGeometryUtil.java
r31985 r32383 58 58 for (MapillaryAbstractImage img : seq.getImages()) { 59 59 if (img.isVisible()) { 60 Point p = mv.getPoint(img.get LatLon());60 Point p = mv.getPoint(img.getMovingLatLon()); 61 61 if (path.getCurrentPoint() == null) { 62 62 path.moveTo(p.getX(), p.getY()); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r32378 r32383 214 214 zoomBounds = new Bounds(new LatLon(0, 0)); 215 215 } else { 216 zoomBounds = new Bounds(images.iterator().next().get LatLon());216 zoomBounds = new Bounds(images.iterator().next().getMovingLatLon()); 217 217 for (MapillaryAbstractImage img : images) { 218 zoomBounds.extend(img.get LatLon());218 zoomBounds.extend(img.getMovingLatLon()); 219 219 } 220 220 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java
r32034 r32383 28 28 File image = new File("images/icon16.png"); 29 29 MapillaryImportedImage img = ImageUtil.readImagesFrom(image, new LatLon(0, 0)).get(0); 30 assertEquals(0, img.get Ca(), 0.01);31 assertTrue(new LatLon(0, 0).equalsEpsilon(img.get LatLon()));30 assertEquals(0, img.getMovingCa(), 0.01); 31 assertTrue(new LatLon(0, 0).equalsEpsilon(img.getMovingLatLon())); 32 32 } 33 33 -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordTest.java
r32065 r32383 120 120 this.record.addCommand(cmd1); 121 121 122 assertEquals(0.1, this.img1.get LatLon().lat(), 0.01);123 124 this.record.undo(); 125 126 assertEquals(0.0, this.img1.get LatLon().lat(), 0.01);127 128 this.record.redo(); 129 130 assertEquals(0.1, this.img1.get LatLon().lat(), 0.01);131 132 this.record.addCommand(cmd2); 133 this.record.undo(); 134 135 assertEquals(-0.1, this.img1.get LatLon().lat(), 0.01);136 137 this.record.redo(); 138 139 assertEquals(0.1, this.img1.get LatLon().lat(), 0.01);122 assertEquals(0.1, this.img1.getMovingLatLon().lat(), 0.01); 123 124 this.record.undo(); 125 126 assertEquals(0.0, this.img1.getMovingLatLon().lat(), 0.01); 127 128 this.record.redo(); 129 130 assertEquals(0.1, this.img1.getMovingLatLon().lat(), 0.01); 131 132 this.record.addCommand(cmd2); 133 this.record.undo(); 134 135 assertEquals(-0.1, this.img1.getMovingLatLon().lat(), 0.01); 136 137 this.record.redo(); 138 139 assertEquals(0.1, this.img1.getMovingLatLon().lat(), 0.01); 140 140 } 141 141 … … 155 155 this.record.undo(); 156 156 157 assertEquals(-0.1, this.img1.get Ca(), 0.01);158 159 this.record.redo(); 160 161 assertEquals(0.1, this.img1.get Ca(), 0.01);162 163 this.record.addCommand(cmd2); 164 this.record.undo(); 165 166 assertEquals(-0.2, this.img1.get Ca(), 0.01);167 168 this.record.redo(); 169 170 assertEquals(0.1, this.img1.get Ca(), 0.01);157 assertEquals(-0.1, this.img1.getMovingCa(), 0.01); 158 159 this.record.redo(); 160 161 assertEquals(0.1, this.img1.getMovingCa(), 0.01); 162 163 this.record.addCommand(cmd2); 164 this.record.undo(); 165 166 assertEquals(-0.2, this.img1.getMovingCa(), 0.01); 167 168 this.record.redo(); 169 170 assertEquals(0.1, this.img1.getMovingCa(), 0.01); 171 171 } 172 172 -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/ImageUtilsTest.java
r32053 r32383 23 23 List<MapillaryImportedImage> images = ImageUtil.readImagesFrom(untaggedFile, defaultLL); 24 24 assertEquals(1, images.size()); 25 assertEquals(0, images.get(0).get Ca(), 1e-9);26 assertEquals(defaultLL, images.get(0).get LatLon());25 assertEquals(0, images.get(0).getMovingCa(), 1e-9); 26 assertEquals(defaultLL, images.get(0).getMovingLatLon()); 27 27 assertEquals(untaggedFile, images.get(0).getFile()); 28 28 long endTime = System.currentTimeMillis() / 1000 * 1000 + 1000; // Rounding to next full second … … 37 37 List<MapillaryImportedImage> images = ImageUtil.readImagesFrom(untaggedFile, defaultLL); 38 38 assertEquals(1, images.size()); 39 assertEquals(0, images.get(0).get Ca(), 1e-9);40 assertEquals(55.6052777777, images.get(0).get LatLon().lat(), 1e-9);41 assertEquals(13.0001388888, images.get(0).get LatLon().lon(), 1e-9);39 assertEquals(0, images.get(0).getMovingCa(), 1e-9); 40 assertEquals(55.6052777777, images.get(0).getMovingLatLon().lat(), 1e-9); 41 assertEquals(13.0001388888, images.get(0).getMovingLatLon().lon(), 1e-9); 42 42 assertEquals(untaggedFile, images.get(0).getFile()); 43 43 long endTime = System.currentTimeMillis() / 1000 * 1000 + 1000; // Rounding to next full second … … 52 52 List<MapillaryImportedImage> images = ImageUtil.readImagesFrom(untaggedFile, defaultLL); 53 53 assertEquals(1, images.size()); 54 assertEquals(42.73, images.get(0).get Ca(), 1e-9);55 assertEquals(defaultLL, images.get(0).get LatLon());54 assertEquals(42.73, images.get(0).getMovingCa(), 1e-9); 55 assertEquals(defaultLL, images.get(0).getMovingLatLon()); 56 56 assertEquals(untaggedFile, images.get(0).getFile()); 57 57 long endTime = System.currentTimeMillis() / 1000 * 1000 + 1000; // Rounding to next full second … … 66 66 List<MapillaryImportedImage> images = ImageUtil.readImagesFrom(untaggedFile, defaultLL); 67 67 assertEquals(1, images.size()); 68 assertEquals(0, images.get(0).get Ca(), 1e-9);69 assertEquals(defaultLL, images.get(0).get LatLon());68 assertEquals(0, images.get(0).getMovingCa(), 1e-9); 69 assertEquals(defaultLL, images.get(0).getMovingLatLon()); 70 70 assertEquals(untaggedFile, images.get(0).getFile()); 71 71 /* http://www.wolframalpha.com/input/?i=convert+2015-12-24T01%3A02%3A03%2B0000+to+unixtime */
Note:
See TracChangeset
for help on using the changeset viewer.