Changeset 34385 in osm for applications
- Timestamp:
- 2018-07-01T06:27:38+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/.classpath
r34330 r34385 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path=""> 3 <classpathentry excluding="config/" including="data/**|images/**|LICENSE|LICENSE_*" kind="src" output="bin/main" path=""> 4 4 <attributes> 5 5 <attribute name="gradle_scope" value="main"/> … … 7 7 </attributes> 8 8 </classpathentry> 9 <classpathentry kind="src" path="config"/> 9 10 <classpathentry kind="src" output="bin/minJosmVersion" path="src"> 10 11 <attributes> -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideAbstractImage.java
r34358 r34385 11 11 12 12 /** 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}. 15 15 * 16 16 * @author nokutu 17 * @author renerr18 17 18 * 18 19 */ … … 370 371 } 371 372 372 373 373 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideCubemap.java
r34358 r34385 2 2 package org.openstreetmap.josm.plugins.streetside; 3 3 4 import java.awt.image.BufferedImage;5 import java.util.EnumSet;6 import java.util.HashMap;7 import java.util.Map;8 9 4 import org.openstreetmap.josm.data.coor.LatLon; 10 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils;11 5 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 12 13 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils.CubemapFaces;14 6 15 7 /** … … 18 10 * 19 11 */ 20 public class StreetsideCubemap extends StreetsideAbstractImage implements Comparable<StreetsideAbstractImage>{ 12 public class StreetsideCubemap extends StreetsideAbstractImage /*implements Comparable<StreetsideAbstractImage>*/{ 21 13 22 14 //private static Map<String,Map<String,BufferedImage>> face2TilesMap = new HashMap<String,Map<String,BufferedImage>>(); … … 40 32 * direction is not yet supported in the Streetside plugin). 41 33 */ 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 } 46 37 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 numbers55 *56 * {@link CubemapFaces}57 *58 * for each cubeface number corresponding map if cubemap tile ids and buffered59 * cubemap tile imagery is stored until assembly by the CubemapBuilder60 * @see org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBuilder61 *62 * @return the face2TilesMap63 */64 /*public Map<String, Map<String,BufferedImage>> getFace2TilesMap() {65 return face2TilesMap;66 }67 */68 38 /** 69 39 * Comparison method for the StreetsideCubemap object. … … 129 99 } 130 100 131 /**132 * resets the faces2TilesMap, emptying it for a new set of cubemap imagery133 */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 }*/141 101 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34365 r34385 32 32 33 33 private static CubemapBuilder instance; 34 // TODO: Help Pop-up35 private StreetsideViewerHelpPopup streetsideViewerHelp;36 34 private StreetsideCubemap cubemap; 37 35 protected boolean cancelled; … … 53 51 } 54 52 55 /**56 * @return the tileImages57 */58 /*public Map<String, BufferedImage> getTileImages() {59 return tileImages;60 }61 62 *//**63 * @param tileImages the tileImages to set64 *//*65 public void setTileImages(Map<String, BufferedImage> tileImages) {66 this.tileImages = tileImages;67 }*/68 69 53 private CubemapBuilder() { 70 54 // private constructor to avoid instantiation … … 98 82 if (cubemap != null && imageId.equals(cubemap.getId())) { 99 83 tileImages = new HashMap<String,BufferedImage>(); 100 //CubemapBuilder.getInstance().getCubemap().resetFaces2TileMap(); 101 downloadCubemapImages(imageId); 84 downloadCubemapImages(imageId); 102 85 } 103 86 } … … 189 172 @Override 190 173 public void tileAdded(String tileId) { 191 // determine whether fourtiles have been set for each of the174 // determine whether all tiles have been set for each of the 192 175 // six cubemap faces. If so, build the images for the faces 193 176 // and set the views in the cubemap box. 194 177 195 178 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 }*/203 179 204 180 tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size(); … … 235 211 for (int i = 0; i < CubemapUtils.NUM_SIDES; i++) { 236 212 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]; 241 214 242 215 for (int j = 0; j < (maxCols * maxRows); j++) { … … 266 239 int tileCount = 0; 267 240 268 /*Map<String, Map<String, BufferedImage>> face2TilesMap = CubemapBuilder.getInstance().getCubemap()269 .getFace2TilesMap();*/270 //Map<String, BufferedImage> tileImages = face2TilesMap.get(CubemapUtils.getFaceNumberForCount(i));271 241 BufferedImage[] faceTileImages = new BufferedImage[StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY 272 242 .get() ? 16 : 4]; … … 297 267 StreetsideViewerDialog.getInstance().getStreetsideViewerPanel().repaint(); 298 268 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() 310 270 .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 }*/319 271 320 272 StreetsideViewerPanel.getThreeSixtyDegreeViewerPanel().revalidate(); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapUtils.java
r34365 r34385 9 9 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 10 10 import org.openstreetmap.josm.tools.I18n; 11 import org.openstreetmap.josm.tools.Logging;12 11 13 12 public class CubemapUtils { … … 35 34 36 35 public static CubefaceType valueOf(int cubefaceType) { 37 return (CubefaceType)map.get(cubefaceType);36 return map.get(cubefaceType); 38 37 } 39 38 … … 122 121 123 122 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; 145 154 } 146 155 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java
r34365 r34385 2 2 package org.openstreetmap.josm.plugins.streetside.gui.imageinfo; 3 3 4 import java.awt.Font; 4 5 import java.awt.GridBagConstraints; 5 6 import java.awt.GridBagLayout; … … 37 38 private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB)); 38 39 39 //private final JLabel numDetectionsLabel;40 private final JLabel numDetectionsLabel; 40 41 //private final JCheckBox showDetectionsCheck; 41 //private final JLabel usernameLabel; 42 private final JLabel placeholder1Label; 43 private final JLabel usernameLabel; 42 44 private final JTextPane imgKeyValue; 43 45 private final WebLinkAction imgLinkAction; … … 58 60 SelectionEventManager.getInstance().addSelectionListener(this); 59 61 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(); 62 66 63 67 //showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image")); … … 70 74 );*/ 71 75 72 //usernameLabel = new JLabel();73 //usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));76 usernameLabel = new JLabel(); 77 usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN)); 74 78 75 79 imgKeyValue = new SelectableLabel(); … … 101 105 gbc.gridwidth = 1; 102 106 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++; 110 114 root.add(new JLabel(I18n.tr("Image key")), gbc); 111 115 gbc.gridy++; … … 117 121 gbc.gridy = 0; 118 122 gbc.anchor = GridBagConstraints.LINE_START; 119 //root.add(numDetectionsLabel, gbc);120 //gbc.gridy++;123 root.add(numDetectionsLabel, gbc); 124 gbc.gridy++; 121 125 //root.add(showDetectionsCheck, gbc); 122 126 //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++; 125 131 root.add(imgButtons, gbc); 126 132 gbc.gridy++; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerHelpPopup.java
r34317 r34385 44 44 mainText.setFont(SelectableLabel.DEFAULT_FONT); 45 45 mainText.setText("<html><div style='width:250px'>" + I18n.tr( 46 " TheStreetsideplugin now uses a separate panel to display extra information (like the image key) and actions for thecurrentlyselectedStreetsideimage (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.") 47 47 + "<br><br>" 48 48 + 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 theleft, 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.") 50 50 + "</div></html>"); 51 51 add(mainText, BorderLayout.CENTER); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34365 r34385 143 143 imageLinkChangeListener.valueChanged(null); 144 144 StreetsideProperties.CUBEMAP_LINK_TO_BLUR_EDITOR.addListener(imageLinkChangeListener); 145 146 147 145 } else { 148 146 if (imageLinkChangeListener != null) { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java
r34365 r34385 24 24 public static final IntegerProperty TILE_DOWNLOAD_THREAD_PAUSE_LEN_SEC = new IntegerProperty("streetside.tile-download-thread-pause-len-sec", 60); 25 25 public static final BooleanProperty PREDOWNLOAD_CUBEMAPS = new BooleanProperty("streetside.predownload-cubemaps", false); 26 public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", true);26 public static final BooleanProperty DEBUGING_ENABLED = new BooleanProperty("streetside.debugging-enabled", false); 27 27 /** 28 28 * If false, all sequences that cross the download bounds are put completely into the StreetsideData object. -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideUtils.java
r34358 r34385 290 290 if (images != null && images.size() > 0) { 291 291 res.add(images.get(0)); 292 try { 292 293 images.remove(0); 293 294 String nextImageId = Long.toString(images.get(0).getNe()); … … 302 303 } 303 304 } 305 } catch (java.lang.UnsupportedOperationException uoe) { 306 // ignore 307 } 304 308 } 305 309
Note:
See TracChangeset
for help on using the changeset viewer.