Changeset 735 in josm
- Timestamp:
- 2008-07-24T12:06:08+02:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 3 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 -
trunk/styles/standard/elemstyles.xml
r733 r735 19 19 <!-- mark some specials that should be fixed - they are already the default and therefore shouldn't be tagged --> 20 20 <rule> 21 <condition k="oneway" v="yes"/>21 <condition k="oneway"/> 22 22 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 23 23 <icon annotate="true" src="misc/deprecated.png" /> … … 26 26 </rule> 27 27 <rule> 28 <condition k="oneway" v="1"/> 29 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 30 <icon annotate="true" src="misc/deprecated.png" /> 31 <scale_min>1</scale_min> 32 <scale_max>40000</scale_max> 33 </rule> 34 <rule> 35 <condition k="oneway" v="-1"/> 36 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 37 <icon annotate="true" src="misc/deprecated.png" /> 38 <scale_min>1</scale_min> 39 <scale_max>40000</scale_max> 40 </rule> 41 <rule> 42 <condition k="oneway" v="true"/> 43 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 44 <icon annotate="true" src="misc/deprecated.png" /> 45 <scale_min>1</scale_min> 46 <scale_max>40000</scale_max> 47 </rule> 48 <rule> 49 <condition k="oneway" v="no"/> 50 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 51 <icon annotate="true" src="misc/deprecated.png" /> 52 <scale_min>1</scale_min> 53 <scale_max>40000</scale_max> 54 </rule> 55 <rule> 56 <condition k="oneway" v="false"/> 57 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 58 <icon annotate="true" src="misc/deprecated.png" /> 59 <scale_min>1</scale_min> 60 <scale_max>40000</scale_max> 61 </rule> 62 <rule> 63 <condition k="bridge" v="yes"/> 28 <condition k="bridge" b="yes"/> 64 29 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 65 30 <icon annotate="true" src="vehicle/viaduct.png" /> … … 68 33 </rule> 69 34 <rule> 70 <condition k="bridge" v="true"/> 71 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 72 <icon annotate="true" src="vehicle/viaduct.png" /> 73 <scale_min>1</scale_min> 74 <scale_max>40000</scale_max> 75 </rule> 76 <rule> 77 <condition k="bridge" v="false"/> 78 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 79 <icon annotate="true" src="misc/deprecated.png" /> 80 <scale_min>1</scale_min> 81 <scale_max>40000</scale_max> 82 </rule> 83 <rule> 84 <condition k="bridge" v="no"/> 35 <condition k="bridge" b="no"/> 85 36 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 86 37 <icon annotate="true" src="misc/deprecated.png" /> … … 110 61 </rule> 111 62 <rule> 112 <condition k="tunnel" v="yes"/>63 <condition k="tunnel" b="yes"/> 113 64 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 114 65 <icon annotate="true" src="vehicle/tunnel.png" /> … … 117 68 </rule> 118 69 <rule> 119 <condition k="tunnel" v="true"/> 120 <!-- no line or area, as this is a highway=xy, railway=xy, .... --> 121 <icon annotate="true" src="vehicle/tunnel.png" /> 122 <scale_min>1</scale_min> 123 <scale_max>40000</scale_max> 124 </rule> 125 <rule> 126 <condition k="tunnel" v="false"/> 70 <condition k="tunnel" b="no"/> 127 71 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 128 72 <icon annotate="true" src="misc/deprecated.png" /> … … 131 75 </rule> 132 76 <rule> 133 <condition k=" tunnel" v="no"/>77 <condition k="cutting" b="no"/> 134 78 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 135 79 <icon annotate="true" src="misc/deprecated.png" /> … … 138 82 </rule> 139 83 <rule> 140 <condition k="cutting" v="false"/> 141 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 142 <icon annotate="true" src="misc/deprecated.png" /> 143 <scale_min>1</scale_min> 144 <scale_max>40000</scale_max> 145 </rule> 146 <rule> 147 <condition k="embankment" v="false"/> 84 <condition k="embankment" b="no"/> 148 85 <line width="2" realwidth="5" dashed="true" colour="#ff0000"/> 149 86 <icon annotate="true" src="misc/deprecated.png" />
Note:
See TracChangeset
for help on using the changeset viewer.