Changeset 1598 in josm for trunk/src/org
- Timestamp:
- 2009-05-18T19:47:22+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r1488 r1598 104 104 myVersion = Integer.parseInt(version.split(" ")[0]); 105 105 } catch (NumberFormatException e) { 106 e.printStackTrace();106 // e.printStackTrace(); 107 107 } 108 108 return myVersion; … … 201 201 for (String line = in.readLine(); line != null; line = in.readLine()) 202 202 s += line + "\n"; 203 if(manifest) 204 { 203 if (manifest) { 205 204 s = Pattern.compile("\n ", Pattern.DOTALL).matcher(s).replaceAll(""); 206 205 s = Pattern.compile("^(SHA1-Digest|Name): .*?$", Pattern.DOTALL|Pattern.MULTILINE).matcher(s).replaceAll(""); … … 210 209 area.setCaretPosition(0); 211 210 } catch (IOException e) { 212 e.printStackTrace(); 211 System.err.println("Cannot load resource " + resource + ": " + e.getMessage()); 212 //e.printStackTrace(); 213 213 } 214 214 return area; -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r1596 r1598 106 106 } 107 107 108 // seems to be different from member "incomplete" - FIXME 108 109 public boolean isIncomplete() { 109 110 for (RelationMember m : members) … … 114 115 115 116 public RelationMember firstMember() { 117 if (incomplete) return null; 116 118 return (members.size() == 0) ? null : members.get(0); 117 119 } 118 120 public RelationMember lastMember() { 121 if (incomplete) return null; 119 122 return (members.size() == 0) ? null : members.get(members.size() -1); 120 123 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r1499 r1598 31 31 public Integer mappaintDrawnAreaCode = 0; 32 32 /* end of mappaint data */ 33 @Override protected void clearCached() 34 { 33 @Override protected void clearCached() { 35 34 super.clearCached(); 36 35 isMappaintArea = false; … … 39 38 40 39 public void visitNodes(Visitor v) { 40 if (incomplete) return; 41 41 for (Node n : this.nodes) 42 42 v.visit(n); … … 45 45 public ArrayList<Pair<Node,Node>> getNodePairs(boolean sort) { 46 46 ArrayList<Pair<Node,Node>> chunkSet = new ArrayList<Pair<Node,Node>>(); 47 if (incomplete) return chunkSet; 47 48 Node lastN = null; 48 49 for (Node n : this.nodes) { … … 70 71 */ 71 72 public Way(Way clone) { 72 73 cloneFrom(clone); 73 74 } 74 75 … … 95 96 96 97 @Override public String toString() { 98 if (incomplete) return "{Way id="+id+" version="+version+" (incomplete)}"; 97 99 return "{Way id="+id+" version="+version+" nodes="+Arrays.toString(nodes.toArray())+"}"; 98 100 } … … 103 105 104 106 public int compareTo(OsmPrimitive o) { 105 if (o instanceof Relation)107 if (o instanceof Relation) 106 108 return 1; 107 109 return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1; … … 132 134 } 133 135 134 public void removeNode(Node n) 135 {136 Boolean closed = (lastNode() == n && firstNode() == n);136 public void removeNode(Node n) { 137 if (incomplete) return; 138 boolean closed = (lastNode() == n && firstNode() == n); 137 139 int i; 138 while ((i = nodes.indexOf(n)) >= 0)140 while ((i = nodes.indexOf(n)) >= 0) 139 141 nodes.remove(i); 140 142 i = nodes.size(); 141 if (closed && i > 2) // close again143 if (closed && i > 2) // close again 142 144 addNode(firstNode()); 143 145 // prevent closed ways with less than 3 different nodes 144 else if (i >= 2 && i <= 3 && nodes.get(0) == nodes.get(i-1))146 else if (i >= 2 && i <= 3 && nodes.get(0) == nodes.get(i-1)) 145 147 nodes.remove(i-1); 146 148 } 147 149 148 public void removeNodes(Collection<? extends OsmPrimitive> selection) 149 { 150 for(OsmPrimitive p : selection) 151 { 152 if(p instanceof Node) 153 { 150 public void removeNodes(Collection<? extends OsmPrimitive> selection) { 151 if (incomplete) return; 152 for(OsmPrimitive p : selection) { 153 if (p instanceof Node) { 154 154 removeNode((Node)p); 155 155 } … … 157 157 } 158 158 159 public void addNode(Node n) 160 {159 public void addNode(Node n) { 160 if (incomplete) return; 161 161 clearCached(); 162 162 nodes.add(n); 163 163 } 164 164 165 public void addNode(int offs, Node n) 166 {165 public void addNode(int offs, Node n) { 166 if (incomplete) return; 167 167 clearCached(); 168 168 nodes.add(offs, n); 169 169 } 170 170 171 public Boolean isClosed() { 171 public boolean isClosed() { 172 if (incomplete) return false; 172 173 return nodes.size() >= 3 && lastNode() == firstNode(); 173 174 } 174 175 175 176 public Node lastNode() { 177 if (incomplete) return null; 176 178 return nodes.get(nodes.size()-1); 177 179 } 178 180 179 181 public Node firstNode() { 182 if (incomplete) return null; 180 183 return nodes.get(0); 181 184 } 182 185 183 186 public boolean isFirstLastNode(Node n) { 187 if (incomplete) return false; 184 188 return n == firstNode() || n == lastNode(); 185 189 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
r1596 r1598 382 382 Node n2 = null; 383 383 RelationMember m = em; 384 while ( true) {384 while (m != null) { 385 385 if (m.member instanceof Way) { 386 386 n1 = ((Way) m.member).lastNode(); … … 394 394 if (i<clone.members.size()-1) { 395 395 m = clone.members.get(i+1); 396 while ( true) {396 while (m != null) { 397 397 if (m.member instanceof Way) { 398 398 n2 = ((Way) (m.member)).firstNode();
Note:
See TracChangeset
for help on using the changeset viewer.