Changeset 34358 in osm for applications/editors/josm/plugins/MicrosoftStreetside/src
- Timestamp:
- 2018-06-28T08:33:24+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside
- Files:
-
- 2 deleted
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java
r34317 r34358 25 25 26 26 protected String id; 27 28 private long ne; 29 private long pr; 30 27 31 28 32 /** The time the image was captured, in Epoch format. */ … … 337 341 movingHe = tempHe + ca; 338 342 } 343 344 /** 345 * @return the ne 346 */ 347 public long getNe() { 348 return ne; 349 } 350 351 /** 352 * @param ne the ne to set 353 */ 354 public void setNe(long ne) { 355 this.ne = ne; 356 } 357 358 /** 359 * @return the pr 360 */ 361 public long getPr() { 362 return pr; 363 } 364 365 /** 366 * @param pr the pr to set 367 */ 368 public void setPr(long pr) { 369 this.pr = pr; 370 } 371 372 339 373 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideCubemap.java
r34317 r34358 20 20 public class StreetsideCubemap extends StreetsideAbstractImage implements Comparable<StreetsideAbstractImage>{ 21 21 22 private static Map<String,Map<String,BufferedImage>> face2TilesMap = new HashMap<String,Map<String,BufferedImage>>();22 //private static Map<String,Map<String,BufferedImage>> face2TilesMap = new HashMap<String,Map<String,BufferedImage>>(); 23 23 24 24 /** … … 43 43 public StreetsideCubemap(String quadId, LatLon latLon, double he) { 44 44 super(quadId, latLon, he); 45 face2TilesMap = new HashMap();45 /*face2TilesMap = new HashMap(); 46 46 47 47 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 48 48 face2TilesMap.put(face.getValue(), new HashMap<String, BufferedImage>()); 49 }); 49 });*/ 50 50 51 51 } … … 62 62 * @return the face2TilesMap 63 63 */ 64 public Map<String, Map<String,BufferedImage>> getFace2TilesMap() {64 /*public Map<String, Map<String,BufferedImage>> getFace2TilesMap() { 65 65 return face2TilesMap; 66 66 } 67 67 */ 68 68 /** 69 69 * Comparison method for the StreetsideCubemap object. … … 132 132 * resets the faces2TilesMap, emptying it for a new set of cubemap imagery 133 133 */ 134 public void resetFaces2TileMap() {134 /*public void resetFaces2TileMap() { 135 135 face2TilesMap = new HashMap<>(); 136 136 … … 138 138 face2TilesMap.put(face.getValue(), new HashMap<String, BufferedImage>()); 139 139 }); 140 } 140 }*/ 141 141 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideData.java
r34349 r34358 59 59 */ 60 60 protected StreetsideData() { 61 this.selectedImage = null;62 this.bounds = new CopyOnWriteArrayList<>();61 selectedImage = null; 62 bounds = new CopyOnWriteArrayList<>(); 63 63 64 64 // Adds the basic set of listeners. 65 65 Arrays.stream(StreetsidePlugin.getStreetsideDataListeners()).forEach(this::addListener); 66 66 if (Main.main != null) { 67 addListener(StreetsideViewerDialog.getInstance().getStreetsideViewerPanel()); 67 68 addListener(StreetsideMainDialog.getInstance()); 68 69 addListener(ImageInfoPanel.getInstance()); 69 addListener(StreetsideViewerDialog.getInstance().getStreetsideViewerPanel());70 70 } 71 71 } … … 135 135 */ 136 136 public void addMultiSelectedImage(final StreetsideAbstractImage image) { 137 if (! this.multiSelectedImages.contains(image)) {138 if ( this.getSelectedImage() == null) {137 if (!multiSelectedImages.contains(image)) { 138 if (getSelectedImage() == null) { 139 139 this.setSelectedImage(image); 140 140 } else { 141 this.multiSelectedImages.add(image);141 multiSelectedImages.add(image); 142 142 } 143 143 } … … 152 152 */ 153 153 public void addMultiSelectedImage(Collection<StreetsideAbstractImage> images) { 154 images.stream().filter(image -> ! this.multiSelectedImages.contains(image)).forEach(image -> {155 if ( this.getSelectedImage() == null) {154 images.stream().filter(image -> !multiSelectedImages.contains(image)).forEach(image -> { 155 if (getSelectedImage() == null) { 156 156 this.setSelectedImage(image); 157 157 } else { 158 this.multiSelectedImages.add(image);158 multiSelectedImages.add(image); 159 159 } 160 160 }); … … 190 190 */ 191 191 public StreetsideAbstractImage getHighlightedImage() { 192 return this.highlightedImage;192 return highlightedImage; 193 193 } 194 194 … … 317 317 */ 318 318 public void setSelectedImage(StreetsideAbstractImage image, boolean zoom) { 319 StreetsideAbstractImage oldImage = this.selectedImage;320 this.selectedImage = image;321 this.multiSelectedImages.clear();319 StreetsideAbstractImage oldImage = selectedImage; 320 selectedImage = image; 321 multiSelectedImages.clear(); 322 322 final MapView mv = StreetsidePlugin.getMapView(); 323 323 if (image != null) { 324 this.multiSelectedImages.add(image);324 multiSelectedImages.add(image); 325 325 if (mv != null && image instanceof StreetsideImage) { 326 326 StreetsideImage streetsideImage = (StreetsideImage) image; … … 333 333 mv.zoomTo(selectedImage.getMovingLatLon()); 334 334 } 335 fireSelectedImageChanged(oldImage, this.selectedImage);335 fireSelectedImageChanged(oldImage, selectedImage); 336 336 StreetsideLayer.invalidateInstance(); 337 337 } … … 368 368 } 369 369 370 /** 371 * Downloads surrounding images of this mapillary image in background threads 372 * @param streetsideImage the image for which the surrounding images should be downloaded 373 */ 374 public static void downloadSurroundingCubemaps(StreetsideImage streetsideImage) { 375 MainApplication.worker.execute(() -> { 376 final int prefetchCount = StreetsideProperties.PRE_FETCH_IMAGE_COUNT.get(); 377 CacheAccess<String, BufferedImageCacheEntry> imageCache = Caches.ImageCache.getInstance().getCache(); 378 379 StreetsideAbstractImage nextImage = streetsideImage.next(); 380 StreetsideAbstractImage prevImage = streetsideImage.previous(); 381 382 for (int i = 0; i < prefetchCount; i++) { 383 if (nextImage != null) { 384 if (nextImage instanceof StreetsideImage && imageCache.get(((StreetsideImage) nextImage).getId()) == null) { 385 CacheUtils.downloadCubemap((StreetsideImage) nextImage); 386 } 387 nextImage = nextImage.next(); 388 } 389 if (prevImage != null) { 390 if (prevImage instanceof StreetsideImage && imageCache.get(((StreetsideImage) prevImage).getId()) == null) { 391 CacheUtils.downloadCubemap((StreetsideImage) prevImage); 392 } 393 prevImage = prevImage.previous(); 394 } 395 } 396 }); 397 } 398 370 399 private void fireSelectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 371 400 listeners.stream().filter(Objects::nonNull).forEach(lis -> lis.selectedImageChanged(oldImage, newImage)); … … 379 408 */ 380 409 public Set<StreetsideAbstractImage> getMultiSelectedImages() { 381 return this.multiSelectedImages;410 return multiSelectedImages; 382 411 } 383 412 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideImage.java
r34349 r34358 42 42 private double pi; 43 43 44 // Heading (equivalent to Mapillary cd attribute - not currently supported.45 private double he;46 47 44 // Blurring instructions - not currently used by the plugin 48 45 private String bl; … … 50 47 // Undocumented Attributes 51 48 private int ml; 52 private long ne;53 private long pr;54 49 private List<String> nbn; 55 50 private List<String> pbn; … … 239 234 240 235 /** 241 * @return the ne242 */243 public long getNe() {244 return ne;245 }246 247 /**248 * @param ne the ne to set249 */250 public void setNe(long ne) {251 this.ne = ne;252 }253 254 /**255 * @return the pr256 */257 public long getPr() {258 return pr;259 }260 261 /**262 * @param pr the pr to set263 */264 public void setPr(long pr) {265 this.pr = pr;266 }267 268 /**269 236 * @return the nbn 270 237 */ -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java
r34349 r34358 12 12 import java.awt.RenderingHints; 13 13 import java.awt.TexturePaint; 14 import java.awt.event.ActionEvent;15 14 import java.awt.geom.Line2D; 16 import java.awt.geom.Path2D;17 15 import java.awt.image.BufferedImage; 18 16 import java.util.Comparator; … … 20 18 import java.util.Optional; 21 19 22 import javax.swing.AbstractAction;23 20 import javax.swing.Action; 24 21 import javax.swing.Icon; 25 import javax.swing.JComponent;26 import javax.swing.KeyStroke;27 22 28 23 import org.openstreetmap.josm.Main; … … 42 37 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 43 38 import org.openstreetmap.josm.plugins.streetside.cache.CacheUtils; 44 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideChangesetDialog;45 39 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideMainDialog; 40 import org.openstreetmap.josm.plugins.streetside.history.StreetsideRecord; 46 41 import org.openstreetmap.josm.plugins.streetside.io.download.StreetsideDownloader; 47 42 import org.openstreetmap.josm.plugins.streetside.io.download.StreetsideDownloader.DOWNLOAD_MODE; … … 57 52 import org.openstreetmap.josm.tools.Logging; 58 53 59 import org.openstreetmap.josm.plugins.streetside.history.StreetsideRecord;60 61 54 /** 62 55 * This class represents the layer shown in JOSM. There can only exist one … … 140 133 141 134 // There is no delete image action for Streetside (Streetside functionality here removed). 142 getLocationChangeset().addChangesetListener(StreetsideChangesetDialog.getInstance());135 //getLocationChangeset().addChangesetListener(StreetsideChangesetDialog.getInstance()); 143 136 } 144 137 createHatchTexture(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideSequence.java
r34325 r34358 7 7 8 8 import org.openstreetmap.josm.plugins.streetside.model.UserProfile; 9 10 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils; 9 11 10 12 /** … … 86 88 * @param images The set of {@link StreetsideAbstractImage} objects to be added. 87 89 */ 88 public synchronized void add(Collection<? extends StreetsideAbstractImage> images) { 90 @SuppressWarnings("unchecked") 91 public synchronized void add(final Collection<? extends StreetsideAbstractImage> images) { 92 Collection<? extends StreetsideAbstractImage> res = images; 93 res = StreetsideUtils.sortImagesInSequence((List<StreetsideAbstractImage>) images); 89 94 this.images.addAll(images); 90 95 images.forEach(img -> img.setSequence(this)); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideDownloadAction.java
r34349 r34358 47 47 @Override 48 48 public void actionPerformed(ActionEvent ae) { 49 if (!StreetsideLayer.hasInstance()) { 50 // A new streetside layer is created, so the active layer is not changed 51 StreetsideLayer.getInstance(); 52 return; 53 } else if (!MainApplication.getLayerManager().containsLayer(StreetsideLayer.getInstance())) { 49 if (!StreetsideLayer.hasInstance() || !MainApplication.getLayerManager().containsLayer(StreetsideLayer.getInstance())) { 54 50 MainApplication.getLayerManager().addLayer(StreetsideLayer.getInstance()); 55 51 return; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/WalkThread.java
r34349 r34358 13 13 import org.openstreetmap.josm.plugins.streetside.cache.CacheUtils; 14 14 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideMainDialog; 15 16 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 15 17 16 18 … … 57 59 // Predownload next 10 thumbnails. 58 60 preDownloadImages((StreetsideImage) image.next(), 10, CacheUtils.PICTURE.THUMBNAIL); 59 // TODO: WalkThread for cubemaps? @rrh 60 //preDownloadCubemaps((StreetsideImage) image.next(), 10, CacheUtils.PICTURE.CUBEMAP); 61 if(StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get()) { 62 preDownloadCubemaps((StreetsideImage) image.next(), 10); 63 } 61 64 if (waitForFullQuality) { 62 65 // Start downloading 3 next full images. 63 66 StreetsideAbstractImage currentImage = image.next(); 64 preDownloadImages((StreetsideImage) currentImage, 3, CacheUtils.PICTURE.FULL_IMAGE); 65 // TODO: WalkThread for cubemaps? @rrh 66 /*if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get().booleanValue()) { 67 preDownloadCubemaps((StreetsideImage) currentImage, 3, CacheUtils.PICTURE.CUBEMAP); 67 preDownloadImages((StreetsideImage) currentImage, 3, CacheUtils.PICTURE.FULL_IMAGE); 68 /*if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get().booleanValue()) { 69 preDownloadCubemaps((StreetsideImage) currentImage, 3); 68 70 }*/ 69 71 } … … 98 100 } 99 101 } 100 101 // TODO: WalkThread for cubemaps? @rrh102 /*while (!end && data.getSelectedImage().next() != null) {103 StreetsideAbstractImage cubemap = data.getSelectedImage();104 if (cubemap != null && cubemap.next() instanceof StreetsideCubemap) {105 if (waitForFullQuality) {106 // Start downloading 3 next full images.107 108 // TODO: cubemap handling @rrh109 preDownloadCubemaps((StreetsideCubemap) cubemap.next(), 6, CacheUtils.PICTURE.CUBEMAP);110 }111 }112 try {113 // Waits for full quality picture.114 final BufferedImage[] displayCubemap = StreetsideMainDialog.getInstance().streetsideViewerDisplay.getCubemap();115 if (waitForFullQuality && cubemap instanceof StreetsideCubemap) {116 // TODO: handle cubemap width? @rrh117 while (displayCubemap == lastCubemap || displayCubemap == null || displayCubemap.getWidth() < 2048) {118 Thread.sleep(100);119 }120 } else { // Waits for thumbnail.121 // TODO: handle cubemap width? @rrh122 while (displayCubemap == lastCubemap || displayCubemap == null || displayCubemap.getWidth() < 320) {123 Thread.sleep(100);124 }125 }126 while (paused) {127 Thread.sleep(100);128 }129 wait(interval);130 while (paused) {131 Thread.sleep(100);132 }133 lastCubemap = StreetsideMainDialog.getInstance().streetsideViewerDisplay.getCubemap();134 // TODO: forward / previous for cubemap? @rrh135 if (goForward) {136 data.selectNext(followSelected);137 } else {138 data.selectPrevious(followSelected);139 }140 } catch (InterruptedException e) {141 return;142 }143 }*/144 102 } catch (NullPointerException e) { 145 103 // TODO: Avoid NPEs instead of waiting until they are thrown and then catching them … … 149 107 } 150 108 151 private void preDownloadCubemaps(StreetsideImage startImage, int n , CacheUtils.PICTURE type) {109 private void preDownloadCubemaps(StreetsideImage startImage, int n) { 152 110 if (n >= 1 && startImage != null) { 153 111 … … 156 114 for (int k = 0; k < 4; k++) { 157 115 158 CacheUtils.downloadPicture(startImage, type);116 CacheUtils.downloadPicture(startImage, CacheUtils.PICTURE.CUBEMAP); 159 117 if (startImage.next() instanceof StreetsideImage && n >= 2) { 160 preDownload Images((StreetsideImage) startImage.next(), n - 1, type);118 preDownloadCubemaps((StreetsideImage) startImage.next(), n - 1); 161 119 } 162 120 } … … 232 190 SwingUtilities.invokeLater(this::end); 233 191 } 234 // TODO: WalkThread for Cubemaps? @rrh235 /*if (Platform.isEventDispatchThread()) {236 end = true;237 data.removeListener(this);238 StreetsideViewerDialog.getInstance().setMode(StreetsideViewerDialog.MODE.NORMAL);239 } else {240 Platform.invokeLater(this::end);241 }*/242 192 } 243 193 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cache/CacheUtils.java
r34325 r34358 57 57 */ 58 58 public static void downloadCubemap(StreetsideImage cm) { 59 // TODO: causes errors. Analyze @rrh 60 //downloadPicture(cm, PICTURE.CUBEMAP); 59 downloadPicture(cm, PICTURE.CUBEMAP); 61 60 } 62 61 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34350 r34358 4 4 import java.awt.image.BufferedImage; 5 5 import java.util.ArrayList; 6 import java.util.HashMap; 6 7 import java.util.List; 7 8 import java.util.Map; … … 34 35 protected boolean cancelled; 35 36 private long startTime; 36 37 private CubemapBuilder() { 37 private Map<String, BufferedImage> tileImages = new HashMap<String,BufferedImage>(); 38 39 /** 40 * @return the tileImages 41 */ 42 public Map<String, BufferedImage> getTileImages() { 43 return tileImages; 44 } 45 46 /** 47 * @param tileImages the tileImages to set 48 */ 49 public void setTileImages(Map<String, BufferedImage> tileImages) { 50 this.tileImages = tileImages; 51 } 52 53 /** 54 * @return the tileImages 55 */ 56 /*public Map<String, BufferedImage> getTileImages() { 57 return tileImages; 58 } 59 60 *//** 61 * @param tileImages the tileImages to set 62 *//* 63 public void setTileImages(Map<String, BufferedImage> tileImages) { 64 this.tileImages = tileImages; 65 }*/ 66 67 private CubemapBuilder() { 38 68 // private constructor to avoid instantiation 39 69 } … … 57 87 // set the cubeface images in JavaFX 58 88 downloadCubemapImages(cubemap.getId()); 89 90 long runTime = (System.currentTimeMillis()-startTime)/1000; 91 Logging.debug("Completed downloading tiles for {0} in {1} seconds.",newImage.getId(),runTime); 59 92 } 60 93 } … … 62 95 public void reload(String imageId) { 63 96 if (cubemap != null && imageId.equals(cubemap.getId())) { 64 CubemapBuilder.getInstance().getCubemap().resetFaces2TileMap(); 97 tileImages = new HashMap<String,BufferedImage>(); 98 //CubemapBuilder.getInstance().getCubemap().resetFaces2TileMap(); 65 99 downloadCubemapImages(imageId); 66 100 } … … 103 137 104 138 Logging.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 105 CubemapUtils.msToString(startTime - System.currentTimeMillis())));139 (startTime - System.currentTimeMillis())/ 1000)); 106 140 } 107 141 … … 125 159 for (Future<String> ff : results) { 126 160 Logging.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 127 CubemapUtils.msToString(startTime - System.currentTimeMillis())));161 (startTime - System.currentTimeMillis())/ 1000)); 128 162 } 129 163 } … … 137 171 long runTime = stopTime - startTime; 138 172 139 Logging.debug(I18n.tr("Tile imagery downloading tasks completed in {0}", CubemapUtils.msToString(runTime)));173 Logging.debug(I18n.tr("Tile imagery downloading tasks completed in {0}", runTime/1000000)); 140 174 141 175 if (fails > 0) { … … 153 187 int tileCount = 0; 154 188 155 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) {189 /*for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 156 190 String faceNumber = CubemapUtils.getFaceNumberForCount(i); 157 191 Map<String, BufferedImage> faceTileImages = CubemapBuilder.getInstance().getCubemap().getFace2TilesMap() 158 192 .get(faceNumber); 159 193 tileCount += faceTileImages.values().size(); 160 } 194 }*/ 195 196 tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size(); 161 197 162 198 int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; … … 168 204 169 205 buildCubemapFaces(); 170 } else {171 Logging.debug(I18n.tr("{0} tile images received for cubemap {1}", Integer.valueOf(tileCount).toString(),172 CubemapBuilder.getInstance().getCubemap().getId()));173 206 } 174 207 } 175 208 176 209 private void buildCubemapFaces() { 177 CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox(); 210 211 Logging.debug("Assembling cubemap tile images"); 212 CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox(); 178 213 ImageView[] views = cmb.getViews(); 179 214 … … 187 222 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 188 223 189 Map<String, BufferedImage> tileImages = CubemapBuilder.getInstance().getCubemap().getFace2TilesMap() 190 .get(CubemapUtils.getFaceNumberForCount(i)); 191 BufferedImage[] faceTileImages = new BufferedImage[maxCols * maxRows]; 224 /*Map<String, BufferedImage> tileImages = CubemapBuilder.getInstance().getCubemap().getFace2TilesMap() 225 .get(CubemapUtils.getFaceNumberForCount(i));*/ 226 227 BufferedImage[] faceTileImages = new BufferedImage[maxCols * maxRows]; 192 228 193 229 for (int j = 0; j < (maxCols * maxRows); j++) { … … 203 239 // rotate top cubeface 180 degrees - misalignment workaround 204 240 if (i == 4) { 241 final long start = System.nanoTime(); 205 242 finalImg = GraphicsUtils.rotateImage(finalImg); 243 Logging.debug(I18n.tr("Rotation took {0}", System.nanoTime() - start)); 206 244 } 207 245 finalImages[i] = GraphicsUtils.convertBufferedImage2JavaFXImage(finalImg); … … 213 251 int tileCount = 0; 214 252 215 Map<String, Map<String, BufferedImage>> face2TilesMap = CubemapBuilder.getInstance().getCubemap()216 .getFace2TilesMap(); 217 Map<String, BufferedImage> tileImages = face2TilesMap.get(CubemapUtils.getFaceNumberForCount(i));253 /*Map<String, Map<String, BufferedImage>> face2TilesMap = CubemapBuilder.getInstance().getCubemap() 254 .getFace2TilesMap();*/ 255 //Map<String, BufferedImage> tileImages = face2TilesMap.get(CubemapUtils.getFaceNumberForCount(i)); 218 256 BufferedImage[] faceTileImages = new BufferedImage[StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY 219 257 .get() ? 16 : 4]; … … 241 279 } 242 280 243 StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().revalidate(); 244 StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().repaint(); 245 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().revalidate(); 246 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().repaint(); 247 248 long endTime = System.currentTimeMillis(); 249 long runTime = endTime - startTime; 250 Logging.debug(I18n.tr("Completed downloading, assembling and setting cubemap imagery for cubemap {0} in {1}", 251 cubemap.getId(), CubemapUtils.msToString(runTime))); 281 StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().revalidate(); 282 StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().repaint(); 283 284 /*if (!Platform.isFxApplicationThread()) { 285 Platform.runLater(new Runnable() { 286 @Override 287 public void run() {*/ 288 289 //try { 290 /* GraphicsUtils.PlatformHelper.run(() -> { 291 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().initialize(); 292 });*/ 293 //StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().initialize(); 294 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel() 295 .setScene(StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getCubemapScene()); 296 /*} catch (NonInvertibleTransformException nite) { 297 // TODO Auto-generated catch block 298 Logging.error(I18n.tr("Error setting scene in 360 viewer panel {0}", nite.getMessage())); 299 }*/ 300 /*} 301 }); 302 }*/ 303 304 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().revalidate(); 305 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().repaint(); 306 307 long endTime = System.currentTimeMillis(); 308 long runTime = (endTime - startTime) / 1000; 309 Logging.debug( 310 I18n.tr( 311 "Completed downloading, assembling and setting cubemap imagery for cubemap {0} in {1}", cubemap.getId(), runTime 312 ) 313 ); 314 CubemapBuilder.getInstance().setTileImages(new HashMap<String, BufferedImage>()); 252 315 } 253 316 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java
r34325 r34358 2 2 package org.openstreetmap.josm.plugins.streetside.cubemap; 3 3 4 import java.text.DateFormat; 5 import java.text.SimpleDateFormat; 6 import java.util.Date; 4 7 import java.util.HashMap; 5 8 import java.util.Map; … … 97 100 final StringBuilder sb = new StringBuilder(); 98 101 102 Logging.debug(I18n.tr("convertDecimal2Quaternary input: {0}", Long.toString(inputNum))); 103 104 99 105 while (inputNum > 0) { 100 106 sb.append(inputNum % CubemapUtils.NUM_BASE); … … 104 110 sb.append("0"); 105 111 res = sb.reverse().toString(); 112 113 Logging.debug(I18n.tr("convertDecimal2Quaternary output: {0}", res)); 106 114 107 115 return res; … … 216 224 } 217 225 218 public static String msToString(long ms) {219 long totalSecs = ms/1000;220 long hours = (totalSecs / 3600);221 long mins = (totalSecs / 60) % 60;222 long secs = totalSecs % 60;223 String minsString = (mins == 0)224 ? "00"225 : ((mins < 10)226 ? "0" + mins227 : "" + mins);228 String secsString = (secs == 0)229 ? "00"230 : ((secs < 10)231 ? "0" + secs232 : "" + secs);233 if (hours > 0)234 return hours + ":" + minsString + ":" + secsString;235 else if (mins > 0)236 return mins + ":" + secsString;237 else return ":" + secsString;238 }239 240 226 public static String convertDoubleCountNrto16TileNr(String countNr) { 241 227 String tileAddress; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtils.java
r34350 r34358 7 7 8 8 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 9 import org.openstreetmap.josm.tools.I18n; 9 10 import org.openstreetmap.josm.tools.Logging; 10 11 … … 42 43 public static BufferedImage buildMultiTiledCubemapFaceImage(BufferedImage[] tiles) { 43 44 44 BufferedImage res = null; 45 long start = System.currentTimeMillis(); 46 47 BufferedImage res = null; 45 48 46 49 int pixelBuffer = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?2:1; … … 63 66 for (int j = 0; j < cols; j++) { 64 67 // TODO: this makes the image a mirror image. why!?! 65 img.createGraphics().drawImage(tiles[num], chunkWidth * j, chunkHeight * i, null);68 img.createGraphics().drawImage(tiles[num], chunkWidth * j, (chunkHeight * i), null); 66 69 67 70 // TODO: remove file test! … … 101 104 } 102 105 103 Logging.debug("Image concatenated....."); 104 106 Logging.debug(I18n.tr("Image concatenated in {0} millisecs.",(System.currentTimeMillis()-start))); 105 107 return res; 106 108 } … … 117 119 private static BufferedImage[] cropMultiTiledImages(BufferedImage[] tiles, int pixelBuffer) { 118 120 119 BufferedImage[] res = new BufferedImage[tiles.length]; 121 long start = System.currentTimeMillis(); 122 123 BufferedImage[] res = new BufferedImage[tiles.length]; 120 124 121 125 for(int i=0; i<tiles.length;i++) { … … 126 130 } 127 131 } 132 133 Logging.debug("Images cropped in {0} millisecs.",(System.currentTimeMillis()-start)); 134 128 135 return res; 129 136 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTask.java
r34349 r34358 5 5 import java.util.HashMap; 6 6 import java.util.List; 7 import java.util.Map;8 7 import java.util.Objects; 9 8 import java.util.concurrent.Callable; … … 108 107 } 109 108 110 String faceId = CubemapUtils.getFaceIdFromTileId(tileId);109 //String faceId = CubemapUtils.getFaceIdFromTileId(tileId); 111 110 112 Map<String, Map<String, BufferedImage>> faces2TilesMap = CubemapBuilder113 .getInstance().getCubemap().getFace2TilesMap(); 111 /*Map<String, Map<String, BufferedImage>> faces2TilesMap = CubemapBuilder 112 .getInstance().getCubemap().getFace2TilesMap();*/ 114 113 115 if(faces2TilesMap.get(faceId)==null) {116 faces2TilesMap.put(faceId, new HashMap<String,BufferedImage>());117 } 118 faces2TilesMap.get(faceId).put(tileId, img);114 /*if(CubemapBuilder.getInstance().getTileImages().get(tileId)==null) { 115 CubemapBuilder.getInstance().getTileImages().put(tileId, new HashMap<String,BufferedImage>()); 116 }*/ 117 CubemapBuilder.getInstance().getTileImages().put(tileId, img); 119 118 120 119 fireTileAdded(tileId); 121 120 122 121 long endTime = System.currentTimeMillis(); 123 long runTime = startTime - endTime;124 Logging.debug("Loaded image for tile {0} in {1} seconds", tileId, CubemapUtils.msToString(runTime));122 long runTime = (endTime-startTime)/1000; 123 Logging.debug("Loaded image for tile {0} in {1} seconds", tileId, runTime); 125 124 126 125 return tileId; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsidePreferenceSetting.java
r34317 r34358 248 248 OAuthPortListener portListener = new OAuthPortListener(callback); 249 249 portListener.start(); 250 try {250 /*try { 251 251 // TODO: change URL RRH 252 252 StreetsideUtils.browse(StreetsideURL.MainWebsite.connect("http://localhost:"+OAuthPortListener.PORT+'/')); 253 253 } catch (IOException e) { 254 254 Logging.error(e); 255 } 255 }*/ 256 256 } 257 257 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideViewerDialog.java
r34317 r34358 79 79 80 80 public StreetsideViewerPanel getStreetsideViewerPanel() { 81 // TODO: check if it's null @rrhs82 81 return streetsideViewerPanel; 83 82 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/dialog/ChooseGeoImageLayersDialog.java
r34317 r34358 59 59 buttonPanel.add(cancelButton); 60 60 final JButton importButton = new JButton(I18n.tr("Import"), new ImageProvider("copy").get()); 61 importButton.addActionListener(e -> {61 /*importButton.addActionListener(e -> { 62 62 list.getSelectedValuesList().parallelStream().map(gil -> { 63 63 StreetsideSequence seq = new StreetsideSequence(); … … 88 88 StreetsideLayer.invalidateInstance(); 89 89 dispose(); 90 }); 90 });*/ 91 91 buttonPanel.add(importButton); 92 92 c.add(buttonPanel, BorderLayout.SOUTH); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java
r34349 r34358 187 187 if (newImageKey != null) { 188 188 imageLinkChangeListener = b -> imgLinkAction.setURL( 189 StreetsideProperties.IMAGE_LINK_TO_BLUR_EDITOR.get()189 /*StreetsideProperties.IMAGE_LINK_TO_BLUR_EDITOR.get() 190 190 ? StreetsideURL.MainWebsite.blurEditImage(newImageKey) 191 : StreetsideURL.MainWebsite.browseImage(newImageKey)191 :*/ StreetsideURL.MainWebsite.browseImage(newImageKey) 192 192 ); 193 193 imageLinkChangeListener.valueChanged(null); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34349 r34358 13 13 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 14 14 import org.openstreetmap.josm.plugins.streetside.actions.ImageReloadAction; 15 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBuilder; 15 16 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils; 16 17 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils; … … 67 68 68 69 StreetsideButton imgReloadButton = new StreetsideButton(imgReloadAction); 69 highResImageryCheck = new JCheckBox(I18n.tr("High resolution"));70 highResImageryCheck = new JCheckBox(I18n.tr("High resolution")); 70 71 highResImageryCheck.setSelected(StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()); 71 72 highResImageryCheck.addActionListener( … … 84 85 checkPanel.add(privacyLink, BorderLayout.PAGE_END); 85 86 86 add(checkPanel, BorderLayout.PAGE_START);87 //add(checkPanel, BorderLayout.PAGE_START); 87 88 add(threeSixtyDegreeViewerPanel, BorderLayout.CENTER); 88 89 89 add(privacyLink, BorderLayout.PAGE_END); 90 JPanel bottomPanel = new JPanel(); 91 bottomPanel.add(checkPanel, BorderLayout.NORTH); 92 bottomPanel.add(privacyLink, BorderLayout.SOUTH); 93 94 add(bottomPanel, BorderLayout.PAGE_END); 90 95 } 91 96 … … 124 129 125 130 //imgIdValue.setEnabled(newImage instanceof StreetsideImage); 126 final String newImageId = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null; 131 //final String newImageId = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null; 132 final String newImageId = CubemapBuilder.getInstance().getCubemap() !=null ? CubemapBuilder.getInstance().getCubemap().getId() : newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null;; 127 133 if (newImageId != null) { 128 134 final String bubbleId = CubemapUtils.convertQuaternary2Decimal(newImageId); … … 130 136 StreetsideURL.MainWebsite.streetsidePrivacyLink(bubbleId) 131 137 ); 138 139 Logging.debug(I18n.tr("Privacy link invoked for Streetside image {0}", bubbleId)); 140 132 141 imageLinkChangeListener.valueChanged(null); 133 142 StreetsideProperties.CUBEMAP_LINK_TO_BLUR_EDITOR.addListener(imageLinkChangeListener); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.java
r34317 r34358 7 7 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils; 8 8 import org.openstreetmap.josm.plugins.streetside.utils.CubemapBox; 9 import org.openstreetmap.josm.tools.I18n;10 import org.openstreetmap.josm.tools.Logging;11 9 12 10 import javafx.application.Platform; … … 31 29 private static final long serialVersionUID = -4940350009018422000L; 32 30 31 private static Scene cubemapScene; 32 33 private static Scene defaultScene; 34 33 35 private static Group root; 34 36 private static Group subGroup; … … 57 59 } 58 60 59 void initialize() {61 public void initialize() { 60 62 61 63 root = new Group(); … … 90 92 @Override 91 93 public void run() { 92 try {93 // TODO: create Default Scene and replace with 360 degree scene @rrh94 95 } catch (NonInvertibleTransformException e) {94 //try { 95 setScene(createDefaultScene()); 96 //setScene(createScene()); 97 /*} catch (NonInvertibleTransformException e) { 96 98 Logging.error(I18n.tr("Error initializing StreetsideViewerPanel - JavaFX {0}", e.getMessage())); 97 } 99 }*/ 98 100 } 99 101 }); 100 102 } 101 103 102 p rivate static Scene createScene() throws NonInvertibleTransformException{103 104 /*root = new Group();104 public static Scene createScene() /*throws NonInvertibleTransformException*/ { 105 106 root = new Group(); 105 107 106 108 camera = new PerspectiveCamera(true); … … 126 128 127 129 subGroup = new Group(); 128 subGroup.getChildren().add(cameraTransform); */130 subGroup.getChildren().add(cameraTransform); 129 131 130 132 final Scene scene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); … … 220 222 subGroup.setAutoSizeChildren(true); 221 223 222 // TODO: attempt toprevent content from disappearing after resizing224 // prevent content from disappearing after resizing 223 225 Platform.setImplicitExit(false); 224 226 … … 230 232 231 233 // Load Cubemap box AFTER camera is initialized 232 final double size = 100000D;234 //final double size = 100000D; 233 235 234 236 TextArea textArea = new TextArea(); … … 237 239 VBox vbox = new VBox(textArea); 238 240 239 Scene scene = new Scene(vbox, 200, 100); 240 return scene; 241 root = new Group(); 242 243 camera = new PerspectiveCamera(true); 244 cameraTransform.setTranslate(0, 0, 0); 245 cameraTransform.getChildren().addAll(camera); 246 camera.setNearClip(0.1); 247 camera.setFarClip(1000000.0); 248 camera.setFieldOfView(42); 249 camera.setTranslateZ(-cameraDistance); 250 final PointLight light = new PointLight(Color.WHITE); 251 252 cameraTransform.getChildren().add(light); 253 light.setTranslateX(camera.getTranslateX()); 254 light.setTranslateY(camera.getTranslateY()); 255 light.setTranslateZ(camera.getTranslateZ()); 256 257 root.getChildren().add(cameraTransform); 258 259 // Load Cubemap box AFTER camera is initialized 260 final double size = 100000D; 261 262 cubemapBox = new CubemapBox(null, null, null, null, null, null, size, camera); 263 264 subGroup = new Group(); 265 subGroup.getChildren().add(cameraTransform); 266 267 /*final Scene*/ cubemapScene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); 268 cubemapScene.setFill(Color.TRANSPARENT); 269 cubemapScene.setCamera(camera); 270 271 // First person shooter keyboard movement 272 cubemapScene.setOnKeyPressed(event -> { 273 double change = 10.0; 274 // Add shift modifier to simulate "Running Speed" 275 if (event.isShiftDown()) { 276 change = 50.0; 277 } 278 // What key did the user press? 279 final KeyCode keycode = event.getCode(); 280 // Step 2c: Add Zoom controls 281 if (keycode == KeyCode.W) { 282 camera.setTranslateZ(camera.getTranslateZ() + change); 283 } 284 if (keycode == KeyCode.S) { 285 camera.setTranslateZ(camera.getTranslateZ() - change); 286 } 287 // Step 2d: Add Strafe controls 288 if (keycode == KeyCode.A) { 289 camera.setTranslateX(camera.getTranslateX() - change); 290 } 291 if (keycode == KeyCode.D) { 292 camera.setTranslateX(camera.getTranslateX() + change); 293 } 294 }); 295 296 cubemapScene.setOnMousePressed((MouseEvent me) -> { 297 mousePosX = me.getSceneX(); 298 mousePosY = me.getSceneY(); 299 mouseOldX = me.getSceneX(); 300 mouseOldY = me.getSceneY(); 301 }); 302 cubemapScene.setOnMouseDragged((MouseEvent me) -> { 303 mouseOldX = mousePosX; 304 mouseOldY = mousePosY; 305 mousePosX = me.getSceneX(); 306 mousePosY = me.getSceneY(); 307 mouseDeltaX = mousePosX - mouseOldX; 308 mouseDeltaY = mousePosY - mouseOldY; 309 310 double modifier = 10.0; 311 final double modifierFactor = 0.1; 312 313 if (me.isControlDown()) { 314 modifier = 0.1; 315 } 316 if (me.isShiftDown()) { 317 modifier = 50.0; 318 } 319 if (me.isPrimaryButtonDown()) { 320 cameraTransform.ry.setAngle( 321 ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540) 322 % 360 - 180); // + 323 cameraTransform.rx.setAngle( 324 ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540) 325 % 360 - 180); // - 326 327 } else if (me.isSecondaryButtonDown()) { 328 final double z = camera.getTranslateZ(); 329 final double newZ = z + mouseDeltaX * modifierFactor * modifier; 330 camera.setTranslateZ(newZ); 331 } else if (me.isMiddleButtonDown()) { 332 cameraTransform.t.setX(cameraTransform.t.getX() + mouseDeltaX * modifierFactor * modifier * 0.3); // - 333 cameraTransform.t.setY(cameraTransform.t.getY() + mouseDeltaY * modifierFactor * modifier * 0.3); // - 334 } 335 }); 336 337 /*scene.widthProperty().addListener(new ChangeListener<Number>() { 338 @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) { 339 System.out.println("Width: " + newSceneWidth); 340 } 341 342 @Override 343 public void changed(ObservableValue<? extends Number> observable, Number oldSceneWidth, Number newSceneWidth) { 344 draw(); 345 } 346 });*/ 347 /*scene.heightProperty().addListener(new ChangeListener<Number>() { 348 @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) { 349 //System.out.println("Height: " + newSceneHeight); 350 draw(); 351 } 352 });*/ 353 354 root.getChildren().addAll(cubemapBox, subGroup); 355 root.setAutoSizeChildren(true); 356 357 subGroup.setAutoSizeChildren(true); 358 359 // prevent content from disappearing after resizing 360 Platform.setImplicitExit(false); 361 362 //return scene; 363 364 defaultScene = new Scene(vbox, 200, 100); 365 return defaultScene; 241 366 } 242 367 … … 381 506 return cubemapBox; 382 507 } 508 509 public Scene getDefaultScene() { 510 return defaultScene; 511 } 512 513 public Scene getCubemapScene() { 514 return cubemapScene; 515 } 383 516 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/BoundsDownloadRunnable.java
r34317 r34358 30 30 public void run() { 31 31 URL nextURL = getUrlGenerator().apply(bounds); 32 Logging.debug("nextURL: {0}", nextURL.toString()); 32 33 try { 33 34 while (nextURL != null) { … … 73 74 message.append(" (").append(info).append(')'); 74 75 } 75 Logging. info(message.toString());76 Logging.debug(message.toString()); 76 77 } 77 78 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/ImageDetailsDownloadRunnable.java
r34317 r34358 13 13 14 14 public class ImageDetailsDownloadRunnable extends BoundsDownloadRunnable { 15 //private static final Function<Bounds, URL> URL_GEN = APIv3::searchImages;16 15 private static final Function<Bounds, URL> URL_GEN = APIv3::searchStreetsideImages; 17 16 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34350 r34358 66 66 67 67 try { 68 69 JsonParser parser = mapper.getFactory().createParser(new BufferedInputStream(con.getInputStream())); 68 JsonParser parser = mapper.getFactory().createParser(new BufferedInputStream(con.getInputStream())); 70 69 if(parser.nextToken() != JsonToken.START_ARRAY) { 71 70 parser.close(); 72 71 throw new IllegalStateException("Expected an array"); 73 72 } 74 75 73 76 74 StreetsideImage previous = null; … … 105 103 List<StreetsideImage> tiles = new ArrayList<StreetsideImage>(); 106 104 107 // TODO: set previous and next @rrh105 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 108 106 109 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 110 111 for (int i = 0; i < 4; i++) { 112 // Initialize four-tiled cubemap faces (four images per cube side with 18-length 113 // Quadkey) 114 //if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 4) { 115 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 116 StreetsideImage tile = new StreetsideImage( 117 String.valueOf(image.getId() + Integer.valueOf(i))); 118 tiles.add(tile); 119 } 120 // Initialize four-tiled cubemap faces (four images per cub eside with 20-length 121 // Quadkey) 122 //if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 16) { 123 if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 124 for (int j = 0; j < 4; j++) { 125 StreetsideImage tile = new StreetsideImage(String.valueOf(image.getId() 126 + face.getValue() + CubemapUtils.rowCol2StreetsideCellAddressMap 127 .get(String.valueOf(Integer.valueOf(i).toString() + Integer.valueOf(j).toString())))); 128 tiles.add(tile); 129 } 130 } 131 } 132 }); 107 for (int i = 0; i < 4; i++) { 108 // Initialize four-tiled cubemap faces (four images per cube side with 18-length 109 // Quadkey) 110 // if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 4) { 111 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 112 StreetsideImage tile = new StreetsideImage(String.valueOf(image.getId() + Integer.valueOf(i))); 113 tiles.add(tile); 114 } 115 // Initialize four-tiled cubemap faces (four images per cub eside with 20-length 116 // Quadkey) 117 // if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 16) { 118 if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 119 for (int j = 0; j < 4; j++) { 120 StreetsideImage tile = new StreetsideImage( 121 String.valueOf( 122 image.getId() + face.getValue() + CubemapUtils.rowCol2StreetsideCellAddressMap 123 .get(String.valueOf(Integer.valueOf(i).toString() + Integer.valueOf(j).toString())) 124 )); 125 tiles.add(tile); 126 } 127 } 128 } 129 }); 133 130 134 131 bubbleImages.add(image); 135 132 Logging.info("Added image with id <" + image.getId() + ">"); 136 // TODO: double check whether this pre-caches successfullly @rrh137 //StreetsideData.downloadSurroundingCubemaps(image);138 133 if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get()) { 134 StreetsideData.downloadSurroundingCubemaps(image); 135 } 139 136 } 140 137 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/model/MapObject.java
r34317 r34358 17 17 public class MapObject extends KeyIndexedObject { 18 18 private static final ImageIcon ICON_UNKNOWN_TYPE = ImageProvider.get("unknown-mapobject-type"); 19 private static Function<String, URL> iconUrlGen = MainWebsite::mapObjectIcon;19 //private static Function<String, URL> iconUrlGen = MainWebsite::mapObjectIcon; 20 20 21 21 private final LatLon coordinate; … … 56 56 return ICON_UNKNOWN_TYPE; 57 57 } else if (cachedIcon == null) { 58 try {58 /*try { 59 59 final ImageIcon downloadedIcon = new ImageIcon(ImageIO.read(iconUrlGen.apply(objectTypeID))); 60 60 MapObjectIconCache.getInstance().put(objectTypeID, downloadedIcon); … … 63 63 Logging.log(Logging.LEVEL_WARN, "Failed to download icon " + objectTypeID, e); 64 64 return ICON_UNKNOWN_TYPE; 65 } 65 }*/ 66 66 } 67 67 return cachedIcon; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/StreetsideUser.java
r34317 r34358 33 33 */ 34 34 public static synchronized String getUsername() { 35 if (!isTokenValid) {35 //if (!isTokenValid) { 36 36 return null; 37 }38 if (username == null) {37 //} 38 /*if (username == null) { 39 39 try { 40 40 username = OAuthUtils … … 46 46 } 47 47 } 48 return username; 48 return username;*/ 49 49 } 50 50 … … 54 54 */ 55 55 public static synchronized Map<String, String> getSecrets() { 56 if (!isTokenValid)56 //if (!isTokenValid) 57 57 return null; 58 Map<String, String> hash = new HashMap<>();58 /*Map<String, String> hash = new HashMap<>(); 59 59 try { 60 60 if (imagesHash == null) … … 72 72 } 73 73 hash.put("images_policy", imagesPolicy); 74 return hash; 74 return hash;*/ 75 75 } 76 76 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java
r34325 r34358 23 23 public static final BooleanProperty CUBEMAP_LINK_TO_BLUR_EDITOR = new BooleanProperty("streetside.cubemap-link-to-blur-editor", true); 24 24 public static final IntegerProperty TILE_DOWNLOAD_THREAD_PAUSE_LEN_SEC = new IntegerProperty("streetside.tile-download-thread-pause-len-sec", 60); 25 public static final BooleanProperty PREDOWNLOAD_CUBEMAPS = new BooleanProperty("streetside.predownload-cubemaps", true);25 public static final BooleanProperty PREDOWNLOAD_CUBEMAPS = new BooleanProperty("streetside.predownload-cubemaps", false); 26 26 27 27 /** -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideURL.java
r34349 r34358 23 23 /** Base URL of the Bing Bubble API. */ 24 24 private static final String STREETSIDE_BASE_URL = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx"; 25 private static final String BASE_API_V2_URL = "https://a.mapillary.com/v2/";25 //private static final String BASE_API_V2_URL = "https://a.mapillary.com/v2/"; 26 26 private static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 27 27 private static final String BING_MAPS_KEY = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm"; … … 36 36 37 37 public static final class APIv3 { 38 private static final String BASE_URL = "https://a.mapillary.com/v3/";38 //private static final String BASE_URL = "https://a.mapillary.com/v3/"; 39 39 40 40 private APIv3() { … … 42 42 } 43 43 44 public static URL getUser(String key) {44 /*public static URL getUser(String key) { 45 45 return StreetsideURL.string2URL(APIv3.BASE_URL, "users/", key, StreetsideURL.queryString(null)); 46 46 } 47 47 48 /**48 *//** 49 49 * @return the URL where you can create, get and approve changesets 50 */ 50 *//* 51 51 public static URL submitChangeset() { 52 52 return StreetsideURL.string2URL(APIv3.BASE_URL, "changesets", APIv3.queryString(null)); … … 59 59 public static URL searchImages(Bounds bounds) { 60 60 return StreetsideURL.string2URL(APIv3.BASE_URL, "images", APIv3.queryStreetsideString(bounds)); 61 } 61 }*/ 62 62 63 63 public static URL searchStreetsideImages(Bounds bounds) { … … 65 65 } 66 66 67 public static URL searchMapObjects(final Bounds bounds) {67 /*public static URL searchMapObjects(final Bounds bounds) { 68 68 return StreetsideURL.string2URL(APIv3.BASE_URL, "objects", APIv3.queryString(bounds)); 69 } 69 }*/ 70 70 71 71 public static URL searchStreetsideSequences(final Bounds bounds) { … … 128 128 * @return the URL where you'll find information about the user account as JSON 129 129 */ 130 public static URL userURL() {130 /*public static URL userURL() { 131 131 return StreetsideURL.string2URL(APIv3.BASE_URL, "me", StreetsideURL.queryString(null)); 132 } 132 }*/ 133 133 } 134 134 … … 152 152 153 153 public static final class MainWebsite { 154 private static final String BASE_URL = "https://www.mapillary.com/";154 //private static final String BASE_URL = "https://www.mapillary.com/"; 155 155 156 156 private MainWebsite() { … … 177 177 * @throws IllegalArgumentException if the image key is <code>null</code> 178 178 */ 179 public static URL blurEditImage(final String key) {179 /*public static URL blurEditImage(final String key) { 180 180 if (key == null) { 181 181 throw new IllegalArgumentException("The image key must not be null!"); … … 189 189 } 190 190 return StreetsideURL.string2URL(MainWebsite.BASE_URL, "app/blur?focus=photo&pKey=", urlEncodedKey); 191 } 191 }*/ 192 192 193 193 /** … … 217 217 * @return the URL that the user should visit to start the OAuth authentication 218 218 */ 219 public static URL connect(String redirectURI) {219 /*public static URL connect(String redirectURI) { 220 220 final HashMap<String, String> parts = new HashMap<>(); 221 221 if (redirectURI != null && redirectURI.length() >= 1) { … … 229 229 public static URL mapObjectIcon(String key) { 230 230 return StreetsideURL.string2URL(MainWebsite.BASE_URL, "developer/api-documentation/images/traffic_sign/" + key + ".png"); 231 } 231 }*/ 232 232 } 233 233 … … 286 286 * @return the URL where you'll find the upload secrets as JSON 287 287 */ 288 public static URL uploadSecretsURL() {288 /*public static URL uploadSecretsURL() { 289 289 return StreetsideURL.string2URL(StreetsideURL.BASE_API_V2_URL, "me/uploads/secrets", StreetsideURL.queryString(null)); 290 } 290 }*/ 291 291 292 292 /** … … 309 309 } 310 310 } 311 312 Logging.info(I18n.tr("queryString result: {0}", ret.toString())); 313 311 314 return ret.toString(); 312 315 } … … 331 334 } 332 335 } 336 Logging.info(I18n.tr("queryStreetsideBoundsString result: {0}", ret.toString())); 337 333 338 return ret.toString(); 334 339 } … … 343 348 Logging.error(e); // This should not happen, as the encoding is hard-coded 344 349 } 350 Logging.info(I18n.tr("queryById result: {0}", ret.toString())); 345 351 return ret.toString(); 346 352 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideUtils.java
r34317 r34358 8 8 import java.text.ParseException; 9 9 import java.text.SimpleDateFormat; 10 import java.util.ArrayList; 10 11 import java.util.Calendar; 12 import java.util.Iterator; 13 import java.util.List; 11 14 import java.util.Locale; 12 15 import java.util.Set; … … 16 19 import org.apache.commons.imaging.common.RationalNumber; 17 20 import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants; 18 19 21 import org.openstreetmap.josm.data.Bounds; 20 22 import org.openstreetmap.josm.data.coor.LatLon; … … 283 285 MainApplication.getMap().statusLine.setHelpText(ret.toString()); 284 286 } 287 288 public static List<StreetsideAbstractImage> sortImagesInSequence(List<StreetsideAbstractImage> images) { 289 List<StreetsideAbstractImage> res = new ArrayList<StreetsideAbstractImage>(); 290 if (images != null && images.size() > 0) { 291 res.add(images.get(0)); 292 images.remove(0); 293 String nextImageId = Long.toString(images.get(0).getNe()); 294 if (nextImageId != null) { 295 Iterator<StreetsideAbstractImage> iter = images.iterator(); 296 while (iter.hasNext()) { 297 StreetsideAbstractImage current = (StreetsideAbstractImage) iter.next(); 298 if (nextImageId.equals(current.getId())) { 299 res.add(current); 300 images.remove(current); 301 } 302 } 303 } 304 } 305 306 return res; 307 } 285 308 }
Note:
See TracChangeset
for help on using the changeset viewer.