public class CrosshairState extends Object
Constructor and Description |
---|
CrosshairState()
Creates a new
CrosshairState instance that calculates
distance in Java2D space. |
CrosshairState(boolean calculateDistanceInDataSpace)
Creates a new
CrosshairState instance. |
Modifier and Type | Method and Description |
---|---|
Point2D |
getAnchor()
Returns the anchor point.
|
double |
getAnchorX()
Returns the x-coordinate (in data space) for the anchor point.
|
double |
getAnchorY()
Returns the y-coordinate (in data space) for the anchor point.
|
double |
getCrosshairDistance()
Returns the distance between the anchor point and the current crosshair
point.
|
double |
getCrosshairX()
Get the x-value for the crosshair point.
|
double |
getCrosshairY()
Get the y-value for the crosshair point.
|
int |
getDatasetIndex()
Returns the dataset index that the crosshair values relate to.
|
int |
getDomainAxisIndex()
Deprecated.
As of version 1.0.11, the domain axis should be determined
using the dataset index.
|
int |
getRangeAxisIndex()
Deprecated.
As of version 1.0.11, the domain axis should be determined
using the dataset index.
|
void |
setAnchor(Point2D anchor)
Sets the anchor point.
|
void |
setAnchorX(double x)
Sets the x-coordinate (in data space) for the anchor point.
|
void |
setAnchorY(double y)
Sets the y-coordinate (in data space) for the anchor point.
|
void |
setCrosshairDistance(double distance)
Sets the distance between the anchor point and the current crosshair
point.
|
void |
setCrosshairX(double x)
Sets the x coordinate for the crosshair.
|
void |
setCrosshairY(double y)
Sets the y coordinate for the crosshair.
|
void |
setDatasetIndex(int index)
Sets the dataset index that the current crosshair values relate to.
|
void |
updateCrosshairPoint(double x,
double y,
double transX,
double transY,
PlotOrientation orientation)
Deprecated.
Use
updateCrosshairPoint(double, double, int, int,
double, double, PlotOrientation) . See bug report 1086307. |
void |
updateCrosshairPoint(double x,
double y,
int domainAxisIndex,
int rangeAxisIndex,
double transX,
double transY,
PlotOrientation orientation)
Evaluates a data point and if it is the closest to the anchor point it
becomes the new crosshair point.
|
void |
updateCrosshairX(double candidateX)
Deprecated.
Use
updateCrosshairX(double, int) . See bug report
1086307. |
void |
updateCrosshairX(double candidateX,
int domainAxisIndex)
Evaluates an x-value and if it is the closest to the anchor x-value it
becomes the new crosshair value.
|
void |
updateCrosshairY(double candidateY)
Deprecated.
Use
updateCrosshairY(double, int) . See bug report
1086307. |
void |
updateCrosshairY(double candidateY,
int rangeAxisIndex)
Evaluates a y-value and if it is the closest to the anchor y-value it
becomes the new crosshair value.
|
public CrosshairState()
CrosshairState
instance that calculates
distance in Java2D space.public CrosshairState(boolean calculateDistanceInDataSpace)
CrosshairState
instance.calculateDistanceInDataSpace
- a flag that controls whether the
distance is calculated in data
space or Java2D space.public double getCrosshairDistance()
setCrosshairDistance(double)
public void setCrosshairDistance(double distance)
distance
- the distance.getCrosshairDistance()
public void updateCrosshairPoint(double x, double y, double transX, double transY, PlotOrientation orientation)
updateCrosshairPoint(double, double, int, int,
double, double, PlotOrientation)
. See bug report 1086307.
To understand this method, you need to know the context in which it will
be called. An instance of this class is passed to an
XYItemRenderer
as
each data point is plotted. As the point is plotted, it is passed to
this method to see if it should be the new crosshair point.
x
- x coordinate (measured against the domain axis).y
- y coordinate (measured against the range axis).transX
- x translated into Java2D space.transY
- y translated into Java2D space.orientation
- the plot orientation.public void updateCrosshairPoint(double x, double y, int domainAxisIndex, int rangeAxisIndex, double transX, double transY, PlotOrientation orientation)
To understand this method, you need to know the context in which it will
be called. An instance of this class is passed to an
XYItemRenderer
as
each data point is plotted. As the point is plotted, it is passed to
this method to see if it should be the new crosshair point.
x
- x coordinate (measured against the domain axis).y
- y coordinate (measured against the range axis).domainAxisIndex
- the index of the domain axis for this point.rangeAxisIndex
- the index of the range axis for this point.transX
- x translated into Java2D space.transY
- y translated into Java2D space.orientation
- the plot orientation.public void updateCrosshairX(double candidateX)
updateCrosshairX(double, int)
. See bug report
1086307.Used in cases where only the x-axis is numerical.
candidateX
- x position of the candidate for the new crosshair
point.public void updateCrosshairX(double candidateX, int domainAxisIndex)
Used in cases where only the x-axis is numerical.
candidateX
- x position of the candidate for the new crosshair
point.domainAxisIndex
- the index of the domain axis for this x-value.public void updateCrosshairY(double candidateY)
updateCrosshairY(double, int)
. See bug report
1086307.Used in cases where only the y-axis is numerical.
candidateY
- y position of the candidate for the new crosshair
point.public void updateCrosshairY(double candidateY, int rangeAxisIndex)
Used in cases where only the y-axis is numerical.
candidateY
- y position of the candidate for the new crosshair
point.rangeAxisIndex
- the index of the range axis for this y-value.public Point2D getAnchor()
setAnchor(Point2D)
public void setAnchor(Point2D anchor)
anchor
- the anchor point (null
permitted).getAnchor()
public double getAnchorX()
public void setAnchorX(double x)
x
- the x-coordinate.public double getAnchorY()
public void setAnchorY(double y)
y
- the y-coordinate.public double getCrosshairX()
setCrosshairX(double)
public void setCrosshairX(double x)
x
- the coordinate.getCrosshairX()
,
setCrosshairY(double)
,
updateCrosshairPoint(double, double, double, double,
PlotOrientation)
public double getCrosshairY()
setCrosshairY(double)
public void setCrosshairY(double y)
y
- the y coordinate.getCrosshairY()
,
setCrosshairX(double)
,
updateCrosshairPoint(double, double, double, double,
PlotOrientation)
public int getDatasetIndex()
setDatasetIndex(int)
public void setDatasetIndex(int index)
index
- the dataset index.getDatasetIndex()
public int getDomainAxisIndex()
public int getRangeAxisIndex()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics