wmglobe: Update to version 1.3.

From https://github.com/d-torrance/dockapps/pull/6
This commit is contained in:
Doug Torrance 2018-01-08 08:26:56 -05:00 committed by Carlos R. Mafra
parent 23019d9278
commit cb7b362149
17 changed files with 4948 additions and 4425 deletions

View file

@ -1,4 +1,27 @@
VMGlobe VMGlobe
1.3 released 12/08/01
- solve bug of custom map loading (now all maps are 3 layers RGB)
- default -bord is now 2
- accept a night map of different size than the day map
- new -defnimap option
- a few minor changes
1.2 released 9/04/2000
- WindowMaker 0.62 compliancy
1.1 not released
- another floating point exception bug solved (Alpha)
- little optimizations and rewriting in rend.c
- -sun option
- -moon option
- -mk marker option
1.0 released 30/05/99
- option -stable : latitude never change of sign
- change email to jerome.dumonteil@linuxfr.org
- modify a few typo in doc
0.5 released 6/02/99 0.5 released 6/02/99
- floating point exception bug solved - floating point exception bug solved
- many minor bugs solved (earth displaying, mouse, time management) - many minor bugs solved (earth displaying, mouse, time management)
@ -11,7 +34,7 @@ VMGlobe
- option selection through parameters screens (right button) - option selection through parameters screens (right button)
- approximation of date & time of view point - approximation of date & time of view point
- new default map (bigger, better) - new default map (bigger, better)
- display of time uses setlocale() - display of time uses setlocale()
- option -dawn value : enhance dawn borderline - option -dawn value : enhance dawn borderline
- option -time : change date displayed - option -time : change date displayed
- option -nonimap - option -nonimap
@ -20,16 +43,16 @@ VMGlobe
- modify comportment of -rand option when zooming - modify comportment of -rand option when zooming
- change left button comportment : only change longitude - change left button comportment : only change longitude
- shift+left button : change longitude & latitude - shift+left button : change longitude & latitude
- man page - man page
0.3.1 released 5/02/99 0.3.1 released 5/01/99
- option -austral - option -austral
- solved bug about colors 24 and 32 bit per pixel - solved bug about colors 24 and 32 bit per pixel
0.3 released 3/02/99 0.3 released 3/01/99
- right button : screen of digital modification of latitude/long. - right button : screen of digital modification of latitude/long.
0.2.1 released 3/02/99 0.2.1 released 3/01/99
- change & enhance mouse operations (longitude/latitude/zoom) - change & enhance mouse operations (longitude/latitude/zoom)
- minor bugs, CPU optimization - minor bugs, CPU optimization
@ -39,7 +62,7 @@ VMGlobe
left click = change longitude left click = change longitude
middle click = zoom in / zoom out middle click = zoom in / zoom out
right click = change latitude right click = change latitude
- a few hints for compile on *BSD - a few hints for compile on *BSD
0.1 released 31/12/98 0.1 released 31/12/98

View file

@ -2,7 +2,7 @@ INC = -I/usr/X11R6/include
LIBS = -lXext -lX11 -lm -L/usr/X11R6/lib \ LIBS = -lXext -lX11 -lm -L/usr/X11R6/lib \
-ltiff -lXpm -lpng -lz -ljpeg -lungif -lwraster -ltiff -lXpm -lpng -lz -ljpeg -lungif -lwraster
OBJS = src/wmglobe.o src/rend.o src/wmgutil.o \ OBJS = src/wmglobe.o src/rend.o src/wmgutil.o \
src/sunpos.o src/myconvert.o src/mycontext.o src/sunpos.o src/myconvert.o src/mycontext.o
.c.o : .c.o :
@ -12,11 +12,11 @@ all: wmglobe
clean: clean:
rm -f src/*.o wmglobe rm -f src/*.o wmglobe
wmglobe : $(OBJS) wmglobe : $(OBJS)
gcc -O2 -Wall $(OBJS) -o wmglobe $(LIBS) gcc -O2 -Wall $(OBJS) -o wmglobe $(LIBS)
strip wmglobe strip wmglobe
install : install :
install wmglobe /usr/local/bin install wmglobe /usr/local/bin
install wmglobe.1 /usr/local/man/man1 install wmglobe.1 /usr/local/man/man1

View file

@ -1,5 +1,5 @@
WMGlobe 0.5 - The Whole Earth spinning on you desktop... as a dockable app WMGlobe 1.3 - The Whole Earth spinning on you desktop... as a dockable app
Copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> Copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
This program is licensed under the terms of the GNU GPL, see below. This program is licensed under the terms of the GNU GPL, see below.
@ -10,90 +10,98 @@ WMGlobe is a WindowMaker dock.app that displays the earth on an icon. It's
an adaptation of XGlobe to WMaker environnement. WMGlobe uses a map which is an adaptation of XGlobe to WMaker environnement. WMGlobe uses a map which is
rendered on a sphere by raytracing. Yes, for a 64x64 pixel result :-) rendered on a sphere by raytracing. Yes, for a 64x64 pixel result :-)
It's still a beta version...
Installation Installation
---------------------------------------- ----------------------------------------
You need WindowMaker to build WMGlobe. WMGlobe needs libwraster to compile, You need WindowMaker to build WMGlobe. WMGlobe needs libwraster to compile,
this lib is built by WindowMaker. No more need at run time if statically this lib is built by WindowMaker. No more need at run time if statically
linked, but then, you need WindowMaker to get the full magic :-) linked, but then, you need WindowMaker to get the full magic :-)
Warning : this version won't work with WindowMaker < 0.62
tar -xvzf wmglobe-0.5.tar.gz tar -xvzf wmglobe-1.3.tar.gz
cd wmglobe-0.5 cd wmglobe-1.3
make make
then move wmglobe in /usr/local/bin and man page somewhere or do then move wmglobe in /usr/local/bin and man page somewhere or do
(as root) : (as root) :
make install make install
If it doesn't work, look for the graphic libraries. If it doesn't work, look for the graphic libraries.
The Makefile is quite crude... The Makefile is quite crude...
WMGlobe is developped on Linux (WMaker 0.51.0 and linux 2.0.36/ix86). WMGlobe is developped on Linux (WMaker 0.65.1 and linux 2.4.x/ix86).
If you are successful on other platforms, please tell me so. If you are successful on other platforms, please tell me so.
platforms with successfull built reported : platforms with successfull built reported (wmglobe 1.0 for older WMaker):
NetBSD 1.3.2 / SPARC (wmaker 0.20.3) , with Makefile adaptations for libs NetBSD 1.3.2 / SPARC (wmaker 0.20.3) , with Makefile adaptations for libs
Linux 2.0.36 / RedHat 5.1 Linux 2.0.36 / RedHat 5.1
Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif
Linux 2.0.36 / RedHat 5.2 (wmaker 0.53)
Linux 2.2.0-pre4 / Debian :-) Linux 2.2.0-pre4 / Debian :-)
FreeBSD-3.0 with -ltiff -> -ltiff34 and -lungif -> -lgif FreeBSD-3.0 with -ltiff -> -ltiff34 and -lungif -> -lgif
Solaris 2.6 / Sun Sparc (wmaker 0.20.3) , with Makefile adaptations for libs Solaris 2.6 / Sun Sparc (wmaker 0.20.3) , with Makefile adaptations for libs
AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2) AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2)
Linux 2.3.14 / Mandrake (wmaker but also blackbox !)
LinuxPPC 1999
Linux 2.2.10 / Alpha (wmglobe 1.1+)
RPM & DEBIAN linux packages coming soon. Or you can directly use the binary. RPM & DEBIAN linux packages coming soon. Or you can directly use the binary.
compile time problems : compile time problems :
Xlib.h, Xpm.h ... : Xlib.h, Xpm.h ... :
If you compile wmglobe on a computer installed with packages (.rpm), you may If you compile wmglobe on a computer installed with packages (.rpm), you may
lack of these header files. Just install the "xxx-dev.rpm" packages for XFree86 lack of these header files. Just install the "xxx-dev.rpm" packages for XFree86
and graphics libs, or install a rpm version of wmglobe. and graphics libs, or install a rpm version of wmglobe.
libwraster : libwraster :
WindowMaker 0.20.3 uses a libwraster.a , so if you use it, you can execute WindowMaker 0.20.3 uses a libwraster.a , so if you use it, you can execute
the binary on a computer without WindowMaker on it, and displaying on a the binary on a computer without WindowMaker on it, and displaying on a
remote computer (this one using WindowMaker). WM 0.51.0 creates a dynamic remote computer (this one using WindowMaker). WM > 0.51.0 creates a dynamic
libwraster.so, so it's necessary to have it on the computer running wmglobe libwraster.so, so it's necessary to have it on the computer running wmglobe
if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3 if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3
and 0.51.0 and 0.51.0
For wmglobe 1.2+, you need WMaker 0.62 or more recent. And wmglobe 1.0 won't
run on these recent versions of WindowMaker. You need to have wraster.h
in the include path to compile wmglobe.
For wmglobe 1.3+, you probably need WMaker 0.64 or more recent.
graphic libs : graphic libs :
you can use libgif or libungif. If your version of WindowMaker is built you can use libgif or libungif. If your version of WindowMaker is built
without support for some graphic type, you don't need it (just remove it without support for some graphic type, you don't need it (just remove it
from the makefile). from the makefile).
This problem may happen with RedHat 5.2, if you get this kind of message, This problem may happen with RedHat 5.2, if you get this kind of message,
just add a libtiff to your system : just add a libtiff to your system :
/usr/local/lib/libwraster.so: undefined reference to `TIFFReadDirectory' /usr/local/lib/libwraster.so: undefined reference to `TIFFReadDirectory'
... ...
make: *** [wmglobe] Error 1 make: *** [wmglobe] Error 1
compile time options : compile time options :
You can modify the file wmgoption.h where many options are set up in defines : You can modify the file wmgoption.h where many options are set up in defines :
To disable the builtin default map, just comment out the line in wmgoptions.h : To disable the builtin default map, just comment out the line in wmgoptions.h
#define DEFMAPOK #define DEFMAPOK
to supprim the shift+left/left method of rotate earth, uncomment the lines to remove the shift+left/left method of rotate earth, uncomment the lines
#define MOUSE_LAT_FULL #define MOUSE_LAT_FULL
you can also suppress some options screen in wmgoption.h you can also suppress some options screen in wmgoption.h (or even suppress
new features of wmglobe 1.2)
Maps
Maps
---------------------------------------- ----------------------------------------
Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default, Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default,
it uses a low quality built-in map of earth. But you will probably want it uses a low quality built-in map of earth. But you will probably want
to use better ones. to use better ones.
You can get maps usable with WMGlobe on the net. See the LINKS chapter. You can get maps usable with WMGlobe on the net. See the LINKS chapter.
@ -101,8 +109,7 @@ You can get maps usable with WMGlobe on the net. See the LINKS chapter.
using custom maps : using custom maps :
- For the image to be mapped correctly, position 0°North 0°West must be in - For the image to be mapped correctly, position 0°North 0°West must be in
the center of the image and the latitude must be linear from 90°N to 90°S. the center of the image and the latitude must be linear from 90°N to 90°S.
- When using a night map, make sure that day and night map have the same - You can safely use a night map of different size than the day map.
dimensions.
By the way, you can use maps of Mars, Luna ... and text. By the way, you can use maps of Mars, Luna ... and text.
@ -112,37 +119,42 @@ Configuration options
---------------------------------------- ----------------------------------------
Configuration is done through command line options. Configuration is done through command line options.
-v version -v version
-h short help -h short help
-zoom zoom_value Value > 1 to magnify the view, value < 1 to lower. -zoom zoom_value Value > 1 to magnify the view, value < 1 to lower.
Default : 1.0 Default : 1.0
-pos latitude long. Initial viewing fixed at this position, don't follow -pos latitude long. Initial viewing fixed at this position, don't follow
the sun rotation. Accepted values in the form the sun rotation. Accepted values in the form
45°12'36 or 45.21 or 45:12:36 45°12'36 or 45.21 or 45:12:36
Default : the initial position is "under" the sun, and Default : the initial position is "under" the sun, and
the point of view follows the sun the point of view follows the sun.
-sun The point of view follows the Sun (default).
-moon The point of view follows the Moon (i.e. you see the
Earth as you were on the Moon).
-rand New random position at every refresh of screen -rand New random position at every refresh of screen
-map map_file Map used for the rendering. Can be JPEG, GIG, XPM -map map_file Map used for the rendering. Can be JPEG, GIF, XPM
PNM, TIFF but none BMP PNM, TIFF but none BMP
Default : use internal map of earth. Default : use internal map of earth.
-nimap night_file Map used for the dark side of the earth. Must be of -nimap night_file Map used for the dark side of the earth. Must be of
the same width x height as the day side map. the same width x height as the day side map.
Default : if the default internal day map is used, use Default : if the default internal day map is used, use
a default internal night file (see -nonimap option). a default internal night file (see -nonimap option).
If a custom day map is provided, and no night map, the
dark side is computed via the -light option. -defnimap Use the default night map (with a custom map).
-nonimap Don't use the default night map. -nonimap Don't use the default night map.
-delay seconds Time in seconds between each calculation of a new -delay seconds Time in seconds between each calculation of a new
position. Limited to 0.04 at compile time (25 frames position. Limited to 0.04 at compile time (25 frames
per second should be enough). The sun position move per second should be enough). The sun position move
only once per minute, so if you use wmglobe without only once per minute, so if you use wmglobe without
-dlong or -accel option, the CPU cost of WMGlobe is -dlong or -accel option, the CPU cost of WMGlobe is
*very* low. The use of very low value for -delay plus *very* low. The use of very low value for -delay plus
@ -150,29 +162,29 @@ Configuration is done through command line options.
Default : 1.0 sec. Default : 1.0 sec.
-dlat delta_latitude Move the point of view by delta_lat degrees per second, -dlat delta_latitude Move the point of view by delta_lat degrees per second,
with a value of 6 the earth make a full rotation in with a value of 6 the earth make a full rotation in
one minute. The value can be formated as -pos option. one minute. The value can be formated as -pos option.
Default : 0°0'0 Default : 0°0'0
-dlong delta_long Move the point of view by delta_long degrees per -dlong delta_long Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default, rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view -dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero. in parameters screen put -dlat and -dlong to zero.
-light light_value Level of light of the dark side when there is no -light light_value Level of light of the dark side when there is no
night map, from 0 to 1. night map, from 0 to 1.
Default : 0.25 Default : 0.25
-dawn dawn_value Level of continuity for dawn limit, from 0 to 1. With -dawn dawn_value Level of continuity for dawn limit, from 0 to 1. With
a value of 1, the border line between night and day is a value of 1, the border line between night and day is
at maximum contrast. at maximum contrast.
Default : 0.2 Default : 0.2
-bord border_num 0 1 or 2. There are 3 different borders for the icon. -bord border_num 0 1 or 2. There are 3 different borders for the icon.
Default : 0 Default : 0
-accel time_multi Time warp factor. With -accel 24, the sun make a full -accel time_multi Time warp factor. With -accel 24, the sun make a full
rotation in one hour (or the earth, I'm not sure). rotation in one hour (or the earth, I'm not sure).
Default : 1.0 Default : 1.0
@ -183,14 +195,22 @@ Configuration is done through command line options.
Negative values for dates before 1970 accepted. Negative values for dates before 1970 accepted.
Default : not set, use current time. Default : not set, use current time.
-mk latitude long. Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can
use wmglobe to predict when Moon will meet the Sun :-)
-fun dx dy Move the earth image by dx dy pixels in the icon. See -fun dx dy Move the earth image by dx dy pixels in the icon. See
puzzle.sh to understand why. puzzle.sh to understand why.
-oz Start in "austral" mode (for "down under" people) -oz Start in "austral" mode (for "down under" people)
-stable Keep the globe from going over the poles.
-d display Select another display -d display Select another display
-w -shape Useless, since it is set by default (WMaker dockable -w -shape Useless, since it is set by default (WMaker dockable
application) application)
mouse : mouse :
@ -203,13 +223,13 @@ right button Displays 7 screens of parameters. On every screen, just
clic with left or right button on the figures to change clic with left or right button on the figures to change
their value. The TIME screen shows an approximation their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed, of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options real local time by one or two hours. Others options
don't need more help. Intuitive they said... don't need more help. Intuitive they said...
Links : Some sites dealing with WindowMaker
Links : Some sites dealing with WindowMaker
------------------------------------------- -------------------------------------------
Official Window Maker Website : Official Window Maker Website :
@ -223,10 +243,10 @@ http://www.bensinclair.com/dockapp/
Links : Where to find maps and similar softs Links : Where to find maps and similar softs
-------------------------------------------- --------------------------------------------
where to find the sources of wmglobe : where to find the sources of wmglobe :
http://www.capway.com/dumonte1/wm/wmglobe-0.5.tar.gz http://perso.linuxfr.org/jdumont/wmg/wmglobe-1.0.tar.gz
the web page of WMGlobe (made by Sylvestre Taburet) : the web page of WMGlobe (made by Sylvestre Taburet) :
http://www.capway.com/dumonte1/wm/wmg.html http://perso.linuxfr.org/jdumont/wmg/
where to find maps and similar softs : where to find maps and similar softs :
@ -254,7 +274,7 @@ Livingearth Inc. has some nice (day and night) images on their web pages.
With these you can test the -nightmap option of XEarth. Unfortunately With these you can test the -nightmap option of XEarth. Unfortunately
they are pretty low-res (400x200). they are pretty low-res (400x200).
You can find a higher-resolution (but heavily compressed) version of this You can find a higher-resolution (but heavily compressed) version of this
day map at the "Earth View" page: day map at the "Earth View" page:
http://www.fourmilab.ch/cgi-bin/uncgi/Earth http://www.fourmilab.ch/cgi-bin/uncgi/Earth
@ -272,9 +292,11 @@ interesting. It also has a rather high resolution.
Todo Todo
---------------------------------------- ----------------------------------------
- add interface module to allow plugins
- test on different platforms, better makefile - test on different platforms, better makefile
- changing map "on the fly", map generator, clouds generator... - changing map "on the fly", map generator, clouds generator...
- must work on every current WindowMaker platform - must work on every current WindowMaker platform (hug...)
- rewrite some ugly things in the code
- see how to minimize CPU load - see how to minimize CPU load
- feature : load a local detailed map of some part of the globe when zooming - feature : load a local detailed map of some part of the globe when zooming
(country maps, city maps) (country maps, city maps)
@ -284,29 +306,33 @@ Todo
Bugs Bugs
---------------------------------------- ----------------------------------------
- Wmglobe depends on WindowMaker version
- The Makefile - The Makefile
- if you use the --enable-single-icon compile time option of WindowMaker, - if you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe. you can not display more than one WMGlobe.
- WMGlobe hopes that an overflow of a long integer dont generate an error - WMGlobe hopes that an overflow of a long integer dont generate an error
and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
when the date go over year 2038. The expected result is wmglobe when the date go over year 2038. The expected result is wmglobe
continuing smoothly from 1901. continuing smoothly from 1901.
- Using WMGlobe at high speed through a LAN may induce some load on the net.
License License
---------------------------------------- ----------------------------------------
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed
the GNU General Public License. through the GNU General Public License.
Read the COPYING file for the complete GNU license. Read the COPYING file for the complete GNU license.
Credits Credits
---------------------------------------- ----------------------------------------
Original idea, tests, logos : Sylvestre Taburet <staburet@consort.fr> Original idea, tests, logos : Sylvestre Taburet <Sylvestre.Taburet@free.fr>
WindowMaker 0.62 fix : Charles G Waldman <cgw@fnal.gov>
The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson. The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
(Actually, it uses now the 1.1 version of Xearth)
/* /*
* sunpos.c * sunpos.c
@ -335,15 +361,15 @@ The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
The rendering engine is taken from XGlobe by Thorsten Scheuermann The rendering engine is taken from XGlobe by Thorsten Scheuermann
XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe
Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker
<http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team <http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team
Feedback Feedback
---------------------------------------- ----------------------------------------
For your questions, bugs, remarks, please contact our representative on For your questions, bugs, remarks, please contact our representative on
planet Earth : jerome dumonteil <jerome.dumonteil@capway.com> planet Earth : jerome dumonteil <jerome.dumonteil@linuxfr.org>

View file

@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
#just for the fun, solve the puzzle and put it on the clip :) #just for the fun, solve the puzzle and put it on the clip :)
if [ -x ./wmglobe ] if [ -x ./wmglobe ]
then then
WMG="nice ./wmglobe" WMG="nice ./wmglobe"
else else
WMG="nice wmglobe" WMG="nice wmglobe"
fi fi
HOP=" -delay 0.1 -pos -25 10 -dlat 0.5 -dlong -5 -zoom 1.8 -accel 240" HOP=" -bord 0 -delay 0.1 -pos -25 10 -dlat 0.5 -dlong -5 -zoom 1.8 -accel 240 -stable"
$WMG $HOP -fun 32 32 & $WMG $HOP -fun 32 32 &
$WMG $HOP -fun -32 32 & $WMG $HOP -fun -32 32 &
$WMG $HOP -fun 32 -32 & $WMG $HOP -fun 32 -32 &
$WMG $HOP -fun -32 -32 & $WMG $HOP -fun -32 -32 &
$WMG -map ./wmgmap.gif -delay 0.05 -dlong 25 -pos 0 0 -accel 10000& [ -f wmgmap.jpeg ] && $WMG -nimap ./wmgmap.jpeg -delay 0.05 -dlat 2 -dlong -20 -pos 0 -20 -accel 21600 -zoom 0.85 -dawn 0 -stable &

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* WMGlobe 0.5 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* sunpos.c is taken from Xearth : * sunpos.c is taken from Xearth 1.0 (and part of 1.1):
*/ */
/* /*
* sunpos.c * sunpos.c
@ -62,6 +62,7 @@
#define PI 3.141592653 #define PI 3.141592653
#endif #endif
#define TWOPI (2*PI) #define TWOPI (2*PI)
#define DegsToRads(x) ((x)*(TWOPI/360))
/* /*
* the epoch upon which these astronomical calculations are based is * the epoch upon which these astronomical calculations are based is
@ -93,8 +94,8 @@
* Eccentricity (eccentricity of orbit) 0.016713 * Eccentricity (eccentricity of orbit) 0.016713
*/ */
#define Epsilon_g (279.403303*(TWOPI/360)) #define Epsilon_g (DegsToRads(279.403303))
#define OmegaBar_g (282.768422*(TWOPI/360)) #define OmegaBar_g (DegsToRads(282.768422))
#define Eccentricity (0.016713) #define Eccentricity (0.016713)
/* /*
@ -102,7 +103,36 @@
* 1990.0 (computed as 23.440592 degrees according to the method given * 1990.0 (computed as 23.440592 degrees according to the method given
* in duffett-smith, section 27) * in duffett-smith, section 27)
*/ */
#define MeanObliquity (23.440592*(TWOPI/360)) #define MeanObliquity (DegsToRads(23.440592))
/*
* Lunar parameters, epoch January 0, 1990.0 (from Xearth 1.1)
*/
#define MoonMeanLongitude DegsToRads(318.351648)
#define MoonMeanLongitudePerigee DegsToRads( 36.340410)
#define MoonMeanLongitudeNode DegsToRads(318.510107)
#define MoonInclination DegsToRads( 5.145396)
#define SideralMonth (27.3217)
/*
* Force an angular value into the range [-PI, +PI]
*/
#define Normalize(x) \
do { \
if ((x) < -PI) \
do (x) += TWOPI; while ((x) < -PI); \
else if ((x) > PI) \
do (x) -= TWOPI; while ((x) > PI); \
} while (0)
static double solve_keplers_equation(double M);
static double mean_sun(double D);
static double sun_ecliptic_longitude(time_t ssue);
static void ecliptic_to_equatorial(double lambda, double beta,
double *alpha, double *delta);
static double julian_date(int y, int m, int d);
static double GST(time_t ssue);
/* /*
* solve Kepler's equation via Newton's method * solve Kepler's equation via Newton's method
@ -110,20 +140,39 @@
*/ */
static double solve_keplers_equation(double M) static double solve_keplers_equation(double M)
{ {
double E; double E;
double delta; double delta;
E = M; E = M;
while (1) { while (1) {
delta = E - Eccentricity * sin(E) - M; delta = E - Eccentricity * sin(E) - M;
if (fabs(delta) <= 1e-10) if (fabs(delta) <= 1e-10)
break; break;
E -= delta / (1 - Eccentricity * cos(E)); E -= delta / (1 - Eccentricity * cos(E));
} }
return E;
return E;
} }
/*
* Calculate the position of the mean sun: where the sun would
* be if the earth's orbit were circular instead of ellipictal.
*/
static double mean_sun(double D)
/* double D; days since ephemeris epoch */
{
double N, M;
N = RadsPerDay * D;
N = fmod(N, TWOPI);
if (N < 0)
N += TWOPI;
M = N + Epsilon_g - OmegaBar_g;
if (M < 0)
M += TWOPI;
return M;
}
/* /*
* compute ecliptic longitude of sun (in radians) * compute ecliptic longitude of sun (in radians)
@ -132,25 +181,19 @@ static double solve_keplers_equation(double M)
static double sun_ecliptic_longitude(time_t ssue) static double sun_ecliptic_longitude(time_t ssue)
/* seconds since unix epoch */ /* seconds since unix epoch */
{ {
double D, N; double D, N;
double M_sun, E; double M_sun, E;
double v; double v;
D = DaysSinceEpoch(ssue); D = DaysSinceEpoch(ssue);
N = RadsPerDay * D; N = RadsPerDay * D;
N = fmod(N, TWOPI); M_sun = mean_sun(D);
if (N < 0) E = solve_keplers_equation(M_sun);
N += TWOPI; v = 2 * atan(sqrt((1 + Eccentricity) / (1 - Eccentricity)) *
tan(E / 2));
M_sun = N + Epsilon_g - OmegaBar_g; return (v + OmegaBar_g);
if (M_sun < 0)
M_sun += TWOPI;
E = solve_keplers_equation(M_sun);
v = 2 * atan(sqrt((1 + Eccentricity) / (1 - Eccentricity)) * tan(E / 2));
return (v + OmegaBar_g);
} }
@ -158,21 +201,22 @@ static double sun_ecliptic_longitude(time_t ssue)
* convert from ecliptic to equatorial coordinates * convert from ecliptic to equatorial coordinates
* (after duffett-smith, section 27) * (after duffett-smith, section 27)
*/ */
static void ecliptic_to_equatorial(double lambda, double beta, double *alpha, double *delta) static void ecliptic_to_equatorial(double lambda, double beta,
double *alpha, double *delta)
/* /*
* double lambda; ecliptic longitude * double lambda; ecliptic longitude
* double beta; ecliptic latitude * double beta; ecliptic latitude
* double *alpha; (return) right ascension * double *alpha; (return) right ascension
* double *delta; (return) declination * double *delta; (return) declination
*/ */
{ {
double sin_e, cos_e; double sin_e, cos_e;
sin_e = sin(MeanObliquity); sin_e = sin(MeanObliquity);
cos_e = cos(MeanObliquity); cos_e = cos(MeanObliquity);
*alpha = atan2(sin(lambda) * cos_e - tan(beta) * sin_e, cos(lambda)); *alpha = atan2(sin(lambda) * cos_e - tan(beta) * sin_e, cos(lambda));
*delta = asin(sin(beta) * cos_e + cos(beta) * sin_e * sin(lambda)); *delta = asin(sin(beta) * cos_e + cos(beta) * sin_e * sin(lambda));
} }
@ -183,31 +227,31 @@ static void ecliptic_to_equatorial(double lambda, double beta, double *alpha, do
*/ */
static double julian_date(int y, int m, int d) static double julian_date(int y, int m, int d)
/* /*
* int y; year (e.g. 19xx) * int y; year (e.g. 19xx)
* int m; month (jan=1, feb=2, ...) * int m; month (jan=1, feb=2, ...)
* int d; day of month * int d; day of month
*/ */
{ {
int A, B, C, D; int A, B, C, D;
double JD; double JD;
/* lazy test to ensure gregorian calendar */ /* lazy test to ensure gregorian calendar */
/* /*
* ASSERT(y >= 1583); * ASSERT(y >= 1583);
*/ */
if ((m == 1) || (m == 2)) { if ((m == 1) || (m == 2)) {
y -= 1; y -= 1;
m += 12; m += 12;
} }
A = y / 100; A = y / 100;
B = 2 - A + (A / 4); B = 2 - A + (A / 4);
C = (int) (365.25 * y); C = (int) (365.25 * y);
D = (int) (30.6001 * (m + 1)); D = (int) (30.6001 * (m + 1));
JD = B + C + D + d + 1720994.5; JD = B + C + D + d + 1720994.5;
return JD; return JD;
} }
@ -219,30 +263,30 @@ static double julian_date(int y, int m, int d)
static double GST(time_t ssue) static double GST(time_t ssue)
/*time_t ssue; seconds since unix epoch */ /*time_t ssue; seconds since unix epoch */
{ {
double JD; double JD;
double T, T0; double T, T0;
double UT; double UT;
struct tm *tm; struct tm *tm;
tm = gmtime(&ssue); tm = gmtime(&ssue);
JD = julian_date(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday); JD = julian_date(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
T = (JD - 2451545) / 36525; T = (JD - 2451545) / 36525;
T0 = ((T + 2.5862e-5) * T + 2400.051336) * T + 6.697374558; T0 = ((T + 2.5862e-5) * T + 2400.051336) * T + 6.697374558;
T0 = fmod(T0, 24.0); T0 = fmod(T0, 24.0);
if (T0 < 0) if (T0 < 0)
T0 += 24; T0 += 24;
UT = tm->tm_hour + (tm->tm_min + tm->tm_sec / 60.0) / 60.0; UT = tm->tm_hour + (tm->tm_min + tm->tm_sec / 60.0) / 60.0;
T0 += UT * 1.002737909; T0 += UT * 1.002737909;
T0 = fmod(T0, 24.0); T0 = fmod(T0, 24.0);
if (T0 < 0) if (T0 < 0)
T0 += 24; T0 += 24;
return T0; return T0;
} }
@ -251,28 +295,67 @@ static double GST(time_t ssue)
* epoch), compute position on the earth (lat, lon) such that sun is * epoch), compute position on the earth (lat, lon) such that sun is
* directly overhead. * directly overhead.
*/ */
void GetSunPos(time_t ssue, double *lat, double *lon) void sun_position(time_t ssue, double *lat, double *lon)
/* time_t ssue; seconds since unix epoch */ /* time_t ssue; seconds since unix epoch */
/* double *lat; (return) latitude */ /* double *lat; (return) latitude in rad */
/* double *lon; (return) longitude */ /* double *lon; (return) longitude in rad */
{ {
double lambda; double lambda;
double alpha, delta; double alpha, delta;
double tmp; double tmp;
lambda = sun_ecliptic_longitude(ssue); lambda = sun_ecliptic_longitude(ssue);
ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta);
tmp = alpha - (TWOPI / 24) * GST(ssue); tmp = alpha - (TWOPI / 24) * GST(ssue);
if (tmp < -PI) { Normalize(tmp);
do *lon = tmp;
tmp += TWOPI; *lat = delta;
while (tmp < -PI); }
} else if (tmp > PI) {
do /*
tmp -= TWOPI; * given a particular time (expressed in seconds since the unix
while (tmp < -PI); * epoch), compute position on the earth (lat, lon) such that the
} * moon is directly overhead.
*lon = tmp; *
*lat = delta; * Based on duffett-smith **2nd ed** section 61; combines some steps
* into single expressions to reduce the number of extra variables.
*/
void moon_position(time_t ssue, double *lat, double *lon)
/* time_t ssue; seconds since unix epoch */
/* double *lat; (return) latitude in ra */
/* double *lon; (return) longitude in ra */
{
double lambda, beta;
double D, L, Ms, Mm, N, Ev, Ae, Ec, alpha, delta;
D = DaysSinceEpoch(ssue);
lambda = sun_ecliptic_longitude(ssue);
Ms = mean_sun(D);
L = fmod(D / SideralMonth, 1.0) * TWOPI + MoonMeanLongitude;
Normalize(L);
Mm = L - DegsToRads(0.1114041 * D) - MoonMeanLongitudePerigee;
Normalize(Mm);
N = MoonMeanLongitudeNode - DegsToRads(0.0529539 * D);
Normalize(N);
Ev = DegsToRads(1.2739) * sin(2.0 * (L - lambda) - Mm);
Ae = DegsToRads(0.1858) * sin(Ms);
Mm += Ev - Ae - DegsToRads(0.37) * sin(Ms);
Ec = DegsToRads(6.2886) * sin(Mm);
L += Ev + Ec - Ae + DegsToRads(0.214) * sin(2.0 * Mm);
L += DegsToRads(0.6583) * sin(2.0 * (L - lambda));
N -= DegsToRads(0.16) * sin(Ms);
L -= N;
lambda = (fabs(cos(L)) < 1e-12) ?
(N + sin(L) * cos(MoonInclination) * PI / 2) :
(N + atan2(sin(L) * cos(MoonInclination), cos(L)));
Normalize(lambda);
beta = asin(sin(L) * sin(MoonInclination));
ecliptic_to_equatorial(lambda, beta, &alpha, &delta);
alpha -= (TWOPI / 24) * GST(ssue);
Normalize(alpha);
*lon = alpha;
*lat = delta;
} }

View file

@ -1,27 +1,27 @@
/* WMGlobe 0.5 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* /*
* I used many functions of wmgeneral.c ("openXwindow") * I used many functions of wmgeneral.c ("openXwindow")
* for the main function of wmglobe.c * for the main function of wmglobe.c
* wmgeneral.c was taken from wmaker applet wmtune-1.0 : * wmgeneral.c was taken from wmaker applet wmtune-1.0 :
* Author: Martijn Pieterse (pieterse@xs4all.nl) * Author: Martijn Pieterse (pieterse@xs4all.nl)
* *
* wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib * wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
***************************************************************************/ ***************************************************************************/
#include "wmglobe.h" #include "wmglobe.h"
@ -35,353 +35,398 @@
#include "defnimap.xpm" #include "defnimap.xpm"
#endif #endif
/***************************************************************************/
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
unsigned int borderwidth = 1; unsigned int borderwidth = 1;
XClassHint classHint; XClassHint classHint;
char *wname = argv[0]; char *wname = argv[0];
XTextProperty name; XTextProperty name;
XGCValues gcv; XGCValues gcv;
unsigned long gcm; unsigned long gcm;
XWindowAttributes attributes; XWindowAttributes attributes;
XColor color; XColor color;
RContext *ctx; RContext *ctx;
XSizeHints mysizehints; XSizeHints mysizehints;
XWMHints mywmhints; XWMHints mywmhints;
Pixel back_pix, fore_pix; Pixel back_pix, fore_pix;
char Geometry[256]; char Geometry[256];
char *rond_bits; char *rond_bits;
int dummy = 0; int dummy = 0;
int ok, redoaction, wait_release, move_lat_flag; int ok, redoaction, wait_release, move_lat_flag;
int xx, yy; int xx, yy;
/** initialisation *********************/ /** initialisation *********************/
xx = 0; xx = 0;
yy = 0; yy = 0;
ok = FALSE; ok = FALSE;
move_lat_flag = FALSE; move_lat_flag = FALSE;
redoaction = 0; redoaction = 0;
wait_release = 0; wait_release = 0;
setlocale(LC_TIME, ""); setlocale(LC_TIME, "");
#ifdef DEBUG #ifdef DEBUG
fprintf(stdout, "%s\n", setlocale(LC_TIME, "")); fprintf(stdout, "%s\n", setlocale(LC_TIME, ""));
#endif #endif
set_defaults(); set_defaults();
cmdline(argc, argv); cmdline(argc, argv);
switch (typecadre) { #if WITH_MARKERS
case 1: if (nb_marker) {
rond_bits = cadre1_bits; int i;
break; for (i = 0; i < nb_marker; i++)
case 2: if (i != moon_marker && i != sun_marker) {
rond_bits = cadre2_bits; marker[i][0] = marker[i][0] * PI / 180.;
break; marker[i][1] = marker[i][1] * PI / 180.;
default: transform_marker(i);
rond_bits = cadre0_bits; }
} }
if (p_type == PTRANDOM) {
dlat = 0;
dlong = 0;
}
initmyconvert();
tdelay.tv_sec = (int) floor(delay);
tdelay.tv_usec = (int) ((delay - tdelay.tv_sec) * 1000000);
aml = (int) floor(ambient_light * 256);
/****************************************************************************/
if (!(dpy = XOpenDisplay(dpy_name))) {
fprintf(stderr, "%s: can't open display \"%s\"\n",
wname, XDisplayName(dpy_name));
exit(1);
}
ctx = myRCreateContext(dpy, DefaultScreen(dpy), NULL);
if (ctx->attribs->use_shared_memory) {
#ifdef DEBUG
fprintf(stdout, "enleve les flags use_shared_memory\n");
#endif #endif
ctx->attribs->flags ^= RC_UseSharedMemory;
ctx->attribs->use_shared_memory = FALSE; switch (typecadre) {
ctx->flags.use_shared_pixmap = 0; case 1:
} rond_bits = cadre1_bits;
break;
case 2:
rond_bits = cadre2_bits;
break;
default:
rond_bits = cadre0_bits;
}
if (p_type == PTRANDOM) {
dlat = 0;
dlong = 0;
}
/* setup long term mem allocation */
initmyconvert();
tdelay.tv_sec = (int) floor(delay);
tdelay.tv_usec = (int) ((delay - tdelay.tv_sec) * 1000000);
aml = (int) floor(ambient_light * 256);
/* ctx initialization */
if (!(dpy = XOpenDisplay(dpy_name))) {
fprintf(stderr, "%s: can't open display \"%s\"\n",
wname, XDisplayName(dpy_name));
exit(1);
}
ctx = myRCreateContext(dpy, DefaultScreen(dpy), NULL);
if (ctx->attribs->use_shared_memory) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stdout, "depth %d\n", ctx->depth); fprintf(stdout, "remove flags use_shared_memory\n");
fflush(stdout); #endif
ctx->attribs->flags ^= RC_UseSharedMemory;
ctx->attribs->use_shared_memory = FALSE;
ctx->flags.use_shared_pixmap = 0;
}
#ifdef DEBUG
fprintf(stdout, "depth %d\n", ctx->depth);
fflush(stdout);
#endif #endif
/* /*
* loading maps ............. * loading maps .............
*
*/ */
if (dayfile != NULL) { if (dayfile != NULL) {
map = RLoadImage(ctx, dayfile, 0); map = RLoadImage(ctx, dayfile, 0);
if (!map) { if (!use_default_nightmap)
fprintf(stdout, "pb map ! file not found ?\n"); use_nightmap = FALSE;
exit(1); ripalpha(map);
} if (!map) {
fprintf(stdout, "pb map ! file not found ?\n");
exit(1);
}
} else {
#ifdef DEFMAPOK
map = RGetImageFromXPMData(ctx, defmap_xpm);
use_default_nightmap = TRUE;
ripalpha(map);
if (!map) {
fprintf(stdout, "pb def map ! file not found ?\n");
exit(1);
}
}
#else
fprintf(stdout, "need a map !\n");
exit(1);
}
#endif
if (!oknimap) {
use_nightmap = FALSE;
use_default_nightmap = FALSE;
}
if (use_nightmap) {
if (nightfile != NULL) {
mapnight = RLoadImage(ctx, nightfile, 0);
ripalpha(mapnight);
if (!mapnight) {
fprintf(stdout, "pb map night! file not found ?\n");
exit(1);
}
} else { } else {
#ifdef DEFMAPOK #ifdef DEFMAPOK
map = RGetImageFromXPMData(ctx, defmap_xpm); if (use_default_nightmap) {
if (!map) { mapnight = RGetImageFromXPMData(ctx, defnimap_xpm);
fprintf(stdout, "pb def map ! file not found ?\n"); ripalpha(mapnight);
exit(1); if (!mapnight) {
fprintf(stdout,
"pb def map night ! file not found ?\n");
exit(1);
} }
nightfile = NULL; }
use_nightmap = TRUE;
} }
#else #else
fprintf(stdout, "need a map !\n"); use_nightmap = FALSE;
exit(1);
} }
#endif #endif
}
if (use_nightmap) { use_nmap_ini = use_nightmap;
if (nightfile != NULL) {
mapnight = RLoadImage(ctx, nightfile, 0); /* we need a night map of same size as day map */
if (!mapnight) { if (mapnight) {
fprintf(stdout, "pb map night! file not found ?\n"); if ((mapnight->width != map->width)
exit(1); || (mapnight->height != map->height)) {
} RImage *tmp;
} else { tmp = mapnight;
#ifdef DEFMAPOK mapnight = RScaleImage(tmp, map->width, map->height);
mapnight = RGetImageFromXPMData(ctx, defnimap_xpm); RReleaseImage(tmp);
if (!mapnight) { ripalpha(mapnight);
fprintf(stdout, "pb def map night ! file not found ?\n");
exit(1);
}
}
#else
/* not very useful... */
use_nightmap = FALSE;
}
#endif
} }
use_nmap_ini = use_nightmap; }
if (!oknimap)
use_nightmap = FALSE;
/* some other init ..................................... */ /* some other init ..................................... */
ratiox = (double) map->width / (2 * PI); ratiox = (double) map->width / (2 * PI);
ratioy = (double) map->height / PI; ratioy = (double) map->height / PI;
mratiox = (int) floor(ratiox * 256); mratiox = (int) floor(ratiox * 256);
mratioy = (int) floor(ratioy * 256); mratioy = (int) floor(ratioy * 256);
loadxpm(ctx->drawable); loadxpm(ctx->drawable);
small = RCreateImage(DIAMETRE, DIAMETRE, 1); small = RCreateImage(DIAMETRE, DIAMETRE, 0);
calcDistance(); calcDistance();
/*...................................................... */
/* /*
* first rendering of the earth * first rendering of the earth
*/ */
recalc(0); rotation_terre(DIAMETRE / 2, DIAMETRE / 2, 0);
do_something = FALSE; recalc(0);
do_something = FALSE;
/************************************************************************* /*************************************************************************
* well, here the problems begin : this code is a merge from wmgeneral and * well, here the problems begin : this code is a merge from wmgeneral and
* some stuff of wmaker, should be rewritten ... * some stuff of wmaker, should be rewritten ...
************************************************************************/ ************************************************************************/
/* wmg */ XGetWindowAttributes(dpy, ctx->drawable, &attributes);
XGetWindowAttributes(dpy, ctx->drawable, &attributes); if (!RConvertImage(ctx, small, &pix)) {
fprintf(stdout, "error small->&pix\n");
puts(RMessageForError(RErrorCode));
exit(1);
}
wmg.pixmap = pix;
wmg.mask = pix;
if (!RConvertImage(ctx, small, &pix)) { mysizehints.flags = USSize | USPosition;
fprintf(stdout, "error small->&pix\n"); mysizehints.x = 0;
puts(RMessageForError(RErrorCode)); mysizehints.y = 0;
exit(1);
}
wmg.pixmap = pix;
wmg.mask = pix;
mysizehints.flags = USSize | USPosition; color.pixel = 0;
mysizehints.x = 0; if (!XParseColor(dpy, attributes.colormap, "white", &color)) {
mysizehints.y = 0; fprintf(stdout, "wmglobe: can't parse white\n");
} else if (!XAllocColor(dpy, attributes.colormap, &color)) {
fprintf(stdout, "wmglobe: can't allocate white\n");
}
back_pix = color.pixel;
color.pixel = 0; XGetWindowAttributes(dpy, ctx->drawable, &attributes);
if (!XParseColor(dpy, attributes.colormap, "white", &color)) {
fprintf(stdout, "wmglobe: can't parse white\n");
} else if (!XAllocColor(dpy, attributes.colormap, &color)) {
fprintf(stdout, "wmglobe: can't allocate white\n");
}
back_pix = color.pixel;
XGetWindowAttributes(dpy, ctx->drawable, &attributes); color.pixel = 0;
if (!XParseColor(dpy, attributes.colormap, "black", &color)) {
color.pixel = 0; fprintf(stdout, "wmglobe: can't parse black\n");
if (!XParseColor(dpy, attributes.colormap, "black", &color)) { } else if (!XAllocColor(dpy, attributes.colormap, &color)) {
fprintf(stdout, "wmglobe: can't parse black\n"); fprintf(stdout, "wmglobe: can't allocate black\n");
} else if (!XAllocColor(dpy, attributes.colormap, &color)) { }
fprintf(stdout, "wmglobe: can't allocate black\n"); fore_pix = color.pixel;
}
fore_pix = color.pixel;
XWMGeometry(dpy, ctx->screen_number, Geometry, NULL, borderwidth, &mysizehints, XWMGeometry(dpy, ctx->screen_number, Geometry, NULL, borderwidth,
&mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.height, &dummy); &mysizehints, &mysizehints.x, &mysizehints.y,
mysizehints.width = DIAMETRE; &mysizehints.width, &mysizehints.height, &dummy);
mysizehints.height = DIAMETRE; mysizehints.width = DIAMETRE;
mysizehints.height = DIAMETRE;
win = XCreateSimpleWindow(dpy, ctx->drawable, mysizehints.x, mysizehints.y, win =
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); XCreateSimpleWindow(dpy, ctx->drawable, mysizehints.x,
mysizehints.y, mysizehints.width,
mysizehints.height, borderwidth, fore_pix,
back_pix);
iconwin = XCreateSimpleWindow(dpy, win, mysizehints.x, mysizehints.y, iconwin = XCreateSimpleWindow(dpy, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); mysizehints.width, mysizehints.height,
borderwidth, fore_pix, back_pix);
/* Activate hints */ /* Activate hints */
XSetWMNormalHints(dpy, win, &mysizehints); XSetWMNormalHints(dpy, win, &mysizehints);
classHint.res_name = wname; classHint.res_name = wname;
classHint.res_class = wname; classHint.res_class = wname;
XSetClassHint(dpy, win, &classHint); XSetClassHint(dpy, win, &classHint);
XSelectInput(dpy, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); XSelectInput(dpy, win,
XSelectInput(dpy, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); ButtonPressMask | ExposureMask | ButtonReleaseMask |
PointerMotionMask | StructureNotifyMask);
XSelectInput(dpy, iconwin,
ButtonPressMask | ExposureMask | ButtonReleaseMask |
PointerMotionMask | StructureNotifyMask);
if (XStringListToTextProperty(&wname, 1, &name) == 0) { if (XStringListToTextProperty(&wname, 1, &name) == 0) {
fprintf(stdout, "%s: can't allocate window name\n", wname); fprintf(stdout, "%s: can't allocate window name\n", wname);
exit(1); exit(1);
} }
XSetWMName(dpy, win, &name); XSetWMName(dpy, win, &name);
/* Create GC for drawing */ /* Create GC for drawing */
gcm = GCForeground | GCBackground | GCGraphicsExposures; gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix; gcv.foreground = fore_pix;
gcv.background = back_pix; gcv.background = back_pix;
gcv.graphics_exposures = 0; gcv.graphics_exposures = 0;
NormalGC = XCreateGC(dpy, ctx->drawable, gcm, &gcv); NormalGC = XCreateGC(dpy, ctx->drawable, gcm, &gcv);
/* ONLYSHAPE ON */ /* ONLYSHAPE ON */
if (onlyshape) { if (onlyshape) {
pixmask = XCreateBitmapFromData(dpy, win, rond_bits, DIAMETRE, DIAMETRE); pixmask =
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask, ShapeSet); XCreateBitmapFromData(dpy, win, rond_bits, DIAMETRE, DIAMETRE);
XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask,
} ShapeSet);
/* ONLYSHAPE OFF */ XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask,
ShapeSet);
}
/* ONLYSHAPE OFF */
mywmhints.initial_state = option_iw; mywmhints.initial_state = option_iw;
mywmhints.icon_window = iconwin; mywmhints.icon_window = iconwin;
mywmhints.icon_x = mysizehints.x; mywmhints.icon_x = mysizehints.x;
mywmhints.icon_y = mysizehints.y; mywmhints.icon_y = mysizehints.y;
mywmhints.window_group = win; mywmhints.window_group = win;
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; mywmhints.flags =
StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
XSetWMHints(dpy, win, &mywmhints); XSetWMHints(dpy, win, &mywmhints);
XSetCommand(dpy, win, argv, argc); XSetCommand(dpy, win, argv, argc);
XMapWindow(dpy, win); XMapWindow(dpy, win);
/****************************************************************************/
XCopyArea(dpy, wmg.pixmap, win, NormalGC, 0, 0, DIAMETRE, DIAMETRE, 0, 0); XCopyArea(dpy, wmg.pixmap, win, NormalGC, 0, 0, DIAMETRE, DIAMETRE, 0,
0);
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
/* /*
* ================= MAIN LOOP ================== * ================= MAIN LOOP ==================
*/ */
while (1) { while (1) {
while (XPending(dpy)) { while (XPending(dpy)) {
XNextEvent(dpy, &Event); XNextEvent(dpy, &Event);
switch (Event.type) { switch (Event.type) {
case Expose: case Expose:
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE); RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
break; break;
case DestroyNotify: case DestroyNotify:
XCloseDisplay(dpy); XCloseDisplay(dpy);
exit(0); exit(0);
break; break;
case ButtonPress: case ButtonPress:
/* /*
* earth rotate when clic left (1) , zooming when middle (2) * earth rotate when clic left (1) , zooming when middle (2)
* change screen to longitude / latitude when (3) * change screen to longitude / latitude when (3)
*/ */
switch (Event.xbutton.button) { switch (Event.xbutton.button) {
case 1: case 1:
#ifdef MOUSE_LAT_NO_SHIFT #ifdef MOUSE_LAT_NO_SHIFT
move_lat_flag = TRUE; move_lat_flag = TRUE;
#else #else
if (Event.xbutton.state & ShiftMask) if (Event.xbutton.state & ShiftMask)
move_lat_flag = TRUE; move_lat_flag = TRUE;
else else
move_lat_flag = FALSE; move_lat_flag = FALSE;
#endif #endif
redoaction = 1; redoaction = 1;
wait_release = 1; wait_release = 1;
break; break;
case 2: case 2:
if (Event.xbutton.state & ShiftMask) if (Event.xbutton.state & ShiftMask)
redoaction = 2; redoaction = 2;
else else
redoaction = 3; redoaction = 3;
wait_release = 1; wait_release = 1;
break; break;
case 3: case 3:
wait_release = 0; wait_release = 0;
redoaction = 0; redoaction = 0;
screen_back(); screen_back();
ok = TRUE; ok = TRUE;
break; break;
default: default:
break; break;
}
break;
case ButtonRelease:
wait_release = 0;
redoaction = 0;
break;
default:
break;
}
} }
if (wait_release) { break;
usleep(2 * VAL_USLEEP_SHORT); case ButtonRelease:
if (redoaction == 1) wait_release = 0;
rotation_terre(Event.xbutton.x, Event.xbutton.y, move_lat_flag); redoaction = 0;
else break;
zooming(Event.xbutton.state & ShiftMask); default:
ok = TRUE; break;
} }
if (diftimev(tnext, getimev()).tv_sec < 0 || ok) {
ok = FALSE;
recalc(redoaction == 1);
if (do_something) {
if (!myRConvertImage(ctx, small, &pix)) {
fprintf(stdout, "plante !?\n");
fprintf(stdout, RMessageForError(RErrorCode));
exit(1);
}
wmg.pixmap = pix;
wmg.mask = pix;
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
#ifdef DEBUG
fprintf(stdout, "draw\n");
#endif
do_something = FALSE;
}
}
usleep(VAL_USLEEP);
} }
/* if (wait_release) {
* Still wonder about freeing some memory for X usleep(2 * VAL_USLEEP_SHORT);
*/ if (redoaction == 1)
return 0; rotation_terre(Event.xbutton.x, Event.xbutton.y,
move_lat_flag);
else
zooming(Event.xbutton.state & ShiftMask);
ok = TRUE;
}
if (diftimev(tnext, getimev()).tv_sec < 0 || ok) {
ok = FALSE;
recalc(redoaction == 1);
if (do_something) {
if (!myRConvertImage(ctx, small, &pix)) {
fprintf(stderr, "crash !?\n");
fprintf(stderr, RMessageForError(RErrorCode));
exit(1);
}
wmg.pixmap = pix;
wmg.mask = pix;
RedrawWindowXYWH(0, 0, DIAMETRE, DIAMETRE);
#ifdef DEBUG
fprintf(stdout, "draw\n");
#endif
do_something = FALSE;
}
}
usleep(VAL_USLEEP);
}
return 0;
} }

