Changeset 32373 in osm


Ignore:
Timestamp:
2016-06-23T01:17:34+02:00 (8 years ago)
Author:
floscher
Message:

[mapillary] Add braces to for and while loops as well as if…else statements

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

Legend:

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

    r32067 r32373  
    126126  public void addMultiSelectedImage(MapillaryAbstractImage image) {
    127127    if (!this.multiSelectedImages.contains(image)) {
    128       if (this.getSelectedImage() == null)
     128      if (this.getSelectedImage() == null) {
    129129        this.setSelectedImage(image);
    130       else
     130      } else {
    131131        this.multiSelectedImages.add(image);
     132      }
    132133    }
    133134    if (Main.main != null)
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java

    r32064 r32373  
    6666   */
    6767  public synchronized void add(List<MapillaryAbstractImage> images) {
    68     for (MapillaryAbstractImage image : images)
     68    for (MapillaryAbstractImage image : images) {
    6969      add(image);
     70    }
    7071  }
    7172
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java

    r31987 r32373  
    7676      } else if (this.dialog.group.isSelected(this.dialog.sequence.getModel())) {
    7777        Set<MapillaryAbstractImage> images = new ConcurrentSkipListSet<>();
    78         for (MapillaryAbstractImage image : MapillaryLayer.getInstance()
    79             .getData().getMultiSelectedImages())
     78        for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getMultiSelectedImages()) {
    8079          if (image instanceof MapillaryImage) {
    81             if (!images.contains(image))
     80            if (!images.contains(image)) {
    8281              images.addAll(((MapillaryImage) image).getSequence().getImages());
     82            }
    8383          } else {
    8484            images.add(image);
    8585          }
     86        }
    8687        export(images);
    8788      } else if (this.dialog.group.isSelected(this.dialog.selected.getModel())) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java

    r31787 r32373  
    3737  @Override
    3838  public void actionPerformed(ActionEvent arg0) {
    39     if (MapillaryLayer.getInstance().mode instanceof SelectMode)
     39    if (MapillaryLayer.getInstance().mode instanceof SelectMode) {
    4040      MapillaryLayer.getInstance().setMode(new JoinMode());
    41     else
     41    } else {
    4242      MapillaryLayer.getInstance().setMode(new SelectMode());
     43    }
    4344  }
    4445}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryUploadAction.java

    r31839 r32373  
    6969
    7070  @Override
    71   public void selectedImageChanged(MapillaryAbstractImage oldImage,
    72       MapillaryAbstractImage newImage) {
    73     if (oldImage == null && newImage != null)
     71  public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) {
     72    if (oldImage == null && newImage != null) {
    7473      MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getUploadMenu(), true);
    75     else if (oldImage != null && newImage == null)
     74    } else if (oldImage != null && newImage == null) {
    7675      MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getUploadMenu(), false);
     76    }
    7777  }
    7878}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java

    r31974 r32373  
    9191
    9292  private void fireWalkStarted() {
    93     if (this.listeners.isEmpty())
     93    if (this.listeners.isEmpty()) {
    9494      return;
    95     for (WalkListener lis : this.listeners)
     95    }
     96    for (WalkListener lis : this.listeners) {
    9697      lis.walkStarted(this.thread);
     98    }
    9799  }
    98100
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java

    r31918 r32373  
    4747
    4848  @Override
    49   public void selectedImageChanged(MapillaryAbstractImage oldImage,
    50       MapillaryAbstractImage newImage) {
    51     if (oldImage == null && newImage != null)
     49  public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) {
     50    if (oldImage == null && newImage != null) {
    5251      MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getZoomMenu(), true);
    53     else if (oldImage != null && newImage == null)
     52    } else if (oldImage != null && newImage == null) {
    5453      MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getZoomMenu(), false);
     54    }
    5555  }
    5656
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java

    r31974 r32373  
    8787      this.sequence.setEnabled(false);
    8888    }
    89     if (MapillaryLayer.getInstance().getData().getMultiSelectedImages()
    90         .isEmpty()) {
     89    if (MapillaryLayer.getInstance().getData().getMultiSelectedImages().isEmpty()) {
    9190      this.selected.setEnabled(false);
    9291    }
    9392    this.rewrite.setEnabled(false);
    94     for (MapillaryAbstractImage img : MapillaryLayer.getInstance().getData()
    95         .getImages())
    96       if (img instanceof MapillaryImportedImage)
     93    for (MapillaryAbstractImage img : MapillaryLayer.getInstance().getData().getImages()) {
     94      if (img instanceof MapillaryImportedImage) {
    9795        this.rewrite.setEnabled(true);
     96      }
     97    }
    9898
    9999    this.path = new JLabel(tr("Select a folder"));
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java

    r31974 r32373  
    145145    int position = MapillaryRecord.getInstance().position;
    146146    ArrayList<MapillaryCommand> undoCommands = new ArrayList<>();
    147     if (position >= 0)
     147    if (position >= 0) {
    148148      undoCommands = new ArrayList<>(commands.subList(0, position + 1));
    149     else
     149    } else {
    150150      this.undoButton.setEnabled(false);
     151    }
    151152    ArrayList<MapillaryCommand> redoCommands = new ArrayList<>();
    152     if (!commands.isEmpty() && position + 1 < commands.size())
     153    if (!commands.isEmpty() && position + 1 < commands.size()) {
    153154      redoCommands = new ArrayList<>(commands.subList(position + 1, commands.size()));
    154     else
     155    } else {
    155156      this.redoButton.setEnabled(false);
     157    }
    156158
    157159    DefaultMutableTreeNode redoRoot = new DefaultMutableTreeNode();
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java

    r31840 r32373  
    143143        visibleRect = MapillaryImageDisplay.this.visibleRect;
    144144      }
    145       if (image == null)
    146         return;
     145      if (image == null) {
     146        return;
     147      }
    147148      if (e.getButton() == OPTION_BUTTON) {
    148         if (!MapillaryImageDisplay.this.visibleRect.equals(new Rectangle(0, 0,
    149             image.getWidth(null), image.getHeight(null))))
     149        if (!MapillaryImageDisplay.this.visibleRect.equals(new Rectangle(0, 0, image.getWidth(null), image.getHeight(null)))) {
    150150          // Zooms to 1:1
    151151          MapillaryImageDisplay.this.visibleRect = new Rectangle(0, 0,
    152152              image.getWidth(null), image.getHeight(null));
    153         else
     153        } else {
    154154          // Zooms to best fit.
    155           MapillaryImageDisplay.this.visibleRect = new Rectangle(0,
    156               (image.getHeight(null) - (image.getWidth(null) * getHeight())
    157                   / getWidth()) / 2, image.getWidth(null),
    158               (image.getWidth(null) * getHeight()) / getWidth());
     155          MapillaryImageDisplay.this.visibleRect = new Rectangle(
     156              0,
     157              (image.getHeight(null) - (image.getWidth(null) * getHeight()) / getWidth()) / 2,
     158              image.getWidth(null),
     159              (image.getWidth(null) * getHeight()) / getWidth()
     160          );
     161        }
    159162        MapillaryImageDisplay.this.repaint();
    160163        return;
    161       } else if (e.getButton() != DRAG_BUTTON)
    162         return;
     164      } else if (e.getButton() != DRAG_BUTTON) {
     165        return;
     166      }
    163167      // Calculate the translation to set the clicked point the center of
    164168      // the view.
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandImport.java

    r31909 r32373  
    3737  @Override
    3838  public void undo() {
    39     for (MapillaryAbstractImage img : this.images)
     39    for (MapillaryAbstractImage img : this.images) {
    4040      MapillaryLayer.getInstance().getData().getImages().remove(img);
    41     if (Main.main != null)
     41    }
     42    if (Main.main != null) {
    4243      MapillaryData.dataUpdated();
     44    }
    4345  }
    4446
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java

    r32372 r32373  
    7878    String downloadMode = Main.pref.get("mapillary.download-mode", MODES.Automatic.toString());
    7979    boolean isTempSemiautomatic = MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().tempSemiautomatic;
    80     if (MODES.Semiautomatic.toString().equals(downloadMode) || isTempSemiautomatic)
     80    if (MODES.Semiautomatic.toString().equals(downloadMode) || isTempSemiautomatic) {
    8181      return MODES.Semiautomatic;
    82     else if (MODES.Manual.toString().equals(downloadMode))
     82    } else if (MODES.Manual.toString().equals(downloadMode)) {
    8383      return MODES.Manual;
    84     else if (MODES.Automatic.toString().equals(downloadMode))
     84    } else if (MODES.Automatic.toString().equals(downloadMode)) {
    8585      return MODES.Automatic;
    86     else
     86    } else {
    8787      throw new IllegalStateException();
     88    }
    8889  }
    8990
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportManager.java

    r31882 r32373  
    129129        // If the queue is full, waits for it to have more space
    130130        // available before executing anything else.
    131         while (this.ex.getQueue().remainingCapacity() == 0)
     131        while (this.ex.getQueue().remainingCapacity() == 0) {
    132132          Thread.sleep(100);
     133        }
    133134      } catch (Exception e) {
    134135        Main.error(e);
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java

    r31842 r32373  
    127127
    128128        exifDirectory.removeField(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
    129         if (mimg instanceof MapillaryImportedImage)
     129        if (mimg instanceof MapillaryImportedImage) {
    130130          exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL,
    131131              ((MapillaryImportedImage) mimg).getDate("yyyy/MM/dd HH:mm:ss"));
    132         else if (mimg instanceof MapillaryImage)
     132        } else if (mimg instanceof MapillaryImage) {
    133133          exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL,
    134134              ((MapillaryImage) mimg).getDate("yyyy/MM/dd HH/mm/ss"));
     135        }
    135136        outputSet.setGPSInDegrees(mimg.getLatLon().lon(), mimg.getLatLon().lat());
    136137        OutputStream os = new BufferedOutputStream(new FileOutputStream(finalPath + ".jpg"));
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java

    r32329 r32373  
    4949  public void mousePressed(MouseEvent e) {
    5050    this.lastButton = e.getButton();
    51     if (e.getButton() != MouseEvent.BUTTON1)
    52       return;
     51    if (e.getButton() != MouseEvent.BUTTON1) {
     52      return;
     53    }
    5354    MapillaryAbstractImage closest = getClosest(e.getPoint());
    5455    if (!(Main.getLayerManager().getActiveLayer() instanceof MapillaryLayer)
     
    5758      this.data.setSelectedImage(closest);
    5859      return;
    59     } else if (Main.getLayerManager().getActiveLayer() != MapillaryLayer
    60             .getInstance())
    61       return;
     60    } else if (Main.getLayerManager().getActiveLayer() != MapillaryLayer.getInstance()) {
     61      return;
     62    }
    6263    // Double click
    63     if (e.getClickCount() == 2 && this.data.getSelectedImage() != null
    64             && closest != null) {
     64    if (e.getClickCount() == 2 && this.data.getSelectedImage() != null && closest != null) {
    6565      for (MapillaryAbstractImage img : closest.getSequence().getImages()) {
    6666        this.data.addMultiSelectedImage(img);
     
    7070    this.lastClicked = this.closest;
    7171    this.closest = closest;
    72     if (closest != null && this.data.getMultiSelectedImages().contains(closest))
    73       return;
     72    if (closest != null && this.data.getMultiSelectedImages().contains(closest)) {
     73      return;
     74    }
    7475    // ctrl+click
    75     if (e.getModifiers() == (InputEvent.BUTTON1_MASK | InputEvent.CTRL_MASK)
    76             && closest != null)
     76    if (e.getModifiers() == (InputEvent.BUTTON1_MASK | InputEvent.CTRL_MASK) && closest != null) {
    7777      this.data.addMultiSelectedImage(closest);
    7878      // shift + click
    79     else if (e.getModifiers() == (InputEvent.BUTTON1_MASK | InputEvent.SHIFT_MASK)
    80             && this.lastClicked instanceof MapillaryImage) {
     79    } else if (
     80        e.getModifiers() == (InputEvent.BUTTON1_MASK | InputEvent.SHIFT_MASK)
     81        && this.lastClicked instanceof MapillaryImage
     82    ) {
    8183      if (this.closest != null && this.lastClicked != null
    8284              && this.closest.getSequence() == (this.lastClicked).getSequence()) {
    8385        int i = this.closest.getSequence().getImages().indexOf(this.closest);
    84         int j = this.lastClicked.getSequence().getImages()
    85                 .indexOf(this.lastClicked);
    86         if (i < j)
    87           this.data.addMultiSelectedImage(new ConcurrentSkipListSet<>(this.closest.getSequence()
    88                   .getImages().subList(i, j + 1)));
    89         else
    90           this.data.addMultiSelectedImage(new ConcurrentSkipListSet<>(this.closest.getSequence()
    91                   .getImages().subList(j, i + 1)));
     86        int j = this.lastClicked.getSequence().getImages().indexOf(this.lastClicked);
     87        this.data.addMultiSelectedImage(
     88            i < j
     89            ? new ConcurrentSkipListSet<>(this.closest.getSequence().getImages().subList(i, j + 1))
     90            : new ConcurrentSkipListSet<>(this.closest.getSequence().getImages().subList(j, i + 1))
     91        );
    9292      }
    9393      // click
    94     } else
     94    } else {
    9595      this.data.setSelectedImage(closest);
     96    }
    9697  }
    9798
     
    102103    }
    103104
    104     if (!Main.pref.getBoolean("mapillary.developer"))
     105    if (!Main.pref.getBoolean("mapillary.developer")) {
    105106      for (MapillaryAbstractImage img : this.data.getMultiSelectedImages()) {
    106         if (img instanceof MapillaryImage)
     107        if (img instanceof MapillaryImage) {
    107108          return;
    108       }
     109        }
     110      }
     111    }
    109112    if (this.data.getSelectedImage() != null) {
    110113      if (this.lastButton == MouseEvent.BUTTON1 && !e.isShiftDown()) {
Note: See TracChangeset for help on using the changeset viewer.