Package org.opensourcephysics.display2d
Class ComplexSurfacePlot
java.lang.Object
org.opensourcephysics.display2d.ComplexSurfacePlot
- All Implemented Interfaces:
Drawable,False3D,Measurable,Plot2D
SurfacePlot draws a 3D surface of a scalar field.
Surfaceplot uses code from the Surface Plotter package by Yanto Suryono.
- Version:
- 1.0
- Author:
- Wolfgang Christian and Yanto Suryono
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intField INIT_CALC_DIVstatic final intField INIT_DISP_DIVprotected DecimalFormatFields inherited from interface org.opensourcephysics.display2d.Plot2D
CONTOUR_PLOT, GRID_PLOT, INTERPOLATED_PLOT, SURFACE_PLOT -
Constructor Summary
ConstructorsConstructorDescriptionConstructs the ComplexSurfacePlot without data.ComplexSurfacePlot(GridData _griddata) ComplexSurfacePlot constructor with the given data model. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(DrawingPanel panel, Graphics g) Paint the surface.doubleGets the ceiling for scaling the z data.doublegetFloor()Gets the floor for scaling the z data.Gets the GridData object.static XML.ObjectLoaderGets an XML.ObjectLoader to save and load data for this program.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.doubleindexToX(int i) Gets the x coordinate for the given index.doubleindexToY(int i) Gets the y coordinate for the given index.booleanGets the autoscale flag for z.booleanDetermines if information is available to set min/max values.booleanGets the symmetric z flag.voidmouseDragged(MouseEvent e, DrawingPanel drawingPanel) mouseDragevent handler.booleanmousePressed(MouseEvent e, DrawingPanel drawingPanel) mouseDownevent handler.voidmouseReleased(MouseEvent e, DrawingPanel drawingPanel) Method mouseReleasedvoidset2DScaling(double scale) Sets the 2D scaling factor.voidSets the data to new values.voidSets the values and the scale.voidsetAutoscaleZ(boolean isAutoscale, double floor, double ceil) Sets the autoscale flag and the floor and ceiling values.voidsetColorPalette(Color[] colors) Sets the colors that will be used between the floor and ceiling values.voidsetDistance(double distance) Sets the viewing distance.voidsetElevationAngle(double angle) Sets the viewing elevation angle.voidsetExpandedZ(boolean expanded, double expansionFactor) Expands the z scale so as to enhance values close to zero.voidsetFloorCeilColor(Color floorColor, Color ceilColor) Sets the floor and ceiling colors.voidsetGridData(GridData _griddata) Sets the data storage to the given value.voidSets the color for grid line boundariesvoidsetIndexes(int[] indexes) Sets the indexes for the data components that will be plotted.voidsetLabelFormat(String _format) Sets the format for the axis labels.voidsetPaletteType(int type) Determines the palette type that will be used.voidsetRotationAngle(double angle) Sets the viewing rotation angle.voidsetShowGridLines(boolean show) Outlines the data grid's boundaries.voidsetSymmetricZ(boolean symmetric) Forces the z-scale to be symmetric about zero.voidsetTranslation(int xpix, int ypix) Translates the view by the specified number of pixels.voidsetVisible(boolean isVisible) Sets the visibility of the lattice.Shows a legend of phase angle and color.voidupdate()Updates the surface plot using the current data.intxToIndex(double x) Gets closest index from the given x world coordinate.intyToIndex(double y) Gets closest index from the given y world coordinate.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
-
labelFormat
-
INIT_CALC_DIV
public static final int INIT_CALC_DIVField INIT_CALC_DIV- See Also:
-
INIT_DISP_DIV
public static final int INIT_DISP_DIVField INIT_DISP_DIV- See Also:
-
-
Constructor Details
-
ComplexSurfacePlot
public ComplexSurfacePlot()Constructs the ComplexSurfacePlot without data. -
ComplexSurfacePlot
ComplexSurfacePlot constructor with the given data model.- Parameters:
_griddata- GridData
-
-
Method Details
-
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. -
getGridData
Gets the GridData object.- Specified by:
getGridDatain interfacePlot2D- Returns:
- GridData
-
setGridData
Sets the data storage to the given value.- Specified by:
setGridDatain interfacePlot2D- Parameters:
_griddata-- Throws:
IllegalArgumentException
-
setIndexes
public void setIndexes(int[] indexes) Sets the indexes for the data components that will be plotted. Indexes determine the postion of the amplitude, real-component, and imaginary-component in the data array.- Specified by:
setIndexesin interfacePlot2D- Parameters:
indexes- the sample-component indexes
-
setColorPalette
Sets the colors that will be used between the floor and ceiling values. Not implemented. Color always maps to phase.- Specified by:
setColorPalettein interfacePlot2D- Parameters:
colors-
-
setVisible
public void setVisible(boolean isVisible) Sets the visibility of the lattice. Drawing will be disabled if visible is false.- Specified by:
setVisiblein interfacePlot2D- Parameters:
isVisible-
-
showLegend
Shows a legend of phase angle and color.- Specified by:
showLegendin interfacePlot2D
-
setShowGridLines
public void setShowGridLines(boolean show) Outlines the data grid's boundaries.- Specified by:
setShowGridLinesin interfacePlot2D- Parameters:
show-
-
setGridLineColor
Sets the color for grid line boundaries- Specified by:
setGridLineColorin interfacePlot2D- Parameters:
c-
-
draw
Paint the surface. -
setPaletteType
public void setPaletteType(int type) Determines the palette type that will be used.- Specified by:
setPaletteTypein interfacePlot2D- Parameters:
type-
-
setLabelFormat
Sets the format for the axis labels. For example, _format=0.000 will produce three digits to the right of decimal point- Parameters:
_format- the format string
-
setAutoscaleZ
public void setAutoscaleZ(boolean isAutoscale, double floor, double ceil) Sets the autoscale flag and the floor and ceiling values. If autoscaling is true, then the min and max values of z are set using the data. If autoscaling is false, then floor and ceiling values become the max and min. Values below min map to the first color; values above max map to the last color.- Specified by:
setAutoscaleZin interfacePlot2D- Parameters:
isAutoscale-floor-ceil-
-
setSymmetricZ
public void setSymmetricZ(boolean symmetric) Forces the z-scale to be symmetric about zero. Forces zmax to be positive and zmin=-zmax when in autoscale mode.- Specified by:
setSymmetricZin interfacePlot2D- Parameters:
symmetric-
-
isSymmetricZ
public boolean isSymmetricZ()Gets the symmetric z flag.- Specified by:
isSymmetricZin interfacePlot2D
-
isAutoscaleZ
public boolean isAutoscaleZ()Gets the autoscale flag for z.- Specified by:
isAutoscaleZin 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:
getCeilingin interfacePlot2D- Returns:
- double
-
setFloorCeilColor
Sets the floor and ceiling colors.- Specified by:
setFloorCeilColorin interfacePlot2D- Parameters:
floorColor-ceilColor-
-
setExpandedZ
public void setExpandedZ(boolean expanded, double expansionFactor) Expands the z scale so as to enhance values close to zero.- Specified by:
setExpandedZin interfacePlot2D- Parameters:
expanded- booleanexpansionFactor- double
-
update
public void update()Updates the surface plot using the current data. -
setTranslation
public void setTranslation(int xpix, int ypix) Translates the view by the specified number of pixels.- Parameters:
xpix- the x translation in pixelsypix- the y translation in pixels
-
setRotationAngle
public void setRotationAngle(double angle) Sets the viewing rotation angle.- Parameters:
angle- the rotation angle in degrees
-
setElevationAngle
public void setElevationAngle(double angle) Sets the viewing elevation angle.- Parameters:
angle- the elevation angle in degrees
-
setDistance
public void setDistance(double distance) Sets the viewing distance.- Parameters:
distance- the distance
-
set2DScaling
public void set2DScaling(double scale) Sets the 2D scaling factor.- Parameters:
scale- the scaling factor
-
mousePressed
mouseDownevent handler. Sets internal tracking variables for dragging operations.- Parameters:
e- the eventdrawingPanel-- Returns:
- mouse pressed flag
-
mouseReleased
Method mouseReleased- Parameters:
e-drawingPanel-
-
mouseDragged
mouseDragevent handler. Tracks dragging operations. Checks the delay regeneration flag and does proper actions.- Parameters:
e- the eventdrawingPanel-
-
getXMin
public double getXMin()Gets the minimum x needed to draw this object.- Specified by:
getXMinin interfaceMeasurable- Returns:
- minimum
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- maximum
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- minimum
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMaxin interfaceMeasurable- Returns:
- minimum
-
isMeasured
public boolean isMeasured()Determines if information is available to set min/max values. X y values have no meaning for this plot.- Specified by:
isMeasuredin interfaceMeasurable- Returns:
- false
-
getLoader
Gets an XML.ObjectLoader to save and load data for this program.- Returns:
- the object loader
-