Changeset 34385 in osm for applications


Ignore:
Timestamp:
2018-07-01T06:27:38+02:00 (6 years ago)
Author:
renerr18
Message:

Fixed bug with privacy link URL and reinstated a portion of the unit tests.

Location:
applications/editors/josm/plugins/MicrosoftStreetside
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/MicrosoftStreetside/.classpath

    r34330 r34385  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<classpath>
    3         <classpathentry including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path="">
     3        <classpathentry excluding="config/" including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path="">
    44                <attributes>
    55                        <attribute name="gradle_scope" value="main"/>
     
    77                </attributes>
    88        </classpathentry>
     9        <classpathentry kind="src" path="config"/>
    910        <classpathentry kind="src" output="bin/minJosmVersion" path="src">
    1011                <attributes>
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java

    r34358 r34385  
    1111
    1212/**
    13  * Abstract superclass for all image objects. At the moment there are just 2,
    14  * {@link StreetsideImportedImage} and {@link StreetsideImage}.
     13 * Abstract superclass for all image objects. At the moment there are 3,
     14 * {@link StreetsideImportedImage}, {@link StreetsideImage}, & {@link StreetsideCubemap}.
    1515 *
    1616 * @author nokutu
     17 * @author renerr18
    1718 *
    1819 */
     
    370371  }
    371372
    372 
    373373}
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideCubemap.java

    r34358 r34385  
    22package org.openstreetmap.josm.plugins.streetside;
    33
    4 import java.awt.image.BufferedImage;
    5 import java.util.EnumSet;
    6 import java.util.HashMap;
    7 import java.util.Map;
    8 
    94import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils;
    115import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    12 
    13 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils.CubemapFaces;
    146
    157/**
     
    1810 *
    1911 */
    20 public class StreetsideCubemap extends StreetsideAbstractImage implements Comparable<StreetsideAbstractImage>{
     12public class StreetsideCubemap extends StreetsideAbstractImage /*implements Comparable<StreetsideAbstractImage>*/{
    2113
    2214        //private static Map<String,Map<String,BufferedImage>> face2TilesMap = new HashMap<String,Map<String,BufferedImage>>();
     
    4032         *            direction is not yet supported in the Streetside plugin).
    4133         */
    42     @SuppressWarnings({ "unchecked", "rawtypes" })
    43         public StreetsideCubemap(String quadId, LatLon latLon, double he) {
    44                 super(quadId, latLon, he);
    45                 /*face2TilesMap = new HashMap();
     34   public StreetsideCubemap(String quadId, LatLon latLon, double he) {
     35           super(quadId, latLon, he);
     36         }
    4637
    47                 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> {
    48                         face2TilesMap.put(face.getValue(), new HashMap<String, BufferedImage>());
    49                 });*/
    50 
    51         }
    52 
    53         /**
    54         * Returns a Map object containing a keyset of cubemap face numbers
    55         *
    56         * {@link CubemapFaces}
    57         *
    58         * for each cubeface number corresponding map if cubemap tile ids and buffered
    59         * cubemap tile imagery is stored until assembly by the CubemapBuilder
    60         * @see org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBuilder
    61         *
    62         * @return the face2TilesMap
    63         */
    64         /*public Map<String, Map<String,BufferedImage>> getFace2TilesMap() {
    65                 return face2TilesMap;
    66         }
    67 */
    6838        /**
    6939         * Comparison method for the StreetsideCubemap object.
     
    12999        }
    130100
    131         /**
    132          * resets the faces2TilesMap, emptying it for a new set of cubemap imagery
    133          */
    134         /*public void resetFaces2TileMap() {
    135                 face2TilesMap = new HashMap<>();
    136 
    137                 EnumSet.allOf(CubemapUtils.CubemapFaces.class).forEach(face -> {
    138                         face2TilesMap.put(face.getValue(), new HashMap<String, BufferedImage>());
    139                 });
    140         }*/
    141101}
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java

    r34365 r34385  
    3232
    3333        private static CubemapBuilder instance;
    34         // TODO: Help Pop-up
    35         private StreetsideViewerHelpPopup streetsideViewerHelp;
    3634        private StreetsideCubemap cubemap;
    3735        protected boolean cancelled;
     
    5351  }
    5452
    55   /**
    56    * @return the tileImages
    57    */
    58   /*public Map<String, BufferedImage> getTileImages() {
    59     return tileImages;
    60   }
    61 
    62   *//**
    63    * @param tileImages the tileImages to set
    64    *//*
    65   public void setTileImages(Map<String, BufferedImage> tileImages) {
    66     this.tileImages = tileImages;
    67   }*/
    68 
    6953  private CubemapBuilder() {
    7054                // private constructor to avoid instantiation
     
    9882                if (cubemap != null && imageId.equals(cubemap.getId())) {
    9983                        tileImages = new HashMap<String,BufferedImage>();
    100                   //CubemapBuilder.getInstance().getCubemap().resetFaces2TileMap();
    101                         downloadCubemapImages(imageId);
     84                  downloadCubemapImages(imageId);
    10285                }
    10386        }
     
    189172        @Override
    190173        public void tileAdded(String tileId) {
    191                 // determine whether four tiles have been set for each of the
     174                // determine whether all tiles have been set for each of the
    192175                // six cubemap faces. If so, build the images for the faces
    193176                // and set the views in the cubemap box.
    194177
    195178                int tileCount = 0;
    196 
    197                 /*for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) {
    198                         String faceNumber = CubemapUtils.getFaceNumberForCount(i);
    199                         Map<String, BufferedImage> faceTileImages = CubemapBuilder.getInstance().getCubemap().getFace2TilesMap()
    200                                         .get(faceNumber);
    201                         tileCount += faceTileImages.values().size();
    202                 }*/
    203179
    204180                tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size();
     
    235211                        for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) {
    236212
    237                                 /*Map<String, BufferedImage> tileImages = CubemapBuilder.getInstance().getCubemap().getFace2TilesMap()
    238                                                 .get(CubemapUtils.getFaceNumberForCount(i));*/
    239 
    240                           BufferedImage[] faceTileImages = new BufferedImage[maxCols * maxRows];
     213                                BufferedImage[] faceTileImages = new BufferedImage[maxCols * maxRows];
    241214
    242215                                for (int j = 0; j < (maxCols * maxRows); j++) {
     
    266239                                int tileCount = 0;
    267240
    268                                 /*Map<String, Map<String, BufferedImage>> face2TilesMap = CubemapBuilder.getInstance().getCubemap()
    269                                                 .getFace2TilesMap();*/
    270                                 //Map<String, BufferedImage> tileImages = face2TilesMap.get(CubemapUtils.getFaceNumberForCount(i));
    271241                                BufferedImage[] faceTileImages = new BufferedImage[StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY
    272242                                                .get() ? 16 : 4];
     
    297267    StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().repaint();
    298268
    299     /*if (!Platform.isFxApplicationThread()) {
    300       Platform.runLater(new Runnable() {
    301         @Override
    302         public void run() {*/
    303 
    304            //try {
    305              /* GraphicsUtils.PlatformHelper.run(() -> {
    306                 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().initialize();
    307             });*/
    308              //StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().initialize();
    309              StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel()
     269    StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel()
    310270                .setScene(StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().getCubemapScene());
    311             /*} catch (NonInvertibleTransformException nite) {
    312               if (StreetsideProperties.DEBUGING_ENABLED.get()) {
    313                 logger.debug(I18n.tr("Error setting scene in 360 viewer panel {0}", nite.getMessage()));
    314               }
    315             }*/
    316         /*}
    317       });
    318     }*/
    319271
    320272    StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().revalidate();
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java

    r34365 r34385  
    99import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    1010import org.openstreetmap.josm.tools.I18n;
    11 import org.openstreetmap.josm.tools.Logging;
    1211
    1312public class CubemapUtils {
     
    3534
    3635                    public static CubefaceType valueOf(int cubefaceType) {
    37                         return (CubefaceType) map.get(cubefaceType);
     36                        return map.get(cubefaceType);
    3837                    }
    3938
     
    122121
    123122        public static String convertQuaternary2Decimal(String inputNum) {
    124                 int len = inputNum.length();
    125                 int power = 1; // Initialize power of base
    126                 int num = 0; // Initialize result
    127                 int base = 4; // This could be used for any base, not just quad
    128 
    129                 // Decimal equivalent is str[len-1]*1 +
    130                 // str[len-1]*base + str[len-1]*(base^2) + ...
    131                 for (int i = len - 1; i >= 0; i--) {
    132                         // A digit in input number must be
    133                         // less than number's base
    134                         int current = Integer.valueOf(String.valueOf(inputNum.substring(i,i+1)));
    135                         if ( current >= 4) {
    136                                 logger.error(I18n.tr("Invalid bubbleId {0}", inputNum));
    137                                 return "-1";
    138                         }
    139 
    140                         num += Integer.valueOf(inputNum.charAt(i)).intValue() * power;
    141                         power = power * base;
    142                 }
    143 
    144                 return Integer.toString(num);
     123
     124          final String res;
     125
     126          if (StreetsideProperties.DEBUGING_ENABLED.get()) {
     127      logger.debug(I18n.tr("convertQuaternary2Decimal input: {0}", inputNum));
     128    }
     129
     130          int len = inputNum.length();
     131    int power = 1;
     132    int num = 0;
     133    int i;
     134
     135    for (i = len - 1; i >= 0; i--)
     136    {
     137        if (Integer.parseInt(inputNum.substring(i,i+1)) >= CubemapUtils.NUM_BASE)
     138        {
     139           logger.error(I18n.tr("Error converting quadkey {0} to decimal.", inputNum));
     140           return "000000000";
     141        }
     142
     143        num += Integer.parseInt(inputNum.substring(i,i+1)) * power;
     144        power = power * CubemapUtils.NUM_BASE;
     145    }
     146
     147                res = Integer.toString(num);
     148
     149                if (StreetsideProperties.DEBUGING_ENABLED.get()) {
     150      logger.debug(I18n.tr("convertQuaternary2Decimal output: {0}", res));
     151    }
     152
     153                return res;
    145154        }
    146155
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java

    r34365 r34385  
    22package org.openstreetmap.josm.plugins.streetside.gui.imageinfo;
    33
     4import java.awt.Font;
    45import java.awt.GridBagConstraints;
    56import java.awt.GridBagLayout;
     
    3738  private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB));
    3839
    39   //private final JLabel numDetectionsLabel;
     40  private final JLabel numDetectionsLabel;
    4041  //private final JCheckBox showDetectionsCheck;
    41   //private final JLabel usernameLabel;
     42  private final JLabel placeholder1Label;
     43  private final JLabel usernameLabel;
    4244  private final JTextPane imgKeyValue;
    4345  private final WebLinkAction imgLinkAction;
     
    5860    SelectionEventManager.getInstance().addSelectionListener(this);
    5961
    60     //numDetectionsLabel = new JLabel();
    61     //numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN));
     62    numDetectionsLabel = new JLabel();
     63    numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN));
     64
     65    placeholder1Label = new JLabel();
    6266
    6367    //showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image"));
     
    7074    );*/
    7175
    72     //usernameLabel = new JLabel();
    73     //usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));
     76    usernameLabel = new JLabel();
     77    usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));
    7478
    7579    imgKeyValue = new SelectableLabel();
     
    101105    gbc.gridwidth = 1;
    102106    gbc.gridheight = 2;
    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++;
     107    root.add(new JLabel(I18n.tr("Placeholder2 label")), gbc);
     108    gbc.gridy += 2;
     109    gbc.gridheight = 1;
     110    root.add(new JLabel(I18n.tr("Blah")), gbc);
     111    gbc.gridy++;
     112    root.add(new JLabel(I18n.tr("Blee")), gbc);
     113    gbc.gridy++;
    110114    root.add(new JLabel(I18n.tr("Image key")), gbc);
    111115    gbc.gridy++;
     
    117121    gbc.gridy = 0;
    118122    gbc.anchor = GridBagConstraints.LINE_START;
    119     //root.add(numDetectionsLabel, gbc);
    120     //gbc.gridy++;
     123    root.add(numDetectionsLabel, gbc);
     124    gbc.gridy++;
    121125    //root.add(showDetectionsCheck, gbc);
    122126    //gbc.gridy++;
    123     //root.add(usernameLabel, gbc);
    124     //gbc.gridy++;
     127    root.add(placeholder1Label, gbc);
     128     gbc.gridy++;
     129    root.add(usernameLabel, gbc);
     130    gbc.gridy++;
    125131    root.add(imgButtons, gbc);
    126132    gbc.gridy++;
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerHelpPopup.java

    r34317 r34385  
    4444                mainText.setFont(SelectableLabel.DEFAULT_FONT);
    4545                mainText.setText("<html><div style='width:250px'>" + I18n.tr(
    46                                 "The Streetside plugin now uses a separate panel to display extra information (like the image key) and actions for the currently selected Streetside image (like viewing it in a browser).")
     46                                "Welcome to the Microsoft Streetside JOSM Plugin. To view the vector bubbles for the 360 degree imagery, select Imagery->Streetside from the JOSM menu.")
    4747                                + "<br><br>"
    4848                                + I18n.tr(
    49                                                 "It can be activated by clicking the left button at the bottom of this message or the button in the toolbar on the left, which uses the same icon.")
     49                                                "Once the blue bubbles appear on the map, click on a vector bubble and undock/maximize the 360 viewer to view the imagery.")
    5050                                + "</div></html>");
    5151                add(mainText, BorderLayout.CENTER);
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java

    r34365 r34385  
    143143                      imageLinkChangeListener.valueChanged(null);
    144144                      StreetsideProperties.CUBEMAP_LINK_TO_BLUR_EDITOR.addListener(imageLinkChangeListener);
    145 
    146 
    147145                    } else {
    148146                      if (imageLinkChangeListener != null) {
  • applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java

    r34365 r34385  
    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   public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", true);
     26  public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", false);
    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/StreetsideUtils.java

    r34358 r34385  
    290290    if (images != null && images.size() > 0) {
    291291      res.add(images.get(0));
     292      try {
    292293      images.remove(0);
    293294      String nextImageId = Long.toString(images.get(0).getNe());
     
    302303        }
    303304      }
     305      } catch (java.lang.UnsupportedOperationException uoe) {
     306        // ignore
     307      }
    304308    }
    305309
Note: See TracChangeset for help on using the changeset viewer.