This class would typically be used with a
ContourPlot
. It allows the user to define a
GeneralPath
curve in plot coordinates. This curve can then be
used mask off or define regions within the contour plot. The data must be
sorted.
ClipPath
public ClipPath()
Constructor for ClipPath.
ClipPath
public ClipPath(double[] xValue,
double[] yValue)
Constructor for ClipPath.
Default values are assumed for the fillPath and drawPath options as
false and true respectively. The fillPaint is set to Color.GRAY, the
drawColor is Color.BLUE, the stroke is BasicStroke(1)
and the composite is AlphaComposite.Src.
xValue
- x coordinates of curved to be createdyValue
- y coordinates of curved to be created
ClipPath
public ClipPath(double[] xValue,
double[] yValue,
boolean fillPath,
boolean drawPath,
Paint fillPaint,
Paint drawPaint,
Stroke drawStroke,
Composite composite)
Constructor for ClipPath.
xValue
- x coordinates of curved to be createdyValue
- y coordinates of curved to be createdfillPath
- whether the path is to filleddrawPath
- whether the path is to drawn as an outlinefillPaint
- the fill paintdrawPaint
- the outline stroke colordrawStroke
- the stroke stylecomposite
- the composite rule
ClipPath
public ClipPath(double[] xValue,
double[] yValue,
boolean clip,
boolean fillPath,
boolean drawPath)
Constructor for ClipPath.
The fillPaint is set to Color.GRAY, the drawColor is Color.BLUE, the
stroke is BasicStroke(1) and the composite is AlphaComposite.Src.
xValue
- x coordinates of curved to be createdyValue
- y coordinates of curved to be createdclip
- clip?fillPath
- whether the path is to filleddrawPath
- whether the path is to drawn as an outline
clone
public Object clone()
throws CloneNotSupportedException
Returns a clone of the object (a deeper clone than default to avoid bugs
when setting values in cloned object).
draw
public GeneralPath draw(Graphics2D g2,
Rectangle2D dataArea,
ValueAxis horizontalAxis,
ValueAxis verticalAxis)
Draws the clip path.
g2
- current graphics2D.dataArea
- the dataArea that the plot is being draw in.horizontalAxis
- the horizontal axis.verticalAxis
- the vertical axis.
- The GeneralPath defining the outline
generateClipPath
public GeneralPath generateClipPath(Rectangle2D dataArea,
ValueAxis horizontalAxis,
ValueAxis verticalAxis)
Generates the clip path.
dataArea
- the dataArea that the plot is being draw in.horizontalAxis
- the horizontal axis.verticalAxis
- the vertical axis.
- The GeneralPath defining the outline
getComposite
public Composite getComposite()
Returns the composite.
getDrawPaint
public Paint getDrawPaint()
Returns the drawPaint.
getDrawStroke
public Stroke getDrawStroke()
Returns the drawStroke.
getFillPaint
public Paint getFillPaint()
Returns the fillPaint.
getXValue
public double[] getXValue()
Returns the xValue.
getYValue
public double[] getYValue()
Returns the yValue.
isClip
public boolean isClip()
Returns the clip.
isDrawPath
public boolean isDrawPath()
Returns the drawPath.
isFillPath
public boolean isFillPath()
Returns the fillPath.
setClip
public void setClip(boolean clip)
Sets the clip.
setComposite
public void setComposite(Composite composite)
Sets the composite.
composite
- The composite to set
setDrawPaint
public void setDrawPaint(Paint drawPaint)
Sets the drawPaint.
drawPaint
- The drawPaint to set
setDrawPath
public void setDrawPath(boolean drawPath)
Sets the drawPath.
drawPath
- The drawPath to set
setDrawStroke
public void setDrawStroke(Stroke drawStroke)
Sets the drawStroke.
drawStroke
- The drawStroke to set
setFillPaint
public void setFillPaint(Paint fillPaint)
Sets the fillPaint.
fillPaint
- The fillPaint to set
setFillPath
public void setFillPath(boolean fillPath)
Sets the fillPath.
fillPath
- The fillPath to set
setXValue
public void setXValue(double[] xValue)
Sets the xValue.
xValue
- The xValue to set
setYValue
public void setYValue(double[] yValue)
Sets the yValue.
yValue
- The yValue to set