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


Ignore:
Timestamp:
2016-01-02T18:04:19+01:00 (9 years ago)
Author:
simon04
Message:

see #7089 - Relation list: re-filter after zooming

This allows to use filters such as parent inview to only display relations w/ members in the current view.

File:
1 edited

Legend:

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

    r9078 r9264  
    6060import org.openstreetmap.josm.gui.MapView;
    6161import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
     62import org.openstreetmap.josm.gui.NavigatableComponent;
    6263import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    6364import org.openstreetmap.josm.gui.PopupMenuHandler;
     
    8586 * objects are visible on the map and can be selected there. Relations are not.
    8687 */
    87 public class RelationListDialog extends ToggleDialog implements DataSetListener {
     88public class RelationListDialog extends ToggleDialog implements DataSetListener, NavigatableComponent.ZoomChangeListener {
    8889    /** The display list. */
    8990    private final JList<Relation> displaylist;
     
    206207    public void showNotify() {
    207208        MapView.addLayerChangeListener(newAction);
     209        MapView.addZoomChangeListener(this);
    208210        newAction.updateEnabledState();
    209211        DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT);
     
    215217    public void hideNotify() {
    216218        MapView.removeLayerChangeListener(newAction);
     219        MapView.removeZoomChangeListener(this);
    217220        DatasetEventManager.getInstance().removeDatasetListener(this);
    218221        DataSet.removeSelectionListener(addSelectionToRelations);
     
    671674        /* ignore */
    672675    }
     676
     677    @Override
     678    public void zoomChanged() {
     679        // re-filter relations
     680        if (model.filter != null) {
     681            model.setFilter(model.filter);
     682        }
     683    }
    673684}
Note: See TracChangeset for help on using the changeset viewer.