Ignore:
Timestamp:
2009-10-24T21:22:49+02:00 (15 years ago)
Author:
jttt
Message:

Use PrimitiveData for Copy, Paste and Paste tags actions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2300 r2305  
    3636abstract public class OsmPrimitive implements Comparable<OsmPrimitive>, Tagged {
    3737
    38     static final AtomicLong idCounter = new AtomicLong(0);
     38    private static final AtomicLong idCounter = new AtomicLong(0);
     39
     40    static long generateUniqueId() {
     41        return idCounter.decrementAndGet();
     42    }
    3943
    4044    private static final int FLAG_MODIFIED = 1 << 0;
     
    164168                throw new IllegalArgumentException(tr("Expected ID >= 0. Got {0}.", id));
    165169            else if (id == 0) {
    166                 this.id = idCounter.decrementAndGet();
     170                this.id = generateUniqueId();
    167171            } else {
    168172                this.id = id;
     
    400404     */
    401405    public void clearOsmId() {
    402         this.id = idCounter.decrementAndGet();
     406        this.id = generateUniqueId();
    403407        this.version = 0;
    404408        this.incomplete = false;
     
    456460        if(directionKeys == null) {
    457461            directionKeys = Main.pref.getCollection("tags.direction",
    458                     Arrays.asList(new String[]{"oneway","incline","incline_steep","aerialway"}));
     462                    Arrays.asList("oneway","incline","incline_steep","aerialway"));
    459463        }
    460464        return directionKeys;
     
    841845
    842846    protected void saveCommonAttributes(PrimitiveData data) {
    843         data.setId(data.getId());
     847        data.setId(id);
    844848        data.getKeys().clear();
    845849        data.getKeys().putAll(getKeys());
Note: See TracChangeset for help on using the changeset viewer.