Ticket #16128: 16128-disable-text-when-moving.patch

File 16128-disable-text-when-moving.patch, 6.1 KB (added by Don-vip, 2 months ago)
  • src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java

     
    6161    /** Preference: minimum space (displayed way length) to display segment numbers */
    6262    protected int segmentNumberSpace;
    6363
     64    /** Performs slow operations by default. Can be disabled when fast partial rendering is required */
     65    protected boolean doSlowOperations;
     66
    6467    /**
    6568     * <p>Creates an abstract paint visitor</p>
    6669     *
     
    240243            }
    241244        }
    242245    }
     246
     247    /**
     248     * Sets whether slow operations such as text rendering must be performed (true by default).
     249     * @param enable whether slow operations such as text rendering must be performed
     250     * @since xxx
     251     */
     252    public final void enableSlowOperations(boolean enable) {
     253        doSlowOperations = enable;
     254    }
    243255}
  • src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

     
    557557     * @param bs The text and it's alignment.
    558558     */
    559559    public void drawBoxText(Node n, BoxTextElement bs) {
    560         if (!isShowNames() || bs == null)
     560        if (!isShowNames() || bs == null || !doSlowOperations)
    561561            return;
    562562
    563563        MapViewPoint p = mapState.getPointFor(n);
     
    10901090     * @since 11722
    10911091     */
    10921092    public void drawText(OsmPrimitive osm, TextLabel text, PositionForAreaStrategy labelPositionStrategy) {
    1093         if (!isShowNames()) {
     1093        if (!isShowNames() || !doSlowOperations) {
    10941094            return;
    10951095        }
    10961096        String name = text.getString(osm);
  • src/org/openstreetmap/josm/gui/MapMover.java

     
    1818import org.openstreetmap.gui.jmapviewer.JMapViewer;
    1919import org.openstreetmap.josm.Main;
    2020import org.openstreetmap.josm.actions.mapmode.SelectAction;
    21 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    22 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    2321import org.openstreetmap.josm.data.coor.EastNorth;
    2422import org.openstreetmap.josm.data.preferences.BooleanProperty;
    2523import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
     24import org.openstreetmap.josm.gui.layer.Layer;
    2625import org.openstreetmap.josm.spi.preferences.Config;
     26import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
     27import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    2728import org.openstreetmap.josm.tools.Destroyable;
    2829import org.openstreetmap.josm.tools.Pair;
    2930import org.openstreetmap.josm.tools.Shortcut;
     
    157158        registeredShortcuts.add(new Pair<>(action, shortcut));
    158159    }
    159160
    160     private boolean movementInProgress() {
     161    /**
     162     * Determines if a map move is in progress.
     163     * @return {@code true} if a map move is in progress
     164     * @since xxx
     165     */
     166    public boolean movementInProgress() {
    161167        return mousePosMoveStart != null;
    162168    }
    163169
     
    237243        }
    238244        nc.resetCursor(this);
    239245        mousePosMoveStart = null;
     246        MainApplication.getLayerManager().getLayers().forEach(Layer::invalidate);
    240247    }
    241248
    242249    /**
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

     
    6363import org.openstreetmap.josm.data.osm.DataIntegrityProblemException;
    6464import org.openstreetmap.josm.data.osm.DataSelectionListener;
    6565import org.openstreetmap.josm.data.osm.DataSet;
    66 import org.openstreetmap.josm.data.osm.DownloadPolicy;
    67 import org.openstreetmap.josm.data.osm.UploadPolicy;
    6866import org.openstreetmap.josm.data.osm.DataSetMerger;
    6967import org.openstreetmap.josm.data.osm.DatasetConsistencyTest;
     68import org.openstreetmap.josm.data.osm.DownloadPolicy;
    7069import org.openstreetmap.josm.data.osm.HighlightUpdateListener;
    7170import org.openstreetmap.josm.data.osm.IPrimitive;
    7271import org.openstreetmap.josm.data.osm.Node;
    7372import org.openstreetmap.josm.data.osm.OsmPrimitive;
    7473import org.openstreetmap.josm.data.osm.OsmPrimitiveComparator;
    7574import org.openstreetmap.josm.data.osm.Relation;
     75import org.openstreetmap.josm.data.osm.UploadPolicy;
    7676import org.openstreetmap.josm.data.osm.Way;
    7777import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent;
    7878import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter;
    7979import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter.Listener;
    8080import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    8181import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
     82import org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer;
    8283import org.openstreetmap.josm.data.osm.visitor.paint.MapRendererFactory;
    83 import org.openstreetmap.josm.data.osm.visitor.paint.Rendering;
    8484import org.openstreetmap.josm.data.osm.visitor.paint.relations.MultipolygonCache;
    8585import org.openstreetmap.josm.data.preferences.IntegerProperty;
    8686import org.openstreetmap.josm.data.preferences.NamedColorProperty;
     
    490490            g.fill(a);
    491491        }
    492492
    493         Rendering painter = MapRendererFactory.getInstance().createActiveRenderer(g, mv, inactive);
     493        AbstractMapRenderer painter = MapRendererFactory.getInstance().createActiveRenderer(g, mv, inactive);
     494        painter.enableSlowOperations(mv.getMapMover() == null || !mv.getMapMover().movementInProgress());
    494495        painter.render(data, virtual, box);
    495496        MainApplication.getMap().conflictDialog.paintConflicts(g, mv);
    496497    }