public class FilterModel extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
changed
true, if the filter state (normal / disabled / hidden) of any primitive has changed in the process
|
private int |
disabledAndHiddenCount
number of primitives that are disabled and hidden
|
private int |
disabledCount
number of primitives that are disabled but not hidden
|
private FilterMatcher |
filterMatcher |
private java.util.List<Filter> |
filters |
Constructor and Description |
---|
FilterModel() |
Modifier and Type | Method and Description |
---|---|
boolean |
addFilter(Filter filter)
Adds a new filter to the filter list.
|
void |
clearFilterFlags()
Clears all filtered flags from all primitives in the dataset
|
void |
clearFilters()
Removes all filters from this model.
|
void |
drawOSDText(java.awt.Graphics2D g,
OSDLabel lblOSD,
java.lang.String header,
java.lang.String footer)
Draws a text on the map display that indicates that filters are active.
|
void |
executeFilters()
Runs the filters on the current edit data set.
|
void |
executeFilters(java.util.Collection<? extends OsmPrimitive> primitives)
Runs the filter on a list of primitives that are part of the edit data set.
|
static java.util.Collection<OsmPrimitive> |
getAffectedPrimitives(java.util.Collection<? extends OsmPrimitive> primitives)
Returns the list of primitives whose filtering can be affected by change in primitive
|
int |
getDisabledAndHiddenCount()
Returns the number of primitives that are disabled and hidden.
|
int |
getDisabledCount()
Returns the number of primitives that are disabled but not hidden.
|
Filter |
getFilter(int rowIndex)
Gets the filter by row index
|
java.util.List<Filter> |
getFilters()
Returns the list of filters.
|
int |
getFiltersCount()
Returns the number of filters.
|
boolean |
hasFilters()
Determines if at least one filter is enabled.
|
boolean |
isChanged()
Determines if the filter state (normal / disabled / hidden) of any primitive has changed in the process.
|
void |
loadPrefs(java.lang.String prefEntry)
Initializes the model from preferences.
|
boolean |
moveDownFilter(int rowIndex)
Moves down the filter in the given row.
|
boolean |
moveUpFilter(int rowIndex)
Moves up the filter in the given row
|
Filter |
removeFilter(int rowIndex)
Removes the filter that is displayed in the given row
|
void |
savePrefs(java.lang.String prefEntry)
Saves the model to preferences.
|
Filter |
setFilter(int rowIndex,
Filter filter)
Sets/replaces the filter for a given row.
|
private void |
updateFilterMatcher() |
private static void |
updateMap() |
private int disabledCount
private int disabledAndHiddenCount
private boolean changed
private final FilterMatcher filterMatcher
public FilterModel()
private void updateFilterMatcher()
public void loadPrefs(java.lang.String prefEntry)
prefEntry
- preference keypublic void savePrefs(java.lang.String prefEntry)
prefEntry
- preferences keypublic void executeFilters()
public void executeFilters(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- The primitivesprivate static void updateMap()
public void clearFilterFlags()
public void clearFilters()
public boolean addFilter(Filter filter)
filter
- The new filterCollection.add(E)
)public boolean moveDownFilter(int rowIndex)
rowIndex
- The filter rowpublic boolean moveUpFilter(int rowIndex)
rowIndex
- The filter rowpublic Filter removeFilter(int rowIndex)
rowIndex
- The index of the filter to removepublic Filter setFilter(int rowIndex, Filter filter)
rowIndex
- The row indexfilter
- The filter that should be placed in that rowpublic Filter getFilter(int rowIndex)
rowIndex
- The row indexpublic void drawOSDText(java.awt.Graphics2D g, OSDLabel lblOSD, java.lang.String header, java.lang.String footer)
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>
public java.util.List<Filter> getFilters()
public int getFiltersCount()
public int getDisabledCount()
public int getDisabledAndHiddenCount()
public boolean isChanged()
public boolean hasFilters()
true
if at least one filter is enabledpublic static java.util.Collection<OsmPrimitive> getAffectedPrimitives(java.util.Collection<? extends OsmPrimitive> primitives)
primitives
- list of primitives to check