Changeset 12631 in josm for trunk/src/org/openstreetmap/josm/Main.java
- Timestamp:
- 2017-08-24T01:24:27+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12630 r12631 124 124 @Deprecated 125 125 public static boolean isDisplayingMapView() { 126 return map != null && map.mapView != null;126 return MainApplication.isDisplayingMapView(); 127 127 } 128 128 … … 681 681 */ 682 682 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(); 690 686 } 691 687 … … 906 902 ImageProvider.shutdown(false); 907 903 JCSCacheManager.shutdown(); 908 }909 if (map != null) {910 map.rememberToggleDialogWidth();911 904 } 912 905 // Remove all layers because somebody may rely on layerRemoved events (like AutosaveTask) … … 1090 1083 /** 1091 1084 * The projection method used. 1092 * use {@link #getProjection()} and {@link #setProjection(Projection)} for access.1085 * Use {@link #getProjection()} and {@link #setProjection(Projection)} for access. 1093 1086 * Use {@link #setProjection(Projection)} in order to trigger a projection change event. 1094 1087 */ … … 1112 1105 CheckParameterUtil.ensureParameterNotNull(p); 1113 1106 Projection oldValue = proj; 1114 Bounds b = isDisplayingMapView() ? map.mapView.getRealBounds() : null;1107 Bounds b = main != null ? main.getRealBounds() : null; 1115 1108 proj = p; 1116 1109 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 1117 1129 } 1118 1130 … … 1139 1151 } 1140 1152 } 1141 if (newValue != null && oldBounds != null ) {1142 MainApplication.getMap().mapView.zoomTo(oldBounds);1153 if (newValue != null && oldBounds != null && main != null) { 1154 main.restoreOldBounds(oldBounds); 1143 1155 } 1144 1156 /* TODO - remove layers with fixed projection */
Note:
See TracChangeset
for help on using the changeset viewer.