Ignore:
Timestamp:
2018-01-13T00:52:54+01:00 (2 years ago)
Author:
Don-vip
Message:

fix #15766, see #15688 - fix performance regression introduced in r13229 when drawing a way of many nodes while the filter dialog is open

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r12542 r13309  
    169169     */
    170170    protected static final short FLAG_ANNOTATED = 1 << 12;
     171
     172    /**
     173     * Determines if the primitive is preserved from the filter mechanism.
     174     */
     175    protected static final short FLAG_PRESERVED = 1 << 13;
    171176
    172177    /**
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r13208 r13309  
    518518
    519519    /**
     520     * Returns a collection containing all primitives preserved from filtering.
     521     * @return A collection containing all primitives preserved from filtering.
     522     * @see OsmPrimitive#isPreserved
     523     * @since 13309
     524     */
     525    public Collection<OsmPrimitive> allPreservedPrimitives() {
     526        return getPrimitives(OsmPrimitive::isPreserved);
     527    }
     528
     529    /**
    520530     * Adds a primitive to the dataset.
    521531     *
  • trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java

    r12846 r13309  
    1111import org.openstreetmap.josm.data.osm.search.SearchMode;
    1212import org.openstreetmap.josm.data.osm.search.SearchParseError;
    13 import org.openstreetmap.josm.gui.MainApplication;
    14 import org.openstreetmap.josm.gui.MapFrame;
    1513import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    1614
     
    225223
    226224    private static FilterType test(List<FilterInfo> filters, OsmPrimitive primitive, boolean hidden) {
    227         MapFrame map = MainApplication.getMap();
    228         if (primitive.isIncomplete() ||
    229                 (map != null && map.mapMode != null && map.mapMode.getPreservedPrimitives().contains(primitive)))
     225        if (primitive.isIncomplete() || primitive.isPreserved())
    230226            return FilterType.NOT_FILTERED;
    231227
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13173 r13309  
    428428
    429429    /**
     430     * Set binary property used internally by the filter mechanism.
     431     * @param isPreserved new "preserved" flag value
     432     * @since 13309
     433     */
     434    public void setPreserved(boolean isPreserved) {
     435        updateFlags(FLAG_PRESERVED, isPreserved);
     436    }
     437
     438    /**
    430439     * Replies true, if this primitive is disabled. (E.g. a filter applies)
    431440     * @return {@code true} if this object has the "disabled" flag enabled
     
    457466    public boolean getDisabledType() {
    458467        return (flags & FLAG_DISABLED_TYPE) != 0;
     468    }
     469
     470    /**
     471     * Replies true, if this primitive is preserved from filtering.
     472     * @return {@code true} if this object has the "preserved" flag enabled
     473     * @since 13309
     474     */
     475    public boolean isPreserved() {
     476        return (flags & FLAG_PRESERVED) != 0;
    459477    }
    460478
Note: See TracChangeset for help on using the changeset viewer.