1 |
673 |
markom |
WORLD
|
2 |
|
|
|
3 |
|
|
This is a program that uses mini-X graphics in MINIX to display a map of
|
4 |
|
|
the world. The database for this map is supplied, and is an edited version
|
5 |
|
|
of the CIA database. The continents, islands, rivers, lakes, countries,
|
6 |
|
|
and the states of the USA are shown. I have slightly edited the database
|
7 |
|
|
to fix some arctic islands and remove the Berlin corridor. But some country
|
8 |
|
|
boundaries are obsolete, since this map is a few years old at least.
|
9 |
|
|
|
10 |
|
|
This program only uses integer arithmetic. Floating point is simulated
|
11 |
|
|
using fixed point arithmetic. For this reason, the projection used in
|
12 |
|
|
the program is rather crude (latitude and longitude are linear and are
|
13 |
|
|
parallel lines). This means that there is much distortion for the lands
|
14 |
|
|
which are near the North and South poles. If floating point was avaiable,
|
15 |
|
|
a good projection could be used instead (such as a true spherical view!).
|
16 |
|
|
|
17 |
|
|
The file "world.map" is the database, and should be installed in "/usr/lib".
|
18 |
|
|
Otherwise you need to edit world.c and change MAPFILE as desired.
|
19 |
|
|
|
20 |
|
|
To build the program (assuming mini-X is installed), use the command:
|
21 |
|
|
|
22 |
|
|
cc -o world world.c -lgraph
|
23 |
|
|
|
24 |
|
|
When the program starts, it draws the whole world. After this is done,
|
25 |
|
|
you can use two of the mouse buttons and the keys to manipulate the view.
|
26 |
|
|
|
27 |
|
|
To zoom in on a section of the map, move the mouse to the location that
|
28 |
|
|
you intend to zoom in on, and press the left mouse button. Then when you
|
29 |
|
|
drag the mouse, a rectangle (the zoom box) will be drawn to indicate the
|
30 |
|
|
current area that you are zooming into. Notice that the point that you
|
31 |
|
|
start the zoom box on will be the center of the zoom box, NOT one of its
|
32 |
|
|
corners.
|
33 |
|
|
|
34 |
|
|
While keeping the mouse button pressed, you can use the 's' and 'm' keys
|
35 |
|
|
to switch between the 'scaling' and the 'moving' modes of the rectangle.
|
36 |
|
|
The scaling mode makes the size of the zoom box vary as you move the mouse,
|
37 |
|
|
but keeps the center of the zoom box fixed. The moving mode keeps the size
|
38 |
|
|
of the zoom box the same, but moves the box around as you move the mouse.
|
39 |
|
|
Note that the width and height of the zoom box change together to preserve
|
40 |
|
|
the aspect ratio of the zoom area.
|
41 |
|
|
|
42 |
|
|
If you have started to do a zoom, but change your mind, then you can type
|
43 |
|
|
the escape key before letting up on the mouse button, and this will cancel
|
44 |
|
|
the zoom operation. If you really want to do a zoom, then simply let up
|
45 |
|
|
on the mouse button and the selected area will be redrawn to fit the screen.
|
46 |
|
|
At this point you can zoom in further if you wish.
|
47 |
|
|
|
48 |
|
|
You can return to the top level map by typing 't'. Then you can zoom in
|
49 |
|
|
again on a different area of the map. Alternatively, you can "zoom out"
|
50 |
|
|
just a little by creating a zoom box larger than the screen size. This can
|
51 |
|
|
be done, for example, by starting a zoom near the top of the screen, and then
|
52 |
|
|
dragging the mouse down to the bottom of the screen. Repeating this process
|
53 |
|
|
lets you slowly reduce the magnification.
|
54 |
|
|
|
55 |
|
|
If you press the right mouse button, the display will show the longitude
|
56 |
|
|
and latitude of the location on the map covered by the cursor. You can then
|
57 |
|
|
drag the mouse around with the button held down, and the coordinates will
|
58 |
|
|
continuously track the cursor location. Letting up on the mouse button
|
59 |
|
|
removes the coordinate display.
|
60 |
|
|
|
61 |
|
|
Typing 'q' will quit from the world program.
|
62 |
|
|
|
63 |
|
|
Enjoy!
|
64 |
|
|
David I. Bell
|