contrib/xplanet/xplanet-1.2.1.patch
2010-06-19 16:08:15 +10:00

458 lines
17 KiB
Diff

http://bugs.gentoo.org/show_bug.cgi?id=277937
diff -ur xplanet-1.2.1.orig/src/libimage/bmp.c xplanet-1.2.1/src/libimage/bmp.c
--- xplanet-1.2.1.orig/src/libimage/bmp.c 2006-03-26 00:50:51.000000000 +0200
+++ xplanet-1.2.1/src/libimage/bmp.c 2009-07-26 21:42:03.000000000 +0300
@@ -61,10 +61,10 @@
struct BMPHeader bmph;
/* The length of each line must be a multiple of 4 bytes */
-
bytesPerLine = (3 * (width + 1) / 4) * 4;
- strcpy(bmph.bfType, "BM");
+ /* copy only "BM" without a terminating null byte */
+ strncpy(bmph.bfType, "BM", 2);
bmph.bfOffBits = 54;
bmph.bfSize = bmph.bfOffBits + bytesPerLine * height;
bmph.bfReserved = 0;
diff -ur xplanet-1.2.1.orig/src/libmultiple/addOrbits.cpp xplanet-1.2.1/src/libmultiple/addOrbits.cpp
--- xplanet-1.2.1.orig/src/libmultiple/addOrbits.cpp 2008-11-14 01:46:12.000000000 +0200
+++ xplanet-1.2.1/src/libmultiple/addOrbits.cpp 2009-07-26 21:42:06.000000000 +0300
@@ -86,9 +86,13 @@
const double period = p->Period();
if (period == 0) return;
+ // Units of orbit circumference
const double startOrbit = currentProperties->StartOrbit();
const double stopOrbit = currentProperties->StopOrbit();
+
+ // degrees
const double delOrbit = currentProperties->DelOrbit();
+
const unsigned char *color = currentProperties->OrbitColor();
const int thickness = currentProperties->ArcThickness();
@@ -103,10 +107,11 @@
const double startTime = jd0 + startOrbit * period;
const double stopTime = jd0 + stopOrbit * period;
- const int numTimes = (int) (180/delOrbit + 0.5);
-
+ int numTimes = (int) abs(360 * startOrbit / delOrbit + 0.5);
addArc(startTime, jd0, numTimes, color, thickness, view, width, height,
Prx, Pry, Prz, p, annotationMap);
+
+ numTimes = (int) abs(360 * stopOrbit / delOrbit + 0.5);
addArc(jd0, stopTime, numTimes, color, thickness, view, width, height,
Prx, Pry, Prz, p, annotationMap);
}
diff -ur xplanet-1.2.1.orig/src/Satellite.cpp xplanet-1.2.1/src/Satellite.cpp
--- xplanet-1.2.1.orig/src/Satellite.cpp 2006-03-26 02:34:21.000000000 +0200
+++ xplanet-1.2.1/src/Satellite.cpp 2009-07-26 21:42:17.000000000 +0300
@@ -1,4 +1,5 @@
#include <clocale>
+#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
diff -ur xplanet-1.2.1.orig/src/Separation.cpp xplanet-1.2.1/src/Separation.cpp
--- xplanet-1.2.1.orig/src/Separation.cpp 2008-11-14 02:19:05.000000000 +0200
+++ xplanet-1.2.1/src/Separation.cpp 2009-07-26 21:42:17.000000000 +0300
@@ -1,4 +1,5 @@
#include <cmath>
+#include <cstdio>
#include <iostream>
#include "Separation.h"
diff -ur xplanet-1.2.1.orig/xplanet.1 xplanet-1.2.1/xplanet.1
--- xplanet-1.2.1.orig/xplanet.1 2007-12-27 01:48:50.000000000 +0200
+++ xplanet-1.2.1/xplanet.1 2009-07-26 21:42:17.000000000 +0300
@@ -31,7 +31,7 @@
.sp
.fi
where declination is in degrees and right ascension is in hours. This
-option has no effect if -projection is specified.
+option has no effect if \-projection is specified.
.TP
.B \-arc_spacing spacing
@@ -48,8 +48,8 @@
.TP
.B \-background background_file
Use background_file as the background image, with the planet to be
-superimposed upon it. A color may also be supplied (e.g. -background
-"navy blue" or -background 0xff00ff).
+superimposed upon it. A color may also be supplied (e.g. \-background
+"navy blue" or \-background 0xff00ff).
.TP
.B \-base_magnitude magnitude
@@ -67,20 +67,20 @@
pluto, charon, random, and major.
The field of view can also be centered on a satellite location using
-"naif" or "norad", along with the satellite id. For example, "-body
-naif-82" will center the field of view on NAIF ID -82, which is the
+"naif" or "norad", along with the satellite id. For example, "\-body
+naif-82" will center the field of view on NAIF ID \-82, which is the
Cassini orbiter. Xplanet must be compiled with SPICE support and the
required kernels must be present. See the README in the spice
-subdirectory for more details. Using "-body norad20580" will center
+subdirectory for more details. Using "\-body norad20580" will center
the field of view on NORAD ID 20580, which is the Hubble Space
Telescope. The appropriate TLE files must be present in this case.
See the README in the satellites subdirectory for more information.
Using "path" will center the field of view on the direction of motion
of the origin. This direction is relative to the direction of motion
-of the body specified by -path_relative_to.
+of the body specified by \-path_relative_to.
-Earth is the default body. This option is the same as -target.
+Earth is the default body. This option is the same as \-target.
.TP
.B \-center +x+y
@@ -92,13 +92,13 @@
.B \-color color
Set the color for the label. The default is "red". Any color in the
rgb.txt file may be used. Colors may also be specified by RGB hex
-values; for example -color 0xff and -color blue mean the same thing,
-as do -color 0xff0000 and -color red.
+values; for example \-color 0xff and \-color blue mean the same thing,
+as do \-color 0xff0000 and \-color red.
.TP
.B \-config config_file
Use the configuration file config_file. The format of config_file is
-described in README.config. See the description of -searchdir to see
+described in README.config. See the description of \-searchdir to see
where xplanet looks in order to find the configuration file.
.TP
@@ -116,7 +116,7 @@
.TP
.B \-dynamic_origin file
Specify an observer location. The location is relative to the body
-specified with -origin (by default, this is the Sun). The last line
+specified with \-origin (by default, this is the Sun). The last line
of the file must be of the form
.nf
.sp
@@ -126,7 +126,7 @@
For example,
.nf
.sp
-19951207.120000 10.328 -3.018 97.709 9.595
+19951207.120000 10.328 \-3.018 97.709 9.595
.sp
.fi
The specified time is ignored and the current time is used. The range
@@ -134,7 +134,7 @@
hours) is optional, but if present, it will be used in place of the
longitude. Only the last line of the file is used. This file may be
updated between renderings using a script executed with the
--prev_command or -post_command options.
+\-prev_command or \-post_command options.
.TP
.B \-ephemeris_file filename
@@ -144,13 +144,13 @@
little endian binary files. The ephemeris files found at
ftp://ssd.jpl.nasa.gov/pub/eph/export/unix are big endian files, but
you do not need to do any additional byte-swapping to use them. See
-the description of -searchdir to see where xplanet looks in order to
+the description of \-searchdir to see where xplanet looks in order to
find the ephemeris file.
.TP
.B \-font fontname
Set the font for the label. Only TrueType fonts are supported. If
-the -pango option is used, fontname is taken to be the font family
+the \-pango option is used, fontname is taken to be the font family
name (e.g. "Arial").
.TP
@@ -168,9 +168,9 @@
.TP
.B \-fov
-Specify the field of view, in degrees. This option and the -radius
+Specify the field of view, in degrees. This option and the \-radius
option are mutually exclusive. This option has no effect if the
--projection option is used.
+\-projection option is used.
.TP
.B \-geometry string
@@ -179,7 +179,7 @@
(e.g. 256x256-10+10 puts a window 256x256 pixels in size 10 pixels
away from the right side and 10 pixels below the top of the root
window). The root window outside of the image will be black. This
-option may be used with -window or -output.
+option may be used with \-window or \-output.
.TP
.B \-glare radius
@@ -188,7 +188,7 @@
.TP
.B \-gmtlabel
-Same as the -label option, but show GMT instead of local time.
+Same as the \-label option, but show GMT instead of local time.
.TP
.B \-grs_longitude lon
@@ -213,7 +213,7 @@
.TP
.B \-interpolate_origin_file
-This option is only useful in conjunction with -origin_file. It
+This option is only useful in conjunction with \-origin_file. It
computes the observer position at the current time by interpolating
between values specified in the origin file. This is useful if you
have spacecraft positions tabulated in an origin file, but want a real
@@ -232,12 +232,12 @@
Specify the location of the label using the standard X window geometry
syntax. The default position is "-15+15", or 15 pixels to the left
and below the top right corner of the display. This option implies
--label.
+\-label.
.TP
.B \-label_body body
Use the specified body to calculate the sub-observer, sub-solar, and
-illumination values in the label. This is useful with the -separation
+illumination values in the label. This is useful with the \-separation
option.
.TP
@@ -268,17 +268,17 @@
.B \-longitude longitude
Place the observer above the specified longitude (in degrees).
Longitude is positive going east, negative going west (for the earth
-and moon), so for example Los Angeles is at -118 or 242. The default
+and moon), so for example Los Angeles is at \-118 or 242. The default
value is 0.
.TP
.B \-make_cloud_maps
If there is an entry in the config file for cloud_map, xplanet will
output a day and night image with clouds overlaid and then exit. The
-images will be created in the directory specified by -tmpdir, or in
-the current directory if -tmpdir is not used. The names of the output
+images will be created in the directory specified by \-tmpdir, or in
+the current directory if \-tmpdir is not used. The names of the output
images default to day_clouds.jpg and night_clouds.jpg, but may be
-changed by the -output option. If "-output filename.extension" is
+changed by the \-output option. If "\-output filename.extension" is
specified, the output images will be named "day_filename.extension"
and "night_filename.extension". The dimensions of the output images
are the same as the day image.
@@ -290,11 +290,11 @@
declination, right ascension, string, as in the example below:
.nf
.sp
--16.7161 6.7525 "Sirius"
+\-16.7161 6.7525 "Sirius"
.sp
.fi
For additional options which may be specified, see the marker_file
-entry in README.config. This option has no effect if -projection is
+entry in README.config. This option has no effect if \-projection is
specified. This option is not meant for city markers; for that use
the marker_file option in the configuration file.
@@ -321,9 +321,9 @@
body: body's north pole
galactic: galactic north pole
orbit: body's orbital north pole (perpendicular to the orbit plane)
-path: origin's velocity vector (also see -path_relative_to option)
+path: origin's velocity vector (also see \-path_relative_to option)
separation: perpendicular to the line of sight and the
- target-separation target line (see -separation option)
+ target-separation target line (see \-separation option)
.sp
.fi
The default value is "body".
@@ -335,7 +335,7 @@
.TP
.B \-origin body
Place the observer at the center of the specified body. Valid values
-are the same as for -target. In addition, "above", "below", or
+are the same as for \-target. In addition, "above", "below", or
"system" may be specified. Using "above" or "below" centers the view
on the body's primary and the field of view is large enough to show
the body's orbit. Using "system" places the observer at the center of
@@ -351,15 +351,15 @@
If the body name is preceded by a dash, the observer is placed on the
opposite side of the target from the specified body at a distance
equal to the distance between the target and body. For example,
--target earth -origin sun places the observer at the center of the
-sun. If -target earth -origin -sun is used, the observer is placed on
+\-target earth \-origin sun places the observer at the center of the
+sun. If \-target earth \-origin \-sun is used, the observer is placed on
a line connecting the centers of the earth and sun at a distance of 1
AU farther from the sun than the earth.
.TP
.B \-origin_file origin_file
Specify a list of observer positions in origin_file. The positions
-are relative to the body specified with -origin (by default, this is
+are relative to the body specified with \-origin (by default, this is
the Sun). Each line should be of the form
.nf
.sp
@@ -369,14 +369,14 @@
For example,
.nf
.sp
-19951207.120000 10.328 -3.018 97.709 9.595
+19951207.120000 10.328 \-3.018 97.709 9.595
.sp
.fi
Range is in planetary radii, and lat and lon are in degrees. The date
is the only required value. If the localtime (in hours) is supplied,
it will be used in place of the longitude. For each line in the
origin file, the observer is placed at the specified position,
-relative to the body specified with -origin. This option is useful
+relative to the body specified with \-origin. This option is useful
for showing spacecraft flybys or orbiting around a planet. Any line
with a # in the first column is ignored.
@@ -386,8 +386,8 @@
taken from the extension. Currently .gif, .jpg, .ppm, .png, and .tiff
images can be created, if xplanet has been compiled with the
appropriate libraries. The image size defaults to 512 by 512 pixels
-but this may be changed by the -geometry flag. If used with the
--num_times option, each output file will be numbered sequentially.
+but this may be changed by the \-geometry flag. If used with the
+\-num_times option, each output file will be numbered sequentially.
.TP
.B \-output_start_index index
@@ -404,7 +404,7 @@
.TP
.B \-path_relative_to body
-Only used with -north path or -target path. The origin's velocity
+Only used with \-north path or \-target path. The origin's velocity
vector is calculated relative to the specified body. By default, this
is the Sun.
@@ -416,7 +416,7 @@
On MS Windows, you may need to use unix-style paths. For example:
.nf
.sp
-xplanet.exe -prev_command ./prev.bat
+xplanet.exe \-prev_command ./prev.bat
.sp
.fi
@@ -471,8 +471,8 @@
.TP
.B \-rotate angle
Rotate the globe by angle degrees counterclockwise so that north (as
-defined by the -north argument) isn't at the top. The default value
-is 0. My friends in the Southern Hemisphere can use -rotate 180 to
+defined by the \-north argument) isn't at the top. The default value
+is 0. My friends in the Southern Hemisphere can use \-rotate 180 to
make the earth look like it should! For non-orthographic projections,
the globe is rotated and then projected, if that helps you visualize
what to expect.
@@ -481,7 +481,7 @@
.B \-save_desktop_file
On Microsoft Windows and Mac OS X, xplanet creates an intermediate
image file which is used to set the desktop. This file will be
-created in the -tmpdir directory. By default, this image is removed
+created in the \-tmpdir directory. By default, this image is removed
after the desktop has been set. Specifying this option will leave the
file in place.
@@ -507,14 +507,14 @@
.TP
.B \-separation body:dist
Place the observer at a location where the target body and the
-separation body are dist degrees apart. For example "-target earth
--separation moon:-3" means place the observer at a location where the
+separation body are dist degrees apart. For example "\-target earth
+\-separation moon:-3" means place the observer at a location where the
moon appears 3 degrees to the left of the earth.
.TP
.B \-spice_ephemeris index
Use SPICE kernels to compute the position of the named body. The
-index is the naif ID code (e.g. 599 for Jupiter). The -spice_file
+index is the naif ID code (e.g. 599 for Jupiter). The \-spice_file
option must be used to supply the names of the kernel files. This
option may be used more than once for different bodies.
@@ -544,15 +544,15 @@
decimal hours. For example, the entry for Sirius is
.nf
.sp
--16.7161 6.7525 -1.46
+\-16.7161 6.7525 \-1.46
.sp
.fi
-See the description of -searchdir to see where xplanet looks in order
+See the description of \-searchdir to see where xplanet looks in order
to find the star map.
.TP
.B \-target target
-Same as -body.
+Same as \-body.
.TP
.B \-tt
@@ -568,13 +568,13 @@
.TP
.B \-tmpdir tmpdir
Specify a directory that xplanet will use to place images created
-using -make_cloud_maps. On Microsoft Windows, xplanet will write
+using \-make_cloud_maps. On Microsoft Windows, xplanet will write
a bitmap file called xplanet.bmp to the specified directory. The
default is the result of the GetWindowsDirectory call (C:\WINDOWS on
Win95). On Mac OS X, xplanet will create an intermediate PNG file in
order to set the background. The default value is /tmp. On Windows
and Mac OS X, the intermediate file will be removed unless the
--save_desktop_file option is specified.
+\-save_desktop_file option is specified.
.TP
.B \-transparency
@@ -583,12 +583,12 @@
.TP
.B \-transpng filename
-Same as the -output option, except set the background to be
+Same as the \-output option, except set the background to be
transparent when writing a PNG file.
.TP
.B \-utclabel
-Same as -gmtlabel.
+Same as \-gmtlabel.
.TP
.B \-verbosity level
@@ -624,13 +624,13 @@
.TP
.B \-window
Render the image to its own X window. The size defaults to 512 by 512
-pixels but this may be set by the -geometry flag.
+pixels but this may be set by the \-geometry flag.
.TP
.B \-window_title title
-Set the window's title to title. This option implies -window.
+Set the window's title to title. This option implies \-window.
.TP
.B \-xscreensaver
-Same as -vroot.
+Same as \-vroot.