Package org.opensourcephysics.display
Class MeasuredImage
java.lang.Object
org.opensourcephysics.display.MeasuredImage
- All Implemented Interfaces:
Drawable,Measurable
- Direct Known Subclasses:
BinaryLattice,ByteRaster,CellLatticePC,ComplexGridPlot,ComplexInterpolatedPlot,GrayscalePlot,GridPlot,IntegerRaster,InterpolatedPlot
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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a MeasuredImage with a pixel scale.MeasuredImage(BufferedImage image) Constructs a MeasuredImage with a pixel scale.MeasuredImage(BufferedImage _image, double _xmin, double _xmax, double _ymin, double _ymax) Constructs a MeasuredImage with the given scale. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(DrawingPanel panel, Graphics g) Draws the image on the panel.getImage()doublegetXMax()Gets the maximum x needed to draw this object.doublegetXMin()Gets the minimum x needed to draw this object.doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.booleanDetermines if information is available to set min/max values.voidsetImage(BufferedImage _image) voidsetMinMax(double _xmin, double _xmax, double _ymin, double _ymax) voidsetVisible(boolean isVisible) Sets the visibility of the lattice.voidsetXMax(double _xmax) voidsetXMin(double _xmin) voidsetYMax(double _ymax) voidsetYMin(double _ymin) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
-
Field Details
-
image
-
xmin
protected double xmin -
xmax
protected double xmax -
ymin
protected double ymin -
ymax
protected double ymax -
visible
protected boolean visible -
minmax
protected double[] minmax
-
-
Constructor Details
-
MeasuredImage
public MeasuredImage()Constructs a MeasuredImage with a pixel scale. -
MeasuredImage
Constructs a MeasuredImage with a pixel scale.- Parameters:
image- the image
-
MeasuredImage
Constructs a MeasuredImage with the given scale.- Parameters:
_image-_xmin-_xmax-_ymin-_ymax-
-
-
Method Details
-
setImage
-
getImage
-
setVisible
public void setVisible(boolean isVisible) Sets the visibility of the lattice. Drawing will be disabled if visible is false.- Parameters:
isVisible-
-
draw
Draws the image on the panel. -
isMeasured
public boolean isMeasured()Description copied from interface:MeasurableDetermines if information is available to set min/max values. Objects that store data should return false if data is null.- Specified by:
isMeasuredin interfaceMeasurable- Returns:
- true if min/max values are valid
-
getXMin
public double getXMin()Description copied from interface:MeasurableGets the minimum x needed to draw this object.- Specified by:
getXMinin interfaceMeasurable- Returns:
- minimum
-
getXMax
public double getXMax()Description copied from interface:MeasurableGets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- maximum
-
getYMin
public double getYMin()Description copied from interface:MeasurableGets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- minimum
-
getYMax
public double getYMax()Description copied from interface:MeasurableGets the maximum y needed to draw this object.- Specified by:
getYMaxin interfaceMeasurable- 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)
-