Class XYArrayPlacement
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.XYArrayPlacement
Defines how to map an XYArrayData object to a definite position
in data space.
- Since:
- 18 Aug 2022
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final XYArrayPlacement
Uses X,Y position at indicated fraction through arrays.static final XYArrayPlacement
Uses the position with the maximal X value.static final XYArrayPlacement
Uses the position with the minimal X value.static final XYArrayPlacement
Uses the center of gravity of all the (X,Y) values.static final XYArrayPlacement
Uses the position with the maximal Y value.static final XYArrayPlacement
Uses the position with the minimal Y value. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
XYArrayPlacement
(String name, String description, boolean usesFraction) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns this placement policy's description.getName()
Returns this placement policy's name.abstract boolean
readPosition
(XYArrayData xyData, double fraction, double[] dpos) Attempts to determine the reference position of an XYArrayData object.toString()
boolean
Indicates whether this placement pays attention to the value of the fraction parameter.
-
Field Details
-
INDEX
Uses X,Y position at indicated fraction through arrays. -
XMAX
Uses the position with the maximal X value. -
XMIN
Uses the position with the minimal X value. -
YMAX
Uses the position with the maximal Y value. -
YMIN
Uses the position with the minimal Y value. -
XYMEAN
Uses the center of gravity of all the (X,Y) values.
-
-
Constructor Details
-
XYArrayPlacement
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 Details
-
getName
Returns this placement policy's name.- Returns:
- name
-
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
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
-