Re: vector fields - locarithmic scale

Hi Patrick,

> 1. I want to visualize a wind vector field. As range samples I have got an
> array containing the numeric values for direction (degree) and speed
> (m/s), which I put into a FlatField object. (As usual the wind speed is
> represented by the vector length). As is done from
> BarbRendererJ2D.main() I've mapped the direction RealType to
> Display.Flow1Azimuth and the speed RealType to
> Display.Flow1Radial. Unfortunately I' m getting no result but the
> following NullPointerException ..
> 
> java.lang.NullPointerException
>         at visad.ShadowType.assembleFlow(Compiled Code)
>         at visad.java2d.ShadowTypeJ2D.assembleFlow(Compiled Code)
>         at visad.ShadowFunctionOrSetType.doTransform(Compiled Code)
>         at visad.java2d.ShadowFunctionOrSetType.doTransform(Compiled Code)
>         at visad.java2d.DefaultRendererJ2D.doTransform(Compiled Code)
>         at visad.java2d.RendererJ2D.doAction(Compiled Code)
>         at visad.DisplayImpl.doAction(Compiled Code)
>         at visad.java2d.DisplayImplJ2D.doAction(Compiled Code)
>         at visad.ActionImpl.run(Compiled Code)
>         at visad.util.ThreadPool$ThreadMinnow.run(Compiled Code)

Please run again in jdb, so that you can send me a stack dump that
includes line numbers instead of "Compiled Code".  That way I may
be able to determine what's wrong.

> 2. For each cell a vector object should be rendered. The problem is that
> depending on spatial resolution or "point of view" position the vector
> objects overlap. On the basis of this facts I want to implement
> something like an "LoD" method. Depending on how close I've zoomed to the
> scene, only parts of the vector objects should be displayed. (For example
> vectors could be rendered as averaged values of the neighbour
> vectors). Has someone an idea how to do this ? And where is
> the zooming-"stuff" defined.

The easiest way to do LOD is to write some code that resamples
your original data to a subset of its original domain Set. You
could put this code in the controlChanged() method of a
ControlListener that you link to the DisplayImpl's
ProjectionControl.  There is a nice example of this in
visad/bom/FlexibleTrackManipulation.java - just do a search on
"ProjectionControlListener".  Note that it gets the matrix from
the ProjectionControl, then calls MouseBehaviorJ3D.unmake_matrix()
to determine the scale which is equivalent to the zoom.

> 3. How can I map RealType components to LOCARITHMIC scaled axis ?

You can do this for spatial DisplayRealTypes (e.g., XAxis) by
defining new instances of DisplayRealTypes, define a new
DisplayTupleType for them with a CoordinateSystem whose
reference is one of the existing DisplayTupleTypes either
Display.DisplaySpatialCartesianTuple [which is (XAxis, YAxis, ZAxis)]
or Display.DisplayRGBTuple [which is (Red, Green, Blue)].

There are examples of this in the MetApps source that Unidata
recently released.  Perhaps someone from Unidata can point you
into the code more specifically.

If you want logarithmic flow scales, you could do this for
Display.DisplayFlow1Tuple [which is (Flow1X, Flow1Y, Flow1Z)]
but none of the existing DataRenderers check for CoordinateSystems
with flow references.  Thus this would need a new Class extending
DataRenderer, which is a bit complex.

Another approach is to transform data into a new RealType with
a logarithmic relation to the old data.  You can even do this
in a CellImpl to maintain an event-driven relation between
data changes and display changes, as in:

  old_data_ref -> CellImpl -> new_data_ref -> DisplayImpl

That is, the CellImpl is triggered by a DataReferenceImpl,
gets its DataImpl, computes a new DataImpl and passes it to
the setData() method of another DataReference, which in turn
triggers a DisplayImpl to update.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: