Changeset 34429 in osm for applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap
- Timestamp:
- 2018-07-19T02:09:21+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java
r34428 r34429 27 27 protected String id; 28 28 29 // Image id of next image in sequence (decimal) 29 30 private long ne; 30 private long pr; 31 32 33 /** The time the image was captured, in Epoch format. */ 34 protected long cd; 31 //Image id of previous image in sequence (decimal) 32 private long pr; 33 34 35 35 /** Sequence of pictures containing this object. */ 36 36 private StreetsideSequence sequence; … … 38 38 /** Position of the picture. */ 39 39 protected LatLon latLon; 40 /** Direction of the picture. */ 40 /** Direction of the picture in degrees from true north. */ 41 41 protected double he; 42 42 /** Temporal position of the picture until it is uploaded. */ … … 116 116 117 117 /** 118 * Returns the Epoch time when the image was captured.119 *120 * @return The long containing the Epoch time when the image was captured.121 */122 public long getCd() {123 return cd;124 }125 126 /**127 * Returns the date the picture was taken in DMY format.128 *129 * @return A String object containing the date when the picture was taken.130 */131 public String getDate() {132 final StringBuilder format = new StringBuilder(26);133 format.append("m/d/YYYY");134 if (StreetsideProperties.DISPLAY_HOUR.get()) {135 if (StreetsideProperties.TIME_FORMAT_24.get()) {136 format.append(" - HH:mm:ss");137 } else {138 format.append(" - h:mm:ss a");139 }140 }141 return getDate(format.toString());142 }143 144 /**145 * Returns the date the picture was taken in the given format.146 *147 * @param format148 * Format of the date. See {@link SimpleDateFormat}.149 * @return A String containing the date the picture was taken using the given150 * format.151 * @throws NullPointerException152 * if parameter format is <code>null</code>153 */154 public String getDate(String format) {155 final Date date = new Date(getCd());156 final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.US);157 formatter.setTimeZone(Calendar.getInstance().getTimeZone());158 return formatter.format(date);159 }160 161 /**162 118 * Returns a LatLon object containing the original coordinates of the object. 163 119 * … … 227 183 */ 228 184 public boolean isModified() { 229 return !getMovingLatLon().equals(latLon) || Math.abs(getMovingHe() - cd) > EPSILON;185 return !getMovingLatLon().equals(latLon) || Math.abs(getMovingHe() - he) > EPSILON; 230 186 } 231 187 … … 277 233 public void setHe(final double he) { 278 234 this.he = he; 279 }280 281 /**282 * Sets the Epoch time when the picture was captured.283 *284 * @param cd285 * Epoch time when the image was captured.286 */287 public synchronized void setCd(final long cd) {288 this.cd = cd;289 235 } 290 236 … … 339 285 * The angle the image is moving. 340 286 */ 341 public void turn(final double ca) {342 movingHe = tempHe + ca;287 public void turn(final double he) { 288 movingHe = tempHe + he; 343 289 } 344 290 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideData.java
r34358 r34429 245 245 */ 246 246 public void selectNext(boolean moveToPicture) { 247 if (getSelectedImage() == null) {248 throw new IllegalStateException();249 }250 if (getSelectedImage().getSequence() == null) {251 throw new IllegalStateException();252 }253 247 StreetsideAbstractImage tempImage = selectedImage; 254 while (tempImage.next() != null) { 255 tempImage = tempImage.next(); 256 if (tempImage.isVisible()) { 257 setSelectedImage(tempImage, moveToPicture); 258 break; 248 if (selectedImage != null && selectedImage.getSequence() != null) { 249 while (tempImage.next() != null) { 250 tempImage = tempImage.next(); 251 if (tempImage.isVisible()) { 252 setSelectedImage(tempImage, moveToPicture); 253 break; 254 } 259 255 } 260 256 } … … 284 280 */ 285 281 public void selectPrevious(boolean moveToPicture) { 286 if (getSelectedImage() == null) { 287 throw new IllegalStateException(); 288 } 289 if (getSelectedImage().getSequence() == null) { 290 throw new IllegalStateException(); 291 } 292 StreetsideAbstractImage tempImage = selectedImage; 293 while (tempImage.previous() != null) { 294 tempImage = tempImage.previous(); 295 if (tempImage.isVisible()) { 296 setSelectedImage(tempImage, moveToPicture); 297 break; 282 if (selectedImage != null && selectedImage.getSequence() != null) { 283 StreetsideAbstractImage tempImage = selectedImage; 284 while (tempImage.previous() != null) { 285 tempImage = tempImage.previous(); 286 if (tempImage.isVisible()) { 287 setSelectedImage(tempImage, moveToPicture); 288 break; 289 } 298 290 } 299 291 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideImage.java
r34416 r34429 73 73 // Default constructor for Jackson/JSON Deserializattion 74 74 public StreetsideImage() { 75 super(CubemapUtils. IMPORTED_ID, null, 0.0);75 super(CubemapUtils.TEST_IMAGE_ID, null, 0.0); 76 76 } 77 77 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java
r34416 r34429 322 322 final Color directionC; 323 323 if (selectedImg != null && getData().getMultiSelectedImages().contains(img)) { 324 markerC = img instanceof StreetsideImportedImage 325 ? StreetsideColorScheme.SEQ_IMPORTED_HIGHLIGHTED 326 : StreetsideColorScheme.SEQ_HIGHLIGHTED; 327 directionC = img instanceof StreetsideImportedImage 328 ? StreetsideColorScheme.SEQ_IMPORTED_HIGHLIGHTED_CA 329 : StreetsideColorScheme.SEQ_HIGHLIGHTED_CA; 324 markerC = StreetsideColorScheme.SEQ_HIGHLIGHTED; 325 directionC = StreetsideColorScheme.SEQ_HIGHLIGHTED_CA; 330 326 } else if (selectedImg != null && selectedImg.getSequence() != null && selectedImg.getSequence().equals(img.getSequence())) { 331 markerC = img instanceof StreetsideImportedImage 332 ? StreetsideColorScheme.SEQ_IMPORTED_SELECTED 333 : StreetsideColorScheme.SEQ_SELECTED; 334 directionC = img instanceof StreetsideImportedImage 335 ? StreetsideColorScheme.SEQ_IMPORTED_SELECTED_CA 336 : StreetsideColorScheme.SEQ_SELECTED_CA; 327 markerC = StreetsideColorScheme.SEQ_SELECTED; 328 directionC = StreetsideColorScheme.SEQ_SELECTED_CA; 337 329 } else { 338 markerC = img instanceof StreetsideImportedImage 339 ? StreetsideColorScheme.SEQ_IMPORTED_UNSELECTED 340 : StreetsideColorScheme.SEQ_UNSELECTED; 341 directionC = img instanceof StreetsideImportedImage 342 ? StreetsideColorScheme.SEQ_IMPORTED_UNSELECTED_CA 343 : StreetsideColorScheme.SEQ_UNSELECTED_CA; 330 markerC = StreetsideColorScheme.SEQ_UNSELECTED; 331 directionC = StreetsideColorScheme.SEQ_UNSELECTED_CA; 344 332 } 345 333 346 334 // Paint direction indicator 347 335 g.setColor(directionC); 348 g.fillArc(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, (int) (90 - img.getMovingHe() - CA_INDICATOR_ANGLE / 2d), CA_INDICATOR_ANGLE); 336 g.fillArc(p.x - CA_INDICATOR_RADIUS, p.y - CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, 2 * CA_INDICATOR_RADIUS, (int) (90 - /*img.getMovingHe()*/img.getHe() - CA_INDICATOR_ANGLE / 2d), CA_INDICATOR_ANGLE); 349 337 // Paint image marker 350 338 g.setColor(markerC); … … 397 385 )) 398 386 .append("\n\n") 399 .append(I18n.tr(400 "{0} imported images",401 getData().getImages().stream().filter(i -> i instanceof StreetsideImportedImage).count()402 ))403 387 .append("\n+ ") 404 388 .append(I18n.tr( … … 489 473 } 490 474 if (MainApplication.isDisplayingMapView()) { 491 //StreetsideMainDialog.getInstance().redButton.setEnabled(nearestImages.length >= 1);492 //StreetsideMainDialog.getInstance().blueButton.setEnabled(nearestImages.length >= 2);475 StreetsideMainDialog.getInstance().redButton.setEnabled(nearestImages.length >= 1); 476 StreetsideMainDialog.getInstance().blueButton.setEnabled(nearestImages.length >= 2); 493 477 } 494 478 if (nearestImages.length >= 1) { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsidePlugin.java
r34416 r34429 25 25 import org.openstreetmap.josm.tools.ImageProvider; 26 26 27 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel; 28 27 29 /** 28 30 * This is the main class of the Streetside plugin. … … 43 45 MainMenu.add(MainApplication.getMenu().viewMenu, ZOOM_ACTION, false, 15); 44 46 MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideDownloadViewAction(), false, 14); 45 //MainMenu.add(MainApplication.getMenu().dataMenu, new StreetsideJoinAction(), false);46 47 MainMenu.add(MainApplication.getMenu().moreToolsMenu, WALK_ACTION, false); 47 48 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideExportAction.java
r34399 r34429 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.KeyEvent; 9 import java.io.IOException;10 import java.util.ArrayList;11 9 import java.util.Set; 12 10 import java.util.concurrent.ConcurrentSkipListSet; … … 22 20 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 23 21 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 24 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;25 22 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 26 23 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin; … … 94 91 export(StreetsideLayer.getInstance().getData().getMultiSelectedImages()); 95 92 } 96 // This option ignores the selected directory.97 } else if (dialog.group.isSelected(dialog.rewrite.getModel())) {98 ArrayList<StreetsideImportedImage> images = new ArrayList<>();99 StreetsideLayer.getInstance().getData().getImages().stream().filter(img -> img instanceof StreetsideImportedImage).forEach(img -> images.add((StreetsideImportedImage) img));100 try {101 MainApplication.worker.execute(new StreetsideExportManager(images));102 } catch (IOException e1) {103 logger.error(e1);104 }105 93 } 106 94 dlg.dispose(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34428 r34429 35 35 private static CubemapBuilder instance; 36 36 private StreetsideCubemap cubemap; 37 protected boolean cancelled; 38 private long startTime; 37 protected boolean isBuilding; 38 39 private long startTime; 39 40 40 41 private Map<String, BufferedImage> tileImages = new ConcurrentHashMap<>(); … … 81 82 @Override 82 83 public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 84 85 83 86 startTime = System.currentTimeMillis(); 84 87 … … 87 90 cubemap = null; 88 91 cubemap = new StreetsideCubemap(newImage.getId(), newImage.getLatLon(), newImage.getHe()); 89 cubemap.setCd(newImage.getCd()); 92 currentTileCount = 0; 93 resetTileImages(); 90 94 91 95 // download cubemap images in different threads and then subsequently … … 149 153 150 154 List<Future<List<String>>> results = pool.invokeAll(tasks); 151 /*for (Future<List<String>> ff : results) { 152 153 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 155 for (Future<List<String>> ff : results) { 156 if (StreetsideProperties.DEBUGING_ENABLED.get() && results!=null) { 154 157 logger.debug( 155 158 MessageFormat.format( 156 159 "Completed tile downloading task {0} in {1} seconds.", ff.get().toString(), 157 (System.currentTimeMillis()) / 1000- startTime)160 ((System.currentTimeMillis()) - startTime)/1000) 158 161 ); 162 } else { 163 logger.error(MessageFormat.format("Results of downloading tasks for image id {0} are null!", imageId)); 159 164 } 160 } */165 } 161 166 162 167 // launch 16-tiled (high-res) downloading tasks … … 178 183 List<Future<List<String>>> results = pool.invokeAll(tasks); 179 184 for (Future<List<String>> ff : results) { 180 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 185 if (StreetsideProperties.DEBUGING_ENABLED.get() && results!=null) { 181 186 logger.debug( 182 187 MessageFormat.format( … … 184 189 ((System.currentTimeMillis()) - startTime)/1000) 185 190 ); 191 } else { 192 logger.error(MessageFormat.format("Results of downloading tasks for image id {0} are null!", imageId)); 186 193 } 187 194 } … … 218 225 // and set the views in the cubemap box. 219 226 220 if( currentTileCount>96) {221 int x = 0;227 if(!tileId.startsWith(cubemap.getId())) { 228 return; 222 229 } 223 230 … … 328 335 resetTileImages(); 329 336 currentTileCount = 0; 337 isBuilding = false; 330 338 } 331 339 … … 364 372 365 373 /** 374 * @return the isBuilding 375 */ 376 public boolean isBuilding() { 377 return isBuilding; 378 } 379 380 381 /** 366 382 * Destroys the unique instance of the class. 367 383 */ -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java
r34428 r34429 72 72 // numerical base for decimal conversion (quaternary in the case of Streetside) 73 73 private static final int NUM_BASE = 4; 74 public static final String IMPORTED_ID = "00000000";74 public static final String TEST_IMAGE_ID = "00000000"; 75 75 public static final int NUM_SIDES = 6; 76 76 public static Map<String,String> rowCol2StreetsideCellAddressMap = null; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideExportDialog.java
r34349 r34429 18 18 19 19 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 20 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;21 20 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 22 21 … … 42 41 */ 43 42 public final JRadioButton selected; 44 /** Button to rewrite all imported images. */45 public final JRadioButton rewrite;46 43 /** Group of button containing all the options. */ 47 44 public final ButtonGroup group; … … 65 62 66 63 RewriteButtonAction action = new RewriteButtonAction(this); 67 this.group = new ButtonGroup(); 68 this.all = new JRadioButton(action); 69 this.all.setText(tr("Export all images")); 70 this.sequence = new JRadioButton(action); 71 this.sequence.setText(tr("Export selected sequence")); 72 this.selected = new JRadioButton(action); 73 this.selected.setText(tr("Export selected images")); 74 this.rewrite = new JRadioButton(action); 75 this.rewrite.setText(tr("Rewrite imported images")); 76 this.group.add(this.all); 77 this.group.add(this.sequence); 78 this.group.add(this.selected); 79 this.group.add(this.rewrite); 64 group = new ButtonGroup(); 65 all = new JRadioButton(action); 66 all.setText(tr("Export all images")); 67 sequence = new JRadioButton(action); 68 sequence.setText(tr("Export selected sequence")); 69 selected = new JRadioButton(action); 70 selected.setText(tr("Export selected images")); 71 group.add(all); 72 group.add(sequence); 73 group.add(selected); 80 74 // Some options are disabled depending on the circumstances 81 75 sequence.setEnabled(StreetsideLayer.getInstance().getData().getSelectedImage() instanceof StreetsideImage); 82 76 if (StreetsideLayer.getInstance().getData().getMultiSelectedImages().isEmpty()) { 83 this.selected.setEnabled(false);77 selected.setEnabled(false); 84 78 } 85 this.rewrite.setEnabled(StreetsideLayer.getInstance().getData().getImages().parallelStream().anyMatch(img -> img instanceof StreetsideImportedImage));86 79 87 this.path = new JLabel(tr("Select a directory"));88 this.choose = new JButton(tr("Explore"));89 this.choose.addActionListener(this);80 path = new JLabel(tr("Select a directory")); 81 choose = new JButton(tr("Explore")); 82 choose.addActionListener(this); 90 83 91 84 // All options belong to the same JPanel so the are in line. 92 85 JPanel jpanel = new JPanel(); 93 86 jpanel.setLayout(new BoxLayout(jpanel, BoxLayout.PAGE_AXIS)); 94 jpanel.add(this.all); 95 jpanel.add(this.sequence); 96 jpanel.add(this.selected); 97 jpanel.add(this.rewrite); 87 jpanel.add(all); 88 jpanel.add(sequence); 89 jpanel.add(selected); 98 90 jpanel.setAlignmentX(Component.CENTER_ALIGNMENT); 99 this.path.setAlignmentX(Component.CENTER_ALIGNMENT);100 this.choose.setAlignmentX(Component.CENTER_ALIGNMENT);91 path.setAlignmentX(Component.CENTER_ALIGNMENT); 92 choose.setAlignmentX(Component.CENTER_ALIGNMENT); 101 93 102 94 add(jpanel); 103 add( this.path);104 add( this.choose);95 add(path); 96 add(choose); 105 97 } 106 98 … … 110 102 @Override 111 103 public void actionPerformed(ActionEvent e) { 112 this.chooser = new JFileChooser();113 this.chooser.setCurrentDirectory(new java.io.File(System104 chooser = new JFileChooser(); 105 chooser.setCurrentDirectory(new java.io.File(System 114 106 .getProperty("user.home"))); 115 this.chooser.setDialogTitle(tr("Select a directory"));116 this.chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);117 this.chooser.setAcceptAllFileFilterUsed(false);107 chooser.setDialogTitle(tr("Select a directory")); 108 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 109 chooser.setAcceptAllFileFilterUsed(false); 118 110 119 if ( this.chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {120 this.path.setText(this.chooser.getSelectedFile().toString());121 this.updateUI();122 this.ok.setEnabled(true);111 if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { 112 path.setText(chooser.getSelectedFile().toString()); 113 updateUI(); 114 ok.setEnabled(true); 123 115 } 124 116 } … … 148 140 } 149 141 142 @SuppressWarnings("synthetic-access") 150 143 @Override 151 144 public void actionPerformed(ActionEvent arg0) { 152 StreetsideExportDialog.this.choose 153 .setEnabled(!StreetsideExportDialog.this.rewrite.isSelected()); 154 if (StreetsideExportDialog.this.rewrite.isSelected()) { 155 this.lastPath = this.dlg.path.getText(); 156 this.dlg.path.setText(" "); 157 } else if (this.lastPath != null) { 158 this.dlg.path.setText(this.lastPath); 145 choose 146 .setEnabled(true); 147 if (lastPath != null) { 148 dlg.path.setText(lastPath); 159 149 } 160 150 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java
r34428 r34429 8 8 import java.io.ByteArrayInputStream; 9 9 import java.io.IOException; 10 import java.text.MessageFormat; 11 import java.util.Arrays; 10 12 import java.util.List; 11 13 … … 13 15 import javax.swing.AbstractAction; 14 16 import javax.swing.Action; 17 import javax.swing.JComponent; 18 import javax.swing.KeyStroke; 15 19 import javax.swing.SwingUtilities; 16 20 … … 24 28 import org.openstreetmap.josm.plugins.streetside.StreetsideDataListener; 25 29 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 26 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;27 30 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 28 31 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin; … … 31 34 import org.openstreetmap.josm.plugins.streetside.cache.StreetsideCache; 32 35 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.ImageInfoHelpPopup; 33 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerHelpPopup;34 36 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 35 37 import org.openstreetmap.josm.tools.I18n; … … 57 59 private volatile StreetsideAbstractImage image; 58 60 59 private ImageInfoHelpPopup imageInfoHelp; 60 61 private StreetsideViewerHelpPopup streetsideViewerHelp; 61 private final SideButton nextButton = new SideButton(new NextPictureAction()); 62 private final SideButton previousButton = new SideButton(new PreviousPictureAction()); 63 /** 64 * Button used to jump to the image following the red line 65 */ 66 public final SideButton redButton = new SideButton(new RedAction()); 67 /** 68 * Button used to jump to the image following the blue line 69 */ 70 public final SideButton blueButton = new SideButton(new BlueAction()); 71 72 private final SideButton playButton = new SideButton(new PlayAction()); 73 private final SideButton pauseButton = new SideButton(new PauseAction()); 74 private final SideButton stopButton = new SideButton(new StopAction()); 75 76 private ImageInfoHelpPopup imageInfoHelp; 62 77 63 78 /** … … 98 113 * Adds the shortcuts to the buttons. 99 114 */ 100 private void addShortcuts() { 101 // next, previous, blueAction and redAction from Mapillary removed 102 } 115 private void addShortcuts() { 116 nextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_DOWN"), "next"); 117 nextButton.getActionMap().put("next", new NextPictureAction()); 118 previousButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_UP"), "previous"); 119 previousButton.getActionMap().put("previous", new PreviousPictureAction()); 120 blueButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control PAGE_UP"), "blue"); 121 blueButton.getActionMap().put("blue", new BlueAction()); 122 redButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control PAGE_DOWN"), "red"); 123 redButton.getActionMap().put("red", new RedAction()); 124 } 103 125 104 126 /** … … 125 147 } 126 148 127 public synchronized void setStreetsideViewerHelp(StreetsideViewerHelpPopup popup) {128 streetsideViewerHelp = popup;129 }130 131 /**132 * @return the streetsideViewerHelp133 */134 public StreetsideViewerHelpPopup getStreetsideViewerHelp() {135 return streetsideViewerHelp;136 }137 138 149 /** 139 150 * Sets a new mode for the dialog. … … 144 155 switch (mode) { 145 156 case WALK: 146 createLayout( 147 streetsideImageDisplay, 148 null 149 // TODO: Walk Action for Streetside - re-add buttons here 150 ); 151 case NORMAL: 152 default: 153 createLayout( 154 streetsideImageDisplay, 155 null 156 ); 157 } 158 159 if (MODE.NORMAL.equals(mode)) { 160 updateImage(); 161 } } 157 createLayout( 158 streetsideImageDisplay, 159 Arrays.asList(playButton, pauseButton, stopButton) 160 ); 161 break; 162 case NORMAL: 163 default: 164 createLayout( 165 streetsideImageDisplay, 166 Arrays.asList(blueButton, previousButton, nextButton, redButton) 167 ); 168 break; 169 } 170 disableAllButtons(); 171 if (MODE.NORMAL.equals(mode)) { 172 updateImage(); 173 } 174 revalidate(); 175 repaint(); 176 } 162 177 163 178 /** … … 201 216 } 202 217 203 if (image.getSequence() != null) {204 StreetsideAbstractImage tempImage = image;205 while (tempImage.next() != null) {206 tempImage = tempImage.next();207 if (tempImage.isVisible()) {208 //nextButton.setEnabled(true);209 break;210 }211 }212 }213 if (image.getSequence() != null) {214 StreetsideAbstractImage tempImage = image;215 while (tempImage.previous() != null) {216 tempImage = tempImage.previous();217 if (tempImage.isVisible()) {218 break;219 }220 }221 }222 218 if (image instanceof StreetsideImage) { 223 219 final StreetsideImage streetsideImage = (StreetsideImage) image; … … 255 251 256 252 /** 253 * Disables all the buttons in the dialog 254 */ 255 private void disableAllButtons() { 256 nextButton.setEnabled(false); 257 previousButton.setEnabled(false); 258 blueButton.setEnabled(false); 259 redButton.setEnabled(false); 260 } 261 262 /** 257 263 * Sets a new StreetsideImage to be shown. 258 264 * … … 272 278 final StringBuilder title = new StringBuilder(I18n.tr(StreetsideMainDialog.BASE_TITLE)); 273 279 if (image instanceof StreetsideImage) { 274 final StreetsideImage streetsideImage = (StreetsideImage) image; 275 if (streetsideImage.getCd() != 0) { 276 title.append(StreetsideMainDialog.MESSAGE_SEPARATOR).append(streetsideImage.getDate()); 277 } 278 setTitle(title.toString()); 279 } else if (image instanceof StreetsideImportedImage) { 280 final StreetsideImportedImage mapillaryImportedImage = (StreetsideImportedImage) image; 281 title.append(StreetsideMainDialog.MESSAGE_SEPARATOR).append(mapillaryImportedImage.getFile().getName()); 282 title.append(StreetsideMainDialog.MESSAGE_SEPARATOR).append(mapillaryImportedImage.getDate()); 283 setTitle(title.toString()); 280 title.append(StreetsideMainDialog.MESSAGE_SEPARATOR).append(MessageFormat.format("(heading {0}°)",Double.toString(image.getHe()))); 281 setTitle(title.toString()); 284 282 } 285 283 } … … 533 531 public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 534 532 setImage(newImage); 533 if (newImage.getSequence() != null && newImage.next()!=null) { 534 nextButton.setEnabled(true); 535 } 536 if (newImage.getSequence() != null && newImage.previous()!=null) { 537 previousButton.setEnabled(true); 538 } 535 539 updateImage(); 536 540 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideViewerDialog.java
r34416 r34429 8 8 import org.openstreetmap.josm.gui.SideButton; 9 9 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 10 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerHelpPopup; 10 11 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel; 11 12 … … 24 25 25 26 private static StreetsideViewerDialog instance; 27 28 // TODO: enable help without StreetsideViewerPanel being a ToggleDialog 29 private StreetsideViewerHelpPopup streetsideViewerHelpPopup; 26 30 27 31 /** … … 81 85 } 82 86 87 public void setStreetsideViewerHelpPopup(StreetsideViewerHelpPopup svhp) { 88 streetsideViewerHelpPopup = svhp; 89 } 90 83 91 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34428 r34429 38 38 private static ThreeSixtyDegreeViewerPanel threeSixtyDegreeViewerPanel; 39 39 40 private StreetsideViewerHelpPopup streetsideViewerHelp; 41 40 42 public StreetsideViewerPanel() { 41 43 … … 43 45 44 46 SwingUtilities.invokeLater(new Runnable() { 45 @Override 47 @SuppressWarnings("synthetic-access") 48 @Override 46 49 public void run() { 47 50 initializeAndStartGUI(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34428 r34429 77 77 if (node.get("id") != null && node.get("la") != null && node.get("lo") != null) { 78 78 StreetsideImage image = new StreetsideImage(CubemapUtils.convertDecimal2Quaternary(node.path("id").asLong()), node.path("la").asDouble(), node.get("lo").asDouble()); 79 if(previous!=null) { 80 image.setPr(Long.parseLong(previous.getId())); 81 previous.setNe(Long.parseLong(image.getId())); 82 83 } 79 84 previous = image; 80 85 image.setAd(node.path("ad").asInt()); 81 86 image.setAl(node.path("al").asDouble()); 82 87 image.setBl(node.path("bl").asText()); 83 image.setCd(node.path("cd").asLong());84 88 image.setHe(node.path("he").asDouble()); 85 89 image.setMl(node.path("ml").asInt()); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportManager.java
r34365 r34429 7 7 import java.io.IOException; 8 8 import java.util.HashSet; 9 import java.util.List;10 9 import java.util.Set; 11 10 import java.util.concurrent.ArrayBlockingQueue; … … 18 17 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 19 18 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 20 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;21 19 22 20 /** … … 63 61 } 64 62 65 /**66 * Constructor used to rewrite imported images.67 *68 * @param images69 * The set of {@link StreetsideImportedImage} object that is going to70 * be rewritten.71 * @throws IOException72 * If the file of one of the {@link StreetsideImportedImage} objects73 * doesn't contain a picture.74 */75 public StreetsideExportManager(List<StreetsideImportedImage> images) throws IOException {76 this(null, null);77 for (StreetsideImportedImage image : images) {78 queue.add(image.getImage());79 queueImages.add(image);80 }81 amount = images.size();82 }83 84 63 @Override 85 64 protected void cancel() { … … 112 91 logger.error(e); 113 92 } 114 } else if (image instanceof StreetsideImportedImage) {115 try {116 queue.put(((StreetsideImportedImage) image).getImage());117 queueImages.put(image);118 } catch (InterruptedException e) {119 logger.error(e);120 }121 93 } 122 94 try { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportWriterThread.java
r34365 r34429 14 14 import org.apache.commons.imaging.ImageReadException; 15 15 import org.apache.commons.imaging.ImageWriteException; 16 import org.apache.commons.imaging.Imaging;17 import org.apache.commons.imaging.common.ImageMetadata;18 16 import org.apache.commons.imaging.common.RationalNumber; 19 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;20 17 import org.apache.commons.imaging.formats.jpeg.exif.ExifRewriter; 21 import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;22 18 import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants; 23 19 import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants; … … 28 24 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; 29 25 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 30 import org.openstreetmap.josm.plugins.streetside.StreetsideImage;31 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;32 26 33 27 /** … … 82 76 img = queue.take(); 83 77 mimg = queueImages.take(); 84 if (path == null && mimg instanceof StreetsideImportedImage) { 85 String path = ((StreetsideImportedImage) mimg).getFile().getPath(); 86 finalPath = path.substring(0, path.lastIndexOf('.')); 87 } else if (mimg instanceof StreetsideImage) { 88 finalPath = path + '/' + ((StreetsideImage) mimg).getId(); 89 } else if (mimg instanceof StreetsideImportedImage) { 90 finalPath = path + '/' + ((StreetsideImportedImage) mimg).getFile().getName(); 91 } 78 92 79 93 80 // Transforms the image into a byte array. … … 101 88 TiffOutputDirectory gpsDirectory; 102 89 // If the image is imported, loads the rest of the EXIF data. 103 if (mimg instanceof StreetsideImportedImage) { 104 final ImageMetadata metadata = Imaging 105 .getMetadata(((StreetsideImportedImage) mimg).getFile()); 106 final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; 107 if (null != jpegMetadata) { 108 final TiffImageMetadata exif = jpegMetadata.getExif(); 109 if (null != exif) { 110 outputSet = exif.getOutputSet(); 111 } 112 } 113 } 90 114 91 if (null == outputSet) { 115 92 outputSet = new TiffOutputSet(); … … 127 104 128 105 exifDirectory.removeField(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 129 if (mimg instanceof StreetsideImportedImage) { 130 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 131 mimg.getDate("yyyy/MM/dd HH:mm:ss")); 132 } else if (mimg instanceof StreetsideImage) { 133 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 134 mimg.getDate("yyyy/MM/dd HH/mm/ss")); 135 } 106 136 107 outputSet.setGPSInDegrees(mimg.getMovingLatLon().lon(), mimg.getMovingLatLon().lat()); 137 108 OutputStream os = new BufferedOutputStream(new FileOutputStream(finalPath + ".jpg")); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideSequencesDecoder.java
r34325 r34429 95 95 result.setPbn(image.getPbn()); 96 96 result.setRn(image.getRn()); 97 result.setCd(image.getCd());98 97 } 99 98 return result;
Note:
See TracChangeset
for help on using the changeset viewer.