Changeset 34348 in osm for applications/editors/josm/plugins
- Timestamp:
- 2018-06-23T23:03:38+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/build.xml
r34329 r34348 13 13 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 14 14 <property name="plugin.main.version" value="13860" /> 15 <property name="plugin.version" value="13860" /> 15 16 16 17 <property name="plugin.author" value="renerr18" /> -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideImage.java
r34333 r34348 48 48 private double pi; 49 49 50 // Heading (equivalent to Mapillary cd attribute - not currently supported.51 private double he;52 53 50 // Blurring instructions - not currently used by the plugin 54 51 private String bl; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideDownloadAction.java
r34317 r34348 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/StreetsideDownloadViewAction.java
r34317 r34348 26 26 27 27 private static final long serialVersionUID = 6738276777802831669L; 28 29 28 private static final String DESCRIPTION = I18n.marktr("Download Streetside images in current view"); 30 29 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideExportAction.java
r34317 r34348 63 63 cancel.addActionListener(e -> pane.setValue(JOptionPane.CANCEL_OPTION)); 64 64 65 dialog = new StreetsideExportDialog(ok);66 pane.setMessage( dialog);65 this.dialog = new StreetsideExportDialog(ok); 66 pane.setMessage(this.dialog); 67 67 pane.setOptions(new JButton[] {ok, cancel}); 68 68 … … 74 74 if (pane.getValue() != null 75 75 && (int) pane.getValue() == JOptionPane.OK_OPTION 76 && dialog.chooser != null) {77 if ( dialog.group.isSelected(dialog.all.getModel())) {76 && this.dialog.chooser != null) { 77 if (this.dialog.group.isSelected(this.dialog.all.getModel())) { 78 78 export(StreetsideLayer.getInstance().getData().getImages()); 79 } else if ( dialog.group.isSelected(dialog.sequence.getModel())) {79 } else if (this.dialog.group.isSelected(this.dialog.sequence.getModel())) { 80 80 Set<StreetsideAbstractImage> images = new ConcurrentSkipListSet<>(); 81 81 for (StreetsideAbstractImage image : StreetsideLayer.getInstance().getData().getMultiSelectedImages()) { … … 89 89 } 90 90 export(images); 91 } else if ( dialog.group.isSelected(dialog.selected.getModel())) {91 } else if (this.dialog.group.isSelected(dialog.selected.getModel())) { 92 92 export(StreetsideLayer.getInstance().getData().getMultiSelectedImages()); 93 93 } 94 94 // This option ignores the selected directory. 95 } else if ( dialog.group.isSelected(dialog.rewrite.getModel())) {95 } else if (this.dialog.group.isSelected(dialog.rewrite.getModel())) { 96 96 ArrayList<StreetsideImportedImage> images = new ArrayList<>(); 97 97 StreetsideLayer.getInstance().getData().getImages().stream().filter(img -> img instanceof StreetsideImportedImage).forEach(img -> images.add((StreetsideImportedImage) img)); … … 113 113 public void export(Set<StreetsideAbstractImage> images) { 114 114 MainApplication.worker.execute(new StreetsideExportManager(images, 115 dialog.chooser.getSelectedFile().toString()));115 this.dialog.chooser.getSelectedFile().toString())); 116 116 } 117 117 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideWalkAction.java
r34317 r34348 55 55 if (pane.getValue() != null 56 56 && (int) pane.getValue() == JOptionPane.OK_OPTION) { 57 th read = new WalkThread((int) dialog.spin.getValue(),57 this.thread = new WalkThread((int) dialog.spin.getValue(), 58 58 dialog.waitForPicture.isSelected(), 59 59 dialog.followSelection.isSelected(), dialog.goForward.isSelected()); … … 76 76 */ 77 77 public void addListener(WalkListener lis) { 78 listeners.add(lis);78 this.listeners.add(lis); 79 79 } 80 80 … … 86 86 */ 87 87 public void removeListener(WalkListener lis) { 88 listeners.remove(lis);88 this.listeners.remove(lis); 89 89 } 90 90 91 91 private void fireWalkStarted() { 92 if ( listeners.isEmpty()) {92 if (this.listeners.isEmpty()) { 93 93 return; 94 94 } 95 for (WalkListener lis : listeners) {96 lis.walkStarted(th read);95 for (WalkListener lis : this.listeners) { 96 lis.walkStarted(this.thread); 97 97 } 98 98 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideZoomAction.java
r34317 r34348 6 6 import java.awt.event.ActionEvent; 7 7 8 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer;9 10 8 import org.openstreetmap.josm.actions.JosmAction; 11 9 import org.openstreetmap.josm.gui.MainApplication; 12 10 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 13 11 import org.openstreetmap.josm.plugins.streetside.StreetsideDataListener; 12 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 14 13 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin; 15 14 import org.openstreetmap.josm.tools.ImageProvider; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34317 r34348 44 44 } 45 45 46 47 48 startTime = System.currentTimeMillis();49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 46 @Override 47 public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 48 startTime = System.nanoTime(); 49 50 if (newImage != null) { 51 52 cubemap = null; 53 cubemap = new StreetsideCubemap(newImage.getId(), newImage.getLatLon(), newImage.getHe()); 54 cubemap.setCd(newImage.getCd()); 55 56 // download cubemap images in different threads and then subsequently 57 // set the cubeface images in JavaFX 58 downloadCubemapImages(cubemap.getId()); 59 } 60 } 61 62 public void reload(String imageId) { 63 if (cubemap != null && imageId.equals(cubemap.getId())) { 64 CubemapBuilder.getInstance().getCubemap().resetFaces2TileMap(); 65 downloadCubemapImages(imageId); 66 } 67 } 68 68 69 69 public void downloadCubemapImages(String imageId) { … … 75 75 int fails = 0; 76 76 77 long startTime = System. currentTimeMillis();77 long startTime = System.nanoTime(); 78 78 79 79 try { … … 102 102 for (Future<String> ff : results) { 103 103 104 Logging. debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(),105 CubemapUtils.msToString(startTime - System. currentTimeMillis())));104 Logging.info(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 105 CubemapUtils.msToString(startTime - System.nanoTime()))); 106 106 } 107 107 … … 115 115 + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString())); 116 116 tasks.add(new TileDownloadingTask(tileId)); 117 Logging. debug(117 Logging.info( 118 118 I18n.tr("Starting tile downloading task for imageId {0}, cubeface {1}, tileID {2}", 119 119 imageId, CubemapUtils.getFaceNumberForCount(i), tileId)); … … 124 124 List<Future<String>> results = pool.invokeAll(tasks); 125 125 for (Future<String> ff : results) { 126 Logging. info(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(),127 CubemapUtils.msToString(startTime - System. currentTimeMillis())));126 Logging.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 127 CubemapUtils.msToString(startTime - System.nanoTime()))); 128 128 } 129 129 } … … 134 134 } 135 135 136 long stopTime = System. currentTimeMillis();136 long stopTime = System.nanoTime(); 137 137 long runTime = stopTime - startTime; 138 138 139 Logging.info(I18n.tr(" Tile imagery downloading tasks completed in {0}", CubemapUtils.msToString(runTime)));139 Logging.info(I18n.tr("Imagery downloading tasks completed for all tiles in {0} seconds.", runTime % 1000)); 140 140 141 141 if (fails > 0) { … … 164 164 165 165 if (tileCount == (CubemapUtils.NUM_SIDES * maxCols * maxRows)) { 166 Logging. info(I18n.tr("{0} tile images ready for building cumbemap faces for cubemap {0}", tileCount,166 Logging.debug(I18n.tr("{0} tile images ready for building cumbemap faces for cubemap {0}", tileCount, 167 167 CubemapBuilder.getInstance().getCubemap().getId())); 168 168 169 169 buildCubemapFaces(); 170 170 } else { 171 Logging. info(I18n.tr("{0} tile images received for cubemap {1}", Integer.valueOf(tileCount).toString(),171 Logging.debug(I18n.tr("{0} tile images received for cubemap {1}", Integer.valueOf(tileCount).toString(), 172 172 CubemapBuilder.getInstance().getCubemap().getId())); 173 173 } … … 246 246 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().repaint(); 247 247 248 long endTime = System. currentTimeMillis();248 long endTime = System.nanoTime(); 249 249 long runTime = endTime - startTime; 250 250 Logging.info(I18n.tr("Completed downloading, assembling and setting cubemap imagery for cubemap {0} in {1}", 251 cubemap.getId(), CubemapUtils.msToString(runTime)));251 cubemap.getId(), runTime)); 252 252 } 253 253 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtils.java
r34317 r34348 44 44 BufferedImage res = null; 45 45 46 int pixelBuffer = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ?2:1;46 int pixelBuffer = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 2 : 1; 47 47 48 48 tiles = cropMultiTiledImages(tiles, pixelBuffer); 49 49 50 int rows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?4:2; //we assume the no. of rows and cols are known and each chunk has equal width and height 51 int cols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?4:2; 50 int rows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; // we assume the no. of rows and 51 // cols are known and each chunk 52 // has 53 // equal width and height 54 int cols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 52 55 53 56 int chunkWidth, chunkHeight; 54 57 55 56 58 chunkWidth = tiles[0].getWidth(); 59 chunkHeight = tiles[0].getHeight(); 57 60 58 //Initializing the final image59 BufferedImage img = new BufferedImage(chunkWidth*cols, chunkHeight*rows, BufferedImage.TYPE_INT_ARGB);61 // Initializing the final image 62 BufferedImage img = new BufferedImage(chunkWidth * cols, chunkHeight * rows, BufferedImage.TYPE_INT_ARGB); 60 63 61 62 63 64 // TODO: this makes the image a mirror image. why!?! 65 64 int num = 0; 65 for (int i = 0; i < rows; i++) { 66 for (int j = 0; j < cols; j++) { 67 // TODO: mirror image 68 img.createGraphics().drawImage(tiles[num], chunkWidth * j, chunkHeight * i, null); 66 69 67 // TODO: remove file test! 68 /*try { 69 ImageIO.write(img, "jpeg", new File("/Users/renerr18/Desktop/TileImagesTest/tile16b" + Long.valueOf(System.currentTimeMillis()).toString() + "createGraphicsAfter.jpeg")); 70 //ImageIO.write(res[i], "jpeg", outputfileAfter); 71 } catch (IOException e) { 72 // TODO Auto-generated catch block 73 e.printStackTrace(); 74 }*/ 70 int width = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 1014 : 510; 71 int height = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 1014 : 510; 75 72 76 int width = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?1014:510; 77 int height = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?1014:510; 73 res = new BufferedImage(StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 1014 : 510, 74 StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 1014 : 510, 75 BufferedImage.TYPE_INT_ARGB); 78 76 79 // BufferedImage for mirror image 80 res = new BufferedImage(StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?1014:510, StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?1014:510, 81 BufferedImage.TYPE_INT_ARGB); 77 // Create mirror image pixel by pixel 78 for (int y = 0; y < height; y++) { 79 for (int lx = 0, rx = width - 1; lx < width; lx++, rx--) { 80 // lx starts from the left side of the image 81 // rx starts from the right side of the image 82 // lx is used since we are getting pixel from left side 83 // rx is used to set from right side 84 // get source pixel value 85 int p = img.getRGB(lx, y); 82 86 83 // Create mirror image pixel by pixel 84 for (int y = 0; y < height; y++) 85 { 86 for (int lx = 0, rx = width - 1; lx < width; lx++, rx--) 87 { 88 // lx starts from the left side of the image 89 // rx starts from the right side of the image 90 // lx is used since we are getting pixel from left side 91 // rx is used to set from right side 92 // get source pixel value 93 int p = img.getRGB(lx, y); 87 // set mirror image pixel value 88 res.setRGB(rx, y, p); 89 } 90 } 91 num++; 92 } 93 } 94 94 95 // set mirror image pixel value 96 res.setRGB(rx, y, p); 97 } 98 } 99 num++; 100 } 101 } 95 Logging.debug("Image concatenated....."); 102 96 103 Logging.info("Image concatenated....."); 104 105 return res; 97 return res; 106 98 } 107 99 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTask.java
r34325 r34348 22 22 23 23 private String tileId; 24 private final long startTime = System. currentTimeMillis();24 private final long startTime = System.nanoTime(); 25 25 private StreetsideCache cache; 26 26 protected CubemapBuilder cb; … … 120 120 fireTileAdded(tileId); 121 121 122 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 endTime = System.nanoTime(); 123 long runTime = endTime - startTime; 124 Logging.info("Loaded image for tile {0} in {1} seconds", tileId, runTime); 125 125 126 126 return tileId; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java
r34325 r34348 12 12 13 13 import javax.swing.ImageIcon; 14 import javax.swing.JCheckBox; 14 15 import javax.swing.JLabel; 15 16 import javax.swing.JPanel; … … 18 19 import org.apache.commons.logging.Log; 19 20 import org.apache.commons.logging.LogFactory; 20 import org.openstreetmap.josm.data.osm.DataSelectionListener; 21 22 import org.openstreetmap.josm.data.SelectionChangedListener; 23 import org.openstreetmap.josm.data.osm.DataSet; 21 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 25 import org.openstreetmap.josm.data.osm.Tag; … … 34 37 import org.openstreetmap.josm.tools.I18n; 35 38 36 public final class ImageInfoPanel extends ToggleDialog implements StreetsideDataListener, DataSelectionListener {39 public final class ImageInfoPanel extends ToggleDialog implements StreetsideDataListener, SelectionChangedListener { 37 40 private static final long serialVersionUID = 4141847503072417190L; 38 41 private static final Log L = LogFactory.getLog(ImageInfoPanel.class); … … 40 43 private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB)); 41 44 42 //private final JLabel numDetectionsLabel;43 //private final JCheckBox showDetectionsCheck;45 private final JLabel numDetectionsLabel; 46 private final JCheckBox showDetectionsCheck; 44 47 private final JLabel usernameLabel; 45 48 private final JTextPane imgKeyValue; … … 59 62 150 60 63 ); 61 SelectionEventManager.getInstance().addSelectionListener(this); 62 63 //numDetectionsLabel = new JLabel(); 64 //numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN)); 65 66 //showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image")); 67 //showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get()); 68 /*showDetectionsCheck.addActionListener( 69 action -> StreetsideProperties.SHOW_DETECTED_SIGNS.put(showDetectionsCheck.isSelected()) 70 ); 71 StreetsideProperties.SHOW_DETECTED_SIGNS.addListener( 72 valueChange -> showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get()) 73 );*/ 64 DataSet.addSelectionListener(this); 65 66 numDetectionsLabel = new JLabel(); 67 numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN)); 68 69 showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image")); 70 71 // no selections currently available for Streetside 72 showDetectionsCheck.setSelected(false); 74 73 75 74 usernameLabel = new JLabel(); … … 120 119 gbc.gridy = 0; 121 120 gbc.anchor = GridBagConstraints.LINE_START; 122 //root.add(numDetectionsLabel, gbc);123 //gbc.gridy++;124 //root.add(showDetectionsCheck, gbc);125 //gbc.gridy++;121 root.add(numDetectionsLabel, gbc); 122 gbc.gridy++; 123 root.add(showDetectionsCheck, gbc); 124 gbc.gridy++; 126 125 root.add(usernameLabel, gbc); 127 126 gbc.gridy++; … … 172 171 173 172 /* (non-Javadoc) 174 * @see org.openstreetmap.josm.plugins. streetside.StreetsideDataListener#selectedImageChanged(org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage, org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage)173 * @see org.openstreetmap.josm.plugins.mapillary.MapillaryDataListener#selectedImageChanged(org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage, org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage) 175 174 */ 176 175 @Override … … 182 181 )); 183 182 184 //numDetectionsLabel.setText(I18n.tr("{0} detections", newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getDetections().size() : 0));183 numDetectionsLabel.setText(I18n.tr("{0} detections", newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getDetections().size() : 0)); 185 184 imgKeyValue.setEnabled(newImage instanceof StreetsideImage); 186 185 final String newImageKey = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null; … … 209 208 } 210 209 211 final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null; 210 // Currently no user info supported in Streetside plugin 211 final UserProfile user = null; 212 212 usernameLabel.setEnabled(user != null); 213 213 if (user != null) { … … 232 232 */ 233 233 @Override 234 public synchronized void selectionChanged(final SelectionChangeEvent event) { 235 final Collection<? extends OsmPrimitive> sel = event.getSelection(); 234 public synchronized void selectionChanged(final Collection<? extends OsmPrimitive> sel) { 236 235 L.debug(String.format("Selection changed. %d primitives are selected.", sel == null ? 0 : sel.size())); 237 236 addStreetsideTagAction.setTarget(sel != null && sel.size() == 1 ? sel.iterator().next() : null); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34333 r34348 49 49 50 50 StreetsideSequence seq = new StreetsideSequence(null); 51 // TODO: re-add sequenceID52 //StreetsideSequence seq = new StreetsideSequence(StreetsideSequenceIdGenerator.generateId());53 54 // TODO: how can LatLon and heading / camera angles (he attribute) be set for a sequence?55 // and does it make sense? @rrh56 51 57 52 List<StreetsideImage> bubbleImages = new ArrayList<>(); 58 53 59 final long startTime = System. currentTimeMillis();54 final long startTime = System.nanoTime(); 60 55 61 56 ObjectMapper mapper = new ObjectMapper(); … … 69 64 try { 70 65 71 JsonParser parser = mapper.getFactory().createParser(new BufferedInputStream(con.getInputStream()));72 if(parser.nextToken() != JsonToken.START_ARRAY) {73 parser.close();74 throw new IllegalStateException("Expected an array");75 }66 JsonParser parser = mapper.getFactory().createParser(new BufferedInputStream(con.getInputStream())); 67 if (parser.nextToken() != JsonToken.START_ARRAY) { 68 parser.close(); 69 throw new IllegalStateException("Expected an array"); 70 } 76 71 72 StreetsideImage previous = null; 77 73 78 StreetsideImage previous = null; 79 80 while (parser.nextToken() == JsonToken.START_OBJECT) { 74 while (parser.nextToken() == JsonToken.START_OBJECT) { 81 75 // read everything from this START_OBJECT to the matching END_OBJECT 82 76 // and return it as a tree model ObjectNode … … 85 79 if (node.get("id") != null && node.get("la") != null && node.get("lo") != null) { 86 80 StreetsideImage image = new StreetsideImage(CubemapUtils.convertDecimal2Quaternary(node.path("id").asLong()), node.path("la").asDouble(), node.get("lo").asDouble()); 87 if(previous!=null) { 88 // Analyze sequence behaviour 89 //previous.setNext(image.) 81 if (previous != null) { 82 previous.setNe(image.getNe()); 90 83 } 91 84 image.setAd(node.path("ad").asInt()); … … 100 93 image.setPi(node.path("pi").asDouble()); 101 94 image.setPr(node.path("pr").asLong()); 102 // TODO: inner class @rrh103 // image.setRn(node.path("rn").asText());104 95 image.setRo(node.path("ro").asDouble()); 105 96 … … 107 98 List<StreetsideImage> tiles = new ArrayList<StreetsideImage>(); 108 99 109 // TODO: set previous and next @rrh100 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 110 101 111 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 102 for (int i = 0; i < 4; i++) { 103 // Initialize four-tiled cubemap faces (four images per cube side with 18-length 104 // Quadkey) 105 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 106 StreetsideImage tile = new StreetsideImage(String.valueOf(image.getId() + Integer.valueOf(i))); 107 tiles.add(tile); 108 } 109 // Initialize four-tiled cubemap faces (four images per cub eside with 20-length 110 // Quadkey) 111 if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 112 for (int j = 0; j < 4; j++) { 113 StreetsideImage tile = new StreetsideImage( 114 String.valueOf( 115 image.getId() + face.getValue() + CubemapUtils.rowCol2StreetsideCellAddressMap 116 .get(String.valueOf(Integer.valueOf(i).toString() + Integer.valueOf(j).toString())) 117 )); 118 tiles.add(tile 119 ); 120 } 121 } 122 } 123 }); 112 124 113 for (int i = 0; i < 4; i++) { 114 // Initialize four-tiled cubemap faces (four images per cube side with 18-length 115 // Quadkey) 116 //if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 4) { 117 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 118 StreetsideImage tile = new StreetsideImage( 119 String.valueOf(image.getId() + Integer.valueOf(i))); 120 tiles.add(tile); 121 } 122 // Initialize four-tiled cubemap faces (four images per cub eside with 20-length 123 // Quadkey) 124 //if (StreetsideProperties.CUBEFACE_SIZE.get().intValue() == 16) { 125 if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 126 for (int j = 0; j < 4; j++) { 127 StreetsideImage tile = new StreetsideImage(String.valueOf(image.getId() 128 + face.getValue() + CubemapUtils.rowCol2StreetsideCellAddressMap 129 .get(String.valueOf(Integer.valueOf(i).toString() + Integer.valueOf(j).toString())))); 130 tiles.add(tile); 131 } 132 } 133 } 134 }); 135 136 bubbleImages.add(image); 137 Logging.info("Added image with id <" + image.getId() + ">"); 138 // TODO: double check whether this pre-caches successfullly @rrh 139 //StreetsideData.downloadSurroundingCubemaps(image); 125 bubbleImages.add(image); 126 Logging.debug("Added image with id <" + image.getId() + ">"); 140 127 141 128 } 142 129 } 143 130 144 parser.close(); 145 146 //StreetsideImage[] images; 147 148 // First load all of the 'bubbles' from the request as Streetside Images 149 /*List<StreetsideImage> images = mapper 150 .readValue(new BufferedInputStream(con.getInputStream()), new TypeReference<List<StreetsideImage>>() {}); 151 */ 152 153 154 //images = mapper.readValue(new BufferedInputStream(con.getInputStream()), StreetsideImage[].class); 155 156 /*for (StreetsideImage image : bubbleImages) { 157 image = JsonStreetsideSequencesDecoder.decodeBubbleData(image); 158 if(image != null) bubbleImages.add(image); 159 }*/ 131 parser.close(); 160 132 161 133 } catch (JsonParseException e) { … … 192 164 } 193 165 194 final long endTime = System. currentTimeMillis();166 final long endTime = System.nanoTime();//currentTimeMillis(); 195 167 Logging.info(I18n.tr("Sucessfully loaded {0} Microsoft Streetside images in {0} ",seq.getImages().size(),endTime-startTime%60)); 196 168 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideURL.java
r34325 r34348 236 236 } 237 237 238 239 240 241 242 243 244 245 246 247 248 249 final String urlStr = baseUrlPrefix + cubemapImageId 250 + CubemapUtils.rowCol2StreetsideCellAddressMap 251 .get(String.valueOf(i) + String.valueOf(j)) 252 + baseUrlSuffix; 253 res.add(new URL(urlStr));254 } catch (final MalformedURLException e) { 255 Logging.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId)); 256 e.printStackTrace(); 257 258 259 } 260 } 261 });262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 238 public static URL[] string2URLs(String baseUrlPrefix, String cubemapImageId, String baseUrlSuffix) { 239 List<URL> res = new ArrayList<>(); 240 241 switch (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 16 : 4) { 242 243 case 16: 244 245 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 246 for (int i = 0; i < 4; i++) { 247 for (int j = 0; j < 4; j++) { 248 try { 249 final String urlStr = baseUrlPrefix + cubemapImageId + CubemapUtils.rowCol2StreetsideCellAddressMap 250 .get(String.valueOf(i) + String.valueOf(j)) + baseUrlSuffix; 251 res.add(new URL(urlStr)); 252 } catch (final MalformedURLException e) { 253 Logging.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId)); 254 e.printStackTrace(); 255 } 256 257 } 258 } 259 }); 260 261 break; 262 263 case 4: 264 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 265 for (int i = 0; i < 4; i++) { 266 267 try { 268 final String urlStr = baseUrlPrefix + cubemapImageId 269 + CubemapUtils.rowCol2StreetsideCellAddressMap.get(String.valueOf(i)) + baseUrlSuffix; 270 res.add(new URL(urlStr)); 271 } catch (final MalformedURLException e) { 272 Logging.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId)); 273 e.printStackTrace(); 274 } 275 276 } 277 }); 278 break; // break is optional 279 default: 280 // Statements 281 } 282 return res.stream().toArray(URL[]::new); 283 } 284 284 285 285 /**
Note:
See TracChangeset
for help on using the changeset viewer.