Re: [visad] Creating Overlays

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

To subscribe or unsubscribe via the World Wide Web, visit
        http://mailman.unidata.ucar.edu/mailman/listinfo/visad
or, via email, send a message with subject or body 'help' to
        visad-request@xxxxxxxxxxxxxxxx

You can reach the person managing the list at
        visad-owner@xxxxxxxxxxxxxxxx

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
Message-ID:
        <CAK8h0qpgoB60U1d5DgLZu6EkbEto1AKrdSd03uqmM4FDFLDfHQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Hi..


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...
URL:<http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20120227/a54c47f0/attachment.html>

------------------------------

_______________________________________________
visad mailing list
visad@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/

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
display.addMap(xMap);
display.addMap(yMap);
//create datareference
DataReferenceImpl datareference = new DataReferenceImpl("overlayref");
//set data in datareference
datareference.setData(g2DSet);
//add datareference to display
display.addReference(datareference);


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.
Ghansham