Changeset 13667 in josm for trunk/src/org


Ignore:
Timestamp:
2018-04-23T22:17:10+02:00 (6 years ago)
Author:
Don-vip
Message:

move a few methods from OsmPrimitive to IPrimitive, Relation to IRelation

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java

    r13665 r13667  
    364364
    365365    /**
     366     * Determines if this object is a relation and behaves as a multipolygon.
     367     * @return {@code true} if it is a real multipolygon or a boundary relation
     368     * @since 13667
     369     */
     370    default boolean isMultipolygon() {
     371        return false;
     372    }
     373
     374    /**
    366375     * true if this object has direction dependent tags (e.g. oneway)
    367376     * @return {@code true} if this object has direction dependent tags
  • trunk/src/org/openstreetmap/josm/data/osm/IRelation.java

    r13665 r13667  
    5454        return formatter.format(this);
    5555    }
     56
     57    /**
     58     * Determines if this relation is a boundary.
     59     * @return {@code true} if a boundary relation
     60     */
     61    default boolean isBoundary() {
     62        return "boundary".equals(get("type"));
     63    }
     64
     65    @Override
     66    default boolean isMultipolygon() {
     67        return "multipolygon".equals(get("type")) || isBoundary();
     68    }
    5669}
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13665 r13667  
    13511351
    13521352    /**
    1353      * Determines if this object is a relation and behaves as a multipolygon.
    1354      * @return {@code true} if it is a real mutlipolygon or a boundary relation
    1355      * @since 10716
    1356      */
    1357     public boolean isMultipolygon() {
    1358         return false;
    1359     }
    1360 
    1361     /**
    13621353     * If necessary, extend the bbox to contain this primitive
    13631354     * @param box a bbox instance
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r13665 r13667  
    4141
    4242    /**
    43      *
     43     * Sets members of the relation.
    4444     * @param members Can be null, in that case all members are removed
    4545     * @since 1925
     
    430430    }
    431431
    432     /**
    433      * Determines if this relation is a boundary.
    434      * @return {@code true} if a boundary relation
    435      */
    436     public boolean isBoundary() {
    437         return "boundary".equals(get("type"));
    438     }
    439 
    440     @Override
    441     public boolean isMultipolygon() {
    442         return "multipolygon".equals(get("type")) || isBoundary();
    443     }
    444 
    445432    @Override
    446433    public BBox getBBox() {
Note: See TracChangeset for help on using the changeset viewer.