View file

@ -1,21 +1,21 @@
/* WMGlobe 0.5 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib /* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
***************************************************************************/ ***************************************************************************/
@ -51,13 +51,15 @@
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
#define MAX(x, y) ((x) < (y) ? (y) : (x)) #define STRONG 2
#define MIN(x, y) ((x) > (y) ? (y) : (x)) #define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABS(a) ((a) < 0 ? -(a) : (a))
#define PTFIXED 1 #define PTFIXED 1
#define PTSUNREL 2 #define PTSUN 2
#define PTRANDOM 3 #define PTRANDOM 3
#define PTMOON 4
#ifndef PI #ifndef PI
#define PI 3.141592653 #define PI 3.141592653
@ -74,34 +76,31 @@
#define MAX_MOUSE_REGION (8) #define MAX_MOUSE_REGION (8)
typedef struct { typedef struct {
int enable; int enable;
int top; int top;
int bottom; int bottom;
int left; int left;
int right; int right;
} MOUSE_REGION; } MOUSE_REGION;
MOUSE_REGION mouse_region[MAX_MOUSE_REGION]; MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
typedef struct MPO { typedef struct MPO {
int r, g, b; int r, g, b;
} MPO; } MPO;
MPO *md[4], *mn[4]; MPO *md[4], *mn[4];
double soluce[DIAMETRE / 2][DIAMETRE][4]; double solu[DIAMETRE][DIAMETRE][3];
int tabsolu[DIAMETRE][DIAMETRE];
int solution; int solution;
/************/
typedef struct { typedef struct {
Pixmap pixmap; Pixmap pixmap;
Pixmap mask; Pixmap mask;
XpmAttributes attributes; XpmAttributes attributes;
} XpmIcon; } XpmIcon;
/************/
Display *dpy; Display *dpy;
@ -121,11 +120,18 @@ GC NormalGC;
/********* rendering********/ /********* rendering********/
#if WITH_MARKERS
double marker[MAX_MARKERS][3];
int nb_marker, sun_marker, moon_marker;
RColor sun_col, moon_col;
double moon_lat,moon_long;
#endif
double delay, time_multi; double delay, time_multi;
/* /*
* struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim, * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
* vec_tim; * vec_tim;
* *
* time_t beg_time, ini_time,t1901; * time_t beg_time, ini_time,t1901;
*/ */
struct timeval tlast, tnext, trend, tdelay, tini, tbase; struct timeval tlast, tnext, trend, tdelay, tini, tbase;
@ -133,8 +139,8 @@ time_t tsunpos;
int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr; int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
int typecadre, p_type, use_nightmap, use_nmap_ini, firstTime, stoprand, int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini,
do_something, iop; firstTime, stoprand, do_something, iop;
double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long; double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn; double dlat, dlong, addlat, addlong, ratiox, ratioy, dawn;
@ -161,11 +167,14 @@ RColor noir;
double minhz; double minhz;
#endif #endif
int stable;
/****************************************************************/ /****************************************************************/
/* Function Prototypes */ /* Function Prototypes */
/****************************************************************/ /****************************************************************/
int main(int argc, char *argv[]); int main(int argc, char *argv[]);
/****************************************************************/
void AddMouseRegion(int index, int left, int top, int right, int bottom); void AddMouseRegion(int index, int left, int top, int right, int bottom);
int CheckMouseRegion(int x, int y); int CheckMouseRegion(int x, int y);
void RedrawWindowXYWH(int x, int y, int w, int h); void RedrawWindowXYWH(int x, int y, int w, int h);
@ -179,19 +188,24 @@ struct timeval diftimev(struct timeval t1, struct timeval t2);
struct timeval addtimev(struct timeval t1, struct timeval t2); struct timeval addtimev(struct timeval t1, struct timeval t2);
struct timeval getimev(); struct timeval getimev();
/***************************************************************/
void setZoom(double z); void setZoom(double z);
void calcDistance(); void calcDistance();
void renderFrame(); void renderFrame();
void initmyconvert(); void initmyconvert();
int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap); int myRConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
RContext *myRCreateContext RContext *myRCreateContext
(Display * dpy, int screen_number, RContextAttributes * attribs); (Display * dpy, int screen_number, RContextAttributes * attribs);
void setTime(struct timeval t); void setTime(struct timeval t);
void recalc(int calme); void recalc(int calme);
void GetSunPos(time_t ssue, double *lat, double *lon); void sun_position(time_t ssue, double *lat, double *lon);
void moon_position(time_t ssue, double *lat, double *lon);
void transform_marker(int m);
void setViewPos(double lat, double lon); void setViewPos(double lat, double lon);
int ripalpha(RImage * image);
/***************************************************************/ RImage*
RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
void
RReleaseImage(RImage *image);
#endif #endif

