@@ -8,40 +8,40 @@ using InteractiveUtils
88using Leptonica_jll
99
1010struct CTRLstruct
11- limits:: Vector{Float64} # To store the data limits. First 6 store: data limits. Second 6: plot limits, 13th +r
12- figsize:: Vector{Float64} # To store the current fig size (xsize,ysize[,zsize]). Needed, for example, in hexbin
13- proj_linear:: Vector{Bool} # To know if images sent to GMT need Pad
14- returnPS:: Vector{Bool} # To know if returning the PS to Julia
15- callable:: Vector{Symbol} # Modules that can be called inside other modules
16- pocket_B:: Vector{String} # To temporarily store opt_B grid and fill color to be reworked in psclip
17- pocket_J:: Vector{String} # To temporarily store opt_J and fig size to eventualy flip directions (y + down, etc)
11+ limits:: Vector{Float64} # To store the data limits. First 6 store: data limits. Second 6: plot limits, 13th +r
12+ figsize:: Vector{Float64} # To store the current fig size (xsize,ysize[,zsize]). Needed, for example, in hexbin
13+ proj_linear:: Vector{Bool} # To know if images sent to GMT need Pad
14+ returnPS:: Vector{Bool} # To know if returning the PS to Julia
15+ callable:: Vector{Symbol} # Modules that can be called inside other modules
16+ pocket_B:: Vector{String} # To temporarily store opt_B grid and fill color to be reworked in psclip
17+ pocket_J:: Vector{String} # To temporarily store opt_J and fig size to eventualy flip directions (y + down, etc)
1818 # = [opt_J width opt_Jz codes-to-tell-which-axis-to-reverse]
19- pocket_R:: Vector{String} # To temporarily store opt_R
20- XYlabels:: Vector{String} # To temporarily store the x,y col names to let x|y labels know what to plot (if "auto")
21- IamInPaperMode:: Vector{Bool} # A 2 elem vec to know if we are in under-the-hood paper mode. 2nd traces if first call
22- gmt_mem_bag:: Vector{Ptr{Cvoid}} # To temporarily store a GMT owned memory to be freed in gmt()
23- pocket_d:: Vector{Dict{Symbol,Any}} # To pass the Dict of kwargs, after consumption, to other modules.
19+ pocket_R:: Vector{String} # To temporarily store opt_R
20+ XYlabels:: Vector{String} # To temporarily store the x,y col names to let x|y labels know what to plot (if "auto")
21+ IamInPaperMode:: Vector{Bool} # A 2 elem vec to know if we are in under-the-hood paper mode. 2nd traces if first call
22+ gmt_mem_bag:: Vector{Ptr{Cvoid}} # To temporarily store a GMT owned memory to be freed in gmt()
23+ pocket_d:: Vector{Dict{Symbol,Any}} # To pass the Dict of kwargs, after consumption, to other modules.
2424end
2525
2626mutable struct CTRLstruct2
27- first:: Bool # Signal that we are starting a new plot (used to set params)
28- points:: Bool # If maps are using points as coordinates
29- fname:: String # Store the full name of PS being constructed
27+ first:: Bool # Signal that we are starting a new plot (used to set params)
28+ points:: Bool # If maps are using points as coordinates
29+ fname:: String # Store the full name of PS being constructed
3030end
3131
3232mutable struct TMPDIRInfo
33- dir:: String # Temporary directory path
34- username:: String # Username (spaces replaced with underscores)
35- pid_suffix:: String # PID suffix for multi-process support
33+ dir:: String # Temporary directory path
34+ username:: String # Username (spaces replaced with underscores)
35+ pid_suffix:: String # PID suffix for multi-process support
3636end
3737
3838mutable struct InsetInfo
39- active:: Bool # Whether currently in inset mode
40- has_J:: Bool # Whether -J projection option was provided (GMT bug #7005 workaround)
39+ active:: Bool # Whether currently in inset mode
40+ has_J:: Bool # Whether -J projection option was provided (GMT bug #7005 workaround)
4141end
4242
43- depfile = joinpath (dirname (@__FILE__ ), " .." , " deps" , " deps.jl" )# File with shared lib names
44- isfile (depfile) && include (depfile)# This loads the shared libs names in the case of NON-JLL, otherwise just return
43+ depfile = joinpath (dirname (@__FILE__ ), " .." , " deps" , " deps.jl" ) # File with shared lib names
44+ isfile (depfile) && include (depfile) # This loads the shared libs names in the case of NON-JLL, otherwise just return
4545
4646if ((! (@isdefined have_jll) || have_jll == 1 ) && get (ENV , " SYSTEMWIDE_GMT" , " " ) == " " )# That is, the JLL case
4747 using GMT_jll, GDAL_jll, PROJ_jll, Ghostscript_jll
@@ -53,52 +53,52 @@ if ((!(@isdefined have_jll) || have_jll == 1) && get(ENV, "SYSTEMWIDE_GMT", "")
5353 const GMTbin = GMT_jll. gmt ()[1 ]
5454 const isJLL = true
5555 fname = joinpath (GMTuserdir[1 ], " ghost_jll_path.txt" )
56- ! isdir (GMTuserdir[1 ]) && mkdir (GMTuserdir[1 ])# When installing on a clean no GMT sys, ~/.gmt doesn't exist
56+ ! isdir (GMTuserdir[1 ]) && mkdir (GMTuserdir[1 ]) # When installing on a clean no GMT sys, ~/.gmt doesn't exist
5757 open (fname, " w" ) do f
58- write (f, GSbin)# Save this to be used by psconvert.c
58+ write (f, GSbin) # Save this to be used by psconvert.c
5959 end
6060else
6161 const isJLL = false
6262 const GMTver, libgmt, libgdal, libproj, GMTuserdir, GMTbin = _GMTver, _libgmt, _libgdal, _libproj, [userdir], " gmt"
63- const GMTdevdate = Date (devdate, dateformat " y.m.d" )# 'devdate' comes from reading 'deps.jl'
63+ const GMTdevdate = Date (devdate, dateformat " y.m.d" ) # 'devdate' comes from reading 'deps.jl'
6464end
6565
6666const G_API = Ref {Ptr{Cvoid}} (C_NULL )
67- const PSname = Ref {String} (" " )# The PS file (filled in __init__) where, in classic mode, all lands.
68- const TMPDIR_USR = TMPDIRInfo (tempdir (), " " , " " )# Save the tmp dir and user name (also filled in __init__)
67+ const PSname = Ref {String} (" " ) # The PS file (filled in __init__) where, in classic mode, all lands.
68+ const TMPDIR_USR = TMPDIRInfo (tempdir (), " " , " " ) # Save the tmp dir and user name (also filled in __init__)
6969const global TESTSDIR = joinpath (dirname (pathof (GMT))[1 : end - 4 ], " test" , " " )# To have easy access to test files
70- const IMG_MEM_LAYOUT = Ref {String} (" " )# "TCP" For Images.jl. The default is "TRBa"
71- const GRD_MEM_LAYOUT = Ref {String} (" " )# "BRP" is the default for GMT PS images.
72- const CURRENT_VIEW = Ref {String} (" " )# To store the current viewpoint (-p)
73- const MULTI_COL = Ref {Bool} (false )# To allow plottig multiple columns at once.
74- const IamModern = Ref {Bool} (false )# To know if we are in modern mode
75- const FirstModern = Ref {Bool} (false )# To know
76- const DidOneGmtCmd = Ref {Bool} (false )# To know when first gmt() call. Used in first modern mode cmd to not restart what is still fresh
77- const IamModernBySubplot = Ref {Bool} (false )# To know if set in subpot
78- const IamSubplot = Ref {Bool} (false )# To know if we are in subplot mode
79- const IamInset = InsetInfo (false , false )# To know if we are in Inset mode
80- const usedConfPar = Ref {Bool} (false )# Hacky solution for the session's memory trouble
81- const ThemeIsOn = Ref {Bool} (false )# To know if we have an active plot theme
82- const CONVERT_SYNTAX = Ref {Bool} (false )# To only convert to hard core GMT syntax (like Vd=2)
83- const SHOW_KWARGS = Ref {Bool} (false )# To just print the kwargs of a option call)
84- const isFranklin = Ref {Bool} (false )# Only set/unset by the Docs building scripts.
85- const isJupyter = Ref {Bool} (false )# Jupyter and Modern need special treatment (Quarto).
86- const isPSclosed = Ref {Bool} (false )# Modern mode will close the PS at the end. We need to know that
87- const noGrdCopy = Ref {Bool} (false )# If true, grids are sent without transpose/copy
88- const GMTCONF = Ref {Bool} (false )# Flag if gmtset was used and must be 'unused'
89- const FMT = Ref {String} (" png" )# The default plot format
90- const BOX_STR = Ref {String} (" " )# Used in plotyy to know -R of first call
70+ const IMG_MEM_LAYOUT = Ref {String} (" " ) # "TCP" For Images.jl. The default is "TRBa"
71+ const GRD_MEM_LAYOUT = Ref {String} (" " ) # "BRP" is the default for GMT PS images.
72+ const CURRENT_VIEW = Ref {String} (" " ) # To store the current viewpoint (-p)
73+ const MULTI_COL = Ref {Bool} (false ) # To allow plottig multiple columns at once.
74+ const IamModern = Ref {Bool} (false ) # To know if we are in modern mode
75+ const FirstModern = Ref {Bool} (false ) # To know
76+ const DidOneGmtCmd = Ref {Bool} (false ) # To know when first gmt() call. Used in first modern mode cmd to not restart what is still fresh
77+ const IamModernBySubplot = Ref {Bool} (false ) # To know if set in subpot
78+ const IamSubplot = Ref {Bool} (false ) # To know if we are in subplot mode
79+ const IamInset = InsetInfo (false , false ) # To know if we are in Inset mode
80+ const usedConfPar = Ref {Bool} (false ) # Hacky solution for the session's memory trouble
81+ const ThemeIsOn = Ref {Bool} (false ) # To know if we have an active plot theme
82+ const CONVERT_SYNTAX = Ref {Bool} (false ) # To only convert to hard core GMT syntax (like Vd=2)
83+ const SHOW_KWARGS = Ref {Bool} (false ) # To just print the kwargs of a option call)
84+ const isFranklin = Ref {Bool} (false ) # Only set/unset by the Docs building scripts.
85+ const isJupyter = Ref {Bool} (false ) # Jupyter and Modern need special treatment (Quarto).
86+ const isPSclosed = Ref {Bool} (false ) # Modern mode will close the PS at the end. We need to know that
87+ const noGrdCopy = Ref {Bool} (false ) # If true, grids are sent without transpose/copy
88+ const GMTCONF = Ref {Bool} (false ) # Flag if gmtset was used and must be 'unused'
89+ const FMT = Ref {String} (" png" ) # The default plot format
90+ const BOX_STR = Ref {String} (" " ) # Used in plotyy to know -R of first call
9191const POSTMAN = Ref {Dict{String,String}} (Dict {String,String} ()) # To pass messages to functions (start with get_dataset)
92- const DEF_FIG_SIZE = " 15c/10c" # Default fig size for plot like programs. Approx 16/11
93- const DEF_FIG_AXES_BAK = " -Baf -BWSen" # Default fig axes for plot like programs
94- const DEF_FIG_AXES3_BAK = " -Baf -Bza" # "" but for 3D views
95- const DEF_FIG_AXES = Ref {String} (DEF_FIG_AXES_BAK) # This one may be be changed by theme()
96- const DEF_FIG_AXES3 = Ref {String} (DEF_FIG_AXES3_BAK) # ""
92+ const DEF_FIG_SIZE = " 15c/10c" # Default fig size for plot like programs. Approx 16/11
93+ const DEF_FIG_AXES_BAK = " -Baf -BWSen" # Default fig axes for plot like programs
94+ const DEF_FIG_AXES3_BAK = " -Baf -Bza" # "" but for 3D views
95+ const DEF_FIG_AXES = Ref {String} (DEF_FIG_AXES_BAK) # This one may be be changed by theme()
96+ const DEF_FIG_AXES3 = Ref {String} (DEF_FIG_AXES3_BAK)# ""
9797const FIG_MARGIN = Ref {Int} (1 ) # Figure margin in points after convertion by 'psconvert'. Accessible 'margin' common option
9898const global CTRL = CTRLstruct (zeros (13 ), zeros (6 ), [true ], [false ],
9999 [:arrows , :bubblechart , :basemap , :band , :clip , :coast , :colorbar , :grdcontour , :hband , :hlines , :inset , :logo , :lines , :grdvector , :plot , :plot3 , :quiver , :scatter , :scatter3 , :stairs , :text , :vlines , :vband ], [" " , " " , " " ], [" " , " " , " " , " " ], [" " , " " ], [" " , " " ], [false , true ], [C_NULL ], [Dict ()])
100100const pocket_call = Ref {Vector{Any}} (Any[nothing , nothing , nothing , nothing , nothing , nothing ])# Extracted from CTRL to isolate type instability
101- const CTRLshapes = CTRLstruct2 (true , true , " " )# Used in sub-module Drawing
101+ const CTRLshapes = CTRLstruct2 (true , true , " " ) # Used in sub-module Drawing
102102const prj4WGS84 = " +proj=longlat +datum=WGS84 +units=m +no_defs" # This is used in many places
103103const global CPTaliases = [:C :color :cmap :colormap :colorscale ]
104104const global VMs = Union{Vector{Symbol},Matrix{Symbol}}
0 commit comments