Open
Conversation
Owner
|
Hi Kyle! Thanks for your contribution! I suggest a few changes / simplifications:
# pseudocode, didn't look everything up, nothing tested!
function collect_extents(tree::STRtree)
extents = [(tree.rootnode.extent, 1)] # extent, level
for child_node in tree.rootnode.children
collect_extents!(extents, child_node, 2)
end
end
function collect_extents!(extents, node::SortTileRecursiveTree.STRNode, level)
push!(extents, (node.extent, level))
for child_node in node.children
collect_extents!(extents, child_node, level+1)
end
end
# similar for leaf node
function extent2xy(ex)
# convert extent to x and y lists or tuples here
end
RecipesBase.@recipe function f(...)
plotdata = collect_extents(tree)
for (ex, level) in plotdata
# unpack extent here and plot stuff
end
end
|
Author
|
Thank you for your feedback Max! #1–3 all sound great to me. I'll likely need to wait until the weekend to work on this code, but I will implement these changes & get back to you! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Good morning, I've written a simple plot recipe for STR trees using the JuliaPlots
RecipesBasepackage. Once you import Plots into the REPL, plotting works right away! See below for two examples.Is this something you are interested in? I'm happy to make any changes if need be.
Another example; I downloaded a small shape file from https://public.opendatasoft.com/explore/dataset/world-administrative-boundaries/export/, but please feel free to use whichever shapefile you have on hand.