Conversation
Member
Author
|
Given my frustration with renumbering some odd models, I've added automagic numbering of NodeIDs to this PR, which also includes quicker validation: model.terminal.add(Node(1, Point(500, 200)))
model.terminal.add(Node(1, Point(500, 200))) # will now error (before only when writing)And do the following to get automagic numbering (you have to specify the term = model.terminal.add(Node(geometry=Point(500, 200)))
assert term.node_id == 1 |
Merged
Co-authored-by: Martijn Visser <mgvisser@gmail.com>
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.
Fixes #1690 as a 🎁 for @deltamarnix when he is back from holiday.
Triggered by #1648, which seems very hard to do in QGIS as it doesn't support compound indexes and we dislike a separate global unique id. In a discussion with @visr he mentioned most people don't use the non-global unique id feature (yet).
Reverts #1513. Partially reverts #1690 as the
NodeIDchanges are not reverted, as it is quite useful to know the node_type in several parts of the code (instead of only a node_id). Therefore, I've added a newNodeIDconstructor and joined the Edge table with the Node table.I had to change the node_ids of several new test models created by @SouthEndMusic, bit of a pain, but the tests seem to pass still.
Furthermore, I changed the
node.addfunctionality to return theNodeData, which should make theedge.addmore straightforward (and pave the way for automatic id numbering in the future). So this:becomes this:
I've made this change in a single Python test model, and in the first model of the examples notebook. We could gradually change this further over time.