Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Creating a radar display in Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a radar display in Java



I've done the fading thing before by drawing the display into an image but going through before every frame multiplying every pixel by, say, 0.9. That way the drawing fades out, leaving a trail behind just like you need. For a monochrome display like radar, you can use an indexed color model which means you only have one integer to multiply per pixel.

You can see the effect at http://www.jhlabs.com/java/particles.html. I can send you the source code if you want.

Jerry

On 2 Feb 2007, at 18:29, Paul Howland wrote:

This is a general Java question, rather than anything Apple specific, although I develop on an Apple out of choice.

I'm fairly new to Java, so I'm just seeking some general guidance here of what approach to take. I am writing a Swing application that is meant to emulate a classical radar display. The application will be displaying real radar data - but I want to give it a classic radar display look. Something like http://www.jica- itumf.itu.edu.tr/Display of RADAR 2.jpg (a random image I found on Google).

So, what I want is a basically a black circle on which I can optionally display different layers. One layer would be a graticule displaying the range-rings and radial lines of constant bearing. This can be switched on or off. Then, on top of the display, I want to be able to display a "dot" or maybe a little arc that represents the location of each aircraft echo. As the radar scans over time, I'd like the older "dots" to gradually fade out (emulating the decay of a phosphor display) by, presumably, gradually increasing the alpha transparency of the plots as their age increases.

Thus, in concept at least, I'm thinking I need to be able to display a number of layers. One layer for the background and one for the graticule. Then I'm not sure how to achieve the fading plots idea. Perhaps a series of layers, one for each radar scan, where I can gradually change the alpha transparency of a layer as time increases, until the point where the transparency is total, when I delete the layer from the display altogether.

So, that's the concept.

What's the best way of achieving this? Can anyone point out some appropriate Java classes I should be considering? JLayeredPane sounds like a possible starting point, but I'm not sure how I add layers and then adjust their transparency with time. If anyone can provide some clues (possibly with some simple skeleton code) I'd much appreciate it! I'm a total Swing novice - so far I've used NetBeans to build a working GUI and played with creating a circle in a frame. That's the sum total of my experience of Swing (although I have done quite a lot of algorithmic Java development, so I understand Java OK, just not the Swing stuff).

Thanks in advance for your help!

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Creating a radar display in Java (From: Paul Howland <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.