Ignore:
Timestamp:
2018-06-29T23:30:12+02:00 (6 years ago)
Author:
renerr18
Message:

Fixed error with European Streetside imagery 8-digit bubble ids. Removed defunct unit tests.

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  
    100100
    101101  /*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());
    103103    synchronized (detections) {
    104104      detections.clear();
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java

    r34358 r34365  
    2121import javax.swing.Icon;
    2222
     23import org.apache.log4j.Logger;
    2324import org.openstreetmap.josm.Main;
    2425import org.openstreetmap.josm.data.Bounds;
     
    5051import org.openstreetmap.josm.tools.I18n;
    5152import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    52 import org.openstreetmap.josm.tools.Logging;
    5353
    5454/**
     
    6060public final class StreetsideLayer extends AbstractModifiableLayer implements
    6161ActiveLayerChangeListener, StreetsideDataListener {
     62
     63  final static Logger logger = Logger.getLogger(StreetsideLayer.class);
    6264
    6365  /** The radius of the image marker */
     
    338340  private void drawImageMarker(final Graphics2D g, final StreetsideAbstractImage img) {
    339341    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!");
    341343      return;
    342344    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideDownloadAction.java

    r34358 r34365  
    77import java.awt.event.KeyEvent;
    88
    9 import org.openstreetmap.josm.plugins.streetside.StreetsideLayer;
    10 
     9import org.apache.log4j.Logger;
    1110import org.openstreetmap.josm.actions.JosmAction;
    1211import org.openstreetmap.josm.gui.MainApplication;
    1312import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     13import org.openstreetmap.josm.plugins.streetside.StreetsideLayer;
    1414import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin;
    1515import org.openstreetmap.josm.tools.ImageProvider;
    1616import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    17 import org.openstreetmap.josm.tools.Logging;
    1817import org.openstreetmap.josm.tools.Shortcut;
    1918
     
    2928  private static final long serialVersionUID = 4426446157849005029L;
    3029  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);
    3132
    3233  /**
     
    6263    } catch (IllegalArgumentException e) {
    6364      // 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);
    6566    }
    6667  }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/StreetsideExportAction.java

    r34349 r34365  
    1616import javax.swing.JOptionPane;
    1717
     18import org.apache.log4j.Logger;
    1819import org.openstreetmap.josm.Main;
    1920import org.openstreetmap.josm.actions.JosmAction;
     
    4041
    4142  private static final long serialVersionUID = 6131359489725632369L;
     43
     44  final static Logger logger = Logger.getLogger(StreetsideExportAction.class);
    4245
    4346  private StreetsideExportDialog dialog;
     
    99102        MainApplication.worker.execute(new StreetsideExportManager(images));
    100103      } catch (IOException e1) {
    101         Logging.error(e1);
     104        logger.error(e1);
    102105      }
    103106    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cache/CacheUtils.java

    r34358 r34365  
    55import java.io.IOException;
    66
     7import org.apache.log4j.Logger;
    78import org.openstreetmap.josm.data.cache.CacheEntry;
    89import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
     
    1920*/
    2021public final class CacheUtils {
     22
     23final static Logger logger = Logger.getLogger(CacheUtils.class);
    2124
    2225private static IgnoreDownload ignoreDownload = new IgnoreDownload();
     
    8588   case CUBEMAP:
    8689           if(img.getId()==null) {
    87                    Logging.error("Download cancelled. Image id is null.");
     90                   logger.error("Download cancelled. Image id is null.");
    8891           } else {
    8992                   CubemapBuilder.getInstance().downloadCubemapImages(img.getId());
     
    259262   new StreetsideCache(key, type).submit(lis, false);
    260263 } catch (IOException e) {
    261    Logging.error(e);
     264   logger.error(e);
    262265 }
    263266}
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cache/Caches.java

    r34317 r34365  
    1010import org.apache.commons.jcs.access.CacheAccess;
    1111import org.apache.commons.jcs.engine.behavior.IElementAttributes;
    12 
     12import org.apache.log4j.Logger;
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
     
    1818
    1919public final class Caches {
     20
     21  final static Logger logger = Logger.getLogger(Caches.class);
    2022
    2123        private Caches() {
     
    3941                                c = createNewCache();
    4042                        } 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);
    4244                                c = null;
    4345                        }
     
    9698                                c = JCSCacheManager.getCache("streetside", 10, 10000, Caches.getCacheDirectory().getPath());
    9799                        } 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);
    99101                                c = null;
    100102                        }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java

    r34358 r34365  
    1212import java.util.concurrent.Future;
    1313
     14import org.apache.log4j.Logger;
    1415import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
    1516import org.openstreetmap.josm.plugins.streetside.StreetsideCubemap;
     
    2122import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    2223import org.openstreetmap.josm.tools.I18n;
    23 import org.openstreetmap.josm.tools.Logging;
    2424
    2525import javafx.scene.image.Image;
     
    2828@SuppressWarnings("restriction")
    2929public class CubemapBuilder implements ITileDownloadingTaskListener, StreetsideDataListener {
     30
     31  final static Logger logger = Logger.getLogger(CubemapBuilder.class);
    3032
    3133        private static CubemapBuilder instance;
     
    8991
    9092                        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));
    9294                }
    9395        }
     
    126128                                                                        + Integer.valueOf(tileNr++).toString());// + Integer.valueOf(k).toString()));
    127129                                                        tasks.add(new TileDownloadingTask(tileId));
    128                                                         Logging.debug(
     130                                                        logger.info(
    129131                                                                        I18n.tr("Starting tile downloading task for imageId {0}, cubeface {1}, tileNr {2}",
    130132                                                                                        tileId, CubemapUtils.getFaceNumberForCount(i), String.valueOf(tileNr)));
     
    136138                                for (Future<String> ff : results) {
    137139
    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(),
    139141                                                        (startTime - System.currentTimeMillis())/ 1000));
    140142                                }
     
    149151                                                                        + String.valueOf(Integer.valueOf(j).toString() + Integer.valueOf(k).toString()));
    150152                                                        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              }
    154160                                                }
    155161                                        }
     
    158164                                List<Future<String>> results = pool.invokeAll(tasks);
    159165                                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(),
    161167                                                        (startTime - System.currentTimeMillis())/ 1000));
    162168                                }
     
    164170                } catch (Exception ee) {
    165171                        fails++;
    166                         Logging.error("Error loading tile for image {0}", imageId);
     172                        logger.error(I18n.tr("Error loading tile for image {0}", imageId));
    167173                        ee.printStackTrace();
    168174                }
     
    171177                long runTime = stopTime - startTime;
    172178
    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                }
    174182
    175183                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)));
    177185                }
    178186
     
    200208
    201209                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,
    203212                                        CubemapBuilder.getInstance().getCubemap().getId()));
     213                  }
    204214
    205215                        buildCubemapFaces();
     
    209219        private void buildCubemapFaces() {
    210220
    211           Logging.debug("Assembling cubemap tile images");
     221          if (StreetsideProperties.DEBUGING_ENABLED.get()) {
     222      logger.debug("Assembling cubemap tile images");
     223          }
     224
    212225          CubemapBox cmb = StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().getCubemapBox();
    213226                ImageView[] views = cmb.getViews();
     
    241254                                  final long start = System.nanoTime();
    242255                                        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                                        }
    244259                                }
    245260                                finalImages[i] = GraphicsUtils.convertBufferedImage2JavaFXImage(finalImg);
     
    295310                .setScene(StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getCubemapScene());
    296311            /*} 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              }
    299315            }*/
    300316        /*}
     
    307323    long endTime = System.currentTimeMillis();
    308324    long runTime = (endTime - startTime) / 1000;
    309     Logging.debug(
     325    if (StreetsideProperties.DEBUGING_ENABLED.get()) {
     326      logger.debug(
    310327      I18n.tr(
    311328        "Completed downloading, assembling and setting cubemap imagery for cubemap {0} in {1}", cubemap.getId(), runTime
    312329        )
    313330      );
    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  /**
    318340         * @return the cubemap
    319341         */
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java

    r34358 r34365  
    22package org.openstreetmap.josm.plugins.streetside.cubemap;
    33
    4 import java.text.DateFormat;
    5 import java.text.SimpleDateFormat;
    6 import java.util.Date;
    74import java.util.HashMap;
    85import java.util.Map;
    96import java.util.stream.Stream;
    107
     8import org.apache.log4j.Logger;
    119import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    1210import org.openstreetmap.josm.tools.I18n;
     
    1412
    1513public class CubemapUtils {
     14
     15  final static Logger logger = Logger.getLogger(CubemapUtils.class);
     16
    1617
    1718        public enum CubefaceType {
     
    100101                final StringBuilder sb = new StringBuilder();
    101102
    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                }
    104106
    105107                while (inputNum > 0) {
     
    108110                }
    109111
    110                 sb.append("0");
     112                // TODO: leading zeros added in StreetsideURL now
     113                //sb.append("0");
    111114                res = sb.reverse().toString();
    112115
    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                }
    114119
    115120                return res;
     
    129134                        int current = Integer.valueOf(String.valueOf(inputNum.substring(i,i+1)));
    130135                        if ( current >= 4) {
    131                                 Logging.error(I18n.tr("Invalid bubbleId {0}", inputNum));
     136                                logger.error(I18n.tr("Invalid bubbleId {0}", inputNum));
    132137                                return "-1";
    133138                        }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/GraphicsUtils.java

    r34358 r34365  
    66import java.awt.image.BufferedImage;
    77
     8import org.apache.log4j.Logger;
    89import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    910import org.openstreetmap.josm.tools.I18n;
     
    1617@SuppressWarnings({ "restriction"})
    1718public class GraphicsUtils {
     19
     20  final static Logger logger = Logger.getLogger(GraphicsUtils.class);
    1821
    1922        public static javafx.scene.image.Image convertBufferedImage2JavaFXImage(BufferedImage bf) {
     
    104107        }
    105108
    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)));
    107110        return res;
    108111        }
     
    131134                        }
    132135
    133                 Logging.debug("Images cropped in {0} millisecs.",(System.currentTimeMillis()-start));
     136                logger.info(I18n.tr("Images cropped in {0} millisecs.",(System.currentTimeMillis()-start)));
    134137
    135138                return res;
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/TileDownloadingTask.java

    r34358 r34365  
    33
    44import java.awt.image.BufferedImage;
    5 import java.util.HashMap;
    65import java.util.List;
    76import java.util.Objects;
     
    1110import javax.imageio.ImageIO;
    1211
     12import org.apache.log4j.Logger;
    1313import org.openstreetmap.josm.plugins.streetside.cache.StreetsideCache;
     14import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    1415import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL;
    1516import org.openstreetmap.josm.tools.I18n;
     
    1920
    2021public class TileDownloadingTask implements Callable<String> {
     22
     23  final static Logger logger = Logger.getLogger(TileDownloadingTask.class);
    2124
    2225        private String tileId;
     
    104107
    105108                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));
    107110                }
    108111
     
    119122                fireTileAdded(tileId);
    120123
    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                }
    124129
    125130                return tileId;
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java

    r34349 r34365  
    1919import javax.swing.SwingUtilities;
    2020
     21import org.apache.log4j.Logger;
    2122import org.openstreetmap.josm.data.cache.CacheEntry;
    2223import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
     
    5152        private static final long serialVersionUID = 2645654786827812861L;
    5253
    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
    5458        private static final String MESSAGE_SEPARATOR = " — ";
    5559
     
    269273                                        thumbnailCache.submit(this, false);
    270274                                } catch (final IOException e) {
    271                                         Logging.error(e);
     275                                        logger.error(e);
    272276                                }
    273277
     
    283287                                                imageCache.submit(this, false);
    284288                                        } catch (final IOException e) {
    285                                                 Logging.error(e);
     289                                                logger.error(e);
    286290                                        }
    287291                                }
     
    292296                                        streetsideImageDisplay.setImage(streetsideImage.getImage(), null);
    293297                                } catch (final IOException e) {
    294                                         Logging.error(e);
     298                                        logger.error(e);
    295299                                }
    296300                        }*/
     
    572576                                }
    573577                        } catch (final IOException e) {
    574                                 Logging.error(e);
     578                                logger.error(e);
    575579                        }
    576580                }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsidePreferenceSetting.java

    r34358 r34365  
    2626import javax.swing.SwingUtilities;
    2727
     28import org.apache.log4j.Logger;
    2829import org.openstreetmap.josm.actions.ExpertToggleAction;
    2930import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
     
    3839import org.openstreetmap.josm.plugins.streetside.utils.StreetsideColorScheme;
    3940import 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;
    4241import org.openstreetmap.josm.tools.GBC;
    4342import org.openstreetmap.josm.tools.I18n;
    44 import org.openstreetmap.josm.tools.Logging;
    4543
    4644/**
     
    5149 */
    5250public class StreetsidePreferenceSetting implements SubPreferenceSetting, StreetsideLoginListener {
     51
     52  final static Logger logger = Logger.getLogger(StreetsidePreferenceSetting.class);
     53
    5354  private final JComboBox<String> downloadModeComboBox = new JComboBox<>(new String[]{
    5455      DOWNLOAD_MODE.VISIBLE_AREA.getLabel(),
     
    117118        brandImage.setIcon(new ImageIcon(ImageIO.read(is)));
    118119      } else {
    119         Logging.warn("Could not load Streetside brand image!");
     120        logger.warn("Could not load Streetside brand image!");
    120121      }
    121122    } 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!");
    123124    }
    124125    loginPanel.add(brandImage, 0);
     
    252253        StreetsideUtils.browse(StreetsideURL.MainWebsite.connect("http://localhost:"+OAuthPortListener.PORT+'/'));
    253254      } catch (IOException e) {
    254         Logging.error(e);
     255        logger.error(e);
    255256      }*/
    256257    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/dialog/ChooseGeoImageLayersDialog.java

    r34358 r34365  
    3232import org.openstreetmap.josm.tools.I18n;
    3333import org.openstreetmap.josm.tools.ImageProvider;
    34 import org.openstreetmap.josm.tools.Logging;
    3534
    3635public class ChooseGeoImageLayersDialog extends JDialog {
     
    6968              } catch (IllegalArgumentException iae) {
    7069                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));
    7271                if (!GraphicsEnvironment.isHeadless()) {
    7372                  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  
    1414import javax.swing.JTextPane;
    1515
     16import org.apache.log4j.Logger;
    1617import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel;
    1718import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton;
     
    2021import org.openstreetmap.josm.tools.I18n;
    2122import org.openstreetmap.josm.tools.ImageProvider;
    22 import org.openstreetmap.josm.tools.Logging;
    2323
    2424public class ImageInfoHelpPopup extends JPopupMenu {
    2525
    2626  private static final long serialVersionUID = -1721594904273820586L;
     27
     28  final static Logger logger = Logger.getLogger(ImageInfoHelpPopup.class);
    2729
    2830  private final Component invokerComp;
     
    8587        return true;
    8688      } 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));
    8890      }
    8991    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java

    r34358 r34365  
    22package org.openstreetmap.josm.plugins.streetside.gui.imageinfo;
    33
    4 import java.awt.Font;
    54import java.awt.GridBagConstraints;
    65import java.awt.GridBagLayout;
    7 import java.awt.Image;
    86import java.awt.Insets;
    97import java.awt.datatransfer.StringSelection;
     
    1614import javax.swing.JTextPane;
    1715
    18 import org.apache.commons.logging.Log;
    19 import org.apache.commons.logging.LogFactory;
     16import org.apache.log4j.Logger;
    2017import org.openstreetmap.josm.data.osm.DataSelectionListener;
    2118import org.openstreetmap.josm.data.osm.OsmPrimitive;
    22 import org.openstreetmap.josm.data.osm.Tag;
    2319import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    2420import org.openstreetmap.josm.data.preferences.AbstractProperty.ValueChangeListener;
     
    2925import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel;
    3026import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton;
    31 import org.openstreetmap.josm.plugins.streetside.model.UserProfile;
    3227import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    3328import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL;
     
    3631public final class ImageInfoPanel extends ToggleDialog implements StreetsideDataListener, DataSelectionListener {
    3732  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
    3936  private static ImageInfoPanel instance;
    4037  private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB));
     
    4239  //private final JLabel numDetectionsLabel;
    4340  //private final JCheckBox showDetectionsCheck;
    44   private final JLabel usernameLabel;
     41  //private final JLabel usernameLabel;
    4542  private final JTextPane imgKeyValue;
    4643  private final WebLinkAction imgLinkAction;
    4744  private final ClipboardAction copyImgKeyAction;
    48   private final AddTagToPrimitiveAction addStreetsideTagAction;
     45  //private final AddTagToPrimitiveAction addStreetsideTagAction;
    4946  private final JTextPane seqKeyValue;
    5047
     
    7370    );*/
    7471
    75     usernameLabel = new JLabel();
    76     usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));
     72    //usernameLabel = new JLabel();
     73    //usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));
    7774
    7875    imgKeyValue = new SelectableLabel();
     
    8481    copyImgKeyAction.setPopupParent(copyButton);
    8582
    86     addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag"));
     83    //addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag"));
    8784
    8885    JPanel imgKey = new JPanel();
     
    9188    JPanel imgButtons = new JPanel();
    9289    imgButtons.add(new StreetsideButton(imgLinkAction, true));
    93     imgButtons.add(new StreetsideButton(addStreetsideTagAction, true));
     90    //imgButtons.add(new StreetsideButton(addStreetsideTagAction, true));
    9491    seqKeyValue = new SelectableLabel();
    9592
     
    104101    gbc.gridwidth = 1;
    105102    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++;
    113110    root.add(new JLabel(I18n.tr("Image key")), gbc);
    114111    gbc.gridy++;
     
    124121    //root.add(showDetectionsCheck, gbc);
    125122    //gbc.gridy++;
    126     root.add(usernameLabel, gbc);
    127     gbc.gridy++;
     123    //root.add(usernameLabel, gbc);
     124    //gbc.gridy++;
    128125    root.add(imgButtons, gbc);
    129126    gbc.gridy++;
     
    176173  @Override
    177174  public synchronized void selectedImageChanged(final StreetsideAbstractImage oldImage, final StreetsideAbstractImage newImage) {
    178     L.debug(String.format(
     175    logger.info(String.format(
    179176      "Selected Streetside image changed from %s to %s.",
    180177      oldImage instanceof StreetsideImage ? ((StreetsideImage) oldImage).getId() : "‹none›",
     
    196193      imgKeyValue.setText(newImageKey);
    197194      copyImgKeyAction.setContents(new StringSelection(newImageKey));
    198       addStreetsideTagAction.setTag(new Tag("streetside", newImageKey));
     195      //addStreetsideTagAction.setTag(new Tag("streetside", newImageKey));
    199196    } else {
    200197      if (imageLinkChangeListener != null) {
     
    206203      imgKeyValue.setText('‹' + I18n.tr("image has no key") + '›');
    207204      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;
    212209    usernameLabel.setEnabled(user != null);
    213210    if (user != null) {
     
    217214      usernameLabel.setText("‹" + I18n.tr("unknown user") + "›");
    218215      usernameLabel.setIcon(EMPTY_USER_AVATAR);
    219     }
     216    }*/
    220217
    221218    final boolean partOfSequence = newImage != null && newImage.getSequence() != null && newImage.getSequence().getId() != null;
     
    234231  public synchronized void selectionChanged(final SelectionChangeEvent event) {
    235232    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);
    238237  }
    239238}
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java

    r34358 r34365  
    88import javax.swing.SwingUtilities;
    99
     10import org.apache.log4j.Logger;
    1011import org.openstreetmap.josm.data.preferences.AbstractProperty.ValueChangeListener;
    1112import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
     
    2324import org.openstreetmap.josm.tools.Logging;
    2425
    25 
    2626public final class StreetsideViewerPanel extends JPanel
    2727                implements StreetsideDataListener {
    2828
    2929        private static final long serialVersionUID = 4141847503072417190L;
     30
     31        final static Logger logger = Logger.getLogger(StreetsideViewerPanel.class);
    3032
    3133        private JCheckBox highResImageryCheck;
     
    122124                if(newImage!=null) {
    123125
    124                     Logging.debug(String.format(
     126                    logger.info(String.format(
    125127                      "Selected Streetside image changed from %s to %s.",
    126128                      oldImage instanceof StreetsideImage ? ((StreetsideImage) oldImage).getId() : "‹none›",
     
    137139                      );
    138140
    139                       Logging.debug(I18n.tr("Privacy link invoked for Streetside image {0}", bubbleId));
     141                      logger.debug(I18n.tr("Privacy link set for Streetside image {0} quadKey {1}", bubbleId, newImageId));
    140142
    141143                      imageLinkChangeListener.valueChanged(null);
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.java

    r34358 r34365  
    9696                                  //setScene(createScene());
    9797                                /*} 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()));
    9999                                }*/
    100100                        }
     
    493493                                        setScene(scene);
    494494                                } 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()));
    496496                                }
    497497                        }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/WebLinkAction.java

    r34317 r34365  
    99import javax.swing.JOptionPane;
    1010
     11import org.apache.log4j.Logger;
    1112import org.openstreetmap.josm.gui.Notification;
    1213import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils;
     
    1415import org.openstreetmap.josm.tools.ImageProvider;
    1516import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    16 import org.openstreetmap.josm.tools.Logging;
    1717
    1818public class WebLinkAction extends AbstractAction {
    1919
    2020  private static final long serialVersionUID = -8168227661356480455L;
     21
     22  final static Logger logger = Logger.getLogger(WebLinkAction.class);
    2123
    2224  private URL url;
     
    4446    } catch (IOException e1) {
    4547      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);
    4749      new Notification(msg).setIcon(JOptionPane.WARNING_MESSAGE).show();
    4850    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/BoundsDownloadRunnable.java

    r34358 r34365  
    99import java.util.function.Function;
    1010
    11 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3;
    12 
     11import org.apache.log4j.Logger;
    1312import org.openstreetmap.josm.data.Bounds;
    1413import org.openstreetmap.josm.gui.Notification;
    1514import org.openstreetmap.josm.plugins.streetside.StreetsidePlugin;
     15import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3;
    1616import org.openstreetmap.josm.tools.I18n;
    1717import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
     
    1919
    2020public abstract class BoundsDownloadRunnable implements Runnable {
     21
     22  final static Logger logger = Logger.getLogger(BoundsDownloadRunnable.class);
    2123
    2224  protected Bounds bounds;
     
    3032  public void run() {
    3133    URL nextURL = getUrlGenerator().apply(bounds);
    32     Logging.debug("nextURL: {0}", nextURL.toString());
     34    logger.info(I18n.tr("nextURL: {0}", nextURL.toString()));
    3335    try {
    3436      while (nextURL != null) {
    3537        if (Thread.interrupted()) {
    36           Logging.debug("{} for {} interrupted!", getClass().getSimpleName(), bounds.toString());
     38          logger.info(I18n.tr("{} for {} interrupted!", getClass().getSimpleName(), bounds.toString()));
    3739          return;
    3840        }
     
    4345    } catch (IOException e) {
    4446      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);
    4648      if (!GraphicsEnvironment.isHeadless()) {
    4749        new Notification(message)
     
    5557
    5658  /**
    57    * Logs information about the given connection via {@link Logging#info(String)}.
     59   * Logs information about the given connection via {@link logger#info(String)}.
    5860   * If it's a {@link HttpURLConnection}, the request method, the response code and the URL itself are logged.
    5961   * Otherwise only the URL is logged.
     
    7476      message.append(" (").append(info).append(')');
    7577    }
    76     Logging.debug(message.toString());
     78    logger.info(message.toString());
    7779  }
    7880
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java

    r34358 r34365  
    2121import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3;
    2222import org.openstreetmap.josm.tools.I18n;
    23 import org.openstreetmap.josm.tools.Logging;
    2423
    2524import com.fasterxml.jackson.core.JsonParseException;
     
    130129
    131130          bubbleImages.add(image);
    132           Logging.info("Added image with id <" + image.getId() + ">");
     131          logger.info(I18n.tr("Added image with id <" + image.getId() + ">"));
    133132          if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get()) {
    134133            StreetsideData.downloadSurroundingCubemaps(image);
     
    188187
    189188    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));
    191190  }
    192191
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/StreetsideDownloader.java

    r34325 r34365  
    66import java.util.concurrent.TimeUnit;
    77
     8import org.apache.log4j.Logger;
    89import org.openstreetmap.josm.data.Bounds;
    910import org.openstreetmap.josm.data.coor.LatLon;
     
    1415import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    1516import org.openstreetmap.josm.tools.I18n;
    16 import org.openstreetmap.josm.tools.Logging;
    1717
    1818/**
     
    2323 */
    2424public final class StreetsideDownloader {
     25
     26  final static Logger logger = Logger.getLogger(StreetsideDownloader.class);
    2527
    2628  /** Possible download modes. */
     
    198200   * lots of Streetside images are going to be downloaded, slowing down the
    199201   * 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
    201203   * @return {@code true} if the area is too big
    202204   */
     
    227229      executor.awaitTermination(30, TimeUnit.SECONDS);
    228230    } catch (InterruptedException e) {
    229       Logging.error(e);
     231      logger.error(e);
    230232    }
    231233    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  
    22package org.openstreetmap.josm.plugins.streetside.io.download;
    33
     4import org.apache.log4j.Logger;
    45import org.openstreetmap.josm.data.Bounds;
    56import org.openstreetmap.josm.plugins.streetside.StreetsideLayer;
     
    78import org.openstreetmap.josm.plugins.streetside.utils.PluginState;
    89import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils;
     10import org.openstreetmap.josm.tools.I18n;
    911import org.openstreetmap.josm.tools.Logging;
    1012
    1113public class StreetsideSquareDownloadRunnable implements Runnable {
     14
     15  final static Logger logger = Logger.getLogger(StreetsideSquareDownloadRunnable.class);
    1216
    1317  private final Bounds bounds;
     
    4852      //detectionsThread.join();
    4953    } 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));
    5155      Thread.currentThread().interrupt();
    5256    } finally {
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportDownloadThread.java

    r34317 r34365  
    99import javax.imageio.ImageIO;
    1010
     11import org.apache.log4j.Logger;
    1112import org.openstreetmap.josm.data.cache.CacheEntry;
    1213import org.openstreetmap.josm.data.cache.CacheEntryAttributes;
     
    1617import org.openstreetmap.josm.plugins.streetside.cache.CacheUtils;
    1718import org.openstreetmap.josm.plugins.streetside.cache.StreetsideCache;
    18 import org.openstreetmap.josm.tools.Logging;
    1919
    2020/**
     
    2828public class StreetsideExportDownloadThread extends Thread implements
    2929    ICachedLoaderListener {
     30
     31  final static Logger logger = Logger.getLogger(StreetsideExportDownloadThread.class);
    3032
    3133  private final ArrayBlockingQueue<BufferedImage> queue;
     
    5658  @Override
    5759  public void run() {
    58     CacheUtils.submit(this.image.getId(), StreetsideCache.Type.FULL_IMAGE, this);
     60    CacheUtils.submit(image.getId(), StreetsideCache.Type.FULL_IMAGE, this);
    5961  }
    6062
     
    6466    try {
    6567      synchronized (StreetsideExportDownloadThread.class) {
    66         this.queue
     68        queue
    6769            .put(ImageIO.read(new ByteArrayInputStream(data.getContent())));
    68         this.queueImages.put(this.image);
     70        queueImages.put(image);
    6971      }
    7072    } catch (InterruptedException | IOException e) {
    71       Logging.error(e);
     73      logger.error(e);
    7274    }
    7375  }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportManager.java

    r34317 r34365  
    1313import java.util.concurrent.TimeUnit;
    1414
     15import org.apache.log4j.Logger;
    1516import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    1617import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
     
    1819import org.openstreetmap.josm.plugins.streetside.StreetsideImage;
    1920import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;
    20 import org.openstreetmap.josm.tools.Logging;
    2121
    2222/**
     
    3333 */
    3434public class StreetsideExportManager extends PleaseWaitRunnable {
     35
     36  final static Logger logger = Logger.getLogger(StreetsideExportManager.class);
    3537
    3638  private final ArrayBlockingQueue<BufferedImage> queue = new ArrayBlockingQueue<>(10);
     
    5860    this.images = images == null ? new HashSet<>() : images;
    5961    this.path = path;
    60     this.amount = this.images.size();
     62    amount = this.images.size();
    6163  }
    6264
     
    7476    this(null, null);
    7577    for (StreetsideImportedImage image : images) {
    76       this.queue.add(image.getImage());
    77       this.queueImages.add(image);
     78      queue.add(image.getImage());
     79      queueImages.add(image);
    7880    }
    79     this.amount = images.size();
     81    amount = images.size();
    8082  }
    8183
    8284  @Override
    8385  protected void cancel() {
    84     this.writer.interrupt();
    85     this.ex.shutdown();
     86    writer.interrupt();
     87    ex.shutdown();
    8688  }
    8789
     
    8991  protected void realRun() throws IOException {
    9092    // 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) {
    9597      try {
    96         this.writer.join();
     98        writer.join();
    9799      } catch (InterruptedException e) {
    98         Logging.error(e);
     100        logger.error(e);
    99101      }
    100102      return;
    101103    }
    102     this.ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS,
     104    ex = new ThreadPoolExecutor(20, 35, 25, TimeUnit.SECONDS,
    103105      new ArrayBlockingQueue<>(10));
    104     for (StreetsideAbstractImage image : this.images) {
     106    for (StreetsideAbstractImage image : images) {
    105107      if (image instanceof StreetsideImage) {
    106108        try {
    107           this.ex.execute(new StreetsideExportDownloadThread(
    108               (StreetsideImage) image, this.queue, this.queueImages));
     109          ex.execute(new StreetsideExportDownloadThread(
     110              (StreetsideImage) image, queue, queueImages));
    109111        } catch (Exception e) {
    110           Logging.error(e);
     112          logger.error(e);
    111113        }
    112114      } else if (image instanceof StreetsideImportedImage) {
    113115        try {
    114           this.queue.put(((StreetsideImportedImage) image).getImage());
    115           this.queueImages.put(image);
     116          queue.put(((StreetsideImportedImage) image).getImage());
     117          queueImages.put(image);
    116118        } catch (InterruptedException e) {
    117           Logging.error(e);
     119          logger.error(e);
    118120        }
    119121      }
     
    121123        // If the queue is full, waits for it to have more space
    122124        // available before executing anything else.
    123         while (this.ex.getQueue().remainingCapacity() == 0) {
     125        while (ex.getQueue().remainingCapacity() == 0) {
    124126          Thread.sleep(100);
    125127        }
    126128      } catch (Exception e) {
    127         Logging.error(e);
     129        logger.error(e);
    128130      }
    129131    }
    130132    try {
    131       this.writer.join();
     133      writer.join();
    132134    } catch (InterruptedException e) {
    133       Logging.error(e);
     135      logger.error(e);
    134136    }
    135137  }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportWriterThread.java

    r34317 r34365  
    2424import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;
    2525import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
    26 
     26import org.apache.log4j.Logger;
    2727import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2828import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor;
     
    3030import org.openstreetmap.josm.plugins.streetside.StreetsideImage;
    3131import org.openstreetmap.josm.plugins.streetside.StreetsideImportedImage;
    32 import org.openstreetmap.josm.tools.Logging;
    3332
    3433/**
     
    3938 */
    4039public class StreetsideExportWriterThread extends Thread {
     40
     41  final static Logger logger = Logger.getLogger(StreetsideExportWriterThread.class);
    4142
    4243  private final String path;
     
    139140        os.close();
    140141      } catch (InterruptedException e) {
    141         Logging.info("Streetside export cancelled");
     142        logger.info("Streetside export cancelled");
    142143        return;
    143144      } catch (IOException | ImageReadException | ImageWriteException e) {
    144         Logging.error(e);
     145        logger.error(e);
    145146      }
    146147
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/model/MapObject.java

    r34358 r34365  
    1313import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.MainWebsite;
    1414import org.openstreetmap.josm.tools.ImageProvider;
    15 import org.openstreetmap.josm.tools.Logging;
    1615
    1716public class MapObject extends KeyIndexedObject {
     
    6160        return downloadedIcon;
    6261      } 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));
    6463        return ICON_UNKNOWN_TYPE;
    6564      }*/
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/OAuthPortListener.java

    r34317 r34365  
    1414import java.util.regex.Pattern;
    1515
     16import org.apache.log4j.Logger;
     17import org.openstreetmap.josm.Main;
    1618import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    17 
    18 import org.openstreetmap.josm.Main;
    1919import org.openstreetmap.josm.tools.I18n;
    20 import org.openstreetmap.josm.tools.Logging;
    2120
    2221/**
     
    3029public static final int PORT = 8763;
    3130
     31final static Logger logger = Logger.getLogger(OAuthPortListener.class);
     32
    3233protected static final String RESPONSE = String.format(
    3334   "<!DOCTYPE html><html><head><meta charset=\"utf8\"><title>%s</title></head><body>%s</body></html>",
     
    3839
    3940public OAuthPortListener(StreetsideLoginListener loginCallback) {
    40  this.callback = loginCallback;
     41 callback = loginCallback;
    4142}
    4243
     
    6768   StreetsideUser.reset();
    6869
    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));
    7071   // Saves the access token in preferences.
    7172   StreetsideUser.setTokenValid(true);
     
    7374     StreetsideProperties.ACCESS_TOKEN.put(accessToken);
    7475     String username = StreetsideUser.getUsername();
    75      Logging.info("The username is: {0}", username);
     76     logger.info(I18n.tr("The username is: {0}", username));
    7677     if (callback != null) {
    7778       callback.onLogin(username);
     
    7980   }
    8081 } catch (BindException e) {
    81    Logging.warn(e);
     82   logger.warn(e);
    8283 } catch (IOException e) {
    83    Logging.error(e);
     84   logger.error(e);
    8485 }
    8586}
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/oauth/StreetsideUser.java

    r34358 r34365  
    4242         .getString("username");
    4343   } 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));
    4545     reset();
    4646   }
     
    6868         .getString("images_policy");
    6969 } 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));
    7171   reset();
    7272 }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/ImageUtil.java

    r34317 r34365  
    66import javax.swing.ImageIcon;
    77
    8 import org.openstreetmap.josm.tools.Logging;
     8import org.apache.log4j.Logger;
     9import org.openstreetmap.josm.tools.I18n;
    910
    1011public final class ImageUtil {
     12
     13  final static Logger logger = Logger.getLogger(ImageUtil.class);
     14
    1115  private ImageUtil() {
    1216    // Private constructor to avoid instantiation
     
    2125   */
    2226  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    }
    2430    return new ImageIcon(icon.getImage().getScaledInstance(
    2531      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  
    66import javax.swing.JOptionPane;
    77
     8import org.apache.log4j.Logger;
    89import org.openstreetmap.josm.Main;
    9 import org.openstreetmap.josm.tools.Logging;
     10import org.openstreetmap.josm.tools.I18n;
    1011
    1112/**
     
    1415 */
    1516public final class PluginState {
     17
     18  final static Logger logger = Logger.getLogger(PluginState.class);
    1619
    1720  private static boolean submittingChangeset;
     
    3942  public static void finishDownload() {
    4043    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"));
    4245      return;
    4346    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java

    r34358 r34365  
    2424  public static final IntegerProperty TILE_DOWNLOAD_THREAD_PAUSE_LEN_SEC = new IntegerProperty("streetside.tile-download-thread-pause-len-sec", 60);
    2525  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);
    2727  /**
    2828   * 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  
    1515import java.util.Map.Entry;
    1616
     17import org.apache.log4j.Logger;
    1718import org.openstreetmap.josm.data.Bounds;
    1819import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils;
     
    2122
    2223public final class StreetsideURL {
     24
     25  final static Logger logger = Logger.getLogger(StreetsideURL.class);
     26
    2327        /** Base URL of the Bing Bubble API. */
    2428        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/";
    2629        private static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz";
    2730        private static final String BING_MAPS_KEY = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
     
    135138        public static final class VirtualEarth {
    136139                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=6338&n=z";
     140                private static final String BASE_URL_SUFFIX = ".jpg?g=6528&n=z";
    138141
    139142                private VirtualEarth() {
     
    141144                }
    142145
    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()));
    149177                        return url;
    150178                }
     
    166194                public static URL browseImage(String id) {
    167195                        if (id == null) {
    168                                 throw new IllegalArgumentException("The image key must not be null!");
     196                                throw new IllegalArgumentException("The image id may not be null!");
    169197                        }
    170198                        return StreetsideURL.string2URL(VirtualEarth.BASE_URL_PREFIX + id + VirtualEarth.BASE_URL_SUFFIX);
     
    185213                                urlEncodedKey = URLEncoder.encode(key, StandardCharsets.UTF_8.name());
    186214                        } 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));
    188216                                urlEncodedKey = key;
    189217                        }
     
    205233                                urlEncodedId = URLEncoder.encode(id, StandardCharsets.UTF_8.name());
    206234                        } 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));
    208236                                urlEncodedId = id;
    209237                        }
     
    253281                                                        res.add(new URL(urlStr));
    254282                                                } 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));
    256284                                                        e.printStackTrace();
    257285                                                }
     
    270298                                                res.add(new URL(urlStr));
    271299                                        } 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));
    273301                                                e.printStackTrace();
    274302                                        }
     
    305333                                        .append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name()));
    306334                                } catch (final UnsupportedEncodingException e) {
    307                                         Logging.error(e); // This should not happen, as the encoding is hard-coded
     335                                        logger.error(e); // This should not happen, as the encoding is hard-coded
    308336                                }
    309337                        }
    310338                }
    311339
    312                 Logging.info(I18n.tr("queryString result: {0}", ret.toString()));
     340                logger.info(I18n.tr("queryString result: {0}", ret.toString()));
    313341
    314342                return ret.toString();
     
    331359                                .append(StreetsideURL.BING_MAPS_KEY);
    332360                        } catch (final UnsupportedEncodingException e) {
    333                                 Logging.error(e); // This should not happen, as the encoding is hard-coded
    334                         }
    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()));
    337365
    338366                return ret.toString();
     
    346374                        .append(URLEncoder.encode(StreetsideURL.BING_MAPS_KEY, StandardCharsets.UTF_8.name()));
    347375                } catch (final UnsupportedEncodingException e) {
    348                         Logging.error(e); // This should not happen, as the encoding is hard-coded
    349                 }
    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()));
    351379                return ret.toString();
    352380        }
     
    354382        /**
    355383         * 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)}.
    357385         * So you should be very confident that your URL is well-formed when calling this method.
    358386         * @param strings the Strings describing the URL
     
    367395                        return new URL(builder.toString());
    368396                } catch (final MalformedURLException e) {
    369                         Logging.log(Logging.LEVEL_ERROR, String.format(
     397                        logger.error(I18n.tr(String.format(
    370398                                        "The class '%s' produces malformed URLs like '%s'!",
    371399                                        StreetsideURL.class.getName(),
    372400                                        builder
    373                                         ), e);
     401                                        ), e));
    374402                        return null;
    375403                }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonDecoder.java

    r34317 r34365  
    1414import javax.json.JsonValue;
    1515
     16import org.apache.log4j.Logger;
    1617import org.openstreetmap.josm.data.coor.LatLon;
     18import org.openstreetmap.josm.tools.I18n;
    1719import org.openstreetmap.josm.tools.Logging;
    1820
    1921public final class JsonDecoder {
     22
     23  final static Logger logger = Logger.getLogger(JsonDecoder.class);
     24
    2025  private JsonDecoder() {
    2126    // Private constructor to avoid instantiation
     
    9297   * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the
    9398   *   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>.
    95100   */
    96101  static Long decodeTimestamp(final String timestamp) {
     
    100105      } catch (ParseException e) {
    101106        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(
    103108          "Could not decode time from the timestamp `%s` (called by %s.%s:%d)",
    104109          timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber()
    105         ), e);
     110        ), e));
    106111      }
    107112    }
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonImageDetectionDecoder.java

    r34317 r34365  
    1010import javax.json.JsonValue;
    1111
     12import org.apache.log4j.Logger;
    1213import org.openstreetmap.josm.plugins.streetside.model.ImageDetection;
    1314import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3;
    14 import org.openstreetmap.josm.tools.Logging;
    15 
    1615
    1716/**
     
    2019 */
    2120public final class JsonImageDetectionDecoder {
     21
     22  final static Logger logger = Logger.getLogger(JsonImageDetectionDecoder.class);
     23
    2224  private JsonImageDetectionDecoder() {
    2325    // Private constructor to avoid instantiation
     
    4951    if (json instanceof JsonObject) {
    5052      if (!"Polygon".equals(((JsonObject) json).getString("type", null))) {
    51         Logging.warn(
     53        logger.warn(
    5254          String.format("Image detections using shapes with type=%s are currently not supported!",
    5355          ((JsonObject) json).getString("type", "‹no type set›"))
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/api/JsonStreetsideDecoder.java

    r34317 r34365  
    1414import javax.json.JsonValue;
    1515
     16import org.apache.log4j.Logger;
    1617import org.openstreetmap.josm.data.coor.LatLon;
    17 import org.openstreetmap.josm.tools.Logging;
     18import org.openstreetmap.josm.tools.I18n;
    1819
    1920public final class JsonStreetsideDecoder {
     21
     22  final static Logger logger = Logger.getLogger(JsonStreetsideDecoder.class);
     23
    2024  private JsonStreetsideDecoder() {
    2125    // Private constructor to avoid instantiation
     
    9296   * @return the point in time as a {@link Long} value representing the UNIX epoch time, or <code>null</code> if the
    9397   *   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>.
    9599   */
    96100  static Long decodeTimestamp(final String timestamp) {
     
    100104      } catch (ParseException e) {
    101105        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(
    103107          "Could not decode time from the timestamp `%s` (called by %s.%s:%d)",
    104108          timestamp, calledBy.getClassName(), calledBy.getMethodName(), calledBy.getLineNumber()
    105         ), e);
     109        ), e));
    106110      }
    107111    }
Note: See TracChangeset for help on using the changeset viewer.