Package uk.ac.starlink.ttools.plot2.geom
Class SkyviewProjection
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.geom.SkyviewProjection
-
- All Implemented Interfaces:
Projection
- Direct Known Subclasses:
SinProjection
public class SkyviewProjection extends java.lang.Object implements Projection
Projection implementation based on classes from the Skyview package.- Since:
- 21 Feb 2013
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static SkyviewProjectionAITAitoff projection.static SkyviewProjectionCAR1Cartesian projection.static SkyviewProjectionTANGnomonic projection.
-
Constructor Summary
Constructors Constructor Description SkyviewProjection(skyview.geometry.Projecter projecter, java.awt.Shape shape, boolean isContinuous)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SkyAspectcreateAspect(boolean reflect, double[] r3, double radiusRad, Range[] ranges)Creates a SkyAspect from configuration information.static SkyviewProjectioncreateProjection(skyview.geometry.Projecter projecter, boolean isContinuous)Factory method that knows shapes for some projections.double[]cursorRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)Returns null - rotation not implemented.SkyFovgetFov(SkySurface surf)Returns the field of view represented by this aspect.java.lang.StringgetProjectionDescription()Returns a short description of the projection.java.lang.StringgetProjectionName()Returns the projection name.java.awt.ShapegetProjectionShape()Returns the shape which encloses all the plane positions to which legal sky coordinates can be projected.skyview.geometry.ProjectergetSkyviewProjecter()Returns the projecter object used by this SkyviewProjection.booleanisContinuous()Indicates whether this projection is known to be continous over its whole range.booleanproject(double rx, double ry, double rz, java.awt.geom.Point2D.Double pos)Transforms a sky position to a plane position.double[]projRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)Returns null - rotation not implemented.booleanunproject(java.awt.geom.Point2D.Double pos, double[] r3)Transforms a plane position to a sky position.booleanuseRanges(boolean reflect, double[] r3, double radiusRad)Returns false - ranging not used.
-
-
-
Field Detail
-
AIT
public static final SkyviewProjection AIT
Aitoff projection.
-
CAR1
public static final SkyviewProjection CAR1
Cartesian projection.
-
TAN
public static final SkyviewProjection TAN
Gnomonic projection.
-
-
Constructor Detail
-
SkyviewProjection
public SkyviewProjection(skyview.geometry.Projecter projecter, java.awt.Shape shape, boolean isContinuous)Constructor. You have to tell it whether the projection is known to be continuous. In more recent SkyView releases, I think this can be determined programmatically from the Projecter instance by using the function!projecter.straddleable().- Parameters:
projecter- projecter objectshape- shape of the sky in this projectionisContinuous- whether projection is known to be continuous
-
-
Method Detail
-
getProjectionName
public java.lang.String getProjectionName()
Description copied from interface:ProjectionReturns the projection name.- Specified by:
getProjectionNamein interfaceProjection- Returns:
- user-directed projection name
-
getProjectionDescription
public java.lang.String getProjectionDescription()
Description copied from interface:ProjectionReturns a short description of the projection. return projection description- Specified by:
getProjectionDescriptionin interfaceProjection
-
getProjectionShape
public java.awt.Shape getProjectionShape()
Description copied from interface:ProjectionReturns the shape which encloses all the plane positions to which legal sky coordinates can be projected. Typically this has linear dimensions of the order of PI.- Specified by:
getProjectionShapein interfaceProjection- Returns:
- projected sky shape
-
isContinuous
public boolean isContinuous()
Description copied from interface:ProjectionIndicates whether this projection is known to be continous over its whole range. Returns false if there may be any cases for which small changes in the 3-vector leads to large changes in the plane position (such as near lon=180 in an Aitoff, but not a Sinus, projection).- Specified by:
isContinuousin interfaceProjection- Returns:
- true iff this projection is known to be continuous
-
project
public boolean project(double rx, double ry, double rz, java.awt.geom.Point2D.Double pos)Description copied from interface:ProjectionTransforms a sky position to a plane position.- Specified by:
projectin interfaceProjection- Parameters:
rx- normalised 3D X coordinatery- normalised 3D Y coordinaterz- normalised 3D Z coordinatepos- point object into which projected dimensionless X,Y coordinates will be written on success- Returns:
- true if transformation succeeded
-
unproject
public boolean unproject(java.awt.geom.Point2D.Double pos, double[] r3)Description copied from interface:ProjectionTransforms a plane position to a sky position.- Specified by:
unprojectin interfaceProjection- Parameters:
pos- contains dimensionless X,Y coordinates of plane positionr3- 3-element array into which normalised X,Y,Z sky coordinates will be written on success- Returns:
- true if transformation succeeded
-
cursorRotate
public double[] cursorRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)Returns null - rotation not implemented.- Specified by:
cursorRotatein interfaceProjection- Parameters:
rotmat- initial rotation matrixpos0- initial cursor positionpos1- destination cursor position- Returns:
- destination rotation matrix, or null
-
projRotate
public double[] projRotate(double[] rotmat, java.awt.geom.Point2D.Double pos0, java.awt.geom.Point2D.Double pos1)Returns null - rotation not implemented.- Specified by:
projRotatein interfaceProjection- Parameters:
rotmat- initial rotation matrixpos0- initial projected positionpos1- destination projected position- Returns:
- destination rotation matrix, or null
-
useRanges
public boolean useRanges(boolean reflect, double[] r3, double radiusRad)Returns false - ranging not used.- Specified by:
useRangesin interfaceProjection- Parameters:
reflect- whether requested aspect will be reflectedr3- central position of field of view (may be null)radiusRad- radius of field of view (may be NaN)- Returns:
- true if ranges would be useful given the other arguments
- See Also:
SurfaceFactory.readRanges(P, uk.ac.starlink.ttools.plot2.PlotLayer[], uk.ac.starlink.ttools.plot2.data.DataStore)
-
createAspect
public SkyAspect createAspect(boolean reflect, double[] r3, double radiusRad, Range[] ranges)
Description copied from interface:ProjectionCreates a SkyAspect from configuration information. Either the supplied field of view or data ranges may be used, or neither.- Specified by:
createAspectin interfaceProjection- Parameters:
reflect- whether requested aspect will be reflectedr3- central position of field of view (may be null)radiusRad- radius of field of view (may be NaN)ranges- definite ranges for normalised X,Y,Z coordinates acquired from data- Returns:
- new sky aspect
- See Also:
SurfaceFactory.createAspect(P, uk.ac.starlink.ttools.plot2.config.ConfigMap, uk.ac.starlink.ttools.plot.Range[])
-
getFov
public SkyFov getFov(SkySurface surf)
Description copied from interface:ProjectionReturns the field of view represented by this aspect. This is a best estimate, it may be approximate depending on the projection geometry. If the field of view is the default for this projection, then null should be returned. Null may also be returned if for some reason no field of view can be determined.- Specified by:
getFovin interfaceProjection- Parameters:
surf- sky surface, which must be set up using this projection- Returns:
- field of view, or null
-
getSkyviewProjecter
public skyview.geometry.Projecter getSkyviewProjecter()
Returns the projecter object used by this SkyviewProjection.- Returns:
- projecter
-
createProjection
public static SkyviewProjection createProjection(skyview.geometry.Projecter projecter, boolean isContinuous)
Factory method that knows shapes for some projections. Name and description are taken from the skyview metadata.- Parameters:
projecter- skyview projecterisContinuous- whether projection is known to be continuous- Throws:
java.lang.IllegalArgumentException- if the shape is not known
-
-