[Date Prev][Date Next][Index][Thread] [SGT Mail Archive] [SGT Main Page]

Re: Réf. : Grid example



*************************************************
Message from the sgt mail list.
*************************************************

Ok.. now it seems working!
Could you tell me also what I can do with the color map?
There are 3 int arrays for red green and blue colors... must I modify them?
What do they mean?

Riccardo Russo

Laurent BEIGBEDER wrote:

> Maybe 2 problems are here:
>
> It seems that you did not set the
>
>     sg.setXMetaData(new SGTMetaData("width","miles"));
>     sg.setYMetaData(new SGTMetaData("height","meters"));
>     sg.setZMetaData(new SGTMetaData("weigth","Kg"));
>
> and zpoints must be |x| * |y| = 6*6 = 36 values.
>
> Laurent BEIGBEDER.
>
> *************************************************
> Message from the sgt mail list.
> *************************************************
>
> Hi all,
> another problem.... Imagine that a want to plot a table N x N with
> different colors using a colored grid. To obtain the right SGT data
> object I used the Grid example and I wrote
>
>      Range2D xr = new Range2D(0.0f, 6.0f, 1.0f);
>      Range2D yr = new Range2D(0.0f, 6.0f, 1.0f);
>
>      double[] x = {1,2,3,4,5,6};
>      double[] y = {2,5,6,2,1,3};
>      double[] z = {10,20,30,40,50,29};
>
>      SimpleGrid sg = new SimpleGrid(z,x,y,"TEST");
>      newData = sg.copy();
>
>      /*
>       * Create a ColorMap and change the style to RASTER_CONTOUR.
>       */
>      ColorMap cmap = createColorMap(datar);
>      gridAttr_.setColorMap(cmap);
>      gridAttr_.setStyle(GridAttribute.RASTER_CONTOUR);
>      /*
>       * Add the grid to the layout and give a label for
>       * the ColorKey.
>       */
>      rpl.addData(newData, gridAttr_, "");
>
> I obtain an error like newData unknown source at this last line
>
> The problem is that I do not understand what is now the function used in
> the grid example:
>
>  ColorMap createColorMap(Range2D datar) {
>     int[] red =   { ...};
>     int[] green =  { ...};
>     int[] blue =  { ...};
>     IndexedColorMap cmap = new IndexedColorMap(red, green, blue);
>     cmap.setTransform(new LinearTransform(0.0, (double)red.length,
>        datar.start, datar.end));
>     return cmap;
>   }
>
> Could someone tell me more about this?
> :)))
> Thanks a lot
>
> *************************************************
> To remove yourself from this mailing list,
> send mail to <Majordomo@epic.noaa.gov> with
> "unsubscribe sgt" in the message body.


*************************************************
To remove yourself from this mailing list,
send mail to <Majordomo@epic.noaa.gov> with
"unsubscribe sgt" in the message body.