java.lang.Object
org.bzdev.graphs.Graph.SymbolFactory
- Enclosing class:
- Graph
Factory class for creating graph symbols.
A service-provider interface
SymbolProvider
can be implemented
to add new symbols. See
SymbolProvider
for details.
The BZDev class library contains the following symbols as a
minimal set of symbols:
EmptyBowtie, EmptyCircle, EmptyHourglass, EmptySquare, SolidBowtie
SolidCircle, SolidHourglass, and SolidSquare. These are located in the
package org.bzdev.graphs.symbols. There are no API pages
for these classes as users will not call a symbol's methods
directly and all of them merely implement
Graph.Symbol
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColor()
Get the symbol colordouble
Get the total tab width for an error bar.double
Get the line thickness for drawing the symboldouble
Get the scale factor for the symbol.String[]
Get the names of known symbols.newSymbol
(Class<? extends Graph.Symbol> clazz) Create a new symbol by class.Create a new symbol by name.void
Set the symbol colorvoid
setErrorBarTab
(double width) Set the total tab width for an error bar.void
setLineThickness
(double thickness) Set the line thickness for drawing the symbolvoid
setScaleFactor
(double scaleFactor) Set the scale factor for the symbol.
-
Constructor Details
-
SymbolFactory
public SymbolFactory()Constructor.
-
-
Method Details
-
setColor
Set the symbol color- Parameters:
color
- the color for the symbol
-
getColor
Get the symbol color- Returns:
- the color for the symbol
-
setLineThickness
public void setLineThickness(double thickness) Set the line thickness for drawing the symbol- Parameters:
thickness
- the line thickness in user-space units
-
getLineThickness
public double getLineThickness()Get the line thickness for drawing the symbol- Returns:
- the line thickness in user-space units
-
setScaleFactor
public void setScaleFactor(double scaleFactor) Set the scale factor for the symbol. Symbols are generally defined so that, for a scale factor of 1.0, they will be sized appropriately for a bounding box 10 units on a side in user-space units. The scale factor can be used to change this default size (the line thickness is scaled along with the shape that is drawn). The default size will be multiplied by the scale factor.- Parameters:
scaleFactor
- the scale factor
-
getScaleFactor
public double getScaleFactor()Get the scale factor for the symbol. Symbols are generally defined so that, for a scale factor of 1.0, they will be sized appropriately for a bounding box 10 units on a side in user-space units. The scale factor can be used to change this default size (the line thickness is scaled along with the shape that is drawn). The default size will be multiplied by the scale factor.- Returns:
- the scale factor
-
setErrorBarTab
public void setErrorBarTab(double width) Set the total tab width for an error bar. The tab width is the length of the lines at the ends of an error bar (the horizontal lines in the following figure):
Note that error bars can be vertical or horizontal, and that some symbols may require both.. _______ . | . | . | . o . | . | . ___|___ .
- Parameters:
width
- the tab width in user-space units
-
getErrorBarTab
public double getErrorBarTab()Get the total tab width for an error bar. The tab width is the length of the lines at the ends of an error bar (the horizontal lines in the following figure):
Note that error bars can be vertical or horizontal, and that some symbols may require both.. _______ . | . | . | . o . | . | . ___|___ .
- Returns:
- the tab width in user-space units
-
getSymbolNames
Get the names of known symbols. A service provider interfaceSymbolProvider
can be used to add additional symbols.- Returns:
- the names of the symbols that have been defined.
-
newSymbol
Create a new symbol by name.- Parameters:
name
- the symbol's name- Returns:
- the symbol as configured by this factory
- Throws:
IllegalArgumentException
-
newSymbol
Create a new symbol by class.- Parameters:
clazz
- the symbol's class.- Returns:
- the symbol as configured by this factory
- Throws:
IllegalArgumentException
-