diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index c42848ec..10c59756 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -13,9 +13,13 @@ function _create_plot(pkg::GLVisualizePackage; kw...) d = Dict(kw) # TODO: create the window/canvas/context that is the plot within the backend (call it `o`) # TODO: initialize the plot... title, xlabel, bgcolor, etc + + # TODO: this should be moved to the display method? w,r=GLVisualize.glscreen() @async r() - Plot(GLScreenWrapper(w,r), pkg, 0, d, Dict[]) + o = GLScreenWrapper(w,r) + + Plot(o, pkg, 0, d, Dict[]) end @@ -23,8 +27,12 @@ function _add_series(::GLVisualizePackage, plt::Plot; kw...) d = Dict(kw) # TODO: add one series to the underlying package push!(plt.seriesargs, d) - x,y,z=map(Float32,d[:x]), map(Float32,d[:y]), map(Float32,d[:surface].surf) - GLVisualize.view(GLVisualize.visualize(x*ones(y)', ones(x)*y', z, :surface)) + + # TODO: this should be moved to the display method? + x, y, z = map(Float32, d[:x]), map(Float32, d[:y]), map(Float32, d[:z].surf) + viz = GLVisualize.visualize(x*ones(y)', ones(x)*y', z, :surface) + GLVisualize.view(viz) + plt end @@ -51,13 +59,16 @@ end # accessors for x/y data function Base.getindex(plt::Plot{GLVisualizePackage}, i::Int) - series = plt.o.lines[i] - series.x, series.y + # TODO: + # series = plt.o.lines[i] + # series.x, series.y + nothing, nothing end function Base.setindex!(plt::Plot{GLVisualizePackage}, xy::Tuple, i::Integer) - series = plt.o.lines[i] - series.x, series.y = xy + # TODO: + # series = plt.o.lines[i] + # series.x, series.y = xy plt end @@ -83,6 +94,10 @@ end function Base.display(::PlotsDisplay, plt::Plot{GLVisualizePackage}) # TODO: display/show the plot + + # NOTE: I think maybe this should be empty? We can start with the assumption that creating + # and adding to a plot will automatically open a window and draw to it, then the display + # wouldn't actually need to do anything end function Base.display(::PlotsDisplay, plt::Subplot{GLVisualizePackage})