Ignore:
Timestamp:
2015-08-06T16:55:05+02:00 (10 years ago)
Author:
nokutu
Message:

Moved bounds ArrayList from MapillaryLayer to MapillaryData.

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

Legend:

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

    r31457 r31459  
    22
    33import org.openstreetmap.josm.Main;
     4import org.openstreetmap.josm.data.Bounds;
    45import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils;
    56import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog;
     
    2627
    2728  private CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>();
     29
     30  /** The bounds of the areas for which the pictures have been downloaded. */
     31  public CopyOnWriteArrayList<Bounds> bounds;
    2832
    2933  /**
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java

    r31457 r31459  
    7474  public boolean TEMP_SEMIAUTOMATIC = false;
    7575
    76   /** Unique instance of the class */
     76  /** Unique instance of the class. */
    7777  public static MapillaryLayer INSTANCE;
    78   /** The image pointed by the blue line */
     78  /** The image pointed by the blue line. */
    7979  public static MapillaryImage BLUE;
    80   /** The image pointed by the red line */
     80  /** The image pointed by the red line. */
    8181  public static MapillaryImage RED;
    8282
    83   /** {@link MapillaryData} object that stores the database */
     83  /** {@link MapillaryData} object that stores the database. */
    8484  private final MapillaryData data;
    8585
    86   /** The bounds of the areas for which the pictures have been downloaded */
    87   public CopyOnWriteArrayList<Bounds> bounds;
    88 
    89   /** Mode of the layer */
     86  /** Mode of the layer. */
    9087  public AbstractMode mode;
    9188
     
    10097    super(tr("Mapillary Images"));
    10198    this.data = new MapillaryData();
    102     this.bounds = new CopyOnWriteArrayList<>();
     99    this.data.bounds = new CopyOnWriteArrayList<>();
    103100    init();
    104101  }
     
    243240   * Replies background color for downloaded areas.
    244241   *
    245    * @return background color for downloaded areas. Black by default
     242   * @return background color for downloaded areas. Black by default.
    246243   */
    247244  private static Color getBackgroundColor() {
     
    252249   * Replies background color for non-downloaded areas.
    253250   *
    254    * @return background color for non-downloaded areas. Yellow by default
     251   * @return background color for non-downloaded areas. Yellow by default.
    255252   */
    256253  private static Color getOutsideColor() {
     
    259256
    260257  /**
    261    * Initialize the hatch pattern used to paint the non-downloaded area
     258   * Initialize the hatch pattern used to paint the non-downloaded area.
    262259   */
    263260  private void createHatchTexture() {
     
    283280      Area a = new Area(b);
    284281      // now successively subtract downloaded areas
    285       for (Bounds bounds : this.bounds) {
     282      for (Bounds bounds : this.data.bounds) {
    286283        Point p1 = mv.getPoint(bounds.getMin());
    287284        Point p2 = mv.getPoint(bounds.getMax());
     
    508505  }
    509506
    510   // EditDataLayerChanged
    511507  @Override
    512508  public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java

    r31455 r31459  
    8282    if (isViewDownloaded(view))
    8383      return;
    84     MapillaryLayer.getInstance().bounds.add(view);
     84    MapillaryLayer.getInstance().getData().bounds.add(view);
    8585    getImages(view);
    8686  }
     
    108108  }
    109109
     110  /**
     111   * Checks if the given {@LatLon} object lies inside the bounds of the
     112   * image.
     113   *
     114   * @param latlon
     115   * @return true if it lies inside the bounds; false otherwise;
     116   */
    110117  private static boolean isInBounds(LatLon latlon) {
    111     for (Bounds bounds : MapillaryLayer.getInstance().bounds) {
     118    for (Bounds bounds : MapillaryLayer.getInstance().getData().bounds) {
    112119      if (bounds.contains(latlon))
    113120        return true;
     
    141148    for (Bounds bounds : Main.map.mapView.getEditLayer().data
    142149        .getDataSourceBounds()) {
    143       if (!layer.bounds.contains(bounds)) {
    144         layer.bounds.add(bounds);
     150      if (!layer.getData().bounds.contains(bounds)) {
     151        layer.getData().bounds.add(bounds);
    145152        MapillaryDownloader.getImages(bounds.getMin(), bounds.getMax());
    146153      }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java

    r31451 r31459  
    132132
    133133  private boolean isInside(MapillaryAbstractImage image) {
    134     for (int i = 0; i < this.layer.bounds.size(); i++)
    135       if (this.layer.bounds.get(i).contains(image.getLatLon()))
     134    for (int i = 0; i < this.layer.getData().bounds.size(); i++)
     135      if (this.layer.getData().bounds.get(i).contains(image.getLatLon()))
    136136        return true;
    137137    return false;
Note: See TracChangeset for help on using the changeset viewer.