Changeset 18414 in josm for trunk


Ignore:
Timestamp:
2022-03-23T20:21:04+01:00 (3 years ago)
Author:
taylor.smock
Message:

fix #21867: Improve documentation for ConditionFactory (patch by gaben)

This should make things clearer for people using mapcss, as we link to our
javadocs in wiki:Help/Styles/MapCSSImplementation .

This also removes some unnecessary casts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java

    r18019 r18414  
    712712
    713713        /**
    714          * {@code closed} tests whether the way is closed or the relation is a closed multipolygon
     714         * {@code :closed} tests whether the way is closed or the relation is a closed multipolygon
    715715         * @param e MapCSS environment
    716716         * @return {@code true} if the way is closed or the relation is a closed multipolygon
     
    719719            if (e.osm instanceof IWay<?> && ((IWay<?>) e.osm).isClosed())
    720720                return true;
    721             return e.osm instanceof IRelation<?> && ((IRelation<?>) e.osm).isMultipolygon();
     721            return e.osm instanceof IRelation<?> && e.osm.isMultipolygon();
    722722        }
    723723
     
    733733
    734734        /**
    735          * {@code ;new} tests whether the object is new.
     735         * {@code :new} tests whether the object is new.
    736736         * @param e MapCSS environment
    737737         * @return {@code true} if the object is new
     
    784784
    785785        /**
    786          * {@code unconnected}: tests whether the object is a unconnected node.
    787          * @param e MapCSS environment
    788          * @return {@code true} if the object is a unconnected node
     786         * {@code :unconnected} tests whether the object is an unconnected node.
     787         * @param e MapCSS environment
     788         * @return {@code true} if the object is an unconnected node
    789789         */
    790790        static boolean unconnected(Environment e) {
     
    793793
    794794        /**
    795          * {@code righthandtraffic} checks if there is right-hand traffic at the current location.
     795         * {@code :righthandtraffic} checks if there is right-hand traffic at the current location.
    796796         * @param e MapCSS environment
    797797         * @return {@code true} if there is right-hand traffic at the current location
     
    803803
    804804        /**
    805          * {@code clockwise} whether the way is closed and oriented clockwise,
     805         * {@code :clockwise} whether the way is closed and oriented clockwise,
    806806         * or non-closed and the 1st, 2nd and last node are in clockwise order.
    807807         * @param e MapCSS environment
     
    814814
    815815        /**
    816          * {@code anticlockwise} whether the way is closed and oriented anticlockwise,
     816         * {@code :anticlockwise} whether the way is closed and oriented anticlockwise,
    817817         * or non-closed and the 1st, 2nd and last node are in anticlockwise order.
    818818         * @param e MapCSS environment
     
    825825
    826826        /**
    827          * {@code unclosed-multipolygon} tests whether the object is an unclosed multipolygon.
     827         * {@code :unclosed-multipolygon} tests whether the object is an unclosed multipolygon.
    828828         * @param e MapCSS environment
    829829         * @return {@code true} if the object is an unclosed multipolygon
     
    838838
    839839        /**
    840          * {@code in-downloaded-area} tests whether the object is within source area ("downloaded area").
     840         * {@code :in-downloaded-area} tests whether the object is within source area ("downloaded area").
    841841         * @param e MapCSS environment
    842842         * @return {@code true} if the object is within source area ("downloaded area")
     
    847847        }
    848848
     849        /**
     850         * {@code :completely_downloaded} tests whether the object is completely downloaded
     851         * @param e MapCSS environment
     852         * @return {@code true} if the object is completely downloaded
     853         */
    849854        static boolean completely_downloaded(Environment e) {
    850855            if (e.osm instanceof IRelation<?>) {
     
    862867            if (e.osm instanceof IWay<?> && ((IWay<?>) e.osm).isClosed())
    863868                return true;
    864             if (e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon()) {
     869            if (e.osm instanceof Relation && e.osm.isMultipolygon()) {
    865870                Multipolygon multipolygon = MultipolygonCache.getInstance().get((Relation) e.osm);
    866871                return multipolygon != null && multipolygon.getOpenEnds().isEmpty();
     
    869874        }
    870875
     876        /**
     877         * {@code :selected} tests whether the object is selected in the editor
     878         * @param e MapCSS environment
     879         * @return {@code true} if the object is selected
     880         */
    871881        static boolean selected(Environment e) {
    872882            if (e.mc != null) {
     
    877887
    878888        /**
    879          * Check if the object is highlighted (i.e., is hovered over)
     889         * {@code :highlighted} tests whether the object is highlighted (i.e. is hovered over)
    880890         * @param e The MapCSS environment
    881891         * @return {@code true} if the object is highlighted
Note: See TracChangeset for help on using the changeset viewer.