Skip to content

Commit ac218dd

Browse files
author
Vincent Landau
committed
fix show(), print to IO
1 parent fbacee0 commit ac218dd

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/show.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
import Base: show
22

33
function show(io::IO, g::AbstractRasterGraph)
4-
printstyled("$(typeof(g))\n", color=:blue)
5-
printstyled(" graph", color=:red)
6-
print(": $(typeof(g.graph)) with $(nv(g)) vertices and $(ne(g)) edges\n")
4+
printstyled(io, "$(typeof(g))", color=:blue)
5+
print(io, ":\n")
6+
printstyled(io, " graph", color=:red)
7+
print(io, ": $(typeof(g.graph)) with $(nv(g)) vertices and $(ne(g)) edges\n")
78

8-
printstyled(" vertex_raster", color=:red)
9+
printstyled(io, " vertex_raster", color=:red)
910
print(
11+
io,
1012
": $(string(nameof(typeof(g.vertex_raster))))" *
1113
"{$(eltype(g.vertex_raster)), $(length(dims(g.vertex_raster)))}"
1214
)
13-
printstyled(" with dimensions:\n", color=:light_black)
15+
printstyled(io, " with dimensions:\n", color=:light_black)
1416

1517
x_dim = dims(g.vertex_raster, X)
1618
y_dim = dims(g.vertex_raster, Y)
17-
printstyled(" X", color=:cyan)
19+
printstyled(io, " X", color=:cyan)
1820
print(
21+
io,
1922
": range($(minimum(x_dim)), $(maximum(x_dim)), step=$(x_dim.val[2] - x_dim.val[1]))\n"
2023

2124
)
22-
printstyled(" Y", color=:cyan)
25+
printstyled(io, " Y", color=:cyan)
2326
print(
27+
io,
2428
": range($(minimum(y_dim)), $(maximum(y_dim)), step=$(y_dim.val[2] - y_dim.val[1]))"
2529
)
2630
if (hasdim(g.vertex_raster, Band))
2731
band_dim = dims(g.vertex_raster, Band)
28-
printstyled("\n Band", color=:cyan)
32+
printstyled(io, "\n Band", color=:cyan)
2933
print(
34+
io,
3035
": $(minimum(band_dim)):$(maximum(band_dim))"
3136
)
3237
end

0 commit comments

Comments
 (0)