Changeset 15246 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2019-07-13T22:55:54+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #17885 - add new MapCSS functions to retrieve OSM metadata:

  • osm_user_name
  • osm_user_id
  • osm_version
  • osm_changeset_id
  • osm_timestamp
File:
1 edited

Legend:

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

    r15245 r15246  
    5050 * immediately. Add the annotation {@link NullableArguments} to allow null arguments.
    5151 * Every method must be static.
    52  * 
     52 *
    5353 * @since 15245 (extracted from {@link ExpressionFactory})
    5454 */
     
    767767
    768768    /**
     769     * Returns the OSM user name who last touched the current object.
     770     * @param env the environment
     771     * @return the OSM user name who last touched the current object
     772     * @see IPrimitive#getUser
     773     * @since 15246
     774     */
     775    public static String osm_user_name(final Environment env) { // NO_UCD (unused code)
     776        return env.osm.getUser().getName();
     777    }
     778
     779    /**
     780     * Returns the OSM user id who last touched the current object.
     781     * @param env the environment
     782     * @return the OSM user id who last touched the current object
     783     * @see IPrimitive#getUser
     784     * @since 15246
     785     */
     786    public static long osm_user_id(final Environment env) { // NO_UCD (unused code)
     787        return env.osm.getUser().getId();
     788    }
     789
     790    /**
     791     * Returns the version number of the current object.
     792     * @param env the environment
     793     * @return the version number of the current object
     794     * @see IPrimitive#getVersion
     795     * @since 15246
     796     */
     797    public static int osm_version(final Environment env) { // NO_UCD (unused code)
     798        return env.osm.getVersion();
     799    }
     800
     801    /**
     802     * Returns the id of the changeset the current object was last uploaded to.
     803     * @param env the environment
     804     * @return the id of the changeset the current object was last uploaded to
     805     * @see IPrimitive#getChangesetId
     806     * @since 15246
     807     */
     808    public static int osm_changeset_id(final Environment env) { // NO_UCD (unused code)
     809        return env.osm.getChangesetId();
     810    }
     811
     812    /**
     813     * Returns the time of last modification to the current object, as timestamp.
     814     * @param env the environment
     815     * @return the time of last modification to the current object, as timestamp
     816     * @see IPrimitive#getRawTimestamp
     817     * @since 15246
     818     */
     819    public static int osm_timestamp(final Environment env) { // NO_UCD (unused code)
     820        return env.osm.getRawTimestamp();
     821    }
     822
     823    /**
    769824     * Translates some text for the current locale. The first argument is the text to translate,
    770825     * and the subsequent arguments are parameters for the string indicated by <code>{0}</code>, <code>{1}</code>, …
Note: See TracChangeset for help on using the changeset viewer.