Changeset 31331 in osm
- Timestamp:
- 2015-07-02T13:57:34+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31328 r31331 20 20 */ 21 21 public abstract class MapillaryAbstractImage { 22 22 23 23 public static Lock lock = new ReentrantLock(); 24 24 … … 30 30 public final double ca; 31 31 public boolean isModified = false; 32 /** Temporal position of the picture until it is upl aoded */32 /** Temporal position of the picture until it is uploaded */ 33 33 public LatLon tempLatLon; 34 34 /** … … 37 37 */ 38 38 public LatLon movingLatLon; 39 /** Temporal direction of the picture until it is upl aoded */39 /** Temporal direction of the picture until it is uploaded */ 40 40 public double tempCa; 41 41 /** … … 75 75 } 76 76 77 /** 78 * Returns whether the image is visible on the map or not. 79 * 80 * @return 81 */ 77 82 public boolean isVisible() { 78 83 return visible; … … 84 89 85 90 /** 86 * Returns the last fixed coordi tanes of the object.91 * Returns the last fixed coordinates of the object. 87 92 * 88 93 * @return … … 95 100 * Moves the image temporally to another position 96 101 * 97 * @param pos 102 * @param x 103 * @param y 98 104 */ 99 105 public void move(double x, double y) { … … 182 188 } 183 189 190 /** 191 * Parses a string with a given format and returns the Epoch time. 192 * 193 * @param date 194 * @param format 195 * @return 196 */ 184 197 public long getEpoch(String date, String format) { 185 198 … … 194 207 } 195 208 209 /** 210 * Returns current time in Epoch format 211 * 212 * @return 213 */ 196 214 private long currentTime() { 197 215 Calendar cal = Calendar.getInstance(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31328 r31331 25 25 private final List<MapillaryAbstractImage> images; 26 26 private MapillaryAbstractImage selectedImage; 27 private MapillaryAbstractImage hoveredImage; 27 /** The image under the cursor */ 28 private MapillaryAbstractImage highlightedImage; 28 29 private final List<MapillaryAbstractImage> multiSelectedImages; 29 30 … … 97 98 */ 98 99 public void setHoveredImage(MapillaryAbstractImage image) { 99 h overedImage = image;100 highlightedImage = image; 100 101 } 101 102 … … 106 107 */ 107 108 public MapillaryAbstractImage getHoveredImage() { 108 return h overedImage;109 return highlightedImage; 109 110 } 110 111 … … 237 238 if (image instanceof MapillaryImage) { 238 239 MapillaryImage mapillaryImage = (MapillaryImage) image; 240 // Donwloadins thumbnails of surrounding pictures. 239 241 if (mapillaryImage.next() != null) { 240 242 new MapillaryCache(mapillaryImage.next().getKey(), -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31328 r31331 64 64 "mapillary.sequence-max-jump-distance", 100); 65 65 66 private boolean TEMP_MANUAL = false; 67 66 68 public static MapillaryLayer INSTANCE; 67 69 public static CacheAccess<String, BufferedImageCacheEntry> CACHE; … … 82 84 private volatile TexturePaint hatched; 83 85 84 p ublicMapillaryLayer() {86 private MapillaryLayer() { 85 87 super(tr("Mapillary Images")); 86 88 bounds = new ArrayList<>(); … … 92 94 */ 93 95 private void init() { 94 MapillaryLayer.INSTANCE = this; 95 startMouseAdapter(); 96 mouseAdapter = new MapillaryMouseAdapter(); 96 97 try { 97 98 CACHE = JCSCacheManager.getCache("Mapillary"); … … 115 116 } 116 117 117 private void startMouseAdapter() {118 mouseAdapter = new MapillaryMouseAdapter();119 }120 121 118 public synchronized static MapillaryLayer getInstance() { 122 119 if (MapillaryLayer.INSTANCE == null) … … 130 127 */ 131 128 public void download() { 132 check BigAreas();133 if (Main.pref.getBoolean("mapillary.download-manually") )129 checkAreaTooBig(); 130 if (Main.pref.getBoolean("mapillary.download-manually") || TEMP_MANUAL) 134 131 return; 135 132 for (Bounds bounds : Main.map.mapView.getEditLayer().data … … 149 146 * shown and you will have to download areas manually. 150 147 */ 151 private void check BigAreas() {148 private void checkAreaTooBig() { 152 149 double area = 0; 153 150 for (Bounds bounds : Main.map.mapView.getEditLayer().data … … 156 153 } 157 154 if (area > MapillaryDownloadViewAction.MAX_AREA) { 158 Main.pref.put("mapillary.download-manually", true); 155 TEMP_MANUAL = true; 156 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, 157 true); 159 158 JOptionPane 160 159 .showMessageDialog( 161 160 Main.parent, 162 tr("The downloaded OSM area is too big. Download mode has been change to manual. You can change this back to automatic in preferences settings."));161 tr("The downloaded OSM area is too big. Download mode has been changed to manual until the layer is restarted.")); 163 162 } 164 163 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31328 r31331 16 16 17 17 /** 18 * Action that triggers the plugin. 18 * Action that triggers the plugin. If in automatic mode, it will automatically 19 * download the images in the areas where there is OSM data. 19 20 * 20 21 * @author nokutu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
r31321 r31331 15 15 import org.openstreetmap.josm.tools.Shortcut; 16 16 17 /** 18 * If in manual mode, downloads all the images in the current view. 19 * 20 * @author nokutu 21 * 22 */ 17 23 public class MapillaryDownloadViewAction extends JosmAction { 18 24 … … 33 39 @Override 34 40 public void actionPerformed(ActionEvent arg0) { 35 MapillaryLayer.getInstance();36 41 MapillaryLayer.getInstance().bounds.add(Main.map.mapView 37 42 .getRealBounds()); … … 41 46 } else { 42 47 JOptionPane.showMessageDialog(Main.parent, 43 tr("This area too big to be downloaded"));48 tr("This area is too big to be downloaded")); 44 49 } 45 50 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31313 r31331 25 25 26 26 /** 27 * Action that launches a MapillaryExportDialog .27 * Action that launches a MapillaryExportDialog and lets you export the images. 28 28 * 29 29 * @author nokutu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandTurnImage.java
r31317 r31331 10 10 11 11 /** 12 * Command created when a image's direction is changed.12 * Command created when an image's direction is changed. 13 13 * 14 14 * @author nokutu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecord.java
r31280 r31331 6 6 7 7 /** 8 * History record system in order to let you undo commands8 * History record system in order to let the user undo and redo commands 9 9 * 10 10 * @author nokutu -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
r31328 r31331 11 11 12 12 /** 13 * Class that concentrates all the ways of downloading of the plugin. 13 * Class that concentrates all the ways of downloading of the plugin. All the 14 * download petitions will be managed one by one. 14 15 * 15 16 * @author nokutu … … 62 63 } 63 64 65 /** 66 * Gets the images within the given bounds. 67 * 68 * @param bounds 69 */ 64 70 public void getImages(Bounds bounds) { 65 71 getImages(bounds.getMin(), bounds.getMax()); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportDownloadThread.java
r31278 r31331 19 19 /** 20 20 * This is the thread that downloads one of the images that are going to be 21 * exported and writes them in a {@link ArrayBlock Queue}.21 * exported and writes them in a {@link ArrayBlockingQueue}. 22 22 * 23 23 * @author nokutu 24 24 * @see MapillaryExportManager 25 25 */ 26 public class MapillaryExportDownloadThread implements Runnable,26 public class MapillaryExportDownloadThread extends Thread implements 27 27 ICachedLoaderListener { 28 28 … … 48 48 new MapillaryCache(image.getKey(), MapillaryCache.Type.FULL_IMAGE) 49 49 .submit(this, false); 50 51 50 } 52 51 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportManager.java
r31278 r31331 21 21 /** 22 22 * Export main thread. Exportation works by creating a 23 * {@link Mapillary WriterThread} and several23 * {@link MapillaryExportWriterThread} and several 24 24 * {@link MapillaryExportDownloadThread}. The second ones download every single 25 25 * image that is going to be exported and stores them in an … … 38 38 List<MapillaryAbstractImage> images; 39 39 String path; 40 41 private Thread writer; 42 private ThreadPoolExecutor ex; 40 43 41 44 public MapillaryExportManager(List<MapillaryAbstractImage> images, … … 72 75 @Override 73 76 protected void cancel() { 74 // TODO Auto-generated method stub 77 writer.interrupt(); 78 ex.shutdown(); 75 79 } 76 80 … … 79 83 OsmTransferException { 80 84 // Starts a writer thread in order to write the pictures on the disk. 81 Thread writer = new Thread(new MapillaryExportWriterThread(path, queue,82 queueImages, amount, this.getProgressMonitor()) );85 writer = new MapillaryExportWriterThread(path, queue, 86 queueImages, amount, this.getProgressMonitor()); 83 87 writer.start(); 84 88 if (path == null) { … … 90 94 return; 91 95 } 92 ThreadPoolExecutorex = new ThreadPoolExecutor(20, 35, 25,96 ex = new ThreadPoolExecutor(20, 35, 25, 93 97 TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10)); 94 98 for (MapillaryAbstractImage image : images) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryExportWriterThread.java
r31328 r31331 32 32 * @see MapillaryExportManager 33 33 */ 34 public class MapillaryExportWriterThread implements Runnable{34 public class MapillaryExportWriterThread extends Thread { 35 35 36 36 private final String path; … … 103 103 os.close(); 104 104 } catch (InterruptedException e) { 105 Main.error(e); 105 Main.info("Mapillary export cancelled"); 106 return; 106 107 } catch (IOException e) { 107 108 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloaderThread.java
r31328 r31331 22 22 * 23 23 * @author nokutu 24 * @see MapillarySqu eareDownloadManagerThread24 * @see MapillarySquareDownloadManagerThread 25 25 */ 26 public class MapillaryImageInfoDownloaderThread implements Runnable{26 public class MapillaryImageInfoDownloaderThread extends Thread { 27 27 private final String url; 28 28 private final ExecutorService ex; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java
r31328 r31331 27 27 * 28 28 * @author nokutu 29 * @see MapillarySquareDownloadManag arThread29 * @see MapillarySquareDownloadManagerThread 30 30 */ 31 public class MapillarySequenceDownloadThread implements Runnable{31 public class MapillarySequenceDownloadThread extends Thread { 32 32 33 33 private final String url; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySignDownloaderThread.java
r31328 r31331 17 17 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 18 18 19 public class MapillarySignDownloaderThread implements Runnable{19 public class MapillarySignDownloaderThread extends Thread { 20 20 21 21 private final String url; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java
r31328 r31331 21 21 * @see MapillaryDownloader 22 22 */ 23 public class MapillarySquareDownloadManagerThread implements Runnable{23 public class MapillarySquareDownloadManagerThread extends Thread { 24 24 25 25 private final String urlImages; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
r31278 r31331 7 7 import java.awt.event.ActionListener; 8 8 9 import javax.swing.AbstractAction; 9 10 import javax.swing.BoxLayout; 10 11 import javax.swing.ButtonGroup; … … 16 17 import javax.swing.JRadioButton; 17 18 19 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; 18 20 import org.openstreetmap.josm.plugins.mapillary.MapillaryData; 19 21 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage; 22 import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage; 20 23 21 24 /** … … 49 52 public MapillaryExportDialog() { 50 53 setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); 51 54 55 RewriteButtonAction action = new RewriteButtonAction(this); 52 56 group = new ButtonGroup(); 53 all = new JRadioButton(tr("Export all images")); 54 sequence = new JRadioButton(tr("Export selected sequence")); 55 selected = new JRadioButton(tr("Export selected images")); 56 rewrite = new JRadioButton(tr("Rewrite imported images")); 57 all = new JRadioButton(action); 58 all.setText(tr("Export all images")); 59 sequence = new JRadioButton(action); 60 sequence.setText(tr("Export selected sequence")); 61 selected = new JRadioButton(action); 62 selected.setText(tr("Export selected images")); 63 rewrite = new JRadioButton(action); 64 rewrite.setText(tr("Rewrite imported images")); 57 65 group.add(all); 58 66 group.add(sequence); … … 68 76 selected.setEnabled(false); 69 77 } 78 rewrite.setEnabled(false); 79 for (MapillaryAbstractImage img : MapillaryData.getInstance().getImages()) 80 if (img instanceof MapillaryImportedImage) 81 rewrite.setEnabled(true); 82 70 83 path = new JLabel(tr("Select a folder")); 71 84 choose = new JButton(tr("Explore")); … … 105 118 } 106 119 } 120 121 public class RewriteButtonAction extends AbstractAction { 122 123 private String lastPath; 124 private MapillaryExportDialog dlg; 125 126 public RewriteButtonAction(MapillaryExportDialog dlg) { 127 this.dlg = dlg; 128 } 129 130 @Override 131 public void actionPerformed(ActionEvent arg0) { 132 choose.setEnabled(!rewrite.isSelected()); 133 if (rewrite.isSelected()) { 134 lastPath = dlg.path.getText(); 135 dlg.path.setText(" "); 136 } 137 else if (lastPath != null){ 138 dlg.path.setText(lastPath); 139 } 140 141 } 142 143 } 107 144 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31284 r31331 30 30 import javax.swing.tree.DefaultMutableTreeNode; 31 31 32 /** 33 * Toggle dialog that shows you the latest commands done and allows the user to 34 * revert them. 35 * 36 * @see MapillaryRecord 37 * @author nokutu 38 * 39 */ 32 40 public class MapillaryHistoryDialog extends ToggleDialog implements 33 41 MapillaryRecordListener { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31278 r31331 28 28 * 29 29 * @author Jorge 30 * @see ImageDisplay30 * @see MapillaryImageDisplay 31 31 * @see MapillaryToggleDialog 32 32 */
Note:
See TracChangeset
for help on using the changeset viewer.