MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / GridPlot

Class GridPlot

src/org/opensourcephysics/display2d/GridPlot.java:30–471  ·  view source on GitHub ↗

GridPlot plots a scalar field by coloring pixels using a buffered image. The buffered image is scaled before it is copied to a drawing panel. @author Wolfgang Christian @created February 15, 2003 @version 1.0

Source from the content-addressed store, hash-verified

28 * @version 1.0
29 */
30public class GridPlot extends MeasuredImage implements Plot2D {
31 boolean autoscaleZ = true;
32 boolean symmetricZ = false;
33 GridData griddata;
34 int[] rgbData;
35 Grid grid;
36 ColorMapper colorMap;
37 private int ampIndex = 0; // amplitude index
38
39 /**
40 * Constructs the GridPlot using the given griddata.
41 *
42 * @param griddata the point data
43 */
44 public GridPlot(GridData griddata) {
45 setGridData(griddata);
46 }
47
48 /**
49 * Constructs a GridPlot without any data.
50 */
51 public GridPlot() {}
52
53 /**
54 * Sets the indexes for the data component that will be plotted.
55 *
56 * @param indexes the sample-component
57 */
58 @Override
59public void setIndexes(int[] indexes) {
60 ampIndex = indexes[0];
61 }
62
63 /**
64 * Gets the GridData object.
65 * @return GridData
66 */
67 @Override
68public GridData getGridData() {
69 return griddata;
70 }
71
72 /**
73 * Sets the data storage to the given value.
74 *
75 * @param _griddata new data storage
76 */
77 @Override
78public void setGridData(GridData _griddata) {
79 griddata = _griddata;
80 if(colorMap==null) {
81 colorMap = new ColorMapper(100, -1, 1, ColorMapper.SPECTRUM);
82 }
83 if(griddata==null) {
84 return;
85 }
86 int nx = griddata.getNx();
87 int ny = griddata.getNy();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected