-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from dlfivefifty/dev
Add initial support for GLVisualize
- Loading branch information
Showing
4 changed files
with
191 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
|
||
# [WEBSITE] | ||
|
||
# --------------------------------------------------------------------------- | ||
|
||
immutable GLScreenWrapper | ||
window | ||
render | ||
end | ||
|
||
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 | ||
w,r=GLVisualize.glscreen() | ||
@async r() | ||
Plot(GLScreenWrapper(w,r), pkg, 0, d, Dict[]) | ||
end | ||
|
||
|
||
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)) | ||
plt | ||
end | ||
|
||
function _add_annotations{X,Y,V}(plt::Plot{GLVisualizePackage}, anns::AVec{@compat(Tuple{X,Y,V})}) | ||
for ann in anns | ||
# TODO: add the annotation to the plot | ||
end | ||
end | ||
|
||
# ---------------------------------------------------------------- | ||
|
||
function _before_update_plot(plt::Plot{GLVisualizePackage}) | ||
end | ||
|
||
# TODO: override this to update plot items (title, xlabel, etc) after creation | ||
function _update_plot(plt::Plot{GLVisualizePackage}, d::Dict) | ||
end | ||
|
||
function _update_plot_pos_size(plt::PlottingObject{GLVisualizePackage}, d::Dict) | ||
end | ||
|
||
# ---------------------------------------------------------------- | ||
|
||
# accessors for x/y data | ||
|
||
function Base.getindex(plt::Plot{GLVisualizePackage}, i::Int) | ||
series = plt.o.lines[i] | ||
series.x, series.y | ||
end | ||
|
||
function Base.setindex!(plt::Plot{GLVisualizePackage}, xy::Tuple, i::Integer) | ||
series = plt.o.lines[i] | ||
series.x, series.y = xy | ||
plt | ||
end | ||
|
||
# ---------------------------------------------------------------- | ||
|
||
function _create_subplot(subplt::Subplot{GLVisualizePackage}) | ||
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example | ||
end | ||
|
||
function _expand_limits(lims, plt::Plot{GLVisualizePackage}, isx::Bool) | ||
# TODO: call expand limits for each plot data | ||
end | ||
|
||
function _remove_axis(plt::Plot{GLVisualizePackage}, isx::Bool) | ||
# TODO: if plot is inner subplot, might need to remove ticks or axis labels | ||
end | ||
|
||
# ---------------------------------------------------------------- | ||
|
||
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{GLVisualizePackage}) | ||
# TODO: write a png to io | ||
end | ||
|
||
function Base.display(::PlotsDisplay, plt::Plot{GLVisualizePackage}) | ||
# TODO: display/show the plot | ||
end | ||
|
||
function Base.display(::PlotsDisplay, plt::Subplot{GLVisualizePackage}) | ||
# TODO: display/show the subplot | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters