Skip to content

Commit fb5792c

Browse files
authored
generalize the integer type support on mesh3d in GR (#5107)
1 parent f54c59b commit fb5792c

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

PlotsBase/ext/GRExt.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,14 +2147,14 @@ function gr_draw_surface(series, x, y, z, clims)
21472147
GR.setfillcolorind(0)
21482148
GR.surface(x, y, z, get(e_kwargs, :display_option, GR.OPTION_FILLED_MESH))
21492149
elseif st :mesh3d
2150-
if series[:connections] isa AbstractVector{<:AbstractVector{Int}}
2150+
if series[:connections] isa AbstractVector{<:AbstractVector{<:Integer}}
21512151
# Combination of any polygon types
21522152
cns = map(cns -> [length(cns), cns...], series[:connections])
2153-
elseif series[:connections] isa AbstractVector{NTuple{N,Int}} where {N}
2153+
elseif series[:connections] isa AbstractVector{NTuple{N,<:Integer}} where {N}
21542154
# Only N-gons - connections have to be 1-based (indexing)
21552155
N = length(series[:connections][1])
21562156
cns = map(cns -> [N, cns...], series[:connections])
2157-
elseif series[:connections] isa NTuple{3,<:AbstractVector{Int}}
2157+
elseif series[:connections] isa NTuple{3,<:AbstractVector{<:Integer}}
21582158
# Only triangles - connections have to be 0-based (indexing)
21592159
ci, cj, ck = series[:connections]
21602160
if !(length(ci) == length(cj) == length(ck))

PlotsBase/test/test_misc.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,22 @@ with(:gr) do
306306
fillcolor = :blue,
307307
fillalpha = 0.2,
308308
)
309+
# Validate still works when we iuse different int types
310+
mesh3d(
311+
x,
312+
y,
313+
z;
314+
connections = [
315+
Int32[1, 2, 4, 3], # Quadrangle
316+
Int32[1, 2, 5], # Triangle
317+
Int32[2, 4, 5], # Triangle
318+
Int32[4, 3, 5], # Triangle
319+
Int32[3, 1, 5], # Triangle
320+
],
321+
linecolor = :black,
322+
fillcolor = :blue,
323+
fillalpha = 0.2,
324+
)
309325
@test true
310326
end
311327

0 commit comments

Comments
 (0)