/** * Draws the arc to represent an interval. * * @param g2 the graphics device. * @param meterArea the drawing area. * @param interval the interval. */ protected void drawArcForInterval(Graphics2D g2, Rectangle2D meterArea, MeterInterval interval) { double minValue = interval.getRange().getLowerBound(); double maxValue = interval.getRange().getUpperBound(); Paint outlinePaint = interval.getOutlinePaint(); Stroke outlineStroke = interval.getOutlineStroke(); Paint backgroundPaint = interval.getBackgroundPaint(); if (backgroundPaint != null) { fillArc(g2, meterArea, minValue, maxValue, backgroundPaint, false); } if (outlinePaint != null) { if (outlineStroke != null) { drawArc(g2, meterArea, minValue, maxValue, outlinePaint, outlineStroke); } drawTick(g2, meterArea, minValue, true); drawTick(g2, meterArea, maxValue, true); } }
/** * Draws a tick. * * @param g2 the graphics device. * @param meterArea the meter area. * @param value the value. */ protected void drawTick(Graphics2D g2, Rectangle2D meterArea, double value) { drawTick(g2, meterArea, value, false); }
/** * Draws the ticks that subdivide the overall range. * * @param g2 the graphics device. * @param meterArea the meter area. * @param minValue the minimum value. * @param maxValue the maximum value. */ protected void drawTicks(Graphics2D g2, Rectangle2D meterArea, double minValue, double maxValue) { for (double v = minValue; v <= maxValue; v += this.tickSize) { drawTick(g2, meterArea, v); } }