Class SkyDensityPlotter
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.SkyDensityPlotter
-
- All Implemented Interfaces:
Plotter<SkyDensityPlotter.SkyDenseStyle>
public class SkyDensityPlotter extends java.lang.Object implements Plotter<SkyDensityPlotter.SkyDenseStyle>
Plotter that plots a genuine density map on a SkySurface. It paints a single Decal, no Glyphs.Note it only works with a SkySurface.
- Since:
- 20 Sep 2015
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSkyDensityPlotter.SkyDenseStyleStyle for configuring with the sky density plot.
-
Field Summary
Fields Modifier and Type Field Description static PerUnitConfigKey<SolidAngleUnit>ANGLE_KEYConfig key for solid angle units.static ConfigKey<Combiner>COMBINER_KEYConfig key for combination mode.static ReportKey<java.lang.Double>TILESIZE_REPKEYReport key for HEALPix tile area in square degrees.static ConfigKey<java.lang.Double>TRANSPARENCY_KEYConfig key for transparency.
-
Constructor Summary
Constructors Constructor Description SkyDensityPlotter(boolean transparent, boolean hasWeight)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PlotLayercreateLayer(DataGeom geom, DataSpec dataSpec, SkyDensityPlotter.SkyDenseStyle style)Creates a PlotLayer based on the given geometry, data and style.SkyDensityPlotter.SkyDenseStylecreateStyle(ConfigMap config)Creates a style that can be used when creating a plot layer.CoordGroupgetCoordGroup()Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.static intgetPixelLevel(SkySurface surface)Calculates the HEALPix level whose pixels are of approximately the same size as the screen pixels for a given SkySurface.java.lang.StringgetPlotterDescription()Returns an XML description of this plotter.javax.swing.IcongetPlotterIcon()Returns an icon for this plotter for use in user interface.java.lang.StringgetPlotterName()Returns the name of this plotter for use in user interface.ConfigKey<?>[]getStyleKeys()Returns the configuration keys used to configure style for this plotter.booleanhasReports()Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.static doublevectorSeparation(double[] p1, double[] p2)Angle in radians between two (not necessarily unit) vectors.
-
-
-
Field Detail
-
TILESIZE_REPKEY
public static final ReportKey<java.lang.Double> TILESIZE_REPKEY
Report key for HEALPix tile area in square degrees.
-
TRANSPARENCY_KEY
public static final ConfigKey<java.lang.Double> TRANSPARENCY_KEY
Config key for transparency.
-
ANGLE_KEY
public static final PerUnitConfigKey<SolidAngleUnit> ANGLE_KEY
Config key for solid angle units.
-
-
Constructor Detail
-
SkyDensityPlotter
public SkyDensityPlotter(boolean transparent, boolean hasWeight)Constructor.- Parameters:
transparent- if true, there will be a config option for setting the alpha value of the whole layerhasWeight- if true, an optional weight coordinate will be solicited alongside the positional coordinates
-
-
Method Detail
-
getPlotterName
public java.lang.String getPlotterName()
Description copied from interface:PlotterReturns the name of this plotter for use in user interface.- Specified by:
getPlotterNamein interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- user-directed plotter name
-
getPlotterIcon
public javax.swing.Icon getPlotterIcon()
Description copied from interface:PlotterReturns an icon for this plotter for use in user interface.- Specified by:
getPlotterIconin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- plotter icon
-
getCoordGroup
public CoordGroup getCoordGroup()
Description copied from interface:PlotterReturns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.- Specified by:
getCoordGroupin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- coordinate group
-
hasReports
public boolean hasReports()
Description copied from interface:PlotterIndicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.- Specified by:
hasReportsin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- true if the plot report may return interesting information
- See Also:
Drawing.getReport(java.lang.Object)
-
getPlotterDescription
public java.lang.String getPlotterDescription()
Description copied from interface:PlotterReturns an XML description of this plotter.Note: really this should appear at the LayerType level.
- Specified by:
getPlotterDescriptionin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- one or more <p> elements
-
getStyleKeys
public ConfigKey<?>[] getStyleKeys()
Description copied from interface:PlotterReturns the configuration keys used to configure style for this plotter. The keys in the return value are used in the map supplied to thePlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap)method.- Specified by:
getStyleKeysin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Returns:
- keys used when creating a style for this plotter.
-
createStyle
public SkyDensityPlotter.SkyDenseStyle createStyle(ConfigMap config)
Description copied from interface:PlotterCreates a style that can be used when creating a plot layer. The keys that are significant in the supplied config map are those returned byPlotter.getStyleKeys(). The return value can be used as input toPlotter.createLayer(uk.ac.starlink.ttools.plot2.DataGeom, uk.ac.starlink.ttools.plot2.data.DataSpec, S).- Specified by:
createStylein interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Parameters:
config- map of style configuration items- Returns:
- plotter-specific plot style
-
createLayer
public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, SkyDensityPlotter.SkyDenseStyle style)
Description copied from interface:PlotterCreates a PlotLayer based on the given geometry, data and style.The
styleparameter is the result of a call toPlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap).The
dataSpecparameter must contain the coordinates defined by this plotter's CoordGroup.The
pointDataGeomparameter is only used ifgetCoordGroup().getPositionCountreturns a non-zero value, otherwise the plot does not have point positions.It is legal to supply null for any of the parameters; if insufficient data is supplied to generate a plot, then the method should return null.
Creating a layer should be cheap; layers may be created and not used.
- Specified by:
createLayerin interfacePlotter<SkyDensityPlotter.SkyDenseStyle>- Parameters:
geom- indicates base position coordinates and their mapping to points in the data space; if non-null, the data geom'sDataGeom.hasPosition()method will return truedataSpec- specifies the data required for the plotstyle- data style as obtained fromcreateStyle- Returns:
- new plot layer, or null if no drawing will take place
-
getPixelLevel
public static int getPixelLevel(SkySurface surface)
Calculates the HEALPix level whose pixels are of approximately the same size as the screen pixels for a given SkySurface. There is not an exact correspondance here. An attempt is made to return the result for the "largest" screen pixel (the one covering more of the sky than any other).- Parameters:
surface- plot surface- Returns:
- approximately corresponding HEALPix level
-
vectorSeparation
public static double vectorSeparation(double[] p1, double[] p2)Angle in radians between two (not necessarily unit) vectors. The code follows that of SLA_SEPV from SLALIB. The straightforward thing to do would just be to use the cosine rule, but that may suffer numeric instabilities for small angles, so this more complicated approach is more robust.- Parameters:
p1- first input vectorp2- second input vector- Returns:
- angle between p1 and p2 in radians
-
-