Changeset 12367 in josm
- Timestamp:
- 2017-06-09T20:14:12+02:00 (7 years ago)
- 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 203 203 */ 204 204 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; 206 229 207 230 static ColorMode fromIndex(final int index) { -
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r10378 r12367 24 24 } 25 25 26 /** 27 * Gets a HSB color range. 28 * @param count The number of colors the scale should have 29 * @return The scale 30 */ 26 31 public static ColorScale createHSBScale(int count) { 27 32 ColorScale sc = new ColorScale(); … … 35 40 } 36 41 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 */ 37 47 public static ColorScale createCyclicScale(int count) { 38 48 ColorScale sc = new ColorScale(); … … 76 86 } 77 87 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 */ 78 93 public void setRange(double min, double max) { 79 94 this.min = min; … … 89 104 } 90 105 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 */ 91 111 public Color getColor(double value) { 92 112 if (value < min) return belowMinColor; … … 102 122 } 103 123 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 */ 104 129 public Color getColor(Number value) { 105 130 return (value == null) ? noDataColor : getColor(value.doubleValue()); 106 131 } 107 132 133 /** 134 * Get the color to use if there is no data 135 * @return The color 136 */ 108 137 public Color getNoDataColor() { 109 138 return noDataColor; 110 139 } 111 140 141 /** 142 * Sets the color to use if there is no data 143 * @param noDataColor The color 144 */ 112 145 public void setNoDataColor(Color noDataColor) { 113 146 this.noDataColor = noDataColor; 114 147 } 115 148 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 */ 116 154 public ColorScale makeTransparent(int alpha) { 117 155 for (int i = 0; i < colors.length; i++) { … … 121 159 } 122 160 161 /** 162 * Adds a title to this scale 163 * @param title The new title 164 * @return This scale, for chaining 165 */ 123 166 public ColorScale addTitle(String title) { 124 167 this.title = title; … … 126 169 } 127 170 171 /** 172 * Sets the interval count for this scale 173 * @param intervalCount The interval count hint 174 * @return This scale, for chaining 175 */ 128 176 public ColorScale setIntervalCount(int intervalCount) { 129 177 this.intervalCount = intervalCount; … … 131 179 } 132 180 181 /** 182 * Reverses this scale 183 * @return This scale, for chaining 184 */ 133 185 public ColorScale makeReversed() { 134 186 int n = colors.length; … … 145 197 } 146 198 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 */ 147 208 public void drawColorBar(Graphics2D g, int x, int y, int w, int h, double valueScale) { 148 209 int n = colors.length;
Note:
See TracChangeset
for help on using the changeset viewer.