- Timestamp:
- 2018-08-31T00:57:57+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r14169 r14206 42 42 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 43 43 import org.openstreetmap.josm.data.osm.event.DataSetListener; 44 import org.openstreetmap.josm.data.osm.event.FilterChangedEvent; 44 45 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 45 46 import org.openstreetmap.josm.data.osm.event.PrimitiveFlagsChangedEvent; … … 1030 1031 1031 1032 void fireFilterChanged() { 1032 fireEvent(new DataChangedEvent(this));1033 fireEvent(new FilterChangedEvent(this)); 1033 1034 } 1034 1035 -
trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
r13309 r14206 114 114 115 115 /** 116 * Determines if at least one filter is enabled. 117 * @return {@code true} if at least one filter is enabled 118 * @since 14206 119 */ 120 public boolean hasFilters() { 121 return !hiddenFilters.isEmpty() || !disabledFilters.isEmpty(); 122 } 123 124 /** 116 125 * Adds a filter to the currently used filters 117 126 * @param filter the filter to add -
trunk/src/org/openstreetmap/josm/data/osm/FilterModel.java
r14153 r14206 373 373 374 374 /** 375 * Determines if at least one filter is enabled. 376 * @return {@code true} if at least one filter is enabled 377 * @since 14206 378 */ 379 public boolean hasFilters() { 380 return filterMatcher.hasFilters(); 381 } 382 383 /** 375 384 * Returns the list of primitives whose filtering can be affected by change in primitive 376 385 * @param primitives list of primitives to check -
trunk/src/org/openstreetmap/josm/data/osm/event/AbstractDatasetChangedEvent.java
r12189 r14206 49 49 */ 50 50 CHANGESET_ID_CHANGED, 51 /** 52 * The filtered state changed for a list of primitives 53 */ 54 FILTERS_CHANGED, 51 55 /** 52 56 * The flags changed for a primitive and have not been covered in an other event -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterButton.java
r12987 r14206 36 36 if (filter.equals(afm.getCurrentAutoFilter())) { 37 37 afm.setCurrentAutoFilter(null); 38 MainApplication.getMap().filterDialog.getFilterModel().executeFilters( );38 MainApplication.getMap().filterDialog.getFilterModel().executeFilters(true); 39 39 } else { 40 40 afm.setCurrentAutoFilter(filter); -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java
r13434 r14206 394 394 MapFrame map = MainApplication.getMap(); 395 395 if (map != null) { 396 map.filterDialog.getFilterModel().executeFilters( );396 map.filterDialog.getFilterModel().executeFilters(true); 397 397 } 398 398 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r14138 r14206 30 30 import org.openstreetmap.josm.data.osm.FilterModel; 31 31 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 32 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent.DatasetEventType; 32 33 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 33 34 import org.openstreetmap.josm.data.osm.event.DataSetListener; … … 83 84 DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT_CONSOLIDATED); 84 85 MapFrame.addMapModeChangeListener(this); 85 filterModel.executeFilters( );86 filterModel.executeFilters(true); 86 87 } 87 88 … … 326 327 @Override 327 328 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 328 filterModel.executeFilters(); 329 if (!DatasetEventType.FILTERS_CHANGED.equals(event.getType())) { 330 filterModel.executeFilters(); 331 } 329 332 } 330 333 -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java
r12630 r14206 63 63 private void updateFilters() { 64 64 AutoFilterManager.getInstance().setCurrentAutoFilter(null); 65 executeFilters( );66 } 67 68 /** 69 * Runs the filters on the current edit data set .65 executeFilters(true); 66 } 67 68 /** 69 * Runs the filters on the current edit data set, if any. Does nothing if no filter is enabled. 70 70 */ 71 71 public void executeFilters() { 72 if (AutoFilterManager.getInstance().getCurrentAutoFilter() == null) { 72 executeFilters(false); 73 } 74 75 /** 76 * Runs the filter on a list of primitives that are part of the edit data set, if any. Does nothing if no filter is enabled. 77 * @param primitives The primitives 78 */ 79 public void executeFilters(Collection<? extends OsmPrimitive> primitives) { 80 executeFilters(primitives, false); 81 } 82 83 /** 84 * Runs the filters on the current edit data set, if any. 85 * @param force force execution of filters even if no filter is enabled. Useful to reset state after change of filters 86 * @since 14206 87 */ 88 public void executeFilters(boolean force) { 89 if (AutoFilterManager.getInstance().getCurrentAutoFilter() == null && (force || model.hasFilters())) { 73 90 model.executeFilters(); 74 91 updateMap(); … … 77 94 78 95 /** 79 * Runs the filter on a list of primitives that are part of the edit data set. 96 * Runs the filter on a list of primitives that are part of the edit data set, if any. 97 * @param force force execution of filters even if no filter is enabled. Useful to reset state after change of filters 80 98 * @param primitives The primitives 81 */ 82 public void executeFilters(Collection<? extends OsmPrimitive> primitives) { 83 if (AutoFilterManager.getInstance().getCurrentAutoFilter() == null) { 99 * @since 14206 100 */ 101 public void executeFilters(Collection<? extends OsmPrimitive> primitives, boolean force) { 102 if (AutoFilterManager.getInstance().getCurrentAutoFilter() == null && (force || model.hasFilters())) { 84 103 model.executeFilters(primitives); 85 104 updateMap();
Note:
See TracChangeset
for help on using the changeset viewer.