Changeset 12631 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-08-24T01:24:27+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 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 */ -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12630 r12631 51 51 import org.openstreetmap.josm.actions.PreferencesAction; 52 52 import org.openstreetmap.josm.actions.RestartAction; 53 import org.openstreetmap.josm.actions.mapmode.DrawAction; 53 54 import org.openstreetmap.josm.data.AutosaveTask; 55 import org.openstreetmap.josm.data.Bounds; 54 56 import org.openstreetmap.josm.data.CustomConfigurator; 55 57 import org.openstreetmap.josm.data.Version; 58 import org.openstreetmap.josm.data.osm.OsmPrimitive; 56 59 import org.openstreetmap.josm.data.validation.OsmValidator; 57 60 import org.openstreetmap.josm.gui.ProgramArguments.Option; … … 220 223 mainFrame.storeState(); 221 224 } 225 if (map != null) { 226 map.rememberToggleDialogWidth(); 227 } 222 228 super.shutdown(); 229 } 230 231 @Override 232 protected Bounds getRealBounds() { 233 return isDisplayingMapView() ? map.mapView.getRealBounds() : null; 234 } 235 236 @Override 237 protected void restoreOldBounds(Bounds oldBounds) { 238 if (isDisplayingMapView()) { 239 map.mapView.zoomTo(oldBounds); 240 } 241 } 242 243 @Override 244 public Collection<OsmPrimitive> getInProgressSelection() { 245 if (map != null && map.mapMode instanceof DrawAction) { 246 return ((DrawAction) map.mapMode).getInProgressSelection(); 247 } else { 248 return super.getInProgressSelection(); 249 } 223 250 } 224 251
Note:
See TracChangeset
for help on using the changeset viewer.