diff --git a/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java b/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java
index bd45a5d..81eb6ec 100644
|
a
|
b
|
package org.openstreetmap.josm.data.osm.history;
|
| 4 | 4 | import java.util.Date; |
| 5 | 5 | |
| 6 | 6 | import org.openstreetmap.josm.data.coor.LatLon; |
| | 7 | import org.openstreetmap.josm.data.osm.Node; |
| 7 | 8 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| 8 | 9 | |
| 9 | 10 | /** |
| … |
… |
public class HistoryNode extends HistoryOsmPrimitive {
|
| 18 | 19 | |
| 19 | 20 | public HistoryNode(long id, long version, boolean visible, String user, long uid, long changesetId, Date timestamp, LatLon coords) { |
| 20 | 21 | super(id, version, visible, user, uid, changesetId, timestamp); |
| 21 | | setCoords(coords); |
| | 22 | this.coords = coords; |
| | 23 | } |
| | 24 | |
| | 25 | public HistoryNode(Node p) { |
| | 26 | super(p); |
| | 27 | this.coords = p.getCoor(); |
| 22 | 28 | } |
| 23 | 29 | |
| 24 | 30 | @Override |
diff --git a/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java b/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
index c22e6c9..78181c9 100644
|
a
|
b
|
import java.util.HashMap;
|
| 10 | 10 | import java.util.Locale; |
| 11 | 11 | import java.util.Map; |
| 12 | 12 | |
| | 13 | import org.openstreetmap.josm.data.osm.Node; |
| | 14 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 13 | 15 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| 14 | 16 | import org.openstreetmap.josm.data.osm.PrimitiveId; |
| | 17 | import org.openstreetmap.josm.data.osm.Relation; |
| 15 | 18 | import org.openstreetmap.josm.data.osm.SimplePrimitiveId; |
| | 19 | import org.openstreetmap.josm.data.osm.Way; |
| 16 | 20 | import org.openstreetmap.josm.tools.CheckParameterUtil; |
| 17 | 21 | |
| 18 | 22 | /** |
| … |
… |
public abstract class HistoryOsmPrimitive implements Comparable<HistoryOsmPrimit
|
| 69 | 73 | tags = new HashMap<String, String>(); |
| 70 | 74 | } |
| 71 | 75 | |
| | 76 | public HistoryOsmPrimitive(OsmPrimitive p) { |
| | 77 | this(p.getId(), p.getVersion(), p.isVisible(), |
| | 78 | p.getUser() == null ? null : p.getUser().getName(), |
| | 79 | p.getUser() == null ? 0 : p.getUser().getId(), |
| | 80 | p.getChangesetId(), p.getTimestamp()); |
| | 81 | } |
| | 82 | |
| | 83 | public static HistoryOsmPrimitive forOsmPrimitive(OsmPrimitive p) { |
| | 84 | if (p instanceof Node) { |
| | 85 | return new HistoryNode((Node) p); |
| | 86 | } else if (p instanceof Way) { |
| | 87 | return new HistoryWay((Way) p); |
| | 88 | } else if (p instanceof Relation) { |
| | 89 | return new HistoryRelation((Relation) p); |
| | 90 | } else { |
| | 91 | return null; |
| | 92 | } |
| | 93 | } |
| | 94 | |
| 72 | 95 | public long getId() { |
| 73 | 96 | return id; |
| 74 | 97 | } |
diff --git a/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java b/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java
index 86258c0..c632a2f 100644
|
a
|
b
|
import java.util.Date;
|
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | 10 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| | 11 | import org.openstreetmap.josm.data.osm.Relation; |
| 11 | 12 | import org.openstreetmap.josm.tools.CheckParameterUtil; |
| 12 | 13 | |
| 13 | 14 | /** |
| … |
… |
import org.openstreetmap.josm.tools.CheckParameterUtil;
|
| 17 | 18 | */ |
| 18 | 19 | public class HistoryRelation extends HistoryOsmPrimitive{ |
| 19 | 20 | |
| 20 | | private ArrayList<RelationMember> members; |
| | 21 | private ArrayList<RelationMember> members = new ArrayList<RelationMember>(); |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * constructor |
| … |
… |
public class HistoryRelation extends HistoryOsmPrimitive{
|
| 35 | 36 | public HistoryRelation(long id, long version, boolean visible, String user, long uid, long changesetId, |
| 36 | 37 | Date timestamp) throws IllegalArgumentException { |
| 37 | 38 | super(id, version, visible, user, uid, changesetId, timestamp); |
| 38 | | members = new ArrayList<RelationMember>(); |
| 39 | 39 | } |
| 40 | 40 | /** |
| 41 | 41 | * constructor |
| … |
… |
public class HistoryRelation extends HistoryOsmPrimitive{
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| | 62 | public HistoryRelation(Relation p) { |
| | 63 | super(p); |
| | 64 | } |
| | 65 | |
| 62 | 66 | /** |
| 63 | 67 | * replies an immutable list of members of this relation |
| 64 | 68 | * |
diff --git a/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java b/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java
index 83b9d08..2d4e249 100644
|
a
|
b
|
import java.util.Date;
|
| 9 | 9 | import java.util.List; |
| 10 | 10 | |
| 11 | 11 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType; |
| | 12 | import org.openstreetmap.josm.data.osm.Way; |
| 12 | 13 | /** |
| 13 | 14 | * Represents an immutable OSM way in the context of a historical view on |
| 14 | 15 | * OSM data. |
| … |
… |
import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
| 16 | 17 | */ |
| 17 | 18 | public class HistoryWay extends HistoryOsmPrimitive { |
| 18 | 19 | |
| 19 | | private ArrayList<Long> nodeIds; |
| | 20 | private ArrayList<Long> nodeIds = new ArrayList<Long>(); |
| 20 | 21 | |
| 21 | 22 | public HistoryWay(long id, long version, boolean visible, String user, long uid, long changesetId, Date timestamp) { |
| 22 | 23 | super(id, version, visible, user, uid, changesetId, timestamp); |
| 23 | | nodeIds = new ArrayList<Long>(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public HistoryWay(long id, long version, boolean visible, String user, long uid, long changesetId, Date timestamp, ArrayList<Long> nodeIdList) { |
| … |
… |
public class HistoryWay extends HistoryOsmPrimitive {
|
| 28 | 28 | this.nodeIds.addAll(nodeIdList); |
| 29 | 29 | } |
| 30 | 30 | |
| | 31 | public HistoryWay(Way p) { |
| | 32 | super(p); |
| | 33 | } |
| | 34 | |
| 31 | 35 | /** |
| 32 | 36 | * replies the number of nodes in this way |
| 33 | 37 | * @return the number of nodes |
diff --git a/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java b/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
index 222c8ad..4614c68 100644
|
a
|
b
|
public class HistoryBrowserModel extends Observable implements LayerChangeListen
|
| 144 | 144 | } |
| 145 | 145 | protected boolean canShowAsLatest(OsmPrimitive primitive) { |
| 146 | 146 | if (primitive == null) return false; |
| 147 | | if (primitive.isNew()) return false; |
| | 147 | if (primitive.isNew() || !primitive.isUsable()) return false; |
| | 148 | |
| | 149 | //try creating a history primitive. if that fails, the primitive cannot be used. |
| | 150 | try { |
| | 151 | HistoryOsmPrimitive.forOsmPrimitive(primitive); |
| | 152 | } catch (Exception ign) { |
| | 153 | return false; |
| | 154 | } |
| | 155 | |
| 148 | 156 | if (history == null) return false; |
| 149 | | // only show latest of the same version if it is |
| 150 | | // modified |
| | 157 | // only show latest of the same version if it is modified |
| 151 | 158 | if (history.getByVersion(primitive.getVersion()) != null) |
| 152 | 159 | return primitive.isModified(); |
| 153 | 160 | |