Route panel: points from search, GPS and library points, reordering, editing a saved route

This commit is contained in:
randy committed 2026-11-13 22:37:49 +01:00
1 parent 3146478c23
commit abde7fe5f9
10 files changed
+214 -25

No files matched your search

+15
View File
@@ -130,6 +130,21 @@ class LibraryTest < Minitest::Test
assert_raises(Maptool::Library::InvalidValue) { library.move_folder("c/x", "a") }
end
def test_a_saved_route_is_a_route_node_and_editing_replaces_it
route = { "type" => "Feature", "geometry" => { "type" => "LineString", "coordinates" => [[17.1, 48.1], [17.2, 48.2]] },
"properties" => { "name" => "To the lake", "kind" => "route", "via" => [[17.1, 48.1], [17.2, 48.2]] } }
library = open_library
key = library.add_note(route, "Routes")
node = library.tree["children"].first["children"].first
assert_equal [key, ["route"]], node.values_at("path", "kinds")
id = JSON.parse(library.geojson(key))["features"].first["properties"]["id"]
edited = route.merge("properties" => route["properties"].merge("name" => "Lake, scenic", "via" => [[17.1, 48.1], [17.15, 48.3], [17.2, 48.2]]))
library.update_feature(key, id, edited)
features = JSON.parse(library.geojson(key))["features"]
assert_equal [["Lake, scenic", 3]], features.map { |f| [f["properties"]["name"], f["properties"]["via"].size] }
end
private
def open_library