Skip to content

Commit c7cce40

Browse files
authored
Fix a regression introduced when the Vd=2 was split from finish_PS_module() (#1830)
* Add some more precompile instructions. * Fix a regression introduced when the Vd=2 was split from finish_PS_module()
1 parent 7f0db13 commit c7cce40

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/GMT.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ include("gmt_types.jl")
216216
include("gdal.jl")
217217
include("gdal_utils.jl")
218218
include("proj_utils.jl")
219-
using GMT.Gdal
220219
const global MatGDsGd = Union{Matrix{<:AbstractFloat}, GMTdataset, Vector{<:GMTdataset}, Gdal.AbstractDataset}
221220
const global CURRENT_CPT = [GMTcpt()] # To store the current palette
222221

@@ -377,7 +376,9 @@ include("libleptonica.jl")
377376
include("lepto_funs.jl")
378377

379378
include("laszip/Laszip.jl")
380-
using GMT.Laszip
379+
380+
using .Gdal
381+
using .Laszip
381382

382383
#include("ImageFeatures/ImageFeatures.jl")
383384
#using GMT.ImageFeatures
@@ -416,9 +417,9 @@ using GMT.Laszip
416417
viz(Glix, show=false);
417418
histogram(randn(100),T=0.1,center=true, Z=:counts)
418419
histogram(I);
419-
#grdlandmask(R="-10/4/37/45", res=:c, inc=0.1);
420-
#grdmask([10 20; 40 40; 70 20; 10 20], R="0/100/0/100", out_edge_in=[100 0 0], I=2);
421-
#grdsample(Glix, inc=0.5);
420+
grdlandmask(R="-10/4/37/45", res=:c, inc=0.1);
421+
grdmask([10 20; 40 40; 70 20; 10 20], R="0/100/0/100", out_edge_in=[100 0 0], I=2);
422+
grdsample(Glix, inc=0.5);
422423
grdtrend(Glix, model=3);
423424
grdtrack(Glix, [1 1]);
424425
coast(R=:g, proj=:guess, W=(level=1,pen=(2,:green)));

src/drawing.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ function helper_shapes(x, y, cmd; Vd=0, kw...)
7878
# Helper function that takes care to all symbols plotting
7979
d = KW(kw)
8080
# Se if we are asked to force the start a new drawing (first= true) or bypass the CTRLshapes.first control
81-
first = find_in_dict(d, [:first])[1]
82-
((isa(first, Bool) && first) || (isa(first, Int) && first != 0)) && (CTRLshapes.first[1] = true)
83-
((isa(first, Bool) && !first) || (isa(first, Int) && first == 0)) && (CTRLshapes.first[1] = false)
81+
_first = find_in_dict(d, [:first])[1]
82+
first = (_first !== nothing) && (_first == 1)
83+
CTRLshapes.first[1] = first
8484

8585
if (CTRLshapes.first[1])
8686
CTRLshapes.fname[1] = PSname[1]
@@ -103,12 +103,13 @@ function helper_shapes(x, y, cmd; Vd=0, kw...)
103103
end
104104
(opt_B == DEF_FIG_AXES[1]) && (opt_B = "") # We don't want a default -B here
105105
opt_O, opt_P = "", " -P"
106-
out, opt_T, EXT, = GMT.fname_out(d)
107106
else
108107
opt_R, opt_J, opt_B, opt_O, opt_P = " -R", " -J", "", " -O", ""
109108
(CTRLshapes.points[1]) && (cmd *= " --PROJ_LENGTH_UNIT=p")
110109
end
111110

111+
out, opt_T, EXT, fname, = GMT.fname_out(d, true)
112+
112113
redirect = (CTRLshapes.first[1]) ? " > " : " >> "
113114
if (length(kw) == 0)
114115
cmd = "psxy" * cmd * opt_R * opt_J * opt_B * opt_P * opt_O * " -K" * redirect * CTRLshapes.fname[1]
@@ -119,6 +120,7 @@ function helper_shapes(x, y, cmd; Vd=0, kw...)
119120
d[:B] = "none"
120121
cmd = GMT.common_plot_xyz("", nothing, cmd, CTRLshapes.first[1], false; d...)
121122
(CTRLshapes.first[1] && opt_B != "") && (cmd = replace(cmd, "psxy" => "psxy" * opt_B))
123+
cmd = GMT.finish_PS(d, cmd, out, true, !first)
122124
end
123125
(0 < Vd < 2) && println(cmd); (Vd > 1) && return cmd
124126

@@ -136,7 +138,6 @@ function helper_shapes(x, y, cmd; Vd=0, kw...)
136138

137139
CTRLshapes.first[1] = true # Better reset it right now in case next command errors
138140
CTRLshapes.points[1] = false
139-
out, opt_T, EXT, fname, = GMT.fname_out(d, true)
140141
#show_non_consumed(d, cmd)
141142
close_PS_file(CTRLshapes.fname[1])
142143
showfig(d, CTRLshapes.fname[1], EXT, opt_T, false, fname)

0 commit comments

Comments
 (0)