source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java@ 11713

Last change on this file since 11713 was 11713, checked in by Don-vip, 7 years ago

add Ant target to run PMD (only few rules for now), fix violations

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint.mapcss;
3
4import org.openstreetmap.josm.data.osm.OsmPrimitive;
5import org.openstreetmap.josm.data.osm.Tag;
6import org.openstreetmap.josm.gui.mappaint.Environment;
7
8/**
9 * This is a condition that needs to be fulfilled in order to apply a MapCSS style.
10 */
11@FunctionalInterface
12public interface Condition {
13
14 /**
15 * Checks if the condition applies in the given MapCSS {@link Environment}.
16 * @param e The environment to check. May not be <code>null</code>.
17 * @return <code>true</code> if the condition applies.
18 */
19 boolean applies(Environment e);
20
21 /**
22 * Context, where the condition applies.
23 */
24 enum Context {
25 /**
26 * normal primitive selector, e.g. way[highway=residential]
27 */
28 PRIMITIVE,
29
30 /**
31 * link between primitives, e.g. relation &gt;[role=outer] way
32 */
33 LINK
34 }
35
36 /**
37 * This is a condition that can be converted to a tag
38 * @author Michael Zangl
39 * @since 10674
40 */
41 @FunctionalInterface
42 interface ToTagConvertable {
43 /**
44 * Converts the current condition to a tag
45 * @param primitive A primitive to use as context. May be ignored.
46 * @return A tag with the key/value of this condition.
47 */
48 Tag asTag(OsmPrimitive primitive);
49 }
50}
Note: See TracBrowser for help on using the repository browser.