• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

CAD/GIS Display - Question #2

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic