Ignore:
Timestamp:
2009-11-14T17:59:10+01:00 (14 years ago)
Author:
Gubaer
Message:

fixed #3352: History doesn't get invalidated on upload?
fixed #3912: Extend history dialog to contain the currently modified version
new: zoom to node in list of nodes in history dialog (popup menu)
new: load history of node from node list in history dialog (popup menu or double click)
fixed: close all history dialogs when the number of layers drop to 0
fixed: implemented equals() and hashCode() on SimplePrimitiveId
fixed: history features now usePrimitiveId instead of long.

File:
1 edited

Legend:

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

    r2242 r2448  
    1010
    1111import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     12import org.openstreetmap.josm.data.osm.PrimitiveId;
     13import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
    1214
    1315/**
     
    4547     * @param user  the user (! null required)
    4648     * @param uid the user id (> 0 required)
    47      * @param changesetId the changeset id (> 0 required)
     49     * @param changesetId the changeset id (may be null if the changeset isn't known)
    4850     * @param timestamp the timestamp (! null required)
    4951     *
     
    5355        ensurePositiveLong(id, "id");
    5456        ensurePositiveLong(version, "version");
    55         if(uid != -1) /* allow -1 for anonymous users */
     57        if(uid != -1) {
    5658            ensurePositiveLong(uid, "uid");
    57         ensurePositiveLong(changesetId, "changesetId");
     59        }
    5860        ensureNotNull(user, "user");
    5961        ensureNotNull(timestamp, "timestamp");
     
    6365        this.user = user;
    6466        this.uid = uid;
     67        // FIXME: restrict to IDs > 0 as soon as OsmPrimitive holds the
     68        // changeset id too
    6569        this.changesetId  = changesetId;
    6670        this.timestamp = timestamp;
     
    7175        return id;
    7276    }
     77
     78    public PrimitiveId getPrimitiveId() {
     79        return new SimplePrimitiveId(id, getType());
     80    }
     81
    7382    public boolean isVisible() {
    7483        return visible;
     
    103112    public int compareTo(HistoryOsmPrimitive o) {
    104113        if (this.id != o.id)
    105             throw new ClassCastException(tr("Can't compare primitive with ID ''{0}'' to primitive with ID ''{1}''.", o.id, this.id));
     114            throw new ClassCastException(tr("Can''t compare primitive with ID ''{0}'' to primitive with ID ''{1}''.", o.id, this.id));
    106115        return new Long(this.version).compareTo(o.version);
    107116    }
     
    121130    public Map<String,String> getTags() {
    122131        return Collections.unmodifiableMap(tags);
     132    }
     133
     134    /**
     135     * Sets the tags for this history primitive. Removes all
     136     * tags if <code>tags</code> is null.
     137     *
     138     * @param tags the tags. May be null.
     139     */
     140    public void setTags(Map<String,String> tags) {
     141        if (tags == null) {
     142            this.tags = new HashMap<String, String>();
     143        } else {
     144            this.tags = new HashMap<String, String>(tags);
     145        }
    123146    }
    124147
Note: See TracChangeset for help on using the changeset viewer.