Add support for Surface plots.

This commit is contained in:
MA Laforge 2018-02-06 06:26:07 -05:00
parent 91cd6c1954
commit bde415edd7

View File

@ -167,6 +167,7 @@ function _initialize_backend(::HDF5Backend)
# "PLOTTEXT" => PlotText, # "PLOTTEXT" => PlotText,
"COLORGRADIENT" => ColorGradient, "COLORGRADIENT" => ColorGradient,
"AXIS" => Axis, "AXIS" => Axis,
"SURFACE" => Surface,
"SUBPLOT" => Subplot, "SUBPLOT" => Subplot,
"NULLABLE" => Nullable, "NULLABLE" => Nullable,
) )
@ -407,6 +408,11 @@ function _hdf5plot_gwrite(grp, k::String, v::Axis)
_hdf5plot_writetype(grp, Axis) _hdf5plot_writetype(grp, Axis)
return return
end end
function _hdf5plot_gwrite(grp, k::String, v::Surface)
grp = HDF5.g_create(grp, k)
_hdf5plot_gwrite(grp, "data2d", v.surf)
_hdf5plot_writetype(grp, Surface)
end
#TODO: "Properly" support Nullable using _hdf5plot_writetype? #TODO: "Properly" support Nullable using _hdf5plot_writetype?
function _hdf5plot_gwrite(grp, k::String, v::Nullable) function _hdf5plot_gwrite(grp, k::String, v::Nullable)
if isnull(v) if isnull(v)
@ -577,6 +583,11 @@ function _hdf5plot_read(grp, k::String, T::Type{Axis}, dtid)
_hdf5plot_read(grp, kwlist) _hdf5plot_read(grp, kwlist)
return Axis([], kwlist) return Axis([], kwlist)
end end
function _hdf5plot_read(grp, k::String, T::Type{Surface}, dtid)
grp = HDF5.g_open(grp, k)
data2d = _hdf5plot_read(grp, "data2d")
return Surface(data2d)
end
function _hdf5plot_read(grp, k::String, T::Type{Subplot}, dtid) function _hdf5plot_read(grp, k::String, T::Type{Subplot}, dtid)
grp = HDF5.g_open(grp, k) grp = HDF5.g_open(grp, k)
idx = _hdf5plot_read(grp, "index") idx = _hdf5plot_read(grp, "index")