Changeset 34428 in osm for applications
- Timestamp:
- 2018-07-18T12:02:17+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside
- Property svn:ignore
-
old new 8 8 .gitignore 9 9 .gradle 10 .settings 10 11 checkstyle-josm-MicrosoftStreetside.xml 11 12 spotbugs-josm-MicrosoftStreetside.xml
-
- Property svn:ignore
-
applications/editors/josm/plugins/MicrosoftStreetside/.classpath
r34399 r34428 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path="">3 <classpathentry excluding="config/" including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path=""> 4 4 <attributes> 5 5 <attribute name="gradle_scope" value="main"/> … … 7 7 </attributes> 8 8 </classpathentry> 9 <classpathentry kind="src" path="config"/> 9 10 <classpathentry kind="src" output="bin/test" path="test/unit"> 10 11 <attributes> -
applications/editors/josm/plugins/MicrosoftStreetside/.gitignore
r34416 r34428 16 16 .gradle/ 17 17 .travis.yml 18 .settings 18 19 19 20 # OS X metadata -
applications/editors/josm/plugins/MicrosoftStreetside/README.md
r34328 r34428 13 13 14 14 ## Building from source 15 Checkout the JOSM source, compile it and checkout the plugin source :15 Checkout the JOSM source, compile it and checkout the plugin source (the last gradle command is optional, but contains code checking and unit test functionality - requires a Gradle installation): 16 16 17 17 svn co http://svn.openstreetmap.org/applications/editors/josm josm 18 18 cd josm/core 19 ant clean dist19 ant 20 20 cd ../plugins 21 21 rm -rf MicrosoftStreetside 22 22 git clone https://github.com/JOSM/MicrosoftStreetside.git MicrosoftStreetside 23 23 cd MicrosoftStreetside 24 ant clean install 24 ant clean 25 ant dist 26 gradle build 25 27 26 28 Now Restart JOSM and activate the MicrosoftStreeside plugin in your preferences. -
applications/editors/josm/plugins/MicrosoftStreetside/build.xml
r34348 r34428 39 39 <include name="apache-commons.jar"/> 40 40 <include name="apache-http.jar"/> 41 <include name="utilsplugin2.jar"/> 41 42 </fileset> 42 43 -
applications/editors/josm/plugins/MicrosoftStreetside/gradle.properties
r34349 r34428 14 14 # If not, choose the next higher number that is available, or the gradle build will break. 15 15 plugin.compile.version=13860 16 plugin.requires=apache-commons;apache-http 16 plugin.requires=apache-commons;apache-http;utilsplugin2 17 17 18 18 # Character encoding of Gradle files -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java
r34385 r34428 12 12 /** 13 13 * Abstract superclass for all image objects. At the moment there are 3, 14 * {@link StreetsideImportedImage}, {@link StreetsideImage}, &{@link StreetsideCubemap}.14 * {@link StreetsideImportedImage}, {@link StreetsideImage}, {@link StreetsideCubemap}. 15 15 * 16 16 * @author nokutu -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBox.java
r34416 r34428 8 8 9 9 import java.awt.image.BufferedImage; 10 11 import org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils; 10 12 11 13 import javafx.animation.AnimationTimer; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34419 r34428 5 5 import java.text.MessageFormat; 6 6 import java.util.ArrayList; 7 import java.util.EnumSet; 7 8 import java.util.HashMap; 8 9 import java.util.List; … … 20 21 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideViewerDialog; 21 22 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel; 23 import org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils; 22 24 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 23 25 … … 35 37 protected boolean cancelled; 36 38 private long startTime; 37 private Map<String, BufferedImage> tileImages = new ConcurrentHashMap();//new HashMap<>(); 39 40 private Map<String, BufferedImage> tileImages = new ConcurrentHashMap<>(); 41 42 private int currentTileCount = 0; 38 43 39 44 /** … … 55 60 } 56 61 57 @Override 62 /** 63 * Fired when any image is added to the database. 64 */ 65 @Override 58 66 public void imagesAdded() { 59 // Do nothing 60 } 61 62 @Override 63 public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 64 startTime = System.currentTimeMillis(); 67 // Not implemented by the CubemapBuilder 68 } 69 70 /** 71 * Fired when the selected image is changed by something different from 72 * manually clicking on the icon. 73 * 74 * @param oldImage 75 * Old selected {@link StreetsideAbstractImage} 76 * @param newImage 77 * New selected {@link StreetsideAbstractImage} 78 * 79 * @see StreetsideDataListener 80 */ 81 @Override 82 public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage) { 83 startTime = System.currentTimeMillis(); 65 84 66 85 if (newImage != null) { … … 90 109 public void downloadCubemapImages(String imageId) { 91 110 92 final int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 93 final int maxRows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 94 final int maxThreadCount = 6 * maxCols * maxRows; 111 final int maxThreadCount = StreetsideProperties.DOWNLOAD_CUBEFACE_TILES_TOGETHER.get()?6:6 * CubemapUtils.getMaxCols() * CubemapUtils.getMaxRows(); 95 112 96 113 int fails = 0; 97 114 98 int min = 0; int max = (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?96:24)*2; 99 100 String[] message = new String[2]; 115 // TODO: message for progress bar 116 String[] message = new String[2]; 101 117 message[0] = MessageFormat.format("Downloading Streetside imagery for {0}", imageId); 102 118 message[1] = "Wait for completion……."; 103 119 104 long startTime = System.currentTimeMillis(); 105 106 try { 107 108 ExecutorService pool = Executors.newFixedThreadPool(maxThreadCount); 109 List<Callable<String>> tasks = new ArrayList<>(maxThreadCount); 110 111 // launch 4-tiled (low-res) downloading tasks . . . 112 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 113 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 114 int tileNr = 0; 115 for (int j = 0; j < maxCols; j++) { 116 for (int k = 0; k < maxRows; k++) { 117 118 String tileId = String.valueOf(imageId + CubemapUtils.getFaceNumberForCount(i) 119 + Integer.valueOf(tileNr++).toString()); 120 tasks.add(new TileDownloadingTask(tileId)); 121 } 122 } 123 } 124 125 List<Future<String>> results = pool.invokeAll(tasks); 126 for (Future<String> ff : results) { 127 128 if(StreetsideProperties.DEBUGING_ENABLED.get()) { 129 logger.debug(MessageFormat.format("Completed tile downloading task {0} in {1} seconds.", ff.get(), (startTime - System.currentTimeMillis())/ 1000)); 130 } 131 } 132 133 // launch 16-tiled (high-res) downloading tasks 134 } else if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 135 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 136 for (int j = 0; j < maxCols; j++) { 137 for (int k = 0; k < maxRows; k++) { 138 139 String tileId = String.valueOf(imageId + CubemapUtils.getFaceNumberForCount(i) 140 + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString())); 141 tasks.add(new TileDownloadingTask(tileId)); 142 } 143 } 144 } 145 146 List<Future<String>> results = pool.invokeAll(tasks); 147 for (Future<String> ff : results) { 148 if(StreetsideProperties.DEBUGING_ENABLED.get()) { 149 logger.debug(MessageFormat.format("Completed tile downloading task {0} in {1} seconds.",ff.get(), 150 (System.currentTimeMillis())/ 1000 - startTime)); 151 } 152 } 153 } 154 } catch (Exception ee) { 155 fails++; 156 logger.error("Error loading tile for image " + imageId); 157 ee.printStackTrace(); 158 } 159 160 long stopTime = System.currentTimeMillis(); 161 long runTime = stopTime - startTime; 162 163 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 164 logger.debug(MessageFormat.format("Tile imagery downloading tasks completed in {0} seconds.", runTime/1000)); 165 } 166 167 if (fails > 0) { 168 logger.error(Integer.valueOf(fails) + " downloading tasks failed!"); 169 } 170 171 } 172 173 @Override 174 public void tileAdded(String tileId) { 175 // determine whether all tiles have been set for each of the 176 // six cubemap faces. If so, build the images for the faces 177 // and set the views in the cubemap box. 178 179 int tileCount = 0; 180 181 tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size(); 182 183 int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 184 int maxRows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 185 186 if (tileCount == (CubemapUtils.NUM_SIDES * maxCols * maxRows)) { 187 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 188 logger.debug(MessageFormat.format("{0} tile images ready for building cumbemap faces for cubemap {1}.", tileCount, 189 CubemapBuilder.getInstance().getCubemap().getId())); 190 } 191 192 buildCubemapFaces(); 193 } 194 } 195 196 @Override 197 public void tilesAdded(String[] tileIds) { 198 // determine whether all tiles have been set for each of the 120 long startTime = System.currentTimeMillis(); 121 122 try { 123 124 ExecutorService pool = Executors.newFixedThreadPool(maxThreadCount); 125 List<Callable<List<String>>> tasks = new ArrayList<>(maxThreadCount); 126 127 if (StreetsideProperties.DOWNLOAD_CUBEFACE_TILES_TOGETHER.get()) { 128 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> { 129 String tileId = String.valueOf(imageId + face.getValue()); 130 tasks.add(new TileDownloadingTask(tileId)); 131 }); 132 } else { 133 134 // launch 4-tiled (low-res) downloading tasks . . . 135 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 136 // download all imagery for each cubeface at once 137 138 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 139 int tileNr = 0; 140 for (int j = 0; j < CubemapUtils.getMaxCols(); j++) { 141 for (int k = 0; k < CubemapUtils.getMaxRows(); k++) { 142 143 String tileId = String 144 .valueOf(imageId + CubemapUtils.getFaceNumberForCount(i) + Integer.valueOf(tileNr++).toString()); 145 tasks.add(new TileDownloadingTask(tileId)); 146 } 147 } 148 } 149 150 List<Future<List<String>>> results = pool.invokeAll(tasks); 151 /*for (Future<List<String>> ff : results) { 152 153 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 154 logger.debug( 155 MessageFormat.format( 156 "Completed tile downloading task {0} in {1} seconds.", ff.get().toString(), 157 (System.currentTimeMillis()) / 1000 - startTime) 158 ); 159 } 160 }*/ 161 162 // launch 16-tiled (high-res) downloading tasks 163 } else if (StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 164 165 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 166 for (int j = 0; j < CubemapUtils.getMaxCols(); j++) { 167 for (int k = 0; k < CubemapUtils.getMaxRows(); k++) { 168 169 String tileId = String 170 .valueOf(imageId + CubemapUtils.getFaceNumberForCount(i) + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString())); 171 tasks.add(new TileDownloadingTask(tileId)); 172 } 173 } 174 } 175 } 176 } // finish preparing tasks for invocation 177 178 List<Future<List<String>>> results = pool.invokeAll(tasks); 179 for (Future<List<String>> ff : results) { 180 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 181 logger.debug( 182 MessageFormat.format( 183 "Completed tile downloading task {0} in {1} seconds.", ff.get().toString(), 184 ((System.currentTimeMillis()) - startTime)/1000) 185 ); 186 } 187 } 188 } catch (Exception ee) { 189 fails++; 190 logger.error("Error loading tile for image " + imageId); 191 ee.printStackTrace(); 192 } 193 194 long stopTime = System.currentTimeMillis(); 195 long runTime = stopTime - startTime; 196 197 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 198 logger.debug(MessageFormat.format("Tile imagery downloading tasks completed in {0} seconds.", runTime / 1000)); 199 } 200 201 if (fails > 0) { 202 logger.error(Integer.valueOf(fails) + " downloading tasks failed!"); 203 } 204 } 205 206 /** 207 * Fired when a TileDownloadingTask has completed downloading an image tile. When all of the tiles for the Cubemap 208 * have been downloaded, the CubemapBuilder assembles the cubemap. 209 * 210 * @param tileId 211 * the complete quadKey of the imagery tile, including cubeface and row/column in quaternary. 212 * @see TileDownloadingTask 213 */ 214 @Override 215 public void tileAdded(String tileId) { 216 // determine whether four tiles have been set for each of the 199 217 // six cubemap faces. If so, build the images for the faces 200 218 // and set the views in the cubemap box. 201 219 202 int tileCount = 0; 203 204 tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size(); 205 206 int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 207 int maxRows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 208 209 if (tileCount == (CubemapUtils.NUM_SIDES * maxCols * maxRows)) { 220 if(currentTileCount>96) { 221 int x = 0; 222 } 223 224 currentTileCount++; 225 226 if (currentTileCount == (CubemapUtils.NUM_SIDES * CubemapUtils.getMaxCols() * CubemapUtils.getMaxRows())) { 210 227 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 211 logger.debug(MessageFormat.format("{0} tile images ready for building cumbemap faces for cubemap {1}.", tileCount, 212 CubemapBuilder.getInstance().getCubemap().getId())); 228 long endTime = System.currentTimeMillis(); 229 long runTime = (endTime - startTime) / 1000; 230 logger.debug( 231 MessageFormat.format( 232 "{0} tile images ready for building cumbemap faces for cubemap {1} in {2} seconds.", currentTileCount, 233 CubemapBuilder.getInstance().getCubemap().getId(), Long.toString(runTime)) 234 ); 213 235 } 214 236 … … 217 239 } 218 240 219 private void buildCubemapFaces() { 220 221 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 222 logger.debug("Assembling cubemap tile images"); 223 } 224 225 CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox(); 241 /** 242 * Assembles the cubemap once all of the tiles have been downloaded. 243 * <p> 244 * The tiles for each cubemap face are cropped and stitched together 245 * then the ImageViews of the cubemap are set with the new imagery. 246 * 247 * @see StreetsideCubemap 248 */ 249 private void buildCubemapFaces() { 250 CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox(); 226 251 ImageView[] views = cmb.getViews(); 227 228 final int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2;229 final int maxRows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2;230 252 231 253 Image finalImages[] = new Image[CubemapUtils.NUM_SIDES]; … … 235 257 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 236 258 237 BufferedImage[] faceTileImages = new BufferedImage[ maxCols * maxRows];238 239 for (int j = 0; j < ( maxCols * maxRows); j++) {259 BufferedImage[] faceTileImages = new BufferedImage[CubemapUtils.getMaxCols() * CubemapUtils.getMaxRows()]; 260 261 for (int j = 0; j < (CubemapUtils.getMaxCols() * CubemapUtils.getMaxRows()); j++) { 240 262 String tileId = String.valueOf(getCubemap().getId() + CubemapUtils.getFaceNumberForCount(i) 241 263 + Integer.valueOf(j).toString()); … … 262 284 .get() ? 16 : 4]; 263 285 264 for (int j = 0; j < maxCols; j++) {265 for (int k = 0; k < maxRows; k++) {286 for (int j = 0; j < CubemapUtils.getMaxCols(); j++) { 287 for (int k = 0; k < CubemapUtils.getMaxRows(); k++) { 266 288 String tileId = String.valueOf(getCubemap().getId() + CubemapUtils.getFaceNumberForCount(i) 267 289 + CubemapUtils.convertDoubleCountNrto16TileNr( … … 303 325 } 304 326 305 CubemapBuilder.getInstance().resetTileImages(); 327 // reset count and image map after assembly 328 resetTileImages(); 329 currentTileCount = 0; 306 330 } 307 331 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java
r34399 r34428 14 14 final static Logger logger = Logger.getLogger(CubemapUtils.class); 15 15 16 private CubemapUtils() { 17 // Private constructor to avoid instantiation 18 } 16 19 17 20 public enum CubefaceType { … … 71 74 public static final String IMPORTED_ID = "00000000"; 72 75 public static final int NUM_SIDES = 6; 73 74 76 public static Map<String,String> rowCol2StreetsideCellAddressMap = null; 75 77 … … 96 98 } 97 99 100 public static int getMaxCols() { 101 return StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()?4:2; 102 } 103 104 public static int getMaxRows() { 105 return getMaxCols(); 106 } 107 98 108 public static String convertDecimal2Quaternary(long inputNum) { 99 109 String res = null; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/ITileDownloadingTaskListener.java
r34416 r34428 16 16 void tileAdded(String imageId); 17 17 18 /**19 * Fired when multiple cubemap tile images are downloaded by a download worker.20 * @param imageId image id21 */22 void tilesAdded(String[] imageId);23 18 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTask.java
r34419 r34428 3 3 4 4 import java.awt.image.BufferedImage; 5 import java.io.IOException; 5 6 import java.text.MessageFormat; 7 import java.util.ArrayList; 6 8 import java.util.List; 7 9 import java.util.Objects; … … 18 20 import us.monoid.web.Resty; 19 21 20 public class TileDownloadingTask implements Callable< String> {22 public class TileDownloadingTask implements Callable<List<String>> { 21 23 22 24 final static Logger logger = Logger.getLogger(TileDownloadingTask.class); 23 25 24 26 private String tileId; 25 private final long startTime = System.currentTimeMillis();26 27 private StreetsideCache cache; 27 28 protected CubemapBuilder cb; … … 98 99 } 99 100 100 101 public Stringcall() throws Exception {101 @Override 102 public List<String> call() throws Exception { 102 103 103 BufferedImage img = ImageIO.read(new Resty().bytes( 104 StreetsideURL.VirtualEarth.streetsideTile(tileId, false).toExternalForm()) 105 .stream()); 104 List<String> res = new ArrayList<>(); 106 105 107 if (img == null) { 108 logger.error("Download of BufferedImage " + tileId + " is null!"); 109 } 106 if (StreetsideProperties.DOWNLOAD_CUBEFACE_TILES_TOGETHER.get()) { 107 // download all imagery for each cubeface at once 108 if (!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 109 // download low-res imagery 110 int tileNr = 0; 111 for (int j = 0; j < CubemapUtils.getMaxCols(); j++) { 112 for (int k = 0; k < CubemapUtils.getMaxRows(); k++) { 113 String quadKey = String.valueOf(tileId + Integer.valueOf(tileNr++).toString()); 114 res.add(downloadTile(quadKey)); 115 } 116 } 117 // download high-res imagery 118 } else { 119 for (int j = 0; j < CubemapUtils.getMaxCols(); j++) { 120 for (int k = 0; k < CubemapUtils.getMaxRows(); k++) { 121 String quadKey = String 122 .valueOf(tileId + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString())); 123 res.add(downloadTile(quadKey)); 124 } 125 } 126 } 127 // task downloads just one tile 128 } else { 129 res.add(downloadTile(tileId)); 130 } 131 return res; 132 } 110 133 111 CubemapBuilder.getInstance().getTileImages().put(tileId, img); 134 private String downloadTile(String tileId) { 135 BufferedImage img; 112 136 113 fireTileAdded(tileId);137 long startTime = System.currentTimeMillis(); 114 138 115 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 116 long endTime = System.currentTimeMillis(); 117 long runTime = (endTime-startTime)/1000; 118 logger.debug(MessageFormat.format("Loaded image for {0} in {1} seconds.", tileId, runTime)); 119 } 139 try { 140 img = ImageIO 141 .read(new Resty().bytes(StreetsideURL.VirtualEarth.streetsideTile(tileId, false).toExternalForm()).stream()); 120 142 121 return tileId; 122 } 143 if (img == null) { 144 logger.error("Download of BufferedImage " + tileId + " is null!"); 145 } 146 147 CubemapBuilder.getInstance().getTileImages().put(tileId, img); 148 149 fireTileAdded(tileId); 150 151 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 152 long endTime = System.currentTimeMillis(); 153 long runTime = (endTime - startTime) / 1000; 154 logger.debug(MessageFormat.format("Loaded image for {0} in {1} seconds.", tileId, runTime)); 155 } 156 } catch (IOException e) { 157 logger.error(MessageFormat.format("Error downloading image for tileId {0}", tileId)); 158 return null; 159 } 160 return tileId; 161 } 123 162 124 163 private void fireTileAdded(String id) { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java
r34416 r34428 57 57 private volatile StreetsideAbstractImage image; 58 58 59 /*public final SideButton nextButton = new SideButton(new NextPictureAction());60 public final SideButton previousButton = new SideButton(new PreviousPictureAction());61 *//**62 * Button used to jump to the image following the red line63 *//*64 public final SideButton redButton = new SideButton(new RedAction());65 *//**66 * Button used to jump to the image following the blue line67 *//*68 public final SideButton blueButton = new SideButton(new BlueAction());69 70 private final SideButton playButton = new SideButton(new PlayAction());71 private final SideButton pauseButton = new SideButton(new PauseAction());72 private final SideButton stopButton = new SideButton(new StopAction());*/73 74 59 private ImageInfoHelpPopup imageInfoHelp; 75 60 … … 107 92 streetsideImageDisplay = new StreetsideImageDisplay(); 108 93 109 /*blueButton.setForeground(Color.BLUE);110 redButton.setForeground(Color.RED);*/111 112 94 setMode(MODE.NORMAL); 113 95 } … … 117 99 */ 118 100 private void addShortcuts() { 119 /*nextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 120 KeyStroke.getKeyStroke("PAGE_DOWN"), "next"); 121 nextButton.getActionMap().put("next", new NextPictureAction()); 122 previousButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 123 KeyStroke.getKeyStroke("PAGE_UP"), "previous"); 124 previousButton.getActionMap().put("previous", 125 new PreviousPictureAction()); 126 blueButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 127 KeyStroke.getKeyStroke("control PAGE_UP"), "blue"); 128 blueButton.getActionMap().put("blue", new BlueAction()); 129 redButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 130 KeyStroke.getKeyStroke("control PAGE_DOWN"), "red"); 131 redButton.getActionMap().put("red", new RedAction());*/ 101 // next, previous, blueAction and redAction from Mapillary removed 132 102 } 133 103 … … 176 146 createLayout( 177 147 streetsideImageDisplay, 178 null//Arrays.asList(playButton, pauseButton, stopButton) 148 null 149 // TODO: Walk Action for Streetside - re-add buttons here 179 150 ); 180 151 case NORMAL: … … 182 153 createLayout( 183 154 streetsideImageDisplay, 184 null //Arrays.asList(blueButton, previousButton, nextButton, redButton)155 null 185 156 ); 186 157 } 187 //disableAllButtons(); 158 188 159 if (MODE.NORMAL.equals(mode)) { 189 160 updateImage(); … … 222 193 streetsideImageDisplay.setImage(null, null); 223 194 setTitle(I18n.tr(StreetsideMainDialog.BASE_TITLE)); 224 //disableAllButtons();225 195 return; 226 196 } 227 197 228 // TODO: help for cubemaps? @rrh229 198 if (imageInfoHelp != null && StreetsideProperties.IMAGEINFO_HELP_COUNTDOWN.get() > 0 && imageInfoHelp.showPopup()) { 230 199 // Count down the number of times the popup will be displayed … … 232 201 } 233 202 234 // Enables/disables next/previous buttons235 /*nextButton.setEnabled(false);236 previousButton.setEnabled(false);*/237 203 if (image.getSequence() != null) { 238 204 StreetsideAbstractImage tempImage = image; … … 250 216 tempImage = tempImage.previous(); 251 217 if (tempImage.isVisible()) { 252 //previousButton.setEnabled(true);253 218 break; 254 219 } … … 290 255 291 256 /** 292 * Disables all the buttons in the dialog293 */294 /*public private void disableAllButtons() {295 nextButton.setEnabled(false);296 previousButton.setEnabled(false);297 blueButton.setEnabled(false);298 redButton.setEnabled(false);299 }*/300 301 /**302 257 * Sets a new StreetsideImage to be shown. 303 258 * … … 407 362 } 408 363 409 // TODO: RedAction for cubemaps? @rrh410 364 @Override 411 365 public void actionPerformed(ActionEvent e) { … … 553 507 || img.getHeight() > streetsideImageDisplay.getImage().getHeight() 554 508 ) { 555 //final StreetsideAbstractImage mai = getImage();556 509 streetsideImageDisplay.setImage( 557 510 img, 558 //mai instanceof StreetsideImage ? ((StreetsideImage) getImage()).getDetections() : null559 511 null); 560 512 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34416 r34428 18 18 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBuilder; 19 19 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils; 20 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils;21 20 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton; 21 import org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils; 22 22 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 23 23 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/BoundsDownloadRunnable.java
r34399 r34428 59 59 60 60 /** 61 * Logs information about the given connection via {@link logger#info(String)}.61 * Logs information about the given connection via {@link Logger}. 62 62 * If it's a {@link HttpURLConnection}, the request method, the response code and the URL itself are logged. 63 63 * Otherwise only the URL is logged. -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34416 r34428 6 6 import java.net.URL; 7 7 import java.net.URLConnection; 8 import java.text.MessageFormat; 8 9 import java.util.ArrayList; 9 10 import java.util.EnumSet; … … 128 129 129 130 } catch (JsonParseException e) { 130 e.printStackTrace();131 logger.error(MessageFormat.format("JSON parsing error occured during Streetside sequence download {0}",e.getMessage())); 131 132 } catch (JsonMappingException e) { 132 e.printStackTrace();133 logger.error(MessageFormat.format("JSON mapping error occured during Streetside sequence download {0}",e.getMessage())); 133 134 } catch (IOException e) { 134 e.printStackTrace();135 logger.error(MessageFormat.format("Input/output error occured during Streetside sequence download {0}",e.getMessage())); 135 136 } 136 137 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/mode/package-info.java
r34325 r34428 5 5 * Currently there are two of them: 6 6 * <ul> 7 * <li><strong>{@link org.openstreetmap.josm.plugins.streetside.mode.JoinMode JoinMode}</strong> for joining pictures to make sequences</li>8 7 * <li><strong>{@link org.openstreetmap.josm.plugins.streetside.mode.SelectMode SelectMode}</strong> for selecting pictures in the layer</li> 9 8 * </ul> -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java
r34416 r34428 24 24 public static final IntegerProperty TILE_DOWNLOAD_THREAD_PAUSE_LEN_SEC = new IntegerProperty("streetside.tile-download-thread-pause-len-sec", 60); 25 25 public static final BooleanProperty PREDOWNLOAD_CUBEMAPS = new BooleanProperty("streetside.predownload-cubemaps", false); 26 public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", false); 26 public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", true); 27 public static final BooleanProperty DOWNLOAD_CUBEFACE_TILES_TOGETHER = new BooleanProperty("streetside.download-cubeface-tiles-together", false); 28 27 29 /** 28 30 * If false, all sequences that cross the download bounds are put completely into the StreetsideData object. -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideSequenceIdGenerator.java
r34317 r34428 5 5 6 6 /** 7 * 7 * Utility class to generated unique ids for Streetside "sequences". 8 * Due to the functionality inherited from Mapillary the plugin is structured to 9 * handle sequences of contiguous imagery, but Streetside only has implicit 10 * sequences defined by the "pre" and "ne" attributes. 11 * <p/> 12 * @See StreetsideSequence 8 13 */ 9 14 public class StreetsideSequenceIdGenerator { 10 15 16 private StreetsideSequenceIdGenerator() { 17 // private constructor to avoid instantiation 18 } 11 19 public static String generateId() { 12 20 13 21 return UUID.randomUUID().toString(); 14 22 15 23 } 16 24 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideURL.java
r34417 r34428 324 324 /** 325 325 * Converts a {@link String} into a {@link URL} without throwing a {@link MalformedURLException}. 326 * Instead such an exception will lead to an {@link logger#error(Throwable)}.326 * Instead such an exception will lead to an {@link Logger}. 327 327 * So you should be very confident that your URL is well-formed when calling this method. 328 328 * @param strings the Strings describing the URL -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonDecoder.java
r34399 r34428 96 96 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 97 97 * parameter does not match the required format (this also triggers a warning via 98 * {@link logger#warn(Throwable)}), or the parameter is <code>null</code>.98 * {@link Logger}, or the parameter is <code>null</code>). 99 99 */ 100 100 static Long decodeTimestamp(final String timestamp) { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideDecoder.java
r34365 r34428 96 96 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 97 97 * parameter does not match the required format (this also triggers a warning via 98 * {@link logger#warn(Throwable)}), or the parameter is <code>null</code>.98 * {@link Logger}, or the parameter is <code>null</code>). 99 99 */ 100 100 static Long decodeTimestamp(final String timestamp) { -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImageTest.java
r34416 r34428 13 13 public class StreetsideAbstractImageTest { 14 14 15 @Rule16 public JOSMTestRules rules = new StreetsideTestRules().platform(); 15 /*@Rule 16 public JOSMTestRules rules = new StreetsideTestRules().platform();*/ 17 17 18 18 @Test -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideDataTest.java
r34386 r34428 25 25 public class StreetsideDataTest { 26 26 27 @Rule28 public JOSMTestRules rules = new StreetsideTestRules().platform(); 27 /*@Rule 28 public JOSMTestRules rules = new StreetsideTestRules().platform();*/ 29 29 30 30 private StreetsideData data; … … 96 96 * Tests the selection of images. 97 97 */ 98 @Ignore99 98 @Test 100 99 public void selectTest() { … … 113 112 * {@link StreetsideData#selectPrevious()} methods. 114 113 */ 115 @Ignore116 114 @Test 117 115 public void nextAndPreviousTest() { … … 128 126 } 129 127 130 @Ignore131 128 @Test(expected=IllegalStateException.class) 132 129 public void nextOfNullImgTest() { … … 135 132 } 136 133 137 @Ignore138 134 @Test(expected=IllegalStateException.class) 139 135 public void previousOfNullImgTest() { … … 146 142 * multiselected List should reset. 147 143 */ 148 @Ignore149 144 @Test 150 145 public void multiSelectTest() { -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideLayerTest.java
r34419 r34428 73 73 } 74 74 75 @Ignore76 75 @Test 77 76 public void testClearInstance() { -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtilsTest.java
r34386 r34428 48 48 49 49 /** 50 * Test method for {@link org.openstreetmap.josm.plugins.streetside. cubemap.GraphicsUtils#convertBufferedImage2JavaFXImage(java.awt.image.BufferedImage)}.50 * Test method for {@link org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils#convertBufferedImage2JavaFXImage(java.awt.image.BufferedImage)}. 51 51 */ 52 52 @Ignore … … 57 57 58 58 /** 59 * Test method for {@link org.openstreetmap.josm.plugins.streetside. cubemap.GraphicsUtils#buildMultiTiledCubemapFaceImage(java.awt.image.BufferedImage[])}.59 * Test method for {@link org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils#buildMultiTiledCubemapFaceImage(java.awt.image.BufferedImage[])}. 60 60 */ 61 61 @Ignore … … 66 66 67 67 /** 68 * Test method for {@link org.openstreetmap.josm.plugins.streetside. cubemap.GraphicsUtils#rotateImage(java.awt.image.BufferedImage)}.68 * Test method for {@link org.openstreetmap.josm.plugins.streetside.utils.GraphicsUtils#rotateImage(java.awt.image.BufferedImage)}. 69 69 */ 70 70 @Ignore -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTaskTest.java
r34419 r34428 21 21 public final void testCall() { 22 22 ExecutorService pool = Executors.newFixedThreadPool(1); 23 List<Callable< String>> tasks = new ArrayList<>(1);23 List<Callable<List<String>>> tasks = new ArrayList<>(1); 24 24 tasks.add(new TileDownloadingTask("2202112030033001233")); 25 25 try { 26 List<Future< String>> results = pool.invokeAll(tasks);26 List<Future<List<String>>> results = pool.invokeAll(tasks); 27 27 assertEquals(results.get(0),"2202112030033001233"); 28 28 } catch (InterruptedException e) {
Note:
See TracChangeset
for help on using the changeset viewer.