commit
0bd76ef7a4
@ -1,4 +1,4 @@
|
|||||||
``#=
|
#=
|
||||||
TODO
|
TODO
|
||||||
* move all gl_ methods to GLPlot
|
* move all gl_ methods to GLPlot
|
||||||
* integrate GLPlot UI
|
* integrate GLPlot UI
|
||||||
@ -7,7 +7,6 @@ TODO
|
|||||||
* polar plots
|
* polar plots
|
||||||
* labes and axis
|
* labes and axis
|
||||||
* fix units in all visuals (e.g dotted lines, marker scale, surfaces)
|
* fix units in all visuals (e.g dotted lines, marker scale, surfaces)
|
||||||
* why is there so little unicode supported in the font!??!?
|
|
||||||
=#
|
=#
|
||||||
|
|
||||||
const _glvisualize_attr = merge_with_base_supported([
|
const _glvisualize_attr = merge_with_base_supported([
|
||||||
@ -134,11 +133,6 @@ function empty_screen!(screen)
|
|||||||
end
|
end
|
||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
function poll_reactive()
|
|
||||||
# run_till_now blocks when message queue is empty!
|
|
||||||
Base.n_avail(Reactive._messages) > 0 && Reactive.run_till_now()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function get_plot_screen(list::Vector, name, result = [])
|
function get_plot_screen(list::Vector, name, result = [])
|
||||||
for elem in list
|
for elem in list
|
||||||
@ -155,19 +149,20 @@ function get_plot_screen(screen, name, result = [])
|
|||||||
end
|
end
|
||||||
|
|
||||||
function create_window(plt::Plot{GLVisualizeBackend}, visible)
|
function create_window(plt::Plot{GLVisualizeBackend}, visible)
|
||||||
name = Symbol("Plots.jl")
|
name = Symbol("__Plots.jl")
|
||||||
# make sure we have any screen open
|
# make sure we have any screen open
|
||||||
if isempty(GLVisualize.get_screens())
|
if isempty(GLVisualize.get_screens())
|
||||||
# create a fresh, new screen
|
# create a fresh, new screen
|
||||||
parent_screen = GLVisualize.glscreen(
|
parent_screen = GLVisualize.glscreen(
|
||||||
"Plot",
|
"Plots",
|
||||||
resolution = plt[:size],
|
resolution = plt[:size],
|
||||||
visible = visible
|
visible = visible
|
||||||
)
|
)
|
||||||
@async GLWindow.waiting_renderloop(parent_screen)
|
@async GLWindow.waiting_renderloop(parent_screen)
|
||||||
|
GLVisualize.add_screen(parent_screen)
|
||||||
end
|
end
|
||||||
# now lets get ourselves a permanent Plotting screen
|
# now lets get ourselves a permanent Plotting screen
|
||||||
plot_screens = get_plot_screen(GLVisualize.get_screens(), name)
|
plot_screens = get_plot_screen(GLVisualize.current_screen(), name)
|
||||||
screen = if isempty(plot_screens) # no screen with `name`
|
screen = if isempty(plot_screens) # no screen with `name`
|
||||||
parent = GLVisualize.current_screen()
|
parent = GLVisualize.current_screen()
|
||||||
screen = GLWindow.Screen(
|
screen = GLWindow.Screen(
|
||||||
@ -183,7 +178,7 @@ function create_window(plt::Plot{GLVisualizeBackend}, visible)
|
|||||||
else
|
else
|
||||||
# okay this is silly! Lets see if we can. There is an ID we could use
|
# okay this is silly! Lets see if we can. There is an ID we could use
|
||||||
# will not be fine for more than 255 screens though -.-.
|
# will not be fine for more than 255 screens though -.-.
|
||||||
error("multiple Plot screens. Please don't use any screen with the name Plots.jl")
|
error("multiple Plot screens. Please don't use any screen with the name $name")
|
||||||
end
|
end
|
||||||
# Since we own this window, we can do deep cleansing
|
# Since we own this window, we can do deep cleansing
|
||||||
empty_screen!(screen)
|
empty_screen!(screen)
|
||||||
@ -1141,8 +1136,7 @@ function _display(plt::Plot{GLVisualizeBackend}, visible = true)
|
|||||||
vis = gl_bar(d, kw_args)
|
vis = gl_bar(d, kw_args)
|
||||||
elseif st == :image
|
elseif st == :image
|
||||||
extract_extrema(d, kw_args)
|
extract_extrema(d, kw_args)
|
||||||
z = transpose_z(series, d[:z].surf, false)
|
vis = GL.gl_image(d[:z].surf, kw_args)
|
||||||
vis = GL.gl_image(z, kw_args)
|
|
||||||
elseif st == :boxplot
|
elseif st == :boxplot
|
||||||
extract_c(d, kw_args, :fill)
|
extract_c(d, kw_args, :fill)
|
||||||
vis = gl_boxplot(d, kw_args)
|
vis = gl_boxplot(d, kw_args)
|
||||||
@ -1182,7 +1176,7 @@ function _display(plt::Plot{GLVisualizeBackend}, visible = true)
|
|||||||
if _3d
|
if _3d
|
||||||
GLAbstraction.center!(sp_screen)
|
GLAbstraction.center!(sp_screen)
|
||||||
end
|
end
|
||||||
Reactive.post_empty()
|
GLAbstraction.post_empty()
|
||||||
yield()
|
yield()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1422,6 +1416,8 @@ function label_scatter(d, w, ho)
|
|||||||
color = get(kw, :color, nothing)
|
color = get(kw, :color, nothing)
|
||||||
kw[:color] = isa(color, Array) ? first(color) : color
|
kw[:color] = isa(color, Array) ? first(color) : color
|
||||||
end
|
end
|
||||||
|
strcolor = get(kw, :stroke_color, RGBA{Float32}(0,0,0,0))
|
||||||
|
kw[:stroke_color] = isa(strcolor, Array) ? first(strcolor) : strcolor
|
||||||
p = get(kw, :primitive, GeometryTypes.Circle)
|
p = get(kw, :primitive, GeometryTypes.Circle)
|
||||||
if isa(p, GLNormalMesh)
|
if isa(p, GLNormalMesh)
|
||||||
bb = GeometryTypes.AABB{Float32}(GeometryTypes.vertices(p))
|
bb = GeometryTypes.AABB{Float32}(GeometryTypes.vertices(p))
|
||||||
@ -1436,6 +1432,9 @@ function label_scatter(d, w, ho)
|
|||||||
kw[:scale] = Vec3f0(w/2)
|
kw[:scale] = Vec3f0(w/2)
|
||||||
delete!(kw, :offset)
|
delete!(kw, :offset)
|
||||||
end
|
end
|
||||||
|
if isa(p, Array)
|
||||||
|
kw[:primitive] = GeometryTypes.Circle
|
||||||
|
end
|
||||||
GL.gl_scatter(Point2f0[(w/2, ho)], kw)
|
GL.gl_scatter(Point2f0[(w/2, ho)], kw)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user