Changeset 34416 in osm for applications/editors/josm/plugins/MicrosoftStreetside/src
- Timestamp:
- 2018-07-12T04:13:24+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside
- Files:
-
- 5 deleted
- 24 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside
- Property svn:ignore
-
old new 5 5 logs 6 6 .git 7 .gitattributes 8 .gitignore 7 9 .gradle 8 10 checkstyle-josm-MicrosoftStreetside.xml
-
- Property svn:ignore
-
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideImage.java
r34399 r34416 63 63 } 64 64 65 public StreetsideImage(String id, LatLon latLon) {66 super(id, latLon, 0.0);67 }68 69 65 public StreetsideImage(String id, double la, double lo) { 70 66 super(id, new LatLon(la,lo), 0.0); … … 97 93 public String toString() { 98 94 return String.format( 99 // TODO: format date cd (Gradle build error command line)100 95 "Image[id=%s,lat=%f,lon=%f,he=%f,user=%s]", 101 96 id, latLon.lat(), latLon.lon(), he, "null"//, cd … … 128 123 129 124 private void checkModified() { 130 if (StreetsideLayer.hasInstance()) { 131 if (isModified()) { 132 StreetsideLayer.getInstance().getLocationChangeset().add(this); 133 } else { 134 StreetsideLayer.getInstance().getLocationChangeset().remove(this); 135 } 136 } 125 // modifications not currently supported in Streetside 137 126 } 138 127 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsideLayer.java
r34399 r34416 43 43 import org.openstreetmap.josm.plugins.streetside.io.download.StreetsideDownloader.DOWNLOAD_MODE; 44 44 import org.openstreetmap.josm.plugins.streetside.mode.AbstractMode; 45 import org.openstreetmap.josm.plugins.streetside.mode.JoinMode;46 45 import org.openstreetmap.josm.plugins.streetside.mode.SelectMode; 47 46 import org.openstreetmap.josm.plugins.streetside.utils.MapViewGeometryUtil; … … 90 89 91 90 private volatile TexturePaint hatched; 92 private final StreetsideLocationChangeset locationChangeset = new StreetsideLocationChangeset();93 91 94 92 private StreetsideLayer() { … … 190 188 return data; 191 189 } 192 193 /**194 * Returns the {@link StreetsideLocationChangeset} object, which acts as the database of the195 * Layer.196 *197 * @return The {@link StreetsideData} object that stores the database.198 */199 public StreetsideLocationChangeset getLocationChangeset() {200 return locationChangeset;201 }202 190 203 191 /** … … 314 302 drawImageMarker(g, imageAbs); 315 303 } 316 }317 if (mode instanceof JoinMode) {318 mode.paint(g, mv, box);319 304 } 320 305 } … … 504 489 } 505 490 if (MainApplication.isDisplayingMapView()) { 506 StreetsideMainDialog.getInstance().redButton.setEnabled(nearestImages.length >= 1);507 StreetsideMainDialog.getInstance().blueButton.setEnabled(nearestImages.length >= 2);491 //StreetsideMainDialog.getInstance().redButton.setEnabled(nearestImages.length >= 1); 492 //StreetsideMainDialog.getInstance().blueButton.setEnabled(nearestImages.length >= 2); 508 493 } 509 494 if (nearestImages.length >= 1) { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/StreetsidePlugin.java
r34412 r34416 13 13 import org.openstreetmap.josm.plugins.streetside.actions.StreetsideDownloadViewAction; 14 14 import org.openstreetmap.josm.plugins.streetside.actions.StreetsideExportAction; 15 import org.openstreetmap.josm.plugins.streetside.actions.StreetsideJoinAction;16 15 import org.openstreetmap.josm.plugins.streetside.actions.StreetsideWalkAction; 17 16 import org.openstreetmap.josm.plugins.streetside.actions.StreetsideZoomAction; … … 20 19 import org.openstreetmap.josm.plugins.streetside.gui.StreetsidePreferenceSetting; 21 20 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideViewerDialog; 21 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.ImageInfoHelpPopup; 22 22 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.ImageInfoPanel; 23 23 import org.openstreetmap.josm.plugins.streetside.oauth.StreetsideUser; 24 24 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 25 25 import org.openstreetmap.josm.tools.ImageProvider; 26 27 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.ImageInfoHelpPopup;28 26 29 27 /** … … 45 43 MainMenu.add(MainApplication.getMenu().viewMenu, ZOOM_ACTION, false, 15); 46 44 MainMenu.add(MainApplication.getMenu().fileMenu, new StreetsideDownloadViewAction(), false, 14); 47 MainMenu.add(MainApplication.getMenu().dataMenu, new StreetsideJoinAction(), false);45 //MainMenu.add(MainApplication.getMenu().dataMenu, new StreetsideJoinAction(), false); 48 46 MainMenu.add(MainApplication.getMenu().moreToolsMenu, WALK_ACTION, false); 49 47 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/actions/WalkThread.java
r34400 r34416 3 3 4 4 import java.awt.image.BufferedImage; 5 import java.text.MessageFormat; 5 6 6 7 import javax.swing.SwingUtilities; 7 8 9 import org.apache.log4j.Logger; 8 10 import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage; 9 11 import org.openstreetmap.josm.plugins.streetside.StreetsideData; … … 30 32 private BufferedImage lastImage; 31 33 private volatile boolean paused; 34 35 final static Logger logger = Logger.getLogger(WalkThread.class); 32 36 33 37 /** … … 65 69 StreetsideAbstractImage currentImage = image.next(); 66 70 preDownloadImages((StreetsideImage) currentImage, 3, CacheUtils.PICTURE.FULL_IMAGE); 67 /*if (StreetsideProperties.PREDOWNLOAD_CUBEMAPS.get().booleanValue()) {68 preDownloadCubemaps((StreetsideImage) currentImage, 3);69 }*/70 71 } 71 72 } … … 100 101 } 101 102 } catch (NullPointerException e) { 102 // TODO: Avoid NPEs instead of waiting until they are thrown and then catching them 103 if(StreetsideProperties.DEBUGING_ENABLED.get()) { 104 logger.debug(MessageFormat.format("Exception thrown in WalkThread: {0}", e.getMessage())); 105 e.printStackTrace(); 106 } 103 107 return; 104 108 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CameraTransformer.java
r34399 r34416 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.streetside.cubemap; 3 4 /**5 * @author Dub6 */7 3 8 4 import javafx.scene.Group; … … 15 11 public class CameraTransformer extends Group { 16 12 17 18 19 13 public enum RotateOrder { 14 XYZ, XZY, YXZ, YZX, ZXY, ZYX 15 } 20 16 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 17 public Translate t = new Translate(); 18 public Translate p = new Translate(); 19 public Translate ip = new Translate(); 20 public Rotate rx = new Rotate(); 21 { 22 rx.setAxis(Rotate.X_AXIS); 23 } 24 public Rotate ry = new Rotate(); 25 { 26 ry.setAxis(Rotate.Y_AXIS); 27 } 28 public Rotate rz = new Rotate(); 29 { 30 rz.setAxis(Rotate.Z_AXIS); 31 } 32 public Scale s = new Scale(); 37 33 38 39 40 41 34 public CameraTransformer() { 35 super(); 36 getTransforms().addAll(t, rz, ry, rx, s); 37 } 42 38 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 39 public CameraTransformer(CameraTransformer.RotateOrder rotateOrder) { 40 super(); 41 switch (rotateOrder) { 42 case XYZ: 43 getTransforms().addAll(t, p, rz, ry, rx, s, ip); 44 break; 45 case XZY: 46 getTransforms().addAll(t, p, ry, rz, rx, s, ip); 47 break; 48 case YXZ: 49 getTransforms().addAll(t, p, rz, rx, ry, s, ip); 50 break; 51 case YZX: 52 getTransforms().addAll(t, p, rx, rz, ry, s, ip); // For Camera 53 break; 54 case ZXY: 55 getTransforms().addAll(t, p, ry, rx, rz, s, ip); 56 break; 57 case ZYX: 58 getTransforms().addAll(t, p, rx, ry, rz, s, ip); 59 break; 60 } 61 } 66 62 67 68 69 70 71 63 public void setTranslate(double x, double y, double z) { 64 t.setX(x); 65 t.setY(y); 66 t.setZ(z); 67 } 72 68 73 74 75 76 69 public void setTranslate(double x, double y) { 70 t.setX(x); 71 t.setY(y); 72 } 77 73 78 79 80 74 public void setTx(double x) { 75 t.setX(x); 76 } 81 77 82 83 84 78 public void setTy(double y) { 79 t.setY(y); 80 } 85 81 86 87 88 82 public void setTz(double z) { 83 t.setZ(z); 84 } 89 85 90 91 92 93 94 86 public void setRotate(double x, double y, double z) { 87 rx.setAngle(x); 88 ry.setAngle(y); 89 rz.setAngle(z); 90 } 95 91 96 97 98 92 public void setRotateX(double x) { 93 rx.setAngle(x); 94 } 99 95 100 101 102 96 public void setRotateY(double y) { 97 ry.setAngle(y); 98 } 103 99 104 105 106 100 public void setRotateZ(double z) { 101 rz.setAngle(z); 102 } 107 103 108 109 110 104 public void setRx(double x) { 105 rx.setAngle(x); 106 } 111 107 112 113 114 108 public void setRy(double y) { 109 ry.setAngle(y); 110 } 115 111 116 117 118 112 public void setRz(double z) { 113 rz.setAngle(z); 114 } 119 115 120 121 122 123 124 116 public void setScale(double scaleFactor) { 117 s.setX(scaleFactor); 118 s.setY(scaleFactor); 119 s.setZ(scaleFactor); 120 } 125 121 126 127 128 129 130 122 public void setScale(double x, double y, double z) { 123 s.setX(x); 124 s.setY(y); 125 s.setZ(z); 126 } 131 127 132 133 134 128 public void setSx(double x) { 129 s.setX(x); 130 } 135 131 136 137 138 132 public void setSy(double y) { 133 s.setY(y); 134 } 139 135 140 141 142 136 public void setSz(double z) { 137 s.setZ(z); 138 } 143 139 144 145 146 147 148 149 150 151 140 public void setPivot(double x, double y, double z) { 141 p.setX(x); 142 p.setY(y); 143 p.setZ(z); 144 ip.setX(-x); 145 ip.setY(-y); 146 ip.setZ(-z); 147 } 152 148 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 149 public void reset() { 150 t.setX(0.0); 151 t.setY(0.0); 152 t.setZ(0.0); 153 rx.setAngle(0.0); 154 ry.setAngle(0.0); 155 rz.setAngle(0.0); 156 s.setX(1.0); 157 s.setY(1.0); 158 s.setZ(1.0); 159 p.setX(0.0); 160 p.setY(0.0); 161 p.setZ(0.0); 162 ip.setX(0.0); 163 ip.setY(0.0); 164 ip.setZ(0.0); 165 } 170 166 171 172 173 174 175 176 177 178 179 180 181 182 183 184 167 public void resetTSP() { 168 t.setX(0.0); 169 t.setY(0.0); 170 t.setZ(0.0); 171 s.setX(1.0); 172 s.setY(1.0); 173 s.setZ(1.0); 174 p.setX(0.0); 175 p.setY(0.0); 176 p.setZ(0.0); 177 ip.setX(0.0); 178 ip.setY(0.0); 179 ip.setZ(0.0); 180 } 185 181 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBox.java
r34415 r34416 5 5 */ 6 6 7 package org.openstreetmap.josm.plugins.streetside. utils;7 package org.openstreetmap.josm.plugins.streetside.cubemap; 8 8 9 9 import java.awt.image.BufferedImage; 10 11 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils;12 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils;13 10 14 11 import javafx.animation.AnimationTimer; … … 25 22 26 23 /** 27 *28 * @author Dub29 24 * @author renerr18 30 25 */ … … 54 49 private Image frontImg, rightImg, backImg, leftImg, upImg, downImg, singleImg; 55 50 56 // private WritableImage convertedImage;57 58 51 private final PerspectiveCamera camera; 59 52 private AnimationTimer timer; 60 53 private final CubemapBoxImageType imageType; 61 54 62 public CubemapBox(Image singleImg, double size, PerspectiveCamera camera) { 55 public CubemapBox( 56 Image frontImg, Image rightImg, Image backImg, Image leftImg, Image upImg, Image downImg, double size, 57 PerspectiveCamera camera) { 58 63 59 super(); 64 imageType = CubemapBoxImageType.SINGLE; 65 66 this.singleImg = singleImg; 67 this.size.set(size); 68 this.camera = camera; 69 70 getTransforms().add(affine); 71 72 loadImageViews(); 73 74 getChildren().addAll(views); 75 } 76 77 // private constructor to prevent instantiation 78 public CubemapBox(double size, PerspectiveCamera camera) { 79 super(); 80 imageType = CubemapBoxImageType.SINGLE; 81 82 this.size.set(size); 83 this.camera = camera; 84 85 getTransforms().add(affine); 86 87 loadImageViews(); 88 89 getChildren().addAll(views); 90 } 91 92 public CubemapBox( 93 Image frontImg, Image rightImg, Image backImg, Image leftImg, Image upImg, Image downImg, double size, 94 PerspectiveCamera camera 95 ) { 96 super(); 60 97 61 imageType = CubemapBoxImageType.MULTIPLE; 98 62 -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBuilder.java
r34412 r34416 19 19 import org.openstreetmap.josm.plugins.streetside.gui.StreetsideViewerDialog; 20 20 import org.openstreetmap.josm.plugins.streetside.gui.imageinfo.StreetsideViewerPanel; 21 import org.openstreetmap.josm.plugins.streetside.utils.CubemapBox;22 21 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 23 22 … … 193 192 } 194 193 } 194 195 @Override 196 public void tilesAdded(String[] tileIds) { 197 // determine whether all tiles have been set for each of the 198 // six cubemap faces. If so, build the images for the faces 199 // and set the views in the cubemap box. 200 201 int tileCount = 0; 202 203 tileCount = CubemapBuilder.getInstance().getTileImages().keySet().size(); 204 205 int maxCols = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 206 int maxRows = StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get() ? 4 : 2; 207 208 if (tileCount == (CubemapUtils.NUM_SIDES * maxCols * maxRows)) { 209 if (StreetsideProperties.DEBUGING_ENABLED.get()) { 210 logger.debug(MessageFormat.format("{0} tile images ready for building cumbemap faces for cubemap {1}.", tileCount, 211 CubemapBuilder.getInstance().getCubemap().getId())); 212 } 213 214 buildCubemapFaces(); 215 } 216 } 195 217 196 218 private void buildCubemapFaces() { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/cubemap/ITileDownloadingTaskListener.java
r34325 r34416 12 12 /** 13 13 * Fired when a cubemap tile image is downloaded by a download worker. 14 * @param imageId image id 14 * @param imageId image id 15 15 */ 16 16 void tileAdded(String imageId); 17 18 /** 19 * Fired when multiple cubemap tile images are downloaded by a download worker. 20 * @param imageId image id 21 */ 22 void tilesAdded(String[] imageId); 17 23 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideMainDialog.java
r34399 r34416 3 3 4 4 import java.awt.BorderLayout; 5 import java.awt.Color;6 5 import java.awt.Component; 7 6 import java.awt.event.ActionEvent; … … 9 8 import java.io.ByteArrayInputStream; 10 9 import java.io.IOException; 11 import java.util.Arrays;12 10 import java.util.List; 13 11 … … 15 13 import javax.swing.AbstractAction; 16 14 import javax.swing.Action; 17 import javax.swing.JComponent;18 import javax.swing.KeyStroke;19 15 import javax.swing.SwingUtilities; 20 16 … … 61 57 private volatile StreetsideAbstractImage image; 62 58 63 public final SideButton nextButton = new SideButton(new NextPictureAction());59 /*public final SideButton nextButton = new SideButton(new NextPictureAction()); 64 60 public final SideButton previousButton = new SideButton(new PreviousPictureAction()); 65 /**61 *//** 66 62 * Button used to jump to the image following the red line 67 */ 63 *//* 68 64 public final SideButton redButton = new SideButton(new RedAction()); 69 /**65 *//** 70 66 * Button used to jump to the image following the blue line 71 */ 67 *//* 72 68 public final SideButton blueButton = new SideButton(new BlueAction()); 73 69 74 70 private final SideButton playButton = new SideButton(new PlayAction()); 75 71 private final SideButton pauseButton = new SideButton(new PauseAction()); 76 private final SideButton stopButton = new SideButton(new StopAction()); 72 private final SideButton stopButton = new SideButton(new StopAction());*/ 77 73 78 74 private ImageInfoHelpPopup imageInfoHelp; … … 111 107 streetsideImageDisplay = new StreetsideImageDisplay(); 112 108 113 blueButton.setForeground(Color.BLUE); 114 redButton.setForeground(Color.RED); 115 116 // TODO: Modes for cubemaps? @rrh 109 /*blueButton.setForeground(Color.BLUE); 110 redButton.setForeground(Color.RED);*/ 111 117 112 setMode(MODE.NORMAL); 118 113 } … … 122 117 */ 123 118 private void addShortcuts() { 124 nextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(119 /*nextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 125 120 KeyStroke.getKeyStroke("PAGE_DOWN"), "next"); 126 121 nextButton.getActionMap().put("next", new NextPictureAction()); … … 134 129 redButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 135 130 KeyStroke.getKeyStroke("control PAGE_DOWN"), "red"); 136 redButton.getActionMap().put("red", new RedAction()); 131 redButton.getActionMap().put("red", new RedAction());*/ 137 132 } 138 133 … … 181 176 createLayout( 182 177 streetsideImageDisplay, 183 Arrays.asList(playButton, pauseButton, stopButton)178 null//Arrays.asList(playButton, pauseButton, stopButton) 184 179 ); 185 180 case NORMAL: … … 187 182 createLayout( 188 183 streetsideImageDisplay, 189 Arrays.asList(blueButton, previousButton, nextButton, redButton)184 null//Arrays.asList(blueButton, previousButton, nextButton, redButton) 190 185 ); 191 186 } 192 disableAllButtons();187 //disableAllButtons(); 193 188 if (MODE.NORMAL.equals(mode)) { 194 189 updateImage(); … … 227 222 streetsideImageDisplay.setImage(null, null); 228 223 setTitle(I18n.tr(StreetsideMainDialog.BASE_TITLE)); 229 disableAllButtons();224 //disableAllButtons(); 230 225 return; 231 226 } … … 238 233 239 234 // Enables/disables next/previous buttons 240 nextButton.setEnabled(false);241 previousButton.setEnabled(false); 235 /*nextButton.setEnabled(false); 236 previousButton.setEnabled(false);*/ 242 237 if (image.getSequence() != null) { 243 238 StreetsideAbstractImage tempImage = image; … … 245 240 tempImage = tempImage.next(); 246 241 if (tempImage.isVisible()) { 247 nextButton.setEnabled(true);242 //nextButton.setEnabled(true); 248 243 break; 249 244 } … … 255 250 tempImage = tempImage.previous(); 256 251 if (tempImage.isVisible()) { 257 previousButton.setEnabled(true);252 //previousButton.setEnabled(true); 258 253 break; 259 254 } … … 297 292 * Disables all the buttons in the dialog 298 293 */ 299 public /*private*/void disableAllButtons() {294 /*public private void disableAllButtons() { 300 295 nextButton.setEnabled(false); 301 296 previousButton.setEnabled(false); 302 297 blueButton.setEnabled(false); 303 298 redButton.setEnabled(false); 304 } 299 }*/ 305 300 306 301 /** … … 316 311 * Updates the title of the dialog. 317 312 */ 318 // TODO: update title for 360 degree viewer? @rrh319 313 public synchronized void updateTitle() { 320 314 if (!SwingUtilities.isEventDispatchThread()) { … … 442 436 } 443 437 444 // TODO: BlueAction for cubemaps?445 438 @Override 446 439 public void actionPerformed(ActionEvent e) { … … 609 602 this.streetsideImageDisplay = streetsideImageDisplay; 610 603 } 611 612 /**613 * @return the streetsideImageDisplay614 */615 /*public StreetsideViewerDisplay getStreetsideViewerDisplay() {616 return streetsideViewerDisplay;617 }*/618 619 /**620 * @param streetsideImageDisplay the streetsideImageDisplay to set621 */622 /*public void setStreetsideViewerDisplay(StreetsideViewerDisplay streetsideViewerDisplay) {623 streetsideViewerDisplay = streetsideViewerDisplay;624 }*/625 626 /*private StreetsideViewerDisplay initStreetsideViewerDisplay() {627 StreetsideViewerDisplay res = new StreetsideViewerDisplay();628 //this.add(streetsideViewerDisplay);629 630 631 Platform.runLater(new Runnable() {632 @Override633 public void run() {634 Scene scene;635 try {636 scene = StreetsideViewerDisplay.createScene();637 res.setScene(scene);638 } catch (NonInvertibleTransformException e) {639 // TODO Auto-generated catch block640 e.printStackTrace();641 }642 }643 });644 return res;645 }*/646 604 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/StreetsideViewerDialog.java
r34399 r34416 31 31 32 32 private StreetsideViewerDialog() { 33 // TODO: I18n support in all languages?34 33 super(StreetsideViewerDialog.BASE_TITLE, "streetside-viewer", "Open Streetside Viewer window", 35 34 null, 200, true, StreetsidePreferenceSetting.class); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/AddTagToPrimitiveAction.java
r34317 r34416 47 47 Main.parent, 48 48 "<html>" + 49 // TODO: tr( RRH50 49 I18n.tr("A tag with key <i>{0}</i> is already present on the selected OSM object.", tag.getKey()) + "<br>" + 51 50 I18n.tr( -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ImageInfoPanel.java
r34399 r34416 2 2 package org.openstreetmap.josm.plugins.streetside.gui.imageinfo; 3 3 4 import java.awt.Font;5 4 import java.awt.GridBagConstraints; 6 5 import java.awt.GridBagLayout; 7 import java.awt.Image;8 6 import java.awt.Insets; 9 7 import java.awt.datatransfer.StringSelection; 10 import java.awt.image.BufferedImage;11 8 import java.util.Collection; 12 9 13 import javax.swing.ImageIcon;14 import javax.swing.JCheckBox;15 10 import javax.swing.JLabel; 16 11 import javax.swing.JPanel; … … 29 24 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.SelectableLabel; 30 25 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton; 31 import org.openstreetmap.josm.plugins.streetside.model.UserProfile;32 26 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 33 27 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL; … … 40 34 41 35 private static ImageInfoPanel instance; 42 private static final ImageIcon EMPTY_USER_AVATAR = new ImageIcon(new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB)); 43 44 private final JLabel numDetectionsLabel; 45 private final JCheckBox showDetectionsCheck; 46 private final JLabel usernameLabel; 36 47 37 private final JTextPane imgKeyValue; 48 38 private final WebLinkAction imgLinkAction; … … 55 45 private ImageInfoPanel() { 56 46 super( 57 I18n.tr("Streetside Image info"),47 I18n.tr("Streetside 360° image info"), 58 48 "streetside-info", 59 49 I18n.tr("Displays detail information on the currently selected Streetside image"), … … 63 53 SelectionEventManager.getInstance().addSelectionListener(this); 64 54 65 numDetectionsLabel = new JLabel();66 numDetectionsLabel.setFont(numDetectionsLabel.getFont().deriveFont(Font.PLAIN));67 68 showDetectionsCheck = new JCheckBox(I18n.tr("Show detections on top of image"));69 showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get());70 showDetectionsCheck.addActionListener(71 action -> StreetsideProperties.SHOW_DETECTED_SIGNS.put(showDetectionsCheck.isSelected())72 );73 StreetsideProperties.SHOW_DETECTED_SIGNS.addListener(74 valueChange -> showDetectionsCheck.setSelected(StreetsideProperties.SHOW_DETECTED_SIGNS.get())75 );76 77 usernameLabel = new JLabel();78 usernameLabel.setFont(usernameLabel.getFont().deriveFont(Font.PLAIN));79 80 55 imgKeyValue = new SelectableLabel(); 81 56 … … 88 63 addStreetsideTagAction = new AddTagToPrimitiveAction(I18n.tr("Add Streetside tag")); 89 64 90 JPanel imgKey = new JPanel();91 imgKey.add(imgKeyValue);92 imgKey.add(copyButton);93 JPanel imgButtons = new JPanel();94 imgButtons.add(new StreetsideButton(imgLinkAction, true));95 imgButtons.add(new StreetsideButton(addStreetsideTagAction, true));96 65 seqKeyValue = new SelectableLabel(); 97 66 98 67 JPanel root = new JPanel(new GridBagLayout()); 68 99 69 GridBagConstraints gbc = new GridBagConstraints(); 100 70 gbc.insets = new Insets(0, 5, 0, 5); 101 71 102 // Left column72 gbc.fill = GridBagConstraints.HORIZONTAL; 103 73 gbc.gridx = 0; 104 74 gbc.gridy = 0; 105 gbc.anchor = GridBagConstraints.LINE_END;106 gbc.gridwidth = 1;107 gbc.gridheight = 2;108 root.add(new JLabel(I18n.tr("Image detections")), gbc);109 gbc.gridy += 2;110 gbc.gridheight = 1;111 root.add(new JLabel(I18n.tr("User")), gbc);112 gbc.gridy++;113 75 root.add(new JLabel(I18n.tr("Image actions")), gbc); 114 gbc.gridy++; 76 77 gbc.fill = GridBagConstraints.HORIZONTAL; 78 gbc.weightx = 0.5; 79 gbc.gridx = 0; 80 gbc.gridy = 1; 115 81 root.add(new JLabel(I18n.tr("Image key")), gbc); 116 gbc.gridy++; 82 83 gbc.fill = GridBagConstraints.HORIZONTAL; 84 gbc.weightx = 0.5; 85 gbc.gridx = 0; 86 gbc.gridy = 2; 117 87 root.add(new JLabel(I18n.tr("Sequence key")), gbc); 118 88 119 // Right column 120 gbc.weightx = 1; 121 gbc.gridx++; 89 gbc.fill = GridBagConstraints.HORIZONTAL; 90 gbc.gridx = 1; 122 91 gbc.gridy = 0; 123 gbc.anchor = GridBagConstraints.LINE_START; 124 root.add(numDetectionsLabel, gbc); 125 gbc.gridy++; 126 root.add(showDetectionsCheck, gbc); 127 gbc.gridy++; 128 root.add(usernameLabel, gbc); 129 gbc.gridy++; 130 root.add(imgButtons, gbc); 131 gbc.gridy++; 132 root.add(imgKey, gbc); 133 gbc.gridy++; 92 root.add(new StreetsideButton(imgLinkAction, true), gbc); 93 94 gbc.fill = GridBagConstraints.HORIZONTAL; 95 gbc.weightx = 0.5; 96 gbc.gridx = 1; 97 gbc.gridy = 1; 98 root.add(imgKeyValue, gbc); 99 100 gbc.fill = GridBagConstraints.HORIZONTAL; 101 gbc.weightx = 0.5; 102 gbc.gridx = 1; 103 gbc.gridy = 2; 134 104 root.add(seqKeyValue, gbc); 105 106 gbc.fill = GridBagConstraints.HORIZONTAL; 107 gbc.weightx = 0.5; 108 gbc.gridx = 2; 109 gbc.gridy = 1; 110 root.add(copyButton, gbc); 135 111 136 112 createLayout(root, true, null); … … 184 160 )); 185 161 186 numDetectionsLabel.setText(I18n.tr("{0} detections", newImage instanceof StreetsideImage ? /*((StreetsideImage) newImage).getDetections().size()*/0 : 0));187 162 imgKeyValue.setEnabled(newImage instanceof StreetsideImage); 188 163 final String newImageKey = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getId(): null; 189 164 if (newImageKey != null) { 190 165 imageLinkChangeListener = b -> imgLinkAction.setURL( 191 /*StreetsideProperties.IMAGE_LINK_TO_BLUR_EDITOR.get() 192 ? StreetsideURL.MainWebsite.blurEditImage(newImageKey) 193 :*/ StreetsideURL.MainWebsite.browseImage(newImageKey) 166 StreetsideURL.MainWebsite.browseImage(newImageKey) 194 167 ); 195 168 imageLinkChangeListener.valueChanged(null); … … 211 184 } 212 185 213 final UserProfile user = newImage instanceof StreetsideImage ? ((StreetsideImage) newImage).getUser() : null;214 usernameLabel.setEnabled(user != null);215 if (user != null) {216 usernameLabel.setText(user.getUsername());217 usernameLabel.setIcon(new ImageIcon(user.getAvatar().getImage().getScaledInstance(32, 32, Image.SCALE_SMOOTH)));218 } else {219 usernameLabel.setText("‹" + I18n.tr("unknown user") + "›");220 usernameLabel.setIcon(EMPTY_USER_AVATAR);221 }222 223 186 final boolean partOfSequence = newImage != null && newImage.getSequence() != null && newImage.getSequence().getId() != null; 224 187 seqKeyValue.setEnabled(partOfSequence); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/StreetsideViewerPanel.java
r34399 r34416 15 15 import org.openstreetmap.josm.plugins.streetside.StreetsideImage; 16 16 import org.openstreetmap.josm.plugins.streetside.actions.ImageReloadAction; 17 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBox; 17 18 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBuilder; 18 19 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapUtils; 19 20 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils; 20 21 import org.openstreetmap.josm.plugins.streetside.gui.boilerplate.StreetsideButton; 21 import org.openstreetmap.josm.plugins.streetside.utils.CubemapBox;22 22 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties; 23 23 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL; … … 67 67 JPanel checkPanel = new JPanel(); 68 68 69 // TODO: I18n for all languages? 70 imgReloadAction = new ImageReloadAction(/*I18n.tr(*/"Reload"/*)*/); 69 imgReloadAction = new ImageReloadAction("Reload"); 71 70 72 71 StreetsideButton imgReloadButton = new StreetsideButton(imgReloadAction); 73 72 74 // TODO: I18n for all languages? 75 highResImageryCheck = new JCheckBox(/*I18n.tr(*/"High resolution"/*)*/); 73 highResImageryCheck = new JCheckBox("High resolution"); 76 74 highResImageryCheck.setSelected(StreetsideProperties.SHOW_HIGH_RES_STREETSIDE_IMAGERY.get()); 77 75 highResImageryCheck.addActionListener( … … 155 153 } 156 154 157 public CubemapBox getCubemapBox() {155 public static CubemapBox getCubemapBox() { 158 156 return threeSixtyDegreeViewerPanel.getCubemapBox(); 159 157 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.java
r34399 r34416 2 2 package org.openstreetmap.josm.plugins.streetside.gui.imageinfo; 3 3 4 import java.awt.image.BufferedImage;5 6 4 import org.openstreetmap.josm.plugins.streetside.cubemap.CameraTransformer; 7 import org.openstreetmap.josm.plugins.streetside.cubemap.GraphicsUtils; 8 import org.openstreetmap.josm.plugins.streetside.utils.CubemapBox; 5 import org.openstreetmap.josm.plugins.streetside.cubemap.CubemapBox; 9 6 10 7 import javafx.application.Platform; … … 21 18 import javafx.scene.layout.VBox; 22 19 import javafx.scene.paint.Color; 23 import javafx.scene.transform.NonInvertibleTransformException;24 25 20 26 21 @SuppressWarnings("restriction") 27 22 public class ThreeSixtyDegreeViewerPanel extends JFXPanel { 28 23 29 private static final long serialVersionUID = -4940350009018422000L; 30 31 private static Scene cubemapScene; 32 33 private static Scene defaultScene; 34 35 private static Group root; 36 private static Group subGroup; 37 private static CubemapBox cubemapBox; 38 private static PerspectiveCamera camera; 39 private static CameraTransformer cameraTransform = new CameraTransformer(); 40 41 private static double mousePosX; 42 private static double mousePosY; 43 private static double mouseOldX; 44 private static double mouseOldY; 45 private static double mouseDeltaX; 46 private static double mouseDeltaY; 47 private static double cameraDistance = 5000; 48 49 // Supply Image Paths or a NullPointer will occur 50 private static Image front; 51 private static Image right; 52 private static Image back; 53 private static Image left; 54 private static Image up; 55 private static Image down; 56 57 public ThreeSixtyDegreeViewerPanel() { 58 // constructor 59 } 60 61 public void initialize() { 62 63 root = new Group(); 64 65 camera = new PerspectiveCamera(true); 66 cameraTransform.setTranslate(0, 0, 0); 67 cameraTransform.getChildren().addAll(camera); 68 camera.setNearClip(0.1); 69 camera.setFarClip(1000000.0); 70 camera.setFieldOfView(42); 71 camera.setTranslateZ(-cameraDistance); 72 // cameraTransform.ry.setAngle(-45.0); 73 // cameraTransform.rx.setAngle(-10.0); 74 // add a Point Light for better viewing of the grid coordinate system 75 final PointLight light = new PointLight(Color.WHITE); 76 77 cameraTransform.getChildren().add(light); 78 light.setTranslateX(camera.getTranslateX()); 79 light.setTranslateY(camera.getTranslateY()); 80 light.setTranslateZ(camera.getTranslateZ()); 81 82 root.getChildren().add(cameraTransform); 83 84 final double size = 100000D; 85 86 cubemapBox = new CubemapBox(front, right, back, left, up, down, size, camera); 87 88 subGroup = new Group(); 89 subGroup.getChildren().add(cameraTransform); 90 91 Platform.runLater(new Runnable() { 92 @Override 93 public void run() { 94 setScene(createDefaultScene()); 95 } 96 }); 97 } 98 99 public static Scene createScene() /*throws NonInvertibleTransformException*/ { 100 101 root = new Group(); 102 103 camera = new PerspectiveCamera(true); 104 cameraTransform.setTranslate(0, 0, 0); 105 cameraTransform.getChildren().addAll(camera); 106 camera.setNearClip(0.1); 107 camera.setFarClip(1000000.0); 108 camera.setFieldOfView(42); 109 camera.setTranslateZ(-cameraDistance); 110 final PointLight light = new PointLight(Color.WHITE); 111 112 cameraTransform.getChildren().add(light); 113 light.setTranslateX(camera.getTranslateX()); 114 light.setTranslateY(camera.getTranslateY()); 115 light.setTranslateZ(camera.getTranslateZ()); 116 117 root.getChildren().add(cameraTransform); 118 119 // Load Cubemap box AFTER camera is initialized 120 final double size = 100000D; 121 122 cubemapBox = new CubemapBox(null, null, null, null, null, null, size, camera); 123 124 subGroup = new Group(); 125 subGroup.getChildren().add(cameraTransform); 126 127 final Scene scene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); 128 scene.setFill(Color.TRANSPARENT); 129 scene.setCamera(camera); 130 131 // First person shooter keyboard movement 132 scene.setOnKeyPressed(event -> { 133 double change = 10.0; 134 // Add shift modifier to simulate "Running Speed" 135 if (event.isShiftDown()) { 136 change = 50.0; 137 } 138 // What key did the user press? 139 final KeyCode keycode = event.getCode(); 140 // Step 2c: Add Zoom controls 141 if (keycode == KeyCode.W) { 142 camera.setTranslateZ(camera.getTranslateZ() + change); 143 } 144 if (keycode == KeyCode.S) { 145 camera.setTranslateZ(camera.getTranslateZ() - change); 146 } 147 // Step 2d: Add Strafe controls 148 if (keycode == KeyCode.A) { 149 camera.setTranslateX(camera.getTranslateX() - change); 150 } 151 if (keycode == KeyCode.D) { 152 camera.setTranslateX(camera.getTranslateX() + change); 153 } 154 }); 155 156 scene.setOnMousePressed((MouseEvent me) -> { 157 mousePosX = me.getSceneX(); 158 mousePosY = me.getSceneY(); 159 mouseOldX = me.getSceneX(); 160 mouseOldY = me.getSceneY(); 161 }); 162 scene.setOnMouseDragged((MouseEvent me) -> { 163 mouseOldX = mousePosX; 164 mouseOldY = mousePosY; 165 mousePosX = me.getSceneX(); 166 mousePosY = me.getSceneY(); 167 mouseDeltaX = mousePosX - mouseOldX; 168 mouseDeltaY = mousePosY - mouseOldY; 169 170 double modifier = 10.0; 171 final double modifierFactor = 0.1; 172 173 if (me.isControlDown()) { 174 modifier = 0.1; 175 } 176 if (me.isShiftDown()) { 177 modifier = 50.0; 178 } 179 if (me.isPrimaryButtonDown()) { 180 cameraTransform.ry.setAngle( 181 ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540) 182 % 360 - 180); // + 183 cameraTransform.rx.setAngle( 184 ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540) 185 % 360 - 180); // - 186 187 } else if (me.isSecondaryButtonDown()) { 188 final double z = camera.getTranslateZ(); 189 final double newZ = z + mouseDeltaX * modifierFactor * modifier; 190 camera.setTranslateZ(newZ); 191 } else if (me.isMiddleButtonDown()) { 192 cameraTransform.t.setX(cameraTransform.t.getX() + mouseDeltaX * modifierFactor * modifier * 0.3); // - 193 cameraTransform.t.setY(cameraTransform.t.getY() + mouseDeltaY * modifierFactor * modifier * 0.3); // - 194 } 195 }); 196 197 root.getChildren().addAll(cubemapBox, subGroup); 198 root.setAutoSizeChildren(true); 199 200 subGroup.setAutoSizeChildren(true); 201 202 // prevent content from disappearing after resizing 203 Platform.setImplicitExit(false); 204 205 return scene; 206 } 207 208 private static Scene createDefaultScene() { 209 // Load Cubemap box AFTER camera is initialized 210 211 TextArea textArea = new TextArea(); 212 textArea.setText("No Streetside image selected."); 213 214 VBox vbox = new VBox(textArea); 215 216 root = new Group(); 24 private static final long serialVersionUID = -4940350009018422000L; 25 26 private static Scene cubemapScene; 27 28 private static Scene defaultScene; 29 30 private static Group root; 31 private static Group subGroup; 32 private static CubemapBox cubemapBox; 33 private static PerspectiveCamera camera; 34 private static CameraTransformer cameraTransform = new CameraTransformer(); 35 36 private static double mousePosX; 37 private static double mousePosY; 38 private static double mouseOldX; 39 private static double mouseOldY; 40 private static double mouseDeltaX; 41 private static double mouseDeltaY; 42 private static double cameraDistance = 5000; 43 44 private static Image front; 45 private static Image right; 46 private static Image back; 47 private static Image left; 48 private static Image up; 49 private static Image down; 50 51 public ThreeSixtyDegreeViewerPanel() { 52 53 } 54 55 public void initialize() { 56 57 root = new Group(); 217 58 218 59 camera = new PerspectiveCamera(true); … … 232 73 root.getChildren().add(cameraTransform); 233 74 234 // Load Cubemap box AFTER camera is initialized235 75 final double size = 100000D; 236 76 237 cubemapBox = new CubemapBox( null, null, null, null, null, null, size, camera);77 cubemapBox = new CubemapBox(front, right, back, left, up, down, size, camera); 238 78 239 79 subGroup = new Group(); 240 80 subGroup.getChildren().add(cameraTransform); 241 81 242 /*final Scene*/ cubemapScene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); 82 Platform.runLater(new Runnable() { 83 @Override 84 public void run() { 85 setScene(createDefaultScene()); 86 } 87 }); 88 } 89 90 private static Scene createDefaultScene() { 91 92 TextArea textArea = new TextArea(); 93 textArea.setText("No Streetside image selected."); 94 95 VBox vbox = new VBox(textArea); 96 97 root = new Group(); 98 99 camera = new PerspectiveCamera(true); 100 cameraTransform.setTranslate(0, 0, 0); 101 cameraTransform.getChildren().addAll(camera); 102 camera.setNearClip(0.1); 103 camera.setFarClip(1000000.0); 104 camera.setFieldOfView(42); 105 camera.setTranslateZ(-cameraDistance); 106 final PointLight light = new PointLight(Color.WHITE); 107 108 cameraTransform.getChildren().add(light); 109 light.setTranslateX(camera.getTranslateX()); 110 light.setTranslateY(camera.getTranslateY()); 111 light.setTranslateZ(camera.getTranslateZ()); 112 113 root.getChildren().add(cameraTransform); 114 115 final double size = 100000D; 116 117 cubemapBox = new CubemapBox(null, null, null, null, null, null, size, camera); 118 119 subGroup = new Group(); 120 subGroup.getChildren().add(cameraTransform); 121 122 cubemapScene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); 243 123 cubemapScene.setFill(Color.TRANSPARENT); 244 124 cubemapScene.setCamera(camera); 245 125 246 // First person shooter keyboard movement247 126 cubemapScene.setOnKeyPressed(event -> { 248 127 double change = 10.0; 249 // Add shift modifier to simulate "Running Speed"250 128 if (event.isShiftDown()) { 251 129 change = 50.0; 252 130 } 253 // What key did the user press?254 131 final KeyCode keycode = event.getCode(); 255 // Step 2c: Add Zoom controls 132 256 133 if (keycode == KeyCode.W) { 257 134 camera.setTranslateZ(camera.getTranslateZ() + change); … … 260 137 camera.setTranslateZ(camera.getTranslateZ() - change); 261 138 } 262 // Step 2d: Add Strafe controls 139 263 140 if (keycode == KeyCode.A) { 264 141 camera.setTranslateX(camera.getTranslateX() - change); … … 294 171 if (me.isPrimaryButtonDown()) { 295 172 cameraTransform.ry.setAngle( 296 ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540)297 % 360 - 180); // +173 ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540) % 360 - 180 174 ); // + 298 175 cameraTransform.rx.setAngle( 299 ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540)300 % 360 - 180); // -176 ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540) % 360 - 180 177 ); // - 301 178 302 179 } else if (me.isSecondaryButtonDown()) { … … 319 196 320 197 defaultScene = new Scene(vbox, 200, 100); 321 return defaultScene; 322 } 323 324 public static Scene createScene(BufferedImage img0, BufferedImage img1, BufferedImage img2, BufferedImage img3, 325 BufferedImage img4, BufferedImage img5) throws NonInvertibleTransformException { 326 front = GraphicsUtils.convertBufferedImage2JavaFXImage(img0); 327 right = GraphicsUtils.convertBufferedImage2JavaFXImage(img1); 328 back = GraphicsUtils.convertBufferedImage2JavaFXImage(img2); 329 left = GraphicsUtils.convertBufferedImage2JavaFXImage(img3); 330 up = GraphicsUtils.convertBufferedImage2JavaFXImage(img4); 331 down = GraphicsUtils.convertBufferedImage2JavaFXImage(img5); 332 333 root = new Group(); 334 335 camera = new PerspectiveCamera(true); 336 cameraTransform.setTranslate(0, 0, 0); 337 cameraTransform.getChildren().addAll(camera); 338 camera.setNearClip(0.1); 339 camera.setFarClip(1000000.0); 340 camera.setFieldOfView(42); 341 camera.setTranslateZ(-cameraDistance); 342 final PointLight light = new PointLight(Color.WHITE); 343 344 cameraTransform.getChildren().add(light); 345 light.setTranslateX(camera.getTranslateX()); 346 light.setTranslateY(camera.getTranslateY()); 347 light.setTranslateZ(camera.getTranslateZ()); 348 349 root.getChildren().add(cameraTransform); 350 351 // Load Cubemap box AFTER camera is initialized 352 final double size = 100000D; 353 354 cubemapBox = new CubemapBox(front, right, back, left, up, down, size, camera); 355 356 final Group torusGroup = new Group(); 357 torusGroup.getChildren().add(cameraTransform); 358 359 final Scene scene = new Scene(new Group(root), 1024, 668, true, SceneAntialiasing.BALANCED); 360 scene.setFill(Color.TRANSPARENT); 361 scene.setCamera(camera); 362 363 // First person shooter keyboard movement 364 scene.setOnKeyPressed(event -> { 365 double change = 10.0; 366 // Add shift modifier to simulate "Running Speed" 367 if (event.isShiftDown()) { 368 change = 50.0; 369 } 370 // What key did the user press? 371 final KeyCode keycode = event.getCode(); 372 // Step 2c: Add Zoom controls 373 if (keycode == KeyCode.W) { 374 camera.setTranslateZ(camera.getTranslateZ() + change); 375 } 376 if (keycode == KeyCode.S) { 377 camera.setTranslateZ(camera.getTranslateZ() - change); 378 } 379 // Step 2d: Add Strafe controls 380 if (keycode == KeyCode.A) { 381 camera.setTranslateX(camera.getTranslateX() - change); 382 } 383 if (keycode == KeyCode.D) { 384 camera.setTranslateX(camera.getTranslateX() + change); 385 } 386 387 }); 388 389 scene.setOnMousePressed((MouseEvent me) -> { 390 mousePosX = me.getSceneX(); 391 mousePosY = me.getSceneY(); 392 mouseOldX = me.getSceneX(); 393 mouseOldY = me.getSceneY(); 394 }); 395 scene.setOnMouseDragged((MouseEvent me) -> { 396 mouseOldX = mousePosX; 397 mouseOldY = mousePosY; 398 mousePosX = me.getSceneX(); 399 mousePosY = me.getSceneY(); 400 mouseDeltaX = mousePosX - mouseOldX; 401 mouseDeltaY = mousePosY - mouseOldY; 402 403 double modifier = 10.0; 404 final double modifierFactor = 0.1; 405 406 if (me.isControlDown()) { 407 modifier = 0.1; 408 } 409 if (me.isShiftDown()) { 410 modifier = 50.0; 411 } 412 if (me.isPrimaryButtonDown()) { 413 cameraTransform.ry.setAngle( 414 ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540) 415 % 360 - 180); // + 416 cameraTransform.rx.setAngle( 417 ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540) 418 % 360 - 180); // - 419 420 } else if (me.isSecondaryButtonDown()) { 421 final double z = camera.getTranslateZ(); 422 final double newZ = z + mouseDeltaX * modifierFactor * modifier; 423 camera.setTranslateZ(newZ); 424 } else if (me.isMiddleButtonDown()) { 425 cameraTransform.t.setX(cameraTransform.t.getX() + mouseDeltaX * modifierFactor * modifier * 0.3); // - 426 cameraTransform.t.setY(cameraTransform.t.getY() + mouseDeltaY * modifierFactor * modifier * 0.3); // - 427 } 428 }); 429 430 root.getChildren().addAll(cubemapBox, torusGroup); 431 root.setAutoSizeChildren(true); 432 433 return scene; 434 } 435 436 public CubemapBox getCubemapBox() { 437 if (cubemapBox == null) { 438 // shouldn't happen 439 initialize(); 440 } 441 return cubemapBox; 442 } 198 return defaultScene; 199 } 200 201 public CubemapBox getCubemapBox() { 202 if (cubemapBox == null) { 203 // shouldn't happen 204 initialize(); 205 } 206 return cubemapBox; 207 } 443 208 444 209 public Scene getDefaultScene() { -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/gui/imageinfo/WebLinkAction.java
r34393 r34416 12 12 import org.openstreetmap.josm.gui.Notification; 13 13 import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils; 14 import org.openstreetmap.josm.tools.I18n;15 14 import org.openstreetmap.josm.tools.ImageProvider; 16 15 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/history/commands/CommandMove.java
r34317 r34416 38 38 @Override 39 39 public void undo() { 40 for (StreetsideAbstractImage image : this.images) {41 image.move(- this.x, -this.y);40 for (StreetsideAbstractImage image : images) { 41 image.move(-x, -y); 42 42 image.stopMoving(); 43 43 } … … 47 47 @Override 48 48 public void redo() { 49 for (StreetsideAbstractImage image : this.images) {50 image.move( this.x, this.y);49 for (StreetsideAbstractImage image : images) { 50 image.move(x, y); 51 51 image.stopMoving(); 52 52 } … … 56 56 @Override 57 57 public String toString() { 58 // TODO: trn( RRH 59 return trn("Moved {0} image", "Moved {0} images", this.images.size(), 60 this.images.size()); 58 return trn("Moved {0} image", "Moved {0} images", images.size(), 59 images.size()); 61 60 } 62 61 … … 64 63 public void sum(StreetsideCommand command) { 65 64 if (command instanceof CommandMove) { 66 this.x += ((CommandMove) command).x;67 this.y += ((CommandMove) command).y;65 x += ((CommandMove) command).x; 66 y += ((CommandMove) command).y; 68 67 } 69 68 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/history/commands/CommandTurn.java
r34325 r34416 33 33 @Override 34 34 public void undo() { 35 for (StreetsideAbstractImage image : this.images) {36 image.turn(- this.ca);35 for (StreetsideAbstractImage image : images) { 36 image.turn(-ca); 37 37 image.stopMoving(); 38 38 } … … 42 42 @Override 43 43 public void redo() { 44 for (StreetsideAbstractImage image : this.images) {45 image.turn( this.ca);44 for (StreetsideAbstractImage image : images) { 45 image.turn(ca); 46 46 image.stopMoving(); 47 47 } … … 51 51 @Override 52 52 public String toString() { 53 // TODO: trn( RRH 54 return trn("Turned {0} image", "Turned {0} images", this.images.size(), 55 this.images.size()); 53 return trn("Turned {0} image", "Turned {0} images", images.size(), 54 images.size()); 56 55 } 57 56 … … 59 58 public void sum(StreetsideCommand command) { 60 59 if (command instanceof CommandTurn) { 61 this.ca += ((CommandTurn) command).ca;60 ca += ((CommandTurn) command).ca; 62 61 } 63 62 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/history/commands/CommandUnjoin.java
r34317 r34416 40 40 @Override 41 41 public void execute() { 42 this.redo();42 redo(); 43 43 } 44 44 … … 59 59 @Override 60 60 public String toString() { 61 // TODO: tr( RRH62 61 return tr("2 images unjoined"); 63 62 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/download/SequenceDownloadRunnable.java
r34412 r34416 76 76 if (node.get("id") != null && node.get("la") != null && node.get("lo") != null) { 77 77 StreetsideImage image = new StreetsideImage(CubemapUtils.convertDecimal2Quaternary(node.path("id").asLong()), node.path("la").asDouble(), node.get("lo").asDouble()); 78 if(previous!=null) {79 // Analyze sequence behaviour80 //previous.setNext(image.getId());81 }82 78 previous = image; 83 79 image.setAd(node.path("ad").asInt()); -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/io/export/StreetsideExportDownloadThread.java
r34412 r34416 58 58 @Override 59 59 public void run() { 60 // CacheUtils.submit(image.getId(), StreetsideCache.Type.FULL_IMAGE, this);60 // use "thumbnail" type here so that the tiles are not exported 61 61 CacheUtils.submit(image.getId(), StreetsideCache.Type.THUMBNAIL, this); 62 62 } -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/model/MapObject.java
r34400 r34416 10 10 public class MapObject extends KeyIndexedObject { 11 11 private static final ImageIcon ICON_UNKNOWN_TYPE = ImageProvider.get("unknown-mapobject-type"); 12 //private static Function<String, URL> iconUrlGen = MainWebsite::mapObjectIcon;13 12 14 13 private final LatLon coordinate; … … 49 48 return ICON_UNKNOWN_TYPE; 50 49 } else if (cachedIcon == null) { 51 /*try { 52 final ImageIcon downloadedIcon = new ImageIcon(ImageIO.read(iconUrlGen.apply(objectTypeID))); 53 MapObjectIconCache.getInstance().put(objectTypeID, downloadedIcon); 54 return downloadedIcon; 55 } catch (IOException e) { 56 logger.warn(I18n.tr("Failed to download icon " + objectTypeID, e)); 57 return ICON_UNKNOWN_TYPE; 58 }*/ 50 // downloading of map icons is not currently supported by Streetside 59 51 } 60 52 return cachedIcon; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/model/UserProfile.java
r34317 r34416 6 6 import javax.swing.ImageIcon; 7 7 8 // not currently used but kept in case Microsoft wants to support user logins 8 9 public class UserProfile extends KeyIndexedObject implements Serializable { 9 10 10 11 private static final long serialVersionUID = 7993340649510343946L; 11 12 12 13 private final String username; 13 14 private final ImageIcon avatar; -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideProperties.java
r34385 r34416 58 58 public static final StringProperty START_DIR = 59 59 new StringProperty("streetside.start-directory", System.getProperty("user.home")); 60 public static final StringProperty URL_CLIENT_ID = 61 new StringProperty("streetside.url-clientid", System.getProperty("T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz")); 62 public static final StringProperty BING_MAPS_KEY = 63 new StringProperty("streetside.bing-maps-key", System.getProperty("AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm")); 64 public static final StringProperty TEST_BUBBLE_ID = 65 new StringProperty("streetside.test-bubble-id", System.getProperty("80848005")); 60 66 61 67 /** -
applications/editors/josm/plugins/MicrosoftStreetside/src/org/openstreetmap/josm/plugins/streetside/utils/StreetsideURL.java
r34412 r34416 28 28 /** Base URL of the Bing Bubble API. */ 29 29 private static final String STREETSIDE_BASE_URL = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx"; 30 private static final String CLIENT_ID = "T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz"; 31 private static final String BING_MAPS_KEY = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm"; 32 private static final String TEST_BUBBLE_ID = "80848005"; 33 34 private static final String STREETSIDE_PRIVACY_URL = "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid="; 30 /** Base URL for Streetside privacy concerns. */ 31 private static final String STREETSIDE_PRIVACY_URL = "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid="; 35 32 36 33 private static final int OSM_BBOX_NORTH = 3; … … 40 37 41 38 public static final class APIv3 { 42 //private static final String BASE_URL = "https://a.mapillary.com/v3/";43 39 44 40 private APIv3() { … … 106 102 } 107 103 108 /**109 * @return the URL where you'll find information about the user account as JSON110 */111 /*public static URL userURL() {112 return StreetsideURL.string2URL(APIv3.BASE_URL, "me", StreetsideURL.queryString(null));113 }*/114 104 } 115 105 … … 174 164 throw new IllegalArgumentException("The image id may not be null!"); 175 165 } 176 return StreetsideURL.string2URL(MessageFormat.format("{0}{1}{2}{3}{4}",VirtualEarth.BASE_URL_PREFIX, "0", id, "01 ", VirtualEarth.BASE_URL_SUFFIX));166 return StreetsideURL.string2URL(MessageFormat.format("{0}{1}{2}{3}{4}",VirtualEarth.BASE_URL_PREFIX, "0", id, "0101", VirtualEarth.BASE_URL_SUFFIX)); 177 167 } 178 168 … … 257 247 */ 258 248 static String queryString(Map<String, String> parts) { 259 final StringBuilder ret = new StringBuilder("?client_id=").append(Streetside URL.CLIENT_ID);249 final StringBuilder ret = new StringBuilder("?client_id=").append(StreetsideProperties.URL_CLIENT_ID.get()); 260 250 if (parts != null) { 261 251 for (final Entry<String, String> entry : parts.entrySet()) { … … 292 282 .append("&c=1000") 293 283 .append("&appkey=") 294 .append(Streetside URL.BING_MAPS_KEY);284 .append(StreetsideProperties.BING_MAPS_KEY.get()); 295 285 } catch (final UnsupportedEncodingException e) { 296 286 logger.error(e); // This should not happen, as the encoding is hard-coded … … 308 298 final StringBuilder ret = new StringBuilder("?id="); 309 299 try { 310 ret.append(URLEncoder.encode(Streetside URL.TEST_BUBBLE_ID, StandardCharsets.UTF_8.name()));300 ret.append(URLEncoder.encode(StreetsideProperties.TEST_BUBBLE_ID.get(), StandardCharsets.UTF_8.name())); 311 301 ret.append('&').append(URLEncoder.encode("appkey=", StandardCharsets.UTF_8.name())).append('=') 312 .append(URLEncoder.encode(Streetside URL.BING_MAPS_KEY, StandardCharsets.UTF_8.name()));302 .append(URLEncoder.encode(StreetsideProperties.BING_MAPS_KEY.get(), StandardCharsets.UTF_8.name())); 313 303 } catch (final UnsupportedEncodingException e) { 314 304 logger.error(e); // This should not happen, as the encoding is hard-coded
Note:
See TracChangeset
for help on using the changeset viewer.