Changeset 12379 in josm


Ignore:
Timestamp:
2017-06-09T22:22:27+02:00 (6 months ago)
Author:
michael2402
Message:

Document the gui.mappaint.mapcss package

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
Files:
4 edited

Legend:

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

    r12259 r12379  
    1313/**
    1414 * A MapCSS Instruction.
    15  * 
     15 *
    1616 * For example a simple assignment like <code>width: 3;</code>, but may also
    1717 * be a set instruction (<code>set highway;</code>).
     
    2727    void execute(Environment env);
    2828
     29    /**
     30     * A float value that will be added to the current float value. Specified as +5 or -3 in MapCSS
     31     */
    2932    class RelativeFloat {
    3033        public final float val;
     
    4043    }
    4144
     45    /**
     46     * An instruction that assigns a given value to a variable on evaluation
     47     */
    4248    class AssignmentInstruction implements Instruction {
    4349        public final String key;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java

    r9371 r12379  
    66
    77import org.openstreetmap.josm.gui.mappaint.Environment;
     8import org.openstreetmap.josm.gui.mappaint.StyleSource;
    89import org.openstreetmap.josm.tools.Utils;
    910
     
    1718public class MapCSSRule implements Comparable<MapCSSRule> {
    1819
     20    /**
     21     * The selector. If it matches, this rule should be applied
     22     */
    1923    public final Selector selector;
     24    /**
     25     * The instructions for this selector
     26     */
    2027    public final Declaration declaration;
    2128
     29    /**
     30     * A declaration is a set of {@link Instruction}s
     31     */
    2232    public static class Declaration {
     33        /**
     34         * The instructions in this declaration
     35         */
    2336        public final List<Instruction> instructions;
    24         // declarations in the StyleSource are numbered consecutively
     37        /**
     38         * The index of this declaration
     39         * <p>
     40         * declarations in the StyleSource are numbered consecutively
     41         */
    2542        public final int idx;
    2643
     44        /**
     45         * Create a new {@link Declaration}
     46         * @param instructions The instructions for this dectlaration
     47         * @param idx The index in the {@link StyleSource}
     48         */
    2749        public Declaration(List<Instruction> instructions, int idx) {
    2850            this.instructions = instructions;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r12290 r12379  
    7676            "text/x-mapcss, text/mapcss, text/css; q=0.9, text/plain; q=0.8, application/zip, application/octet-stream; q=0.5";
    7777
    78     // all rules
     78    /**
     79     * all rules in this style file
     80     */
    7981    public final List<MapCSSRule> rules = new ArrayList<>();
    80     // rule indices, filtered by primitive type
    81     public final MapCSSRuleIndex nodeRules = new MapCSSRuleIndex();         // nodes
    82     public final MapCSSRuleIndex wayRules = new MapCSSRuleIndex();          // ways without tag area=no
    83     public final MapCSSRuleIndex wayNoAreaRules = new MapCSSRuleIndex();    // ways with tag area=no
    84     public final MapCSSRuleIndex relationRules = new MapCSSRuleIndex();     // relations that are not multipolygon relations
    85     public final MapCSSRuleIndex multipolygonRules = new MapCSSRuleIndex(); // multipolygon relations
    86     public final MapCSSRuleIndex canvasRules = new MapCSSRuleIndex();       // rules to apply canvas properties
     82    /**
     83     * Rules for nodes
     84     */
     85    public final MapCSSRuleIndex nodeRules = new MapCSSRuleIndex();
     86    /**
     87     * Rules for ways without tag area=no
     88     */
     89    public final MapCSSRuleIndex wayRules = new MapCSSRuleIndex();
     90    /**
     91     * Rules for ways with tag area=no
     92     */
     93    public final MapCSSRuleIndex wayNoAreaRules = new MapCSSRuleIndex();
     94    /**
     95     * Rules for relations that are not multipolygon relations
     96     */
     97    public final MapCSSRuleIndex relationRules = new MapCSSRuleIndex();
     98    /**
     99     * Rules for multipolygon relations
     100     */
     101    public final MapCSSRuleIndex multipolygonRules = new MapCSSRuleIndex();
     102    /**
     103     * rules to apply canvas properties
     104     */
     105    public final MapCSSRuleIndex canvasRules = new MapCSSRuleIndex();
    87106
    88107    private Color backgroundColorOverride;
     
    670689    }
    671690
     691    /**
     692     * Evaluate a supports condition
     693     * @param feature The feature to evaluate for
     694     * @param val The additional parameter passed to evaluate
     695     * @return <code>true</code> if JSOM supports that feature
     696     */
    672697    public boolean evalSupportsDeclCondition(String feature, Object val) {
    673698        if (feature == null) return false;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Subpart.java

    r10600 r12379  
    1212@FunctionalInterface
    1313public interface Subpart {
     14    /**
     15     * Gets the ID of the suppart
     16     * @param env The environment to get it from
     17     * @return The id
     18     */
    1419    String getId(Environment env);
    1520
     21    /**
     22     * The default subpart for normal rules
     23     */
    1624    Subpart DEFAULT_SUBPART = new StringSubpart("default");
    1725
Note: See TracChangeset for help on using the changeset viewer.