Ignore:
Timestamp:
2017-08-24T01:24:27+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - remove last calls to Main.map

File:
1 edited

Legend:

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

    r12630 r12631  
    124124    @Deprecated
    125125    public static boolean isDisplayingMapView() {
    126         return map != null && map.mapView != null;
     126        return MainApplication.isDisplayingMapView();
    127127    }
    128128
     
    681681     */
    682682    public Collection<OsmPrimitive> getInProgressSelection() {
    683         if (map != null && map.mapMode instanceof DrawAction) {
    684             return ((DrawAction) map.mapMode).getInProgressSelection();
    685         } else {
    686             DataSet ds = getLayerManager().getEditDataSet();
    687             if (ds == null) return null;
    688             return ds.getSelected();
    689         }
     683        DataSet ds = getLayerManager().getEditDataSet();
     684        if (ds == null) return null;
     685        return ds.getSelected();
    690686    }
    691687
     
    906902            ImageProvider.shutdown(false);
    907903            JCSCacheManager.shutdown();
    908         }
    909         if (map != null) {
    910             map.rememberToggleDialogWidth();
    911904        }
    912905        // Remove all layers because somebody may rely on layerRemoved events (like AutosaveTask)
     
    10901083    /**
    10911084     * The projection method used.
    1092      * use {@link #getProjection()} and {@link #setProjection(Projection)} for access.
     1085     * Use {@link #getProjection()} and {@link #setProjection(Projection)} for access.
    10931086     * Use {@link #setProjection(Projection)} in order to trigger a projection change event.
    10941087     */
     
    11121105        CheckParameterUtil.ensureParameterNotNull(p);
    11131106        Projection oldValue = proj;
    1114         Bounds b = isDisplayingMapView() ? map.mapView.getRealBounds() : null;
     1107        Bounds b = main != null ? main.getRealBounds() : null;
    11151108        proj = p;
    11161109        fireProjectionChanged(oldValue, proj, b);
     1110    }
     1111
     1112    /**
     1113     * Returns the bounds for the current projection. Used for projection events.
     1114     * @return the bounds for the current projection
     1115     * @see #restoreOldBounds
     1116     */
     1117    protected Bounds getRealBounds() {
     1118        // To be overriden
     1119        return null;
     1120    }
     1121
     1122    /**
     1123     * Restore clean state corresponding to old bounds after a projection change event.
     1124     * @param oldBounds bounds previously returned by {@link #getRealBounds}, before the change of projection
     1125     * @see #getRealBounds
     1126     */
     1127    protected void restoreOldBounds(Bounds oldBounds) {
     1128        // To be overriden
    11171129    }
    11181130
     
    11391151                }
    11401152            }
    1141             if (newValue != null && oldBounds != null) {
    1142                 MainApplication.getMap().mapView.zoomTo(oldBounds);
     1153            if (newValue != null && oldBounds != null && main != null) {
     1154                main.restoreOldBounds(oldBounds);
    11431155            }
    11441156            /* TODO - remove layers with fixed projection */
Note: See TracChangeset for help on using the changeset viewer.