Changeset 1814 in josm for trunk/src/org/openstreetmap/josm/Main.java
- Timestamp:
- 2009-07-19T19:04:49+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1811 r1814 77 77 */ 78 78 public static Preferences pref = new Preferences(); 79 /** 80 * The global dataset. 81 */ 82 public static DataSet ds = new DataSet(); 79 83 80 /** 84 81 * The global paste buffer. … … 167 164 if (map != null) { 168 165 map.mapView.removeLayer(layer); 169 if (layer instanceof OsmDataLayer) {170 ds = new DataSet();171 }172 166 if (map.mapView.getAllLayers().isEmpty()) { 173 167 setMapFrame(null); … … 224 218 map.mapView.addLayer(layer); 225 219 } 226 /** 227 * Replies the current edit layer. Creates one if no {@see OsmDataLayer}228 * exists. Replies null, if the currently active layer isn't an instance229 * of {@see OsmDataLayer}.220 221 /** 222 * Replies true if there is an edit layer which is currently 223 * active 230 224 * 231 * @return the current edit layer 232 */ 233 public final OsmDataLayer createOrGetEditLayer() { 234 if (map == null || map.mapView.getEditLayer() == null) { 235 menu.newAction.actionPerformed(null); 236 } 237 return map.mapView.getEditLayer(); 238 } 239 240 /** 241 * Replies true if this map view has an edit layer 242 * 243 * @return true if this map view has an edit layer 244 */ 245 public boolean hasEditLayer() { 225 * @return true if there is an edit layer which is currently 226 * active 227 */ 228 public boolean hasActiveEditLayer() { 246 229 if (map == null) return false; 247 230 if (map.mapView == null) return false; 248 231 if (map.mapView.getEditLayer() == null) return false; 249 232 return true; 233 } 234 235 /** 236 * Replies the current edit layer 237 * 238 * @return the current edit layer. null, if no current edit layer exists 239 */ 240 public OsmDataLayer getEditLayer() { 241 if (map == null) return null; 242 if (map.mapView == null) return null; 243 return map.mapView.getEditLayer(); 244 } 245 246 /** 247 * Replies the current data set. 248 * 249 * @return the current data set. null, if no current data set exists 250 */ 251 public DataSet getCurrentDataSet() { 252 if (!hasActiveEditLayer()) return null; 253 return getEditLayer().data; 250 254 } 251 255 … … 495 499 pref.put("gui.geometry", newGeometry); 496 500 } 501 502 497 503 }
Note:
See TracChangeset
for help on using the changeset viewer.