Ignore:
Timestamp:
2009-10-25T12:55:53+01:00 (14 years ago)
Author:
stoecker
Message:

applied #3771 - patch by bastiK - improve link display in relation handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/WayConnectionType.java

    r2298 r2311  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 public enum WayConnectionType {
     6public class WayConnectionType {
    77
    8     none("", tr("Not connected")),
    9     head_to_head("-><-", tr("Last points of ways are connected")),
    10     tail_to_tail("<-->", tr("First points of ways are connected")),
    11     head_to_tail("->->", tr("First point of second way connects to last point of first way")),
    12     tail_to_head("<-<-", tr("First point of first way connects to last point of second way"));
     8    public final boolean connectedToPrevious;
     9    public final boolean connectedToNext;
     10    /** Is 1 if way has the same direction as the first way in the set of connected ways. Else it is (-1) */
     11    public final int direction;
     12    /** The WayConnectionType is invalid, if the corresponding primitive is not a way or the way is incomplete */
     13    public final boolean invalid;
    1314
    14     private String textSymbol;
    15     private String toolTip;
    16 
    17     WayConnectionType(String textSymbol, String toolTip) {
    18         this.textSymbol = textSymbol;
    19         this.toolTip = toolTip;
     15    public WayConnectionType(boolean connectedToPrevious, boolean connectedToNext, int direction) {
     16        this.connectedToPrevious = connectedToPrevious;
     17        this.connectedToNext = connectedToNext;
     18        this.direction = direction;
     19        invalid = false;
    2020    }
    2121
    22     @Override
    23     public String toString() {
    24         return textSymbol;
     22    public WayConnectionType() {
     23        connectedToPrevious = false;
     24        connectedToNext = false;
     25        direction = 1;
     26        invalid = true;
    2527    }
    2628
     29//    @Override
     30//    public String toString() {
     31//        return ...
     32//    }
     33
    2734    public String getToolTip() {
    28         return toolTip;
     35        if (invalid) {
     36            return "";
     37        }
     38        else if (connectedToPrevious && connectedToNext) {
     39            return tr("way is connected");
     40        }
     41        else if (connectedToPrevious) {
     42            return tr("way is connected to previous relation member");
     43        }
     44        else if (connectedToNext) {
     45            return tr("way is connected to next relation member");
     46        }
     47        else {
     48            return tr("way is not connected to previous or next relation member");
     49        }
    2950    }
    3051}
Note: See TracChangeset for help on using the changeset viewer.