Changeset 12367 in josm for trunk


Ignore:
Timestamp:
2017-06-09T20:14:12+02:00 (7 years ago)
Author:
michael2402
Message:

Document GPX color scale

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r12274 r12367  
    203203     */
    204204    public enum ColorMode {
    205         NONE, VELOCITY, HDOP, DIRECTION, TIME, HEATMAP;
     205        /**
     206         * No special colors
     207         */
     208        NONE,
     209        /**
     210         * Color by velocity
     211         */
     212        VELOCITY,
     213        /**
     214         * Color by accuracy
     215         */
     216        HDOP,
     217        /**
     218         * Color by traveling direction
     219         */
     220        DIRECTION,
     221        /**
     222         * Color by time
     223         */
     224        TIME,
     225        /**
     226         * Color using a heatmap instead of normal lines
     227         */
     228        HEATMAP;
    206229
    207230        static ColorMode fromIndex(final int index) {
  • trunk/src/org/openstreetmap/josm/tools/ColorScale.java

    r10378 r12367  
    2424    }
    2525
     26    /**
     27     * Gets a HSB color range.
     28     * @param count The number of colors the scale should have
     29     * @return The scale
     30     */
    2631    public static ColorScale createHSBScale(int count) {
    2732        ColorScale sc = new ColorScale();
     
    3540    }
    3641
     42    /**
     43     * Creates a cyclic color scale (red  yellow  green   blue    red)
     44     * @param count The number of colors the scale should have
     45     * @return The scale
     46     */
    3747    public static ColorScale createCyclicScale(int count) {
    3848        ColorScale sc = new ColorScale();
     
    7686    }
    7787
     88    /**
     89     * Sets the hint on the range this scale is for
     90     * @param min The minimum value
     91     * @param max The maximum value
     92     */
    7893    public void setRange(double min, double max) {
    7994        this.min = min;
     
    89104    }
    90105
     106    /**
     107     * Gets a color for the given value.
     108     * @param value The value
     109     * @return The color for this value, this may be a special color if the value is outside the range but never null.
     110     */
    91111    public Color getColor(double value) {
    92112        if (value < min) return belowMinColor;
     
    102122    }
    103123
     124    /**
     125     * Gets a color for the given value.
     126     * @param value The value, may be <code>null</code>
     127     * @return The color for this value, this may be a special color if the value is outside the range or the value is null but never null.
     128     */
    104129    public Color getColor(Number value) {
    105130        return (value == null) ? noDataColor : getColor(value.doubleValue());
    106131    }
    107132
     133    /**
     134     * Get the color to use if there is no data
     135     * @return The color
     136     */
    108137    public Color getNoDataColor() {
    109138        return noDataColor;
    110139    }
    111140
     141    /**
     142     * Sets the color to use if there is no data
     143     * @param noDataColor The color
     144     */
    112145    public void setNoDataColor(Color noDataColor) {
    113146        this.noDataColor = noDataColor;
    114147    }
    115148
     149    /**
     150     * Make all colors transparent
     151     * @param alpha The alpha value all colors in the range should have, range 0..255
     152     * @return This scale, for chaining
     153     */
    116154    public ColorScale makeTransparent(int alpha) {
    117155        for (int i = 0; i < colors.length; i++) {
     
    121159    }
    122160
     161    /**
     162     * Adds a title to this scale
     163     * @param title The new title
     164     * @return This scale, for chaining
     165     */
    123166    public ColorScale addTitle(String title) {
    124167        this.title = title;
     
    126169    }
    127170
     171    /**
     172     * Sets the interval count for this scale
     173     * @param intervalCount The interval count hint
     174     * @return This scale, for chaining
     175     */
    128176    public ColorScale setIntervalCount(int intervalCount) {
    129177        this.intervalCount = intervalCount;
     
    131179    }
    132180
     181    /**
     182     * Reverses this scale
     183     * @return This scale, for chaining
     184     */
    133185    public ColorScale makeReversed() {
    134186        int n = colors.length;
     
    145197    }
    146198
     199    /**
     200     * Draws a color bar representing this scale on the given graphics
     201     * @param g The graphics to draw on
     202     * @param x Rect x
     203     * @param y Rect y
     204     * @param w Rect width
     205     * @param h Rect height
     206     * @param valueScale The scale factor of the values
     207     */
    147208    public void drawColorBar(Graphics2D g, int x, int y, int w, int h, double valueScale) {
    148209        int n = colors.length;
Note: See TracChangeset for help on using the changeset viewer.