Ignore:
Timestamp:
2015-07-16T13:56:06+02:00 (9 years ago)
Author:
nokutu
Message:

Code commented

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

Legend:

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

    r31359 r31386  
    2020public abstract class MapillaryAbstractImage {
    2121
     22  /**
     23   * Lock that locks next() and previous() methods. Used when downloading images
     24   * to prevent concurrency problems.
     25   */
    2226  public static Lock lock = new ReentrantLock();
    2327
    24   /** The time the image was captured, in Epoch format */
     28  /** The time the image was captured, in Epoch format. */
    2529  private long capturedAt;
    26   /** Sequence of pictures containing this object */
     30  /** Sequence of pictures containing this object. */
    2731  private MapillarySequence sequence;
    28   /** Position of the picture */
     32  /** Position of the picture. */
    2933  public final LatLon latLon;
    30   /** Direction of the picture */
     34  /** Direction of the picture. */
    3135  public final double ca;
     36  /** If the image has been modified from its initial values. */
    3237  public boolean isModified = false;
    33   /** Temporal position of the picture until it is uploaded */
     38  /** Temporal position of the picture until it is uploaded. */
    3439  public LatLon tempLatLon;
    3540  /**
    3641   * When the object is being dragged in the map, the temporal position is
    37    * stored here
     42   * stored here.
    3843   */
    3944  public LatLon movingLatLon;
     
    4752  private boolean visible;
    4853
     54  /**
     55   * Main constructor of the class.
     56   *
     57   * @param lat
     58   *          The latitude where the picture was taken.
     59   * @param lon
     60   *          The longitude where the picture was taken.
     61   * @param ca
     62   *          The direction of the picture (0 means north).
     63   */
    4964  public MapillaryAbstractImage(double lat, double lon, double ca) {
    5065    this.latLon = new LatLon(lat, lon);
     
    85100  }
    86101
     102  /**
     103   * Set's whether the image should be visible on the map or not.
     104   *
     105   * @param visible
     106   *          true if the image is set to be visible; false otherwise.
     107   */
    87108  public void setVisible(boolean visible) {
    88109    this.visible = visible;
     
    107128   */
    108129  public void move(double x, double y) {
    109     this.movingLatLon = new LatLon(this.tempLatLon.getY() + y, this.tempLatLon.getX() + x);
     130    this.movingLatLon = new LatLon(this.tempLatLon.getY() + y,
     131        this.tempLatLon.getX() + x);
    110132    this.isModified = true;
    111133  }
     
    169191  }
    170192
     193  /**
     194   * Sets the Epoch time when the picture was captured.
     195   *
     196   * @param capturedAt
     197   */
    171198  public void setCapturedAt(long capturedAt) {
    172199    this.capturedAt = capturedAt;
    173200  }
    174201
     202  /**
     203   * Returns the Epoch time when the image was captured.
     204   *
     205   * @return The long containing the Epoch time when the image was captured.
     206   */
    175207  public long getCapturedAt() {
    176208    return capturedAt;
     
    181213   *
    182214   * @param format
    183    * @return
     215   * @return A String containing the date the picture was taken using the given
     216   *         format.
    184217   */
    185218  public String getDate(String format) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java

    r31377 r31386  
    2020 */
    2121public class MapillaryData implements ICachedLoaderListener {
     22
     23  /** Unique instance of the class */
    2224  public volatile static MapillaryData INSTANCE;
     25  /** Enable this if you are using in Unit Tests */
    2326  public static boolean TEST_MODE = false;
    2427
     
    3134  private List<MapillaryDataListener> listeners = new ArrayList<>();
    3235
    33   public MapillaryData() {
     36  /**
     37   * Main constructor.
     38   */
     39  private MapillaryData() {
    3440    images = new CopyOnWriteArrayList<>();
    3541    multiSelectedImages = new ArrayList<>();
     
    3743  }
    3844
     45  /**
     46   * Returns the unique instance of the class.
     47   *
     48   * @return The unique instance of the class.
     49   */
    3950  public static MapillaryData getInstance() {
    4051    if (INSTANCE == null) {
     
    4859   *
    4960   * @param images
    50    *          The set of images to be added.
     61   *        The set of images to be added.
    5162   */
    5263  public synchronized void add(List<MapillaryAbstractImage> images) {
     
    6071   *
    6172   * @param image
    62    *          The image to be added.
     73   *        The image to be added.
    6374   */
    6475  public synchronized void add(MapillaryAbstractImage image) {
     
    7081  }
    7182
     83  /**
     84   * Adds a new listener.
     85   *
     86   * @param lis Listener to be added.
     87   */
    7288  public void addListener(MapillaryDataListener lis) {
    7389    listeners.add(lis);
    7490  }
    7591
     92  /**
     93   * Removes a listener.
     94   *
     95   * @param lis Listener to be removed.
     96   */
    7697  public void removeListener(MapillaryDataListener lis) {
    7798    listeners.remove(lis);
     
    83104   *
    84105   * @param images
    85    *          The set of images to be added.
     106   *        The set of images to be added.
    86107   */
    87108  public synchronized void addWithoutUpdate(List<MapillaryAbstractImage> images) {
     
    95116   *
    96117   * @param image
    97    *          The image under the cursor.
     118   *        The image under the cursor.
    98119   */
    99120  public void setHighlightedImage(MapillaryAbstractImage image) {
     
    115136   *
    116137   * @param image
    117    *          The image to be added.
     138   *        The image to be added.
    118139   */
    119140  public synchronized void addWithoutUpdate(MapillaryAbstractImage image) {
     
    198219
    199220  /**
    200    * Selects a new image and then starts a new
    201    * {@link MapillaryImageDownloadThread} thread in order to download its
    202    * surrounding thumbnails. If the user does ctrl+click, this isn't triggered.
    203    *
    204    * @param image
    205    *          The MapillaryImage which is going to be selected
     221   * Selects a new image.If the user does ctrl+click, this isn't triggered.
     222   *
     223   * @param image
     224   *        The MapillaryImage which is going to be selected
    206225   */
    207226  public void setSelectedImage(MapillaryAbstractImage image) {
     
    210229
    211230  /**
    212    * Selects a new image and then starts a new
    213    * {@link MapillaryImageDownloadThread} thread in order to download its
    214    * surrounding thumbnails. If the user does ctrl+click, this isn't triggered.
     231   * Selects a new image.If the user does ctrl+click, this isn't triggered.
    215232   * You can choose whether to center the view on the new image or not.
    216233   *
    217234   * @param image
    218    *          The {@link MapillaryImage} which is going to be selected.
     235   *        The {@link MapillaryImage} which is going to be selected.
    219236   * @param zoom
    220    *          True if the view must be centered on the image; false otherwise.
     237   *        True if the view must be centered on the image; false otherwise.
    221238   */
    222239  public void setSelectedImage(MapillaryAbstractImage image, boolean zoom) {
     
    264281   *
    265282   * @param image
    266    *          The MapillaryImage object to be added.
     283   *        The MapillaryImage object to be added.
    267284   */
    268285  public void addMultiSelectedImage(MapillaryAbstractImage image) {
     
    281298   *
    282299   * @param images
    283    *          A List object containing the set of images to be added.
     300   *        A List object containing the set of images to be added.
    284301   */
    285302  public void addMultiSelectedImage(List<MapillaryAbstractImage> images) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java

    r31350 r31386  
    11package org.openstreetmap.josm.plugins.mapillary;
    22
     3/**
     4 * Interface for listeners of the class {@link MapillaryData}.
     5 *
     6 * @author nokutu
     7 *
     8 */
    39public interface MapillaryDataListener {
    410
     
    1117   * Fired when the selected image is changed by something different from
    1218   * manually clicking on the icon.
     19   *
     20   * @param oldImage Old selected {@link MapillaryAbstractImage}
     21   * @param newImage New selected {@link MapillaryAbstractImage}
    1322   */
    1423  public void selectedImageChanged(MapillaryAbstractImage oldImage,
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java

    r31359 r31386  
    2121  private String location;
    2222
     23  /**
     24   * Returns the localtion where the image was taken.
     25   *
     26   * @return A String containing the location where the picture was taken.
     27   */
    2328  public String getLocation() {
    2429    return location;
    2530  }
    2631
     32  /**
     33   * Sets the location of the image.
     34   *
     35   * @param location
     36   */
    2737  public void setLocation(String location) {
    2838    this.location = location;
     
    8595  }
    8696
     97  /**
     98   * Returns the username of the person who took the picture.
     99   *
     100   * @return A String containing the username of the person who took the picture.
     101   */
    87102  public String getUser() {
    88103    return user;
     
    91106  @Override
    92107  public String toString() {
    93     return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon=" + this.latLon.lon() + ";ca=" + this.ca + "]";
     108    return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon="
     109        + this.latLon.lon() + ";ca=" + this.ca + "]";
    94110  }
    95111
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java

    r31350 r31386  
    99import javax.imageio.ImageIO;
    1010
     11/**
     12 * A MapillaryImoprtedImage object represents a picture imported locally.
     13 *
     14 * @author nokutu
     15 *
     16 */
    1117public class MapillaryImportedImage extends MapillaryAbstractImage {
    1218
    13   /**
    14    * The picture file.
    15    */
     19  /** The picture file. */
    1620  protected File file;
     21  /** The date when the picture was taken. */
    1722  public final long datetimeOriginal;
    1823
     24  /**
     25   * Creates a new MapillaryImportedImage object using as date the current date,
     26   * because it is missing in the file.
     27   *
     28   * @param lat
     29   *          Latitude where the picture was taken.
     30   * @param lon
     31   *          Longitude where the picture was taken.
     32   * @param ca
     33   *          Direction of the picture (0 means north).
     34   * @param file
     35   *          The file containing the picture.
     36   */
    1937  public MapillaryImportedImage(double lat, double lon, double ca, File file) {
    2038    this(lat, lon, ca, file, currentDate());
    2139  }
    2240
     41  /**
     42   * Main constructor of the class.
     43   *
     44   * @param lat
     45   *          Latitude where the picture was taken.
     46   * @param lon
     47   *          Longitude where the picture was taken.
     48   * @param ca
     49   *          Direction of the picture (0 means north),
     50   * @param file
     51   *          The file containing the picture.
     52   * @param datetimeOriginal
     53   *          The date the picture was taken.
     54   */
    2355  public MapillaryImportedImage(double lat, double lon, double ca, File file,
    2456      String datetimeOriginal) {
     
    4274  /**
    4375   * Returns the File object where the picture is located.
    44    * 
     76   *
    4577   * @return The File object where the picture is located.
    4678   */
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java

    r31381 r31386  
    44import static org.openstreetmap.josm.tools.I18n.marktr;
    55
    6 import org.apache.commons.jcs.access.CacheAccess;
    76import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryDownloadViewAction;
    87import org.openstreetmap.josm.plugins.mapillary.cache.MapillaryCache;
     
    2120import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
    2221import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    23 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry;
    24 import org.openstreetmap.josm.data.cache.JCSCacheManager;
    2522import org.openstreetmap.josm.data.coor.LatLon;
    2623import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    5047import java.awt.image.AffineTransformOp;
    5148import java.awt.image.BufferedImage;
    52 import java.io.IOException;
    5349
    5450import javax.swing.ImageIcon;
     
    6056import java.util.ArrayList;
    6157
    62 public class MapillaryLayer extends AbstractModifiableLayer implements DataSetListener, EditLayerChangeListener,
    63     LayerChangeListener {
    64 
    65   public final static int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref
    66       .getInteger("mapillary.sequence-max-jump-distance", 100);
     58/**
     59 * This class represents the layer shown in JOSM. There can only exist one
     60 * instance of this object.
     61 *
     62 * @author nokutu
     63 *
     64 */
     65public class MapillaryLayer extends AbstractModifiableLayer implements
     66    DataSetListener, EditLayerChangeListener, LayerChangeListener {
     67
     68  /** Maximum distance for the red/blue lines. */
     69  public final static int SEQUENCE_MAX_JUMP_DISTANCE = Main.pref.getInteger(
     70      "mapillary.sequence-max-jump-distance", 100);
    6771
    6872  private boolean TEMP_MANUAL = false;
    6973
     74  /** Unique instance of the class */
    7075  public static MapillaryLayer INSTANCE;
    71   public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
     76  /** The image pointed by the blue line */
    7277  public static MapillaryImage BLUE;
     78  /** The image pointed by the red line */
    7379  public static MapillaryImage RED;
    7480
    75   private final MapillaryData data = MapillaryData.getInstance();
    76 
     81  /** {@link MapillaryData} object that stores the database */
     82  public final MapillaryData data = MapillaryData.getInstance();
     83
     84  /** The bounds of the areas for which the pictures have been downloaded */
    7785  public ArrayList<Bounds> bounds;
    7886
     87  /** Mode of the layer */
    7988  public AbstractMode mode;
    8089
    81   private int highlightPointRadius = Main.pref.getInteger("mappaint.highlight.radius", 7);
    82   private int highlightStep = Main.pref.getInteger("mappaint.highlight.step", 4);
     90  private int highlightPointRadius = Main.pref.getInteger(
     91      "mappaint.highlight.radius", 7);
     92  private int highlightStep = Main.pref
     93      .getInteger("mappaint.highlight.step", 4);
    8394
    8495  private volatile TexturePaint hatched;
     
    95106  private void init() {
    96107    mode = new SelectMode();
    97     try {
    98       CACHE = JCSCacheManager.getCache("Mapillary");
    99     } catch (IOException e) {
    100       Main.error(e);
    101     }
    102108    if (Main.map != null && Main.map.mapView != null) {
    103109      Main.map.mapView.addMouseListener(mode);
     
    120126  }
    121127
     128  /**
     129   * Changes the mode the the given one.
     130   *
     131   * @param mode
     132   *          The mode that is going to be activated.
     133   */
    122134  public void setMode(AbstractMode mode) {
    123135    Main.map.mapView.removeMouseListener(this.mode);
     
    130142  }
    131143
     144  /**
     145   * Returns the unique instance of this class.
     146   *
     147   * @return The unique isntance of this class.
     148   */
    132149  public synchronized static MapillaryLayer getInstance() {
    133150    if (MapillaryLayer.INSTANCE == null)
     
    144161    if (Main.pref.getBoolean("mapillary.download-manually") || TEMP_MANUAL)
    145162      return;
    146     for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) {
     163    for (Bounds bounds : Main.map.mapView.getEditLayer().data
     164        .getDataSourceBounds()) {
    147165      if (!this.bounds.contains(bounds)) {
    148166        this.bounds.add(bounds);
     
    160178  private void checkAreaTooBig() {
    161179    double area = 0;
    162     for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) {
     180    for (Bounds bounds : Main.map.mapView.getEditLayer().data
     181        .getDataSourceBounds()) {
    163182      area += bounds.getArea();
    164183    }
     
    174193
    175194  /**
    176    * Returns the MapillaryData object, which acts as the database of the Layer.
    177    *
    178    * @return
     195   * Returns the {@link MapillaryData} object, which acts as the database of the
     196   * Layer.
     197   *
     198   * @return The {@link MapillaryData} object that stores the database.
    179199   */
    180200  public MapillaryData getMapillaryData() {
     
    292312        Point p1 = mv.getPoint(bounds.getMin());
    293313        Point p2 = mv.getPoint(bounds.getMax());
    294         Rectangle r = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), Math.abs(p2.x - p1.x), Math.abs(p2.y
    295             - p1.y));
     314        Rectangle r = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y),
     315            Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y));
    296316        a.subtract(new Area(r));
    297317      }
     
    314334        MapillaryLayer.BLUE = closestImages[0];
    315335        g.setColor(Color.BLUE);
    316         g.drawLine(mv.getPoint(closestImages[0].getLatLon()).x, mv.getPoint(closestImages[0].getLatLon()).y,
    317             selected.x, selected.y);
     336        g.drawLine(mv.getPoint(closestImages[0].getLatLon()).x,
     337            mv.getPoint(closestImages[0].getLatLon()).y, selected.x, selected.y);
    318338        MapillaryMainDialog.getInstance().blueButton.setEnabled(true);
    319339      }
     
    321341        MapillaryLayer.RED = closestImages[1];
    322342        g.setColor(Color.RED);
    323         g.drawLine(mv.getPoint(closestImages[1].getLatLon()).x, mv.getPoint(closestImages[1].getLatLon()).y,
    324             selected.x, selected.y);
     343        g.drawLine(mv.getPoint(closestImages[1].getLatLon()).x,
     344            mv.getPoint(closestImages[1].getLatLon()).y, selected.x, selected.y);
    325345        MapillaryMainDialog.getInstance().redButton.setEnabled(true);
    326346      }
     
    356376        draw(g, image, icon, p);
    357377        if (!image.getSigns().isEmpty()) {
    358           g.drawImage(MapillaryPlugin.MAP_SIGN.getImage(), p.x + icon.getIconWidth() / 2, p.y - icon.getIconHeight()
    359               / 2, Main.map.mapView);
     378          g.drawImage(MapillaryPlugin.MAP_SIGN.getImage(),
     379              p.x + icon.getIconWidth() / 2, p.y - icon.getIconHeight() / 2,
     380              Main.map.mapView);
    360381        }
    361382      } else if (imageAbs instanceof MapillaryImportedImage) {
     
    384405    Color oldColor = g.getColor();
    385406    Color highlightColor = PaintColors.HIGHLIGHT.get();
    386     Color highlightColorTransparent = new Color(highlightColor.getRed(), highlightColor.getGreen(),
    387         highlightColor.getBlue(), 100);
     407    Color highlightColorTransparent = new Color(highlightColor.getRed(),
     408        highlightColor.getGreen(), highlightColor.getBlue(), 100);
    388409    g.setColor(highlightColorTransparent);
    389410    int s = size + highlightPointRadius;
     
    405426   * @param p
    406427   */
    407   private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, Point p) {
     428  private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon,
     429      Point p) {
    408430    Image imagetemp = icon.getImage();
    409431    BufferedImage bi = (BufferedImage) imagetemp;
     
    473495          ret[0] = image;
    474496          distances[0] = image.getLatLon().greatCircleDistance(selectedCoords);
    475         } else if ((ret[1] == null || image.getLatLon().greatCircleDistance(selectedCoords) < distances[1])
     497        } else if ((ret[1] == null || image.getLatLon().greatCircleDistance(
     498            selectedCoords) < distances[1])
    476499            && image.getSequence() != ret[0].getSequence()) {
    477500          ret[1] = image;
     
    482505    // Predownloads the thumbnails
    483506    if (ret[0] != null)
    484       new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL).submit(data, false);
     507      new MapillaryCache(ret[0].getKey(), MapillaryCache.Type.THUMBNAIL)
     508          .submit(data, false);
    485509    if (ret[1] != null)
    486       new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL).submit(data, false);
     510      new MapillaryCache(ret[1].getKey(), MapillaryCache.Type.THUMBNAIL)
     511          .submit(data, false);
    487512    return ret;
    488513  }
     
    589614  }
    590615
     616  /**
     617   * Updates the help text at the bottom of the window.
     618   */
    591619  public void updateHelpText() {
    592620    String ret = "";
     
    597625    ret += " -- " + tr(mode.toString());
    598626
    599      Main.map.statusLine.setHelpText(ret);
     627    Main.map.statusLine.setHelpText(ret);
    600628  }
    601629}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java

    r31374 r31386  
    3030public class MapillaryPlugin extends Plugin {
    3131
     32  /** 24x24 icon. */
    3233  public static final ImageIcon ICON24 = new ImageProvider("icon24.png").get();
     34  /** 16x16 icon. */
    3335  public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get();
    34   public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png").get();
    35   public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get();
    36   public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get();
     36  /** Icon representing an image in the map. */
     37  public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png")
     38      .get();
     39  /** Icon representing a selected image in the map. */
     40  public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider(
     41      "mapiconselected.png").get();
     42  /** Icon representing an imported iage in the map. */
     43  public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider(
     44      "mapiconimported.png").get();
     45  /** Icon used to identify which images have signs on them */
    3746  public static final ImageIcon MAP_SIGN = new ImageProvider("sign.png").get();
    3847  public static final int ICON_SIZE = 24;
    3948
     49  /** Cache that stores the pictures the downloaded pictures. */
    4050  public static CacheAccess<String, BufferedImageCacheEntry> CACHE;
    4151
     
    4858  private final MapillaryJoinAction joinAction;
    4959
     60  /** Menu button for the {@link MapillaryDownloadAction} action. */
    5061  public static JMenuItem DOWNLOAD_MENU;
     62  /** Menu button for the {@link MapillaryExportAction} action. */
    5163  public static JMenuItem EXPORT_MENU;
     64  /** Menu button for the {@link MapillaryImportAction} action. */
    5265  public static JMenuItem IMPORT_MENU;
     66  /** Menu button for the {@link MapillaryZoomAction} action. */
    5367  public static JMenuItem ZOOM_MENU;
     68  /** Menu button for the {@link MapillaryDownloadViewAction} action. */
    5469  public static JMenuItem DOWNLOAD_VIEW_MENU;
     70  /** Menu button for the {@link MapillaryImportIntoSequenceAction} action. */
    5571  public static JMenuItem IMPORT_INTO_SEQUENCE_MENU;
     72  /** Menu button for the {@link MapillaryJoinAction} action. */
    5673  public static JMenuItem JOIN_MENU;
    5774
     75  /**
     76   * Main constructor.
     77   *
     78   * @param info
     79   */
    5880  public MapillaryPlugin(PluginInformation info) {
    5981    super(info);
     
    6789
    6890    if (Main.main != null) { // important for headless mode
    69       DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, downloadAction, false);
    70       EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction, false, 14);
    71       IMPORT_INTO_SEQUENCE_MENU = MainMenu.add(Main.main.menu.fileMenu, importIntoSequenceAction, false, 14);
    72       IMPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, importAction, false, 14);
     91      DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, downloadAction,
     92          false);
     93      EXPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, exportAction, false,
     94          14);
     95      IMPORT_INTO_SEQUENCE_MENU = MainMenu.add(Main.main.menu.fileMenu,
     96          importIntoSequenceAction, false, 14);
     97      IMPORT_MENU = MainMenu.add(Main.main.menu.fileMenu, importAction, false,
     98          14);
    7399      ZOOM_MENU = MainMenu.add(Main.main.menu.viewMenu, zoomAction, false, 15);
    74       DOWNLOAD_VIEW_MENU = MainMenu.add(Main.main.menu.fileMenu, downloadViewAction, false, 14);
     100      DOWNLOAD_VIEW_MENU = MainMenu.add(Main.main.menu.fileMenu,
     101          downloadViewAction, false, 14);
    75102      JOIN_MENU = MainMenu.add(Main.main.menu.dataMenu, joinAction, false);
    76103    }
     
    85112
    86113    try {
    87       CACHE = JCSCacheManager.getCache("mapillary", 10, 10000, this.getPluginDir() + "/cache/");
     114      CACHE = JCSCacheManager.getCache("mapillary", 10, 10000,
     115          this.getPluginDir() + "/cache/");
    88116    } catch (IOException e) {
    89117      Main.error(e);
     
    117145  }
    118146
     147  /**
     148   * Enables/disables a JMenuItem.
     149   *
     150   * @param menu
     151   *          The JMenuItem object that is going to be enabled or disabled.
     152   * @param value
     153   *          true to enable de JMenuItem; false to disable it.
     154   */
    119155  public static void setMenuEnabled(JMenuItem menu, boolean value) {
    120156    menu.setEnabled(value);
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java

    r31355 r31386  
    66/**
    77 * Class that stores a sequence of MapillaryImage objects.
    8  * 
     8 *
    99 * @author nokutu
    1010 * @see MapillaryImage
     
    1515  private String key;
    1616  private long created_at;
    17  
     17
     18  /**
     19   * Creates a sequence without key or timestamp. Used for
     20   * {@link MapillaryImportedImage} sequences.
     21   */
    1822  public MapillarySequence() {
    1923    this.images = new ArrayList<>();
    2024  }
    2125
     26  /**
     27   * Creates a sequence object with the given parameters
     28   *
     29   * @param key
     30   *          The unique identifier of the sequence.
     31   * @param created_at
     32   *          The date the sequence was created.
     33   */
    2234  public MapillarySequence(String key, long created_at) {
    2335    this.images = new ArrayList<>();
     
    2840  /**
    2941   * Returns all MapillaryImages objects contained by this object.
    30    *
    31    * @return
     42   *
     43   * @return A List object containing all the {@link MapillaryAbstractImage}
     44   *         objects that are part of the sequence.
    3245   */
    3346  public List<MapillaryAbstractImage> getImages() {
     
    3548  }
    3649
     50  /**
     51   * Returns the Epoch time when the sequence was captured.
     52   *
     53   * @return A long containing the Epoch time when the sequence was captured.
     54   *
     55   */
    3756  public long getCreatedAt() {
    3857    return created_at;
     
    4160  /**
    4261   * Adds a new MapillaryImage object to this object.
    43    * 
     62   *
    4463   * @param image
    4564   */
     
    4867  }
    4968
     69  /**
     70   * Returns the unique identifier of the sequence.
     71   *
     72   * @return A String containing the unique identifier of the sequence. null
     73   *         means that the sequence has been created locally for imported
     74   *         images.
     75   */
    5076  public String getKey() {
    5177    return this.key;
     
    5480  /**
    5581   * Adds a set of MapillaryImage objects to this object.
    56    * 
     82   *
    5783   * @param images
    5884   */
     
    6490  /**
    6591   * Removes a MapillaryImage object from this object.
    66    * 
     92   *
    6793   * @param image
    6894   */
     
    7298
    7399  /**
    74    * Returns the next MapillaryImage in the sequence.
    75    * 
     100   * Returns the next {@link MapillaryAbstractImage} in the sequence.
     101   *
    76102   * @param image
    77    * @return
     103   *          The {@link MapillaryAbstractImage} object whose next image is
     104   *          going to be returned.
     105   * @return The next {@link MapillaryAbstractImage} object in the sequence.
    78106   */
    79107  public MapillaryAbstractImage next(MapillaryAbstractImage image) {
     
    89117  /**
    90118   * Returns the previous {@link MapillaryAbstractImage} in the sequence.
    91    * 
     119   *
    92120   * @param image
    93    * @return
     121   *          The {@link MapillaryAbstractImage} object whose previous image is
     122   *          going to be returned.
     123   * @return The previous {@link MapillaryAbstractImage} object in the sequence.
    94124   */
    95125  public MapillaryAbstractImage previous(MapillaryAbstractImage image) {
     
    106136   * Returns the difference of index between two {@link MapillaryAbstractImage}
    107137   * objects belonging to the same {@link MapillarySequence}.
    108    * 
     138   *
    109139   * @param image1
    110140   * @param image2
    111    * @return
     141   * @return The distance between two {@link MapillaryAbstractImage} objects
     142   *         belonging to the same {@link MapillarySequence}.
    112143   */
    113   public int getDistance(MapillaryAbstractImage image1, MapillaryAbstractImage image2) {
     144  public int getDistance(MapillaryAbstractImage image1,
     145      MapillaryAbstractImage image2) {
    114146    if (!this.images.contains(image1) || !this.images.contains(image2))
    115147      throw new IllegalArgumentException();
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java

    r31350 r31386  
    2424public class MapillaryDownloadAction extends JosmAction {
    2525
     26  private static final long serialVersionUID = 325060354730454948L;
     27
     28  /**
     29   * Main constructor.
     30   */
    2631  public MapillaryDownloadAction() {
    2732    super(tr("Mapillary"), new ImageProvider("icon24.png"),
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java

    r31350 r31386  
    2323public class MapillaryDownloadViewAction extends JosmAction {
    2424
     25  private static final long serialVersionUID = -6837073336175123503L;
     26
     27  /** Max area to be downloaded */
    2528  public static final double MAX_AREA = Main.pref.getDouble(
    2629      "mapillary.max-download-area", 0.020);
    2730
     31  /**
     32   * Main constructor.
     33   */
    2834  public MapillaryDownloadViewAction() {
    2935    super(tr("Download Mapillary images in current view"), new ImageProvider(
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java

    r31380 r31386  
    2828/**
    2929 * Action that launches a MapillaryExportDialog and lets you export the images.
    30  * 
     30 *
    3131 * @author nokutu
    3232 *
     
    3434public class MapillaryExportAction extends JosmAction {
    3535
    36   MapillaryExportDialog dialog;
     36  private static final long serialVersionUID = 6009490043174837948L;
    3737
     38  private MapillaryExportDialog dialog;
     39
     40  /**
     41   * Main constructor.
     42   */
    3843  public MapillaryExportAction() {
    3944    super(tr("Export pictures"), new ImageProvider("icon24.png"),
     
    100105  /**
    101106   * Exports the given images from the database.
     107   *
     108   * @param images
     109   *          The set of images to be exported.
    102110   */
    103111  public void export(List<MapillaryAbstractImage> images) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java

    r31379 r31386  
    3636public class MapillaryImportAction extends JosmAction {
    3737
    38   public JFileChooser chooser;
     38  private static final long serialVersionUID = 4995924098228081806L;
     39
     40  private JFileChooser chooser;
    3941
    4042  /**
     
    4345  private int noTagsPics = 0;
    4446
     47  /**
     48   * Main constructor.
     49   */
    4550  public MapillaryImportAction() {
    4651    super(tr("Import pictures"), new ImageProvider("icon24.png"),
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java

    r31379 r31386  
    3232import org.openstreetmap.josm.tools.Shortcut;
    3333
     34/**
     35 * Imports a set of images and puts them in a single {@link MapillarySequence}.
     36 *
     37 * @author nokutu
     38 *
     39 */
    3440public class MapillaryImportIntoSequenceAction extends JosmAction {
    3541
    36   public JFileChooser chooser;
     42  private static final long serialVersionUID = -9190217809965894878L;
     43
     44  private JFileChooser chooser;
    3745
    3846  private LinkedList<MapillaryImportedImage> images;
     
    129137      final TiffField datetimeOriginal = jpegMetadata
    130138          .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
    131       if (lat_ref == null || lat == null || lon == null || lon_ref == null
    132           || datetimeOriginal == null)
    133         throw new IllegalArgumentException(
    134             "The picture has not correct EXIF tags");
     139      if (lat_ref == null || lat == null || lon == null || lon_ref == null || datetimeOriginal == null)
     140        throw new IllegalArgumentException("The picture has not correct EXIF tags");
    135141
    136142      double latValue = 0;
     
    155161  }
    156162
     163  /**
     164   * Joins all the images in a unique {@link MapillarySequence}.
     165   */
    157166  public void joinImages() {
    158167    Collections.sort(images, new MapillaryEpochComparator());
     
    164173  }
    165174
     175  /**
     176   * Comparator that comperes two {@link MapillaryAbstractImage} objects
     177   * depending on the time they were taken.
     178   *
     179   * @author nokutu
     180   *
     181   */
    166182  public class MapillaryEpochComparator implements
    167183      Comparator<MapillaryAbstractImage> {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java

    r31357 r31386  
    1313import org.openstreetmap.josm.tools.Shortcut;
    1414
     15/**
     16 * Changes the mode of the Layer, from Select mode to Join mode and viceversa.
     17 *
     18 * @author nokutu
     19 *
     20 */
    1521public class MapillaryJoinAction extends JosmAction {
    1622
     23  private static final long serialVersionUID = -7082300908202843706L;
     24
     25  /**
     26   * Main constructor.
     27   */
    1728  public MapillaryJoinAction() {
    1829    super(tr("Join mode"), new ImageProvider("icon24.png"),
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java

    r31350 r31386  
    1717/**
    1818 * Zooms to the currently selected image.
    19  * 
     19 *
    2020 * @author nokutu
    2121 *
     
    2424    MapillaryDataListener {
    2525
     26  private static final long serialVersionUID = -6050566219765623059L;
     27
     28  /**
     29   * Main constructor.
     30   */
    2631  public MapillaryZoomAction() {
    2732    super(tr("Zoom to selected image"), new ImageProvider("icon24.png"),
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java

    r31350 r31386  
    1010import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
    1111
     12/**
     13 * Sotres the
     14 *
     15 * @author nokutu
     16 *
     17 */
    1218public class MapillaryCache extends
    1319    JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> {
     
    1622  private volatile String key;
    1723
     24  /**
     25   * Types of images.
     26   *
     27   * @author nokutu
     28   */
    1829  public static enum Type {
    1930    FULL_IMAGE, THUMBNAIL
    2031  }
    2132
     33  /**
     34   * Main constructor.
     35   *
     36   * @param key
     37   * @param type
     38   */
    2239  public MapillaryCache(String key, Type type) {
    2340    super(MapillaryPlugin.CACHE, 50000, 50000, new HashMap<String, String>());
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/HyperlinkLabel.java

    r31352 r31386  
    1919import java.awt.Desktop;
    2020
     21/**
     22 * JLabel that acts as a hyperlink.
     23 *
     24 * @author nokutu
     25 *
     26 */
    2127public class HyperlinkLabel extends JLabel implements ActionListener {
    2228
Note: See TracChangeset for help on using the changeset viewer.