%%
%% This is file `pst-map3d.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-map3d.tex'
%%
%% Manuel Luque <Mluque5130@aol.com> (France)
%% Giuseppe Matarazzo  <joematara@hotmail.com> (Italy)
%% Herbert Voss  <hvoss@tug.org> (Germany)
%%
%% March 5, 2010
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `pst-map3d' is a PSTricks package to create geographical objects
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nouvelle version de pst-map3d %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\csname PSTMapThreeD\endcsname
\let\PSTMapThreeDLoaded\endinput

% Require PSTricks
\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey.tex \fi

\def\fileversion{2.04}
\def\filedate{2010/05/05}

\message{`PST-map3d v\fileversion, \filedate}
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\pst@addfams{pst-map3d}
%
\definecolor{orange}{cmyk}{0,0.61,0.87,0}
\definecolor{darkgreen}{cmyk}{1,0,1,0.5}
\SpecialCoor
%
\define@key[psset]{pst-map3d}{path}{\def\psk@WorldMap@Path{#1}} % chemin des données
\psset{path=data}
%
\pstheader{pst-map3d.pro}
\define@key[psset]{pst-map3d}{RotX}{\def\psk@TroisD@RotX{#1}} % rotation autour de Ox en degrés
\define@key[psset]{pst-map3d}{RotY}{\def\psk@TroisD@RotY{#1}} % rotation autour de Oy en degrés
\define@key[psset]{pst-map3d}{RotZ}{\def\psk@TroisD@RotZ{#1}} % rotation autour de OZ en degrés
\define@key[psset]{pst-map3d}{Radius}{\def\psk@TroisD@Radius{#1}} % rayon de la sphère
%
\define@key[psset]{pst-map3d}{THETA}{\def\psk@TroisD@Theta{#1}}
\define@key[psset]{pst-map3d}{PHI}{\def\psk@TroisD@Phi{#1}}
\define@key[psset]{pst-map3d}{Dobs}{\def\psk@TroisD@Dobs{#1}}
\define@key[psset]{pst-map3d}{Decran}{\def\psk@TroisD@Ecran{#1}}
\psset[pst-map3d]{THETA=0,PHI=45,Dobs=20,Decran=25}
%
\psset[pst-map3d]{RotX=0,RotY=0,RotZ=0,Radius=5}
%
\define@key[psset]{pst-map3d}{Day}{\def\psk@WorldMap@J{#1}}
\define@key[psset]{pst-map3d}{Month}{\def\psk@WorldMap@M{#1}}
\define@key[psset]{pst-map3d}{Year}{\def\psk@WorldMap@A{#1}}
\psset[pst-map3d]{Day=\number\day,Month=\number\month,Year=\number\year}
\define@key[psset]{pst-map3d}{hour}{\def\psk@WorldMap@hour{#1}}
\psset[pst-map3d]{hour=12} % en heures
%
\define@key[psset]{pst-map3d}{gridmapdiv}{\def\psk@WorldMap@mapgriddiv{#1}}
\psset[pst-map3d]{gridmapdiv=10}
%
\define@key[psset]{pst-map3d}{longitudeMeridien}{\def\psk@WorldMap@longitudeMeridien{#1}}
\psset[pst-map3d]{longitudeMeridien=0}
%
\newdimen\psmeridienwidth
\define@key[psset]{pst-map3d}{meridienwidth}[1pt]{\pssetlength\psmeridienwidth{#1}}
\psset[pst-map3d]{meridienwidth=1pt}
%
\define@key[psset]{pst-map3d}{meridiencolor}[red]{\pst@getcolor{#1}\psmeridiencolor}
\psset[pst-map3d]{meridiencolor=red}
%
\define@key[psset]{pst-map3d}{latitudeParallel}[0]{\def\psk@WorldMap@latitudeParallel{#1}}
\psset[pst-map3d]{latitudeParallel=0}
%
\newdimen\psparallelwidth
\define@key[psset]{pst-map3d}{parallelwidth}[1pt]{\pssetlength\psparallelwidth{#1}}
\psset[pst-map3d]{parallelwidth=1pt}
%
\define@key[psset]{pst-map3d}{parallelcolor}{\pst@getcolor{#1}\psparallelcolor}
\psset[pst-map3d]{parallelcolor=red}
%
\definecolor{terre}{rgb}{0.99,0.95,0.7}
\definecolor{mer}{rgb}{0.5,0.8,0.8}
\definecolor{darkblue}{cmyk}{1,1,0,0.7}

\define@key[psset]{pst-map3d}{mapcolor}{\pst@getcolor{#1}\psmapcolor}
\psset[pst-map3d]{mapcolor=terre}
\define@key[psset]{pst-map3d}{bordercolor}{\pst@getcolor{#1}\psbordercolor}
\psset[pst-map3d]{bordercolor=black}
\define@key[psset]{pst-map3d}{islandcolor}{\pst@getcolor{#1}\psislandcolor}
\psset[pst-map3d]{islandcolor=black}
\define@key[psset]{pst-map3d}{coastcolor}{\pst@getcolor{#1}\pscoastcolor}
\psset[pst-map3d]{coastcolor=black}
\define@key[psset]{pst-map3d}{oceancolor}{\pst@getcolor{#1}\psoceancolor}
\psset[pst-map3d]{oceancolor=mer}
\define@key[psset]{pst-map3d}{rivercolor}{\pst@getcolor{#1}\psrivercolor}
\psset[pst-map3d]{rivercolor=blue}
\define@key[psset]{pst-map3d}{wfraczoncolor}{\pst@getcolor{#1}\pswfraczoncolor}
\psset[pst-map3d]{wfraczoncolor=red}
\define@key[psset]{pst-map3d}{wmaglincolor}{\pst@getcolor{#1}\pswmaglincolor}
\psset[pst-map3d]{wmaglincolor=darkblue}
\define@key[psset]{pst-map3d}{ridgecolor}{\pst@getcolor{#1}\psridgecolor}
\psset[pst-map3d]{ridgecolor=red}
\define@key[psset]{pst-map3d}{transfrmcolor}{\pst@getcolor{#1}\pstransfrmcolor}
\psset[pst-map3d]{transfrmcolor=orange}
\define@key[psset]{pst-map3d}{trenchcolor}{\pst@getcolor{#1}\pstrenchcolor}
\psset[pst-map3d]{trenchcolor=darkgreen}
\define@key[psset]{pst-map3d}{gridmapcolor}{\pst@getcolor{#1}\psgridmapcolor}
\psset[pst-map3d]{gridmapcolor=black}
\define@key[psset]{pst-map3d}{circlecolor}{\pst@getcolor{#1}\pscirclecolor}
\psset[pst-map3d]{circlecolor=blue}
\define@key[psset]{pst-map3d}{circlesep}{\def\psk@WorldMap@circlesep{#1}}
\psset[pst-map3d]{circlesep=2} % en degres
\newdimen\pscirclewidth
\define@key[psset]{pst-map3d}{circlewidth}{\pssetlength\pscirclewidth{#1}}
\psset[pst-map3d]{circlewidth=.5pt}
\newdimen\psgridmapwidth
\define@key[psset]{pst-map3d}{gridmapwidth}[0.8pt]{\pssetlength\psgridmapwidth{#1}}
\psset[pst-map3d]{gridmapwidth=.8pt}
\newdimen\psborderwidth
\define@key[psset]{pst-map3d}{borderwidth}[0.8pt]{\pssetlength\psborderwidth{#1}}
\psset[pst-map3d]{borderwidth=.8pt}
\newdimen\pscoastwidth
\define@key[psset]{pst-map3d}{coastwidth}[0.8pt]{\pssetlength\pscoastwidth{#1}}
\psset[pst-map3d]{coastwidth=.8pt}
\newdimen\pswfraczonwidth
\define@key[psset]{pst-map3d}{wfraczonwidth}[0.8pt]{\pssetlength\pswfraczonwidth{#1}}
\psset[pst-map3d]{wfraczonwidth=.8pt}
\newdimen\pswmaglinwidth
\define@key[psset]{pst-map3d}{wmaglinwidth}[0.8pt]{\pssetlength\pswmaglinwidth{#1}}
\psset[pst-map3d]{wmaglinwidth=.8pt}
\newdimen\psridgewidth
\define@key[psset]{pst-map3d}{ridgewidth}[2pt]{\pssetlength\psridgewidth{#1}}
\psset[pst-map3d]{ridgewidth=2pt}

\def\variablesIIID@map3d{%
    /RotX \psk@TroisD@RotX\space def
    /RotY \psk@TroisD@RotY\space def
    /RotZ \psk@TroisD@RotZ\space def
    /THETA \psk@TroisD@Theta\space def
    /PHI \psk@TroisD@Phi\space def
    /Rsphere \psk@TroisD@Radius\space def
    /Dobs \psk@TroisD@Dobs\space def
    /DScreen \psk@TroisD@Ecran\space def
    /xunit {\pst@number\psxunit\space mul}def
    /yunit {\pst@number\psyunit\space mul}def
    /runit {\pst@number\psrunit\space mul}def
 }%
 %
\newif\ifPst@WorldMap@island
\define@key[psset]{pst-map3d}{islands}[false]{\@nameuse{Pst@WorldMap@island#1}}
\psset{islands=true}
%
\newif\ifPst@WorldMap@border
\define@key[psset]{pst-map3d}{borders}[false]{\@nameuse{Pst@WorldMap@border#1}}
\psset{borders=true}
%
\newif\ifPst@WorldMap@france
\define@key[psset]{pst-map3d}{france}[true]{\@nameuse{Pst@WorldMap@france#1}}
\psset{france=false}
%
\newif\ifPst@WorldMap@capitals
\define@key[psset]{pst-map3d}{capitals}[true]{\@nameuse{Pst@WorldMap@capitals#1}}
\psset{capitals=false}
%
\newif\ifPst@WorldMap@usa
\define@key[psset]{pst-map3d}{usa}[true]{\@nameuse{Pst@WorldMap@usa#1}}
\psset{usa=false}
%
\newif\ifPst@WorldMap@mexico
\define@key[psset]{pst-map3d}{mexico}[true]{\@nameuse{Pst@WorldMap@mexico#1}}
\psset{mexico=false}
%
\newif\ifPst@WorldMap@australia
\define@key[psset]{pst-map3d}{australia}[true]{\@nameuse{Pst@WorldMap@australia#1}}
\psset{australia=false}
%
\newif\ifPst@WorldMap@canada
\define@key[psset]{pst-map3d}{canada}[true]{\@nameuse{Pst@WorldMap@canada#1}}
\psset{canada=false}
%
\newif\ifPst@WorldMap@city
\define@key[psset]{pst-map3d}{citys}[false]{\@nameuse{Pst@WorldMap@city#1}}
\psset{citys=false}
%
\newif\ifPst@WorldMap@Rivers%
\define@key[psset]{pst-map3d}{rivers}[false]{\@nameuse{Pst@WorldMap@Rivers#1}}
\psset{rivers=true}
%
\newif\ifPst@WorldMap@Lake%
\define@key[psset]{pst-map3d}{lakes}[false]{\@nameuse{Pst@WorldMap@Lake#1}}
\psset{lakes=true}
%
\newif\ifPst@WorldMap@gridmap
\define@key[psset]{pst-map3d}{gridmap}[true]{\@nameuse{Pst@WorldMap@gridmap#1}}
\psset{gridmap=true}
%
\newif\ifPst@WorldMap@coasts
\define@key[psset]{pst-map3d}{coasts}[true]{\@nameuse{Pst@WorldMap@coasts#1}}
\psset{coasts=false}
%
\newif\ifPst@WorldMap@fraczon
\define@key[psset]{pst-map3d}{wfraczon}[true]{\@nameuse{Pst@WorldMap@fraczon#1}}
\psset{wfraczon=false}
%
\newif\ifPst@WorldMap@ridge
\define@key[psset]{pst-map3d}{ridge}[true]{\@nameuse{Pst@WorldMap@ridge#1}}
\psset{ridge=false}
%
\newif\ifPst@WorldMap@maglin
\define@key[psset]{pst-map3d}{wmaglin}[true]{\@nameuse{Pst@WorldMap@maglin#1}}
\psset{wmaglin=false}
%
\newif\ifPst@WorldMap@circles
\define@key[psset]{pst-map3d}{circles}[false]{\@nameuse{Pst@WorldMap@circles#1}}
\psset{circles=true}
%
\newif\ifPst@WorldMap@visibility
\define@key[psset]{pst-map3d}{visibility}[false]{\@nameuse{Pst@WorldMap@visibility#1}}
\psset{visibility=true}
%
\newif\ifPst@WorldMap@blueEarth
\define@key[psset]{pst-map3d}{blueEarth}[false]{\@nameuse{Pst@WorldMap@blueEarth#1}}
\psset{blueEarth=true}
%
\newif\ifPst@WorldMap@ombre
\define@key[psset]{pst-map3d}{daynight}[true]{\@nameuse{Pst@WorldMap@ombre#1}}
\psset{daynight=false}
%	
\def\WorldMapThreeD{\pst@object{WorldMapThreeD}}
\def\WorldMapThreeD@i{\@ifnextchar[{\WorldMapThreeD@do}{\WorldMapThreeD@do[]}}
\def\WorldMapThreeD@do[#1]{{%
\psset{#1}%
\begin@ClosedObj%
\addto@pscode{%
  /increment \psk@WorldMap@mapgriddiv\space def
  \variablesIIID@map3d
  /mapcolor  {\pst@usecolor\psmapcolor currentrgbcolor} def
  /bordercolor  {\pst@usecolor\psbordercolor currentrgbcolor} def
  /coastcolor  {\pst@usecolor\pscoastcolor currentrgbcolor} def
  /islandcolor  {\pst@usecolor\psislandcolor currentrgbcolor} def
  /maillagecolor  {\pst@usecolor\psgridmapcolor currentrgbcolor} def
  /oceancolor  {\pst@usecolor\psoceancolor currentrgbcolor} def
  /rivercolor  {\pst@usecolor\psrivercolor currentrgbcolor} def
  /wfraczoncolor {\pst@usecolor\pswfraczoncolor currentrgbcolor} def
  /wmaglincolor {\pst@usecolor\pswmaglincolor currentrgbcolor} def
  /ridgecolor {\pst@usecolor\psridgecolor currentrgbcolor} def
  /transfrmcolor {\pst@usecolor\pstransfrmcolor currentrgbcolor} def
  /trenchcolor {\pst@usecolor\pstrenchcolor currentrgbcolor} def
  /circlecolor  {\pst@usecolor\pscirclecolor currentrgbcolor} def
  /circlewidth {\pst@number\pscirclewidth SLW} def
  /circlesep \psk@WorldMap@circlesep\space def
  /maillagewidth {\pst@number\psgridmapwidth SLW} def
  /borderwidth {\pst@number\psborderwidth SLW} def
  /coastwidth {\pst@number\pscoastwidth SLW} def
  /wfraczonwidth {\pst@number\pswfraczonwidth SLW} def
  /wmaglinwidth {\pst@number\pswmaglinwidth SLW} def
  /ridgewidth {\pst@number\psridgewidth SLW} def
  /longitude_meridien \psk@WorldMap@longitudeMeridien\space def
  /meridienwidth {\pst@number\psmeridienwidth SLW} def
  /meridiencolor  {\pst@usecolor\psmeridiencolor currentrgbcolor} def
  /latitude_parallel \psk@WorldMap@latitudeParallel\space def
  /parallelwidth {\pst@number\psparallelwidth SLW} def
  /parallelcolor  {\pst@usecolor\psparallelcolor currentrgbcolor} def
  /year \psk@WorldMap@A\space def
  /month \psk@WorldMap@M\space def
  /day \psk@WorldMap@J\space def
   month 3 lt {/month month 12 add def /year year 1 sub def} if
  /AA year 100 div truncate def
  /BB 2 AA sub AA 4 div truncate add def
  /CC 365.25 year mul truncate def
  /DD 30.6001 month 1 add mul truncate def
  /julien BB CC add DD add day add 1720994.5 add def
  /hour \psk@WorldMap@hour\space def
  /jours julien 2454367 sub def
  /AngleRayonsSoleil latitude_parallel  23.5 sin 360 jours mul 365.25 div sin mul arccos sub def
   /u1 0 def /u2 AngleRayonsSoleil cos def /u3 AngleRayonsSoleil sin def
%  /Julien jd hour 24 div add def
  %
  1 setlinejoin
  0 0 translate
  /pst@fill { \psk@opacityalpha .setopacityalpha fill } def
 tx@map3DDict begin
 MatriceTransformationZXY
%
  /RsphereScreen Rsphere DScreen mul Dobs div
    1 Rsphere dup mul Dobs dup mul div sub sqrt div runit def
%
/GrandCercle {
  % cercle vu par l'observateur
  0 0 RsphereScreen 0 360 arc
  closepath
} def
%
\ifPst@WorldMap@visibility
  /condition { 0 ge } def
\else
 /condition { 0 le } def
\fi
%
\ifPst@WorldMap@ombre
    the_night
\fi
%
\ifPst@WorldMap@blueEarth
  gsave
  newpath
  oceancolor
  GrandCercle
  pst@fill  % fill
  grestore
\fi
%
\ifPst@WorldMap@circles
gsave
 oceans_seas_hatched
grestore
\fi
%
\ifPst@WorldMap@border
  (\psk@WorldMap@Path/pborder.dat) run
gsave
GrandCercle
clip
border dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  closepath
   gsave
 mapcolor
  pst@fill  % fill
  grestore
  borderwidth
  bordercolor
  stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@island
  (\psk@WorldMap@Path/pisland.dat) run
gsave
GrandCercle
clip
islands dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  closepath
   gsave
 mapcolor
  pst@fill  % fill
  grestore
  borderwidth
  islandcolor
   stroke
  }forall
grestore
\fi
  %
\ifPst@WorldMap@france
  (\psk@WorldMap@Path/france.dat) run
gsave
GrandCercle
clip
france dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  closepath
   gsave
 mapcolor
  pst@fill  % fill
  grestore
  borderwidth
  bordercolor
  stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@Lake
 (\psk@WorldMap@Path/plake.dat) run
gsave
GrandCercle
clip
lake dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  closepath
   gsave
  oceancolor
  pst@fill  % fill
  grestore
%  borderwidth
%  bordercolor
0 0 1 setrgbcolor
  stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@coasts
  (\psk@WorldMap@Path/pcoast.dat) run
gsave
GrandCercle
clip
coasts dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   coastwidth
   coastcolor
   stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@usa
  (\psk@WorldMap@Path/usa.dat) run
gsave
GrandCercle
clip
usa dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   closepath
   gsave
   mapcolor
   pst@fill  % fill
   grestore
  borderwidth
  bordercolor
   stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@mexico
  (\psk@WorldMap@Path/mex.dat) run
gsave
GrandCercle
clip
mexico dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   closepath
   gsave
   mapcolor
   pst@fill  % fill
   grestore
  borderwidth
  bordercolor
   stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@australia
  (\psk@WorldMap@Path/aus.dat) run
gsave
GrandCercle
clip
australia dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   closepath
   gsave
   mapcolor
   pst@fill  % fill
   grestore
  borderwidth
  bordercolor
   stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@canada
  (\psk@WorldMap@Path/canada.dat) run
gsave
GrandCercle
clip
canada dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   closepath
   gsave
   mapcolor
   pst@fill  % fill
   grestore
  borderwidth
  bordercolor
   stroke
  }forall
grestore
\fi
%
\ifPst@WorldMap@fraczon
  (\psk@WorldMap@Path/wfraczon.dat) run
GrandCercle
clip
wfraczon dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  wfraczoncolor
  wfraczonwidth
   stroke}forall
\fi
%
\ifPst@WorldMap@maglin
  (\psk@WorldMap@Path/wmaglin.dat) run
GrandCercle
clip
wmaglin dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  wmaglincolor
  wmaglinwidth
   stroke}forall
\fi
%
\ifPst@WorldMap@ridge
  (\psk@WorldMap@Path/ridge.dat) run
gsave
GrandCercle
clip
ridge dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  ridgecolor
  ridgewidth
   stroke}forall
grestore
  (\psk@WorldMap@Path/transfrm.dat) run
gsave
GrandCercle
clip
transfrm dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  transfrmcolor
  ridgewidth
   stroke}forall
grestore
  (\psk@WorldMap@Path/trench.dat) run
gsave
GrandCercle
clip
trench dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
  trenchcolor
  ridgewidth
   stroke}forall
grestore
\fi
%
\ifPst@WorldMap@Rivers
  (\psk@WorldMap@Path/river.dat) run
GrandCercle
clip
river dup /REGION exch def
CompteurRegions
{CalculsPointsRegion
   rivercolor
   stroke}forall
\fi
%
\ifPst@WorldMap@city
% les capitales
  (\psk@WorldMap@Path/c-cap.dat) run
  1.5
  citycapitals
  DrawCitys
% les autres villes
  (\psk@WorldMap@Path/c-sub.dat) run
  0.5
  CitySub
DrawCitys
\fi
\ifPst@WorldMap@capitals
% les capitales
  (\psk@WorldMap@Path/c-cap.dat) run
  2
  citycapitals
  DrawCitys
\fi
%
\ifPst@WorldMap@gridmap
    MaillageSphere
\fi
end}%
\end@ClosedObj}}
% placer une ville en particulier
% par sa longitude et sa latitude en degrés
% si la ville n'est pas visible
% elle est rejetée hors de l'écran
\def\pnodeMapIIID{\pst@object{pnodeMapIIID}}
\def\pnodeMapIIID@i(#1,#2)#3{%
   \begin@SpecialObj%
   \pnode(!
   \variablesIIID@map3d
   tx@map3DDict begin
   MatriceTransformationZXY
        /Xpoint {#2 cos #1 cos mul Rsphere mul} def
        /Ypoint {#2 cos #1 sin mul Rsphere mul} def
        /Zpoint {#2 sin Rsphere mul } def
   CalculsPointsAfterTransformations
%  CalcCoordinates
%  /YcoorCity exch def /XcoorCity exch def
%   Test
%   PS 0 ge %
%    {XcoorCity YcoorCity }
%    {/XcoorCity 1000 def /YcoorCity 1000 def}
%    ifelse
formulesTroisD
     Xi Yi end){#3}%
   \end@SpecialObj%
   \ignorespaces}%
%
% adaptation de \mapput de \pst-map2d}
\define@key[psset]{pst-map3d}{mapCountry}{\edef\psk@WorldMap@mapCountry{#1}}
\psset{mapCountry=all}
\define@key[psset]{pst-map3d}{nodeWidth}{\edef\psk@WorldMap@nodeWidth{#1}}
\psset{nodeWidth=1mm}
\newpsstyle{psNodeMapStyle}{fillstyle=solid,fillcolor=red}
\newpsstyle{NodeLabelStyle}{fillstyle=solid,fillcolor=yellow,framesep=0,linestyle=none}

%
\def\mapputIIID{\@ifnextchar[{\mapputIIID@i}{\mapputIIID@i[90]}}
\def\mapputIIID@i[#1](#2,#3){\@ifnextchar[{\mapputIIID@iii[#1](#2,#3)}{\mapputIIID@ii[#1](#2,#3)}}
\def\mapputIIID@ii[#1](#2,#3)#4{\mapputIIID@iii[#1](#2,#3)[#4]{#4}}
\def\mapputIIID@iii[#1](#2,#3)[#4]#5{%
  \@ifnextchar[{\mapputIIID@iv[#1](#2,#3)[#4]#5}{\mapputIIID@iv[#1](#2,#3)[#4]#5[\@empty]}}
\def\mapputIIID@iv[#1](#2,#3)[#4]#5[#6]{{%
% [angle](longitude,lattitude)[node name]{node label}[country]
  \def\pst@tempb{all}
  \ifx\pst@tempb\psk@WorldMap@mapCountry
    \mapputIIID@v[#1](#2,#3)[#4]{#5}%
  \else
    \def\pst@tempb{#6}%
%    \typeout{Compare \pst@tempb{} with \psk@WorldMap@mapCountry}
    \ifx\pst@tempb\psk@WorldMap@mapCountry
      \mapputIIID@v[#1](#2,#3)[#4]{#5}
    \fi%
  \fi%
}}
\def\mapputIIID@v[#1](#2,#3)[#4]#5{%
  \pnodeMapIIID(#2,#3){#4}
  \pst@dima=\psk@WorldMap@nodeWidth
  \pscircle[style=psNodeMapStyle](#4){\pst@dima}
  \pscircle*(#4){0.5\pst@dima}
  \ifx\relax#5\relax\else
    \uput{1.2\pst@dima}[#1](#4){\psframebox[style=NodeLabelStyle]{#5}}%
  \fi}
%
% dessiner un méridien de longitude donnée
% longitude en degrés
\def\psmeridien{\pst@object{psmeridien}}
\def\psmeridien@i#1{%
   \pst@killglue
   \begingroup
   \begin@SpecialObj%
   \addto@pscode{%
   \variablesIIID@map3d
   /longitude_meridien #1 def
   /meridienwidth {\pst@number\psmeridienwidth SLW} def
   /meridiencolor  {\pst@usecolor\psmeridiencolor currentrgbcolor} def
   tx@map3DDict begin
   MatriceTransformationZXY
  \ifPst@WorldMap@visibility
    /condition { 0 ge } def
  \else
   /condition { 0 le } def
  \fi
   meridien
   end}%
   \end@SpecialObj%
   \endgroup%
   \ignorespaces%
}
%
% dessiner un cercle parallèle à l'équateur de latitude donnée
% latitude en degrés
\def\psparallel{\pst@object{psparallel}}
\def\psparallel@i#1{%
   \pst@killglue
   \begingroup
   \begin@SpecialObj%
   \addto@pscode{%
   \variablesIIID@map3d
   /latitude_parallel #1 def
   /parallelwidth {\pst@number\psparallelwidth SLW} def
   /parallelcolor  {\pst@usecolor\psparallelcolor currentrgbcolor} def
   tx@map3DDict begin
   MatriceTransformationZXY
     \ifPst@WorldMap@visibility
    /condition { 0 ge } def
    \else
    /condition { 0 le } def
    \fi
   Parallel
   parallelwidth
   parallelcolor
   stroke
   end}%
   \end@SpecialObj%
   \endgroup%
   \ignorespaces%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% le dessin du globe tellure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\define@key[psset]{pst-map3d}{styleGlobe}{% style du globe
\edef\psk@styleGlobe{#1}}

\define@key[psset]{pst-map3d}{styleNight}{% style de la partie dans la nuit
\edef\psk@styleNight{#1}}

\newpsstyle{Globe}{circles=true}
\newpsstyle{night}{fillstyle=solid,fillcolor=black,opacity=0.8}
\psset[pst-map3d]{styleGlobe=Globe,styleNight=night}

\def\psGlobeTellure{\pst@object{psGlobeTellure}}
\def\psGlobeTellure@i(#1,#2)#3{% longitude, latitude et nom de la ville
   \begin@SpecialObj%
    \pnode(!/ux 0 def /uy 90 #2 sub sin def /uz 90 #2 sub cos def 0 0){ttt}%
    \psset{THETA=0,PHI=0}%
    {\psset{RotX=#2 90 sub,RotZ=90 #1 add}
    \WorldMapThreeD[style=\psk@styleGlobe,daynight=false]%
    \mapputIIID(#1,#2){#3}}%
   \WorldMapThreeD[style=\psk@styleNight,daynight=true,circles=false,blueEarth=false,
                         borders=false,islands=false,
                         rivers=false,lakes=false,
                         gridmap=false,latitudeParallel=#2]%
   \psframe*(! -3 \psk@TroisD@Radius\space neg -1.5 add)(!3 \psk@TroisD@Radius\space neg -0.5 add)
   \rput(! 0 \psk@TroisD@Radius\space neg -1 add){\white\psk@WorldMap@hour h le \psk@WorldMap@J/\psk@WorldMap@M/\psk@WorldMap@A}
   \end@SpecialObj%
   \ignorespaces}%

%%%%%%%%%%%%%%%%%%%%%%%%%

% épicentre d'un tremblement de terre
% Earthquake Epicenters
%
\define@key[psset]{pst-map3d}{waves}{\edef\psk@WorldMap@waves{#1}}
\psset{waves=3} % nombre de cercles concentriques
\define@key[psset]{pst-map3d}{Rmax}{\edef\psk@WorldMap@Rmax{#1}}
\psset{Rmax=1500} % rayon maximum du séisme en km

\def\psepicenter{\pst@object{psepicenter}}
\def\psepicenter@i(#1,#2)#3{%
  \begin@ClosedObj%
  \addto@pscode{
    \variablesIIID@map3d
    /longitude #1 def
    /latitude #2 def
    /nbre \psk@WorldMap@waves\space def
    /dphi \psk@WorldMap@Rmax\space 0.008983 mul def
    /circlecolor  {\pst@usecolor\pscirclecolor currentrgbcolor} def
    /circlewidth {\pst@number\pscirclewidth SLW} def
    tx@map3DDict begin
    circlecolor
    circlewidth
    nbre dphi longitude latitude
    ondes
    end }%
  \ifx\relax#3\relax\else\mapputIIID(#1,#2){#3}\fi%
  \end@ClosedObj%
  \ignorespaces}
%
\catcode`\@=\PstAtCode\relax
\endinput
