Package org.opensourcephysics.display
Class HighlightableDataset
java.lang.Object
org.opensourcephysics.display.DataTable.DataModel
org.opensourcephysics.display.Dataset
org.opensourcephysics.display.HighlightableDataset
- All Implemented Interfaces:
Data
,Drawable
,Interactive
,LogMeasurable
,Measurable
A Dataset that can highlight selected points.
- Version:
- 1.0
- Author:
- Doug Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.display.Dataset
Dataset.Model
-
Field Summary
Fields inherited from class org.opensourcephysics.display.Dataset
AREA, BAR, CIRCLE, columnID, CUSTOM, customMarker, datasetID, errorBars, generalPath, id, index, maxPoints, maxPointsMultiplier, model, NO_MARKER, PIXEL, POST, shift, sorted, SQUARE, update, visible, xColumnDescription, xmax, xmaxLogscale, xmin, xminLogscale, xpoints, yColumnDescription, ymax, ymaxLogscale, ymin, yminLogscale, ypoints
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.HighlightableDataset
(Color markerColor) Constructor specifying the marker color. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all data from this Dataset.void
Clears highlights.void
draw
(DrawingPanel drawingPanel, Graphics g) Draw this Dataset in the drawing panel.findInteractive
(DrawingPanel panel, int xpix, int ypix) Returns the Interactive object at a specified pixel position.int
int
Gets the most recent hit index.static XML.ObjectLoader
Returns the XML.ObjectLoader for this class.double[][]
Gets the screen coordinates of all data points.int
double
getX()
Implements Interactive.double
getY()
Implements Interactive.boolean
Implements Interactive.boolean
isHighlighted
(int n) Gets the highlighted flag for the specified point.void
Restores previous highlights.void
setEnabled
(boolean enabled) Implements Interactive.void
setHighlightColor
(Color color) Sets the highlight color.void
setHighlighted
(int i, boolean highlight) Sets the highlighted flag for the specified point.void
setHighlights
(BitSet bs) void
setX
(double x) Implements Interactive.void
setXY
(double x, double y) Implements Interactive.void
setY
(double y) Implements Interactive.Methods inherited from class org.opensourcephysics.display.Dataset
append, append, append, append, append, convertTableColumnIndex, countColumnsVisible, drawable, drawClip, drawData, drawScatterPlot, findDataSet, getColumnCount, getColumnID, getColumnName, getColumnNames, getData2D, getData3D, getDataList, getDatasets, getEdgeColor, getFillColor, getFillColors, getID, getIndex, getLineColor, getLineColors, getMarkerShape, getMarkerSize, getMean, getName, getNaNCount, getPoints, getRowCount, getShift, getTranslateInstance, getValidXPoints, getValidYPoints, getValueAt, getVisible, getX, getXColumnDescription, getXColumnName, getXMax, getXMaxLogscale, getXMin, getXMinLogscale, getXPoints, getXPointsRaw, getY, getYColumnDescription, getYColumnName, getYMax, getYMaxLogscale, getYMin, getYMinLogscale, getYPoints, getYPointsRaw, getYShifted, insertionSort, isConnected, isMeasured, isShifted, isSorted, isXColumnVisible, isYColumnVisible, loadDatasets, read, recalculatePath, set, setColumnID, setConnected, setCustomMarker, setID, setLineColor, setMarkerColor, setMarkerColor, setMarkerColor, setMarkerShape, setMarkerSize, setMaximumPoints, setName, setShift, setShifted, setShiftedValue, setSorted, setStride, setVisible, setXColumnDescription, setXColumnVisible, setXYColumnNames, setXYColumnNames, setYColumnDescription, setYColumnVisible, toBoolArray, toString, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
-
Constructor Details
-
HighlightableDataset
public HighlightableDataset()Default constructor. -
HighlightableDataset
Constructor specifying the marker color.- Parameters:
markerColor
- marker color
-
-
Method Details
-
clear
public void clear()Clear all data from this Dataset. -
restoreHighlights
public void restoreHighlights()Restores previous highlights. -
clearHighlights
public void clearHighlights()Clears highlights. -
setHighlighted
public void setHighlighted(int i, boolean highlight) Sets the highlighted flag for the specified point.- Parameters:
i
- the array indexhighlight
- true to highlight the point
-
isHighlighted
public boolean isHighlighted(int n) Gets the highlighted flag for the specified point.- Parameters:
n
- the array index- Returns:
- true if point is highlighted
-
setHighlightColor
Sets the highlight color.- Parameters:
color
- the color
-
draw
Draw this Dataset in the drawing panel. -
findInteractive
Returns the Interactive object at a specified pixel position. Implements Interactive.- Specified by:
findInteractive
in interfaceInteractive
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the object
-
getHitIndex
public int getHitIndex()Gets the most recent hit index.- Returns:
- the hit index
-
getScreenCoordinates
public double[][] getScreenCoordinates()Gets the screen coordinates of all data points.- Returns:
- screen coordinates
-
setEnabled
public void setEnabled(boolean enabled) Implements Interactive.- Specified by:
setEnabled
in interfaceInteractive
- Parameters:
enabled
- ignored
-
isEnabled
public boolean isEnabled()Implements Interactive.- Specified by:
isEnabled
in interfaceInteractive
- Returns:
- true
-
setXY
public void setXY(double x, double y) Implements Interactive.- Specified by:
setXY
in interfaceInteractive
- Parameters:
x
- ignoredy
- ignored
-
setX
public void setX(double x) Implements Interactive.- Specified by:
setX
in interfaceInteractive
- Parameters:
x
- ignored
-
setY
public void setY(double y) Implements Interactive.- Specified by:
setY
in interfaceInteractive
- Parameters:
y
- ignored
-
getX
public double getX()Implements Interactive.- Specified by:
getX
in interfaceInteractive
- Returns:
- the x value at the current hit index, or Double.NaN if none
-
getY
public double getY()Implements Interactive.- Specified by:
getY
in interfaceInteractive
- Returns:
- the y value at the current hit index, or Double.NaN if none
-
getLoader
Returns the XML.ObjectLoader for this class.- Returns:
- the object loader
-
setHighlights
-
getHighlightedBS
-
getHighlightCount
public int getHighlightCount() -
getValidYCount
public int getValidYCount()
-