- Timestamp:
- 2008-07-24T12:06:08+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
r627 r735 17 17 String curKey = null; 18 18 String curValue = null; 19 String curBoolean = null; 19 20 int curLineWidth = -1; 20 21 int curLineRealWidth = 0; … … 56 57 for (int count=0; count<atts.getLength(); count++) { 57 58 if(atts.getQName(count).equals("k")) 58 curKey = atts.getValue(count); 59 { 60 curKey = atts.getValue(count); 61 curBoolean = null; 62 curValue = null; 63 } 59 64 else if(atts.getQName(count).equals("v")) 60 curValue = atts.getValue(count); 65 curValue = atts.getValue(count); 66 else if(atts.getQName(count).equals("b")) 67 curBoolean = atts.getValue(count); 61 68 } 62 69 } else if (qName.equals("line")) { … … 127 134 newStyle = new LineElemStyle(curLineWidth, curLineRealWidth, curLineColour, 128 135 curLineDashed, curScaleMax, curScaleMin); 129 MapPaintStyles.add(curKey, curValue, newStyle);136 MapPaintStyles.add(curKey, curValue, curBoolean, newStyle); 130 137 curLineWidth = -1; 131 138 curLineRealWidth= 0; … … 136 143 if (curIcon != null) { 137 144 newStyle = new IconElemStyle(curIcon, curIconAnnotate, curScaleMax, curScaleMin); 138 MapPaintStyles.add(curKey, curValue, newStyle);145 MapPaintStyles.add(curKey, curValue, curBoolean, newStyle); 139 146 curIcon = null; 140 147 curIconAnnotate = true; … … 142 149 if (curAreaColour != null) { 143 150 newStyle = new AreaElemStyle (curAreaColour, curScaleMax, curScaleMin); 144 MapPaintStyles.add(curKey, curValue, newStyle);151 MapPaintStyles.add(curKey, curValue, curBoolean, newStyle); 145 152 curAreaColour = null; 146 153 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r627 r735 9 9 import org.openstreetmap.josm.Main; 10 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 import org.openstreetmap.josm.data.osm.OsmUtils; 11 12 import org.xml.sax.InputSource; 12 13 import org.xml.sax.XMLReader; … … 75 76 } 76 77 77 static int nr = 0;78 // static int nr = 0; 78 79 79 public static void add (String k, String v, ElemStyle style) {80 public static void add (String k, String v, String b, ElemStyle style) { 80 81 ElemStyle old_style; 81 String key = k + "=" + v;82 String key; 82 83 83 84 /* unfortunately, there don't seem to be an efficient way to */ 84 85 /* find out, if a given OsmPrimitive is an area or not, */ 85 86 /* so distinguish only between way and node here - for now */ 86 if (style instanceof AreaElemStyle) { 87 key = key + "way"; 88 } else if (style instanceof LineElemStyle) { 89 key = key + "way"; 90 } else if (style instanceof IconElemStyle) { 91 key = key + "node"; 92 } 87 if (style instanceof AreaElemStyle) 88 key = "way"; 89 else if (style instanceof LineElemStyle) 90 key = "way"; 91 else if (style instanceof IconElemStyle) 92 key = "node"; 93 else 94 key = ""; 95 96 if(v != null) 97 key += "n" + k + "=" + v; 98 else if(b != null) 99 key += "b" + k + "=" + OsmUtils.getNamedOsmBoolean(b); 100 else 101 key += "x" + k; 102 93 103 /* avoid duplicates - for now */ 94 104 old_style = styles.get(key); … … 120 130 { 121 131 String key = iterator.next(); 122 kv = key + "=" + p.keys.get(key) + classname;123 if (styles.containsKey(kv)) {132 kv = classname + "n" + key + "=" + p.keys.get(key); 133 if (styles.containsKey(kv)) 124 134 return styles.get(kv); 125 } 135 kv = classname + "b" + key + "=" + OsmUtils.getNamedOsmBoolean(p.keys.get(key)); 136 if (styles.containsKey(kv)) 137 return styles.get(kv); 138 kv = classname + "x" + key; 139 if (styles.containsKey(kv)) 140 return styles.get(kv); 126 141 } 127 142 128 143 // not a known key/value combination 129 boolean first_line = true;144 // boolean first_line = true; 130 145 131 146 // filter out trivial tags and show the rest 132 iterator = p.keys.keySet().iterator();133 while (iterator.hasNext()) {134 String key = iterator.next();135 kv = key + "=" + p.keys.get(key);136 if (!kv.startsWith("created_by=") &&137 !kv.startsWith("converted_by=") &&138 !kv.startsWith("source=") &&139 !kv.startsWith("note=") &&140 !kv.startsWith("layer=") &&141 !kv.startsWith("bridge=") &&142 !kv.startsWith("tunnel=") &&143 !kv.startsWith("oneway=") &&144 !kv.startsWith("speedlimit=") &&145 !kv.startsWith("motorcar=") &&146 !kv.startsWith("horse=") &&147 !kv.startsWith("bicycle=") &&148 !kv.startsWith("foot=")149 ) {147 // iterator = p.keys.keySet().iterator(); 148 // while (iterator.hasNext()) { 149 // String key = iterator.next(); 150 // kv = key + "=" + p.keys.get(key); 151 // if (!kv.startsWith("created_by=") && 152 // !kv.startsWith("converted_by=") && 153 // !kv.startsWith("source=") && 154 // !kv.startsWith("note=") && 155 // !kv.startsWith("layer=") && 156 // !kv.startsWith("bridge=") && 157 // !kv.startsWith("tunnel=") && 158 // !kv.startsWith("oneway=") && 159 // !kv.startsWith("speedlimit=") && 160 // !kv.startsWith("motorcar=") && 161 // !kv.startsWith("horse=") && 162 // !kv.startsWith("bicycle=") && 163 // !kv.startsWith("foot=") 164 // ) { 150 165 151 if (first_line) {152 nr++;153 //System.out.println("mappaint - rule not found[" + nr + "]: " + kv + " id:" + p.id);154 } else {155 //System.out.println("mappaint - rule not found[" + nr + "]: " + kv);156 }157 first_line=false;158 }159 }166 // if (first_line) { 167 // nr++; 168 // System.out.println("mappaint - rule not found[" + nr + "]: " + kv + " id:" + p.id); 169 // } else { 170 // System.out.println("mappaint - rule not found[" + nr + "]: " + kv); 171 // } 172 // first_line=false; 173 // } 174 // } 160 175 } 161 176
Note:
See TracChangeset
for help on using the changeset viewer.