org.opensourcephysics.display
Class MeasuredImage

java.lang.Object
  extended by org.opensourcephysics.display.MeasuredImage
All Implemented Interfaces:
Drawable, Measurable
Direct Known Subclasses:
BinaryLattice, ByteRaster, CellLatticePC, ComplexGridPlot, ComplexInterpolatedPlot, GrayscalePlot, GridPlot, IntegerRaster, InterpolatedPlot

public class MeasuredImage
extends java.lang.Object
implements Measurable

MeasuredImage contains an image and a scale in world units. When a MeasuredImage is added to a drawing panel, the image will scale itself to the panel's world units.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
protected  java.awt.image.BufferedImage image
           
protected  boolean visible
           
protected  double xmax
           
protected  double xmin
           
protected  double ymax
           
protected  double ymin
           
 
Constructor Summary
MeasuredImage()
          Constructs a MeasuredImage with a pixel scale.
MeasuredImage(java.awt.image.BufferedImage image)
          Constructs a MeasuredImage with a pixel scale.
MeasuredImage(java.awt.image.BufferedImage _image, double _xmin, double _xmax, double _ymin, double _ymax)
          Constructs a MeasuredImage with the given scale.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the image on the panel.
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMin()
          Gets the minimum y needed to draw this object.
 boolean isMeasured()
          Determines if information is available to set min/max values.
 void setImage(java.awt.image.BufferedImage _image)
           
 void setMinMax(double _xmin, double _xmax, double _ymin, double _ymax)
           
 void setVisible(boolean isVisible)
          Sets the visibility of the lattice.
 void setXMax(double _xmax)
           
 void setXMin(double _xmin)
           
 void setYMax(double _ymax)
           
 void setYMin(double _ymin)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

protected java.awt.image.BufferedImage image

xmin

protected double xmin

xmax

protected double xmax

ymin

protected double ymin

ymax

protected double ymax

visible

protected boolean visible
Constructor Detail

MeasuredImage

public MeasuredImage()
Constructs a MeasuredImage with a pixel scale.


MeasuredImage

public MeasuredImage(java.awt.image.BufferedImage image)
Constructs a MeasuredImage with a pixel scale.

Parameters:
image - the image

MeasuredImage

public MeasuredImage(java.awt.image.BufferedImage _image,
                     double _xmin,
                     double _xmax,
                     double _ymin,
                     double _ymax)
Constructs a MeasuredImage with the given scale.

Parameters:
_image -
_xmin -
_xmax -
_ymin -
_ymax -
Method Detail

setImage

public void setImage(java.awt.image.BufferedImage _image)

setVisible

public void setVisible(boolean isVisible)
Sets the visibility of the lattice. Drawing will be disabled if visible is false.

Parameters:
isVisible -

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the image on the panel.

Specified by:
draw in interface Drawable
Parameters:
panel -
g -

isMeasured

public boolean isMeasured()
Description copied from interface: Measurable
Determines if information is available to set min/max values. Objects that store data should return false if data is null.

Specified by:
isMeasured in interface Measurable
Returns:
true if min/max values are valid

getXMin

public double getXMin()
Description copied from interface: Measurable
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
minimum

getXMax

public double getXMax()
Description copied from interface: Measurable
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
maximum

getYMin

public double getYMin()
Description copied from interface: Measurable
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
minimum

getYMax

public double getYMax()
Description copied from interface: Measurable
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Returns:
minimum

setXMin

public void setXMin(double _xmin)

setXMax

public void setXMax(double _xmax)

setYMin

public void setYMin(double _ymin)

setYMax

public void setYMax(double _ymax)

setMinMax

public void setMinMax(double _xmin,
                      double _xmax,
                      double _ymin,
                      double _ymax)