Public Group

Large Map ...

This topic is 4420 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I'm writing an 2d MapViewer with VC++ and GDI+ ... The Map is so large ... I just want to know ur technics for displaying this map ... Thanks, Hadi

Share on other sites
Well, if your map is small enough that it can be stored as an array without using up your all your memory, selecting the portion that is visible for display isn't terribly difficult.

If your map is too big for memory, you'll likely need to employ a spatial subdivision scheme and a method for procedurally generating the map at a particular location when it comes into view. The details of this algorithm will depend entirely on the specifics of what you are trying to do.

Share on other sites
If your map is grid-based then it is just a matter of
storing the top left corner and drawing only the amount of tiles that
can fit into the screen.

Share on other sites
Thanks alot for replies ...
Let me test ur ways and I'll write reply ...

Best Regards,

Share on other sites
Hi,

1- In this program the user should be able to Zoom In / Out on the map ...
So , what i need to do more ?!

2- Can do Double-Buffering in GDI+ ?!

Regards,

Share on other sites
Im not an expert, but heres my thoughts...

I think you have to do the double buffering yourself in GDI.
Simply make a bitmap in memory and render all the images and objects to it.
When you are done rendering things on the memory buffer, copy it to the screen with BitBlt or StretchBlt.

Im not sure if double buffering will be of much help if you only copy potions of a static image each frame.

As for zooming, I would consider using the StretchBlt function.

Pseudo code:
...source_rect.left = current_user_position.xsource_rect.top = current_user_position.ysource_rect.right = current_user_position.x + user_screen_width * zoom;source_rect.bottom = current_user_position.y + user_screen_height * zoom;...StretchBlt(...)

This is a quite simple example though, I suspect there is ways to make zooming look better

[Edited by - pulpfist on July 9, 2006 8:47:24 AM]

Share on other sites
For the double buffering you can create two
BufferedGraphics classes and do the double buffering your self
ie. Render your graphics to one buffer while displaying the other.

For the scaling you can draw your tiles with a rect larger than the original and the gdi will scale it for you.

Share on other sites
Hi again and thanks alot for replies ...

Ok, Now I came back from writing the program .
and i think i did it ..

I simply get the area that should be shown on the screen ...
I also used double-buffer ...
and draw the buffer on screen ...

But there is two strange problem ...

1- I've .4 sec delay on displaying each area only in first time ...
It means .. for example if didn't check (see, display) the right-corner of map , it takes time to display that area .. but in second time it displays smoothly ...

2- When i scroll my view fast ... i still see some flickers just in my window border ...

Plz help me ,

1. 1
2. 2
3. 3
4. 4
frob
20
5. 5
JoeJ
20

• 11
• 11
• 12
• 13
• 9
• Forum Statistics

• Total Topics
632214
• Total Posts
3004858

×