Changeset 34365 in osm for applications/editors/josm/plugins/MicrosoftStreetside/src
- Timestamp:
- 2018-06-29T23:30:12+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideImage.java
r34358 r34365 100 100 101 101 /*public void setAllDetections(Collection<ImageDetection> newDetections) { 102 Logging.debug("Add {0} detections to image {1}", newDetections.size(), getId());102 logger.debug("Add {0} detections to image {1}", newDetections.size(), getId()); 103 103 synchronized (detections) { 104 104 detections.clear(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java
r34358 r34365 21 21 import javax.swing.Icon; 22 22 23 import org.apache.log4j.Logger; 23 24 import org.openstreetmap.josm.Main; 24 25 import org.openstreetmap.josm.data.Bounds; … … 50 51 import org.openstreetmap.josm.tools.I18n; 51 52 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 52 import org.openstreetmap.josm.tools.Logging;53 53 54 54 /** … … 60 60 public final class StreetsideLayer extends AbstractModifiableLayer implements 61 61 ActiveLayerChangeListener, StreetsideDataListener { 62 63 final static Logger logger = Logger.getLogger(StreetsideLayer.class); 62 64 63 65 /** The radius of the image marker */ … … 338 340 private void drawImageMarker(final Graphics2D g, final StreetsideAbstractImage img) { 339 341 if (img == null || img.getLatLon() == null) { 340 Logging.warn("An image is not painted, because it is null or has no LatLon!");342 logger.warn("An image is not painted, because it is null or has no LatLon!"); 341 343 return; 342 344 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideDownloadAction.java
r34358 r34365 7 7 import java.awt.event.KeyEvent; 8 8 9 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 10 9 import org.apache.log4j.Logger; 11 10 import org.openstreetmap.josm.actions.JosmAction; 12 11 import org.openstreetmap.josm.gui.MainApplication; 13 12 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 13 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; 14 14 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin; 15 15 import org.openstreetmap.josm.tools.ImageProvider; 16 16 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 17 import org.openstreetmap.josm.tools.Logging;18 17 import org.openstreetmap.josm.tools.Shortcut; 19 18 … … 29 28 private static final long serialVersionUID = 4426446157849005029L; 30 29 public static final Shortcut SHORTCUT = Shortcut.registerShortcut("Streetside", tr("Open Streetside layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT); 30 31 final static Logger logger = Logger.getLogger(StreetsideDownloadAction.class); 31 32 32 33 /** … … 62 63 } catch (IllegalArgumentException e) { 63 64 // If the StreetsideLayer is not managed by LayerManager but you try to set it as active layer 64 Logging.warn(e);65 logger.warn(e); 65 66 } 66 67 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideExportAction.java
r34349 r34365 16 16 import javax.swing.JOptionPane; 17 17 18 import org.apache.log4j.Logger; 18 19 import org.openstreetmap.josm.Main; 19 20 import org.openstreetmap.josm.actions.JosmAction; … … 40 41 41 42 private static final long serialVersionUID = 6131359489725632369L; 43 44 final static Logger logger = Logger.getLogger(StreetsideExportAction.class); 42 45 43 46 private StreetsideExportDialog dialog; … … 99 102 MainApplication.worker.execute(new StreetsideExportManager(images)); 100 103 } catch (IOException e1) { 101 Logging.error(e1);104 logger.error(e1); 102 105 } 103 106 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cache/CacheUtils.java
r34358 r34365 5 5 import java.io.IOException; 6 6 7 import org.apache.log4j.Logger; 7 8 import org.openstreetmap.josm.data.cache.CacheEntry; 8 9 import org.openstreetmap.josm.data.cache.CacheEntryAttributes; … … 19 20 */ 20 21 public final class CacheUtils { 22 23 final static Logger logger = Logger.getLogger(CacheUtils.class); 21 24 22 25 private static IgnoreDownload ignoreDownload = new IgnoreDownload(); … … 85 88 case CUBEMAP: 86 89 if(img.getId()==null) { 87 Logging.error("Download cancelled. Image id is null.");90 logger.error("Download cancelled. Image id is null."); 88 91 } else { 89 92 CubemapBuilder.getInstance().downloadCubemapImages(img.getId()); … … 259 262 new StreetsideCache(key, type).submit(lis, false); 260 263 } catch (IOException e) { 261 Logging.error(e);264 logger.error(e); 262 265 } 263 266 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cache/Caches.java
r34317 r34365 10 10 import org.apache.commons.jcs.access.CacheAccess; 11 11 import org.apache.commons.jcs.engine.behavior.IElementAttributes; 12 12 import org.apache.log4j.Logger; 13 13 import org.openstreetmap.josm.Main; 14 14 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; … … 18 18 19 19 public final class Caches { 20 21 final static Logger logger = Logger.getLogger(Caches.class); 20 22 21 23 private Caches() { … … 39 41 c = createNewCache(); 40 42 } catch (IOException e) { 41 Logging.log(Logging.LEVEL_WARN,"Could not initialize cache for " + getClass().getName(), e);43 logger.warn("Could not initialize cache for " + getClass().getName(), e); 42 44 c = null; 43 45 } … … 96 98 c = JCSCacheManager.getCache("streetside", 10, 10000, Caches.getCacheDirectory().getPath()); 97 99 } catch (Exception e) { 98 Logging.log(Logging.LEVEL_WARN,"Could not initialize the Streetside cubemap cache.", e);100 logger.warn("Could not initialize the Streetside cubemap cache.", e); 99 101 c = null; 100 102 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34358 r34365 12 12 import java.util.concurrent.Future; 13 13 14 import org.apache.log4j.Logger; 14 15 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 15 16 import org.openstreetmap.josm.plugins.streetside.StreetsideCubemap; … … 21 22 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 22 23 import org.openstreetmap.josm.tools.I18n; 23 import org.openstreetmap.josm.tools.Logging;24 24 25 25 import javafx.scene.image.Image; … … 28 28 @SuppressWarnings("restriction") 29 29 public class CubemapBuilder implements ITileDownloadingTaskListener, StreetsideDataListener { 30 31 final static Logger logger = Logger.getLogger(CubemapBuilder.class); 30 32 31 33 private static CubemapBuilder instance; … … 89 91 90 92 long runTime = (System.currentTimeMillis()-startTime)/1000; 91 Logging.debug("Completed downloading tiles for {0} in {1} seconds.",newImage.getId(),runTime);93 logger.info(I18n.tr("Completed downloading tiles for {0} in {1} seconds.", newImage.getId(),runTime)); 92 94 } 93 95 } … … 126 128 + Integer.valueOf(tileNr++).toString());// + Integer.valueOf(k).toString())); 127 129 tasks.add(new TileDownloadingTask(tileId)); 128 Logging.debug(130 logger.info( 129 131 I18n.tr("Starting tile downloading task for imageId {0}, cubeface {1}, tileNr {2}", 130 132 tileId, CubemapUtils.getFaceNumberForCount(i), String.valueOf(tileNr))); … … 136 138 for (Future<String> ff : results) { 137 139 138 Logging.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(),140 logger.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 139 141 (startTime - System.currentTimeMillis())/ 1000)); 140 142 } … … 149 151 + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString())); 150 152 tasks.add(new TileDownloadingTask(tileId)); 151 Logging.debug( 152 I18n.tr("Starting tile downloading task for imageId {0}, cubeface {1}, tileID {2}", 153 imageId, CubemapUtils.getFaceNumberForCount(i), tileId)); 153 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 154 logger.debug( 155 I18n.tr( 156 "Starting tile downloading task for imageId {0}, cubeface {1}, tileID {2}", imageId, 157 CubemapUtils.getFaceNumberForCount(i), tileId) 158 ); 159 } 154 160 } 155 161 } … … 158 164 List<Future<String>> results = pool.invokeAll(tasks); 159 165 for (Future<String> ff : results) { 160 Logging.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(),166 logger.debug(I18n.tr("Completed tile downloading task {0} in {1}", ff.get(), 161 167 (startTime - System.currentTimeMillis())/ 1000)); 162 168 } … … 164 170 } catch (Exception ee) { 165 171 fails++; 166 Logging.error("Error loading tile for image {0}", imageId);172 logger.error(I18n.tr("Error loading tile for image {0}", imageId)); 167 173 ee.printStackTrace(); 168 174 } … … 171 177 long runTime = stopTime - startTime; 172 178 173 Logging.debug(I18n.tr("Tile imagery downloading tasks completed in {0}", runTime/1000000)); 179 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 180 logger.debug(I18n.tr("Tile imagery downloading tasks completed in {0}", runTime/1000000)); 181 } 174 182 175 183 if (fails > 0) { 176 Logging.error(I18n.tr("{0} downloading tasks failed.", Integer.valueOf(fails)));184 logger.error(I18n.tr("{0} downloading tasks failed.", Integer.valueOf(fails))); 177 185 } 178 186 … … 200 208 201 209 if (tileCount == (CubemapUtils.NUM_SIDES * maxCols * maxRows)) { 202 Logging.debug(I18n.tr("{0} tile images ready for building cumbemap faces for cubemap {0}", tileCount, 210 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 211 logger.debug(I18n.tr("{0} tile images ready for building cumbemap faces for cubemap {0}", tileCount, 203 212 CubemapBuilder.getInstance().getCubemap().getId())); 213 } 204 214 205 215 buildCubemapFaces(); … … 209 219 private void buildCubemapFaces() { 210 220 211 Logging.debug("Assembling cubemap tile images"); 221 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 222 logger.debug("Assembling cubemap tile images"); 223 } 224 212 225 CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox(); 213 226 ImageView[] views = cmb.getViews(); … … 241 254 final long start = System.nanoTime(); 242 255 finalImg = GraphicsUtils.rotateImage(finalImg); 243 Logging.debug(I18n.tr("Rotation took {0}", System.nanoTime() - start)); 256 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 257 logger.debug(I18n.tr("Rotation took {0}", System.nanoTime() - start)); 258 } 244 259 } 245 260 finalImages[i] = GraphicsUtils.convertBufferedImage2JavaFXImage(finalImg); … … 295 310 .setScene(StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getCubemapScene()); 296 311 /*} catch (NonInvertibleTransformException nite) { 297 // TODO Auto-generated catch block 298 Logging.error(I18n.tr("Error setting scene in 360 viewer panel {0}", nite.getMessage())); 312 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 313 logger.debug(I18n.tr("Error setting scene in 360 viewer panel {0}", nite.getMessage())); 314 } 299 315 }*/ 300 316 /*} … … 307 323 long endTime = System.currentTimeMillis(); 308 324 long runTime = (endTime - startTime) / 1000; 309 Logging.debug( 325 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 326 logger.debug( 310 327 I18n.tr( 311 328 "Completed downloading, assembling and setting cubemap imagery for cubemap {0} in {1}", cubemap.getId(), runTime 312 329 ) 313 330 ); 314 CubemapBuilder.getInstance().setTileImages(new HashMap<String, BufferedImage>()); 315 } 316 317 /** 331 } 332 CubemapBuilder.getInstance().resetTileImages(); 333 } 334 335 private void resetTileImages() { 336 tileImages = new HashMap<String,BufferedImage>(); 337 } 338 339 /** 318 340 * @return the cubemap 319 341 */ -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java
r34358 r34365 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;7 4 import java.util.HashMap; 8 5 import java.util.Map; 9 6 import java.util.stream.Stream; 10 7 8 import org.apache.log4j.Logger; 11 9 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 12 10 import org.openstreetmap.josm.tools.I18n; … … 14 12 15 13 public class CubemapUtils { 14 15 final static Logger logger = Logger.getLogger(CubemapUtils.class); 16 16 17 17 18 public enum CubefaceType { … … 100 101 final StringBuilder sb = new StringBuilder(); 101 102 102 Logging.debug(I18n.tr("convertDecimal2Quaternary input: {0}", Long.toString(inputNum))); 103 103 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 104 logger.debug(I18n.tr("convertDecimal2Quaternary input: {0}", Long.toString(inputNum))); 105 } 104 106 105 107 while (inputNum > 0) { … … 108 110 } 109 111 110 sb.append("0"); 112 // TODO: leading zeros added in StreetsideURL now 113 //sb.append("0"); 111 114 res = sb.reverse().toString(); 112 115 113 Logging.debug(I18n.tr("convertDecimal2Quaternary output: {0}", res)); 116 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 117 logger.debug(I18n.tr("convertDecimal2Quaternary output: {0}", res)); 118 } 114 119 115 120 return res; … … 129 134 int current = Integer.valueOf(String.valueOf(inputNum.substring(i,i+1))); 130 135 if ( current >= 4) { 131 Logging.error(I18n.tr("Invalid bubbleId {0}", inputNum));136 logger.error(I18n.tr("Invalid bubbleId {0}", inputNum)); 132 137 return "-1"; 133 138 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtils.java
r34358 r34365 6 6 import java.awt.image.BufferedImage; 7 7 8 import org.apache.log4j.Logger; 8 9 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 9 10 import org.openstreetmap.josm.tools.I18n; … … 16 17 @SuppressWarnings({ "restriction"}) 17 18 public class GraphicsUtils { 19 20 final static Logger logger = Logger.getLogger(GraphicsUtils.class); 18 21 19 22 public static javafx.scene.image.Image convertBufferedImage2JavaFXImage(BufferedImage bf) { … … 104 107 } 105 108 106 Logging.debug(I18n.tr("Image concatenated in {0} millisecs.",(System.currentTimeMillis()-start)));109 logger.info(I18n.tr("Image concatenated in {0} millisecs.",(System.currentTimeMillis()-start))); 107 110 return res; 108 111 } … … 131 134 } 132 135 133 Logging.debug("Images cropped in {0} millisecs.",(System.currentTimeMillis()-start));136 logger.info(I18n.tr("Images cropped in {0} millisecs.",(System.currentTimeMillis()-start))); 134 137 135 138 return res; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTask.java
r34358 r34365 3 3 4 4 import java.awt.image.BufferedImage; 5 import java.util.HashMap;6 5 import java.util.List; 7 6 import java.util.Objects; … … 11 10 import javax.imageio.ImageIO; 12 11 12 import org.apache.log4j.Logger; 13 13 import org.openstreetmap.josm.plugins.streetside.cache.StreetsideCache; 14 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 14 15 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL; 15 16 import org.openstreetmap.josm.tools.I18n; … … 19 20 20 21 public class TileDownloadingTask implements Callable<String> { 22 23 final static Logger logger = Logger.getLogger(TileDownloadingTask.class); 21 24 22 25 private String tileId; … … 104 107 105 108 if (img == null) { 106 Logging.error(I18n.tr("Download of BufferedImage {0} is null!", tileId));109 logger.error(I18n.tr("Download of BufferedImage {0} is null!", tileId)); 107 110 } 108 111 … … 119 122 fireTileAdded(tileId); 120 123 121 long endTime = System.currentTimeMillis(); 122 long runTime = (endTime-startTime)/1000; 123 Logging.debug("Loaded image for tile {0} in {1} seconds", tileId, runTime); 124 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 125 long endTime = System.currentTimeMillis(); 126 long runTime = (endTime-startTime)/1000; 127 logger.debug(I18n.tr("Loaded image for tile {0} in {1} seconds", tileId, runTime)); 128 } 124 129 125 130 return tileId; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java
r34349 r34365 19 19 import javax.swing.SwingUtilities; 20 20 21 import org.apache.log4j.Logger; 21 22 import org.openstreetmap.josm.data.cache.CacheEntry; 22 23 import org.openstreetmap.josm.data.cache.CacheEntryAttributes; … … 51 52 private static final long serialVersionUID = 2645654786827812861L; 52 53 53 public static final String BASE_TITLE = I18n.marktr("Microsoft Streetside image"); 54 final static Logger logger = Logger.getLogger(StreetsideMainDialog.class); 55 56 public static final String BASE_TITLE = I18n.marktr("Microsoft Streetside image"); 57 54 58 private static final String MESSAGE_SEPARATOR = " — "; 55 59 … … 269 273 thumbnailCache.submit(this, false); 270 274 } catch (final IOException e) { 271 Logging.error(e);275 logger.error(e); 272 276 } 273 277 … … 283 287 imageCache.submit(this, false); 284 288 } catch (final IOException e) { 285 Logging.error(e);289 logger.error(e); 286 290 } 287 291 } … … 292 296 streetsideImageDisplay.setImage(streetsideImage.getImage(), null); 293 297 } catch (final IOException e) { 294 Logging.error(e);298 logger.error(e); 295 299 } 296 300 }*/ … … 572 576 } 573 577 } catch (final IOException e) { 574 Logging.error(e);578 logger.error(e); 575 579 } 576 580 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsidePreferenceSetting.java
r34358 r34365 26 26 import javax.swing.SwingUtilities; 27 27 28 import org.apache.log4j.Logger; 28 29 import org.openstreetmap.josm.actions.ExpertToggleAction; 29 30 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; … … 38 39 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideColorScheme; 39 40 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 40 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL;41 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils;42 41 import org.openstreetmap.josm.tools.GBC; 43 42 import org.openstreetmap.josm.tools.I18n; 44 import org.openstreetmap.josm.tools.Logging;45 43 46 44 /** … … 51 49 */ 52 50 public class StreetsidePreferenceSetting implements SubPreferenceSetting, StreetsideLoginListener { 51 52 final static Logger logger = Logger.getLogger(StreetsidePreferenceSetting.class); 53 53 54 private final JComboBox<String> downloadModeComboBox = new JComboBox<>(new String[]{ 54 55 DOWNLOAD_MODE.VISIBLE_AREA.getLabel(), … … 117 118 brandImage.setIcon(new ImageIcon(ImageIO.read(is))); 118 119 } else { 119 Logging.warn("Could not load Streetside brand image!");120 logger.warn("Could not load Streetside brand image!"); 120 121 } 121 122 } catch (IOException e) { 122 Logging.warn("While reading Streetside brand image, an IO-exception occured!");123 logger.warn("While reading Streetside brand image, an IO-exception occured!"); 123 124 } 124 125 loginPanel.add(brandImage, 0); … … 252 253 StreetsideUtils.browse(StreetsideURL.MainWebsite.connect("http://localhost:"+OAuthPortListener.PORT+'/')); 253 254 } catch (IOException e) { 254 Logging.error(e);255 logger.error(e); 255 256 }*/ 256 257 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/dialog/ChooseGeoImageLayersDialog.java
r34358 r34365 32 32 import org.openstreetmap.josm.tools.I18n; 33 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.Logging;35 34 36 35 public class ChooseGeoImageLayersDialog extends JDialog { … … 69 68 } catch (IllegalArgumentException iae) { 70 69 final String message = I18n.tr("Could not import a geotagged image to the Streetside layer!"); 71 Logging.log(Logging.LEVEL_WARN,message, iae);70 logger.warn(I18n.tr(message, iae)); 72 71 if (!GraphicsEnvironment.isHeadless()) { 73 72 new Notification(message).setIcon(StreetsidePlugin.LOGO.get()).show(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoHelpPopup.java
r34317 r34365 14 14 import javax.swing.JTextPane; 15 15 16 import org.apache.log4j.Logger; 16 17 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel; 17 18 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton; … … 20 21 import org.openstreetmap.josm.tools.I18n; 21 22 import org.openstreetmap.josm.tools.ImageProvider; 22 import org.openstreetmap.josm.tools.Logging;23 23 24 24 public class ImageInfoHelpPopup extends JPopupMenu { 25 25 26 26 private static final long serialVersionUID = -1721594904273820586L; 27 28 final static Logger logger = Logger.getLogger(ImageInfoHelpPopup.class); 27 29 28 30 private final Component invokerComp; … … 85 87 return true; 86 88 } catch (IllegalComponentStateException e) { 87 Logging.log(Logging.LEVEL_WARN,"Could not show ImageInfoHelpPopup, because probably the invoker component has disappeared from screen.", e);89 logger.warn(I18n.tr("Could not show ImageInfoHelpPopup, because probably the invoker component has disappeared from screen.", e)); 88 90 } 89 91 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java
r34358 r34365 2 2 package org.openstreetmap.josm.plugins.streetside.gui.imageinfo; 3 3 4 import java.awt.Font;5 4 import java.awt.GridBagConstraints; 6 5 import java.awt.GridBagLayout; 7 import java.awt.Image;8 6 import java.awt.Insets; 9 7 import java.awt.datatransfer.StringSelection; … … 16 14 import javax.swing.JTextPane; 17 15 18 import org.apache.commons.logging.Log; 19 import org.apache.commons.logging.LogFactory; 16 import org.apache.log4j.Logger; 20 17 import org.openstreetmap.josm.data.osm.DataSelectionListener; 21 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 import org.openstreetmap.josm.data.osm.Tag;23 19 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 24 20 import org.openstreetmap.josm.data.preferences.AbstractProperty.ValueChangeListener; … … 29 25 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel; 30 26 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton; 31 import org.openstreetmap.josm.plugins.streetside.model.UserProfile;32 27 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 33 28 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL; … … 36 31 public final class ImageInfoPanel extends ToggleDialog implements StreetsideDataListener, DataSelectionListener { 37 32 private static final long serialVersionUID = 4141847503072417190L; 38 private static final Log L = LogFactory.getLog(ImageInfoPanel.class); 33 34 final static Logger logger = Logger.getLogger(ImageInfoPanel.class); 35 39 36 private static ImageInfoPanel instance; 40 37 private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB)); … … 42 39 //private final JLabel numDetectionsLabel; 43 40 //private final JCheckBox showDetectionsCheck; 44 private final JLabel usernameLabel; 41 //private final JLabel usernameLabel; 45 42 private final JTextPane imgKeyValue; 46 43 private final WebLinkAction imgLinkAction; 47 44 private final ClipboardAction copyImgKeyAction; 48 private final AddTagToPrimitiveAction addStreetsideTagAction; 45 //private final AddTagToPrimitiveAction addStreetsideTagAction; 49 46 private final JTextPane seqKeyValue; 50 47 … … 73 70 );*/ 74 71 75 usernameLabel = new JLabel(); 76 usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN)); 72 //usernameLabel = new JLabel(); 73 //usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN)); 77 74 78 75 imgKeyValue = new SelectableLabel(); … … 84 81 copyImgKeyAction.setPopupParent(copyButton); 85 82 86 addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag")); 83 //addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag")); 87 84 88 85 JPanel imgKey = new JPanel(); … … 91 88 JPanel imgButtons = new JPanel(); 92 89 imgButtons.add(new StreetsideButton(imgLinkAction, true)); 93 imgButtons.add(new StreetsideButton(addStreetsideTagAction, true)); 90 //imgButtons.add(new StreetsideButton(addStreetsideTagAction, true)); 94 91 seqKeyValue = new SelectableLabel(); 95 92 … … 104 101 gbc.gridwidth = 1; 105 102 gbc.gridheight = 2; 106 root.add(new JLabel(I18n.tr("Image detections")), gbc); 107 gbc.gridy += 2; 108 gbc.gridheight = 1; 109 root.add(new JLabel(I18n.tr("User")), gbc); 110 gbc.gridy++; 111 root.add(new JLabel(I18n.tr("Image actions")), gbc); 112 gbc.gridy++; 103 //root.add(new JLabel(I18n.tr("Image detections")), gbc); 104 //gbc.gridy += 2; 105 //gbc.gridheight = 1; 106 //root.add(new JLabel(I18n.tr("User")), gbc); 107 //gbc.gridy++; 108 //root.add(new JLabel(I18n.tr("Image actions")), gbc); 109 //gbc.gridy++; 113 110 root.add(new JLabel(I18n.tr("Image key")), gbc); 114 111 gbc.gridy++; … … 124 121 //root.add(showDetectionsCheck, gbc); 125 122 //gbc.gridy++; 126 root.add(usernameLabel, gbc); 127 gbc.gridy++; 123 //root.add(usernameLabel, gbc); 124 //gbc.gridy++; 128 125 root.add(imgButtons, gbc); 129 126 gbc.gridy++; … … 176 173 @Override 177 174 public synchronized void selectedImageChanged(final StreetsideAbstractImage oldImage, final StreetsideAbstractImage newImage) { 178 L.debug(String.format(175 logger.info(String.format( 179 176 "Selected Streetside image changed from %s to %s.", 180 177 oldImage instanceof StreetsideImage ? ((StreetsideImage) oldImage).getId() : "‹none›", … … 196 193 imgKeyValue.setText(newImageKey); 197 194 copyImgKeyAction.setContents(new StringSelection(newImageKey)); 198 addStreetsideTagAction.setTag(new Tag("streetside", newImageKey)); 195 //addStreetsideTagAction.setTag(new Tag("streetside", newImageKey)); 199 196 } else { 200 197 if (imageLinkChangeListener != null) { … … 206 203 imgKeyValue.setText('‹' + I18n.tr("image has no key") + '›'); 207 204 copyImgKeyAction.setContents(null); 208 addStreetsideTagAction.setTag(null); 209 } 210 211 final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null; 205 //addStreetsideTagAction.setTag(null); 206 } 207 208 /*final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null; 212 209 usernameLabel.setEnabled(user != null); 213 210 if (user != null) { … … 217 214 usernameLabel.setText("‹" + I18n.tr("unknown user") + "›"); 218 215 usernameLabel.setIcon(EMPTY_USER_AVATAR); 219 } 216 }*/ 220 217 221 218 final boolean partOfSequence = newImage != null && newImage.getSequence() != null && newImage.getSequence().getId() != null; … … 234 231 public synchronized void selectionChanged(final SelectionChangeEvent event) { 235 232 final Collection<? extends OsmPrimitive> sel = event.getSelection(); 236 L.debug(String.format("Selection changed. %d primitives are selected.", sel == null ? 0 : sel.size())); 237 addStreetsideTagAction.setTarget(sel != null && sel.size() == 1 ? sel.iterator().next() : null); 233 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 234 logger.debug(String.format("Selection changed. %d primitives are selected.", sel == null ? 0 : sel.size())); 235 } 236 //addStreetsideTagAction.setTarget(sel != null && sel.size() == 1 ? sel.iterator().next() : null); 238 237 } 239 238 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34358 r34365 8 8 import javax.swing.SwingUtilities; 9 9 10 import org.apache.log4j.Logger; 10 11 import org.openstreetmap.josm.data.preferences.AbstractProperty.ValueChangeListener; 11 12 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; … … 23 24 import org.openstreetmap.josm.tools.Logging; 24 25 25 26 26 public final class StreetsideViewerPanel extends JPanel 27 27 implements StreetsideDataListener { 28 28 29 29 private static final long serialVersionUID = 4141847503072417190L; 30 31 final static Logger logger = Logger.getLogger(StreetsideViewerPanel.class); 30 32 31 33 private JCheckBox highResImageryCheck; … … 122 124 if(newImage!=null) { 123 125 124 Logging.debug(String.format(126 logger.info(String.format( 125 127 "Selected Streetside image changed from %s to %s.", 126 128 oldImage instanceof StreetsideImage ? ((StreetsideImage) oldImage).getId() : "‹none›", … … 137 139 ); 138 140 139 Logging.debug(I18n.tr("Privacy linkinvokedfor Streetside image {0}", bubbleId));141 logger.debug(I18n.tr("Privacy link set for Streetside image {0} quadKey {1}", bubbleId, newImageId)); 140 142 141 143 imageLinkChangeListener.valueChanged(null); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.java
r34358 r34365 96 96 //setScene(createScene()); 97 97 /*} catch (NonInvertibleTransformException e) { 98 Logging.error(I18n.tr("Error initializing StreetsideViewerPanel - JavaFX {0}", e.getMessage()));98 logger.error(I18n.tr("Error initializing StreetsideViewerPanel - JavaFX {0}", e.getMessage())); 99 99 }*/ 100 100 } … … 493 493 setScene(scene); 494 494 } catch (NonInvertibleTransformException e) { 495 Logging.error(I18n.tr("Error initializing StreetsideViewerPanel - JavaFX {0}", e.getMessage()));495 logger.error(I18n.tr("Error initializing StreetsideViewerPanel - JavaFX {0}", e.getMessage())); 496 496 } 497 497 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/WebLinkAction.java
r34317 r34365 9 9 import javax.swing.JOptionPane; 10 10 11 import org.apache.log4j.Logger; 11 12 import org.openstreetmap.josm.gui.Notification; 12 13 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils; … … 14 15 import org.openstreetmap.josm.tools.ImageProvider; 15 16 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 16 import org.openstreetmap.josm.tools.Logging;17 17 18 18 public class WebLinkAction extends AbstractAction { 19 19 20 20 private static final long serialVersionUID = -8168227661356480455L; 21 22 final static Logger logger = Logger.getLogger(WebLinkAction.class); 21 23 22 24 private URL url; … … 44 46 } catch (IOException e1) { 45 47 String msg = I18n.tr("Could not open the URL {0} in a browser", url == null ? "‹null›" : url); 46 Logging.log(Logging.LEVEL_WARN,msg, e1);48 logger.warn(msg, e1); 47 49 new Notification(msg).setIcon(JOptionPane.WARNING_MESSAGE).show(); 48 50 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/BoundsDownloadRunnable.java
r34358 r34365 9 9 import java.util.function.Function; 10 10 11 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3; 12 11 import org.apache.log4j.Logger; 13 12 import org.openstreetmap.josm.data.Bounds; 14 13 import org.openstreetmap.josm.gui.Notification; 15 14 import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin; 15 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3; 16 16 import org.openstreetmap.josm.tools.I18n; 17 17 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; … … 19 19 20 20 public abstract class BoundsDownloadRunnable implements Runnable { 21 22 final static Logger logger = Logger.getLogger(BoundsDownloadRunnable.class); 21 23 22 24 protected Bounds bounds; … … 30 32 public void run() { 31 33 URL nextURL = getUrlGenerator().apply(bounds); 32 Logging.debug("nextURL: {0}", nextURL.toString());34 logger.info(I18n.tr("nextURL: {0}", nextURL.toString())); 33 35 try { 34 36 while (nextURL != null) { 35 37 if (Thread.interrupted()) { 36 Logging.debug("{} for {} interrupted!", getClass().getSimpleName(), bounds.toString());38 logger.info(I18n.tr("{} for {} interrupted!", getClass().getSimpleName(), bounds.toString())); 37 39 return; 38 40 } … … 43 45 } catch (IOException e) { 44 46 String message = I18n.tr("Could not read from URL {0}!", nextURL.toString()); 45 Logging.log(Logging.LEVEL_WARN,message, e);47 logger.warn(message, e); 46 48 if (!GraphicsEnvironment.isHeadless()) { 47 49 new Notification(message) … … 55 57 56 58 /** 57 * Logs information about the given connection via {@link Logging#info(String)}.59 * Logs information about the given connection via {@link logger#info(String)}. 58 60 * If it's a {@link HttpURLConnection}, the request method, the response code and the URL itself are logged. 59 61 * Otherwise only the URL is logged. … … 74 76 message.append(" (").append(info).append(')'); 75 77 } 76 Logging.debug(message.toString());78 logger.info(message.toString()); 77 79 } 78 80 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34358 r34365 21 21 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3; 22 22 import org.openstreetmap.josm.tools.I18n; 23 import org.openstreetmap.josm.tools.Logging;24 23 25 24 import com.fasterxml.jackson.core.JsonParseException; … … 130 129 131 130 bubbleImages.add(image); 132 Logging.info("Added image with id <" + image.getId() + ">");131 logger.info(I18n.tr("Added image with id <" + image.getId() + ">")); 133 132 if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get()) { 134 133 StreetsideData.downloadSurroundingCubemaps(image); … … 188 187 189 188 final long endTime = System.currentTimeMillis(); 190 Logging.debug(I18n.tr("Sucessfully loaded {0} Microsoft Streetside images in {0} ",seq.getImages().size(),endTime-startTime%60));189 logger.info(I18n.tr("Sucessfully loaded {0} Microsoft Streetside images in {0} ",seq.getImages().size(),endTime-startTime%60)); 191 190 } 192 191 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/StreetsideDownloader.java
r34325 r34365 6 6 import java.util.concurrent.TimeUnit; 7 7 8 import org.apache.log4j.Logger; 8 9 import org.openstreetmap.josm.data.Bounds; 9 10 import org.openstreetmap.josm.data.coor.LatLon; … … 14 15 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 15 16 import org.openstreetmap.josm.tools.I18n; 16 import org.openstreetmap.josm.tools.Logging;17 17 18 18 /** … … 23 23 */ 24 24 public final class StreetsideDownloader { 25 26 final static Logger logger = Logger.getLogger(StreetsideDownloader.class); 25 27 26 28 /** Possible download modes. */ … … 198 200 * lots of Streetside images are going to be downloaded, slowing down the 199 201 * program too much. A notification is shown when the download has stopped or continued. 200 * @param area area to check 202 * @param area area to check 201 203 * @return {@code true} if the area is too big 202 204 */ … … 227 229 executor.awaitTermination(30, TimeUnit.SECONDS); 228 230 } catch (InterruptedException e) { 229 Logging.error(e);231 logger.error(e); 230 232 } 231 233 executor = new ThreadPoolExecutor(3, 5, 100, TimeUnit.SECONDS, -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/StreetsideSquareDownloadRunnable.java
r34317 r34365 2 2 package org.openstreetmap.josm.plugins.streetside.io.download; 3 3 4 import org.apache.log4j.Logger; 4 5 import org.openstreetmap.josm.data.Bounds; 5 6 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer; … … 7 8 import org.openstreetmap.josm.plugins.streetside.utils.PluginState; 8 9 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils; 10 import org.openstreetmap.josm.tools.I18n; 9 11 import org.openstreetmap.josm.tools.Logging; 10 12 11 13 public class StreetsideSquareDownloadRunnable implements Runnable { 14 15 final static Logger logger = Logger.getLogger(StreetsideSquareDownloadRunnable.class); 12 16 13 17 private final Bounds bounds; … … 48 52 //detectionsThread.join(); 49 53 } catch (InterruptedException e) { 50 Logging.log(Logging.LEVEL_WARN,"Streetside download interrupted (probably because of closing the layer).", e);54 logger.warn(I18n.tr("Streetside download interrupted (probably because of closing the layer).", e)); 51 55 Thread.currentThread().interrupt(); 52 56 } finally { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportDownloadThread.java
r34317 r34365 9 9 import javax.imageio.ImageIO; 10 10 11 import org.apache.log4j.Logger; 11 12 import org.openstreetmap.josm.data.cache.CacheEntry; 12 13 import org.openstreetmap.josm.data.cache.CacheEntryAttributes; … … 16 17 import org.openstreetmap.josm.plugins.streetside.cache.CacheUtils; 17 18 import org.openstreetmap.josm.plugins.streetside.cache.StreetsideCache; 18 import org.openstreetmap.josm.tools.Logging;19 19 20 20 /** … … 28 28 public class StreetsideExportDownloadThread extends Thread implements 29 29 ICachedLoaderListener { 30 31 final static Logger logger = Logger.getLogger(StreetsideExportDownloadThread.class); 30 32 31 33 private final ArrayBlockingQueue<BufferedImage> queue; … … 56 58 @Override 57 59 public void run() { 58 CacheUtils.submit( this.image.getId(), StreetsideCache.Type.FULL_IMAGE, this);60 CacheUtils.submit(image.getId(), StreetsideCache.Type.FULL_IMAGE, this); 59 61 } 60 62 … … 64 66 try { 65 67 synchronized (StreetsideExportDownloadThread.class) { 66 this.queue68 queue 67 69 .put(ImageIO.read(new ByteArrayInputStream(data.getContent()))); 68 this.queueImages.put(this.image);70 queueImages.put(image); 69 71 } 70 72 } catch (InterruptedException | IOException e) { 71 Logging.error(e);73 logger.error(e); 72 74 } 73 75 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportManager.java
r34317 r34365 13 13 import java.util.concurrent.TimeUnit; 14 14 15 import org.apache.log4j.Logger; 15 16 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 16 17 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; … … 18 19 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 19 20 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage; 20 import org.openstreetmap.josm.tools.Logging;21 21 22 22 /** … … 33 33 */ 34 34 public class StreetsideExportManager extends PleaseWaitRunnable { 35 36 final static Logger logger = Logger.getLogger(StreetsideExportManager.class); 35 37 36 38 private final ArrayBlockingQueue<BufferedImage> queue = new ArrayBlockingQueue<>(10); … … 58 60 this.images = images == null ? new HashSet<>() : images; 59 61 this.path = path; 60 this.amount = this.images.size();62 amount = this.images.size(); 61 63 } 62 64 … … 74 76 this(null, null); 75 77 for (StreetsideImportedImage image : images) { 76 this.queue.add(image.getImage());77 this.queueImages.add(image);78 queue.add(image.getImage()); 79 queueImages.add(image); 78 80 } 79 this.amount = images.size();81 amount = images.size(); 80 82 } 81 83 82 84 @Override 83 85 protected void cancel() { 84 this.writer.interrupt();85 this.ex.shutdown();86 writer.interrupt(); 87 ex.shutdown(); 86 88 } 87 89 … … 89 91 protected void realRun() throws IOException { 90 92 // Starts a writer thread in order to write the pictures on the disk. 91 this.writer = new StreetsideExportWriterThread(this.path, this.queue,92 this.queueImages,this.amount, this.getProgressMonitor());93 this.writer.start();94 if ( this.path == null) {93 writer = new StreetsideExportWriterThread(path, queue, 94 queueImages, amount, getProgressMonitor()); 95 writer.start(); 96 if (path == null) { 95 97 try { 96 this.writer.join();98 writer.join(); 97 99 } catch (InterruptedException e) { 98 Logging.error(e);100 logger.error(e); 99 101 } 100 102 return; 101 103 } 102 this.ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS,104 ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS, 103 105 new ArrayBlockingQueue<>(10)); 104 for (StreetsideAbstractImage image : this.images) {106 for (StreetsideAbstractImage image : images) { 105 107 if (image instanceof StreetsideImage) { 106 108 try { 107 this.ex.execute(new StreetsideExportDownloadThread(108 (StreetsideImage) image, this.queue, this.queueImages));109 ex.execute(new StreetsideExportDownloadThread( 110 (StreetsideImage) image, queue, queueImages)); 109 111 } catch (Exception e) { 110 Logging.error(e);112 logger.error(e); 111 113 } 112 114 } else if (image instanceof StreetsideImportedImage) { 113 115 try { 114 this.queue.put(((StreetsideImportedImage) image).getImage());115 this.queueImages.put(image);116 queue.put(((StreetsideImportedImage) image).getImage()); 117 queueImages.put(image); 116 118 } catch (InterruptedException e) { 117 Logging.error(e);119 logger.error(e); 118 120 } 119 121 } … … 121 123 // If the queue is full, waits for it to have more space 122 124 // available before executing anything else. 123 while ( this.ex.getQueue().remainingCapacity() == 0) {125 while (ex.getQueue().remainingCapacity() == 0) { 124 126 Thread.sleep(100); 125 127 } 126 128 } catch (Exception e) { 127 Logging.error(e);129 logger.error(e); 128 130 } 129 131 } 130 132 try { 131 this.writer.join();133 writer.join(); 132 134 } catch (InterruptedException e) { 133 Logging.error(e);135 logger.error(e); 134 136 } 135 137 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportWriterThread.java
r34317 r34365 24 24 import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory; 25 25 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet; 26 26 import org.apache.log4j.Logger; 27 27 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 28 28 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; … … 30 30 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 31 31 import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage; 32 import org.openstreetmap.josm.tools.Logging;33 32 34 33 /** … … 39 38 */ 40 39 public class StreetsideExportWriterThread extends Thread { 40 41 final static Logger logger = Logger.getLogger(StreetsideExportWriterThread.class); 41 42 42 43 private final String path; … … 139 140 os.close(); 140 141 } catch (InterruptedException e) { 141 Logging.info("Streetside export cancelled");142 logger.info("Streetside export cancelled"); 142 143 return; 143 144 } catch (IOException | ImageReadException | ImageWriteException e) { 144 Logging.error(e);145 logger.error(e); 145 146 } 146 147 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/model/MapObject.java
r34358 r34365 13 13 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.MainWebsite; 14 14 import org.openstreetmap.josm.tools.ImageProvider; 15 import org.openstreetmap.josm.tools.Logging;16 15 17 16 public class MapObject extends KeyIndexedObject { … … 61 60 return downloadedIcon; 62 61 } catch (IOException e) { 63 Logging.log(Logging.LEVEL_WARN,"Failed to download icon " + objectTypeID, e);62 logger.warn(I18n.tr("Failed to download icon " + objectTypeID, e)); 64 63 return ICON_UNKNOWN_TYPE; 65 64 }*/ -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/OAuthPortListener.java
r34317 r34365 14 14 import java.util.regex.Pattern; 15 15 16 import org.apache.log4j.Logger; 17 import org.openstreetmap.josm.Main; 16 18 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 17 18 import org.openstreetmap.josm.Main;19 19 import org.openstreetmap.josm.tools.I18n; 20 import org.openstreetmap.josm.tools.Logging;21 20 22 21 /** … … 30 29 public static final int PORT = 8763; 31 30 31 final static Logger logger = Logger.getLogger(OAuthPortListener.class); 32 32 33 protected static final String RESPONSE = String.format( 33 34 "<!DOCTYPE html><html><head><meta charset=\"utf8\"><title>%s</title></head><body>%s</body></html>", … … 38 39 39 40 public OAuthPortListener(StreetsideLoginListener loginCallback) { 40 this.callback = loginCallback;41 callback = loginCallback; 41 42 } 42 43 … … 67 68 StreetsideUser.reset(); 68 69 69 Logging.info("Successful login with Mapillary, the access token is: {0}", accessToken);70 logger.info(I18n.tr("Successful login with Mapillary, the access token is: {0}", accessToken)); 70 71 // Saves the access token in preferences. 71 72 StreetsideUser.setTokenValid(true); … … 73 74 StreetsideProperties.ACCESS_TOKEN.put(accessToken); 74 75 String username = StreetsideUser.getUsername(); 75 Logging.info("The username is: {0}", username);76 logger.info(I18n.tr("The username is: {0}", username)); 76 77 if (callback != null) { 77 78 callback.onLogin(username); … … 79 80 } 80 81 } catch (BindException e) { 81 Logging.warn(e);82 logger.warn(e); 82 83 } catch (IOException e) { 83 Logging.error(e);84 logger.error(e); 84 85 } 85 86 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/StreetsideUser.java
r34358 r34365 42 42 .getString("username"); 43 43 } catch (IOException e) { 44 Logging.log(Logging.LEVEL_WARN,"Invalid Streetside token, resetting field", e);44 logger.warn(I18n.tr("Invalid Streetside token, resetting field", e)); 45 45 reset(); 46 46 } … … 68 68 .getString("images_policy"); 69 69 } catch (IOException e) { 70 Logging.log(Logging.LEVEL_WARN,"Invalid Streetside token, resetting field", e);70 logger.warn(I18n.tr("Invalid Streetside token, resetting field", e)); 71 71 reset(); 72 72 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/ImageUtil.java
r34317 r34365 6 6 import javax.swing.ImageIcon; 7 7 8 import org.openstreetmap.josm.tools.Logging; 8 import org.apache.log4j.Logger; 9 import org.openstreetmap.josm.tools.I18n; 9 10 10 11 public final class ImageUtil { 12 13 final static Logger logger = Logger.getLogger(ImageUtil.class); 14 11 15 private ImageUtil() { 12 16 // Private constructor to avoid instantiation … … 21 25 */ 22 26 public static ImageIcon scaleImageIcon(final ImageIcon icon, int size) { 23 Logging.debug("Scale icon {0} → {1}", icon.getIconWidth(), size); 27 if(StreetsideProperties.DEBUGING_ENABLED.get()) { 28 logger.debug(I18n.tr("Scale icon {0} → {1}", icon.getIconWidth(), size)); 29 } 24 30 return new ImageIcon(icon.getImage().getScaledInstance( 25 31 icon.getIconWidth() >= icon.getIconHeight() ? size : Math.max(1, Math.round(icon.getIconWidth() / (float) icon.getIconHeight() * size)), -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/PluginState.java
r34317 r34365 6 6 import javax.swing.JOptionPane; 7 7 8 import org.apache.log4j.Logger; 8 9 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.tools. Logging;10 import org.openstreetmap.josm.tools.I18n; 10 11 11 12 /** … … 14 15 */ 15 16 public final class PluginState { 17 18 final static Logger logger = Logger.getLogger(PluginState.class); 16 19 17 20 private static boolean submittingChangeset; … … 39 42 public static void finishDownload() { 40 43 if (runningDownloads == 0) { 41 Logging.warn("The amount of running downloads is equal to 0");44 logger.warn(I18n.tr("The amount of running downloads is equal to 0")); 42 45 return; 43 46 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java
r34358 r34365 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 26 public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", true); 27 27 /** 28 28 * 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/StreetsideURL.java
r34358 r34365 15 15 import java.util.Map.Entry; 16 16 17 import org.apache.log4j.Logger; 17 18 import org.openstreetmap.josm.data.Bounds; 18 19 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils; … … 21 22 22 23 public final class StreetsideURL { 24 25 final static Logger logger = Logger.getLogger(StreetsideURL.class); 26 23 27 /** Base URL of the Bing Bubble API. */ 24 28 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/";26 29 private static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 27 30 private static final String BING_MAPS_KEY = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm"; … … 135 138 public static final class VirtualEarth { 136 139 private static final String BASE_URL_PREFIX = "https://t.ssl.ak.tiles.virtualearth.net/tiles/hs"; 137 private static final String BASE_URL_SUFFIX = ".jpg?g=6 338&n=z";140 private static final String BASE_URL_SUFFIX = ".jpg?g=6528&n=z"; 138 141 139 142 private VirtualEarth() { … … 141 144 } 142 145 143 public static URL streetsideTile(String id, boolean thumbnail) { 144 if(thumbnail) { 145 id = id + "01"; 146 } 147 URL url = StreetsideURL.string2URL(VirtualEarth.BASE_URL_PREFIX + id + VirtualEarth.BASE_URL_SUFFIX); 148 Logging.info("Tile task URL {0} invoked.", url.toString()); 146 public static URL streetsideTile(final String id, boolean thumbnail) { 147 StringBuilder modifiedId = new StringBuilder(); 148 149 // TODO: make code more elegant 150 if (thumbnail) { 151 // pad thumbnail imagery with leading zeros 152 if (id.length() < 16) { 153 for (int i = 0; i < 16 - id.length(); i++) { 154 modifiedId.append("0"); 155 } 156 } 157 modifiedId.append(id).append("01"); 158 } else if(StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()){ 159 // pad 16-tiled imagery with leading zeros 160 if (id.length() < 20) { 161 for (int i = 0; i < 20 - id.length(); i++) { 162 modifiedId.append("0"); 163 } 164 modifiedId.append(id); 165 } 166 } else if(!StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()) { 167 // pad 4-tiled imagery with leading zeros 168 if (id.length() < 19) { 169 for (int i = 0; i < 19 - id.length(); i++) { 170 modifiedId.append("0"); 171 } 172 modifiedId.append(id); 173 } 174 } 175 URL url = StreetsideURL.string2URL(VirtualEarth.BASE_URL_PREFIX + modifiedId.toString() + VirtualEarth.BASE_URL_SUFFIX); 176 logger.info(I18n.tr("Tile task URL {0} invoked.", url.toString())); 149 177 return url; 150 178 } … … 166 194 public static URL browseImage(String id) { 167 195 if (id == null) { 168 throw new IllegalArgumentException("The image key mustnot be null!");196 throw new IllegalArgumentException("The image id may not be null!"); 169 197 } 170 198 return StreetsideURL.string2URL(VirtualEarth.BASE_URL_PREFIX + id + VirtualEarth.BASE_URL_SUFFIX); … … 185 213 urlEncodedKey = URLEncoder.encode(key, StandardCharsets.UTF_8.name()); 186 214 } catch (final UnsupportedEncodingException e) { 187 Logging.log(Logging.LEVEL_ERROR,"Unsupported encoding when URL encoding", e);215 logger.error(I18n.tr("Unsupported encoding when URL encoding", e)); 188 216 urlEncodedKey = key; 189 217 } … … 205 233 urlEncodedId = URLEncoder.encode(id, StandardCharsets.UTF_8.name()); 206 234 } catch (final UnsupportedEncodingException e) { 207 Logging.log(Logging.LEVEL_ERROR,"Unsupported encoding when URL encoding", e);235 logger.error(I18n.tr("Unsupported encoding when URL encoding", e)); 208 236 urlEncodedId = id; 209 237 } … … 253 281 res.add(new URL(urlStr)); 254 282 } catch (final MalformedURLException e) { 255 Logging.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId));283 logger.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId)); 256 284 e.printStackTrace(); 257 285 } … … 270 298 res.add(new URL(urlStr)); 271 299 } catch (final MalformedURLException e) { 272 Logging.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId));300 logger.error(I18n.tr("Error creating URL String for cubemap {0}", cubemapImageId)); 273 301 e.printStackTrace(); 274 302 } … … 305 333 .append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name())); 306 334 } catch (final UnsupportedEncodingException e) { 307 Logging.error(e); // This should not happen, as the encoding is hard-coded335 logger.error(e); // This should not happen, as the encoding is hard-coded 308 336 } 309 337 } 310 338 } 311 339 312 Logging.info(I18n.tr("queryString result: {0}", ret.toString()));340 logger.info(I18n.tr("queryString result: {0}", ret.toString())); 313 341 314 342 return ret.toString(); … … 331 359 .append(StreetsideURL.BING_MAPS_KEY); 332 360 } catch (final UnsupportedEncodingException e) { 333 Logging.error(e); // This should not happen, as the encoding is hard-coded334 } 335 } 336 Logging.info(I18n.tr("queryStreetsideBoundsString result: {0}", ret.toString()));361 logger.error(e); // This should not happen, as the encoding is hard-coded 362 } 363 } 364 logger.info(I18n.tr("queryStreetsideBoundsString result: {0}", ret.toString())); 337 365 338 366 return ret.toString(); … … 346 374 .append(URLEncoder.encode(StreetsideURL.BING_MAPS_KEY, StandardCharsets.UTF_8.name())); 347 375 } catch (final UnsupportedEncodingException e) { 348 Logging.error(e); // This should not happen, as the encoding is hard-coded349 } 350 Logging.info(I18n.tr("queryById result: {0}", ret.toString()));376 logger.error(e); // This should not happen, as the encoding is hard-coded 377 } 378 logger.info(I18n.tr("queryById result: {0}", ret.toString())); 351 379 return ret.toString(); 352 380 } … … 354 382 /** 355 383 * Converts a {@link String} into a {@link URL} without throwing a {@link MalformedURLException}. 356 * Instead such an exception will lead to an {@link Logging#error(Throwable)}.384 * Instead such an exception will lead to an {@link logger#error(Throwable)}. 357 385 * So you should be very confident that your URL is well-formed when calling this method. 358 386 * @param strings the Strings describing the URL … … 367 395 return new URL(builder.toString()); 368 396 } catch (final MalformedURLException e) { 369 Logging.log(Logging.LEVEL_ERROR,String.format(397 logger.error(I18n.tr(String.format( 370 398 "The class '%s' produces malformed URLs like '%s'!", 371 399 StreetsideURL.class.getName(), 372 400 builder 373 ), e); 401 ), e)); 374 402 return null; 375 403 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonDecoder.java
r34317 r34365 14 14 import javax.json.JsonValue; 15 15 16 import org.apache.log4j.Logger; 16 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.tools.I18n; 17 19 import org.openstreetmap.josm.tools.Logging; 18 20 19 21 public final class JsonDecoder { 22 23 final static Logger logger = Logger.getLogger(JsonDecoder.class); 24 20 25 private JsonDecoder() { 21 26 // Private constructor to avoid instantiation … … 92 97 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 93 98 * parameter does not match the required format (this also triggers a warning via 94 * {@link Logging#warn(Throwable)}), or the parameter is <code>null</code>.99 * {@link logger#warn(Throwable)}), or the parameter is <code>null</code>. 95 100 */ 96 101 static Long decodeTimestamp(final String timestamp) { … … 100 105 } catch (ParseException e) { 101 106 StackTraceElement calledBy = e.getStackTrace()[Math.min(e.getStackTrace().length - 1, 2)]; 102 Logging.log(Logging.LEVEL_WARN,String.format(107 logger.warn(I18n.tr(String.format( 103 108 "Could not decode time from the timestamp `%s` (called by %s.%s:%d)", 104 109 timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber() 105 ), e); 110 ), e)); 106 111 } 107 112 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonImageDetectionDecoder.java
r34317 r34365 10 10 import javax.json.JsonValue; 11 11 12 import org.apache.log4j.Logger; 12 13 import org.openstreetmap.josm.plugins.streetside.model.ImageDetection; 13 14 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3; 14 import org.openstreetmap.josm.tools.Logging;15 16 15 17 16 /** … … 20 19 */ 21 20 public final class JsonImageDetectionDecoder { 21 22 final static Logger logger = Logger.getLogger(JsonImageDetectionDecoder.class); 23 22 24 private JsonImageDetectionDecoder() { 23 25 // Private constructor to avoid instantiation … … 49 51 if (json instanceof JsonObject) { 50 52 if (!"Polygon".equals(((JsonObject) json).getString("type", null))) { 51 Logging.warn(53 logger.warn( 52 54 String.format("Image detections using shapes with type=%s are currently not supported!", 53 55 ((JsonObject) json).getString("type", "‹no type set›")) -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideDecoder.java
r34317 r34365 14 14 import javax.json.JsonValue; 15 15 16 import org.apache.log4j.Logger; 16 17 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.tools. Logging;18 import org.openstreetmap.josm.tools.I18n; 18 19 19 20 public final class JsonStreetsideDecoder { 21 22 final static Logger logger = Logger.getLogger(JsonStreetsideDecoder.class); 23 20 24 private JsonStreetsideDecoder() { 21 25 // Private constructor to avoid instantiation … … 92 96 * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the 93 97 * parameter does not match the required format (this also triggers a warning via 94 * {@link Logging#warn(Throwable)}), or the parameter is <code>null</code>.98 * {@link logger#warn(Throwable)}), or the parameter is <code>null</code>. 95 99 */ 96 100 static Long decodeTimestamp(final String timestamp) { … … 100 104 } catch (ParseException e) { 101 105 StackTraceElement calledBy = e.getStackTrace()[Math.min(e.getStackTrace().length - 1, 2)]; 102 Logging.log(Logging.LEVEL_WARN,String.format(106 logger.warn(I18n.tr(String.format( 103 107 "Could not decode time from the timestamp `%s` (called by %s.%s:%d)", 104 108 timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber() 105 ), e); 109 ), e)); 106 110 } 107 111 }
Note:
See TracChangeset
for help on using the changeset viewer.