Class MultiPointForm
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.MultiPointForm
-
- All Implemented Interfaces:
ModePlotter.Form,ShapeForm
- Direct Known Subclasses:
SkyMultiPointForm
public abstract class MultiPointForm extends java.lang.Object implements ShapeForm
ShapeForm implementation that draws shapes based on a single main position, and a number of additional positions supplied asextracoordinates. The extra coordinates required (defining one or more non-central data positions) are defined by a suppliedMultiPointCoordSetand those coordinates are then plotted by a correspondingMultiPointShape.- Since:
- 18 Feb 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description MultiPointForm(java.lang.String name, javax.swing.Icon icon, java.lang.String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, ConfigKey<?>[] otherKeys)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DataGeomadjustGeom(DataGeom geom)Provides a DataGeom to be used by the layer this form makes, given a DataGeom that characterises the plotting environment.static MultiPointFormcreateDefaultForm(java.lang.String name, javax.swing.Icon icon, java.lang.String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, boolean canScale)Returns a new MultiPointForm with scaling in one of two default configurations, depending on the value of the supplied canScale parameter.static MultiPointFormcreateErrorForm(java.lang.String name, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey)Returns a MultiPointForm for drawing error bars.OutlinercreateOutliner(ConfigMap config)Returns an object which will do the work of drawing shapes when supplied with the appropriate style information and data.static ConfigKey<java.lang.Integer>createThicknessKey(MultiPointConfigKey shapeKey)Creates a config key for line thickness to be used with MultiPointShapes.static MultiPointFormcreateVectorForm(java.lang.String name, MultiPointCoordSet extraCoordSet, boolean canScale)Returns a MultiPointForm instance for drawing arrows from the central position to another position.ConfigKey<?>[]getConfigKeys()Returns style configuration keys specific to this form.static java.lang.StringgetDefaultScalingDescription(java.lang.String shapename)Returns XML text suitable for inclusion in a MultiPointForm description explaining how the scaling of marker sizes is controlled.Coord[]getExtraCoords()Returns data coordinates additional to the basic position which are required to plot a point.java.lang.StringgetFormDescription()Returns a description of this mode as an XML string.javax.swing.IcongetFormIcon()Returns an icon to identify this form in the GUI.java.lang.StringgetFormName()Returns the user-directed name for this form.intgetPositionCount()Returns the number of data positions per tuple used by this form.protected abstract doublegetScaleFactor(ConfigMap config)Returns a fixed constant by which to scale all (autoscaled or not autoscaled) offset values before plotting.protected abstract booleanisAutoscale(ConfigMap config)Indicates whether autoscaling should be applied.
-
-
-
Constructor Detail
-
MultiPointForm
public MultiPointForm(java.lang.String name, javax.swing.Icon icon, java.lang.String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, ConfigKey<?>[] otherKeys)Constructor.- Parameters:
name- shapeform nameicon- shapeform icondescription- XML descriptionextraCoordSet- defines the extra positional coordinates used to plot multipoint shapesshapeKey- config key for the shape; provides option to vary the shape, but any shape specified by it must be expecting data corresponding to theextraCoordSetparameterotherKeys- additional config keys
-
-
Method Detail
-
getScaleFactor
protected abstract double getScaleFactor(ConfigMap config)
Returns a fixed constant by which to scale all (autoscaled or not autoscaled) offset values before plotting.- Parameters:
config- config map- Returns:
- constant scaling factor
-
isAutoscale
protected abstract boolean isAutoscale(ConfigMap config)
Indicates whether autoscaling should be applied. If true, before plotting is carried out a scan of all the data values is performed to determine the range of values, and the supplied offsets are scaled accordingly, so that the largest ones are a reasonable size on the screen.- Parameters:
config- config map- Returns:
- true for autoscaling false to use raw values
-
getPositionCount
public int getPositionCount()
Description copied from interface:ShapeFormReturns the number of data positions per tuple used by this form.- Specified by:
getPositionCountin interfaceShapeForm- Returns:
- number of sets of positional coordinates
-
getFormName
public java.lang.String getFormName()
Description copied from interface:ModePlotter.FormReturns the user-directed name for this form.- Specified by:
getFormNamein interfaceModePlotter.Form- Returns:
- form name
-
getFormIcon
public javax.swing.Icon getFormIcon()
Description copied from interface:ModePlotter.FormReturns an icon to identify this form in the GUI.- Specified by:
getFormIconin interfaceModePlotter.Form- Returns:
- form icon
-
getFormDescription
public java.lang.String getFormDescription()
Description copied from interface:ShapeFormReturns a description of this mode as an XML string. The return value should be one or more <p> elements.- Specified by:
getFormDescriptionin interfaceShapeForm- Returns:
- XML description of form
-
getExtraCoords
public Coord[] getExtraCoords()
Description copied from interface:ShapeFormReturns data coordinates additional to the basic position which are required to plot a point.- Specified by:
getExtraCoordsin interfaceShapeForm- Returns:
- additional plot coordinates
-
adjustGeom
public DataGeom adjustGeom(DataGeom geom)
Description copied from interface:ShapeFormProvides a DataGeom to be used by the layer this form makes, given a DataGeom that characterises the plotting environment. The output should be similar to the input, for instance implementing the same plotType-specific DataGeom subtype.In most cases the supplied instance can be returned unchanged, but instances with special requirements may want to adjust how the data is interpreted.
- Specified by:
adjustGeomin interfaceShapeForm- Parameters:
geom- context geom- Returns:
- geom to use for data interpretation, the same or similar to the input
-
getConfigKeys
public ConfigKey<?>[] getConfigKeys()
Description copied from interface:ShapeFormReturns style configuration keys specific to this form. These keys will be used in the config map supplied toShapeForm.createOutliner(uk.ac.starlink.ttools.plot2.config.ConfigMap).- Specified by:
getConfigKeysin interfaceShapeForm- Returns:
- config keys
-
createOutliner
public Outliner createOutliner(ConfigMap config)
Description copied from interface:ShapeFormReturns an object which will do the work of drawing shapes when supplied with the appropriate style information and data. The significant keys in the supplied config map are those given byShapeForm.getConfigKeys().- Specified by:
createOutlinerin interfaceShapeForm- Parameters:
config- configuration map from which values for this form's config keys will be extracted- Returns:
- new outliner object
-
createVectorForm
public static MultiPointForm createVectorForm(java.lang.String name, MultiPointCoordSet extraCoordSet, boolean canScale)
Returns a MultiPointForm instance for drawing arrows from the central position to another position.- Parameters:
name- form nameextraCoordSet- nDataDim-element coord set that defines one extra data position, the (unscaled) endpoint of the vectorcanScale- whether to offer vector size scaling- Returns:
- new vector form instance
-
getDefaultScalingDescription
public static java.lang.String getDefaultScalingDescription(java.lang.String shapename)
Returns XML text suitable for inclusion in a MultiPointForm description explaining how the scaling of marker sizes is controlled. This corresponds to the behaviour of thecreateDefaultFormmethod.- Parameters:
shapename- human-readable name of the shape being plotted by this form- Returns:
- description text <p> element
-
createErrorForm
public static MultiPointForm createErrorForm(java.lang.String name, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey)
Returns a MultiPointForm for drawing error bars.- Parameters:
name- form nameextraCoordSet- coord set specifying error bar position endpointsshapeKey- config key for specifying multipoint shape- Returns:
- new error form instance
-
createDefaultForm
public static MultiPointForm createDefaultForm(java.lang.String name, javax.swing.Icon icon, java.lang.String description, MultiPointCoordSet extraCoordSet, MultiPointConfigKey shapeKey, boolean canScale)
Returns a new MultiPointForm with scaling in one of two default configurations, depending on the value of the supplied canScale parameter. If true, then the StyleKeys SCALE and AUTOSCALE keys are used to configure scaling, and if false, no scaling is provided.- Parameters:
name- shapeform nameicon- shapeform icondescription- XML descriptionextraCoordSet- defines the extra positional coordinates used to plot multipoint shapesshapeKey- config key for the shape; provides option to vary the shape, but any shape specified by it must be expecting data corresponding to theextraCoordSetparametercanScale- true for standard scaling configuration, false for no scaling
-
createThicknessKey
public static ConfigKey<java.lang.Integer> createThicknessKey(MultiPointConfigKey shapeKey)
Creates a config key for line thickness to be used with MultiPointShapes.- Parameters:
shapeKey- configured shape to which this relates- Returns:
- key for line thickness
-
-