Re: [visad] Creating Overlays

On 02/28/2012 12:30 AM, visad-request@xxxxxxxxxxxxxxxx wrote:
Send visad mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of visad digest..."

Today's Topics:

    1. Creating Overlays (Ankita Zalavadiya)


Message: 1
Date: Mon, 27 Feb 2012 16:33:43 +0530
From: Ankita Zalavadiya<ankitazalavadia@xxxxxxxxx>
To: visad@xxxxxxxxxxxxxxxx
Subject: [visad] Creating Overlays
Content-Type: text/plain; charset="iso-8859-1"


Anyone knew whether there is a way in VisAD
to apply an overlay to VisAD displays without using Mapadapter or
shapefile adapter..
-------------- next part --------------
An HTML attachment was scrubbed...


visad mailing list
For list information, to unsubscribe, visit:

End of visad Digest, Vol 27, Issue 2

Do you mean to say, you want to create draw some boundary.
If you have an ASCII file,
you can just read that to create a visad.Gridded2DSet or visad.UnionSet with appropriate domainType.
Create a datareference. Add the Gridded2DSet/Union to datareference.
Add ScalarMaps that Map the MathType of Gridded2DSet/UnionSet to DisplayRealTypes.
And that is done.
For example,
you can create a domainType of Gridded2DSet like this:

RealType elementType = RealType.getType("elementType");
RealType lineType = RealType.getType("lineType");
RealTupleType domainType = new RealTupleType(elementType, lineType);
float samples[][] = readSamples(); //you will have to write readSamples function yourself Gridded2DSet g2DSet = new Gridded2DSet(domainType, samples, samples[0].length);
//create ScalarMaps
ScalarMap xMap = new ScalarMap(elementType, Display.XAxis);
ScalarMap yMap = new ScalarMap(elementType, Display.YAxis);
//create Display
DisplayImplJ3D display = new DisplayImplJ3D("sample display");
//Add scalarmaps
//create datareference
DataReferenceImpl datareference = new DataReferenceImpl("overlayref");
//set data in datareference
//add datareference to display

Gridded2DSet is used if there is a single line segment in the data.
If you have multiple line segments in your data (as generally happens in boundary data), you have to use UnionSet like this. Suppose you want to create 'n' line segments.
Gridded2DSet sets = new Gridded2DSets[10];
//initialize each set with the corresponding data as above (we created only one line segment above)
|*UnionSet uset = new UnionSet*(domainType,sets);|

And then set uset in datareference.

I hope thats helps.