Re: click inside a region
- From: "David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Jul 2009 07:26:45 +0100
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message news:a5ip451ftc9rpvqahqpm9l87ph1t6ndh0m@xxxxxxxxxx
I would consider the only sane representation to be the vector format representation; as
you point out, it can be scaled.
Unfortunately, for various projections (e.g., the classic Mercator map) the scaling is
quite nonlinear, but the formulas are centuries old. There's probably a set of Web sites
devoted to the math.
For a fixed projection, the transformation is easily precomputed, or could be built into
the vector representation.
I hadn't interpreted the OP's problem as necessarily one of creating specifically a map of the globe. But if so, yes, the underlying vector data could be stored as coordinates on the globe, or as coordinates on the map. The first would have the advantage that different projections could be applied at the stage where the bitmap is created. It's a while since I looked at them but IIRC standard projections like Mercator are not particularly complicated.
FillRgn can be used to fill an arbitrary region, and PtInRgn can be used for hit testing.
Much simpler than the bitmap manipulation.
However, note that even with a "limited" number of colors selected, a "red" or "green" or
"yellow" or "blue" map element can be made different from other "red" or "green" or
"yellow" or "blue" map elements of nominally the same color by tweaking the low-order bit
of one of the color components. Thus, while yellow is nominally RGB(255, 255, 0), most
displays will show a yellow which is visually indistinguishable except it might be
RGB(254, 255, 0), RGB(255, 254, 0), RGB(254, 254, 0) or repeat all of the preceding with
RGB(r, g, 1) for the aforementioned values of r and g. This can be repeated for a fairly
large range, probably up to 5, without creating colors that look distinct. So the pixel
hack *can* work, but it still makes sense to have the basic representation as vectors.
I was imagining use of a visibly different colour for each region - much prettier :-)
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
.
- Follow-Ups:
- Re: click inside a region
- From: Joseph M . Newcomer
- Re: click inside a region
- References:
- Re: click inside a region
- From: David Webber
- Re: click inside a region
- From: David Ching
- Re: click inside a region
- From: vvf
- Re: click inside a region
- From: David Ching
- Re: click inside a region
- From: David Webber
- Re: click inside a region
- From: Joseph M . Newcomer
- Re: click inside a region
- Prev by Date: Re: CEvent & WaitForSingleObject (auto-reset)
- Next by Date: Re: CEvent & WaitForSingleObject (auto-reset)
- Previous by thread: Re: click inside a region
- Next by thread: Re: click inside a region
- Index(es):
Relevant Pages
|