View file

@ -1,16 +1,16 @@
/* WMGlobe 0.5 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -20,7 +20,7 @@
* #define DEBUG * #define DEBUG
*/ */
#define WMGVERSION "WMGlobe v.0.5 6 fev 1999 <jerome.dumonteil@capway.com>" #define WMGVERSION "WMGlobe v.1.3 12 aug 2001 <jerome.dumonteil@linuxfr.org>"
/* /*
* comment DEFMAPOK to not install the built-in default maps, * comment DEFMAPOK to not install the built-in default maps,
@ -64,14 +64,27 @@
#define STOP_RANDOM_FACTOR 1 #define STOP_RANDOM_FACTOR 1
#define RATIO_ROTATE 0.5 #define RATIO_ROTATE 0.5
/* Markers */
#define WITH_MARKERS 1 /* put to 0 to remove markers code */
#define CROSS_LENGTH 8 /* min 2 */
#define CROSS_INVERT 0 /* 0: black/white, 1: inv. color */
#define MAX_MARKERS 5
#define CR_SUN_R 255 /* sun cross color */
#define CR_SUN_G 255
#define CR_SUN_B 127
#define CR_MOON_R 0 /* moon cross color */
#define CR_MOON_G 200
#define CR_MOON_B 255
/* some default values*/
#define DEFAULT_DELAY 1.0 #define DEFAULT_DELAY 1.0
#define DEFAULT_V_LAT 0.0 #define DEFAULT_V_LAT 0.0
#define DEFAULT_V_LONG 0.0 #define DEFAULT_V_LONG 0.0
#define DEFAULT_SENS 1 #define DEFAULT_SENS 1
#define DEFAULT_ZOOM 1.0 #define DEFAULT_ZOOM 1.0
#define DEFAULT_LIGHT 0.25 #define DEFAULT_LIGHT 0.25
#define DEFAULT_BORDER 0 #define DEFAULT_BORDER 2
#define DEFAULT_NIGHTMAP 1 /* 1 or 0 */ #define DEFAULT_NIGHTMAP 1 /* 1 or 0 */
#define MAX_DELAY_SEC 86400.0 #define MAX_DELAY_SEC 86400.0
@ -82,6 +95,6 @@
#define DEFAULT_DAWN 0.9 #define DEFAULT_DAWN 0.9
/* change this if not 64x64 icons (not deep tested) you will need to change /* change this if not 64x64 icons (not deep tested) you will need to change
the cadrex.xbm too and a few other things for the parameters menus the cadrex.xbm too and a few other things for the parameters menus
--- DIAMETRE must be a multiple of 2 --- */ --- DIAMETRE must be a multiple of 2 --- */
#define DIAMETRE 64 #define DIAMETRE 64

