Package uk.ac.starlink.topcat.plot
Class SphericalPolarPointStore
- java.lang.Object
-
- uk.ac.starlink.topcat.plot.SphericalPolarPointStore
-
- All Implemented Interfaces:
Points
,PointStore
public class SphericalPolarPointStore extends java.lang.Object implements PointStore
PointStore implementation for storing spherical polar data. In fact currently the data points are stored in Cartesian coordinates (X,Y,Z), since spherical decoding is taken care of by the PointSelection object (probably saving time on replots) but the errors are stored as radial and tangential deltas (since storing the error points would take a lot of extra space).The error points returned by
getErrors(int)
consist of a 1- (radial only), 2- (tangential only) or 3- (tangential followed by radial) pair array of 3-d coordinate arrays. Each pair is a lower bound followed by an upper bound along the relevant dimension.- Since:
- 3 Apr 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description SphericalPolarPointStore(uk.ac.starlink.ttools.plot.ErrorMode radialMode, boolean hasTanerr, boolean radialLog, int npoint)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calcErrors(double[] centre, double[] tanErrs, double[] radErrs, double[][] errors)
Calculates the returned error points given the raw error values.int
getCount()
Returns the number of points in this dataset.double[][]
getErrors(int ipoint)
Reads the errors for one of the stored points.java.lang.String
getLabel(int ipoint)
Returns a string associated with a given point.int
getNdim()
Returns the length of the coordinate array for each point.int
getNerror()
Returns the number of error points returned for each point.double[]
getPoint(int ipoint)
Reads the coordinates of one of the stored points.boolean
hasLabels()
Indicates whether a string label is associated with some points.void
setMinimumTanError(double minTanError)
Sets the smallest value for tan error which should generate non-blank tangent error bar points.void
storePoint(java.lang.Object[] coordRow, java.lang.Object[] errorRow, java.lang.String label)
Stores the next point in sequence to this object.
-
-
-
Constructor Detail
-
SphericalPolarPointStore
public SphericalPolarPointStore(uk.ac.starlink.ttools.plot.ErrorMode radialMode, boolean hasTanerr, boolean radialLog, int npoint)
Constructor.- Parameters:
radialMode
- type of radial error information to storehasTanerr
- whether to store tangential error informationradialLog
- whether radial coordinates are logarithmicnpoint
- number of points to store
-
-
Method Detail
-
storePoint
public void storePoint(java.lang.Object[] coordRow, java.lang.Object[] errorRow, java.lang.String label)
Description copied from interface:PointStore
Stores the next point in sequence to this object. The lengths of the arrays supplied here are not necessarily the same as those returned by thePoints.getNdim()
andPoints.getNerror()
methods, since there may be some translation between the arrays.The
PointSelection
submits rows here as retrieved directly from the AxesSelectorAxesSelector.getData()
andAxesSelector.getErrorData()
tables.- Specified by:
storePoint
in interfacePointStore
- Parameters:
coordRow
- array of objects representing coordinate valueserrorRow
- array of objects representing error valueslabel
- string labelling the point
-
getCount
public int getCount()
Description copied from interface:Points
Returns the number of points in this dataset.
-
getNdim
public int getNdim()
Description copied from interface:Points
Returns the length of the coordinate array for each point.
-
getPoint
public double[] getPoint(int ipoint)
Description copied from interface:Points
Reads the coordinates of one of the stored points. The returned array may be modified by subsequent calls to this method. The caller is also permitted to modify it.
-
getNerror
public int getNerror()
Description copied from interface:Points
Returns the number of error points returned for each point.
-
getErrors
public double[][] getErrors(int ipoint)
Description copied from interface:Points
Reads the errors for one of the stored points. The returned value is an array ofnerror
double[] arrays, each of which hasndim
elements and represents the coordinates of the end of an error bar. If any of these coordinate arrays isnull
, it represents an error bar of zero size, that is one whose end sits right on the data point. The ordering of these points is up to the user of this object, but typically they will be in pairs, e.g. (xlo,xhi, ylo,hi, ...). The content of the returned double[][] array and of its elements may be modified by subsequent calls to this method. The caller is also permitted to modify these.
-
hasLabels
public boolean hasLabels()
Description copied from interface:Points
Indicates whether a string label is associated with some points.- Specified by:
hasLabels
in interfacePoints
- Returns:
- true if
Points.getLabel(int)
may return a non-null value for any point
-
getLabel
public java.lang.String getLabel(int ipoint)
Description copied from interface:Points
Returns a string associated with a given point. May only return a non-null value ifPoints.hasLabels()
returns true.
-
setMinimumTanError
public void setMinimumTanError(double minTanError)
Sets the smallest value for tan error which should generate non-blank tangent error bar points. The idea is that if the graphical destination of the points represented by this object is known to have a pixel size/resolution smaller than a given angular distance over its whole range, we can save a lot of work by assuming that certain errors are effectively non-existent.- Parameters:
minTanError
- minimum non-negligable tangent error in radians
-
calcErrors
public void calcErrors(double[] centre, double[] tanErrs, double[] radErrs, double[][] errors)
Calculates the returned error points given the raw error values.- Parameters:
centre
- central point coordinatestanErrs
- array of raw tangent error values as storedradErrs
- array of raw radial error values as storederrors
- array of error points
-
-