Changeset 5357 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2012-07-23T19:28:33+02:00 (12 years ago)
Author:
stoecker
Message:

improve task handling for jmapviewer in JOSM context

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r5279 r5357  
    9696     * it only shows the MOTD panel.
    9797     *
    98      * @return true if JOSM currently displays a map view
     98     * @return <code>true</code> if JOSM currently displays a map view
    9999     */
    100100    static public boolean isDisplayingMapView() {
     
    133133    public static MapFrame map;
    134134    /**
    135      * True, when in applet mode
     135     * Set to <code>true</code>, when in applet mode
    136136     */
    137137    public static boolean applet = false;
     
    376376
    377377    /**
    378      * Replies true if there is an edit layer
     378     * Replies <code>true</code> if there is an edit layer
    379379     *
    380      * @return true if there is an edit layer
     380     * @return <code>true</code> if there is an edit layer
    381381     */
    382382    public boolean hasEditLayer() {
     
    388388     * Replies the current edit layer
    389389     *
    390      * @return the current edit layer. null, if no current edit layer exists
     390     * @return the current edit layer. <code>null</code>, if no current edit layer exists
    391391     */
    392392    public OsmDataLayer getEditLayer() {
     
    399399     * Replies the current data set.
    400400     *
    401      * @return the current data set. null, if no current data set exists
     401     * @return the current data set. <code>null</code>, if no current data set exists
    402402     */
    403403    public DataSet getCurrentDataSet() {
     
    409409     * Returns the currently active  layer
    410410     *
    411      * @return the currently active layer. null, if currently no active layer exists
     411     * @return the currently active layer. <code>null</code>, if currently no active layer exists
    412412     */
    413413    public Layer getActiveLayer() {
     
    807807     * Replies the current projection.
    808808     *
    809      * @return
     809     * @return the currently active projection
    810810     */
    811811    public static Projection getProjection() {
     
    859859     * Register a projection change listener
    860860     *
    861      * @param listener the listener. Ignored if null.
     861     * @param listener the listener. Ignored if <code>null</code>.
    862862     */
    863863    public static void addProjectionChangeListener(ProjectionChangeListener listener) {
     
    875875     * Removes a projection change listener
    876876     *
    877      * @param listener the listener. Ignored if null.
     877     * @param listener the listener. Ignored if <code>null</code>.
    878878     */
    879879    public static void removeProjectionChangeListener(ProjectionChangeListener listener) {
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r5046 r5357  
    184184    public SlippyMapBBoxChooser() {
    185185        super();
     186        TMSLayer.setMaxWorkers();
    186187        cachedLoader = null;
    187188        String cachePath = TMSLayer.PROP_TILECACHE_DIR.get();
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r5311 r5357  
    105105    //public static final BooleanProperty PROP_DRAW_DEBUG = new BooleanProperty(PREFERENCE_PREFIX + ".draw_debug", false);
    106106    public static final BooleanProperty PROP_ADD_TO_SLIPPYMAP_CHOOSER = new BooleanProperty(PREFERENCE_PREFIX + ".add_to_slippymap_chooser", true);
     107    public static final IntegerProperty PROP_TMS_JOBS = new IntegerProperty("tmsloader.maxjobs", 25);
    107108    public static final StringProperty PROP_TILECACHE_DIR;
    108109
     
    121122    protected TileSource tileSource;
    122123    protected OsmTileLoader tileLoader;
    123     JobDispatcher jobDispatcher = JobDispatcher.getInstance();
    124124
    125125    HashSet<Tile> tileRequestsOutstanding = new HashSet<Tile>();
     
    441441    }
    442442
     443    /**
     444     * Function to set the maximum number of workers for tile loading to the value defined
     445     * in preferences.
     446     */
     447    static public void setMaxWorkers() {
     448        JobDispatcher.getInstance().setMaxWorkers(PROP_TMS_JOBS.get());
     449        JobDispatcher.getInstance().setLIFO(true);
     450    }
     451
    443452    @SuppressWarnings("serial")
    444453    public TMSLayer(ImageryInfo info) {
    445454        super(info);
    446455
     456        setMaxWorkers();
    447457        if(!isProjectionSupported(Main.getProjection())) {
    448458            JOptionPane.showMessageDialog(Main.parent,
     
    650660        }*/
    651661        needRedraw = true;
    652         jobDispatcher.cancelOutstandingJobs();
     662        JobDispatcher.getInstance().cancelOutstandingJobs();
    653663        tileRequestsOutstanding.clear();
    654664    }
     
    778788            return false;
    779789        tileRequestsOutstanding.add(tile);
    780         jobDispatcher.addJob(tileLoader.createTileLoaderJob(tileSource,
    781                 tile.getXtile(), tile.getYtile(), tile.getZoom()));
     790        JobDispatcher.getInstance().addJob(tileLoader.createTileLoaderJob(tile));
    782791        return true;
    783792    }
Note: See TracChangeset for help on using the changeset viewer.