This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Design Help on Applet/Graphics  RSS feed

 
TomD Logan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't normally get too deep into programming and need some advise on a graphics program I'm trying to create. I have a program that is monitoring the location of multiple vehicles and displaying their location on a map. In my current plan I'll have three layers of information - a jpeg image for the map, a drawing with multiple colored polygons representing various buildings, and a third layer that is opaque where I'll draw in images of vehicles based on their locations. I decided to make this web based so it will be accessable from pretty much anyplace. My first question is: What technology should I employ to accomplish this? My thoughts are to use an applet that loads the first 2 layers up and then leaves them as is. The third layer will then retrieve data on a fixed interval and repaint the vehicle locations. Is this a reasonable approach? If so,does anyone happen to have the base code to implement this with. I've been floundering in various forums reading about graphics2d, applets, japplets, mediatracker, and on and on. I want to start with an index.html with a subdirectory called 'images' relative to the index.html. The various images will then be in the images directory. I want to then load these 3 layers and update/repaint the third level on a regular basis from within an applet. Sample code that would work is very much appreciated. A second approach I've considered is to handle all the updating on the server side. I would create all the graphics and then convert the graphics to an image and simply load the image on the browser side. There are multiple details in both of these approaches that are still not fully baked - so any opinions/ideas/pitfalls are much appreciated. I would also entertain possibly paying for fully operational and debugged code for this providing final ownership of the code is mine to do with as I please.

Thanks
Tom
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My 2 cents.
It seems wasting the thick client resources by processing stuff on the server side. This would also mean overloading the server.

I would approach it this way.

When the applet loads, it will display the first two layers. Needless to say they will be coming from the server per se. From what you have described, these two layers are pretty constant.
The server has a monitorning component, which has a mechanism to figure out which vehicle has moved and where.
It can fire an intimation to all clients that the vehicle positions have changed. The notification event itself can contain the new co-ordinates so as to eliminate another server side call.
All the clients subscribe to these notifications. On getting them, they process the event and referesh the UI locally.

This way, you can eliminate (or bring down drastically) the 2 minute time lag which exists in your approach. Also you will be optimally utilizing the thick client resources, and not over loading the server.
 
TomD Logan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey - Thanks for the quick reply

What you say sounds reasonable. The first 2 layers are relatively static (days/months) whereas the 3rd layer is constantly changing. In fact the third layer is changing so fast that it can simply be updated at some specified time interval. On the third layer there are 50-100 objecft in motion - so it is not simply a coordinate changing, it is 100 x/y coordinates changing - which may be what you were assuming anyhow.
I'm unclear on this part of your proposal: "fire an intimation to all clients that the vehicle positions have changed. The notification event itself can contain the new co-ordinates". Can you give me some more detail as to what this notification is, how I would send this notification, and how I would target the various clients.

Any other design approaches anyone has?

Thanks
Tom
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by TomD Logan:

I'm unclear on this part of your proposal: "fire an intimation to all clients that the vehicle positions have changed. The notification event itself can contain the new co-ordinates".


Ok. I am imagining you are going to use some JComponent to indicate an individual "vehicle" and not "draw" it explicitly.
Consider an interface say a VehicleMovementListener which uses a VehicleMoved event.
You need to register the "vehicle" component as a listener to this interface.
The server triggers the VehicleMoved events. The VehicleMoved event object can contain the new co-ordinates. So each "vehicle" component gets notified when its own position changes. Then it can ask its parent container to redraw it.

Does this make sense?
 
TomD Logan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey - Thanks. That makes some sense to me - I'll have to do some self education to get a clearer picture of the details. I'll let you know if/when I got hung up on something.
Thanks,
Tom
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!