Package org.opensourcephysics.display2d
Class ComplexGridPlot
java.lang.Object
org.opensourcephysics.display.MeasuredImage
org.opensourcephysics.display2d.ComplexGridPlot
- All Implemented Interfaces:
Drawable
,Measurable
,Plot2D
ComplexGridPlot plots a complex scalar field by coloring pixels a buffered image.
The buffered image is scaled before it is copied to a drawing panel.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields inherited from class org.opensourcephysics.display.MeasuredImage
image, minmax, visible, xmax, xmin, ymax, ymin
Fields inherited from interface org.opensourcephysics.display2d.Plot2D
CONTOUR_PLOT, GRID_PLOT, INTERPOLATED_PLOT, SURFACE_PLOT
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs the ComplexGridPlot without data.ComplexGridPlot
(GridData _griddata) Constructs the ComplexGridPlot using the given 2d datset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the image and the grid.double
Gets the ceiling for scaling the z data.double
getFloor()
Gets the floor for scaling the z data.Gets the GridData object.static XML.ObjectLoader
Gets an XML.ObjectLoader to save and load data for this program.double
indexToX
(int i) Gets the x coordinate for the given index.double
indexToY
(int i) Gets the y coordinate for the given index.boolean
Gets the autoscale flag for z.boolean
Gets the symmetric z flag.protected void
Recolors the image pixels using the data array.void
Sets the data to new values.void
Sets the values and the scale.void
setAutoscaleZ
(boolean isAutoscale, double floor, double ceil) Sets the autoscale flag and the floor and ceiling values for the colors.void
setColorPalette
(Color[] colors) Setting the color palette is not supported.void
setExpandedZ
(boolean expanded, double expansionFactor) Expands the magnitude scale so as to enhance values close to zero.void
setFloorCeilColor
(Color floorColor, Color ceilColor) Sets the floor and ceiling colors.void
setGridData
(GridData _griddata) Sets the data storage to the given value.void
Sets the color for grid line boundariesvoid
setIndexes
(int[] indexes) Sets the indexes for the data components that will be plotted.void
setPaletteType
(int type) Setting the palette is not supported.void
setShowGridLines
(boolean showGrid) Shows the grid lines if set to true.void
setSymmetricZ
(boolean symmetric) Forces the z-scale to be symmetric about zero.Shows a legend of phase angle and color.void
update()
Updates in response to changes in the data.int
xToIndex
(double x) Gets closest index from the given x world coordinate.int
yToIndex
(double y) Gets closest index from the given y world coordinate.Methods inherited from class org.opensourcephysics.display.MeasuredImage
getImage, getXMax, getXMin, getYMax, getYMin, isMeasured, setImage, setMinMax, setVisible, setXMax, setXMin, setYMax, setYMin
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
Methods inherited from interface org.opensourcephysics.display2d.Plot2D
setVisible
-
Constructor Details
-
ComplexGridPlot
public ComplexGridPlot()Constructs the ComplexGridPlot without data. -
ComplexGridPlot
Constructs the ComplexGridPlot using the given 2d datset.- Parameters:
_griddata
-
-
-
Method Details
-
getGridData
Gets the GridData object.- Specified by:
getGridData
in interfacePlot2D
- Returns:
- GridData
-
xToIndex
public int xToIndex(double x) Gets closest index from the given x world coordinate. -
yToIndex
public int yToIndex(double y) Gets closest index from the given y world coordinate. -
indexToX
public double indexToX(int i) Gets the x coordinate for the given index. -
indexToY
public double indexToY(int i) Gets the y coordinate for the given index. -
setAll
Sets the data to new values. The grid is resized to fit the new data if needed. -
setAll
Sets the values and the scale. The grid is resized to fit the new data if needed. -
setGridData
Description copied from interface:Plot2D
Sets the data storage to the given value.- Specified by:
setGridData
in interfacePlot2D
-
showLegend
Shows a legend of phase angle and color.- Specified by:
showLegend
in interfacePlot2D
-
setAutoscaleZ
public void setAutoscaleZ(boolean isAutoscale, double floor, double ceil) Sets the autoscale flag and the floor and ceiling values for the colors. If autoscaling is true, then the min and max values of z will span the colors. If autoscaling is false, then floor and ceiling values limit the colors. Values below min map to the first color; values above max map to the last color.- Specified by:
setAutoscaleZ
in interfacePlot2D
- Parameters:
isAutoscale
-floor
- not supportedceil
- ceiling value
-
setSymmetricZ
public void setSymmetricZ(boolean symmetric) Forces the z-scale to be symmetric about zero. Not applicable in complex map because amplitude is always positive- Specified by:
setSymmetricZ
in interfacePlot2D
- Parameters:
symmetric
-
-
isSymmetricZ
public boolean isSymmetricZ()Gets the symmetric z flag.- Specified by:
isSymmetricZ
in interfacePlot2D
-
isAutoscaleZ
public boolean isAutoscaleZ()Gets the autoscale flag for z.- Specified by:
isAutoscaleZ
in interfacePlot2D
- Returns:
- boolean
-
getFloor
public double getFloor()Gets the floor for scaling the z data. -
getCeiling
public double getCeiling()Gets the ceiling for scaling the z data.- Specified by:
getCeiling
in interfacePlot2D
- Returns:
- double
-
setFloorCeilColor
Sets the floor and ceiling colors.- Specified by:
setFloorCeilColor
in interfacePlot2D
- Parameters:
floorColor
- not supportedceilColor
- ceiling color
-
setShowGridLines
public void setShowGridLines(boolean showGrid) Shows the grid lines if set to true.- Specified by:
setShowGridLines
in interfacePlot2D
- Parameters:
showGrid
-
-
update
public void update()Updates in response to changes in the data. -
setExpandedZ
public void setExpandedZ(boolean expanded, double expansionFactor) Expands the magnitude scale so as to enhance values close to zero.- Specified by:
setExpandedZ
in interfacePlot2D
- Parameters:
expanded
- booleanexpansionFactor
- double
-
recolorImage
protected void recolorImage()Recolors the image pixels using the data array. -
draw
Draws the image and the grid.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classMeasuredImage
- Parameters:
panel
-g
-
-
setColorPalette
Setting the color palette is not supported. The complex palette always maps phase to color.- Specified by:
setColorPalette
in interfacePlot2D
- Parameters:
colors
-
-
setPaletteType
public void setPaletteType(int type) Setting the palette is not supported. The complex palette always maps phase to color.- Specified by:
setPaletteType
in interfacePlot2D
- Parameters:
type
-
-
setGridLineColor
Description copied from interface:Plot2D
Sets the color for grid line boundaries- Specified by:
setGridLineColor
in interfacePlot2D
-
setIndexes
public void setIndexes(int[] indexes) Description copied from interface:Plot2D
Sets the indexes for the data components that will be plotted. Indexes determine the postion of the amplitude, phase, x-component, and y-component data in the data array. The amplitude index is usually the first index.- Specified by:
setIndexes
in interfacePlot2D
- Parameters:
indexes
- the sample-component indexes
-
getLoader
Gets an XML.ObjectLoader to save and load data for this program.- Returns:
- the object loader
-