home *** CD-ROM | disk | FTP | other *** search
- Drawmap
-
- A program for drawing representations of the Earth's surface.
-
- by
-
- Bryan Brown
-
- 06/26/89
-
- I. Distribution
-
- This program is released into the public domain (FREEWARE), and is
- freely distributable as long as this document file, source code, header files
- and map files are included in their entirety. The source may be modified for
- personal use, but is NOT for commercial use. I would, however, appreciate
- receiving credit for the implementation of the ideas embodied in the program.
- Donations are welcome, but not at all necessary since I do this stuff for fun.
-
- II. Introduction
-
- Drawmap is a program that draws several different views of the Earth's
- surface. In my work we regularly display views of the orbits of Earth-
- orbiting satellites superimposed on one of several different types of maps.
- Even though I am not involved with the development of graphics displays, the
- quality of the displays generated on our IRIS workstations finally induced me
- to try my hand at similar graphics on the Amiga. While a stock Amiga cannot
- generate displays as fast as the IRIS systems, the quality of the displays it
- can generate are quite respectable.
-
- The user interface is exclusively through pop-up menus, as implemented
- by Derek Zahn on Fish disk 96 and used in Bob Corwin's rotating globe
- demonstration on Fish disk 151. The IRIS systems have a similar interface,
- and make for a very professional appearance.
-
- The executable code was built using Aztec C, Version 3.6a. I have no
- idea what modifications would be necessary to build it with Lattice C, but
- they should not be extensive. Included is a simple batch file for building
- the executable from source.
-
-
- III. Files Provided
-
- drawmap - the executable file
- drawmap.c - the source code
- drawmap.doc - this document file
- drawmap.h - header file containing necessary non-menu definitions
- drawmap-menu.h - header file with menu definitions
- pop-drawmap.c - source for pop-up menus, modified for this application
- to initialize the special mouse pointer
- map.bin - map data file (see below)
- map-trig.bin - map data file (see below)
- makepop-drawmap - batch file for compiling pop-drawmap.c
- makedrawmap - batch file for building executable from source
- pop.c - original source for pop-up menus
- pop.doc - original documentation for the pop-up menus
- popmenu.h - header file needed by pop.c and pop-drawmap.c
-
-
- IV. Map Files
-
- Land masses (referred to as regions here) are represented as closed
- polygons. Each vertex of such a polygon is represented as an ordered pair of
- numbers, the first being the latitude and the second the longitude. Latitude
- runs from -90 degrees (the South pole) to +90 degrees (the North pole), while
- longitude runs from -180 degrees to +180 degrees. The end of a region is
- indicated by a point with values (0, 0).
-
- There are two binary files loaded into memory during program
- initialization. The first file, "map.bin", consists of 8859 of these
- (latitude, longitude) pairs, packed into short integers (16 bits each) to
- conserve memory and disk space. The second file, "map.trig.bin", also
- consists of short integers, each pair being packed representations of the
- cosine and sine of the latitude of the corresponding point in "map.bin".
- These values were pre-computed in order to speed up the drawing of the globe
- views described below. The latitude and longitude values are accurate to
- 0.01 degree each. The sines and cosines of the latitude are only accurate to
- 4 or 5 decimal places, but this is more than accurate enough for this
- application.
-
-
- V. Usage and Features
-
- To run the program, you can either
-
- - enter "run drawmap" from the CLI, or
- - click on the DrawMap icon from the Workbench,
-
- either of which brings up a blank, high resolution interlaced window. The
- user communicates with the program entirely via the mouse. Messages and
- instructions to the user appear in the window title bar. Pressing the menu
- button brings up a pop-up window with the following user options:
-
- o Color-Fill - An on-off switch indicating whether or not regions are to be
- color-filled. A checkmark in the pop-up menu indicates that color-fill is
- on.
-
- o Flat - Generate a "Flat" map. A "Flat" map is just a plot of the latitude
- and longitude pairs, without any attempt to preserve areas or make the
- representation conformal. This type of map is therefore not usually used
- by cartographers.
-
- o Mercator - Generate a Mercator map, color-filling the continents. This is
- the standard conformal map.
-
- o Globe - Generate a view of one entire hemisphere of the Earth. If the last
- view drawn was neither a Flat nor Mercator map, a Flat map is first drawn.
- The user is then prompted (in the window title bar) to press the mouse
- selection button to choose the point on the Earth's surface to appear at
- the center of the globe view. Note that this is a representation of how
- the Earth would look (without clouds, of course) to an observer infinitely
- far away, but with a very powerful telescope.
-
- o Orbital - Generate a view of the Earth as seen from an altitude of 300
- kilometers. As above, press the mouse select button to choose the point to
- appear at the center of the globe view. Because of perspective effects,
- the continents and larger islands appear distorted in this view compared to
- the previous globe view.
-
- o Zoom In - Generate an orbital view as above, but halve the altitude from
- which the view is seen. The resulting altitude appears in the title bar.
- The minimum allowed altitude is 10 kilometers.
-
- o Zoom Out - Generate an orbital view as above, but double the altitude from
- which the view is seen. The resulting altitude appears in the title bar.
-
- o Box - Draw a map of all regions overlapping a rectangular box. As the
- window title bar indicates, press and drag the mouse select button to
- define the box desired.
-
- o Grid - Superimpose a latitude-longitude grid on the currently-drawn map.
- This option is not allowed for the Box view.
-
- o Flood Fill - Color-fill an area of the map currently displayed. As the
- window title bar indicates, press the mouse select button to select the
- area to be color-filled. Note that only if the area being color-filled is
- of the same color as the oceans does color-filling actually occur. In
- other words, the black sky background in the globe and orbital views cannot
- be color-filled.
-
- o Colors - Modify the colors used to display land masses and bodies of water.
-
- o Clear - Clear the Screen.
-
-
- VI. Notes
-
- o The time required to complete a globe view is longer than I would have
- liked. Pre-computing the sines and cosines of the latitudes helped, but
- with a stock Amiga about 35 seconds is still required to plot a typical
- globe view.
-
- o In the globe views, the blue globe is drawn using the DrawEllipse and Flood
- functions. I originally used the AreaEllipse and AreaEnd functions, but
- for reasons unknown to me the resulting blue globe had horizontal black
- spikes running across it. I would appreciate receiving an explanation of
- this phenomenon.
-
- o For the Flat, Mercator and Globe views the grid lines are spaced 20 degrees
- in latitude and 30 degrees in longitude. For the Orbital views, above 1200
- kilometers the grid lines are spaced as above, but below 1200 kilometers
- they are spaced 10 degrees in latitude and 15 degrees in longitude so that
- they can be more easily seen.
-
- o Regions that wrap around the limb of the Earth in the Globe and Orbital
- views, or that cross the boundaries in the Box view, are not color-filled.
- The algorithm I have for doing this depends on the (sometimes complex)
- topology of the set of rim points that arise during the drawing of a given
- region. Mapping the rim point coordinates to screen coordinates introduces
- a discreteness which makes the algorithm very sensitive to truncation and
- roundoff. For the time being I have left these partial regions un-filled.
- In any case, the Flood Fill function can be used to tidy up.
-
-
- VII. Conclusion
-
- If you have any questions, recommendations, gripes, etc., about this
- program, I can be reached at the following address:
-
-
- Dr. Bryan Brown
-
- Computer Sciences Corporation
-
- c/o
-
- Flight Dynamics Facility
- Code 553.1
- Goddard Space Flight Center
- Greenbelt, MD 20771
-