File diff suppressed because it is too large Load diff

View file

@ -1,398 +0,0 @@
/*
* Raster graphics library
*
* Copyright (c) 1997, 1998 Alfredo K. Kojima
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Environment variables:
*
* WRASTER_GAMMA <rgamma>/<ggamma>/<bgamma>
* gamma correction value. Must be greater than 0
* Only for PseudoColor visuals.
*
* Default:
* WRASTER_GAMMA 1/1/1
*
*
* If you want a specific value for a screen, append the screen number
* preceded by a hash to the variable name as in
* WRASTER_GAMMA#1
* for screen number 1
*/
#ifndef RLRASTER_H_
#define RLRASTER_H_
/* version of the header for the library: 0.11 */
#define WRASTER_HEADER_VERSION 11
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef XSHM
#include <X11/extensions/XShm.h>
#endif
/* RM_MATCH or RM_DITHER */
#define RC_RenderMode (1<<0)
/* number of colors per channel for colormap in PseudoColor mode */
#define RC_ColorsPerChannel (1<<1)
/* do gamma correction */
#define RC_GammaCorrection (1<<2)
/* visual id to use */
#define RC_VisualID (1<<3)
/* shared memory usage */
#define RC_UseSharedMemory (1<<4)
/* use default instead of best visual */
#define RC_DefaultVisual (1<<5)
typedef struct RContextAttributes {
int flags;
int render_mode;
int colors_per_channel; /* for PseudoColor */
float rgamma; /* gamma correction for red, */
float ggamma; /* green, */
float bgamma; /* and blue */
VisualID visualid; /* visual ID to use */
int use_shared_memory; /* True of False */
} RContextAttributes;
/*
* describes a screen in terms of depth, visual, number of colors
* we can use, if we should do dithering, and what colors to use for
* dithering.
*/
typedef struct RContext {
Display *dpy;
int screen_number;
Colormap cmap;
RContextAttributes *attribs;
GC copy_gc;
Visual *visual;
int depth;
Window drawable; /* window to pass for XCreatePixmap(). */
/* generally = root */
int vclass;
unsigned long black;
unsigned long white;
int red_offset; /* only used in 24bpp */
int green_offset;
int blue_offset;
/* only used for pseudocolor and grayscale */
XStandardColormap *std_rgb_map; /* standard RGB colormap */
XStandardColormap *std_gray_map; /* standard grayscale colormap */
int ncolors; /* total number of colors we can use */
XColor *colors; /* internal colormap */
struct {
unsigned int use_shared_pixmap:1;
} flags;
} RContext;
typedef struct RColor {
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
} RColor;
typedef struct RHSVColor {
unsigned short hue; /* 0-359 */
unsigned char saturation; /* 0-255 */
unsigned char value; /* 0-255 */
} RHSVColor;
typedef struct RPoint {
int x, y;
} RPoint;
typedef struct RSegment {
int x1, y1, x2, y2;
} RSegment;
/*
* internal 24bit+alpha image representation
*/
typedef struct RImage {
unsigned width, height; /* size of the image */
RColor background; /* background color */
unsigned char *data[4]; /* image data (R,G,B,A) */
} RImage;
/*
* internal wrapper for XImage. Used for shm abstraction
*/
typedef struct RXImage {
XImage *image;
/* Private data. Do not access */
#ifdef XSHM
XShmSegmentInfo info;
char is_shared;
#endif
} RXImage;
/* note that not all operations are supported in all functions */
enum {
RClearOperation, /* clear with 0 */
RCopyOperation,
RNormalOperation, /* same as combine */
RAddOperation,
RSubtractOperation
};
/* image display modes */
enum {
RDitheredRendering = 0,
RBestMatchRendering = 1
};
/* bw compat */
#define RM_DITHER RDitheredRendering
#define RM_MATCH RBestMatchRendering
enum {
RAbsoluteCoordinates = 0,
RRelativeCoordinates = 1
};
enum {
RSunkenBevel = -1,
RRaisedBevel = 1
};
/* bw compat */
#define RBEV_SUNKEN RSunkenBevel
/* 1 pixel wide */
#define RBEV_RAISED RRaisedBevel
/* 1 pixel wide on top/left 2 on bottom/right */
#define RBEV_RAISED2 2
/* 2 pixel width */
#define RBEV_RAISED3 3
enum {
RHorizontalGradient = 2,
RVerticalGradient = 3,
RDiagonalGradient = 4
};
/* for backwards compatibility */
#define RGRD_HORIZONTAL RHorizontalGradient
#define RGRD_VERTICAL RVerticalGradient
#define RGRD_DIAGONAL RDiagonalGradient
/* error codes */
#define RERR_NONE 0
#define RERR_OPEN 1 /* cant open file */
#define RERR_READ 2 /* error reading from file */
#define RERR_WRITE 3 /* error writing to file */
#define RERR_NOMEMORY 4 /* out of memory */
#define RERR_NOCOLOR 5 /* out of color cells */
#define RERR_BADIMAGEFILE 6 /* image file is corrupted or invalid */
#define RERR_BADFORMAT 7 /* image file format is unknown */
#define RERR_BADINDEX 8 /* no such image index in file */
#define RERR_BADVISUALID 16 /* invalid visual ID requested for context */
#define RERR_XERROR 127 /* internal X error */
#define RERR_INTERNAL 128 /* should not happen */
/*
* Returns a NULL terminated array of strings containing the
* supported formats, such as: TIFF, XPM, PNG, JPEG, PPM, GIF
*/
char **RSupportedFileFormats(void);
void RFreeStringList(char **list);
/*
* Xlib contexts
*/
RContext *RCreateContext(Display * dpy, int screen_number,
RContextAttributes * attribs);
void RDestroyContext(RContext * context);
Bool RGetClosestXColor(RContext * context, RColor * color, XColor * retColor);
/*
* RImage creation
*/
RImage *RCreateImage(unsigned width, unsigned height, int alpha);
RImage *RCreateImageFromXImage(RContext * context, XImage * image, XImage * mask);
RImage *RCreateImageFromDrawable(RContext * context, Drawable drawable,
Pixmap mask);
RImage *RLoadImage(RContext * context, char *file, int index);
void RDestroyImage(RImage * image);
RImage *RGetImageFromXPMData(RContext * context, char **data);
/*
* RImage storing
*/
Bool RSaveImage(RImage * image, char *filename, char *format);
/*
* Area manipulation
*/
RImage *RCloneImage(RImage * image);
RImage *RGetSubImage(RImage * image, int x, int y, unsigned width,
unsigned height);
void RCombineImageWithColor(RImage * image, RColor * color);
void RCombineImages(RImage * image, RImage * src);
void RCombineArea(RImage * image, RImage * src, int sx, int sy, unsigned width,
unsigned height, int dx, int dy);
void RCombineImagesWithOpaqueness(RImage * image, RImage * src, int opaqueness);
void RCombineAreaWithOpaqueness(RImage * image, RImage * src, int sx, int sy,
unsigned width, unsigned height, int dx, int dy,
int opaqueness);
RImage *RScaleImage(RImage * image, unsigned new_width, unsigned new_height);
RImage *RMakeTiledImage(RImage * tile, unsigned width, unsigned height);
RImage *RMakeCenteredImage(RImage * image, unsigned width, unsigned height,
RColor * color);
/*
* Drawing
*/
Bool RGetPixel(RImage * image, int x, int y, RColor * color);
void RPutPixel(RImage * image, int x, int y, RColor * color);
void ROperatePixel(RImage * image, int operation, int x, int y, RColor * color);
void RPutPixels(RImage * image, RPoint * points, int npoints, int mode,
RColor * color);
void ROperatePixels(RImage * image, int operation, RPoint * points,
int npoints, int mode, RColor * color);
int RDrawLine(RImage * image, int x0, int y0, int x1, int y1, RColor * color);
int ROperateLine(RImage * image, int operation, int x0, int y0, int x1, int y1,
RColor * color);
void RDrawLines(RImage * image, RPoint * points, int npoints, int mode,
RColor * color);
void ROperateLines(RImage * image, int operation, RPoint * points, int npoints,
int mode, RColor * color);
void RDrawSegments(RImage * image, RSegment * segs, int nsegs, RColor * color);
void ROperateSegments(RImage * image, int operation, RSegment * segs, int nsegs,
RColor * color);
/*
* Color convertion
*/
void RRGBtoHSV(RColor * color, RHSVColor * hsv);
void RHSVtoRGB(RHSVColor * hsv, RColor * rgb);
/*
* Painting
*/
void RClearImage(RImage * image, RColor * color);
void RBevelImage(RImage * image, int bevel_type);
RImage *RRenderGradient(unsigned width, unsigned height, RColor * from,
RColor * to, int style);
RImage *RRenderMultiGradient(unsigned width, unsigned height, RColor ** colors,
int style);
/*
* Convertion into X Pixmaps
*/
int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap);
int RConvertImageMask(RContext * context, RImage * image, Pixmap * pixmap,
Pixmap * mask, int threshold);
/*
* misc. utilities
*/
RXImage *RCreateXImage(RContext * context, int depth,
unsigned width, unsigned height);
void RDestroyXImage(RContext * context, RXImage * ximage);
void RPutXImage(RContext * context, Drawable d, GC gc, RXImage * ximage,
int src_x, int src_y, int dest_x, int dest_y,
unsigned width, unsigned height);
/* do not free the returned string! */
const char *RMessageForError(int errorCode);
int RBlurImage(RImage * image);
/****** Global Variables *******/
extern int RErrorCode;
#endif

