-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Predefined objects and improved user experience #313
Comments
Would also like to hear your thoughts on this @Sov-trotter |
I think this task in general has tons of possibilities. I am not yet ready with a concrete design yet. For now I think we need a general data structure/API to store not just the start point but any information in general, hence a mutable |
Oh yeah for sure. This was just an example. Each |
Hey @Wikunia , @TheCedarPrince I was thinking about how this could be done and came up with the following
function Line(p1, p2)
return (video, object, frame; kwargs...) -> begin push!(object.metadata, Dict(:p1=>p1, :p2=>p2)); line(p1, p2, :stroke); end
end
myline = Object(1:100, Line(p1, p2)) To change an end point for the line,
CustomObject(<frames>, <custom object specific args>, <custom draw function>, <start pos>; <optional keyword arguments>) |
The
Can you explain the problem here again? The points |
The way I look at metadata is something similar to what has been done in the GeometryBasics.jl package -> https://github.com/JuliaGeometry/GeometryBasics.jl/blob/master/src/metadata.jl#L181-L210 and https://juliageometry.github.io/GeometryBasics.jl/dev/metadata/ |
Yes, we definitely don't need to push it for every frames. The
I was thinking that if points Hey @Sov-trotter , I see the We could use multiple dispatch and provide versions of the |
So metadata can be attached to anything(not necessarily to shapes or an entire video). We obvoiusly don't need to stick with the implementation in GeometryBasics.jl since it's more tuned for geospatial data with millions of rows of geometries and metadata.
So that's why we can use a macro to generate |
I am trying to wrap my head around the way this is done in GeometryBasics.jl, so if we have a But does a user need to call the |
So what the metatype macro does is create a struct eg: This is helpful as it avoids much manual labour. |
I think having a I am looking at a syntax like this @Object(1:100, Line(p1, p2))
or
@Object 1:100 Line(p1, p2) O This can also be extended to a list of objects @Object 1:100 [Line(p1, p2), Line(p2, p3)] O I was also hoping the following would be possible @Object 1:100 Line(p1, p2) Line(p2, p3) O but it would be difficult to parse this since there are also a variable number of keyword arguments passed to the The separation can be thought to be made on whether a drawing function or a custom shape was being passed as an argument. What are your thoughts on it? |
The problem we have with macros is that we can't use extensive dispatching functionality. I think we might be able to transform this into Object(1:100, (args...; p1=p1, p2=p2) -> Line(p1,p2)) Not sure though whether that helps as we will have the same problem with things like: @Object 1:100 Line(pos(o1),pos(o2)) where we want to call the functions at runtime. In that case it would only work if we just keep |
Also, if the following manner of creating an object is supported Object(1:100, [Line(p1, p2), Line(p2, p3)]) we will need to make the change keywords explicit to each "sub-object" or do some manipulation when calling the drawing functions of each "sub-object" individually so that only the keywords it requires are passed to it during calling it. |
This shouldn't be closed just yet? Or a separate issue to address metadata related discussion? |
I'm currently unsure of what you're referring to but maybe it's best to open another issue for it. 😊 |
I was referring to the fact that we still need a metadata implementation. |
Is your feature request related to a problem? Please explain.
I feel like writing anonymous functions is sometimes a pain and it doesn't contain much structure if everything is an
Object
.Describe the solution you'd like
I'm wondering if it makes sense to have some types for
Line, Circle, Rectangle, Polygon
etc. and one can write:such that the line gets drawn (see #218 )
and maybe also
such that we can concatenate line segments easily.
Additionally each object could have some properties like,
start_point
,end_point
for line andradius
andcenter
for Circle.Then one would be able to write:
where the
start_point
field is an anonymous function which has access to the start point of the line.The main point for
Line
and the other objects is also that we can define them ourselves on top of Luxor and be able to specify all possible options to it likecolor
,width
for which one currently needs to write anonymous functions.Old functionality should not be destroyed by this but just extended and it should be simple for the user to define their own objects.
Describe alternatives you've considered
I considered using
but it feels better to have the
Object
around it which takes care of the frames.This might also somehow make it easier to work with #130 .
@TheCedarPrince What do you think and feel free to rename this issue as naming is hard 😄
The text was updated successfully, but these errors were encountered: