Hi Kevin-
Kevin Manross wrote:
Greetings,
Can I override a ScalarMap with a ConstantMap? Specifically, I have
ScalarMap altMap = new ScalarMap(alt, Display.YAxis);
ScalarMap refMap = new ScalarMap(ref, Display.XAxis);
ScalarMap rgbMap = new ScalarMap(ref, Display.RGB);
While I need the RGB for displaying a FlatField, I eventually want to
add a horizontal line of solid color on top of my data using a Gridded2DSet
g2set = new Gridded2DDoubleSet(altref_tt, vals, vals[0].length);
where altref_tt = new RealTupleType(alt, ref);
I then add g2set to my DataReferenceImpl "zline_ref":
display.addReference(zline_ref, new ConstantMap[] {
new
ConstantMap( 0.0, Display.Red ),
new
ConstantMap( 0.75, Display.Green ),
new
ConstantMap( 1.0, Display.Blue )
});
zline_ref.setData(g2set);
but since it contains the RealType "ref" which is mapped to RGB (as well
as XAxis) I get a multicolored line instead of a solid colored line.
Am I required to create a dummy RealType mapped only to XAxis (and
consquently used in my Gridded2DSet) in order to invoke the ConstantMap
properties, or should the ConstantMap mapped to that DataReferenceImpl
override the ScalarMap RGB?
In this case, the ConstantMaps are used in conjunction with the
ScalarMaps since they are different DisplayRealTypes (RGB vs.
Red, Green, Blue).
I would use different RealTypes and ScalarMaps to get the
desired result. You can remove ScalarMaps without a performance
hit (i.e. redrawing everything), so the overhead is small.
Obviously it isn't difficult to create the new RealType if necessary, I
was just hoping to avoid adding an extra RealType just to create a line.
Many times you can share the values and just have different
ScalarMaps. For example, in the IDV, we might have a
FlatField which is:
(Longitude, Latitude) -> (Temperature)
If I wanted to display Temperature as a color shaded (RGB)
display and as black contours, I need two different RealTypes.
If I use the same RealType, I'll just get colored contour
lines. So, we just create a new RealType (Temperature_0)
and a new FlatField:
(Longitude, Latitude) -> (Temperature_0)
using the same domain and copying the samples like:
temp_0_field.setSamples(temp_field.getSamples(false), false);
If this needs further clarification, I'd be glad to send an example.
Don
*************************************************************
Don Murray UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000
(303) 497-8628 Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
"Time makes everyone interesting, even YOU!"
*************************************************************