Class FilterModel

    • Method Detail

      • loadPrefs

        public void loadPrefs​(String prefEntry)
        Initializes the model from preferences.
        Parameters:
        prefEntry - preference key
      • savePrefs

        public void savePrefs​(String prefEntry)
        Saves the model to preferences.
        Parameters:
        prefEntry - preferences key
      • executeFilters

        public void executeFilters()
        Runs the filters on the current edit data set.
      • executeFilters

        public void executeFilters​(Collection<? extends OsmPrimitive> primitives)
        Runs the filter on a list of primitives that are part of the edit data set.
        Parameters:
        primitives - The primitives
      • updateMap

        private static void updateMap()
      • clearFilterFlags

        public void clearFilterFlags()
        Clears all filtered flags from all primitives in the dataset
      • clearFilters

        public void clearFilters()
        Removes all filters from this model.
      • addFilter

        public boolean addFilter​(Filter filter)
        Adds a new filter to the filter list.
        Parameters:
        filter - The new filter
        Returns:
        true (as specified by Collection.add(E))
      • moveFilters

        public boolean moveFilters​(int delta,
                                   int... rowIndexes)
        Moves the filters in the given rows by a number of positions.
        Parameters:
        delta - negative or positive increment
        rowIndexes - The filter rows
        Returns:
        true if the filters have been moved down
        Since:
        15226
      • moveDownFilter

        public boolean moveDownFilter​(int rowIndex)
        Moves down the filter in the given row.
        Parameters:
        rowIndex - The filter row
        Returns:
        true if the filter has been moved down
      • moveUpFilter

        public boolean moveUpFilter​(int rowIndex)
        Moves up the filter in the given row
        Parameters:
        rowIndex - The filter row
        Returns:
        true if the filter has been moved up
      • removeFilter

        public Filter removeFilter​(int rowIndex)
        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
      • drawOSDText

        public void drawOSDText​(Graphics2D g,
                                OSDLabel lblOSD,
                                String header,
                                String footer)
        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 label
        header - The title to display at the beginning of OSD
        footer - The message to display at the bottom of OSD. Must end by </html>
      • getFilters

        public List<FiltergetFilters()
        Returns the list of filters.
        Returns:
        the list of filters
      • getFiltersCount

        public int getFiltersCount()
        Returns the number of filters.
        Returns:
        the number of filters
      • getDisabledCount

        public int getDisabledCount()
        Returns the number of primitives that are disabled but not hidden.
        Returns:
        the number of primitives that are disabled but not hidden
      • getDisabledAndHiddenCount

        public int getDisabledAndHiddenCount()
        Returns the number of primitives that are disabled and hidden.
        Returns:
        the number of primitives that are disabled and hidden
      • isChanged

        public boolean 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

        public boolean hasFilters()
        Determines if at least one filter is enabled.
        Returns:
        true if at least one filter is enabled
        Since:
        14206
      • getAffectedPrimitives

        public static Collection<OsmPrimitivegetAffectedPrimitives​(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