Changeset 11993 in josm


Ignore:
Timestamp:
2017-04-24T01:39:24+02:00 (2 years ago)
Author:
Don-vip
Message:

fix #5144 - Cannot draw new ways when filter is active (patch by michael2402)

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r11713 r11993  
    12961296
    12971297    @Override
     1298    public Collection<? extends OsmPrimitive> getPreservedPrimitives() {
     1299        DataSet ds = getLayerManager().getEditDataSet();
     1300        return ds != null ? ds.getSelected() : null;
     1301    }
     1302
     1303    @Override
    12981304    public boolean layerIsSupported(Layer l) {
    12991305        return l instanceof OsmDataLayer;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r11713 r11993  
    88import java.awt.event.MouseListener;
    99import java.awt.event.MouseMotionListener;
     10import java.util.Collection;
     11import java.util.Collections;
    1012
    1113import org.openstreetmap.josm.Main;
     
    1315import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
    1416import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
     17import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1518import org.openstreetmap.josm.gui.MapFrame;
    1619import org.openstreetmap.josm.gui.layer.Layer;
     
    201204        readPreferences();
    202205    }
     206
     207    /**
     208     * Gets a collection of primitives that should not be hidden by the filter.
     209     * @return The primitives that the filter should not hide.
     210     * @since 11993
     211     */
     212    public Collection<? extends OsmPrimitive> getPreservedPrimitives() {
     213        return Collections.emptySet();
     214    }
    203215}
  • trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java

    r11385 r11993  
    66import java.util.List;
    77
     8import org.openstreetmap.josm.Main;
    89import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;
    910import org.openstreetmap.josm.actions.search.SearchCompiler;
     
    224225    private static FilterType test(List<FilterInfo> filters, OsmPrimitive primitive, boolean hidden) {
    225226
    226         if (primitive.isIncomplete())
     227        if (primitive.isIncomplete() || Main.map.mapMode.getPreservedPrimitives().contains(primitive))
    227228            return FilterType.NOT_FILTERED;
    228229
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r11366 r11993  
    2929
    3030import org.openstreetmap.josm.Main;
     31import org.openstreetmap.josm.actions.mapmode.MapMode;
    3132import org.openstreetmap.josm.actions.search.SearchAction;
    3233import org.openstreetmap.josm.data.osm.Filter;
     
    4647import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    4748import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
     49import org.openstreetmap.josm.gui.MapFrame;
     50import org.openstreetmap.josm.gui.MapFrame.MapModeChangeListener;
    4851import org.openstreetmap.josm.gui.SideButton;
    4952import org.openstreetmap.josm.tools.ImageProvider;
     
    5760 * @author Petr_Dlouhý
    5861 */
    59 public class FilterDialog extends ToggleDialog implements DataSetListener {
     62public class FilterDialog extends ToggleDialog implements DataSetListener, MapModeChangeListener {
    6063
    6164    private JTable userTable;
     
    8285    public void showNotify() {
    8386        DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT_CONSOLIDATED);
     87        MapFrame.addMapModeChangeListener(this);
    8488        filterModel.executeFilters();
    8589    }
     
    8892    public void hideNotify() {
    8993        DatasetEventManager.getInstance().removeDatasetListener(this);
     94        MapFrame.removeMapModeChangeListener(this);
    9095        filterModel.clearFilterFlags();
    9196        Main.map.mapView.repaint();
     
    108113    };
    109114
     115    /**
     116     * Builds the GUI.
     117     */
    110118    protected void build() {
    111119        userTable = new UserTable(filterModel);
     
    375383    }
    376384
     385    @Override
     386    public void mapModeChange(MapMode oldMapMode, MapMode newMapMode) {
     387        filterModel.executeFilters();
     388    }
     389
    377390    /**
    378      * This method is intendet for Plugins getting the filtermodel and using .addFilter() to
     391     * This method is intended for Plugins getting the filtermodel and using .addFilter() to
    379392     * add a new filter.
    380393     * @return the filtermodel
Note: See TracChangeset for help on using the changeset viewer.