View file

@ -1,37 +1,36 @@
/* WMGlobe 0.5.pre1 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99 Jerome Dumonteil <jerome.dumonteil@capway.com> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
int zapnum[14][4] = int zapnum[14][4] = {
{ {90, 0, 10, 13},
{90, 0, 10, 13}, {0, 0, 10, 13},
{0, 0, 10, 13}, {10, 0, 10, 13},
{10, 0, 10, 13}, {20, 0, 10, 13},
{20, 0, 10, 13}, {30, 0, 10, 13},
{30, 0, 10, 13}, {40, 0, 10, 13},
{40, 0, 10, 13}, {50, 0, 10, 13},
{50, 0, 10, 13}, {60, 0, 10, 13},
{60, 0, 10, 13}, {70, 0, 10, 13},
{70, 0, 10, 13}, {80, 0, 10, 13},
{80, 0, 10, 13}, {100, 0, 10, 13},
{100, 0, 10, 13}, {110, 0, 10, 13},
{110, 0, 10, 13}, {100, 0, 5, 13},
{100, 0, 5, 13}, {114, 0, 5, 13}
{114, 0, 5, 13}
}; };
/* /*
@ -54,27 +53,23 @@ int zapnum[14][4] =
* }; * };
*/ */
int platd[4][2] = int platd[4][2] = {
{ {2, 12},
{2, 12}, {6, 12},
{6, 12}, {16, 12},
{16, 12}, {26, 12}
{26, 12}
}; };
int platm[2][2] = int platm[2][2] = {
{ {42, 12},
{42, 12}, {52, 12}
{52, 12}
}; };
int plongd[4][2] = int plongd[4][2] = {
{ {2, 36},
{2, 36}, {6, 36},
{6, 36}, {16, 36},
{16, 36}, {26, 36}
{26, 36}
}; };
int plongm[2][2] = int plongm[2][2] = {
{ {42, 36},
{42, 36}, {52, 36}
{52, 36}
}; };

View file

