Changeset 12174 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-05-15T18:09:18+02:00 (8 years ago)
Author:
michael2402
Message:

Map paint style: Invalidate the affected layers instead of triggering a full repaint.

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r12170 r12174  
    669669            }
    670670        }
     671        // invalidate repaint cache. The layer order may have changed by this, so we invalidate every layer
     672        getLayerManager().getLayers().forEach(invalidatedListener::invalidate);
    671673        AudioPlayer.reset();
    672         repaint();
    673674    }
    674675
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r11781 r12174  
    2424import org.openstreetmap.josm.data.osm.Tag;
    2525import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     26import org.openstreetmap.josm.gui.layer.Layer;
     27import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2628import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    2729import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage;
     
    340342                fireMapPaintSylesUpdated();
    341343                styles.clearCached();
    342                 if (Main.isDisplayingMapView()) {
    343                     Main.map.mapView.preferenceChanged(null);
    344                     Main.map.mapView.repaint();
    345                 }
     344
     345                // Trigger a repaint of all data layers
     346                Main.getLayerManager().getLayers()
     347                    .stream()
     348                    .filter(layer -> layer instanceof OsmDataLayer)
     349                    .forEach(Layer::invalidate);
    346350            });
    347351        }
Note: See TracChangeset for help on using the changeset viewer.