Re: Rendering CAD/GIS Data on a Map Canvas



Thank you so much for your help Thomas.

That is just what I needed to know. I will look at the information you
referenced in your e-mail.

Scott Huey

Thomas Weidenfeller wrote:
redefined.horizons@xxxxxxxxx wrote:
I am working through the design of a disp[lay for a CAD/GIS program
written
in Java.

You probably want to have a look at existing drawing frameworks for Java
like JHotDraw (based on Swing), instead of doing everything from scratch.

Let's say for the sake of this discussion that the area I will use to
display my map, or the canvas, will be 600 by 300 pixels. Would it be
possible to render the shapes that would fall within an area 20% larger
than
this to allow for quicker panning and zooming?

You are mixing things up. Painting more than what is visible will hot
help for zooming, only for panning.

Regarding panning: Yes, with a trick. You could render to an off-screen
image, like a VolatileImage, which you made larger then the visible
portion of the drawing panel. A VolatileImage can be hardware
accelerated (depends on platform and VM), so later drawing portions of
the VolatileImage to the panel should be fast.

Is this method possible? Any ideas or suggestions on how I can learn
the
techniques I need to implement it?

Sun's Java 2D tutorial. And a good book on computer graphics in general
will be a good idea. Plus, the GoF book is full of related patterns,
which is not surprising, since the authors were involved in the historic
InterViews GUI framework which also included a drawing framework called
Idraw (all written in C++).

Oh, and you might want to sort out your Java terminology. A canvas in
Java is associated with an AWT component (Canvas), which you don't want
to use if you use Swing for painting. There one uses a JPanel, or even a
JComponent.

Also, my program will allow the user to select shapes on the display
using
various interactions with the mouse, and will subsequently allow them
to
move or modify those geometries. Is it possible to only render the
portion
of the canvas that needs to be repainted, instead of repainting the
entire
canvas everytime a single shape is modified?

Yes, in Swing you would issue a repaint, specifying a bounding rectangle
which indicates the area of the screen which has changed. In the
paintComponent() method your code would have to observe that information
and only redraw the changed parts.

Is this method of partial rendering possible? Any ideas or suggestions
on
how I can learn the techniques I need to implement it?

The API documentation, the Java 2D tutorial.

I am interested in learning how this might be done in both Swing and
SWT.

Keep in mind that SWT is reported to be slow like a dog on anything but
Windows. Which is ironic, because one justification for its existence
was that Swing is soooooo slow (which it never was).

/Thomas
--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

.



Relevant Pages

  • Re: Rendering CAD/GIS Data on a Map Canvas
    ... You probably want to have a look at existing drawing frameworks for Java like JHotDraw (based on Swing), instead of doing everything from scratch. ... A canvas in Java is associated with an AWT component, which you don't want to use if you use Swing for painting. ...
    (comp.lang.java.gui)
  • Re: warum keine Schleifen und Logik in paintComponent()?
    ... private Image offscreen; ... die ich gesehen habe wird statt Canvas oft ... Im übrigen ist da nichts "in Java ... Grundlagen, mein Herr, Grundlagen. ...
    (de.comp.lang.java)
  • Re: ATWT-MEG DESERVES EVERYTHING SHE GETS
    ... Java ... a écrit dans le message de ... > Oh, and soon as Will and Gwen leave the canvas of the show, my vcr will ... Prev by Date: ...
    (rec.arts.tv.soaps.cbs)
  • Java 2D demo & the Tk canvas
    ... I'm no graphics guru, but based on what I've seen of a lot of the terrific stuff folks have done with the Tk Canvas, much of that demo seems doable or at least can be simulated with some imaginative coding with the Tk canvas. ... What fundamental features stand out in particular as *missing* from the Tk Canvas that are demonstrated in the Java 2D demo? ... For the graphics gurus out there: Are any of those, like maybe anti-aliased rendering and font rotation, relatively low-hanging fruit that would really allow a significant improvement in creating some good looking graphics in the Tk canvas? ...
    (comp.lang.tcl)
  • Re: [Process] I dont understand where is the problem
    ... > I need to capture an offscreen window on WinXP Platform and show the ... > image in a Canvas. ... Who says it isn't possible in Java? ...
    (comp.lang.java.help)