Class Graph.SymbolFactory

java.lang.Object
org.bzdev.graphs.Graph.SymbolFactory
Enclosing class:
Graph

public static class Graph.SymbolFactory extends Object
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 Details

    • SymbolFactory

      public SymbolFactory()
      Constructor.
  • Method Details

    • setColor

      public void setColor(Color color)
      Set the symbol color
      Parameters:
      color - the color for the symbol
    • getColor

      public Color 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):
       .      _______
       .         |
       .         |
       .         |
       .         o
       .         |
       .         |
       .      ___|___
       .
       
      Note that error bars can be vertical or horizontal, and that some symbols may require both.
      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):
       .      _______
       .         |
       .         |
       .         |
       .         o
       .         |
       .         |
       .      ___|___
       .
       
      Note that error bars can be vertical or horizontal, and that some symbols may require both.
      Returns:
      the tab width in user-space units
    • getSymbolNames

      public String[] getSymbolNames()
      Get the names of known symbols. A service provider interface SymbolProvider can be used to add additional symbols.
      Returns:
      the names of the symbols that have been defined.
    • newSymbol

      public Graph.Symbol newSymbol(String name) throws IllegalArgumentException
      Create a new symbol by name.
      Parameters:
      name - the symbol's name
      Returns:
      the symbol as configured by this factory
      Throws:
      IllegalArgumentException
    • newSymbol

      public Graph.Symbol newSymbol(Class<? extends Graph.Symbol> clazz) throws IllegalArgumentException
      Create a new symbol by class.
      Parameters:
      clazz - the symbol's class.
      Returns:
      the symbol as configured by this factory
      Throws:
      IllegalArgumentException