Changeset 1289 in josm for trunk/src/org


Ignore:
Timestamp:
2009-01-17T23:45:34+01:00 (16 years ago)
Author:
stoecker
Message:

close #2028. patch by robome

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

Legend:

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

    r1282 r1289  
    1717import java.util.LinkedList;
    1818import java.util.Locale;
     19import java.util.Iterator;
    1920
    2021import javax.swing.ImageIcon;
     
    225226        boolean showDirection = w.selected || ((!useRealWidth) && (showDirectionArrow
    226227        && (!showRelevantDirectionsOnly || w.hasDirectionKeys)));
     228        // head only takes over control if the option is true,
     229        // the direction should be shown at all and not only because it's selected
     230        boolean showOnlyHeadArrowOnly = showDirection && !w.selected && showHeadArrowOnly;
    227231        int width = defaultSegmentWidth;
    228232        int realWidth = 0; //the real width of the element in meters
     
    270274        // draw the way
    271275        lastN = null;
    272         for(Node n : w.nodes)
    273         {
     276        Iterator<Node> it = w.nodes.iterator();
     277        while (it.hasNext())
     278        {
     279            Node n = it.next();
    274280            if(lastN != null)
    275                 drawSeg(lastN, n, color, showDirection, width, dashed);
     281                drawSeg(lastN, n, color,
     282                    showOnlyHeadArrowOnly ? !it.hasNext() : showDirection, width, dashed);
    276283            lastN = n;
    277284        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1251 r1289  
    6464    protected boolean showDirectionArrow;
    6565    protected boolean showRelevantDirectionsOnly;
     66    protected boolean showHeadArrowOnly;
    6667    protected boolean showOrderNumber;
    6768    protected boolean fillSelectedNode;
     
    101102        showDirectionArrow = Main.pref.getBoolean("draw.segment.direction", true);
    102103        showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only", true);
     104        showHeadArrowOnly = Main.pref.getBoolean("draw.segment.head_only", false);
    103105        showOrderNumber = Main.pref.getBoolean("draw.segment.order_number", false);
    104106        selectedNodeRadius = Main.pref.getInteger("mappaint.node.selected-size", 5) / 2;
     
    292294        boolean showThisDirectionArrow = w.selected
    293295        || (showDirectionArrow && (!showRelevantDirectionsOnly || w.hasDirectionKeys));
     296        // head only takes over control if the option is true,
     297        // the direction should be shown at all and not only because it's selected
     298        boolean showOnlyHeadArrowOnly = showThisDirectionArrow && !w.selected && showHeadArrowOnly;
    294299        Color wayColor;
    295300
     
    307312            for (int orderNumber = 1; it.hasNext(); orderNumber++) {
    308313                Point p = nc.getPoint(it.next().eastNorth);
    309                 drawSegment(lastP, p, w.selected && !inactive ? selectedColor : wayColor, showThisDirectionArrow);
     314                drawSegment(lastP, p, w.selected && !inactive ? selectedColor : wayColor,
     315                    showOnlyHeadArrowOnly ? !it.hasNext() : showThisDirectionArrow);
    310316                if (showOrderNumber)
    311317                    drawOrderNumber(lastP, p, orderNumber);
  • trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

    r1283 r1289  
    3434    private JTextField drawGpsArrowsMinDist = new JTextField(8);
    3535    private JCheckBox interestingDirections = new JCheckBox(tr("Only interesting direction hints (e.g. with oneway tag)."));
     36    private JCheckBox headArrow = new JCheckBox(tr("Only on the head of a way."));
    3637    private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers"));
    3738    private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data"));
     
    132133        directionHint.addActionListener(new ActionListener(){
    133134            public void actionPerformed(ActionEvent e) {
    134                             if (directionHint.isSelected()){
    135                                 interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only", true));
    136                             }else{
    137                                 interestingDirections.setSelected(false);
    138                             }
    139                             interestingDirections.setEnabled(directionHint.isSelected());
     135                if (directionHint.isSelected()){
     136                    interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only", true));
     137                    headArrow.setSelected(Main.pref.getBoolean("draw.segment.head_only", false));
     138                }else{
     139                    interestingDirections.setSelected(false);
     140                    headArrow.setSelected(false);
     141                }
     142                interestingDirections.setEnabled(directionHint.isSelected());
     143                headArrow.setEnabled(directionHint.isSelected());
    140144            }
    141145        });
     
    149153        interestingDirections.setEnabled(directionHint.isSelected());
    150154        panel.add(interestingDirections, GBC.eop().insets(40,0,0,0));
     155
     156        // only on the head of a way
     157        headArrow.setToolTipText(tr("Only on the head of a way."));
     158        headArrow.setSelected(Main.pref.getBoolean("draw.segment.head_only", false));
     159        headArrow.setEnabled(directionHint.isSelected());
     160        panel.add(headArrow, GBC.eop().insets(40, 0, 0, 0));
    151161
    152162        // segment order number
     
    194204        Main.pref.put("draw.segment.direction", directionHint.isSelected());
    195205        Main.pref.put("draw.segment.relevant_directions_only", interestingDirections.isSelected());
     206        Main.pref.put("draw.segment.head_only", headArrow.isSelected());
    196207        Main.pref.put("draw.segment.order_number", segmentOrderNumber.isSelected());
    197208        Main.pref.put("draw.data.downloaded_area", sourceBounds.isSelected());
Note: See TracChangeset for help on using the changeset viewer.