Ignore:
Timestamp:
2017-07-07T23:47:58+02:00 (7 years ago)
Author:
giackserva
Message:

[pt_assistant] implemented #josm14977

Location:
applications/editors/josm/plugins/pt_assistant
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/PTAssistantPlugin.java

    r33429 r33432  
    2121import org.openstreetmap.josm.plugins.pt_assistant.actions.EditHighlightedRelationsAction;
    2222import org.openstreetmap.josm.plugins.pt_assistant.actions.RepeatLastFixAction;
     23import org.openstreetmap.josm.plugins.pt_assistant.actions.SortPTStopsAction;
    2324import org.openstreetmap.josm.plugins.pt_assistant.actions.SplitRoundaboutAction;
    2425import org.openstreetmap.josm.plugins.pt_assistant.data.PTRouteSegment;
     
    6667        editHighlightedRelationsMenu = MainMenu.add(Main.main.menu.toolsMenu, editHighlightedRelationsAction);
    6768        MainMenu.add(Main.main.menu.toolsMenu, new SplitRoundaboutAction());
     69        MainMenu.add(Main.main.menu.toolsMenu, new SortPTStopsAction());
    6870    }
    6971
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/data/PTStop.java

    r33055 r33432  
    2727    private OsmPrimitive platform = null;
    2828
     29    private RelationMember stopPositionRM = null;
     30
     31    private RelationMember platformRM = null;
     32
    2933    /* the name of this stop */
    3034    private String name = "";
     
    5054            this.stopPosition = other.getNode();
    5155            this.name = stopPosition.get("name");
    52 
     56            setStopPositionRM(other);
    5357            // } else if (other.getRole().equals("platform") ||
    5458            // other.getRole().equals("platform_entry_only")
     
    6064            this.platform = other.getMember();
    6165            this.name = platform.get("name");
     66            setPlatformRM(other);
    6267
    6368        } else {
     
    7883     *         already has an attribute with that role.
    7984     */
    80     protected boolean addStopElement(RelationMember member) {
     85    public boolean addStopElement(RelationMember member) {
    8186
    8287        // each element is only allowed once per stop
     
    8893            if (member.getType().equals(OsmPrimitiveType.NODE) && stopPosition == null) {
    8994                this.stopPosition = member.getNode();
     95                stopPositionRM = member;
    9096                return true;
    9197            }
     
    102108            if (platform == null) {
    103109                platform = member.getMember();
     110                platformRM = member;
    104111                return true;
    105112            }
     
    211218    }
    212219
     220    public RelationMember getPlatformRM() {
     221        return platformRM;
     222    }
     223
     224    public void setPlatformRM(RelationMember platformRM) {
     225        this.platformRM = platformRM;
     226    }
     227
     228    public RelationMember getStopPositionRM() {
     229        return stopPositionRM;
     230    }
     231
     232    public void setStopPositionRM(RelationMember stopPositionRM) {
     233        this.stopPositionRM = stopPositionRM;
     234    }
     235
    213236}
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java

    r33429 r33432  
    1919public final class RouteUtils {
    2020
    21     private static final String ptVersionTag = "public_transport:version";
     21    private static final String PT_VERSION_TAG = "public_transport:version";
    2222    private RouteUtils() {
    2323        // private constructor for util classes
     
    3939        }
    4040
    41         if (!r.hasTag(ptVersionTag, "2")) {
     41        if (!r.hasTag(PT_VERSION_TAG, "2")) {
    4242            return false;
    4343        }
     
    5252        }
    5353
    54         if (r.get(ptVersionTag) == null) {
     54        if (r.get(PT_VERSION_TAG) == null) {
    5555            return true;
    5656        }
    5757
    58         return r.hasTag(ptVersionTag, "1");
     58        return r.hasTag(PT_VERSION_TAG, "1");
    5959    }
    6060
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/StopToWayAssigner.java

    r33055 r33432  
    77import java.util.HashSet;
    88import java.util.List;
     9import java.util.Map;
    910import java.util.Set;
    1011
     
    3233
    3334    /* contains assigned stops */
    34     public static HashMap<PTStop, List<Way>> stopToWay = new HashMap<>();
     35    public static Map<PTStop, List<Way>> stopToWay = new HashMap<>();
    3536
    3637    /*
     
    3940     */
    4041    private HashSet<Way> ways;
    41 
    42     /* route relation for which this StopToWayAssigner was created */
    4342
    4443    public StopToWayAssigner(List<PTWay> ptways) {
     
    4746            ways.addAll(ptway.getWays());
    4847        }
     48    }
     49
     50    public StopToWayAssigner(Collection<Way> ways) {
     51        this.ways = new HashSet<>();
     52        this.ways.addAll(ways);
    4953    }
    5054
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RouteChecker.java

    r33429 r33432  
    8282            }
    8383        }
     84    }
     85
     86    public boolean hasGaps(List<RelationMember> waysToCheck) {
     87        return countGaps(waysToCheck) > 0;
    8488    }
    8589
Note: See TracChangeset for help on using the changeset viewer.