Ignore:
Timestamp:
2017-01-16T22:34:15+01:00 (7 years ago)
Author:
bastiK
Message:

see #13124 - better cache invalidation

Fixes a problem when zoomed out, so all gpx data is in the center of the mapview.
Then moving the map did not update the gpx layer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r11469 r11470  
    3939import org.openstreetmap.josm.data.preferences.ColorProperty;
    4040import org.openstreetmap.josm.gui.MapView;
     41import org.openstreetmap.josm.gui.MapViewState;
    4142import org.openstreetmap.josm.io.CachedFile;
    4243import org.openstreetmap.josm.tools.ColorScale;
     
    139140    // some cached values
    140141    Rectangle heatMapCacheScreenBounds = new Rectangle();
    141     int heatMapCacheVisibleSegments;
    142     double heatMapCacheZoomScale;
     142    MapViewState heatMapMapViewState;
    143143    int heatMapCacheLineWith;
    144144
     
    538538
    539539            // force redraw of image
    540             heatMapCacheVisibleSegments = 0;
     540            heatMapMapViewState = null;
    541541        }
    542542
     
    10881088        // get bounds of screen image and projection, zoom and adjust input parameters
    10891089        final Rectangle screenBounds = new Rectangle(mv.getWidth(), mv.getHeight());
    1090         final double zoomScale = mv.getScale();
     1090        final MapViewState mapViewState = mv.getState();
     1091        final double zoomScale = mapViewState.getScale();
    10911092
    10921093        // adjust global settings ( zero = default line width )
     
    11171118
    11181119        // recalculation of image needed
    1119         final boolean imageRecalc = heatMapCacheVisibleSegments != visibleSegments.size() ||
    1120                                     heatMapCacheZoomScale != zoomScale ||
     1120        final boolean imageRecalc = !mapViewState.equalsInWindow(heatMapMapViewState) ||
    11211121                                    heatMapCacheLineWith != globalLineWidth;
    11221122
     
    11411141
    11421142            // remember draw parameters
    1143             heatMapCacheVisibleSegments = visibleSegments.size();
    1144             heatMapCacheZoomScale = zoomScale;
     1143            heatMapMapViewState = mapViewState;
    11451144            heatMapCacheLineWith = globalLineWidth;
    11461145        }
Note: See TracChangeset for help on using the changeset viewer.