Changeset 31297 in osm for applications/editors
- Timestamp:
- 2015-06-23T10:14:53+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31284 r31297 234 234 Main.map.mapView.zoomTo(MapillaryData.getInstance() 235 235 .getSelectedImage().getLatLon()); 236 if (Main.map != null) {236 if (Main.map != null) 237 237 Main.map.mapView.repaint(); 238 }239 238 fireSelectedImageChanged(oldImage, selectedImage); 240 239 } … … 300 299 // DO NOTHING 301 300 } 301 302 /** 303 * Returns the amount of images contained by this object. 304 * 305 * @return 306 */ 307 public int size() { 308 return images.size(); 309 } 302 310 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31284 r31297 7 7 import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache; 8 8 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader; 9 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog; 9 10 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryToggleDialog; 10 11 import org.openstreetmap.josm.Main; … … 62 63 public static MapillaryImage RED; 63 64 64 private final MapillaryData mapillaryData = MapillaryData.getInstance();65 private final MapillaryData data = MapillaryData.getInstance(); 65 66 66 67 public List<Bounds> bounds; … … 69 70 private MouseAdapter mouseAdapter; 70 71 71 int highlightPointRadius = Main.pref.getInteger(72 private int highlightPointRadius = Main.pref.getInteger( 72 73 "mappaint.highlight.radius", 7); 73 74 private int highlightStep = Main.pref.getInteger("mappaint.highlight.step", … … 105 106 } 106 107 107 p ublicvoid startMouseAdapter() {108 private void startMouseAdapter() { 108 109 mouseAdapter = new MapillaryMouseAdapter(); 109 110 } … … 161 162 */ 162 163 public MapillaryData getMapillaryData() { 163 return mapillaryData;164 return data; 164 165 } 165 166 … … 171 172 MapillaryToggleDialog.getInstance().mapillaryImageDisplay 172 173 .setImage(null); 173 MapillaryData.getInstance().getImages().clear();174 data.getImages().clear(); 174 175 MapillaryLayer.INSTANCE = null; 175 176 MapillaryData.INSTANCE = null; … … 190 191 @Override 191 192 public boolean isModified() { 192 for (MapillaryAbstractImage image : mapillaryData.getImages())193 for (MapillaryAbstractImage image : data.getImages()) 193 194 if (image.isModified()) 194 195 return true; 195 196 return false; 197 } 198 199 @Override 200 public void setVisible(boolean visible) { 201 super.setVisible(visible); 202 for (MapillaryAbstractImage img : data.getImages()) 203 img.setVisible(visible); 204 MapillaryFilterDialog.getInstance().refresh(); 196 205 } 197 206 … … 209 218 210 219 // Sets blue and red lines and enables/disables the buttons 211 if ( mapillaryData.getSelectedImage() != null) {220 if (data.getSelectedImage() != null) { 212 221 MapillaryImage[] closestImages = getClosestImagesFromDifferentSequences(); 213 Point selected = mv.getPoint( mapillaryData.getSelectedImage()222 Point selected = mv.getPoint(data.getSelectedImage() 214 223 .getLatLon()); 215 224 if (closestImages[0] != null) { … … 233 242 } 234 243 g.setColor(Color.WHITE); 235 for (MapillaryAbstractImage imageAbs : mapillaryData.getImages()) {244 for (MapillaryAbstractImage imageAbs : data.getImages()) { 236 245 if (!imageAbs.isVisible()) 237 246 continue; … … 247 256 g.drawLine(p.x, p.y, nextp.x, nextp.y); 248 257 } 249 258 250 259 ImageIcon icon; 251 if (! mapillaryData.getMultiSelectedImages().contains(image))260 if (!data.getMultiSelectedImages().contains(image)) 252 261 icon = MapillaryPlugin.MAP_ICON; 253 262 else … … 263 272 MapillaryImportedImage image = (MapillaryImportedImage) imageAbs; 264 273 ImageIcon icon; 265 if (! mapillaryData.getMultiSelectedImages().contains(image))274 if (!data.getMultiSelectedImages().contains(image)) 266 275 icon = MapillaryPlugin.MAP_ICON_IMPORTED; 267 276 else … … 322 331 g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y - (height / 2), 323 332 Main.map.mapView); 324 if ( MapillaryData.getInstance().getHoveredImage() == image) {333 if (data.getHoveredImage() == image) { 325 334 drawPointHighlight(g, p, 16); 326 335 } … … 358 367 */ 359 368 private MapillaryImage[] getClosestImagesFromDifferentSequences() { 360 if (!( mapillaryData.getSelectedImage() instanceof MapillaryImage))369 if (!(data.getSelectedImage() instanceof MapillaryImage)) 361 370 return new MapillaryImage[2]; 362 MapillaryImage selected = (MapillaryImage) mapillaryData371 MapillaryImage selected = (MapillaryImage) data 363 372 .getSelectedImage(); 364 373 MapillaryImage[] ret = new MapillaryImage[2]; 365 374 double[] distances = { SEQUENCE_MAX_JUMP_DISTANCE, 366 375 SEQUENCE_MAX_JUMP_DISTANCE }; 367 LatLon selectedCoords = mapillaryData.getSelectedImage().getLatLon();368 for (MapillaryAbstractImage imagePrev : mapillaryData.getImages()) {376 LatLon selectedCoords = data.getSelectedImage().getLatLon(); 377 for (MapillaryAbstractImage imagePrev : data.getImages()) { 369 378 if (!(imagePrev instanceof MapillaryImage)) 370 379 continue; … … 393 402 if (ret[0] != null) 394 403 new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL) 395 .submit( MapillaryData.getInstance(), false);404 .submit(data, false); 396 405 if (ret[1] != null) 397 406 new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL) 398 .submit( MapillaryData.getInstance(), false);407 .submit(data, false); 399 408 return ret; 400 409 } … … 407 416 sb.append(tr("Total images:")); 408 417 sb.append(" "); 409 sb.append( this.size());418 sb.append(data.size()); 410 419 sb.append("\n"); 411 420 return sb.toString(); … … 414 423 @Override 415 424 public String getToolTipText() { 416 return this.size() + " " + tr("images"); 417 } 418 419 private int size() { 420 return mapillaryData.getImages().size(); 425 return data.size() + " " + tr("images"); 421 426 } 422 427 … … 485 490 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 486 491 if (newLayer == this) { 487 if ( MapillaryData.getInstance().getImages().size() > 0)492 if (data.size() > 0) 488 493 Main.map.statusLine.setHelpText(tr("Total images: {0}", 489 MapillaryData.getInstance().getImages().size()));494 data.size())); 490 495 else 491 496 Main.map.statusLine.setHelpText(tr("No images found")); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31284 r31297 129 129 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 130 130 if (oldLayer == null && newLayer != null) { 131 DOWNLOAD_MENU.setEnabled(true);132 IMPORT_MENU.setEnabled(true);133 DOWNLOAD_VIEW_MENU.setEnabled(true);131 setMenuEnabled(DOWNLOAD_MENU, true); 132 setMenuEnabled(IMPORT_MENU, true); 133 setMenuEnabled(DOWNLOAD_VIEW_MENU, true); 134 134 } else if (oldLayer != null && newLayer == null) { 135 DOWNLOAD_MENU.setEnabled(false);136 IMPORT_MENU.setEnabled(false);137 DOWNLOAD_VIEW_MENU.setEnabled(false);135 setMenuEnabled(DOWNLOAD_MENU, false); 136 setMenuEnabled(IMPORT_MENU, false); 137 setMenuEnabled(DOWNLOAD_VIEW_MENU, false); 138 138 } 139 139 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31278 r31297 45 45 } 46 46 } 47 48 47 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterChooseSigns.java
r31296 r31297 12 12 import org.openstreetmap.josm.tools.ImageProvider; 13 13 14 public class MapillaryFilterChooseSigns extends JPanel implements ActionListener { 14 public class MapillaryFilterChooseSigns extends JPanel implements 15 ActionListener { 15 16 16 private JCheckBox maxspeed = new JCheckBox(); 17 17 private final JCheckBox maxspeed = new JCheckBox(); 18 private final JCheckBox stop = new JCheckBox(); 19 private final JCheckBox giveWay = new JCheckBox(); 20 private final JCheckBox roundabout = new JCheckBox(); 21 private final JCheckBox access = new JCheckBox(); 22 18 23 private static MapillaryFilterChooseSigns INSTANCE; 19 24 20 25 public MapillaryFilterChooseSigns() { 26 // Max speed sign 21 27 JPanel maxspeedPanel = new JPanel(); 22 28 JLabel maxspeedLabel = new JLabel(tr("Speed limit")); 23 maxspeedLabel.setIcon(new ImageProvider("styles/standard/vehicle/restriction/speed.png").get()); 29 maxspeedLabel.setIcon(new ImageProvider( 30 "styles/standard/vehicle/restriction/speed.png").get()); 24 31 maxspeedPanel.add(maxspeedLabel); 25 32 maxspeedPanel.add(maxspeed); 26 33 this.add(maxspeedPanel); 34 35 // Stop sign 36 JPanel stopPanel = new JPanel(); 37 JLabel stopLabel = new JLabel(tr("Stop")); 38 stopLabel.setIcon(new ImageProvider( 39 "styles/standard/vehicle/restriction/stop.png").get()); 40 stopPanel.add(stopLabel); 41 stopPanel.add(stop); 42 this.add(stopPanel); 43 44 // Give way sign 45 JPanel giveWayPanel = new JPanel(); 46 JLabel giveWayLabel = new JLabel(tr("Give way")); 47 giveWayLabel.setIcon(new ImageProvider( 48 "styles/standard/vehicle/restriction/right_of_way.png").get()); 49 giveWayPanel.add(giveWayLabel); 50 giveWayPanel.add(giveWay); 51 this.add(giveWayPanel); 52 53 // Roundabout sign 54 JPanel roundaboutPanel = new JPanel(); 55 JLabel roundaboutLabel = new JLabel(tr("Give way")); 56 roundaboutLabel.setIcon(new ImageProvider( 57 "styles/standard/vehicle/restriction/roundabout_right.png") 58 .get()); 59 roundaboutPanel.add(roundaboutLabel); 60 roundaboutPanel.add(roundabout); 61 this.add(roundaboutPanel); 62 63 // No entry sign 64 // TODO need icon 65 JPanel noEntryPanel = new JPanel(); 66 JLabel noEntryLabel = new JLabel(tr("No entry")); 67 noEntryLabel.setIcon(new ImageProvider( 68 "styles/standard/vehicle/restriction/access.png").get()); 69 noEntryPanel.add(noEntryLabel); 70 noEntryPanel.add(access); 71 this.add(noEntryPanel); 27 72 } 28 73 29 74 public static MapillaryFilterChooseSigns getInstance() { 30 75 if (INSTANCE == null) … … 32 77 return INSTANCE; 33 78 } 34 79 35 80 @Override 36 81 public void actionPerformed(ActionEvent arg0) { 37 82 // TODO Auto-generated method stub 38 83 39 84 } 40 85 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31296 r31297 225 225 } 226 226 } 227 227 228 228 private class OnlySignsAction extends AbstractAction { 229 229 public OnlySignsAction() { … … 237 237 } 238 238 239 /** 240 * Opens a new window where you can specifically filter signs. 241 * 242 * @author nokutu 243 * 244 */ 239 245 private class SignChooserAction extends AbstractAction { 240 246 public SignChooserAction() { … … 245 251 public void actionPerformed(ActionEvent arg0) { 246 252 JPanel dialog = MapillaryFilterChooseSigns.getInstance(); 247 JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE,248 JOptionPane. OK_CANCEL_OPTION);253 JOptionPane pane = new JOptionPane(dialog, 254 JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 249 255 JDialog dlg = pane.createDialog(Main.parent, tr("Choose signs")); 250 256 dlg.setMinimumSize(new Dimension(400, 150)); … … 252 258 MapillaryFilterDialog.getInstance().refresh(); 253 259 dlg.dispose(); 254 255 260 } 256 261 } 257 262 258 263 public static void destroyInstance() { 259 MapillaryFilterDialog.INSTANCE = null; 264 MapillaryFilterDialog.INSTANCE = null; 260 265 } 261 266 }
Note:
See TracChangeset
for help on using the changeset viewer.