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

Fix printing wrapper geoms #150

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

BenCurran98
Copy link

Proposing a fix for this issue where we modify the displayed text for our wrapper geometries. Each geometry can be displayed in "regular" or "compact" form which will influence how much information is shown to the user. This should make things a bit clearer so we don't get spammed with the raw fields that can be hard to follow.

@asinghvi17
Copy link
Member

This looks great, thanks! Love the compactification of the elements you have going on there.

One more thing that I'm thinking we should do is to decrease the number of points printed, so that that any geometry fits on one line. Otherwise you get crazy long strings, aka what we have now, which have crashed my terminal a couple times when ultra long geometries are considered (10k points or higher).

Consider something like the following:

screen_nrows, screen_ncols = displaysize(io)
# limit the number of points plotted to 
# floor((screen_ncols - currently_used_space - 1 #= triple dot character =#) / length_of_one_point_in_chars)
# add a `...` in between (unicode character) or indicate number of points somehow, as is done in Strings

I will post a more useful prototype sometime later today, but this is the basic concept.

@BenCurran98
Copy link
Author

@asinghvi17 I've had a crack at this, is this sort of what you're after? Now we compress geometries with "..." and report the number of sub geometries hidden, e.g.

linestring = GI.LineString(map(_ -> rand(2), 1:10_000))

Gives

LineString{false, false}([[0.6022716265309537, 0.46854202492808894], [0.7698994281922478, 0.5141934816807233],   (9997)  [0.5275211157024845, 0.7022242690985355], [0.09265052455532974, 0.5388384079940159]])

@asinghvi17
Copy link
Member

Sorry for the delay! This is next on my list. Should get to it by Wednesday.

@asinghvi17 asinghvi17 self-requested a review September 2, 2024 15:01
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 this pull request may close these issues.

2 participants