Changeset 2452 in josm
- Timestamp:
- 2009-11-14T21:37:38+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2450 r2452 233 233 allPrimitives.remove(primitive); 234 234 primitive.setDataset(null); 235 errors.remove(primitive); 235 236 firePrimitivesRemoved(Collections.singletonList(primitive)); 236 237 } … … 871 872 allPrimitives.clear(); 872 873 } 874 875 876 // TODO Should be part of validator 877 // This used to be OsmPrimitive.errors. I don't really like that such information is kept here, 878 // but at least it's not such memory waste as having it in (every) OsmPrimitive 879 private Map<OsmPrimitive, List<String>> errors = new HashMap<OsmPrimitive, List<String>>(); 880 881 void setErrors(OsmPrimitive primitive, List<String> errors) { 882 if (errors != null && !errors.isEmpty()) { 883 this.errors.put(primitive, errors); 884 } else { 885 this.errors.remove(primitive); 886 } 887 } 888 889 public List<String> getErrors(OsmPrimitive primitive) { 890 return errors.get(primitive); 891 } 873 892 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2450 r2452 97 97 /* mappaint data */ 98 98 public ElemStyle mappaintStyle = null; 99 public Integer mappaintVisibleCode = 0;100 99 public Integer mappaintDrawnCode = 0; 101 public Collection<String> errors; 102 103 public void putError(String text, Boolean isError) 100 101 public void putError(String text, boolean isError) 104 102 { 105 if(errors == null) { 103 checkDataset(); 104 List<String> errors = dataSet.getErrors(this); 105 if (errors == null) { 106 106 errors = new ArrayList<String>(); 107 107 } 108 108 String s = isError ? tr("Error: {0}", text) : tr("Warning: {0}", text); 109 109 errors.add(s); 110 dataSet.setErrors(this, errors); 110 111 } 111 112 public void clearErrors() 112 113 { 113 errors = null; 114 if (dataSet != null) { 115 dataSet.setErrors(this, null); 116 } 117 } 118 119 public List<String> getErrors() { 120 if (dataSet == null) 121 return null; 122 else 123 return dataSet.getErrors(this); 114 124 } 115 125 /* This should not be called from outside. Fixing the UI to add relevant … … 118 128 protected void clearCached() 119 129 { 120 mappaintVisibleCode = 0;121 130 mappaintDrawnCode = 0; 122 131 mappaintStyle = null; … … 798 807 user= osm.user; 799 808 clearCached(); 800 clearErrors();801 809 } 802 810 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r2450 r2452 148 148 (n.getEastNorth().east() < minEN.east() ) || 149 149 (n.getEastNorth().north() < minEN.north())) 150 {151 n.mappaintVisibleCode = viewid;152 150 return; 153 }154 n.mappaintVisibleCode = 0;155 151 156 152 IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(n); … … 186 182 public void drawWay(Way w, int fillAreas) { 187 183 if(w.getNodesCount() < 2) 188 {189 w.mappaintVisibleCode = viewid;190 184 return; 191 }192 185 193 186 /* check, if the way is visible at all */ … … 217 210 (maxx < minEN.east()) || 218 211 (maxy < minEN.north())) 219 {220 w.mappaintVisibleCode = viewid;221 212 return; 222 }223 213 224 214 ElemStyle wayStyle = getPrimitiveStyle(w); 225 215 226 216 if(!isZoomOk(wayStyle)) 227 {228 w.mappaintVisibleCode = viewid;229 217 return; 230 } 231 232 w.mappaintVisibleCode = 0; 218 233 219 if(fillAreas > dist) { 234 220 w.clearErrors(); … … 540 526 public void visit(Relation r) {}; 541 527 public void paintUnselectedRelation(Relation r) { 542 r.mappaintVisibleCode = 0;543 528 544 529 if (drawMultipolygon && "multipolygon".equals(r.get("type"))) … … 1046 1031 } 1047 1032 } 1048 if(!visible) /* nothing visible, so disable relation and all its ways */ 1049 { 1050 r.mappaintVisibleCode = viewid; 1051 for (Way wInner : inner) { 1052 wInner.mappaintVisibleCode = viewid; 1053 } 1054 for (Way wOuter : outer) { 1055 wOuter.mappaintVisibleCode = viewid; 1056 } 1033 if(!visible) 1057 1034 return drawn; 1058 }1059 1035 for (Way wInner : inner) 1060 1036 { … … 1510 1486 // profilerN = 0; 1511 1487 for (final Relation osm: data.getRelations()) { 1512 if (drawable(osm) && osm.mappaintVisibleCode != viewid) {1488 if (drawable(osm)) { 1513 1489 paintUnselectedRelation(osm); 1514 1490 // profilerN++; … … 1525 1501 // profilerN = 0; 1526 1502 for (final Way osm : selectedLast(data, data.searchWays(bbox))) { 1527 if (drawable(osm) 1528 && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid) { 1503 if (drawable(osm) && osm.mappaintDrawnCode != paintid) { 1529 1504 if (isPrimitiveArea(osm) && osm.mappaintDrawnAreaCode != paintid) { 1530 1505 drawWay(osm, fillAreas); … … 1560 1535 // profilerN = 0; 1561 1536 for (final Way way: data.getWays()) { 1562 if (drawable(way) && !data.isSelected(way) 1563 && way.mappaintVisibleCode != viewid) { 1537 if (drawable(way) && !data.isSelected(way)) { 1564 1538 drawWay(way, 0); 1565 1539 // profilerN++; … … 1579 1553 for (final OsmPrimitive osm : data.getSelected()) { 1580 1554 if (!osm.incomplete && !osm.isDeleted() && !(osm instanceof Node) 1581 && osm.mappaint VisibleCode != viewid && osm.mappaintDrawnCode != paintid1555 && osm.mappaintDrawnCode != paintid 1582 1556 ) { 1583 1557 osm.visit(new AbstractVisitor() { … … 1594 1568 //if(profilerOmitDraw) 1595 1569 // return; 1596 r.mappaintVisibleCode = 0;1597 1570 for (RelationMember m : r.getMembers()) { 1598 1571 if (m.isNode() && drawable(m.getMember())) { … … 1619 1592 for (final Node osm: data.searchNodes(bbox)) { 1620 1593 if (!osm.incomplete && !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered()) 1621 && osm.mappaint VisibleCode != viewid && osm.mappaintDrawnCode != paintid)1594 && osm.mappaintDrawnCode != paintid) 1622 1595 { 1623 1596 drawNode(osm); … … 1638 1611 currentColor = nodeColor; 1639 1612 for (final OsmPrimitive osm: data.searchWays(bbox)) { 1640 if (osm.isUsable() && !osm.isFiltered() 1641 && osm.mappaintVisibleCode != viewid ) 1613 if (osm.isUsable() && !osm.isFiltered()) 1642 1614 { 1643 1615 /* TODO: move this into the SimplePaint code? */ -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r2436 r2452 138 138 String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo); 139 139 name += (name.length() > 0) ? " ("+nodes+")" : nodes; 140 if(way. errors!= null) {140 if(way.getErrors() != null) { 141 141 name = "*"+name; 142 142 } … … 189 189 int mbno = relation.getMembersCount(); 190 190 name += trn("{0} member", "{0} members", mbno, mbno) + ")"; 191 if(relation. errors!= null) {191 if(relation.getErrors() != null) { 192 192 name = "*"+name; 193 193 }
Note:
See TracChangeset
for help on using the changeset viewer.