Package org.openstreetmap.josm.data.osm
Class FilterModel
java.lang.Object
org.openstreetmap.josm.data.osm.FilterModel
- All Implemented Interfaces:
ReorderableModel<Filter>,SortableModel<Filter>
The model that is used both for auto and manual filters.
- Since:
- 12400
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleantrue, if the filter state (normal / disabled / hidden) of any primitive has changed in the processprivate intnumber of primitives that are disabled and hiddenprivate intnumber of primitives that are disabled but not hiddenprivate final FilterMatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a new filter to the filter list.booleanaddFilters(Filter... newFilters) Adds new filters to the filter list.voidClears all filtered flags from all primitives in the datasetvoidRemoves all filters from this model.voiddrawOSDText(Graphics2D g, OSDLabel lblOSD, String header, String footer) Draws a text on the map display that indicates that filters are active.voidRuns the filters on the current edit data set.voidexecuteFilters(Collection<? extends OsmPrimitive> primitives) Runs the filter on a list of primitives that are part of the edit data set.static Collection<OsmPrimitive>getAffectedPrimitives(Collection<? extends OsmPrimitive> primitives) Returns the list of primitives whose filtering can be affected by change in primitiveintReturns the number of primitives that are disabled and hidden.intReturns the number of primitives that are disabled but not hidden.Returns the list of filters.intReturns the number of filters.getValue(int rowIndex) Get object value at given index.booleanDetermines if at least one filter is enabled.booleanDetermines if the filter state (normal / disabled / hidden) of any primitive has changed in the process.voidInitializes the model from preferences.booleanmoveDownFilter(int rowIndex) Moves down the filter in the given row.booleanmoveFilters(int delta, int... rowIndexes) Moves the filters in the given rows by a number of positions.booleanmoveUpFilter(int rowIndex) Moves up the filter in the given rowremoveFilter(int rowIndex) Removes the filter that is displayed in the given rowremoveFilters(int... rowIndexes) Removes the filters that are displayed in the given rowsvoidreverse()Reverse the items order.voidSaves the model to preferences.Set object value at given index.voidsort()Sort the items.private voidprivate static voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.ReorderableModel
canMove, canMoveDown, canMoveUp, doMove
-
Field Details
-
disabledCount
number of primitives that are disabled but not hidden -
disabledAndHiddenCount
number of primitives that are disabled and hidden -
changed
true, if the filter state (normal / disabled / hidden) of any primitive has changed in the process -
filters
-
filterMatcher
-
-
Constructor Details
-
FilterModel
public FilterModel()
-
-
Method Details
-
updateFilterMatcher
-
loadPrefs
Initializes the model from preferences.- Parameters:
prefEntry- preference key
-
savePrefs
Saves the model to preferences.- Parameters:
prefEntry- preferences key
-
executeFilters
Runs the filters on the current edit data set. -
executeFilters
Runs the filter on a list of primitives that are part of the edit data set.- Parameters:
primitives- The primitives
-
updateMap
-
clearFilterFlags
Clears all filtered flags from all primitives in the dataset -
clearFilters
Removes all filters from this model. -
addFilter
Adds a new filter to the filter list.- Parameters:
filter- The new filter- Returns:
- true (as specified by
Collection.add(E))
-
addFilters
Adds new filters to the filter list.- Parameters:
newFilters- The new filters- Returns:
- true (as specified by
Collection.add(E)) - Since:
- 18556
-
moveFilters
Moves the filters in the given rows by a number of positions.- Parameters:
delta- negative or positive incrementrowIndexes- The filter rows- Returns:
- true if the filters have been moved down
- Since:
- 15226
-
moveDownFilter
Moves down the filter in the given row.- Parameters:
rowIndex- The filter row- Returns:
- true if the filter has been moved down
-
moveUpFilter
Moves up the filter in the given row- Parameters:
rowIndex- The filter row- Returns:
- true if the filter has been moved up
-
removeFilter
Removes the filter that is displayed in the given row- Parameters:
rowIndex- The index of the filter to remove- Returns:
- the filter previously at the specified position
- See Also:
-
removeFilters
Removes the filters that are displayed in the given rows- Parameters:
rowIndexes- The indexes of the filters to remove- Returns:
- the filters previously at the specified positions
- Since:
- 18556
-
setValue
Description copied from interface:ReorderableModelSet object value at given index.- Specified by:
setValuein interfaceReorderableModel<Filter>- Parameters:
rowIndex- indexfilter- new value- Returns:
- the value previously at the specified position
-
getValue
Description copied from interface:ReorderableModelGet object value at given index.- Specified by:
getValuein interfaceReorderableModel<Filter>- Parameters:
rowIndex- index- Returns:
- object value at given index
-
drawOSDText
Draws a text on the map display that indicates that filters are active.- Parameters:
g- The graphics to draw that text on.lblOSD- On Screen Display labelheader- The title to display at the beginning of OSDfooter- The message to display at the bottom of OSD. Must end by</html>
-
getFilters
Returns the list of filters.- Returns:
- the list of filters
-
getFiltersCount
Returns the number of filters.- Returns:
- the number of filters
-
getDisabledCount
Returns the number of primitives that are disabled but not hidden.- Returns:
- the number of primitives that are disabled but not hidden
-
getDisabledAndHiddenCount
Returns the number of primitives that are disabled and hidden.- Returns:
- the number of primitives that are disabled and hidden
-
isChanged
Determines if the filter state (normal / disabled / hidden) of any primitive has changed in the process.- Returns:
- true, if the filter state (normal / disabled / hidden) of any primitive has changed in the process
-
hasFilters
Determines if at least one filter is enabled.- Returns:
trueif at least one filter is enabled- Since:
- 14206
-
getAffectedPrimitives
public static Collection<OsmPrimitive> getAffectedPrimitives(Collection<? extends OsmPrimitive> primitives) Returns the list of primitives whose filtering can be affected by change in primitive- Parameters:
primitives- list of primitives to check- Returns:
- List of primitives whose filtering can be affected by change in source primitives
-
sort
Description copied from interface:SortableModelSort the items.- Specified by:
sortin interfaceSortableModel<Filter>
-
reverse
Description copied from interface:SortableModelReverse the items order.- Specified by:
reversein interfaceSortableModel<Filter>
-