edu.swri.swiftvis.plot.styles
Class ImageAdder

java.lang.Object
  extended by edu.swri.swiftvis.plot.styles.ImageAdder
All Implemented Interfaces:
DataPlotStyle, GradientUser, java.io.Serializable

public class ImageAdder
extends java.lang.Object
implements DataPlotStyle, GradientUser

The purpose of this class is to add an image into a plot. The image will be scaled appropriately for the bounds on the plot and the user can sepcify the location and size of the image itself. I'm creating this largely so that I have an easy way to put axes on the PNG plots that are created by the ring analysis program. * @author mlewis

See Also:
Serialized Form

Nested Class Summary
private  class ImageAdder.ColorPickPanel
           
private  class ImageAdder.SwapPair
           
 
Field Summary
private  ColorGradient blueGradient
           
private  int clipSizeX
           
private  int clipSizeY
           
private  int clipX
           
private  int clipY
           
private  java.util.Vector<ImageAdder.SwapPair> colorSwaps
           
private  java.awt.image.BufferedImage fullImage
           
private  ColorGradient greenGradient
           
private  boolean imageColored
           
private  java.io.File imageFile
           
private  boolean imageRead
           
private  java.awt.image.BufferedImage img
           
private  double maxY
           
private  double minX
           
private  java.awt.image.BufferedImage originalImage
           
private  PlotArea2D plotArea
           
private  javax.swing.JPanel propPanel
           
private  ColorGradient redGradient
           
private static long serialVersionUID
           
private  double sizeX
           
private  double sizeY
           
 
Constructor Summary
ImageAdder(ImageAdder c, PlotArea2D pa)
           
ImageAdder(PlotArea2D pa)
           
 
Method Summary
 void applyGradient(ColorGradient cg)
           
 ImageAdder copy(PlotArea2D pa)
           
 void drawToGraphics(java.awt.Graphics2D g, double xSize, double ySize)
          Creates a transform and draws the image using it.
 double[][] getBounds()
          This method return the bounds the user input.
 PlotLegend getLegendInformation()
          This method should return the legend information for this plot style.
 javax.swing.JComponent getPropertiesPanel()
          Returns a panel in which the user can specify the parameters of the image.
static java.lang.String getTypeDescription()
           
private  void loadImage()
           
 void redoBounds()
          This method does nothing as the bounds are user inputs.
private  void setClipSizeX(javax.swing.JTextField field)
           
private  void setClipSizeY(javax.swing.JTextField field)
           
private  void setClipX(javax.swing.JTextField field)
           
private  void setClipY(javax.swing.JTextField field)
           
private  void setMaxY(javax.swing.JTextField field)
           
private  void setMinX(javax.swing.JTextField field)
           
private  void setSizeX(javax.swing.JTextField field)
           
private  void setSizeY(javax.swing.JTextField field)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

plotArea

private PlotArea2D plotArea

imageFile

private java.io.File imageFile

minX

private double minX

maxY

private double maxY

sizeX

private double sizeX

sizeY

private double sizeY

clipX

private int clipX

clipY

private int clipY

clipSizeX

private int clipSizeX

clipSizeY

private int clipSizeY

colorSwaps

private java.util.Vector<ImageAdder.SwapPair> colorSwaps

redGradient

private ColorGradient redGradient

greenGradient

private ColorGradient greenGradient

blueGradient

private ColorGradient blueGradient

propPanel

private transient javax.swing.JPanel propPanel

originalImage

private transient java.awt.image.BufferedImage originalImage

fullImage

private transient java.awt.image.BufferedImage fullImage

img

private transient java.awt.image.BufferedImage img

imageRead

private transient boolean imageRead

imageColored

private transient boolean imageColored

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

ImageAdder

public ImageAdder(PlotArea2D pa)

ImageAdder

public ImageAdder(ImageAdder c,
                  PlotArea2D pa)
Method Detail

getTypeDescription

public static java.lang.String getTypeDescription()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBounds

public double[][] getBounds()
This method return the bounds the user input.

Specified by:
getBounds in interface DataPlotStyle
Returns:
The bounds for this data.
See Also:
DataPlotStyle.getBounds()

redoBounds

public void redoBounds()
This method does nothing as the bounds are user inputs.

Specified by:
redoBounds in interface DataPlotStyle
See Also:
DataPlotStyle.redoBounds()

getLegendInformation

public PlotLegend getLegendInformation()
Description copied from interface: DataPlotStyle
This method should return the legend information for this plot style. If there is no legend information for this type of plot, then it should return null.

Specified by:
getLegendInformation in interface DataPlotStyle
Returns:
The legend information or null if none.

getPropertiesPanel

public javax.swing.JComponent getPropertiesPanel()
Returns a panel in which the user can specify the parameters of the image.

Specified by:
getPropertiesPanel in interface DataPlotStyle
See Also:
DataPlotStyle.getPropertiesPanel()

drawToGraphics

public void drawToGraphics(java.awt.Graphics2D g,
                           double xSize,
                           double ySize)
Creates a transform and draws the image using it.

Specified by:
drawToGraphics in interface DataPlotStyle
See Also:
DataPlotStyle.drawToGraphics(java.awt.Graphics2D, double, double)

copy

public ImageAdder copy(PlotArea2D pa)
Specified by:
copy in interface DataPlotStyle

applyGradient

public void applyGradient(ColorGradient cg)
Specified by:
applyGradient in interface GradientUser

loadImage

private void loadImage()
                throws java.io.IOException
Throws:
java.io.IOException

setMinX

private void setMinX(javax.swing.JTextField field)

setMaxY

private void setMaxY(javax.swing.JTextField field)

setSizeX

private void setSizeX(javax.swing.JTextField field)

setSizeY

private void setSizeY(javax.swing.JTextField field)

setClipX

private void setClipX(javax.swing.JTextField field)

setClipY

private void setClipY(javax.swing.JTextField field)

setClipSizeX

private void setClipSizeX(javax.swing.JTextField field)

setClipSizeY

private void setClipSizeY(javax.swing.JTextField field)