Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolyCanvas error on update #14

Open
kescobo opened this issue Aug 26, 2024 · 5 comments · Fixed by #16
Open

PolyCanvas error on update #14

kescobo opened this issue Aug 26, 2024 · 5 comments · Fixed by #16

Comments

@kescobo
Copy link

kescobo commented Aug 26, 2024

This works:

(jl_03spvp) pkg> st
Status `/tmp/jl_03spvp/Project.toml`
⌃ [e9467ef8] GLMakie v0.8.12
  [5c1252a2] GeometryBasics v0.4.11
⌃ [8315f7d3] MakieDraw v0.2.1
using GLMakie
using MakieDraw
using GeometryBasics

fig = Figure()
ax = Axis(fig[1,1])
scatter!(ax, rand(20), rand(20))

pc = GeometryCanvas{Polygon}(; figure=fig, axis=ax)

When I upgrade, this code runs, but when I click on the axis:

(jl_3RSnhJ) pkg> st
Status `/tmp/jl_3RSnhJ/Project.toml`
  [e9467ef8] GLMakie v0.10.8
  [5c1252a2] GeometryBasics v0.4.11
  [8315f7d3] MakieDraw v0.3.1

julia> Error in callback:
MethodError: Cannot `convert` an object of type
  Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}} to an object of type
  Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}
Full stack trace

Error in callback:
MethodError: Cannot `convert` an object of type
  Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}} to an object of type
  Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:84

Stacktrace:
  [1] setindex!(A::Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}, x::Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}, i1::Int64)
    @ Base ./array.jl:1021
  [2] _unsafe_copyto!(dest::Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}, doffs::Int64, src::Vector{Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}}, soffs::Int64, n::Int64)
    @ Base ./array.jl:299
  [3] unsafe_copyto!
    @ ./array.jl:353 [inlined]
  [4] _copyto_impl!
    @ ./array.jl:376 [inlined]
  [5] copyto!
    @ ./array.jl:363 [inlined]
  [6] copyto!
    @ ./array.jl:385 [inlined]
  [7] copyto_axcheck!
    @ ./abstractarray.jl:1177 [inlined]
  [8] Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}(x::Vector{Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}})
    @ Base ./array.jl:673
  [9] convert(::Type{Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}}, a::Vector{Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}})
    @ Base ./array.jl:665
 [10] setproperty!(x::Observable{Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}}, f::Symbol, v::Vector{Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}})
    @ Base ./Base.jl:40
 [11] setindex!(observable::Observable, val::Any)
    @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:122
 [12] (::MakieDraw.var"#8#13"{UnionAll})(ps::Vector{Vector{Point{2, Float32}}})
    @ MakieDraw ~/.julia/packages/MakieDraw/Vbn12/src/geometry_canvas.jl:150
 [13] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [14] invokelatest
    @ ./essentials.jl:889 [inlined]
 [15] notify
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
 [16] (::MakieDraw.var"#58#64"{Polygon, GeometryCanvas{Polygon, Observable{Vector{Polygon{2, Float64, Point{2, Float64}, L, V} where {L<:(AbstractVector{<:Line{2, Float64}}), V<:AbstractVector{L}}}}, Observable{Vector{Vector{Point{2, Float32}}}}, Observable{Tuple{Int64, Int64}}, Nothing, @NamedTuple{}, @NamedTuple{}, Figure, Axis, Nothing}, Observable{Float64}, Observable{Bool}, Axis, Figure})(event::Makie.MouseButtonEvent)
    @ MakieDraw ~/.julia/packages/MakieDraw/Vbn12/src/geometry_canvas.jl:615
 [17] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [18] invokelatest
    @ ./essentials.jl:889 [inlined]
 [19] notify
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
 [20] setindex!
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123 [inlined]
 [21] (::GLMakie.var"#mousebuttons#167"{Observable{Makie.MouseButtonEvent}})(window::GLFW.Window, button::GLFW.MouseButton, action::GLFW.Action, mods::Int32)
    @ GLMakie ~/.julia/packages/GLMakie/GjxNU/src/events.jl:104
 [22] _MouseButtonCallbackWrapper(window::GLFW.Window, button::GLFW.MouseButton, action::GLFW.Action, mods::Int32)
    @ GLFW ~/.julia/packages/GLFW/wmoTL/src/callback.jl:43
 [23] PollEvents
    @ ~/.julia/packages/GLFW/wmoTL/src/glfw3.jl:702 [inlined]
 [24] pollevents(screen::GLMakie.Screen{GLFW.Window}, frame_state::Makie.TickState)
    @ GLMakie ~/.julia/packages/GLMakie/GjxNU/src/screen.jl:483
 [25] on_demand_renderloop(screen::GLMakie.Screen{GLFW.Window})
    @ GLMakie ~/.julia/packages/GLMakie/GjxNU/src/screen.jl:979
 [26] renderloop(screen::GLMakie.Screen{GLFW.Window})
    @ GLMakie ~/.julia/packages/GLMakie/GjxNU/src/screen.jl:1007
 [27] (::GLMakie.var"#68#69"{GLMakie.Screen{GLFW.Window}})()
    @ GLMakie ~/.julia/packages/GLMakie/GjxNU/src/screen.jl:867

@rafaqz
Copy link
Collaborator

rafaqz commented Aug 26, 2024

Right, actually clicking doesn't happen in the tests 😭

@rafaqz
Copy link
Collaborator

rafaqz commented Aug 26, 2024

Fixed on main, should be registered in a few minutes

@kescobo
Copy link
Author

kescobo commented Aug 27, 2024

Thank you!

@kescobo
Copy link
Author

kescobo commented Aug 27, 2024

Hmm - I'm afraid the issue actually isn't solved - the error is different though!

Error in callback:
MethodError: Cannot `convert` an object of type
  GeometryBasics.Mesh{2,Float64,GeometryBasics.Ngon{2,Float64,3,Point{2,Float64}},FaceView{GeometryBasics.Ngon{2,Float64,3,Point{2,Float64}},Point{2,Float64},NgonFace{3,OffsetInteger{-1,UInt32}},Array{Point{2,Float64},1},Array{NgonFace{3,OffsetInteger{-1,UInt32}},1}}} to an object of type
  GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},Point{2,Float32},NgonFace{3,OffsetInteger{-1,UInt32}},Array{Point{2,Float32},1},Array{NgonFace{3,OffsetInteger{-1,UInt32}},1}}}

@rafaqz rafaqz reopened this Aug 27, 2024
@rafaqz
Copy link
Collaborator

rafaqz commented Aug 27, 2024

Its actually a bug in Makie:

polygons = Observable(Polygon{2,Float64}[])
poly(polygons)
push!(polygons[], Polygon([Point(1.0, 2.0), Point(2.0, 3.0), Point(3.0, 2.0)]))
notify(polygons)

errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@rafaqz @kescobo and others