Ignore:
Timestamp:
2016-01-05T16:54:55+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Fix some code style issues

Mainly:

  • Avoid if (x != y) ..; else ..;
  • Avoid using for/while statements without curly braces
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

    r31909 r31951  
    139139   */
    140140  public void addMultiSelectedImage(Set<MapillaryAbstractImage> images) {
    141     for (MapillaryAbstractImage image : images)
     141    for (MapillaryAbstractImage image : images) {
    142142      if (!this.multiSelectedImages.contains(image)) {
    143         if (this.getSelectedImage() != null)
     143        if (this.getSelectedImage() == null) {
     144          this.setSelectedImage(image);
     145        } else {
    144146          this.multiSelectedImages.add(image);
    145         else
    146           this.setSelectedImage(image);
     147        }
    147148      }
     149    }
    148150    Main.map.mapView.repaint();
    149151  }
     
    237239    if (this.listeners.isEmpty())
    238240      return;
    239     for (MapillaryDataListener lis : this.listeners)
     241    for (MapillaryDataListener lis : this.listeners) {
    240242      if (lis != null)
    241243        lis.imagesAdded();
     244    }
    242245  }
    243246
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java

    r31840 r31951  
    239239  public void setVisible(boolean visible) {
    240240    super.setVisible(visible);
    241     for (MapillaryAbstractImage img : this.data.getImages())
     241    for (MapillaryAbstractImage img : this.data.getImages()) {
    242242      img.setVisible(visible);
     243    }
    243244    MapillaryFilterDialog.getInstance().refresh();
    244245  }
     
    347348        MapillaryImage image = (MapillaryImage) imageAbs;
    348349        ImageIcon icon;
    349         if (!this.data.getMultiSelectedImages().contains(image))
    350           icon = MapillaryPlugin.MAP_ICON;
    351         else
    352           icon = MapillaryPlugin.MAP_ICON_SELECTED;
     350        icon = this.data.getMultiSelectedImages().contains(image) ? MapillaryPlugin.MAP_ICON_SELECTED : MapillaryPlugin.MAP_ICON;
    353351        draw(g, image, icon, p);
    354352        if (!image.getSigns().isEmpty()) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java

    r31815 r31951  
    7777    if (this.position != -1) {
    7878      boolean equalSets = true;
    79       for (MapillaryAbstractImage img : this.commandList.get(this.position).images)
    80         if (!command.images.contains(img))
    81           equalSets = false;
    82       for (MapillaryAbstractImage img : command.images)
    83         if (!this.commandList.get(this.position).images.contains(img))
    84           equalSets = false;
    85       if (equalSets
    86           && this.commandList.get(this.position).getClass() == command
    87               .getClass()) {
     79      for (MapillaryAbstractImage img : this.commandList.get(this.position).images) {
     80        equalSets = command.images.contains(img) && equalSets;
     81      }
     82      for (MapillaryAbstractImage img : command.images) {
     83        equalSets = this.commandList.get(this.position).images.contains(img) && equalSets;
     84      }
     85      if (equalSets && this.commandList.get(this.position).getClass() == command.getClass()) {
    8886        this.commandList.get(this.position).sum(command);
    8987        fireRecordChanged();
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java

    r31909 r31951  
    182182
    183183  protected static void tooBigErrorDialog() {
    184     if (!SwingUtilities.isEventDispatchThread()) {
     184    if (SwingUtilities.isEventDispatchThread()) {
     185      MapillaryLayer.getInstance().tempSemiautomatic = true;
     186      MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getDownloadViewMenu(), true);
     187      JOptionPane
     188          .showMessageDialog(
     189              Main.parent,
     190              tr("The downloaded OSM area is too big. Download mode has been changed to semiautomatic until the layer is restarted."));
     191    } else {
    185192      SwingUtilities.invokeLater(new Runnable() {
    186193        @Override
     
    189196        }
    190197      });
    191     } else {
    192       MapillaryLayer.getInstance().tempSemiautomatic = true;
    193       MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getDownloadViewMenu(), true);
    194       JOptionPane
    195           .showMessageDialog(
    196               Main.parent,
    197               tr("The downloaded OSM area is too big. Download mode has been changed to semiautomatic until the layer is restarted."));
    198198    }
    199199  }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java

    r31843 r31951  
    7676    while (!this.downloadExecutor.isShutdown()) {
    7777      this.downloadExecutor.execute(new MapillarySequenceDownloadThread(this.downloadExecutor, bounds, page));
    78       while (this.downloadExecutor.getQueue().remainingCapacity() == 0)
     78      while (this.downloadExecutor.getQueue().remainingCapacity() == 0) {
    7979        Thread.sleep(500);
     80      }
    8081      page++;
    8182    }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryTrafficSignDownloadThread.java

    r31843 r31951  
    6666            for (int k = 0; k < rects.size(); k++) {
    6767              JsonObject data = rects.getJsonObject(k);
    68               for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getImages())
     68              for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getImages()) {
    6969                if (image instanceof MapillaryImage && ((MapillaryImage) image).getKey().equals(key))
    7070                  ((MapillaryImage) image).addSign(data.getString("type"));
     71              }
    7172            }
    7273          }
Note: See TracChangeset for help on using the changeset viewer.