map provinces
map provinces
map provinces
map provinces
map provinces
map provinces map provinces map provinces map provinces map provinces map provinces map provinces map provinces
map provinces map provinces
map provinces
Go Back  Xtreme Visual Basic Talk > > > map provinces


Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2015, 01:31 AM
wolfstrike's Avatar
wolfstrike wolfstrike is offline
Junior Contributor
 
Join Date: Aug 2004
Posts: 336
Default map provinces


I still use bitblt.

I would like to draw maps with provinces as artwork, then be able to change each of the provinces different colors, also highlight the borders.
I just don't see any way to do it without a hundred different pictures and knowing each x and y
__________________
The Pho·net·ic Programmer
Reply With Quote
  #2  
Old 04-12-2015, 08:51 PM
hDC_0map provinces hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default Drawing maps - raster versus vector

If you stick with different raster artwork for each province, then yes, you will probably have to include hundreds of different pictures.

However, here's an idea.

What if you made up a nice (but not too large) tile-able bitmap.

Then you save the outlines of the provinces as a series of 2D point arrays.

Then for each province you draw the outline as you would any normal polygon:
http://www.vb-helper.com/howto_fill_polygon.html

(This let's you do anything you want with highlighting the borders).



Then you use that to create (in an off screen picbox or memDC) a black/white version
of the province's polygon (flood filled) that can serve as a mask at runtime.

Have a non-visible picturebox sized to fit the largest province, filled (tiled-at-runtime) with the bitmap.
(see the BackBufferPark demo for tiling a bitmap using a memDC.)

Bitblt the graphics from these two hidden picboxes together
(with the right ROPcode) to a third (visible) picbox.

An Bitblt ROPcode sampler is attached to this post.

The number of bitblt's to the 3rd visible picturebox control only need equal the number of provinces.

For your tile-able bitmap you can even make 4 or 5 different ones with different colors
(or use color tints overlayed semi-transparently atop the same greyscale/desaturated random bumpy-iness pattern).

No more than four colors are really required (topologically speaking) to color the regions of the map
so that no two adjacent regions have the same color, per the Four color theorem.

Doing it the vector way might save a lot of time and total project file footprint.

Also (for other who might find this thread looking for something just a little different), you can shape a picturebox to its non-transparent pixels,
so each province can be its own shaped picturebox control
(in case you want to be able to click on the control
and have it do something like present travelogue info).

There is also a custom image map control in the forum's Code Library.

Last edited by hDC_0; 04-12-2015 at 09:05 PM.
Reply With Quote
  #3  
Old 04-25-2015, 03:41 PM
wolfstrike's Avatar
wolfstrike wolfstrike is offline
Junior Contributor
 
Join Date: Aug 2004
Posts: 336
Default

thanks for the reply. i'll review the ideas
__________________
The Pho·net·ic Programmer
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
map provinces
map provinces
map provinces map provinces
map provinces
map provinces
map provinces map provinces map provinces map provinces map provinces map provinces map provinces
map provinces
map provinces
 
map provinces
map provinces
 
-->