Ignore:
Timestamp:
2018-04-23T02:05:41+02:00 (19 months ago)
Author:
Don-vip
Message:

use of IPrimitive interface

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

Legend:

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

    r13636 r13662  
    101101
    102102    /**
     103     * Replies true, if this primitive is disabled. (E.g. a filter applies)
     104     * @return {@code true} if this object has the "disabled" flag enabled
     105     * @since 13662
     106     */
     107    default boolean isDisabled() {
     108        return false;
     109    }
     110
     111    /**
     112     * Replies true, if this primitive is disabled and marked as completely hidden on the map.
     113     * @return {@code true} if this object has both the "disabled" and "hide if disabled" flags enabled
     114     * @since 13662
     115     */
     116    default boolean isDisabledAndHidden() {
     117        return false;
     118    }
     119
     120    /**
    103121     * Replies the id of this primitive.
    104122     *
     
    251269        return getType();
    252270    }
     271
     272    /**
     273     * Determines if this object is considered "tagged". To be "tagged", an object
     274     * must have one or more "interesting" tags. "created_by" and "source"
     275     * are typically considered "uninteresting" and do not make an object "tagged".
     276     * @return true if this object is considered "tagged"
     277     * @since 13662
     278     */
     279    boolean isTagged();
     280
     281    /**
     282     * Determines if this object is considered "annotated". To be "annotated", an object
     283     * must have one or more "work in progress" tags, such as "note" or "fixme".
     284     * @return true if this object is considered "annotated"
     285     * @since 13662
     286     */
     287    boolean isAnnotated();
     288
     289    /**
     290     * true if this object has direction dependent tags (e.g. oneway)
     291     * @return {@code true} if this object has direction dependent tags
     292     * @since 13662
     293     */
     294    boolean hasDirectionKeys();
     295
     296    /**
     297     * true if this object has the "reversed direction" flag enabled
     298     * @return {@code true} if this object has the "reversed direction" flag enabled
     299     * @since 13662
     300     */
     301    boolean reversedDirection();
    253302}
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13636 r13662  
    445445    }
    446446
    447     /**
    448      * Replies true, if this primitive is disabled. (E.g. a filter applies)
    449      * @return {@code true} if this object has the "disabled" flag enabled
    450      */
     447    @Override
    451448    public boolean isDisabled() {
    452449        return (flags & FLAG_DISABLED) != 0;
    453450    }
    454451
    455     /**
    456      * Replies true, if this primitive is disabled and marked as completely hidden on the map.
    457      * @return {@code true} if this object has both the "disabled" and "hide if disabled" flags enabled
    458      */
     452    @Override
    459453    public boolean isDisabledAndHidden() {
    460454        return ((flags & FLAG_DISABLED) != 0) && ((flags & FLAG_HIDE_IF_DISABLED) != 0);
     
    825819    }
    826820
    827     /**
    828      * Determines if this object is considered "tagged". To be "tagged", an object
    829      * must have one or more "interesting" tags. "created_by" and "source"
    830      * are typically considered "uninteresting" and do not make an object
    831      * "tagged".
    832      * @return true if this object is considered "tagged"
    833      */
     821    @Override
    834822    public boolean isTagged() {
    835823        return (flags & FLAG_TAGGED) != 0;
    836824    }
    837825
    838     /**
    839      * Determines if this object is considered "annotated". To be "annotated", an object
    840      * must have one or more "work in progress" tags, such as "note" or "fixme".
    841      * @return true if this object is considered "annotated"
    842      * @since 5754
    843      */
     826    @Override
    844827    public boolean isAnnotated() {
    845828        return (flags & FLAG_ANNOTATED) != 0;
     
    861844    }
    862845
    863     /**
    864      * true if this object has direction dependent tags (e.g. oneway)
    865      * @return {@code true} if this object has direction dependent tags
    866      */
     846    @Override
    867847    public boolean hasDirectionKeys() {
    868848        return (flags & FLAG_HAS_DIRECTIONS) != 0;
    869849    }
    870850
    871     /**
    872      * true if this object has the "reversed diretion" flag enabled
    873      * @return {@code true} if this object has the "reversed diretion" flag enabled
    874      */
     851    @Override
    875852    public boolean reversedDirection() {
    876853        return (flags & FLAG_DIRECTION_REVERSED) != 0;
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java

    r13636 r13662  
    134134
    135135    @Override
     136    public boolean isTagged() {
     137        return hasKeys();
     138    }
     139
     140    @Override
     141    public boolean isAnnotated() {
     142        return false;
     143    }
     144
     145    @Override
     146    public boolean hasDirectionKeys() {
     147        return false;
     148    }
     149
     150    @Override
     151    public boolean reversedDirection() {
     152        return false;
     153    }
     154
     155    @Override
    136156    public StyleCache getCachedStyle() {
    137157        return null;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r13657 r13662  
    4747import org.openstreetmap.josm.data.osm.BBox;
    4848import org.openstreetmap.josm.data.osm.DataSet;
     49import org.openstreetmap.josm.data.osm.IPrimitive;
    4950import org.openstreetmap.josm.data.osm.Node;
    5051import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    754755     * @since 11670
    755756     */
    756     public void drawAreaIcon(OsmPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta,
     757    public void drawAreaIcon(IPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta,
    757758            PositionForAreaStrategy iconPosition) {
    758759        Rectangle2D.Double iconRect = new Rectangle2D.Double(-img.getWidth() / 2.0, -img.getHeight() / 2.0, img.getWidth(), img.getHeight());
     
    10901091     * @since 11722
    10911092     */
    1092     public void drawText(OsmPrimitive osm, TextLabel text, PositionForAreaStrategy labelPositionStrategy) {
     1093    public void drawText(IPrimitive osm, TextLabel text, PositionForAreaStrategy labelPositionStrategy) {
    10931094        if (!isShowNames()) {
    10941095            return;
     
    11261127    }
    11271128
    1128     private void displayText(OsmPrimitive osm, TextLabel text, String name, Rectangle2D nb,
     1129    private void displayText(IPrimitive osm, TextLabel text, String name, Rectangle2D nb,
    11291130            MapViewPositionAndRotation center) {
    11301131        AffineTransform at = new AffineTransform();
     
    11821183     * @param consumer The consumer to call.
    11831184     */
    1184     private void forEachPolygon(OsmPrimitive osm, Consumer<MapViewPath> consumer) {
     1185    private void forEachPolygon(IPrimitive osm, Consumer<MapViewPath> consumer) {
    11851186        if (osm instanceof Way) {
    11861187            consumer.accept(getPath((Way) osm));
Note: See TracChangeset for help on using the changeset viewer.