// set alpha
final int oldAlpha = gc.getAlpha();
gc.setAlpha(marker.getAlpha());
final PlotOrientation orientation = plot.getOrientation();
final double v = axis.valueToJava2D(value, dataArea.getRectangle(),
plot.getRangeAxisEdge());
Line line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
line = Line
.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
} else if (orientation == PlotOrientation.VERTICAL) {
line = Line
.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
}
gc.setForeground(marker.getPaint());
marker.getStroke().set(gc);
GCUtilities.draw(gc, line);
final String label = marker.getLabel();
final RectangleAnchor anchor = marker.getLabelAnchor();
if (label != null) {
final Font labelFont = marker.getLabelFont();
gc.setFont(labelFont);
gc.setForeground(marker.getLabelPaint());
final Point coordinates = this
.calculateRangeMarkerTextAnchorPoint(gc, orientation,
dataArea.getRectangle(), line.getBounds(),
marker.getLabelOffset(),
LengthAdjustmentType.EXPAND, anchor);
TextUtilities.drawAlignedString(label, gc, coordinates.x,
coordinates.y, marker.getLabelTextAnchor());
}
gc.setAlpha(oldAlpha);
} else if (marker instanceof IntervalMarker) {
final IntervalMarker im = (IntervalMarker) marker;
final double start = im.getStartValue();
final double end = im.getEndValue();
final Range range = axis.getRange();
if (!(range.intersects(start, end))) {
return;
}
final int oldAlpha = gc.getAlpha();
gc.setAlpha(marker.getAlpha());
final double start2d = axis.valueToJava2D(start, dataArea
.getRectangle(), plot.getRangeAxisEdge());
final double end2d = axis.valueToJava2D(end, dataArea
.getRectangle(), plot.getRangeAxisEdge());
final PlotOrientation orientation = plot.getOrientation();
Rectangle rect = null;
if (orientation == PlotOrientation.HORIZONTAL) {
rect = RectangleUtil.Double(Math.min(start2d, end2d), dataArea
.getMinY(), Math.abs(end2d - start2d), dataArea
.getHeight());