Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Add indentation in show method #98

Merged
merged 2 commits into from
May 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/lib/overloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ import Base: vcat
import Base: show

"""
Base.show(io::IO, ::MIME"text/plain", layer::T) where {T <: SimpleSDMLayer}
Base.show(io::IO, layer::T) where {T <: SimpleSDMLayer}

Shows a textual representation of the layer.
"""
function Base.show(io::IO, layer::T) where {T <: SimpleSDMLayer}
function Base.show(io::IO, ::MIME"text/plain", layer::T) where {T <: SimpleSDMLayer}
itype = eltype(layer)
otype = T <: SimpleSDMPredictor ? "predictor" : "response"
print(io, """SDM $(otype) → $(size(layer,1))×$(size(layer,2)) grid with $(length(layer)) $(itype)-valued cells
Latitudes\t$(extrema(latitudes(layer)))
Longitudes\t$(extrema(longitudes(layer)))""")
\x20\x20Latitudes\t$(extrema(latitudes(layer)))
\x20\x20Longitudes\t$(extrema(longitudes(layer)))""")
end

function Base.show(io::IO, layer::T) where {T <: SimpleSDMLayer}
itype = eltype(layer)
otype = T <: SimpleSDMPredictor ? "predictor" : "response"
print(io, "SDM $(otype) → $(size(layer,1))×$(size(layer,2)) grid with $(length(layer)) $(itype)-valued cells")
end

"""
Expand Down