Ignore:
Timestamp:
2015-06-15T14:13:09+02:00 (10 years ago)
Author:
nokutu
Message:

Picture's author and capture date is shown

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java

    r31259 r31267  
    11package org.openstreetmap.josm.plugins.mapillary;
    22
     3import java.sql.Date;
     4import java.text.SimpleDateFormat;
    35import java.util.ArrayList;
    46import java.util.List;
     
    1719        private MapillarySequence sequence;
    1820
    19         private int capturedAt;
     21        private long capturedAt;
    2022        private String user;
    2123        private List<String> signals;
     
    6567        }
    6668
    67         public void setCapturedAt(int capturedAt) {
     69        public void setCapturedAt(long capturedAt) {
    6870                this.capturedAt = capturedAt;
    6971        }
    7072
    71         public int getCapturedAt() {
     73        public long getCapturedAt() {
    7274                return capturedAt;
    7375        }
     
    128130                return this.getSequence().previous(this);
    129131        }
     132       
     133        public String getDate() {
     134                Date date = new Date(getCapturedAt());
     135
     136                SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy - hh:mm:ss");
     137                return formatter.format(date);
     138        }
    130139
    131140        @Override
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloaderThread.java

    r31264 r31267  
    5252                                                                        .getString("user"));
    5353                                                        ((MapillaryImage) image).setCapturedAt(data
    54                                                                         .getJsonNumber("captured_at").intValue());
     54                                                                        .getJsonNumber("captured_at").longValue());
    5555                                                        ((MapillaryImage) image).setLocation(data
    5656                                                                        .getString("location"));
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java

    r31266 r31267  
    4848        public final static int SIGNAL_MODE = 1;
    4949
     50        public final static String BASE_TITLE = "Mapillary picture";
     51
    5052        public static MapillaryToggleDialog INSTANCE;
    5153
     
    7678
    7779        public MapillaryToggleDialog() {
    78                 super(tr("Mapillary image"), "mapillary.png",
    79                                 tr("Open Mapillary window"), Shortcut.registerShortcut(
    80                                                 tr("Mapillary dialog"),
     80                super(tr(BASE_TITLE), "mapillary.png", tr("Open Mapillary window"),
     81                                Shortcut.registerShortcut(tr("Mapillary dialog"),
    8182                                                tr("Open Mapillary main dialog"), KeyEvent.VK_M,
    8283                                                Shortcut.NONE), 200);
     
    130131                createLayout(mapillaryImageDisplay, list,
    131132                                Main.pref.getBoolean("mapillary.reverse-buttons"));
     133                disableAllButtons();
    132134                updateImage();
    133135        }
     
    149151                                return;
    150152                        }
    151                         if (this.image == null)
     153                        if (this.image == null) {
     154                                mapillaryImageDisplay.setImage(null);
     155                                titleBar.setTitle(BASE_TITLE);
     156                                disableAllButtons();
    152157                                return;
     158                        }
    153159                        if (image instanceof MapillaryImage) {
    154160                                MapillaryImage mapillaryImage = (MapillaryImage) this.image;
     161                                String title = BASE_TITLE;
     162                                if (mapillaryImage.getUser() != null)
     163                                        title += " -- " + mapillaryImage.getUser();
     164                                if (mapillaryImage.getCapturedAt() != 0)
     165                                        title += " -- " + mapillaryImage.getDate();
     166                                titleBar.setTitle(title);
    155167                                if (mode == NORMAL_MODE) {
    156168                                        this.nextButton.setEnabled(true);
     
    215227        }
    216228
     229        private void disableAllButtons() {
     230                nextButton.setEnabled(false);
     231                previousButton.setEnabled(false);
     232                blueButton.setEnabled(false);
     233                redButton.setEnabled(false);
     234                nextSignalButton.setEnabled(false);
     235                previousSignalButton.setEnabled(false);
     236        }
     237
    217238        /**
    218239         * Sets a new MapillaryImage to be shown.
     
    382403
    383404        @Override
    384         public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) {
     405        public void selectedImageChanged(MapillaryAbstractImage oldImage,
     406                        MapillaryAbstractImage newImage) {
    385407                setImage(MapillaryData.getInstance().getSelectedImage());
    386408                updateImage();
Note: See TracChangeset for help on using the changeset viewer.