Closed KDKasonde closed 6 months ago
Thanks so much for this! It's a very impressive first PR in Rust. How has learning the language been so far?
A bunch of comments, mostly Rust style stuff. Let me know if anything's unclear (or if you don't have time to address them). And could you please run
cargo fmt
to auto-format everything?
Cheers man it is very fun to learn, definitely think reading the book first helped me out ALOT, but I still have a lot of trouble with the different pointers it uses and the traits system - I probably suck at design if it is in Rust. I am also slower when using it, but also much more thoughtful with what I am writing so I consider that a win. I will carry on using it, just because it is a very nice language.
And sweet I will look through the changes and makes some updates now!
Thanks for the comments btw they were really helpful! Also for the examples, how will you add the geotiff
file?
I'll change the setup.py
scripts to download the file, probably.
I'll open a PR and CC you on any changes I make tomorrow
I'll change the
setup.py
scripts to download the file, probably.I'll open a PR and CC you on any changes I make tomorrow
Please do man!
Objective This PR aims to tackle issue #18 with the omission of allowing end users to toggle edge colouring by steepness.
Changes Config will now accept a
dem
attribute which is the location of thetif
file users want to extract elevations from, but this is all optional.The
Edge
struct now has the new attributes:forward_cost
the cost of travelling on an edge fromnode1
tonode2
backward_cost
the cost of travelling on an edge fromnode2
tonode1
slope
the slope returned for a given edge as a result of the inputtif
fileslope_factor
an optional tuple that holds theslope_factor
for theforward_cost
andbackward_cost
The steepness is used when doing batch calculations in the calculate_batch function which returns an
option
tuple of costs now.For now the forward and backward costs are calculated by multiplying a base cost by the slope_factor. For more details see here.
Breaking changes Users with external commands need to edit them to make sure they output a
tuple
of costs not afloat
now as a result of the changes.