This is a patch for the following issue:
1659627 IntervalMarker with Double.POSITIVE_INFINITY bound
1. I had to code all the clipping myself, because Rectangle2D.Double#createIntersection() did not work well with infinite bounds and produced NaNs while trying to calculate the width/height of the clipped rectangle. Therefore, I compared the bounds first, clipped them and only after that calculated the new width/height.
2. The marker label was not displayed in the correct location. When I previously created a marker with an infinite upper bound and also set label anchor to RectangleAnchor.CENTER, the label was drawn in the infinity, off the screen. Now the label is drawn in the centre of the visible marker area.
3. There was a bug in AbstractXYItemRenderer#drawRangeMarker(), which resulted in outline not being drawn correctly (X and Y coordinates were swapped). This was also fixed.
4. I have successfully tested the patch in all possible combinations of plot and axis orientation, with both linear and logarithmic axes.
5. As correctly pointed out in a discussion of a similar problem:
the clipping will affect the gradient paint, particularly when coupled with scaling GradientPaintTransformer. As the drawing area for the marker is clipped to the visible area, the gradient paint will be resized to fit inside the visible area (whereas previously it was stretched to the whole marker area). I do not know if this change in behaviour can be considered critical. One problem I see with the standard GradientPaintTransformer is that it demotes double coordinates to a float range, which results in loss of precision and may still have weird side effects in some situations. In the light of this, clipping will probably do more good than harm.
Log in to post a comment.