Ignore:
Timestamp:
2010-12-21T11:44:19+01:00 (11 years ago)
Author:
Upliner
Message:

fix #5756 -- allow to overwrite offset bookmarks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r3720 r3734  
    99import java.util.LinkedList;
    1010import java.util.List;
     11import java.util.ListIterator;
    1112
    1213import org.openstreetmap.josm.Main;
     
    7677    }
    7778
     79    public static OffsetBookmark getBookmarkByName(ImageryLayer layer, String name) {
     80        for (OffsetBookmark b : allBookmarks) {
     81            if (b.isUsable(layer) && name.equals(b.name))
     82                return b;
     83        }
     84        return null;
     85    }
     86
     87    public static void bookmarkOffset(String name, ImageryLayer layer) {
     88        OffsetBookmark nb = new OffsetBookmark(
     89                Main.proj, layer.getInfo().getName(),
     90                name, layer.getDx(), layer.getDy());
     91        for (ListIterator<OffsetBookmark> it = allBookmarks.listIterator();it.hasNext();) {
     92            OffsetBookmark b = it.next();
     93            if (b.isUsable(layer) && name.equals(b.name)) {
     94                it.set(nb);
     95                saveBookmarks();
     96                return;
     97            }
     98        }
     99        allBookmarks.add(nb);
     100        saveBookmarks();
     101    }
    78102}
Note: See TracChangeset for help on using the changeset viewer.