URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [mw/] [src/] [demos/] [nanox/] [README.world] - Rev 1765
Compare with Previous | Blame | View Log
WORLDThis is a program that uses mini-X graphics in MINIX to display a map ofthe world. The database for this map is supplied, and is an edited versionof the CIA database. The continents, islands, rivers, lakes, countries,and the states of the USA are shown. I have slightly edited the databaseto fix some arctic islands and remove the Berlin corridor. But some countryboundaries are obsolete, since this map is a few years old at least.This program only uses integer arithmetic. Floating point is simulatedusing fixed point arithmetic. For this reason, the projection used inthe program is rather crude (latitude and longitude are linear and areparallel lines). This means that there is much distortion for the landswhich are near the North and South poles. If floating point was avaiable,a good projection could be used instead (such as a true spherical view!).The file "world.map" is the database, and should be installed in "/usr/lib".Otherwise you need to edit world.c and change MAPFILE as desired.To build the program (assuming mini-X is installed), use the command:cc -o world world.c -lgraphWhen the program starts, it draws the whole world. After this is done,you can use two of the mouse buttons and the keys to manipulate the view.To zoom in on a section of the map, move the mouse to the location thatyou intend to zoom in on, and press the left mouse button. Then when youdrag the mouse, a rectangle (the zoom box) will be drawn to indicate thecurrent area that you are zooming into. Notice that the point that youstart the zoom box on will be the center of the zoom box, NOT one of itscorners.While keeping the mouse button pressed, you can use the 's' and 'm' keysto switch between the 'scaling' and the 'moving' modes of the rectangle.The scaling mode makes the size of the zoom box vary as you move the mouse,but keeps the center of the zoom box fixed. The moving mode keeps the sizeof the zoom box the same, but moves the box around as you move the mouse.Note that the width and height of the zoom box change together to preservethe aspect ratio of the zoom area.If you have started to do a zoom, but change your mind, then you can typethe escape key before letting up on the mouse button, and this will cancelthe zoom operation. If you really want to do a zoom, then simply let upon the mouse button and the selected area will be redrawn to fit the screen.At this point you can zoom in further if you wish.You can return to the top level map by typing 't'. Then you can zoom inagain on a different area of the map. Alternatively, you can "zoom out"just a little by creating a zoom box larger than the screen size. This canbe done, for example, by starting a zoom near the top of the screen, and thendragging the mouse down to the bottom of the screen. Repeating this processlets you slowly reduce the magnification.If you press the right mouse button, the display will show the longitudeand latitude of the location on the map covered by the cursor. You can thendrag the mouse around with the button held down, and the coordinates willcontinuously track the cursor location. Letting up on the mouse buttonremoves the coordinate display.Typing 'q' will quit from the world program.Enjoy!David I. Bell
