paint map areas of real map and make distinction

Hi,

I want to make an area of a map from a JPG (see url for example):

http://www.meccg.net/netherlands/meccg/downloads/promomap.jpg

Now, I want the application I am building to be able to unravel in regions and break down the map regions into separate parts.

The application needs to know when the mouse is pointed on a region which region it is etc.

How can this be accomplished ?

Thanks,

Coen

[443 byte] By [Coenosiaa] at [2007-10-3 1:36:13]
# 1
if the url was workingand also try MouseListener and i would guess u would have to try from there being im a newb i dont know much either..soo good luck
JollyRogera at 2007-7-14 18:34:19 > top of Java-index,Other Topics,Java Game Development...
# 2
Its not going to be easy. As far as I know, youre going to have to use a MouseMotionListener and have to distinguish between regions by using coordinates.
CaptainMorgan08a at 2007-7-14 18:34:19 > top of Java-index,Other Topics,Java Game Development...
# 3

Ho Coenosia,

I think you have two options.

1. Break the map up into pre-prepared sections, say 100 units x 100 units, and assign a mouse listener to each section, so when the mouse moves into a section (it could highlight itself?) and the user clicks in it, it opens.

2. Draw a square around the cursor so the cursor is in the centre and moves with the mouse. This is the more flexible option. The user could perhaps make the square smaller or bigger by using the mouse scroll wheel. Anyway, the user selects a map area and the exact size he wants and clicks.

Hope this has been helpful to you,

Hasman.

hasman001a at 2007-7-14 18:34:19 > top of Java-index,Other Topics,Java Game Development...
# 4

just do it how you would in HTML: use polygons.

write up a quick "tracing" program that displays that image and remembers the "points" you plot on the screen with your mouse. save these points somewhere for later use.

in your real program, load those points, create an individual polygon for each area, and check if the mouse is in the area with Polygon.contains() or Polygon.intersects()

Woogleya at 2007-7-14 18:34:19 > top of Java-index,Other Topics,Java Game Development...