@ -1,6 +1,6 @@
.TH WMGlobe 1 "fevrier 1999" .TH WMGlobe 1.3 "august 2001"
.SH NAME .SH NAME
WMGlobe - The Whole Earth spinning on you desktop... WMGlobe - The Whole Earth spinning on you desktop...
as a dockable app for WindowMaker as a dockable app for WindowMaker
.SH SYNOPSIS .SH SYNOPSIS
.B wmglobe .B wmglobe
@ -14,7 +14,7 @@ rendered on a sphere by raytracing. Yes, for a 64x64 pixel result:-)
.B \-v .B \-v
version. Currently, this should display : version. Currently, this should display :
WMGlobe v.0.5 6 fev 1999 <jerome.dumonteil@capway.com> WMGlobe v.1.3 12 aug 2001 <jerome.dumonteil@linuxfr.org>
.TP .TP
.B \-h .B \-h
short help short help
@ -23,58 +23,66 @@ short help
Value > 1 to magnify the view, value < 1 to lower. Default: 1.0 Value > 1 to magnify the view, value < 1 to lower. Default: 1.0
.TP .TP
.B \-pos \fI latitude longitude\fP .B \-pos \fI latitude longitude\fP
Initial viewing fixed at this position, don't follow Initial viewing fixed at this position, don't follow
the sun rotation. Accepted values in the form 45°12'36 or 45.21 or 45:12:36 . the sun rotation. Accepted values in the form 45°12'36 or 45.21 or 45:12:36 .
Default: the initial position is "under" the sun, and Default: the initial position is "under" the sun, and
the point of view follows the sun. the point of view follows the sun.
.TP .TP
.B \-sun
The point of view follows the Sun (default).
.TP
.B \-moon
The point of view follows the Moon (i.e. you see the Earth as you
were on the Moon).
.TP
.B \-rand .B \-rand
New random position at every refresh of screen. New random position at every refresh of screen.
.TP .TP
.B \-map \fI map_file\fP .B \-map \fI map_file\fP
Map used for the rendering. Can be JPEG, GIG, XPM Map used for the rendering. Can be JPEG, GIF, XPM
PNM, TIFF but none BMP. PNM, TIFF but none BMP.
Default: use internal map of earth. Default: use internal map of earth.
.TP .TP
.B \-nimap \fI night_file\fP .B \-nimap \fI night_file\fP
Map used for the dark side of the earth. Must be of Map used for the dark side of the earth. Must be of
the same width x height as the day side map. the same width x height as the day side map.
Default: if the default internal day map is used, use Default: if the default internal day map is used, use
a default internal night file (see -nonimap option). a default internal night file (see -nonimap option).
If a custom day map is provided, and no night map, the .TP
dark side is computed via the -light option. .B \-defnimap
Use the default night map (with a custom map).
.TP .TP
.B \-nonimap .B \-nonimap
Don't use the default night map. Don't use the default night map.
.TP .TP
.B \-delay \fI seconds\fP .B \-delay \fI seconds\fP
Time in seconds between each calculation of a new Time in seconds between each calculation of a new
position. Limited to 0.04 at compile time (25 frames position. Limited to 0.04 at compile time (25 frames
per second should be enough). The sun position move per second should be enough). The sun position move
only once per minute, so if you use wmglobe without only once per minute, so if you use wmglobe without
-dlong or -accel option, the CPU cost of WMGlobe is -dlong or -accel option, the CPU cost of WMGlobe is
*very* low. The use of very low value for -delay plus *very* low. The use of very low value for -delay plus
-dlong and -accel can be CPU costly (but very nice...). -dlong and -accel can be CPU costly (but very nice...).
Default: 1.0 sec. Default: 1.0 sec.
.TP .TP
.B \-dlat \fI delta_latitude\fP .B \-dlat \fI delta_latitude\fP
Move the point of view by delta_lat degrees per second, Move the point of view by delta_lat degrees per second,
with a value of 6 the earth make a full rotation in with a value of 6 the earth make a full rotation in
one minute. The value can be formated as -pos option. one minute. The value can be formated as -pos option.
Default: 0°0'0 Default: 0°0'0
.TP .TP
.B \-dlong \fI delta_long\fP .B \-dlong \fI delta_long\fP
Move the point of view by delta_long degrees per Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default, rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view -dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero. in parameters screen put -dlat and -dlong to zero.
.TP .TP
.B \-light \fI light_value\fP .B \-light \fI light_value\fP
Level of light of the dark side when there is no Level of light of the dark side when there is no
night map, from 0 to 1. night map, from 0 to 1.
Default: 0.25 Default: 0.25
.TP .TP
.B \-dawn \fI dawn_value\fP .B \-dawn \fI dawn_value\fP
Level of continuity for dawn limit, from 0 to 1. With Level of continuity for dawn limit, from 0 to 1. With
@ -83,9 +91,9 @@ at maximum contrast.
Default: 0.2 Default: 0.2
.TP .TP
.B \-bord \fI border_num\fP .B \-bord \fI border_num\fP
0 1 or 2. There are 3 different borders for the icon. 0 1 or 2. There are 3 different borders for the icon.
Default: 0 Default: 2
.TP .TP
.B \-accel \fI time_multi\fP .B \-accel \fI time_multi\fP
Time warp factor. With -accel 24, the sun make a full Time warp factor. With -accel 24, the sun make a full
rotation in one hour (or the earth, I'm not sure). Default: 1.0 rotation in one hour (or the earth, I'm not sure). Default: 1.0
@ -97,18 +105,28 @@ WMGlobe is Y2K compliant without changing system time.
Negative values for dates before 1970 accepted. Negative values for dates before 1970 accepted.
Default: not set, use current time. Default: not set, use current time.
.TP .TP
.B \-mk \fI latitude longitude\fP
Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can
use wmglobe to predict when Moon will meet the Sun :-)
.TP
.B \-fun \fI dx dy\fP .B \-fun \fI dx dy\fP
Move the earth image by dx dy pixels in the icon. See Move the earth image by dx dy pixels in the icon. See
puzzle.sh to understand why. puzzle.sh to understand why.
.TP .TP
.B \-oz .B \-oz
Start in "austral" mode (for "down under" people) Start in "austral" mode (for "down under" people)
.TP
.B \-stable
Keep the globe from going over the poles.
.TP .TP
.B \-d \fI display\fP .B \-d \fI display\fP
Select another display Select another display
.TP .TP
.B \-w \-shape .B \-w \-shape
Useless, since it is set by default (WMaker dockable Useless, since it is set by default (WMaker dockable
application) application)
.SH "MOUSE OPTIONS" .SH "MOUSE OPTIONS"
.TP .TP
@ -124,30 +142,30 @@ Displays 7 screens of parameters. On every screen, just
clic with left or right button on the figures to change clic with left or right button on the figures to change
their value. The TIME screen shows an approximation their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed, of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options real local time by one or two hours. Others options
don't need more help. Intuitive they said... don't need more help. Intuitive they said...
.SH "FILES" .SH "FILES"
.TP .TP
.B MAPS .B MAPS
Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default, Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default,
it uses a low quality built-in map of earth. But you will probably want it uses a low quality built-in map of earth. But you will probably want
to use better ones. to use better ones.
You can get maps usable with WMGlobe on the net. See the links below. You can get maps usable with WMGlobe on the net. See the links below.
using custom maps: using custom maps:
For the image to be mapped correctly, position 0°North 0°West must be in For the image to be mapped correctly, position 0°North 0°West must be in
the center of the image and the latitude must be linear from 90°N to 90°S. the center of the image and the latitude must be linear from 90°N to 90°S.
When using a night map, make sure that day and night map have the same When using a night map, make sure that day and night map have the same
dimensions. dimensions.
.TP .TP
.B Links: Where to find maps and similar softs .B Links: Where to find maps and similar softs
where to find the sources of wmglobe: where to find the sources of wmglobe:
the web page of WMGlobe (made by Sylvestre Taburet): the web page of WMGlobe (made by Sylvestre Taburet):
<http://www.capway.com/dumonte1/wm/wmg.html> <http://perso.linuxfr.org/jdumont/wmg/>
where to find maps and similar softs: where to find maps and similar softs:
@ -163,7 +181,7 @@ XGlobe Homepage: (many links to map of earth)
<http://www.uni-karlsruhe.de/~uddn/xglobe> <http://www.uni-karlsruhe.de/~uddn/xglobe>
Xearth Homepage: Xearth Homepage:
<http://www.cs.colorado.edu/~tuna/xearth/> <http://www.cs.colorado.edu/~tuna/xearth/>
@ -173,7 +191,8 @@ By the way, you can use maps of Mars, Luna ... and text.
.LP .LP
WMGlobe uses the setlocale(3) function, so you LANG environment need to be ok. WMGlobe uses the setlocale(3) function, so you LANG environment need to be ok.
You need WindowMaker 0.20.3 or 0.51.0 installed to use WMGlobe. You need WindowMaker 0.62 or higher to use WMGlobe. (use WMGlobe 1.0 for
older versions of WindowMaker).
.SH "SEE ALSO" .SH "SEE ALSO"
.LP .LP
The Window Maker User Guide The Window Maker User Guide
@ -181,18 +200,20 @@ The Window Maker User Guide
The Window Maker FAQ The Window Maker FAQ
.SH "AUTHOR" .SH "AUTHOR"
jerome dumonteil <jerome.dumonteil@capway.com> jerome dumonteil <jerome.dumonteil@linuxfr.org>
Patches, bug reports, and suggestions are welcome. Patches, bug reports, and suggestions are welcome.
.SH "CREDITS" .SH "CREDITS"
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through
the GNU General Public License. the GNU General Public License.
Read the COPYING file for the complete GNU license. Read the COPYING file for the complete GNU license.
Original idea, tests, logos: Original idea, tests, logos:
Sylvestre Taburet <staburet@consort.fr> Sylvestre Taburet <Sylvestre.Taburet@free.fr>
WindowMaker 0.62 fix : Charles G Waldman <cgw@fnal.gov>
The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson. The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
@ -224,7 +245,7 @@ documentation.
The rendering engine is taken from XGlobe by Thorsten Scheuermann The rendering engine is taken from XGlobe by Thorsten Scheuermann
XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe
Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker
<http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team <http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team
@ -234,9 +255,10 @@ If you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe. you can not display more than one WMGlobe.
WMGlobe hopes that an overflow of a long integer dont generate an error WMGlobe hopes that an overflow of a long integer dont generate an error
and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
when the date go over year 2038. The expected result is wmglobe when the date go over year 2038. The expected result is wmglobe
continuing smoothly from 1901. continuing smoothly from 1901.
Using WMGlobe at high speed through a LAN may induce some load on the net.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

BIN
wmglobe/wmgmap.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB