[Date Prev][Date Next][Index][Thread]
[SGT Mail Archive]
[SGT Main Page]
RE: Creating bitmaps of SGT plots
*************************************************
Message from the sgt mail list.
*************************************************
Thanks Bob, that's helpful. It's pretty similar to the way I'd hacked
together. Unfortunately it still suffers from the disadvantage that there
needs to be an X server running even for "invisible" drawing of the
components. This is tricky in my particular setup.
I was wondering if someone could point me in the direction of the bits of
code that do the actual construction of the bitmap picture that is painted
on to the components in question? Then I could just adapt these bits of
code to paint directly onto an Image. I'm most interested in plotting 2-D
grids of data (i.e. SGTGrids).
Thanks,
Jon
> -----Original Message-----
> From: Bob Simons [mailto:Bob.Simons@noaa.gov]
> Sent: 13 February 2006 16:21
> To: sgt@noaa.gov
> Subject: Re: Creating bitmaps of SGT plots
>
> *************************************************
> Message from the sgt mail list.
> *************************************************
>
> I have modified SGT to work as part of a server program and generate
> BufferedImages. I hacked the SGT code a little to make this possible.
> Here are my notes. I am sorry they are a little terse. I hope they are
> helpful.
>
> To allow using the system in a non-GUI way:
> In sgt.Layer.computeScale, I changed
> Rectangle bnds = getBounds();
> to
> Rectangle bnds = pbnds;
> In sgt.Pane, I added
> class field:
> Rectangle bounds;
> to constructor:
> bounds = new Rectangle(0,0, size.width, size.height);
> new method:
> public Rectangle getBounds() {
> return bounds;
> }
> In sgt.dm.Collection:
> change variable "enum" to "en" to allow use with Java 1.5
> Note about SGT coordinates (at different levels):
> Graph - uses "user" coordinates (e.g., lat and lon)
> Layer - uses "physical" coordinates (doubles, 0,0 at lower left)
> JPane - uses "device" coordinates (ints, 0,0 at upper left)
> To actually use SGT to draw on a Java Image object,
> 1) make a BufferedImage
> Get its graphic2D object.
> 2) set up SGT
> * Create a JPane object
> * For each thing plotted:
> Create a Graph, placed on a Layer, added to the JPane
> 3) call jPane.draw(graphics2D) to actually draw
> the graphs you have set up to the buffered image
>
>
> Jon Blower wrote:
> > *************************************************
> > Message from the sgt mail list.
> > *************************************************
> >
> > Dear all,
> >
> > I've been trying to use SGT to create graphics on the fly for a web
> > application. I don't want to use a Java applet: I want to create a
bitmap
> > picture (jpg, gif or png) on the server, then serve this to the client
in a
> > web page. I note that a very similar thread has been started on this
> > mailing list by Leonard Scardino, but there have been no replies.
> >
> > I have discovered a rather clunky way of achieving this, which involves
> > creating the relevant SGT component (e.g. a JPlotLayout) and grabbing
its
> > graphics using ScreenImage.createImage(JComponent com, String filename)
> > (http://www.discoverteenergy.com/files/ScreenImage.java). This works,
but
> > it has the disadvantage that the graphics are generated in an X server
> > off-screen, then grabbed. This means that I need to run an X server on
my
> > web server, which is not ideal for various local reasons.
> >
> > It must be possible to draw the graphics in the graphics context of a
> > BufferedImage object instead of on a Swing or AWT component. Can this
be
> > done? I'd be happy to hack away at the SGT code if necessary but I'd
like
> > some pointers on where to start in the code.
> >
> > Thanks in advance for any help,
> > Jon
> >
> > --------------------------------------------------------------
> > Dr Jon Blower Tel: +44 118 378 5213 (direct line)
> > Technical Director Tel: +44 118 378 8741 (ESSC)
> > Reading e-Science Centre Fax: +44 118 378 6413
> > ESSC Email: jdb@mail.nerc-essc.ac.uk
> > University of Reading
> > 3 Earley Gate
> > Reading RG6 6AL, UK
> > --------------------------------------------------------------
> >
> >
> >
> >
> > *************************************************
> > To remove yourself from this mailing list,
> > send mail to <epic-majordomo@noaa.gov> with
> > "unsubscribe sgt" in the message body.
> > ==========
>
>
> Sincerely,
>
> Bob Simons
> Satellite Data Product Manager
> Environmental Research Division
> NOAA Southwest Fisheries Science Center
> 1352 Lighthouse Ave
> Pacific Grove, CA 93950-2079
> (831)658-3205
> bob.simons@noaa.gov
> <>< <>< <>< <>< <>< <>< <>< <>< <><
>
> *************************************************
> To remove yourself from this mailing list,
> send mail to <epic-majordomo@noaa.gov> with
> "unsubscribe sgt" in the message body.
> ==========
*************************************************
To remove yourself from this mailing list,
send mail to <epic-majordomo@noaa.gov> with
"unsubscribe sgt" in the message body.
==========
Privacy Notice,
External Links Disclaimer.