Changeset 9574 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-23T03:47:29+01:00 (9 years ago)
Author:
Don-vip
Message:

see #12412 - add a new preset type "multipolygon". TODO: make a better icon

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r9490 r9574  
    185185                return r.types.contains(TaggingPresetType.WAY);
    186186            case MULTIPOLYGON:
     187                return r.types.contains(TaggingPresetType.MULTIPOLYGON);
    187188            case RELATION:
    188189                return r.types.contains(TaggingPresetType.RELATION);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r8863 r9574  
    8888            try {
    8989                TaggingPresetType presetType = TaggingPresetType.fromString(type);
    90                 result.add(presetType);
     90                if (presetType != null) {
     91                    result.add(presetType);
     92                }
    9193            } catch (IllegalArgumentException e) {
    9294                throw new SAXException(tr("Unknown type: {0}", type), e);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetType.java

    r8863 r9574  
    1717    RELATION(/* ICON */ "Mf_relation", "relation"),
    1818    /** Closed way */
    19     CLOSEDWAY(/* ICON */ "Mf_closedway", "closedway");
     19    CLOSEDWAY(/* ICON */ "Mf_closedway", "closedway"),
     20    /** Multipolygon */
     21    MULTIPOLYGON(/* ICON */ "multipoly_create", "multipolygon"); // FIXME find a better multipolygon icon
    2022    private final String iconName;
    2123    private final String name;
     
    5759     */
    5860    public static TaggingPresetType forPrimitiveType(OsmPrimitiveType type) {
    59         if (type == OsmPrimitiveType.NODE) return NODE;
    60         if (type == OsmPrimitiveType.WAY) return WAY;
    61         if (type == OsmPrimitiveType.CLOSEDWAY) return CLOSEDWAY;
    62         if (type == OsmPrimitiveType.RELATION || type == OsmPrimitiveType.MULTIPOLYGON)
    63                 return RELATION;
     61        if (type == OsmPrimitiveType.NODE)
     62            return NODE;
     63        if (type == OsmPrimitiveType.WAY)
     64            return WAY;
     65        if (type == OsmPrimitiveType.CLOSEDWAY)
     66            return CLOSEDWAY;
     67        if (type == OsmPrimitiveType.MULTIPOLYGON)
     68            return TaggingPresetType.MULTIPOLYGON;
     69        if (type == OsmPrimitiveType.RELATION)
     70            return RELATION;
    6471        throw new IllegalArgumentException("Unexpected primitive type: " + type);
    6572    }
Note: See TracChangeset for help on using the changeset viewer.