java.lang.Object
org.jfree.chart3d.renderer.AbstractRenderer3D
org.jfree.chart3d.renderer.xyz.AbstractXYZRenderer
org.jfree.chart3d.renderer.xyz.SurfaceRenderer
- All Implemented Interfaces:
Serializable
,ChartElement
,ColorScaleRenderer
,Renderer3D
,XYZRenderer
public class SurfaceRenderer
extends AbstractXYZRenderer
implements XYZRenderer, ColorScaleRenderer, Serializable
A renderer that plots a surface based on a function (any implementation
of
For the fastest rendering, the
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
Function3D
). This renderer is different to others in that it
does not plot data from a dataset, instead it samples a function and plots
those values. By default 900 samples are taken (30 x-values by 30 z-values)
although this can be modified.
For the fastest rendering, the
drawFaceOutlines
flag can be set
to false
(the default is true
) but this may
cause slight rendering artifacts if anti-aliasing is on (note that switching
off anti-aliasing as well also improves rendering performance).
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
- Since:
- 1.1
- See Also:
-
Field Summary
Fields inherited from interface org.jfree.chart3d.renderer.Renderer3D
TRANSPARENT_COLOR
-
Constructor Summary
ConstructorsConstructorDescriptionSurfaceRenderer
(Function3D function) Creates a new renderer for the specified function. -
Method Summary
Modifier and TypeMethodDescriptionvoid
composeAll
(XYZPlot plot, World world, Dimension3D dimensions, double xOffset, double yOffset, double zOffset) Composes the entire representation of the function in the suppliedworld
.void
composeItem
(XYZDataset dataset, int series, int item, World world, Dimension3D dimensions, double xOffset, double yOffset, double zOffset) Throws anUnsupportedOperationException
because this renderer does not support per-item rendering.boolean
Tests this renderer for equality with an arbitrary object.findXRange
(XYZDataset dataset) Returns the current range for the x-axis - the method is overridden because this renderer does not use a dataset (it samples and plots a function directly).findYRange
(XYZDataset dataset) Returns the range that the renderer requires on the y-axis to display all the data in the function.findZRange
(XYZDataset dataset) Returns the current range for the z-axis - the method is overridden because this renderer does not use a dataset (it samples and plots a function directly).Returns the color scale.Returns the compose-type for the renderer.boolean
Returns the flag that controls whether or not the faces that make up the surface have their outlines drawn during rendering.int
Returns the number of samples the renderer will take along the x-axis when plotting the function.int
Returns the number of samples the renderer will take along the z-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners.void
setColorScale
(ColorScale colorScale) Sets the color scale and sends aRenderer3DChangeEvent
to all registered listeners.void
setDrawFaceOutlines
(boolean draw) Sets a flag that controls whether or not the faces that make up the surface are drawn (as well as filled) and sends aRenderer3DChangeEvent
to all registered listeners.void
setXSamples
(int count) Sets the number of samples the renderer will take along the x-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners.void
setZSamples
(int count) Sets the number of samples the renderer will take along the z-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners.Methods inherited from class org.jfree.chart3d.renderer.xyz.AbstractXYZRenderer
getColorSource, getItemLabelGenerator, getPlot, setColors, setColorSource, setItemLabelGenerator, setPlot
Methods inherited from class org.jfree.chart3d.renderer.AbstractRenderer3D
addChangeListener, fireChangeEvent, getItemLabelBackgroundColor, getItemLabelColor, getItemLabelFont, getItemLabelPositioning, isNotify, notifyListeners, receive, removeChangeListener, setItemLabelBackgroundColor, setItemLabelColor, setItemLabelFont, setItemLabelPositioning, setNotify
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.chart3d.ChartElement
receive
Methods inherited from interface org.jfree.chart3d.renderer.Renderer3D
addChangeListener, removeChangeListener
Methods inherited from interface org.jfree.chart3d.renderer.xyz.XYZRenderer
getColorSource, getPlot, setColors, setColorSource, setPlot
-
Constructor Details
-
SurfaceRenderer
Creates a new renderer for the specified function. By default, the renderer will take 30 samples along the x-axis and 30 samples along the z-axis (this is configurable).- Parameters:
function
- the function (null
not permitted).
-
-
Method Details
-
getXSamples
Returns the number of samples the renderer will take along the x-axis when plotting the function. The default value is 30.- Returns:
- The number of samples.
-
setXSamples
Sets the number of samples the renderer will take along the x-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners. The default value is 30, setting this to higher values will result in smoother looking plots, but they will take longer to draw.- Parameters:
count
- the count.- See Also:
-
getZSamples
Returns the number of samples the renderer will take along the z-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners. The default value is 30.- Returns:
- The number of samples.
-
setZSamples
Sets the number of samples the renderer will take along the z-axis when plotting the function and sends aRenderer3DChangeEvent
to all registered listeners. The default value is 30, setting this to higher values will result in smoother looking plots, but they will take longer to draw.- Parameters:
count
- the count.- See Also:
-
getComposeType
Returns the compose-type for the renderer. Here the value isComposeType.ALL
which means the plot will call thecomposeAll(org.jfree.chart3d.plot.XYZPlot, org.jfree.chart3d.graphics3d.World, org.jfree.chart3d.graphics3d.Dimension3D, double, double, double)
method for composing the chart.- Specified by:
getComposeType
in interfaceXYZRenderer
- Overrides:
getComposeType
in classAbstractXYZRenderer
- Returns:
- The compose type (never
null
).
-
getColorScale
Returns the color scale. This determines the color of the surface according to the y-value.- Specified by:
getColorScale
in interfaceColorScaleRenderer
- Returns:
- The color scale (never
null
).
-
setColorScale
Sets the color scale and sends aRenderer3DChangeEvent
to all registered listeners.- Parameters:
colorScale
- the color scale (null
not permitted).
-
getDrawFaceOutlines
Returns the flag that controls whether or not the faces that make up the surface have their outlines drawn during rendering. The default value istrue
.- Returns:
- A boolean.
-
setDrawFaceOutlines
Sets a flag that controls whether or not the faces that make up the surface are drawn (as well as filled) and sends aRenderer3DChangeEvent
to all registered listeners. If the face outlines are drawn (the default), the surface is solid (but takes longer to draw). If the face outlines are not drawn, Java2D can leave small gaps that you can "see" through (if you don't mind this, then the performance is better).- Parameters:
draw
- the new flag value.
-
composeAll
public void composeAll(XYZPlot plot, World world, Dimension3D dimensions, double xOffset, double yOffset, double zOffset) Composes the entire representation of the function in the suppliedworld
.- Specified by:
composeAll
in interfaceXYZRenderer
- Overrides:
composeAll
in classAbstractXYZRenderer
- Parameters:
plot
- the plot.world
- the world.dimensions
- the plot dimensions.xOffset
- the x-offset.yOffset
- the y-offset.zOffset
- the z-offset.
-
composeItem
public void composeItem(XYZDataset dataset, int series, int item, World world, Dimension3D dimensions, double xOffset, double yOffset, double zOffset) Throws anUnsupportedOperationException
because this renderer does not support per-item rendering.- Specified by:
composeItem
in interfaceXYZRenderer
- Parameters:
dataset
- the dataset (null
not permitted).series
- the series index.item
- the item index.world
- the world (null
not permitted).dimensions
- the dimensions (null
not permitted).xOffset
- the x-offset.yOffset
- the y-offset.zOffset
- the z-offset.
-
findXRange
Returns the current range for the x-axis - the method is overridden because this renderer does not use a dataset (it samples and plots a function directly).- Specified by:
findXRange
in interfaceXYZRenderer
- Overrides:
findXRange
in classAbstractXYZRenderer
- Parameters:
dataset
- the dataset (ignored).- Returns:
- The x-range (never
null
).
-
findYRange
Returns the range that the renderer requires on the y-axis to display all the data in the function.- Specified by:
findYRange
in interfaceXYZRenderer
- Overrides:
findYRange
in classAbstractXYZRenderer
- Parameters:
dataset
- the dataset (ignored).- Returns:
- The range.
-
findZRange
Returns the current range for the z-axis - the method is overridden because this renderer does not use a dataset (it samples and plots a function directly).- Specified by:
findZRange
in interfaceXYZRenderer
- Overrides:
findZRange
in classAbstractXYZRenderer
- Parameters:
dataset
- the dataset (ignored).- Returns:
- The z-range (never
null
).
-
equals
Tests this renderer for equality with an arbitrary object.- Overrides:
equals
in classAbstractXYZRenderer
- Parameters:
obj
- the object (null
not permitted).- Returns:
- A boolean.
-