|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object visad.ScalarMap
public class ScalarMap
A ScalarMap object defines a mapping from a RealType to a DisplayRealType. A set of ScalarMap objects define how data are dislayed.
The mapping of values is linear. Any non-linear mapping must be handled by Display CoordinateSystem-s.
Constructor Summary | |
---|---|
ScalarMap(ScalarType scalar,
DisplayRealType display_scalar)
Construct a ScalarMap that maps the scalar to
the display_scalar. |
Method Summary | |
---|---|
void |
addScalarMapListener(ScalarMapListener listener)
add a ScalarMapListener, to be notified whenever setRange is invoked |
boolean |
badRange()
|
boolean |
checkTicks(DataRenderer r,
DataDisplayLink link)
return true if application called setRange |
Object |
clone()
Create and return a copy of this ScalarMap. |
int |
compareTo(Object o)
Compares this ScalarMap with another object. |
protected int |
compareTo(ScalarMap that)
Compares this ScalarMap with another ScalarMap. |
protected void |
copy(ScalarMap map)
|
void |
disableAutoScale()
disable auto-scaling for this ScalarMap |
boolean |
doInitialize()
|
static void |
equalizeFlow(Vector mapVector,
DisplayTupleType flow_tuple)
ensure that non-Manual components of flow_tuple have equal dataRanges symmetric about 0.0 |
boolean |
equals(Object o)
Indicates if this ScalarMap is the same as another object. |
AxisScale |
getAxisScale()
Get the AxisScale associated with this ScalarMap. |
Control |
getControl()
Gets the Control for the DisplayScalar. |
DisplayImpl |
getDisplay()
Get the DisplayImpl this ScalarMap is linked to |
DisplayRealType |
getDisplayScalar()
Get the DisplayRealType that is the map range |
Unit |
getOverrideUnit()
Return the override unit. |
double[] |
getRange()
Returns the current range of the RealType data. |
ScalarType |
getScalar()
Get the ScalarType that is the map domain |
String |
getScalarName()
Get the name being used on the axis scale. |
boolean |
getScale(double[] so,
double[] data,
double[] display)
return value is true if data (RealType) values are linearly scaled to display (DisplayRealType) values; if so, then values are scaled by: display_value = data_value * so[0] + so[1]; (data[0], data[1]) defines range of data values (either passed in to setRange or computed by autoscaling logic) and (display[0], display[1]) defines range of display values; so, data, display must each be passed in as double[2] arrays; note if overrideUnit ! |
boolean |
getScaleEnable()
See if the AxisScale is visible or not. |
int |
getValueIndex()
get index of DisplayScalar in value array used by ShadowType.doTransform |
int |
hashCode()
Returns the hash code for this ScalarMap. |
long |
incTick()
invoke incTick on every application call to setRange |
float[] |
inverseScaleValues(float[] values)
return an array of data (RealType) values by inverse linear scaling (if applicable) the display_values array (DisplayRealType values); this is useful for direct manipulation and cursor labels |
float[] |
inverseScaleValues(float[] values,
boolean newArray)
return an array of data (RealType) values by inverse linear scaling (if applicable) the display_values array (DisplayRealType values); this is useful for direct manipulation and cursor labels |
boolean |
isAutoScale()
determine whether this ScalarMap is auto-scaled |
void |
makeScale()
Create the scale that is displayed. |
boolean |
peekTicks(DataRenderer r,
DataDisplayLink link)
|
void |
removeScalarMapListener(ScalarMapListener listener)
remove a ScalarMapListener |
void |
resetAutoScale()
re-enable auto-scaling for this ScalarMap |
byte[] |
scaleValues(byte[] values,
int factor)
return an array of display (DisplayRealType) values by linear scaling (if applicable) the data_values array (RealType values); results are scaled by the given scale factor |
float[] |
scaleValues(double[] values)
return an array of display (DisplayRealType) values by linear scaling (if applicable) the data_values array (RealType values) |
float[] |
scaleValues(float[] values)
return an array of display (DisplayRealType) values by linear scaling (if applicable) the data_values array (RealType values) |
float[] |
scaleValues(float[] values,
boolean newArray)
return an array of display (DisplayRealType) values by linear scaling (if applicable) the data_values array (RealType values) |
void |
setOverrideUnit(Unit unit)
Set display Unit to override default Unit of Scalar; MUST be called before any data are displayed |
void |
setRange(DataShadow shadow)
set range used for linear map from Scalar to DisplayScalar values; this is the call for automatic scaling |
void |
setRange(double low,
double hi)
Explicitly sets the range of RealType data values that is mapped to
the natural range of DisplayRealType display values. |
void |
setRange(double low,
double hi,
int remoteId)
explicitly set the range of data (RealType) values; used for linear map from Scalar to DisplayScalar values; if neither this nor setRangeByUnits is invoked, then the range will be computed from the initial values of Data objects linked to the Display by autoscaling logic; if the range of data values is (0.0, 1.0), for example, this method may be invoked with low = 1.0 and hi = 0.0 to invert the display scale . |
void |
setRangeByUnits()
explicitly set the range of data (RealType) values according to Unit conversion between this ScalarMap's RealType and DisplayRealType (both must have Units and they must be convertable; if neither this nor setRange is invoked, then the range will be computed from the initial values of Data objects linked to the Display by autoscaling logic. |
void |
setScalarName(String name)
Set the name being used on the axis scale. |
void |
setScaleColor(float[] color)
Set color of axis scales; color must be float[3] with red, green and blue components; DisplayScalar must be XAxis, YAxis or ZAxis. |
void |
setScaleEnable(boolean on)
Enable the display of the scale for this map. |
void |
setTicks()
set tickFlag according to OldTick and NewTick |
void |
setUnderscoreToBlank(boolean u2b)
Change underscore characters (_) in the Scalar name to blanks. |
void |
setValueIndex(int index)
set index of DisplayScalar in value array used by ShadowType.doTransform |
String |
toString()
Returns a string representation of the ScalarMap. |
String |
toString(String pre)
Returns a string representation of the ScalarMap with the specified prefix prepended. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ScalarMap(ScalarType scalar, DisplayRealType display_scalar) throws VisADException
ScalarMap
that maps the scalar to
the display_scalar.
scalar
- ScalarType (must be RealType at present)display_scalar
- DisplayScalar to map to. If the
display_scalar is one of the spatial
axes (X, Y, Z) an AxisScale will be
created.
VisADException
- VisAD errorMethod Detail |
---|
public void resetAutoScale()
public void disableAutoScale()
public boolean isAutoScale()
public boolean doInitialize()
public void setOverrideUnit(Unit unit) throws VisADException
unit
- unit that data will be displayed with
VisADException
- unit
is not convertable with
the default unit or scalar is not a RealType.public Unit getOverrideUnit()
public String getScalarName()
setScalarName
setScalarName(String name)
public void setScalarName(String name)
name
- new name for the scalar.AxisScale.setTitle(String name)
public long incTick()
public void setTicks()
public boolean peekTicks(DataRenderer r, DataDisplayLink link)
public boolean checkTicks(DataRenderer r, DataDisplayLink link)
public ScalarType getScalar()
public DisplayRealType getDisplayScalar()
public DisplayImpl getDisplay()
public Control getControl()
Display.addMap(ScalarMap)
method. Not all ScalarMaps have Controls,
generally depending on the ScalarMap's DisplayRealType. If a ScalarMap is
removed from a Display (via the Display.clearMaps()
method, then,
in general, any information in the ScalarMap's control will be lost and
must be reestablished.
null
if one has not yet been set.public boolean getScale(double[] so, double[] data, double[] display)
so
- array to contain scale and offsetdata
- array to contain the data rangedisplay
- array to contain the display range
public double[] getRange()
RealType
data. The range is
implicitly set by autoscaling logic or may be explicitly set by the setRange(double,double)
method. Note that if overrideUnit != null,
then dataRange is in overrideUnit.
RealType
data.
The array is new and may be safely modified.public void setRangeByUnits() throws VisADException, RemoteException
VisADException
- VisAD error
RemoteException
- Java RMI errorpublic void setRange(double low, double hi) throws VisADException, RemoteException
RealType
data values that is mapped to
the natural range of DisplayRealType
display values. This method
is used to define a linear map from Scalar to DisplayScalar values. If
neither this nor setRangeByUnits()
is invoked, then the range will
be computed by autoscaling logic from the initial values of Data objects
linked to the Display. If the range of data values is (0.0, 1.0), for
example, this method may be invoked with low = 1.0 and hi = 0.0 to invert
the display scale.
low
- One end of the range of applicable data.hi
- The other end of the range of applicable data.
VisADException
- VisAD failure.
RemoteException
- Java RMI failure.public void setRange(double low, double hi, int remoteId) throws VisADException, RemoteException
low
- lower range value (see notes above)hi
- upper range value (see notes above)remoteId
- id of remote scale
VisADException
- VisAD error
RemoteException
- Java RMI errorpublic void setRange(DataShadow shadow) throws VisADException, RemoteException
VisADException
RemoteException
public void addScalarMapListener(ScalarMapListener listener)
listener
- ScalarMapListener
to recieve notification
of changes.public void removeScalarMapListener(ScalarMapListener listener)
listener
- ScalarMapListener
to remove from the listpublic void setUnderscoreToBlank(boolean u2b)
u2b
- true to change, false to change backas an alternative
public void makeScale() throws VisADException
setRange(lo, hi)
and setDisplay
are
called. It makes a call to AxisScale.makeScale()
where
the actual hard work is done.
VisADException
- VisAD error.public void setScaleEnable(boolean on)
GraphicsModeControl.setScaleEnable()
or DisplayRenderer.setScaleOn(boolean on)
.
on
- true will enable display of axis, false will disable displayGraphicsModeControl.setScaleEnable(boolean enable)
,
DisplayRenderer.setScaleOn(boolean on)
,
AxisScale.setVisible(boolean visible)
public boolean getScaleEnable()
public void setScaleColor(float[] color) throws VisADException
AxisScale.setColor
methods.
- Parameters:
color
- array of R,G,B values of color.
- Throws:
VisADException
- non-spatial DisplayScalar or wrong length
of color array- See Also:
getAxisScale()
,
AxisScale.setColor(Color color)
,
AxisScale.setColor(float[] color)
public boolean badRange()
public float[] scaleValues(double[] values)
values
- to scale as doubles
public float[] scaleValues(float[] values)
values
- to scale as floats
public float[] scaleValues(float[] values, boolean newArray)
values
- to scale as floatsnewArray
- false to scale in place
public byte[] scaleValues(byte[] values, int factor) throws VisADException
values
- to scale as bytes
VisADException
public float[] inverseScaleValues(float[] values)
values
- display values
public float[] inverseScaleValues(float[] values, boolean newArray)
values
- display valuesnewArray
- false to transform in place
public static void equalizeFlow(Vector mapVector, DisplayTupleType flow_tuple) throws VisADException, RemoteException
VisADException
RemoteException
public void setValueIndex(int index)
public int getValueIndex()
public int compareTo(Object o)
compareTo
in interface Comparable
o
- The other object.
ClassCastException
- if the other object isn't a ScalarMap
.
NullPointerException
- if the other object is null
.protected int compareTo(ScalarMap that)
that
- The other ScalarMap.
public boolean equals(Object o)
equals
in class Object
o
- The other object.
true
if and only if the other object is a
ScalarMap and compares equal to this ScalarMap.public int hashCode()
scalarMap1.equals(
scalarMap2)
is true, then scalarMap1.hashCode() ==
scalarMap2.hashCode()
.
hashCode
in class Object
public Object clone()
clone
in class Object
null
if a copy couldn't
be created.protected void copy(ScalarMap map) throws VisADException, RemoteException
VisADException
RemoteException
public String toString()
toString
in class Object
public String toString(String pre)
pre
- prefix to prepend to the representation
pre
prepended.public AxisScale getAxisScale()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |