Changeset 31272 in osm for applications/editors/josm


Ignore:
Timestamp:
2015-06-17T00:17:40+02:00 (9 years ago)
Author:
nokutu
Message:

Fixed bug when downloading signals and some cache errors

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

Legend:

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

    r31261 r31272  
    4141                                JsonArray rects = jsonarr.getJsonObject(i)
    4242                                                .getJsonArray("rects");
    43                                 if (rects == null)
    44                                         return;
     43                                JsonArray rectversions = jsonarr.getJsonObject(i).getJsonArray(
     44                                                "rectversions");
    4545                                String key = jsonarr.getJsonObject(i).getString("key");
    46                                 for (int j = 0; j < rects.size(); j++) {
    47                                         JsonObject data = rects.getJsonObject(j);
    48                                         for (MapillaryAbstractImage image : MapillaryData
    49                                                         .getInstance().getImages()) {
    50                                                 if (image instanceof MapillaryImage) {
    51                                                         if (((MapillaryImage) image).getKey().equals(key)) {
    52                                                                 if (((MapillaryImage) image).getKey().equals(
    53                                                                                 key)) {
     46                                if (rectversions != null) {
     47                                        for (int j = 0; j < rectversions.size(); j++) {
     48                                                rects = rectversions.getJsonObject(j).getJsonArray("rects");
     49                                                for (int k = 0; k < rects.size(); k++) {
     50                                                        JsonObject data = rects.getJsonObject(j);
     51                                                        for (MapillaryAbstractImage image : MapillaryData
     52                                                                        .getInstance().getImages())
     53                                                                if (image instanceof MapillaryImage
     54                                                                                && ((MapillaryImage) image).getKey()
     55                                                                                                .equals(key))
    5456                                                                        ((MapillaryImage) image).addSignal(data
    5557                                                                                        .getString("type"));
    56                                                                 }
    57                                                         }
    5858                                                }
     59                                        }
     60                                }
     61
     62                                // Just one signal on the picture
     63                                else if (rects != null) {
     64                                        for (int j = 0; j < rects.size(); j++) {
     65                                                JsonObject data = rects.getJsonObject(j);
     66                                                for (MapillaryAbstractImage image : MapillaryData
     67                                                                .getInstance().getImages())
     68                                                        if (image instanceof MapillaryImage
     69                                                                        && ((MapillaryImage) image).getKey()
     70                                                                                        .equals(key))
     71                                                                ((MapillaryImage) image).addSignal(data
     72                                                                                .getString("type"));
    5973                                        }
    6074                                }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java

    r31268 r31272  
    361361                                }
    362362                        });
    363                 } else if (data != null) {
     363                } else if (data != null && result == LoadResult.SUCCESS) {
    364364                        try {
    365365                                BufferedImage img = ImageIO.read(new ByteArrayInputStream(data
Note: See TracChangeset for help on using the changeset viewer.