Class XYArrayPlacement
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.XYArrayPlacement
-
@Equality public abstract class XYArrayPlacement extends java.lang.Object
Defines how to map an XYArrayData object to a definite position in data space.- Since:
- 18 Aug 2022
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static XYArrayPlacementINDEXUses X,Y position at indicated fraction through arrays.static XYArrayPlacementXMAXUses the position with the maximal X value.static XYArrayPlacementXMINUses the position with the minimal X value.static XYArrayPlacementXYMEANUses the center of gravity of all the (X,Y) values.static XYArrayPlacementYMAXUses the position with the maximal Y value.static XYArrayPlacementYMINUses the position with the minimal Y value.
-
Constructor Summary
Constructors Modifier Constructor Description protectedXYArrayPlacement(java.lang.String name, java.lang.String description, boolean usesFraction)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()Returns this placement policy's description.java.lang.StringgetName()Returns this placement policy's name.abstract booleanreadPosition(XYArrayData xyData, double fraction, double[] dpos)Attempts to determine the reference position of an XYArrayData object.java.lang.StringtoString()booleanusesFraction()Indicates whether this placement pays attention to the value of the fraction parameter.
-
-
-
Field Detail
-
INDEX
public static final XYArrayPlacement INDEX
Uses X,Y position at indicated fraction through arrays.
-
XMAX
public static final XYArrayPlacement XMAX
Uses the position with the maximal X value.
-
XMIN
public static final XYArrayPlacement XMIN
Uses the position with the minimal X value.
-
YMAX
public static final XYArrayPlacement YMAX
Uses the position with the maximal Y value.
-
YMIN
public static final XYArrayPlacement YMIN
Uses the position with the minimal Y value.
-
XYMEAN
public static final XYArrayPlacement XYMEAN
Uses the center of gravity of all the (X,Y) values.
-
-
Constructor Detail
-
XYArrayPlacement
protected XYArrayPlacement(java.lang.String name, java.lang.String description, boolean usesFraction)Constructor.- Parameters:
name- short name for presentation to usersdescription- XML-friendly description of behaviourusesFraction- true iff this placement pays any attention to the value of the fraction parameter
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns this placement policy's name.- Returns:
- name
-
getDescription
public java.lang.String getDescription()
Returns this placement policy's description.- Returns:
- XML-friendly description text
-
usesFraction
public boolean usesFraction()
Indicates whether this placement pays attention to the value of the fraction parameter.- Returns:
- true if fraction may influence placement, false if it definitely doesn't
-
readPosition
public abstract boolean readPosition(XYArrayData xyData, double fraction, double[] dpos)
Attempts to determine the reference position of an XYArrayData object. On success, the position in data coordinates is written into the supplied 2-element array.- Parameters:
xyData- XY data, not nullfraction- numeric value in the range 0..1; may or may not be useddpos- 2-element array for X, Y output on success- Returns:
- true for success
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-