Changeset 227 in josm for src/org/openstreetmap
- Timestamp:
- 2007-05-07T23:17:41+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r220 r227 56 56 57 57 /** 58 * Visibility status as specified by the server. The visible attribute was 59 * introduced with the 0.4 API to be able to communicate deleted objects 60 * (they will have visible=false). Currently JOSM does never deal with 61 * these, so this is really for future use only. 62 */ 63 public boolean visible = true; 64 65 /** 66 * User that last modified this primitive, as specified by the server. 67 * Never changed by JOSM. 68 */ 69 public User user = null; 70 71 /** 58 72 * <code>true</code>, if the object has been shown. This property is not used 59 73 * internally by JOSM, but can be used by plugins that take over the object … … 182 196 deleted == osm.deleted && 183 197 (semanticOnly || (timestamp == null ? osm.timestamp==null : timestamp.equals(osm.timestamp))) && 198 (semanticOnly || (user == null ? osm.user==null : user==osm.user)) && 199 (semanticOnly || (visible == osm.visible)) && 184 200 (keys == null ? osm.keys==null : keys.equals(osm.keys)); 185 201 } -
src/org/openstreetmap/josm/io/OsmReader.java
r225 r227 6 6 import java.io.InputStream; 7 7 import java.io.InputStreamReader; 8 import java.lang.reflect.Array; 8 9 import java.text.ParseException; 10 import java.util.Arrays; 9 11 import java.util.Collection; 10 12 import java.util.HashMap; 13 import java.util.HashSet; 11 14 import java.util.LinkedList; 12 15 import java.util.Map; … … 20 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 24 import org.openstreetmap.josm.data.osm.Segment; 25 import org.openstreetmap.josm.data.osm.User; 22 26 import org.openstreetmap.josm.data.osm.Way; 23 27 import org.openstreetmap.josm.data.osm.visitor.AddVisitor; … … 76 80 osm.deleted = deleted; 77 81 osm.timestamp = timestamp; 82 osm.user = user; 83 osm.visible = visible; 78 84 } 79 85 } … … 84 90 */ 85 91 private Map<OsmPrimitiveData, long[]> segs = new HashMap<OsmPrimitiveData, long[]>(); 92 86 93 /** 87 94 * Data structure for the remaining way objects … … 89 96 private Map<OsmPrimitiveData, Collection<Long>> ways = new HashMap<OsmPrimitiveData, Collection<Long>>(); 90 97 98 /** 99 * List of protocol versions that will be accepted on reading 100 */ 101 private HashSet<String> allowedVersions = new HashSet<String>(); 91 102 92 103 private class Parser extends MinML2 { … … 101 112 if (atts == null) 102 113 throw new SAXException(tr("Unknown version")); 103 if (! Main.pref.get("osm-server.version", "0.4").equals(atts.getValue("version")))114 if (!allowedVersions.contains(atts.getValue("version"))) 104 115 throw new SAXException(tr("Unknown version")+": "+atts.getValue("version")); 105 116 } else if (qName.equals("node")) { … … 138 149 } 139 150 } 151 152 /** 153 * Constructor initializes list of allowed protocol versions. 154 */ 155 public OsmReader() { 156 // first add the main server version 157 allowedVersions.add(Main.pref.get("osm-server.version", "0.4")); 158 // now also add all compatible versions 159 String[] additionalVersions = 160 Main.pref.get("osm-server.additional-versions", "0.3").split("/,/"); 161 allowedVersions.addAll(Arrays.asList(additionalVersions)); 162 } 140 163 141 164 /** … … 155 178 throw new SAXException(tr("Couldn''t read time format \"{0}\".",time)); 156 179 } 180 } 181 182 // user attribute added in 0.4 API 183 String user = atts.getValue("user"); 184 if (user != null) { 185 // do not store literally; get object reference for string 186 current.user = User.get(user); 187 } 188 189 // visible attribute added in 0.4 API 190 String visible = atts.getValue("visible"); 191 if (visible != null) { 192 current.visible = Boolean.parseBoolean(visible); 157 193 } 158 194 -
src/org/openstreetmap/josm/io/OsmWriter.java
r225 r227 153 153 154 154 /** 155 * Add the common part as the from of the tag as well as the id or the action tag. 155 * Add the common part as the form of the tag as well as the XML attributes 156 * id, action, user, and visible. 156 157 */ 157 158 private void addCommon(OsmPrimitive osm, String tagname) { … … 170 171 out.print(" timestamp='"+time+"'"); 171 172 } 173 // user and visible added with 0.4 API 174 if (osm.user != null) { 175 out.print(" user='"+XmlWriter.encode(osm.user.name)+"'"); 176 } 177 out.print(" visible='"+osm.visible+"'"); 178 172 179 } 173 180 }
Note:
See TracChangeset
for help on using the changeset viewer.