Changeset 8229 in josm for trunk


Ignore:
Timestamp:
2015-04-19T00:29:10+02:00 (10 years ago)
Author:
simon04
Message:

see #10973 - Relation sorting: group platform and stop in front of other public_transport/route members

File:
1 edited

Legend:

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

    r7937 r8229  
    2929        additionalSorters.add(new AssociatedStreetRoleStreetSorter());
    3030        additionalSorters.add(new AssociatedStreetRoleAddressHouseSorter());
     31        additionalSorters.add(new PublicTransportRoleStopPlatformSorter());
    3132    }
    3233
     
    7576                }
    7677            });
     78            return list;
     79        }
     80    }
     81
     82    /**
     83     * Class that sorts the {@code platform} and {@code stop} members of
     84     * {@code type=public_transport} relations.
     85     */
     86    private static class PublicTransportRoleStopPlatformSorter implements AdditionalSorter {
     87
     88        @Override
     89        public boolean acceptsMember(RelationMember m) {
     90            return "platform".equals(m.getRole()) || "stop".equals(m.getRole());
     91        }
     92
     93        @Override
     94        public List<RelationMember> sortMembers(List<RelationMember> list) {
     95            // Retain order from original relation
    7796            return list;
    7897        }
Note: See TracChangeset for help on using the changeset viewer.