Changeset 31284 in osm for applications/editors/josm/plugins/mapillary
- Timestamp:
- 2015-06-19T18:30:35+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31278 r31284 1 1 package org.openstreetmap.josm.plugins.mapillary; 2 2 3 import java.sql.Date; 4 import java.text.ParseException; 5 import java.text.SimpleDateFormat; 6 import java.util.Calendar; 7 8 import org.openstreetmap.josm.Main; 3 9 import org.openstreetmap.josm.data.coor.LatLon; 4 10 … … 11 17 */ 12 18 public abstract class MapillaryAbstractImage { 19 20 private long capturedAt; 13 21 14 22 /** Postion of the picture */ … … 31 39 */ 32 40 protected double movingCa; 41 private boolean visible; 33 42 34 43 public MapillaryAbstractImage(double lat, double lon, double ca) { … … 39 48 this.tempCa = ca; 40 49 this.movingCa = ca; 50 this.visible = true; 41 51 } 42 52 … … 58 68 public LatLon getLatLon() { 59 69 return movingLatLon; 70 } 71 72 public boolean isVisible() { 73 return visible; 74 } 75 76 public void setVisible(boolean visible) { 77 this.visible = visible; 60 78 } 61 79 … … 116 134 return tempCa; 117 135 } 136 137 /** 138 * Returns the date the picture was taken in DMY format. 139 * 140 * @return 141 */ 142 public String getDate() { 143 return getDate("dd/MM/yyyy - hh:mm:ss"); 144 } 145 146 public void setCapturedAt(long capturedAt) { 147 this.capturedAt = capturedAt; 148 } 149 150 public long getCapturedAt() { 151 return capturedAt; 152 } 153 154 /** 155 * Returns the date the picture was taken in the given format. 156 * 157 * @param format 158 * @return 159 */ 160 public String getDate(String format) { 161 Date date = new Date(getCapturedAt()); 162 163 SimpleDateFormat formatter = new SimpleDateFormat(format); 164 return formatter.format(date); 165 } 166 167 public long getEpoch(String date, String format) { 168 169 SimpleDateFormat formatter = new SimpleDateFormat(format); 170 try { 171 Date dateTime = (Date) formatter.parse(date); 172 return dateTime.getTime(); 173 } catch (ParseException e) { 174 Main.error(e); 175 } 176 return currentTime(); 177 } 178 179 private long currentTime() { 180 Calendar cal = Calendar.getInstance(); 181 return cal.getTimeInMillis(); 182 } 118 183 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31278 r31284 65 65 } 66 66 dataUpdated(); 67 fireImagesAdded(); 67 68 } 68 69 … … 118 119 this.images.add(image); 119 120 } 121 fireImagesAdded(); 120 122 } 121 123 … … 143 145 public MapillaryAbstractImage getSelectedImage() { 144 146 return selectedImage; 147 } 148 149 private void fireImagesAdded() { 150 if (listeners.isEmpty()) 151 return; 152 for (MapillaryDataListener lis : listeners) 153 lis.imagesAdded(); 145 154 } 146 155 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java
r31278 r31284 2 2 3 3 public interface MapillaryDataListener { 4 5 public void imagesAdded(); 6 4 7 /** 5 8 * Fired when the selected image is changed by something different from -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31278 r31284 1 1 package org.openstreetmap.josm.plugins.mapillary; 2 2 3 import java.sql.Date;4 import java.text.SimpleDateFormat;5 3 import java.util.ArrayList; 6 4 import java.util.List; … … 20 18 21 19 /** Epoch time when the image was taken. */ 22 private long capturedAt;23 20 /** The user that made the image */ 24 21 private String user; … … 73 70 public List<String> getSigns() { 74 71 return signs; 75 }76 77 public void setCapturedAt(long capturedAt) {78 this.capturedAt = capturedAt;79 }80 81 public long getCapturedAt() {82 return capturedAt;83 72 } 84 73 … … 139 128 } 140 129 141 /**142 * Returns the date the picture was taken in DMY format.143 * @return144 */145 public String getDate() {146 return getDate("dd/MM/yyyy - hh:mm:ss");147 }148 149 /**150 * Returns the date the picture was taken in the given format.151 * @param format152 * @return153 */154 public String getDate(String format) {155 Date date = new Date(getCapturedAt());156 157 SimpleDateFormat formatter = new SimpleDateFormat(format);158 return formatter.format(date);159 }160 161 130 @Override 162 131 public boolean equals(Object object) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31278 r31284 13 13 */ 14 14 protected File file; 15 public final String datetimeOriginal;15 public final long datetimeOriginal; 16 16 17 17 public MapillaryImportedImage(double lat, double lon, double ca, File file, … … 20 20 this.file = file; 21 21 System.out.println(datetimeOriginal); 22 this.datetimeOriginal = datetimeOriginal; 22 this.datetimeOriginal = getEpoch(datetimeOriginal, "yyyy/MM/dd hh:mm:ss"); 23 23 } 24 24 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31280 r31284 207 207 MapillaryToggleDialog.getInstance().blueButton.setEnabled(false); 208 208 MapillaryToggleDialog.getInstance().redButton.setEnabled(false); 209 210 // Sets blue and red lines and enables/disables the buttons 209 211 if (mapillaryData.getSelectedImage() != null) { 210 212 MapillaryImage[] closestImages = getClosestImagesFromDifferentSequences(); … … 232 234 g.setColor(Color.WHITE); 233 235 for (MapillaryAbstractImage imageAbs : mapillaryData.getImages()) { 236 if (!imageAbs.isVisible()) 237 continue; 234 238 Point p = mv.getPoint(imageAbs.getLatLon()); 235 239 if (imageAbs instanceof MapillaryImage) { 236 240 MapillaryImage image = (MapillaryImage) imageAbs; 237 241 Point nextp; 242 // Draw sequence line 238 243 if (image.getSequence() != null 239 && image. getSequence().next(image) != null) {244 && image.next() != null && image.next().isVisible()) { 240 245 nextp = mv.getPoint(image.getSequence().next(image) 241 246 .getLatLon()); 242 247 g.drawLine(p.x, p.y, nextp.x, nextp.y); 243 248 } 249 244 250 ImageIcon icon; 245 251 if (!mapillaryData.getMultiSelectedImages().contains(image)) … … 363 369 if (!(imagePrev instanceof MapillaryImage)) 364 370 continue; 371 if (!imagePrev.isVisible()) 372 continue; 365 373 MapillaryImage image = (MapillaryImage) imagePrev; 366 374 if (image.getLatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryMouseAdapter.java
r31278 r31284 209 209 nothingHighlighted = false; 210 210 } else if (Main.map.mapModeSelect.getValue("active") == Boolean.FALSE 211 && !nothingHighlighted) { 211 && !nothingHighlighted && Main.map.mapView != null 212 && Main.map.mapView.getEditLayer().data != null) { 212 213 for (OsmPrimitive primivitive : Main.map.mapView.getEditLayer().data 213 214 .allPrimitives()) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31280 r31284 18 18 import org.openstreetmap.josm.plugins.Plugin; 19 19 import org.openstreetmap.josm.plugins.PluginInformation; 20 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog; 20 21 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryHistoryDialog; 21 22 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryPreferenceSetting; … … 107 108 Main.map.addToggleDialog(MapillaryToggleDialog.getInstance(), false); 108 109 Main.map.addToggleDialog(MapillaryHistoryDialog.getInstance(), false); 110 Main.map.addToggleDialog(MapillaryFilterDialog.getInstance(), false); 109 111 } 110 112 if (oldFrame != null && newFrame == null) { // map frame destroyed 111 113 MapillaryToggleDialog.destroyInstance(); 114 MapillaryHistoryDialog.destroyInstance(); 115 MapillaryFilterDialog.destroyInstance(); 112 116 } 113 117 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
r31282 r31284 51 51 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.ZOOM_MENU, false); 52 52 } 53 54 @Override 55 public void imagesAdded() { 56 } 53 57 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java
r31278 r31284 87 87 exifDirectory.add( 88 88 ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 89 ((MapillaryImportedImage) mimg). datetimeOriginal);89 ((MapillaryImportedImage) mimg).getDate("yyyy/MM/dd hh:mm:ss")); 90 90 } else if (mimg instanceof MapillaryImage) 91 91 exifDirectory.add( -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31278 r31284 170 170 } 171 171 } 172 173 public static void destroyInstance() { 174 MapillaryHistoryDialog.INSTANCE = null; 175 } 172 176 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java
r31282 r31284 164 164 this.nextButton.setEnabled(true); 165 165 this.previousButton.setEnabled(true); 166 if (mapillaryImage.next() == null) 166 if (mapillaryImage.next() == null || !mapillaryImage.next().isVisible()) 167 167 this.nextButton.setEnabled(false); 168 if (mapillaryImage.previous() == null) 168 if (mapillaryImage.previous() == null || !mapillaryImage.previous().isVisible()) 169 169 this.previousButton.setEnabled(false); 170 170 } else if (mode == SIGN_MODE) { … … 481 481 } 482 482 } 483 484 @Override 485 public void imagesAdded() { 486 } 483 487 }
Note:
See TracChangeset
for help on using the changeset viewer.