• Post Reply Bookmark Topic Watch Topic
  • New Topic

CAD/GIS Display - Question #2

 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working through the design of a disp[lay for a CAD/GIS program written in Java. (I haven't decided firmly if I will use SWT or Swing.)

This program will have to display a large number of Java 2D Shapes. I'm want to make the rendering process as quick and efficient as possible. I had a couple of questions about how I can do this. I will ask the second question in this thread:

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? Would I do this by splitting my display into a grid of different images, or can I just pass the rectangular bounds of the new area that needs to be rendered?

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

Landon
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Graphics object (the object that you render on) always has a clip area. If I remember correctly, there is a redraw method that takes a clip area as parameter

Typically, drawing outside the clip area is *very* fast, so you typicall don't have to care about it (unless you do a lot of computations during drawing).

Does that help?
 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it does help.

Thank you for the response to this post, and my other related post.

Actually, another Java developer told me that the repaint() method will take a clip boundary as you mentioned.

Thanks,

Landon
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!