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

More comments and made many methods and properties private.

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

Legend:

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

    r31387 r31389  
    2424/**
    2525 * GUI for exporting images.
    26  * 
     26 *
    2727 * @author nokutu
    2828 *
     
    3838  /** Button to export all images belonging to the selected {@link MapillaryImage} objects. */
    3939  public JRadioButton selected;
    40   /** Button to rewrite all imported images */
     40  /** Button to rewrite all imported images. */
    4141  public JRadioButton rewrite;
     42  /** Group of button containing all the options. */
    4243  public ButtonGroup group;
    4344  private JButton choose;
    4445  private JLabel path;
     46  /** File chooser. */
    4547  public JFileChooser chooser;
    4648  protected String exportDirectory;
    4749  private JButton ok;
    4850
     51  /**
     52   * Main constructor.
     53   */
    4954  public MapillaryExportDialog(JButton ok) {
    5055    this.ok = ok;
     
    120125  }
    121126
     127  /**
     128   * Enables/disables some parts of the panel depending if the rewrite button is
     129   * active.
     130   *
     131   * @author nokutu
     132   *
     133   */
    122134  public class RewriteButtonAction extends AbstractAction {
    123135
     
    126138    private MapillaryExportDialog dlg;
    127139
     140    /**
     141     * Main constructor.
     142     *
     143     * @param dlg
     144     *          Parent dialog.
     145     */
    128146    public RewriteButtonAction(MapillaryExportDialog dlg) {
    129147      this.dlg = dlg;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterChooseSigns.java

    r31350 r31389  
    44
    55import java.awt.Dimension;
    6 import java.awt.event.ActionEvent;
    7 import java.awt.event.ActionListener;
    86
    97import javax.swing.JCheckBox;
     
    1311import org.openstreetmap.josm.tools.ImageProvider;
    1412
    15 public class MapillaryFilterChooseSigns extends JPanel implements
    16     ActionListener {
     13/**
     14 * UI to choose which signs must be displayed.
     15 *
     16 * @author nokutu
     17 *
     18 */
     19public class MapillaryFilterChooseSigns extends JPanel {
    1720
    18   public final JCheckBox maxspeed = new JCheckBox();
     21  private static final long serialVersionUID = -3513805549022406720L;
     22
     23  /** Max speed signs */
     24  public final JCheckBox maxSpeed = new JCheckBox();
     25  /** Stop signs */
    1926  public final JCheckBox stop = new JCheckBox();
     27  /** Give way signs */
    2028  public final JCheckBox giveWay = new JCheckBox();
     29  /** Roundabout sings */
    2130  public final JCheckBox roundabout = new JCheckBox();
     31  /** Forbidden access or forbidden direction signs */
    2232  public final JCheckBox access = new JCheckBox();
     33  /** Intersection danger signs */
    2334  public final JCheckBox intersection = new JCheckBox();
     35  /** Mandatory direction signs */
    2436  public final JCheckBox direction = new JCheckBox();
     37  /** Uneven pavement signs */
    2538  public final JCheckBox uneven = new JCheckBox();
     39  /** No parking signs */
    2640  public final JCheckBox noParking = new JCheckBox();
     41  /** Forbidden overtaking signs */
    2742  public final JCheckBox noOvertaking = new JCheckBox();
     43  /** Pedestrian crossing signs */
    2844  public final JCheckBox crossing = new JCheckBox();
     45  /** Forbidden turn signs */
    2946  public final JCheckBox noTurn = new JCheckBox();
    3047
    3148  private static MapillaryFilterChooseSigns INSTANCE;
    3249
    33   public MapillaryFilterChooseSigns() {
    34     maxspeed.setSelected(true);
     50  private MapillaryFilterChooseSigns() {
     51    maxSpeed.setSelected(true);
    3552    stop.setSelected(true);
    3653    giveWay.setSelected(true);
     
    5067    maxspeedLabel.setIcon(new ImageProvider("signs/speed.png").get());
    5168    maxspeedPanel.add(maxspeedLabel);
    52     maxspeedPanel.add(maxspeed);
     69    maxspeedPanel.add(maxSpeed);
    5370    this.add(maxspeedPanel);
    5471
     
    148165  }
    149166
     167  /**
     168   * Return the unique instance of the class.
     169   *
     170   * @return THe unique instance of the class.
     171   */
    150172  public static MapillaryFilterChooseSigns getInstance() {
    151173    if (INSTANCE == null)
     
    153175    return INSTANCE;
    154176  }
    155 
    156   @Override
    157   public void actionPerformed(ActionEvent arg0) {
    158     // TODO Auto-generated method stub
    159 
    160   }
    161 
    162177}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java

    r31350 r31389  
    3232/**
    3333 * ToggleDialog that lets you filter the images that are being shown.
    34  * 
     34 *
    3535 * @author nokutu
    3636 * @see MapillaryFilterChooseSigns
     
    4040    MapillaryDataListener {
    4141
    42   public static MapillaryFilterDialog INSTANCE;
     42  private static final long serialVersionUID = -4192029663670922103L;
     43
     44  private static MapillaryFilterDialog INSTANCE;
    4345
    4446  private final static String[] TIME_LIST = { tr("All time"), tr("This year"),
     
    5052  private final JPanel panel = new JPanel(new GridLayout(ROWS, COLUMNS));
    5153
    52   public final JCheckBox imported = new JCheckBox("Imported images");
    53   public final JCheckBox downloaded = new JCheckBox(
     54  private final JCheckBox imported = new JCheckBox("Imported images");
     55  private final JCheckBox downloaded = new JCheckBox(
    5456      new downloadCheckBoxAction());
    55   public final JCheckBox onlySigns = new JCheckBox(new OnlySignsAction());
    56   public final JComboBox<String> time;
    57   public final JTextField user;
    58 
    59   public final SideButton updateButton = new SideButton(new UpdateAction());
    60   public final SideButton resetButton = new SideButton(new ResetAction());
    61   public final JButton signChooser = new JButton(new SignChooserAction());
    62 
    63   public final MapillaryFilterChooseSigns signFilter = MapillaryFilterChooseSigns
     57  private final JCheckBox onlySigns = new JCheckBox(new OnlySignsAction());
     58  private final JComboBox<String> time;
     59  private final JTextField user;
     60
     61  private final SideButton updateButton = new SideButton(new UpdateAction());
     62  private final SideButton resetButton = new SideButton(new ResetAction());
     63  private final JButton signChooser = new JButton(new SignChooserAction());
     64
     65  private final MapillaryFilterChooseSigns signFilter = MapillaryFilterChooseSigns
    6466      .getInstance();
    6567
     
    7476      "prohibitory_noturn" };
    7577  /** The the {@link JCheckBox} where the respective tag should be searched */
    76   private final JCheckBox[] SIGN_CHECKBOXES = { signFilter.maxspeed,
     78  private final JCheckBox[] SIGN_CHECKBOXES = { signFilter.maxSpeed,
    7779      signFilter.stop, signFilter.giveWay, signFilter.roundabout,
    7880      signFilter.access, signFilter.access, signFilter.intersection,
     
    8183      signFilter.crossing, signFilter.noTurn, signFilter.noTurn };
    8284
    83   public MapillaryFilterDialog() {
     85  private MapillaryFilterDialog() {
    8486    super(tr("Mapillary filter"), "mapillaryfilter.png",
    8587        tr("Open Mapillary filter dialog"), Shortcut.registerShortcut(
     
    119121  }
    120122
     123  /**
     124   * Returns the unique instance of the class.
     125   *
     126   * @return THe unique instance of the class.
     127   */
    121128  public static MapillaryFilterDialog getInstance() {
    122129    if (INSTANCE == null)
     
    209216  /**
    210217   * Checks if the image fulfills the sign conditions.
    211    * 
     218   *
    212219   * @param img
    213220   *          The {@link MapillaryAbstractImage} object that is going to be
     
    243250  private class downloadCheckBoxAction extends AbstractAction {
    244251
     252    private static final long serialVersionUID = 4672634002899519496L;
     253
    245254    public downloadCheckBoxAction() {
    246255      putValue(NAME, tr("Downloaded images"));
     
    254263
    255264  private class UpdateAction extends AbstractAction {
     265
     266    private static final long serialVersionUID = -7417238601979689863L;
     267
    256268    public UpdateAction() {
    257269      putValue(NAME, tr("Update"));
     
    265277
    266278  private class ResetAction extends AbstractAction {
     279    /**
     280     *
     281     */
     282    private static final long serialVersionUID = 1178261778165525040L;
     283
    267284    public ResetAction() {
    268285      putValue(NAME, tr("Reset"));
     
    276293
    277294  private class OnlySignsAction extends AbstractAction {
     295
     296    private static final long serialVersionUID = -2937440338019185723L;
     297
    278298    public OnlySignsAction() {
    279299      putValue(NAME, tr("Only images with signs"));
     
    288308  /**
    289309   * Opens a new window where you can specifically filter signs.
    290    * 
     310   *
    291311   * @author nokutu
    292312   *
    293313   */
    294314  private class SignChooserAction extends AbstractAction {
     315
     316    private static final long serialVersionUID = 8706299665735930148L;
     317
    295318    public SignChooserAction() {
    296319      putValue(NAME, tr("Choose signs"));
     
    310333  }
    311334
     335  /**
     336   * Destroys the unique instance of the class.
     337   */
    312338  public static void destroyInstance() {
    313339    MapillaryFilterDialog.INSTANCE = null;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java

    r31350 r31389  
    3333 * Toggle dialog that shows you the latest {@link MapillaryCommand} done and
    3434 * allows the user to revert them.
    35  * 
     35 *
    3636 * @see MapillaryRecord
    3737 * @see MapillaryCommand
     
    4242    MapillaryRecordListener {
    4343
    44   public static MapillaryHistoryDialog INSTANCE;
     44  private static final long serialVersionUID = -3019715241209349372L;
     45
     46  private static MapillaryHistoryDialog INSTANCE;
    4547
    4648  private final DefaultTreeModel undoTreeModel = new DefaultTreeModel(
     
    5759  private SideButton redoButton;
    5860
    59   public MapillaryHistoryDialog() {
     61  private MapillaryHistoryDialog() {
    6062    super(tr("Mapillary history"), "mapillaryhistory.png",
    6163        tr("Open Mapillary history dialog"), Shortcut.registerShortcut(
     
    9294  }
    9395
     96  /**
     97   * Returns the unique instance of the class.
     98   *
     99   * @return The unique instance of the class.
     100   */
    94101  public static MapillaryHistoryDialog getInstance() {
    95102    if (INSTANCE == null)
     
    141148  private class UndoAction extends AbstractAction {
    142149
     150    private static final long serialVersionUID = -6435832206342007269L;
     151
    143152    public UndoAction() {
    144153      putValue(NAME, tr("Undo"));
     
    154163
    155164  private class RedoAction extends AbstractAction {
     165
     166    private static final long serialVersionUID = -2761935780353053512L;
     167
    156168    public RedoAction() {
    157169      putValue(NAME, tr("Redo"));
     
    167179
    168180  private static class MapillaryCellRenderer extends DefaultTreeCellRenderer {
     181
     182    private static final long serialVersionUID = -3129520241562296901L;
     183
    169184    @Override
    170185    public Component getTreeCellRendererComponent(JTree tree, Object value,
     
    177192  }
    178193
     194  /**
     195   * Destroys the unique instance of the class.
     196   */
    179197  public static void destroyInstance() {
    180198    MapillaryHistoryDialog.INSTANCE = null;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java

    r31352 r31389  
    2727 * included in a {@link MapillaryMainDialog} object.
    2828 *
    29  * @author Jorge
     29 * @author nokutu
    3030 * @see MapillaryImageDisplay
    3131 * @see MapillaryMainDialog
    3232 */
    3333public class MapillaryImageDisplay extends JComponent {
     34
     35  private static final long serialVersionUID = 3369727203329307716L;
    3436
    3537  private static final int DRAG_BUTTON = Main.pref.getInteger(
     
    5557  private Rectangle selectedRect = null;
    5658
    57   public HyperlinkLabel hyperlink;
     59  protected HyperlinkLabel hyperlink;
    5860
    5961  private class ImgDisplayMouseListener implements MouseListener,
     
    324326  }
    325327
     328  /**
     329   * Main constructor.
     330   */
    326331  public MapillaryImageDisplay() {
    327332    ImgDisplayMouseListener mouseListener = new ImgDisplayMouseListener();
     
    356361
    357362  /**
    358    * Returns the picture that is being displayerd
     363   * Returns the picture that is being displayed
    359364   *
    360    * @return
     365   * @return The picture that is being displayed.
    361366   */
    362367  public BufferedImage getImage() {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java

    r31385 r31389  
    4747    ICachedLoaderListener, MapillaryDataListener {
    4848
    49   public final static String BASE_TITLE = "Mapillary picture";
    50 
    51   public static MapillaryMainDialog INSTANCE;
    52 
    53   public volatile MapillaryAbstractImage image;
    54 
    55   public final SideButton nextButton = new SideButton(new nextPictureAction());
    56   public final SideButton previousButton = new SideButton(
     49  private static final long serialVersionUID = 6856496736429480600L;
     50
     51  private final static String BASE_TITLE = "Mapillary picture";
     52
     53  private static MapillaryMainDialog INSTANCE;
     54
     55  private volatile MapillaryAbstractImage image;
     56
     57  private final SideButton nextButton = new SideButton(new nextPictureAction());
     58  private final SideButton previousButton = new SideButton(
    5759      new previousPictureAction());
     60  /** Button used to jump to the image following the red line */
    5861  public final SideButton redButton = new SideButton(new redAction());
     62  /** Button used to jump to the image following the blue line */
    5963  public final SideButton blueButton = new SideButton(new blueAction());
    6064
    6165  private JPanel buttonsPanel;
    6266
    63   public MapillaryImageDisplay mapillaryImageDisplay;
     67  private MapillaryImageDisplay mapillaryImageDisplay;
    6468
    6569  private MapillaryCache imageCache;
    6670  private MapillaryCache thumbnailCache;
    6771
    68   public MapillaryMainDialog() {
     72  private MapillaryMainDialog() {
    6973    super(tr(BASE_TITLE), "mapillary.png", tr("Open Mapillary window"),
    7074        Shortcut.registerShortcut(tr("Mapillary dialog"),
     
    105109  }
    106110
     111  /**
     112   * Returns the unique instance of the class.
     113   *
     114   * @return The unique instance of the class.
     115   */
    107116  public static MapillaryMainDialog getInstance() {
    108117    if (INSTANCE == null)
     
    111120  }
    112121
     122  /**
     123   * Destroys the unique instance of the class.
     124   */
    113125  public static void destroyInstance() {
    114126    INSTANCE = null;
     
    258270
    259271  /**
    260    * Returns the MapillaryImage objects which is being shown.
    261    *
    262    * @return
     272   * Returns the {@link MapillaryAbstractImage} object which is being shown.
     273   *
     274   * @return The {@link MapillaryAbstractImage} object which is being shown.
    263275   */
    264276  public synchronized MapillaryAbstractImage getImage() {
     
    269281   * Action class form the next image button.
    270282   *
    271    * @author Jorge
     283   * @author nokutu
    272284   *
    273285   */
    274286  class nextPictureAction extends AbstractAction {
     287
     288    private static final long serialVersionUID = 3023827221453154340L;
     289
    275290    public nextPictureAction() {
    276291      putValue(NAME, tr("Next picture"));
     
    287302   * Action class for the previous image button.
    288303   *
    289    * @author Jorge
     304   * @author nokutu
    290305   *
    291306   */
    292307  class previousPictureAction extends AbstractAction {
     308
     309    private static final long serialVersionUID = -6420511632957956012L;
     310
    293311    public previousPictureAction() {
    294312      putValue(NAME, tr("Previous picture"));
     
    310328   */
    311329  class redAction extends AbstractAction {
     330
     331    private static final long serialVersionUID = -6480229431481386376L;
     332
    312333    public redAction() {
    313334      putValue(NAME, tr("Jump to red"));
     
    331352   */
    332353  class blueAction extends AbstractAction {
     354
     355    private static final long serialVersionUID = 6250690644594703314L;
     356
    333357    public blueAction() {
    334358      putValue(NAME, tr("Jump to blue"));
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryOAuthUI.java

    r31388 r31389  
    1919public class MapillaryOAuthUI extends JPanel {
    2020
    21   PortListener portListener;
    22   JLabel text;
     21  private static final long serialVersionUID = 5882019193626545915L;
     22
     23  private PortListener portListener;
     24  private JLabel text;
    2325
    2426  /**
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java

    r31350 r31389  
    1919import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
    2020
     21/**
     22 * Creates the preferences panel for the plugin.
     23 *
     24 * @author nokutu
     25 *
     26 */
    2127public class MapillaryPreferenceSetting implements SubPreferenceSetting {
    2228
     
    7985  }
    8086
     87  /**
     88   * Opens the {@link MapillaryoAuthUI} window and lets the user log in.
     89   *
     90   * @author nokutu
     91   *
     92   */
    8193  public class OAuthAction extends AbstractAction {
     94
     95    private static final long serialVersionUID = -3908477563072057344L;
    8296
    8397    @Override
     
    97111
    98112  private class LoginAction extends AbstractAction {
     113
     114    private static final long serialVersionUID = -7157028112711343289L;
     115
    99116    private JOptionPane pane;
    100117
     
    111128
    112129  private class CancelAction extends AbstractAction {
     130
     131    private static final long serialVersionUID = 2329066472975953270L;
     132
    113133    private JOptionPane pane;
    114134
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java

    r31358 r31389  
    1212import org.openstreetmap.josm.plugins.mapillary.MapillaryData;
    1313
     14/**
     15 * Superclass for all the mode of the {@link MapillaryLayer}
     16 *
     17 * @author nokutu
     18 * @see MapillaryLayer
     19 *
     20 */
    1421public abstract class AbstractMode extends MouseAdapter {
    1522
    1623  protected MapillaryData data = MapillaryData.getInstance();
    17  
     24
     25  /**
     26   * Cursor that should become active when this mode is activated.
     27   */
    1828  public int cursor = Cursor.DEFAULT_CURSOR;
    19 
    20   public AbstractMode() {
    21     super();
    22   }
    2329
    2430  protected MapillaryAbstractImage getClosest(Point clickPoint) {
     
    3036      imagePoint.setLocation(imagePoint.getX(), imagePoint.getY());
    3137      double dist = clickPoint.distanceSq(imagePoint);
    32       if (minDistance > dist && clickPoint.distance(imagePoint) < snapDistance && image.isVisible()) {
     38      if (minDistance > dist && clickPoint.distance(imagePoint) < snapDistance
     39          && image.isVisible()) {
    3340        minDistance = dist;
    3441        closest = image;
     
    3845  }
    3946
     47  /**
     48   * Paints whatever the mode needs.
     49   *
     50   * @param g
     51   * @param mv
     52   * @param box
     53   */
    4054  public abstract void paint(Graphics2D g, MapView mv, Bounds box);
    4155
    42 
    4356}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java

    r31358 r31389  
    1616import org.openstreetmap.josm.plugins.mapillary.MapillarySequence;
    1717
     18/**
     19 * In this mode the user can join pictures to make sequences or unjoin them.
     20 *
     21 * @author nokutu
     22 *
     23 */
    1824public class JoinMode extends AbstractMode {
    1925
    20   public MapillaryImportedImage lastClick;
    21   public MouseEvent lastPos;
    22  
     26  private MapillaryImportedImage lastClick;
     27  private MouseEvent lastPos;
     28
     29  /**
     30   * Main constructor.
     31   */
    2332  public JoinMode() {
    2433    cursor = Cursor.CROSSHAIR_CURSOR;
     
    2938    if (data.getHighlighted() == null)
    3039      return;
    31     if (lastClick == null && data.getHighlighted() instanceof MapillaryImportedImage) {
     40    if (lastClick == null
     41        && data.getHighlighted() instanceof MapillaryImportedImage) {
    3242      lastClick = (MapillaryImportedImage) data.getHighlighted();
    33     } else if (lastClick != null && data.getHighlighted() instanceof MapillaryImportedImage) {
    34       if (((data.getHighlighted().previous() == null && lastClick.next() == null) || (data.getHighlighted().next() == null && lastClick
    35           .previous() == null))
    36           && (data.getHighlighted().getSequence() != lastClick.getSequence() || lastClick.getSequence() == null)) {
     43    } else if (lastClick != null
     44        && data.getHighlighted() instanceof MapillaryImportedImage) {
     45      if (((data.getHighlighted().previous() == null && lastClick.next() == null) || (data
     46          .getHighlighted().next() == null && lastClick.previous() == null))
     47          && (data.getHighlighted().getSequence() != lastClick.getSequence() || lastClick
     48              .getSequence() == null)) {
    3749        join(lastClick, (MapillaryImportedImage) data.getHighlighted());
    38       } else if (lastClick.next() == data.getHighlighted() || lastClick.previous() == data.getHighlighted())
     50      } else if (lastClick.next() == data.getHighlighted()
     51          || lastClick.previous() == data.getHighlighted())
    3952        unjoin(lastClick, (MapillaryImportedImage) data.getHighlighted());
    4053      lastClick = null;
     
    93106    }
    94107
    95     ArrayList<MapillaryAbstractImage> firstHalf = new ArrayList<>(img1.getSequence().getImages()
     108    ArrayList<MapillaryAbstractImage> firstHalf = new ArrayList<>(img1
     109        .getSequence().getImages()
    96110        .subList(0, img1.getSequence().getImages().indexOf(img2)));
    97     ArrayList<MapillaryAbstractImage> secondHalf = new ArrayList<>(img1.getSequence().getImages()
    98         .subList(img1.getSequence().getImages().indexOf(img2), img1.getSequence().getImages().size()));
     111    ArrayList<MapillaryAbstractImage> secondHalf = new ArrayList<>(img1
     112        .getSequence()
     113        .getImages()
     114        .subList(img1.getSequence().getImages().indexOf(img2),
     115            img1.getSequence().getImages().size()));
    99116
    100117    MapillarySequence seq1 = new MapillarySequence();
     
    110127    }
    111128  }
    112  
     129
    113130  @Override
    114131  public String toString() {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java

    r31385 r31389  
    3838  private boolean imageHighlighted = false;
    3939
     40  /**
     41   * Main constructor.
     42   */
    4043  public SelectMode() {
    4144    record = MapillaryRecord.getInstance();
Note: See TracChangeset for help on using the changeset viewer.