#####################################################################################################
# 衛星軌道３Ｄ表示用 gnuplot 設定ファイル（使い方： gnuplot> load "00-orbit.txt" ）
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 基本表示環境の設定（初期化）
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
reset									# 全クリア!!
set term qt noenhanced noraise font "VL Gothic,8"		# 端末＆フォントの設定
set macros								# マクロの有効化

set grid								# グリッドの表示設定
set size square							# スケールの比率設定(２次元：正方形)
set view equal xyz						# スケールの比率設定(３次元：立方体)
set view ,,2.25
set xyplane at 0						# Ｚ軸ゼロ位置の高さ設定

set title "WGS84 with ECI-Axis ( Tick=5000[Km] )" font ",12"
set format ""							# 座標軸数値の非表示設定
set xtics 5000							# >大目盛り = 5000 [Km]
set ytics 5000							# >　〃
set ztics 5000							# >　〃
#set mxtics 5							# >小目盛り = 1000 [Km]
#set mytics 5							# >　〃
#set mztics 5							# >　〃

#####################################################################################################
# splot パラメーター用マクロの定義
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ３Ｄ：｛地球メッシュ(回転だ円体)[緑] ＋ 座標軸ベクトル[黒] ｝の表示用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [緑＋黒] 
ev="[-size:+size][-size:+size][-size:+size] 0 lt 0, \"ECI-Mesh3D.dat\" with line lc 2 lw 0.5 lt 2, \"ECI-Vect3D.dat\" u 1:2:3:4:5:6 with vect lc 1 lw 0.5 lt 1, \"\" u 7:8:9:10 w labels font \",12\""
eo="[-size:+size][-size:+size][-size:+size] 0 lt 0, \"ECI-Mesh3D.dat\" with line lc 2 lw 0.5 lt 2"
vo="[-size:+size][-size:+size][-size:+size] 0 lt 0,                                                \"ECI-Vect3D.dat\" u 1:2:3:4:5:6 with vect lc 1 lw 0.5 lt 1, \"\" u 7:8:9:10 w labels font \",12\""
e =ev				# 赤道面有り

EV="[-size:+size][-size:+size][-size:+size]         \"ECI-Mesh3D.dat\" with line lc 2 lw 0.5 lt 2, \"ECI-Vect3D.dat\" u 1:2:3:4:5:6 with vect lc 1 lw 0.5 lt 1, \"\" u 7:8:9:10 w labels font \",12\""
EO="[-size:+size][-size:+size][-size:+size]         \"ECI-Mesh3D.dat\" with line lc 2 lw 0.5 lt 2"
VO="[-size:+size][-size:+size][-size:+size]                                                        \"ECI-Vect3D.dat\" u 1:2:3:4:5:6 with vect lc 1 lw 0.5 lt 1, \"\" u 7:8:9:10 w labels font \",12\""
E =EV				# 赤道面無し

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ３Ｄ：衛星位置＆衛星軌道表示用		GNUPLOT> splot @e, "data.txt" @p
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 可変色 ### [＊]
clp="u 15:16:17:(column(-2)) with lp  pt 3 lc variable"		# @clp = (X,Y,Z) w lp
cl ="u 15:16:17:(column(-2)) with l        lc variable"		# @cl  = (X,Y,Z) w l
cp ="u 15:16:17:(column(-2)) with  p  pt 3 lc variable"		# @cp  = (X,Y,Z) w  p
cd ="u 15:16:17:(column(-2)) with   d      lc variable"		# @cd  = (X,Y,Z) w   d

### 固定色 ### [青] 
lp ="u 15:16:17              with lp  pt 3 lc 6"			# @lp  = (X,Y,Z) w lp
l  ="u 15:16:17              with l        lc 6"			# @l   = (X,Y,Z) w l
p  ="u 15:16:17              with  p  pt 3 lc 6"			# @p   = (X,Y,Z) w  p
d  ="u 15:16:17              with   d      lc 6"			# @d   = (X,Y,Z) w   d

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ３Ｄ：衛星名称表示用					GNUPLOT> splot @e, "data.txt" @p, "" @n
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [黒] 
n0 ="u 15:16:17:22 ev ::1::1 w labels left offset 0.5		# @n0 = (X,Y,Z) w labels 先頭のみ
na ="u 15:16:17:22           w labels left offset 0.5		# @na = (X,Y,Z) w labels 全て表示
n  =na

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ３Ｄ：速度Vect表示用					GNUPLOT> splot @e, "data.txt" @p, "" @v
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [紫] 
v0 ="u 15:16:17:18:19:20 ev ::1::1 w vect lc 1"				# @v0 = (X,Y,Z) w vect 先頭のみ
va ="u 15:16:17:18:19:20           w vect lc 1"				# @va = (X,Y,Z) w vect 全て表示
v  =va

#####################################################################################################
# 単独実行用マクロの定義
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# MISC情報ラベル（日付時刻等）の設定用 [ label 番号は文字 M+I の ASCII CODE ）
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
MiscInfo=""
lmi="set label 150 MiscInfo left at screen 0.0,0.0 offset character 1,3 font \",12\" tc \"blue\"

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 座標枠と枠刻みの設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
b="set tics; unset ztics; set border 1+2+4+8"	# @b    = 座標枠と枠刻みの表  示（平面のみ）
nob="unset tics; unset border"					# @nob  = 座標枠と枠刻みの非表示

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 曲線重なり    の設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
h="set hidden3d"								# @h    = 曲線重なりの非表示
noh="unset hidden3d"							# @noh  = 曲線重なりの表  示

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 凡  例        の設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
t="set key"										# @t    = 凡  例の表  示
not="unset key"									# @not  = 凡  例の非表示

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# グラフスケールの設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
leo  = "size= 10000; @set_range3"
meo  = "size= 30000; @set_range3"
geo  = "size= 50000; @set_range3"
deep = "size=350000; @set_range3"
gps = meo

set_range3 = "set xrange [-size:+size]; set yrange [-size:+size]; set zrange [-size:+size]; set isosample 2"

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 特殊データ形式の設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
unixtime="set xdata time; set timefmt \"%s\"      ; set format x" # @unixtime "出力書式" -> データファイル(UnixTime  値)利用 & 出力書式は指定
yyyymmdd="set xdata time; set timefmt \"%Y-%m-%d\"; set format x" # @yyyymmdd "出力書式" -> データファイル(YYYY-MM-DD値)利用 & 出力書式は指定

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 使用方法の表示用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
usage="\n\
    Usage: splot @e, \"file\" ***     ### Splot Earth & 3D-Axis, \"file\" ...\n\
    \n\
    > *** = @d , @p , @l , @lp  <- plot {dot,point,line,line+point} at (X,Y,Z) - Fixed Color\n\
    > *** = @cd, @cp, @cl, @clp <- plot {dot,point,line,line+point} at (X,Y,Z) - Varia Color\n\
    > *** = @n                  <- draw {All} Name at (X,Y,Z)\n\
    > *** = @v                  <- draw {All} Vect at (X,Y,Z)\n\
    \n\
    @leo   | @meo   | @geo   | @deep  -> Set Graph Scale for LEO|MEO|GEO|DeepSpace\n\
    @[no]b | @[no]h | @[no]t          -> (ENA/DIS) InfoLabel|Border|Hidden-3D|Title(Key)\n\
    MiscInfo=\"***\" ; @lmi             -> Load MiscInfo Label from MiscInfo Variable\n\
"

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
#(マクロの初期値)
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
@b
@h
@not
@leo

#print usage
