Changeset 3994 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2011-03-18T00:22:13+01:00 (13 years ago)
Author:
mjulius
Message:

fix #6113 - removing "mandatory" arrows on some types of ways
Since oneway arrows are now different from way direction arrows they need to be treated separately.
They now can be turned on and off independently.

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

Legend:

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

    r3862 r3994  
    1414    private boolean useRealWidth;
    1515    private boolean showDirectionArrow;
    16     private boolean showRelevantDirectionsOnly;
     16    private boolean showOnewayArrow;
    1717    private int defaultSegmentWidth;
    1818    private boolean showOrderNumber;
     
    4646    private void load() {
    4747        showDirectionArrow = Main.pref.getBoolean("draw.segment.direction", true);
    48         showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only", true);
     48        showOnewayArrow = Main.pref.getBoolean("draw.oneway", true);
    4949        useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false);
    5050        defaultSegmentWidth = Main.pref.getInteger("mappaint.segment.default-width", 2);
     
    8181
    8282        outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false);
    83        
     83
    8484    }
    8585
     
    9696    }
    9797
    98     public boolean isShowRelevantDirectionsOnly() {
    99         return showRelevantDirectionsOnly;
     98    public boolean isShowOnewayArrow() {
     99        return showOnewayArrow;
    100100    }
    101101
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/SimplePaintVisitor.java

    r3895 r3994  
    6363    protected Color taggedConnectionColor;
    6464    protected boolean showDirectionArrow;
    65     protected boolean showRelevantDirectionsOnly;
     65    protected boolean showOnewayArrow;
    6666    protected boolean showHeadArrowOnly;
    6767    protected boolean showOrderNumber;
     
    109109        MapPaintSettings settings = MapPaintSettings.INSTANCE;
    110110        showDirectionArrow = settings.isShowDirectionArrow();
    111         showRelevantDirectionsOnly = settings.isShowRelevantDirectionsOnly();
     111        showOnewayArrow = settings.isShowOnewayArrow();
    112112        showHeadArrowOnly = settings.isShowHeadArrowOnly();
    113113        showOrderNumber = settings.isShowOrderNumber();
     
    333333           (even if the tag is negated as in oneway=false) or the way is selected */
    334334
    335         boolean showThisDirectionArrow = ds.isSelected(w)
    336         || (showDirectionArrow && (!showRelevantDirectionsOnly || w.hasDirectionKeys()));
     335        boolean showThisDirectionArrow = ds.isSelected(w) || showDirectionArrow;
    337336        /* head only takes over control if the option is true,
    338337           the direction should be shown at all and not only because it's selected */
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3992 r3994  
    121121                }
    122122            }
    123             if (!hasPositive || dashes.length == 0) {
     123            if (!hasPositive || (dashes != null && dashes.length == 0)) {
    124124                dashes = null;
    125125            }
     
    198198        the way is tagged with a direction key
    199199        (even if the tag is negated as in oneway=false) or the way is selected */
    200         boolean showOrientation = !isModifier && selected && !paintSettings.isUseRealWidth();
     200        boolean showOrientation = !isModifier && (selected || paintSettings.isShowDirectionArrow()) && !paintSettings.isUseRealWidth();
    201201        boolean showOneway = !isModifier && !selected &&
    202                 !paintSettings.isUseRealWidth() &&
    203                 paintSettings.isShowDirectionArrow() && w.hasDirectionKeys();
     202        !paintSettings.isUseRealWidth() &&
     203        paintSettings.isShowOnewayArrow() && w.hasDirectionKeys();
    204204        boolean onewayReversed = w.reversedDirection();
    205205        /* head only takes over control if the option is true,
     
    215215                myWidth = line.getLineWidth();
    216216            }
    217             myLine = new BasicStroke(myWidth, line.getEndCap(), line.getLineJoin(), 
     217            myLine = new BasicStroke(myWidth, line.getEndCap(), line.getLineJoin(),
    218218                    line.getMiterLimit(), line.getDashArray(), line.getDashPhase());
    219219            if (dashesLine != null) {
     
    259259        final LineElemStyle other = (LineElemStyle) obj;
    260260        return  equal(line, other.line) &&
    261                 equal(color, other.color) &&
    262                 equal(dashesLine, other.dashesLine) &&
    263                 equal(dashesBackground, other.dashesBackground) &&
    264                 equal(text, other.text) &&
    265                 realWidth == other.realWidth;
     261        equal(color, other.color) &&
     262        equal(dashesLine, other.dashesLine) &&
     263        equal(dashesBackground, other.dashesBackground) &&
     264        equal(text, other.text) &&
     265        realWidth == other.realWidth;
    266266    }
    267267
     
    281281    public String toString() {
    282282        return "LineElemStyle{" + super.toString() + "width=" + line.getLineWidth() +
    283                 " realWidth=" + realWidth + " color=" + Utils.toString(color) +
    284                 " dashed=" + Arrays.toString(line.getDashArray()) +
    285                 (line.getDashPhase() == 0f ? "" : " dashesOffses=" + line.getDashPhase()) +
    286                 " dashedColor=" + Utils.toString(dashesBackground) + '}';
     283        " realWidth=" + realWidth + " color=" + Utils.toString(color) +
     284        " dashed=" + Arrays.toString(line.getDashArray()) +
     285        (line.getDashPhase() == 0f ? "" : " dashesOffses=" + line.getDashPhase()) +
     286        " dashedColor=" + Utils.toString(dashesBackground) + '}';
    287287    }
    288288}
  • trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

    r3895 r3994  
    5252    private JCheckBox drawGpsArrowsFast = new JCheckBox(tr("Fast drawing (looks uglier)"));
    5353    private JTextField drawGpsArrowsMinDist = new JTextField(8);
    54     private JCheckBox interestingDirections = new JCheckBox(tr("Only interesting direction hints (e.g. with oneway tag)."));
    5554    private JCheckBox headArrow = new JCheckBox(tr("Only on the head of a way."));
     55    private JCheckBox onewayArrow = new JCheckBox(tr("Draw oneway arrows."));
    5656    private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers"));
    5757    private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data"));
     
    6262    private JCheckBox outlineOnly = new JCheckBox(tr("Draw only outlines of areas"));
    6363    private JComboBox waypointLabel = new JComboBox(new String[] {tr("Auto"), /* gpx data field name */ trc("gpx_field", "Name"),
    64                                       /* gpx data field name */ trc("gpx_field", "Desc(ription)"), tr("Both"), tr("None")});
     64            /* gpx data field name */ trc("gpx_field", "Desc(ription)"), tr("Both"), tr("None")});
    6565
    6666    public void addGui(PreferenceTabbedPane gui) {
     
    227227            public void actionPerformed(ActionEvent e) {
    228228                if (directionHint.isSelected()){
    229                     interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only", true));
    230229                    headArrow.setSelected(Main.pref.getBoolean("draw.segment.head_only", false));
    231230                }else{
    232                     interestingDirections.setSelected(false);
    233231                    headArrow.setSelected(false);
    234232                }
    235                 interestingDirections.setEnabled(directionHint.isSelected());
    236233                headArrow.setEnabled(directionHint.isSelected());
    237234            }
     
    240237        directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction", true));
    241238        panel.add(directionHint, GBC.eop().insets(20,0,0,0));
    242 
    243         // only interesting directions
    244         interestingDirections.setToolTipText(tr("Only interesting direction hints (e.g. with oneway tag)."));
    245         interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only", true));
    246         interestingDirections.setEnabled(directionHint.isSelected());
    247         panel.add(interestingDirections, GBC.eop().insets(40,0,0,0));
    248239
    249240        // only on the head of a way
     
    252243        headArrow.setEnabled(directionHint.isSelected());
    253244        panel.add(headArrow, GBC.eop().insets(40, 0, 0, 0));
     245
     246        // draw oneway arrows
     247        onewayArrow.setToolTipText(tr("Draw arrows in the direction of oneways and other directed features."));
     248        onewayArrow.setSelected(Main.pref.getBoolean("draw.oneway", true));
     249        panel.add(onewayArrow, GBC.eop().insets(20,0,0,0));
    254250
    255251        // segment order number
     
    312308        Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected());
    313309        Main.pref.put("draw.segment.direction", directionHint.isSelected());
    314         Main.pref.put("draw.segment.relevant_directions_only", interestingDirections.isSelected());
    315310        Main.pref.put("draw.segment.head_only", headArrow.isSelected());
     311        Main.pref.put("draw.oneway", onewayArrow.isSelected());
    316312        Main.pref.put("draw.segment.order_number", segmentOrderNumber.isSelected());
    317313        Main.pref.put("draw.data.downloaded_area", sourceBounds.isSelected());
Note: See TracChangeset for help on using the changeset viewer.