Ignore:
Timestamp:
2009-07-19T19:04:49+02:00 (15 years ago)
Author:
Gubaer
Message:

removed dependencies to Main.ds, removed Main.ds
removed AddVisitor, NameVisitor, DeleteVisitor - unnecessary double dispatching for these simple cases

File:
1 edited

Legend:

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

    r1811 r1814  
    7777     */
    7878    public static Preferences pref = new Preferences();
    79     /**
    80      * The global dataset.
    81      */
    82     public static DataSet ds = new DataSet();
     79
    8380    /**
    8481     * The global paste buffer.
     
    167164        if (map != null) {
    168165            map.mapView.removeLayer(layer);
    169             if (layer instanceof OsmDataLayer) {
    170                 ds = new DataSet();
    171             }
    172166            if (map.mapView.getAllLayers().isEmpty()) {
    173167                setMapFrame(null);
     
    224218        map.mapView.addLayer(layer);
    225219    }
    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 instance
    229      * of {@see OsmDataLayer}.
     220
     221    /**
     222     * Replies true if there is an edit layer which is currently
     223     * active
    230224     *
    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() {
    246229        if (map == null) return false;
    247230        if (map.mapView == null) return false;
    248231        if (map.mapView.getEditLayer() == null) return false;
    249232        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;
    250254    }
    251255
     
    495499        pref.put("gui.geometry", newGeometry);
    496500    }
     501
     502
    497503}
Note: See TracChangeset for help on using the changeset viewer.