Changeset 990 in josm


Ignore:
Timestamp:
Sep 18, 2008 4:50:16 PM (5 years ago)
Author:
stoecker
Message:

closed bug #1476 - invisible tram lines

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r987 r990  
    134134                        if (tmpWidth > width) width = tmpWidth; 
    135135                } 
     136                if(w.selected) 
     137                        color = selectedColor; 
    136138 
    137139                Node lastN; 
     
    146148                                        { 
    147149                                                if(lastN != null) 
    148                                                         drawSeg(lastN, n, s.color != null ? s.color : color, false, s.getWidth(width), s.dashed); 
     150                                                { 
     151                                                        drawSeg(lastN, n, s.color != null  && !w.selected ? s.color : color, 
     152                                                        false, s.getWidth(width), s.dashed); 
     153                                                } 
    149154                                                lastN = n; 
    150155                                        } 
     
    157162                { 
    158163                        if(lastN != null) 
    159                                 drawSeg(lastN, n, w.selected ? selectedColor : color, showDirection, width, dashed); 
     164                                drawSeg(lastN, n, color, showDirection, width, dashed); 
    160165                        lastN = n; 
    161166                } 
     
    171176                                        { 
    172177                                                if(lastN != null) 
    173                                                         drawSeg(lastN, n, s.color != null ? s.color : color, false, s.getWidth(width), s.dashed); 
     178                                                { 
     179                                                        drawSeg(lastN, n, s.color != null && !w.selected ? s.color : color, 
     180                                                        false, s.getWidth(width), s.dashed); 
     181                                                } 
    174182                                                lastN = n; 
    175183                                        } 
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java

    r987 r990  
    5151                String colorString; 
    5252                if(i < 0) // name only 
    53                         colorString = Main.pref.get("color.mappaint."+colString); 
     53                        colorString = Main.pref.get("color.mappaint."+styleName+"."+colString); 
    5454                else if(i == 0) // value only 
    5555                        colorString = colString; 
    5656                else // value and name 
    57                         colorString = Main.pref.get("color.mappaint."+colString.substring(0,i), colString.substring(i)); 
     57                        colorString = Main.pref.get("color.mappaint."+styleName+"."+colString.substring(0,i), colString.substring(i)); 
    5858                return ColorHelper.html2color(colorString); 
    5959        } 
     
    108108                        else if (qName.equals("linemod")) 
    109109                        { 
    110                                 hadLineMod = inLine = true; 
     110                                hadLineMod = inLineMod = true; 
    111111                                for (int count=0; count<atts.getLength(); count++) 
    112112                                { 
     
    116116                                                if(val.startsWith("+")) 
    117117                                                { 
    118                                                         rule.line.width = Integer.parseInt(val.substring(1)); 
    119                                                         rule.line.widthMode = LineElemStyle.WidthMode.OFFSET; 
     118                                                        rule.linemod.width = Integer.parseInt(val.substring(1)); 
     119                                                        rule.linemod.widthMode = LineElemStyle.WidthMode.OFFSET; 
    120120                                                } 
    121121                                                else if(val.startsWith("-")) 
    122122                                                { 
    123                                                         rule.line.width = Integer.parseInt(val); 
    124                                                         rule.line.widthMode = LineElemStyle.WidthMode.OFFSET; 
     123                                                        rule.linemod.width = Integer.parseInt(val); 
     124                                                        rule.linemod.widthMode = LineElemStyle.WidthMode.OFFSET; 
    125125                                                } 
    126126                                                else if(val.endsWith("%")) 
    127127                                                { 
    128                                                         rule.line.width = Integer.parseInt(val.substring(0, val.length()-1)); 
    129                                                         rule.line.widthMode = LineElemStyle.WidthMode.PERCENT; 
     128                                                        rule.linemod.width = Integer.parseInt(val.substring(0, val.length()-1)); 
     129                                                        rule.linemod.widthMode = LineElemStyle.WidthMode.PERCENT; 
    130130                                                } 
    131131                                                else 
    132                                                         rule.line.width = Integer.parseInt(val); 
     132                                                        rule.linemod.width = Integer.parseInt(val); 
    133133                                        } 
    134134                                        else if (atts.getQName(count).equals("colour")) 
    135                                                 rule.line.color=convertColor(atts.getValue(count)); 
     135                                                rule.linemod.color=convertColor(atts.getValue(count)); 
    136136                                        else if (atts.getQName(count).equals("realwidth")) 
    137                                                 rule.line.realWidth=Integer.parseInt(atts.getValue(count)); 
     137                                                rule.linemod.realWidth=Integer.parseInt(atts.getValue(count)); 
    138138                                        else if (atts.getQName(count).equals("dashed")) 
    139                                                 rule.line.dashed=Boolean.parseBoolean(atts.getValue(count)); 
    140                                         else if(atts.getQName(count).equals("priority")) 
    141                                                 rule.line.priority = Integer.parseInt(atts.getValue(count)); 
     139                                                rule.linemod.dashed=Boolean.parseBoolean(atts.getValue(count)); 
     140                                        else if(atts.getQName(count).equals("priority")) 
     141                                                rule.linemod.priority = Integer.parseInt(atts.getValue(count)); 
    142142                                        else if(atts.getQName(count).equals("mode")) 
    143                                                 rule.line.over = !atts.getValue(count).equals("under"); 
     143                                                rule.linemod.over = !atts.getValue(count).equals("under"); 
    144144                                } 
    145145                        } 
     
    180180                        if(hadLineMod) 
    181181                                styles.addModifier(styleName, rule.key, rule.value, rule.boolValue, 
    182                                 new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin)); 
     182                                new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin)); 
    183183                        if(hadIcon) 
    184184                                styles.add(styleName, rule.key, rule.value, rule.boolValue, 
     
    195195                else if (inLine && qName.equals("line")) 
    196196                        inLine = false; 
     197                else if (inLineMod && qName.equals("linemod")) 
     198                        inLineMod = false; 
    197199                else if (inIcon && qName.equals("icon")) 
    198200                        inIcon = false; 
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r987 r990  
    117117                AreaElemStyle retArea = null; 
    118118                LineElemStyle retLine = null; 
    119                 List<LineElemStyle> over = new LinkedList<LineElemStyle>(); 
     119                String linestring = null; 
     120                HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>(); 
    120121                Iterator<String> iterator = w.keys.keySet().iterator(); 
    121122                while(iterator.hasNext()) 
     
    129130                                retArea = styleArea; 
    130131                        if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 
     132                        { 
    131133                                retLine = styleLine; 
     134                                linestring = idx; 
     135                        } 
    132136                        if((styleLine = ss.modifiers.get(idx)) != null) 
    133                                 over.add(styleLine); 
     137                                over.put(idx, styleLine); 
    134138                        idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val); 
    135139                        if((styleArea = ss.areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority)) 
    136140                                retArea = styleArea; 
    137141                        if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 
     142                        { 
    138143                                retLine = styleLine; 
     144                                linestring = idx; 
     145                        } 
    139146                        if((styleLine = ss.modifiers.get(idx)) != null) 
    140                                 over.add(styleLine); 
     147                                over.put(idx, styleLine); 
    141148                        idx = "x" + key; 
    142149                        if((styleArea = ss.areas.get(idx)) != null && (retArea == null || styleArea.priority > retArea.priority)) 
    143150                                retArea = styleArea; 
    144151                        if((styleLine = ss.lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 
     152                        { 
    145153                                retLine = styleLine; 
     154                                linestring = idx; 
     155                        } 
    146156                        if((styleLine = ss.modifiers.get(idx)) != null) 
    147                                 over.add(styleLine); 
     157                                over.put(idx, styleLine); 
    148158                } 
     159                over.remove(linestring); 
    149160                if(over.size() != 0 && retLine != null) 
    150161                { 
    151                         Collections.sort(over); 
    152                         retLine = new LineElemStyle(retLine, over); 
     162                        List<LineElemStyle> s = new LinkedList<LineElemStyle>(over.values()); 
     163                        Collections.sort(s); 
     164                        retLine = new LineElemStyle(retLine, s); 
    153165                } 
    154166                if(retArea != null) 
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r885 r990  
    22 
    33import java.awt.Color; 
    4 import java.util.LinkedList; 
    5 import java.util.List; 
     4import java.util.Collection; 
    65 
    76public class LineElemStyle extends ElemStyle implements Comparable<LineElemStyle> 
     
    1615        public WidthMode widthMode; 
    1716 
    18         public List<LineElemStyle> overlays; 
     17        public Collection<LineElemStyle> overlays; 
    1918 
    2019        public LineElemStyle(LineElemStyle s, long maxScale, long minScale) { 
     
    3130        } 
    3231 
    33         public LineElemStyle(LineElemStyle s, List<LineElemStyle> overlays) { 
     32        public LineElemStyle(LineElemStyle s, Collection<LineElemStyle> overlays) { 
    3433                this.width = s.width; 
    3534                this.realWidth = s.realWidth; 
Note: See TracChangeset for help on using the changeset viewer.