Hello Leah,
an easy way to "connect the dots" is to use a Gridded2DSet.
There is an example of this in "Rivers.java" which you can
find in the "examples" directory of visad.
For example, if you want to draw a line that connects the
following points: (1,2) (10,20) (100, 200),
you can use the following:
// Set up the samples.
int numSamples = 3;
double samples[][] = new double[2][numSamples];
// First point.
samples[0][0] = 1;
samples[1][0] = 2;
// Second point.
samples[0][1] = 10;
samples[1][1] = 20;
// Third point.
samples[0][2] = 100;
samples[1][2] = 200;
// Create the math types.
RealType xType = RealType.get("x");
RealType yType = RealType.get("y");
RealTupleType realTupleType = new RealTupleType(xType, yType);
// Create the set and add to data reference.
Gridded2DSet set = new Gridded2DSet(realTupleType, samples, numSamples);
DataReferenceImpl dataRef = new DataReferenceImpl("data_ref");
dataRef.setData(set);
// Set up scalar maps.
ScalarMap xMap = new ScalarMap(xType, Display.XAxis);
ScalarMap yMap = new ScalarMap(yType, Display.YAXis);
// Set up the display.
DisplayImpl display = new DisplayImplJ3D("display");
display.addMap(xMap);
display.addMap(yMap);
The "Rivers.java" example is worth experimenting with.
Also, I would probably use the VisADLineStripArray if
I were working with shapes. In this case, the Gridded2DSet
should meet your needs.
Hope this helps,
Jim.
---
Jim Koutsovasilis
Bureau of Meteorology, Australia
jimk@xxxxxxxxxx
Leah Heiss wrote:
Could someone point me towards an example of how to use
VisADLineStripArray?
I'm trying to draw a coastline on my display. I have a list of coordinates
describing various points along the coast and I'd like to connect the dots.
Thank you.
Leah