org.jplot2d.element
Class ElementFactory
- java.lang.Object
-
- org.jplot2d.element.ElementFactory
-
public class ElementFactory extends java.lang.ObjectA factory to produce all kind of plot components.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description <T extends Element>
Tcopy(T element)Create a copy of the given element.<T extends Element>
Tcopy(T element, java.util.Map<Element,Element> copyMap)Create a copy of the given element.Axis[]createAxes(int n)Create n Axes which share the same tick manager.AxiscreateAxis()Create an Axis.AxisRangeLockGroupcreateAxisRangeLockGroup()Create an axis lock group.AxisTickManagercreateAxisTickManager()Create an AxisTickManager, which contains an AxisTransform.AxisTransformcreateAxisTransform()Create an AxisTransform, which contains an axis range lock group.CoordinateAnnotationcreateCoordinateAnnotation(double x, double y, SymbolShape symbol)HLineAnnotationcreateHLineAnnotation(double y)Create a horizontal line annotation with the given y value in world coordinate systemHStripAnnotationcreateHStripAnnotation(double start, double end)Create a horizontal strip annotation with the given y value range in world coordinate systemImageGraphcreateImageGraph(byte[][] byte2d)ImageGraphcreateImageGraph(double[][] double2d)ImageGraphcreateImageGraph(float[][] float2d)ImageGraphcreateImageGraph(int[][] int2d)ImageGraphcreateImageGraph(short[][] short2d)ImageGraphcreateImageGraph(SingleBandImageData data)Create an single band image graph.ImageMappingcreateImageMapping()Create an image mapping.LayercreateLayer()Create a layerLayercreateLayer(Graph graph)PlotcreatePlot()Create a plot with the initial values cacheable: true color: BLACK font: Serif PLAIN 12 margin: extra 12 on left, top, right, bottom sizeMode: FillContainerSizeMode(1) containerSize: 640x480RectangleAnnotationcreateRectangleAnnotation(double x1, double x2, double y1, double y2)Create a rectangle annotation with the given x and y value range in world coordinate system.RGBImageGraphcreateRGBImageGraph(byte[][] red2d, byte[][] green2d, byte[][] blue2d)RGBImageGraphcreateRGBImageGraph(double[][] red2d, double[][] green2d, double[][] blue2d)RGBImageGraphcreateRGBImageGraph(float[][] red2d, float[][] green2d, float[][] blue2d)RGBImageGraphcreateRGBImageGraph(int[][] red2d, int[][] green2d, int[][] blue2d)RGBImageGraphcreateRGBImageGraph(MultiBandImageData data)Create an single band image graph.RGBImageGraphcreateRGBImageGraph(short[][] red2d, short[][] green2d, short[][] blue2d)RGBImageMappingcreateRGBImageMapping()Create an image mapping.java.awt.BasicStrokecreateStroke(float width)java.awt.BasicStrokecreateStroke(float width, float[] dash)PlotcreateSubplot()Create a plot which can be added to other plot later.SymbolAnnotationcreateSymbolAnnotation(double x, double y)SymbolAnnotationcreateSymbolAnnotation(double x, double y, java.lang.String text)SymbolAnnotationcreateSymbolAnnotation(double x, double y, SymbolShape symbol)SymbolAnnotationcreateSymbolAnnotation(double x, double y, SymbolShape symbol, java.lang.String text)TitlecreateTitle(java.lang.String text)Create a plot title.VLineAnnotationcreateVLineAnnotation(double x)Create a vertical line annotation with the given y value in world coordinate systemVStripAnnotationcreateVStripAnnotation(double start, double end)Create a vertical strip annotation with the given x value range in world coordinate system.XYGraphcreateXYGraph(ArrayPair xy)Create a XYGraph with the given ArrayPair.XYGraphcreateXYGraph(ArrayPair xy, ArrayPair errorX, ArrayPair errorY)Create a XYGraph with the given x/y ArrayPair, x low/high error ArrayPair and y low/high error ArrayPair.XYGraphcreateXYGraph(ArrayPair xy, ArrayPair errorX, ArrayPair errorY, java.lang.String name)Create a XYGraph with the given x/y ArrayPair, x low/high error ArrayPair and y low/high error ArrayPair.XYGraphcreateXYGraph(ArrayPair xy, java.lang.String name)Create a XYGraph with the given x/y ArrayPair.XYGraphcreateXYGraph(java.lang.Object xarray, java.lang.Object yarray)Create a XYGraph with the given x/y array.XYGraphcreateXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.Object xErrorLow, java.lang.Object xErrorHigh, java.lang.Object yErrorLow, java.lang.Object yErrorHigh)Create a XYGraph with the given x/y array, x low/high error array and y low/high error array.XYGraphcreateXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.Object xErrorLow, java.lang.Object xErrorHigh, java.lang.Object yErrorLow, java.lang.Object yErrorHigh, java.lang.String name)Create a XYGraph with the given x/y array, x low/high error array and y low/high error array.XYGraphcreateXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.String name)Create a XYGraph with the given x/y array.XYGraphcreateXYGraph(XYGraphData data)Create a XYGraph with the given graph dataXYGraphcreateXYGraph(XYGraphData data, java.lang.String name)Create a XYGraph with the given graph data and namestatic ElementFactorygetInstance()Returns an instance of ComponentFactory.static ElementFactorygetInstance(StyleConfiguration profile)Returns an instance of ComponentFactory which is configured by profile.static ElementFactorygetThreadSafeInstance()Returns an instance of ComponentFactory.static ElementFactorygetThreadSafeInstance(StyleConfiguration profile)Returns an instance of ComponentFactory which is configured by profile.<T extends Element>
Tproxy(ElementEx impl, java.lang.Class<T> clazz)Create proxy for the given impl
-
-
-
Method Detail
-
getInstance
public static ElementFactory getInstance()
Returns an instance of ComponentFactory. All component created by this factory are not thread-safe.- Returns:
- an instance of ComponentFactory
-
getThreadSafeInstance
public static ElementFactory getThreadSafeInstance()
Returns an instance of ComponentFactory. All component created by this factory are thread-safe.- Returns:
- an instance of ComponentFactory
-
getInstance
public static ElementFactory getInstance(StyleConfiguration profile)
Returns an instance of ComponentFactory which is configured by profile. All component created by this factory are not thread-safe.- Parameters:
profile-- Returns:
- an instance of ComponentFactory
-
getThreadSafeInstance
public static ElementFactory getThreadSafeInstance(StyleConfiguration profile)
Returns an instance of ComponentFactory which is configured by profile. All component created by this factory are thread-safe.- Parameters:
profile-- Returns:
- an instance of ComponentFactory
-
proxy
public <T extends Element> T proxy(ElementEx impl, java.lang.Class<T> clazz)
Create proxy for the given impl- Type Parameters:
T- the proxy type- Parameters:
impl- the implclazz- the class of proxy type- Returns:
- the proxy
-
createPlot
public Plot createPlot()
Create a plot with the initial values- cacheable: true
- color: BLACK
- font: Serif PLAIN 12
- margin: extra 12 on left, top, right, bottom
- sizeMode: FillContainerSizeMode(1)
- containerSize: 640x480
- Returns:
-
createSubplot
public Plot createSubplot()
Create a plot which can be added to other plot later.- Returns:
-
createTitle
public Title createTitle(java.lang.String text)
Create a plot title.- Parameters:
text- the title text- Returns:
- a plot title
-
createAxis
public Axis createAxis()
Create an Axis. The default position isAxisPosition.NEGATIVE_SIDE- Returns:
- a axis
-
createAxes
public Axis[] createAxes(int n)
Create n Axes which share the same tick manager. The position of the axis on index 0 isAxisPosition.NEGATIVE_SIDE, the position of the axis on index 1 isAxisPosition.POSITIVE_SIDE. All the created axes must be added to a plot byPlot.addXAxes(Axis[])orPlot.addYAxes(Axis[])- Returns:
- axes in an array
-
createAxisTickManager
public AxisTickManager createAxisTickManager()
Create an AxisTickManager, which contains an AxisTransform.- Returns:
- an AxisTickManager
-
createAxisTransform
public AxisTransform createAxisTransform()
Create an AxisTransform, which contains an axis range lock group.- Returns:
- an AxisTransform
-
createAxisRangeLockGroup
public AxisRangeLockGroup createAxisRangeLockGroup()
Create an axis lock group.- Returns:
- an axis lock group
-
createLayer
public Layer createLayer()
Create a layer- Returns:
- a layer
-
createXYGraph
public XYGraph createXYGraph(java.lang.Object xarray, java.lang.Object yarray)
Create a XYGraph with the given x/y array.- Parameters:
xarray- the x data array, can be byte[], short[], int[], long[], float[] or double[]yarray- the y data array, can be byte[], short[], int[], long[], float[] or double[]- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.String name)
Create a XYGraph with the given x/y array.- Parameters:
xarray- the x data array, can be byte[], short[], int[], long[], float[] or double[]yarray- the y data array, can be byte[], short[], int[], long[], float[] or double[]name- the name of created XYGraph, can display in legend- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.Object xErrorLow, java.lang.Object xErrorHigh, java.lang.Object yErrorLow, java.lang.Object yErrorHigh)
Create a XYGraph with the given x/y array, x low/high error array and y low/high error array.- Parameters:
xarray- the x data array, can be byte[], short[], int[], long[], float[] or double[]yarray- the y data array, can be byte[], short[], int[], long[], float[] or double[]xErrorLow- the x low error array, can be byte[], short[], int[], long[], float[] or double[]xErrorHigh- the x high error array, can be byte[], short[], int[], long[], float[] or double[]yErrorLow- the y low error array, can be byte[], short[], int[], long[], float[] or double[]yErrorHigh- the y high error array, can be byte[], short[], int[], long[], float[] or double[]- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(java.lang.Object xarray, java.lang.Object yarray, java.lang.Object xErrorLow, java.lang.Object xErrorHigh, java.lang.Object yErrorLow, java.lang.Object yErrorHigh, java.lang.String name)
Create a XYGraph with the given x/y array, x low/high error array and y low/high error array.- Parameters:
xarray- the x data array, can be byte[], short[], int[], long[], float[] or double[]yarray- the y data array, can be byte[], short[], int[], long[], float[] or double[]xErrorLow- the x low error array, can be byte[], short[], int[], long[], float[] or double[]xErrorHigh- the x high error array, can be byte[], short[], int[], long[], float[] or double[]yErrorLow- the y low error array, can be byte[], short[], int[], long[], float[] or double[]yErrorHigh- the y high error array, can be byte[], short[], int[], long[], float[] or double[]name- the name of created XYGraph, can display in legend- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(ArrayPair xy)
Create a XYGraph with the given ArrayPair.- Parameters:
xy- the x/y ArrayPair- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(ArrayPair xy, java.lang.String name)
Create a XYGraph with the given x/y ArrayPair.- Parameters:
xy- the x/y ArrayPairname- the name of created XYGraph, can display in legend- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(ArrayPair xy, ArrayPair errorX, ArrayPair errorY)
Create a XYGraph with the given x/y ArrayPair, x low/high error ArrayPair and y low/high error ArrayPair.- Parameters:
xy- the x/y ArrayPairerrorX- the x low/high error ArrayPairerrorY- the y low/high error ArrayPair- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(ArrayPair xy, ArrayPair errorX, ArrayPair errorY, java.lang.String name)
Create a XYGraph with the given x/y ArrayPair, x low/high error ArrayPair and y low/high error ArrayPair.- Parameters:
xy- the x/y ArrayPairerrorX- the x low/high error ArrayPairerrorY- the y low/high error ArrayPairname- the name of created XYGraph, can display in legend- Returns:
- a XYGraph object
-
createXYGraph
public XYGraph createXYGraph(XYGraphData data)
Create a XYGraph with the given graph data- Parameters:
data- the graph to be plotted- Returns:
- a XYGraph
-
createXYGraph
public XYGraph createXYGraph(XYGraphData data, java.lang.String name)
Create a XYGraph with the given graph data and name- Parameters:
data- the graph to be plottedname- the name of created XYGraph, can display in legend- Returns:
- a XYGraph
-
createSymbolAnnotation
public SymbolAnnotation createSymbolAnnotation(double x, double y)
-
createSymbolAnnotation
public SymbolAnnotation createSymbolAnnotation(double x, double y, java.lang.String text)
-
createSymbolAnnotation
public SymbolAnnotation createSymbolAnnotation(double x, double y, SymbolShape symbol)
-
createSymbolAnnotation
public SymbolAnnotation createSymbolAnnotation(double x, double y, SymbolShape symbol, java.lang.String text)
-
createCoordinateAnnotation
public CoordinateAnnotation createCoordinateAnnotation(double x, double y, SymbolShape symbol)
-
createHLineAnnotation
public HLineAnnotation createHLineAnnotation(double y)
Create a horizontal line annotation with the given y value in world coordinate system- Parameters:
y- the y value in world coordinate system- Returns:
- a horizontal line annotation
-
createVLineAnnotation
public VLineAnnotation createVLineAnnotation(double x)
Create a vertical line annotation with the given y value in world coordinate system- Parameters:
x- the y value in world coordinate system- Returns:
- a horizontal line annotation
-
createHStripAnnotation
public HStripAnnotation createHStripAnnotation(double start, double end)
Create a horizontal strip annotation with the given y value range in world coordinate system- Parameters:
start- the y start value in world coordinate systemend- the y end value in world coordinate system- Returns:
- a horizontal strip annotation
-
createVStripAnnotation
public VStripAnnotation createVStripAnnotation(double start, double end)
Create a vertical strip annotation with the given x value range in world coordinate system.- Parameters:
start- the x start value in world coordinate systemend- the x end value in world coordinate system- Returns:
- a vertical strip annotation
-
createRectangleAnnotation
public RectangleAnnotation createRectangleAnnotation(double x1, double x2, double y1, double y2)
Create a rectangle annotation with the given x and y value range in world coordinate system.- Parameters:
x1- the x start value in world coordinate systemx2- the x end value in world coordinate systemy1- the y start value in world coordinate systemy2- the y end value in world coordinate system- Returns:
- a rectangle annotation
-
createStroke
public java.awt.BasicStroke createStroke(float width)
-
createStroke
public java.awt.BasicStroke createStroke(float width, float[] dash)
-
createImageGraph
public ImageGraph createImageGraph(byte[][] byte2d)
-
createImageGraph
public ImageGraph createImageGraph(short[][] short2d)
-
createImageGraph
public ImageGraph createImageGraph(int[][] int2d)
-
createImageGraph
public ImageGraph createImageGraph(float[][] float2d)
-
createImageGraph
public ImageGraph createImageGraph(double[][] double2d)
-
createImageGraph
public ImageGraph createImageGraph(SingleBandImageData data)
Create an single band image graph.- Returns:
- an image graph
-
createImageMapping
public ImageMapping createImageMapping()
Create an image mapping.- Returns:
- an image mapping
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(byte[][] red2d, byte[][] green2d, byte[][] blue2d)
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(short[][] red2d, short[][] green2d, short[][] blue2d)
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(int[][] red2d, int[][] green2d, int[][] blue2d)
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(float[][] red2d, float[][] green2d, float[][] blue2d)
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(double[][] red2d, double[][] green2d, double[][] blue2d)
-
createRGBImageGraph
public RGBImageGraph createRGBImageGraph(MultiBandImageData data)
Create an single band image graph.- Returns:
- an image graph
-
createRGBImageMapping
public RGBImageMapping createRGBImageMapping()
Create an image mapping.- Returns:
- an image mapping
-
copy
public <T extends Element> T copy(T element)
Create a copy of the given element. All sub-element are copied together.- Parameters:
element- the element to be copied.- Returns:
- the copy of given element
-
copy
public <T extends Element> T copy(T element, java.util.Map<Element,Element> copyMap)
Create a copy of the given element. All sub-element are copied together.- Parameters:
element- the element to be copied.copyMap- a map to be filled with mapping from original element to copy element.- Returns:
- the copy of given element
-
-
DMelt 3.0 © DataMelt by jWork.ORG