Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

Large Map Application Using 2D API

Thread view: 
paul.a.burgess@gmail.com - 18 Feb 2005 04:07 GMT
Hello!

I am currently developing a Java application that will track the land
covered by a moving vehicle as it works on a task.  The GUI shows the
progress of the task in what I call pseudo-real-time.  A good way to
picture the application is to think of an application that would show
you the area that you have mowed while you are mowing your lawn.  The
problem that I am having is finding the most economical but accurate
way of keeping track of the progress of the vehicle and displaying it.

Currently, I am using a BufferedImage to store the progress of the
vehicle.  Each time I receive the vehicle's status from GPS and
inertial sensors I paint the area covered into the image and then paint
the image into a JPanel (after all appropriate AffineTransforms, etc).
Unfortunately, there is a big limitation to this approach.  Namely, the
size of the image is limited by the memory on the computer being used.
The tracking system needs to be very accurate, thus I have been
assuming that 1 pixel = 1 square centimeter.  The area covered by the
vehicle can be very large, thus the image needs to be very large to
ensure we don't go outside the bounds of the image.  I have tried
making it so 1 pixel = 100 square centimeters, but it still doesn't
have the desired result.

Another approach I tried in the past involved using the
java.awt.geom.Area class to store the area covered by the vehicle.
Each time the vehicle's status was reported, I would add the new
position covered to the Area object, perform the necessary
AffineTransforms depending on the heading of the vehicle, and then
paint the area into the JPanel.  This works great at first, but
performance quickly degrades.  This degradation is a result of the Area
containing a LARGE number of paths.

I am new to the Java 2D API and new to graphics in general.  Therefore,
I was hoping somebody would have advice on how to handle such a
problem.  Is my image approach the best one?  Is there another class
that would fit my needs better that I haven't come across?  Any insight
would be appreciated.

Paul
Boudewijn Dijkstra - 18 Feb 2005 21:25 GMT
What are you supposed to do with the terrain data that has scrolled off the
screen?  Why do you need to keep all data in memory?
PaullyB - 19 Feb 2005 01:16 GMT
If by terrain data you are referring to the terrain that has been
covered, then I am storing it all in memory even when part of it has
scrolled off of the screen.  The application always has the vehicle
pointing up, so the terrain is constantly rotating depending on the
current heading of the vehicle.  This rotating is done using an
AffineTransform on the terrain data.  Are you suggesting breaking down
the terrain data into logical sections of images?  If so, is there an
easy way to figure out which images would be in the viewing area at a
given time even with all of the transformations that are occuring
(rotation, scaling because of a zooming feature, translations)?  I
understand that if there weren't any rotating going on (north is always
up, east is always right), I could store pieces on the hard drive and
access them when necessary.  Unfortunately, this is not the
functionality.

Please let me know if you have any ideas.
Boudewijn Dijkstra - 19 Feb 2005 14:19 GMT
> If by terrain data you are referring to the terrain that has been
> covered, then I am storing it all in memory even when part of it has
[quoted text clipped - 3 lines]
> AffineTransform on the terrain data.  Are you suggesting breaking down
> the terrain data into logical sections of images?

Yes.

> If so, is there an
> easy way to figure out which images would be in the viewing area at a
> given time even with all of the transformations that are occuring
> (rotation, scaling because of a zooming feature, translations)?

java.awt.Shape.intersects()

> I understand that if there weren't any rotating going on (north is always
> up, east is always right), I could store pieces on the hard drive and
> access them when necessary.

I think you still can.  The pieces can be rotated too.  However I don't know
whether the drawing algorithm is accurate enough to rotate them one by one or
whether the pieces must first be 'assembled' and then rotated.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.