feat: first draw of ways
649
Cargo.lock
generated
|
@ -14,6 +14,17 @@ version = "0.3.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
|
@ -23,6 +34,21 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.86"
|
||||
|
@ -35,6 +61,12 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.3.0"
|
||||
|
@ -76,25 +108,99 @@ version = "2.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bobosm_raylib_rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"fully_pub",
|
||||
"osm-types",
|
||||
"osmpbf",
|
||||
"raylib",
|
||||
"rstar",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"toml",
|
||||
"ureq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "borsh"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed"
|
||||
dependencies = [
|
||||
"borsh-derive",
|
||||
"cfg_aliases",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "borsh-derive"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "bytecheck"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2"
|
||||
dependencies = [
|
||||
"bytecheck_derive",
|
||||
"ptr_meta",
|
||||
"simdutf8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytecheck_derive"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.98"
|
||||
|
@ -122,6 +228,27 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.8.1"
|
||||
|
@ -142,6 +269,12 @@ dependencies = [
|
|||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.4.2"
|
||||
|
@ -198,6 +331,51 @@ version = "0.8.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.12.0"
|
||||
|
@ -236,6 +414,12 @@ dependencies = [
|
|||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
|
@ -251,6 +435,22 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||
|
||||
[[package]]
|
||||
name = "fully_pub"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fd8cb48eceb4e8b471af6a8e4e223cbe1286552791b9ab274512ba9cfd754df"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
|
@ -283,7 +483,7 @@ version = "0.7.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.3.8",
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
|
@ -292,6 +492,9 @@ name = "hashbrown"
|
|||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
dependencies = [
|
||||
"ahash 0.7.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
|
@ -309,6 +512,12 @@ dependencies = [
|
|||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hibitset"
|
||||
version = "0.6.4"
|
||||
|
@ -324,6 +533,35 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
|
@ -342,6 +580,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
|||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.12.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -352,6 +591,7 @@ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
|||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.14.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -369,6 +609,24 @@ version = "1.0.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kstring"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -477,6 +735,12 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
@ -493,6 +757,18 @@ version = "1.19.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "osm-types"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae3b968f618fd91f709bfd42f7653aa02b8441a9b743bb12596a8b92c6de1b66"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"fnv",
|
||||
"kstring",
|
||||
"rust_decimal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osmpbf"
|
||||
version = "0.3.3"
|
||||
|
@ -536,6 +812,18 @@ version = "2.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.20"
|
||||
|
@ -546,6 +834,38 @@ dependencies = [
|
|||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
|
||||
dependencies = [
|
||||
"toml_edit 0.21.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.85"
|
||||
|
@ -606,6 +926,26 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ptr_meta"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1"
|
||||
dependencies = [
|
||||
"ptr_meta_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ptr_meta_derive"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
|
@ -615,6 +955,42 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raylib"
|
||||
version = "5.0.1"
|
||||
|
@ -700,6 +1076,15 @@ version = "0.8.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
|
||||
[[package]]
|
||||
name = "rend"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c"
|
||||
dependencies = [
|
||||
"bytecheck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
|
@ -715,6 +1100,35 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rkyv"
|
||||
version = "0.7.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"bytecheck",
|
||||
"bytes",
|
||||
"hashbrown 0.12.3",
|
||||
"ptr_meta",
|
||||
"rend",
|
||||
"rkyv_derive",
|
||||
"seahash",
|
||||
"tinyvec",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rkyv_derive"
|
||||
version = "0.7.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rstar"
|
||||
version = "0.12.0"
|
||||
|
@ -726,6 +1140,22 @@ dependencies = [
|
|||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust_decimal"
|
||||
version = "1.35.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a"
|
||||
dependencies = [
|
||||
"arrayvec 0.7.4",
|
||||
"borsh",
|
||||
"bytes",
|
||||
"num-traits",
|
||||
"rand",
|
||||
"rkyv",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
|
@ -788,6 +1218,12 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "seahash"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.203"
|
||||
|
@ -810,9 +1246,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.117"
|
||||
version = "1.0.118"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
||||
checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -828,6 +1264,36 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.2.6",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serde_with_macros",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
|
@ -840,7 +1306,7 @@ version = "0.10.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f08237e667ac94ad20f8878b5943d91a93ccb231428446c57c21c57779016d"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"arrayvec 0.5.2",
|
||||
"hashbrown 0.7.2",
|
||||
"mopa",
|
||||
"smallvec",
|
||||
|
@ -853,6 +1319,12 @@ version = "1.1.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5ea33232fdcf1bf691ca33450e5a94dde13e1a8cbb8caabc5e4f9d761e10b1a"
|
||||
|
||||
[[package]]
|
||||
name = "simdutf8"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
|
@ -897,6 +1369,18 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.0"
|
||||
|
@ -925,6 +1409,24 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn_derive"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.10.1"
|
||||
|
@ -957,6 +1459,37 @@ dependencies = [
|
|||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
|
@ -981,7 +1514,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
"toml_edit 0.22.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -993,6 +1526,17 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
|
||||
dependencies = [
|
||||
"indexmap 2.2.6",
|
||||
"toml_datetime",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.14"
|
||||
|
@ -1003,7 +1547,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
"winnow 0.6.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1078,12 +1622,78 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.3"
|
||||
|
@ -1105,6 +1715,15 @@ dependencies = [
|
|||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
@ -1178,6 +1797,15 @@ version = "0.52.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.13"
|
||||
|
@ -1187,6 +1815,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||
dependencies = [
|
||||
"tap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.8.1"
|
||||
|
|
|
@ -5,9 +5,13 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
fully_pub = "0.1.4"
|
||||
osm-types = "0.1.5"
|
||||
osmpbf = "0.3.3"
|
||||
raylib = { version = "5.0.1", features = ["wayland"] }
|
||||
rstar = "0.12.0"
|
||||
serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.118"
|
||||
serde_with = "3.8.1"
|
||||
toml = "0.8.14"
|
||||
ureq = { version = "2.9.7", features = ["json"] }
|
||||
|
|
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Bobosm
|
||||
|
||||
## Features
|
||||
|
||||
- [X] basic navigation
|
||||
- [ ] load data from osm server
|
||||
- [ ] load raster layer (slippy map)
|
||||
|
||||
## Inspirations
|
||||
|
||||
https://lib.rs/crates/walkers
|
11
TODO.md
|
@ -4,6 +4,8 @@
|
|||
- 2024-06-24: Basic navigation
|
||||
- 2024-06-24: Keyboard navigations, location presets
|
||||
- 2024-06-25: Afficher les quartiers d'Aubevoye, afficher les rues
|
||||
- 2024-06-25: Load GPS trace
|
||||
- 2024-06-26: Create or a edit a way to conform to a GPS trace
|
||||
|
||||
- Pouvoir afficher les grandes villes mondiale
|
||||
- Pouvoir se déplacer de façon basique
|
||||
|
@ -36,6 +38,11 @@
|
|||
- Distances de deux points sur une sphère avec la formule de Haversine
|
||||
- https://fr.wikipedia.org/wiki/Formule_de_haversine
|
||||
|
||||
- `bobosm account login`
|
||||
- `bobosm account status`
|
||||
- `bobosm push --comment "Hello world"`
|
||||
- `bobosm account logout`
|
||||
|
||||
## Tile
|
||||
|
||||
https://a.tile.openstreetmap.org/15/16511/11224.png
|
||||
|
@ -47,3 +54,7 @@
|
|||
## Get nodes on a area
|
||||
|
||||
curl -v https://api.openstreetmap.org/api/0.6/map.json -G -d "bbox=1.32495,49.16409,1.34585,49.18485" > map.json
|
||||
|
||||
## issues
|
||||
|
||||
- the `RTree` external struct does not support Debug trait
|
||||
|
|
BIN
assets/spreadsheet.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
1
data/centre_vernon.json
Normal file
1
data/data.json
Normal file
30590
data/osm_data_bethleem.json
Normal file
1
data/ouest_aubevoye.json
Normal file
BIN
docs/dev_screenshots/2024-06-25_first_ways_draw.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/dev_screenshots/screenshot000.png
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
docs/dev_screenshots/screenshot001.png
Normal file
After Width: | Height: | Size: 103 KiB |
BIN
docs/dev_screenshots/screenshot002.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
docs/dev_screenshots/screenshot003.png
Normal file
After Width: | Height: | Size: 105 KiB |
BIN
docs/dev_screenshots/screenshot004.png
Normal file
After Width: | Height: | Size: 83 KiB |
109
src/data.rs
Normal file
|
@ -0,0 +1,109 @@
|
|||
use std::collections::HashMap;
|
||||
use fully_pub::fully_pub;
|
||||
use crate::ToSlice;
|
||||
|
||||
use raylib::math::Vector2;
|
||||
use serde::Deserialize;
|
||||
|
||||
type Tags = Option<HashMap<String, String>>;
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
struct Node {
|
||||
id: i64,
|
||||
lat: f32,
|
||||
lon: f32,
|
||||
tags: Tags
|
||||
}
|
||||
|
||||
impl Node {
|
||||
pub fn to_vec(&self) -> Vector2 {
|
||||
Vector2::new(
|
||||
self.lon,
|
||||
self.lat
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
struct Way {
|
||||
id: i64,
|
||||
nodes: Vec<i64>,
|
||||
tags: Tags
|
||||
}
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
struct Relation {
|
||||
id: i64,
|
||||
tags: Tags
|
||||
}
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
#[serde(tag = "type", rename_all= "snake_case")]
|
||||
enum Element {
|
||||
Node(Node),
|
||||
Way(Way),
|
||||
Relation(Relation)
|
||||
}
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Data {
|
||||
version: String,
|
||||
elements: Vec<Element>
|
||||
}
|
||||
|
||||
#[fully_pub]
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct IndexedData {
|
||||
elements: HashMap<i64, Element>
|
||||
}
|
||||
|
||||
impl Data {
|
||||
|
||||
pub fn to_indexed_data(&self) -> IndexedData {
|
||||
let mut elements: HashMap<i64, Element> = HashMap::new();
|
||||
for e in &self.elements {
|
||||
let id = match e {
|
||||
Element::Way(w) => w.id,
|
||||
Element::Node(n) => n.id,
|
||||
Element::Relation(r) => r.id
|
||||
};
|
||||
|
||||
elements.insert(id, e.clone());
|
||||
}
|
||||
IndexedData {
|
||||
elements
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn compute_way_bbox(nodes_pos: &Vec<Vector2>) -> (Vector2, Vector2) {
|
||||
let mut b1 = Vector2::zero();
|
||||
let mut b2 = Vector2::zero();
|
||||
let mut initialized = false;
|
||||
for n in nodes_pos {
|
||||
if !initialized {
|
||||
b1 = n.clone();
|
||||
b2 = n.clone();
|
||||
initialized = true;
|
||||
}
|
||||
if n.x < b1.x {
|
||||
b1.x = n.x;
|
||||
}
|
||||
if n.y < b1.y {
|
||||
b1.y = n.y;
|
||||
}
|
||||
if n.x > b2.x {
|
||||
b2.x = n.x;
|
||||
}
|
||||
if n.y > b2.y {
|
||||
b2.y = n.y;
|
||||
}
|
||||
}
|
||||
(b1, b2)
|
||||
}
|
407
src/main.rs
|
@ -1,7 +1,13 @@
|
|||
use std::{fs, time::Duration};
|
||||
mod data;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_data;
|
||||
|
||||
use std::{collections::HashMap, fs, time::Duration};
|
||||
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
|
||||
use data::compute_way_bbox;
|
||||
use raylib::prelude::*;
|
||||
use std::io::Read;
|
||||
use osmpbf::{ElementReader, Element};
|
||||
|
@ -29,6 +35,30 @@ impl Invertion for Vector2 {
|
|||
}
|
||||
}
|
||||
|
||||
trait CanvasPos {
|
||||
fn to_canvas_pos(&self, camera: &Camera) -> Vector2;
|
||||
}
|
||||
|
||||
impl CanvasPos for Vector2 {
|
||||
fn to_canvas_pos(&self, camera: &Camera) -> Vector2 {
|
||||
return Vector2::new(
|
||||
self.x - camera.bounds.0.x,
|
||||
camera.bounds.1.y - self.y
|
||||
).scale_by(camera.real_to_canvas_factor);
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToSlice {
|
||||
fn to_slice(&self) -> [f32; 2];
|
||||
}
|
||||
|
||||
impl ToSlice for Vector2 {
|
||||
fn to_slice(&self) -> [f32; 2] {
|
||||
return [self.x, self.y]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Camera {
|
||||
bounds: (Vector2, Vector2),
|
||||
|
@ -39,21 +69,27 @@ struct Camera {
|
|||
canvas_to_real_factor: f32
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
// represent the displayed point on screen (should be renamed POI)
|
||||
struct LabeledPoint {
|
||||
pos: Vector2,
|
||||
importance: u32,
|
||||
name: String
|
||||
}
|
||||
|
||||
impl LabeledPoint {
|
||||
fn to_canvas_pos(&self, camera: &Camera) -> Vector2 {
|
||||
return Vector2::new(
|
||||
self.pos.x - camera.bounds.0.x,
|
||||
camera.bounds.1.y - self.pos.y
|
||||
).scale_by(camera.real_to_canvas_factor);
|
||||
}
|
||||
// represent the displayed way on screen ()
|
||||
struct DisplayedWay {
|
||||
positions: Vec<Vector2>,
|
||||
bbox: (Vector2, Vector2),
|
||||
importance: u32,
|
||||
name: String
|
||||
}
|
||||
|
||||
#[derive()]
|
||||
struct Layer {
|
||||
points_tree: Option<RTree<LabeledPoint>>,
|
||||
way_tree: Option<RTree<DisplayedWay>>,
|
||||
name: String,
|
||||
display: bool
|
||||
}
|
||||
|
||||
impl RTreeObject for LabeledPoint
|
||||
|
@ -66,6 +102,16 @@ impl RTreeObject for LabeledPoint
|
|||
}
|
||||
}
|
||||
|
||||
impl RTreeObject for DisplayedWay
|
||||
{
|
||||
type Envelope = AABB<[f32; 2]>;
|
||||
|
||||
fn envelope(&self) -> Self::Envelope
|
||||
{
|
||||
AABB::from_corners(self.bbox.0.to_slice(), self.bbox.1.to_slice())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum GetRasterError {
|
||||
HttpError(ureq::Error),
|
||||
|
@ -96,40 +142,61 @@ fn get_envelope_from_bounds(bounds: (Vector2, Vector2), margin_percent: f32) ->
|
|||
)
|
||||
}
|
||||
|
||||
fn get_raster_tile(http_agent: &Agent, geo_pos: Vector2, zoom_level: u32) -> Result<Image> {
|
||||
fn get_raster_tile(
|
||||
raster_cache: &mut HashMap<(u32, u32, u32), Vec<u8>>,
|
||||
http_agent: &Agent,
|
||||
geo_pos: Vector2,
|
||||
zoom_level: u32
|
||||
) -> Result<Image> {
|
||||
let projected_pos = deg2num(
|
||||
geo_pos.y.into(),
|
||||
geo_pos.x.into(),
|
||||
zoom_level
|
||||
);
|
||||
let response = http_agent.get(
|
||||
&format!("https://a.tile.openstreetmap.org/{}/{}/{}.png",
|
||||
let mut img_bytes: Vec<u8> = Vec::with_capacity(25_000);
|
||||
let cache_key = (zoom_level, projected_pos.0, projected_pos.1);
|
||||
if let Some(cached) = raster_cache.get(&cache_key) {
|
||||
// println!("getting cached data {:?}", cached);
|
||||
img_bytes = cached.to_vec();
|
||||
} else {
|
||||
let url = &format!(
|
||||
"https://a.tile.openstreetmap.org/{}/{}/{}.png",
|
||||
zoom_level,
|
||||
projected_pos.0,
|
||||
projected_pos.1
|
||||
)
|
||||
)
|
||||
.call()
|
||||
.context("Requesting the tile")?;
|
||||
);
|
||||
let response = http_agent.get(url)
|
||||
.call()
|
||||
.context("Requesting the tile")?;
|
||||
|
||||
let len: usize = response.header("Content-Length")
|
||||
.unwrap()
|
||||
.parse()
|
||||
.map_err(|_e| anyhow!("Invalid content length"))?;
|
||||
// let len: usize = response.header("Content-Length")
|
||||
// .unwrap()
|
||||
// .parse()
|
||||
// .map_err(|_e| anyhow!("Invalid content length"))?;
|
||||
|
||||
let mut img_bytes: Vec<u8> = Vec::with_capacity(len);
|
||||
let _ = response.into_reader()
|
||||
.take(10_000_000) // safety to limit overflow
|
||||
.read_to_end(&mut img_bytes)
|
||||
.context("Reading response body");
|
||||
let _ = response.into_reader()
|
||||
.take(10_000_000) // safety to limit overflow
|
||||
.read_to_end(&mut img_bytes)
|
||||
.context("Reading response body");
|
||||
|
||||
raster_cache.insert(cache_key, img_bytes.clone());
|
||||
|
||||
println!("Request {} done", url);
|
||||
}
|
||||
|
||||
Image::load_image_from_mem(".png", &img_bytes)
|
||||
.map_err(|e| anyhow!("Cannot decode PNG, {:?}", e))
|
||||
}
|
||||
|
||||
fn get_osm_data() {
|
||||
// curl -v https://api.openstreetmap.org/api/0.6/map.json -G -d "bbox=1.32495,49.16409,1.34585,49.18485" > map.json
|
||||
}
|
||||
// fn get_osm_data(http_agent: &Agent, bounds: (Vector2, Vector2)) -> Result<OSMData> {
|
||||
// /// download local data
|
||||
// // curl -v https://api.openstreetmap.org/api/0.6/map.json -G -d "bbox=1.32495,49.16409,1.34585,49.18485" > map.json
|
||||
|
||||
// let response = http_agent.get("https://api.openstreetmap.org/api/0.6/map.json")
|
||||
// .query("bbox", format!("{},{},{},{}", bounds.0.x, bounds.0.y, bounds.1.x, bounds.1.y))
|
||||
// .call()
|
||||
// .context("Requesting OSM local data")?;
|
||||
// }
|
||||
|
||||
fn read_config() -> Result<Config> {
|
||||
let config_content =
|
||||
|
@ -140,40 +207,57 @@ fn read_config() -> Result<Config> {
|
|||
Ok(config)
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
||||
let http_agent: Agent = ureq::AgentBuilder::new()
|
||||
.user_agent("bobosm/0.1")
|
||||
.timeout_read(Duration::from_secs(6))
|
||||
.timeout_write(Duration::from_secs(6))
|
||||
.build();
|
||||
|
||||
let (mut rl, thread) = raylib::init()
|
||||
.size(640, 640)
|
||||
.vsync()
|
||||
.title("BobOSM")
|
||||
.build();
|
||||
|
||||
let config = read_config()
|
||||
.context("Read config")?;
|
||||
fn load_static_osm_layer(path: &str) -> Result<Layer> {
|
||||
let content =
|
||||
fs::read_to_string(path)
|
||||
.context("Reading static osm data file")?;
|
||||
let data: data::Data = serde_json::from_str(&content)
|
||||
.context("Parsing static osm data")?;
|
||||
let indexed_data = data.to_indexed_data();
|
||||
|
||||
let reader = ElementReader::from_path(config.static_layers.base_data_path)
|
||||
.context("Read static layers")?;
|
||||
|
||||
enum MoveState {
|
||||
Started { start_pos: Vector2 },
|
||||
Done
|
||||
let mut d_ways: Vec<DisplayedWay> = vec![];
|
||||
for element in data.elements {
|
||||
let way = match element {
|
||||
data::Element::Way(w) => w,
|
||||
_ => {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
// load into a DisplayedWay, compute bbox
|
||||
let nodes_pos: Vec<Vector2> = way.nodes.iter().map(|n| {
|
||||
let resolved_ref = indexed_data.elements.get(&n).expect("Found invalid node_ref");
|
||||
let node = match resolved_ref {
|
||||
data::Element::Node(n) => n,
|
||||
_ => {
|
||||
panic!("Unexpected type");
|
||||
}
|
||||
};
|
||||
node.to_vec()
|
||||
}).collect();
|
||||
let bbox = compute_way_bbox(&nodes_pos);
|
||||
d_ways.push(DisplayedWay {
|
||||
name: "?".to_string(),
|
||||
importance: 0,
|
||||
positions: nodes_pos,
|
||||
bbox
|
||||
});
|
||||
}
|
||||
|
||||
Ok(Layer {
|
||||
name: "Static OSM Data".to_string(),
|
||||
points_tree: None,
|
||||
way_tree: Some(RTree::bulk_load(d_ways)),
|
||||
display: true
|
||||
})
|
||||
}
|
||||
|
||||
let mut move_state = MoveState::Done;
|
||||
fn load_static_cities_layer(path: &str) -> Result<Layer> {
|
||||
let reader = ElementReader::from_path(path)
|
||||
.context("Read static layers")?;
|
||||
|
||||
// first point is left bottom, second point is top right point
|
||||
// let mut current_bounds: (Vector2, Vector2) = ((-4.0, -4.0).into(), (4.0, 4.0).into());
|
||||
// let mut current_bounds: (Vector2, Vector2) = ((-6., 37.0).into(), (12., 55.0).into());
|
||||
|
||||
let mut points: Vec<LabeledPoint> = vec![];
|
||||
println!("==1");
|
||||
reader.for_each(|element| {
|
||||
if let Element::DenseNode(n) = element {
|
||||
let mut name: Option<String> = None;
|
||||
|
@ -204,21 +288,68 @@ fn main() -> Result<()> {
|
|||
})
|
||||
}
|
||||
}).expect("To for each");
|
||||
println!("==2");
|
||||
let mut tree = RTree::bulk_load(points);
|
||||
println!("==3");
|
||||
let tree = RTree::bulk_load(points);
|
||||
|
||||
Ok(Layer {
|
||||
name: "Cities, Towns".to_string(),
|
||||
display: true,
|
||||
points_tree: Some(tree),
|
||||
way_tree: None
|
||||
})
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut raster_cache: HashMap<(u32, u32, u32), Vec<u8>> = HashMap::new();
|
||||
|
||||
let http_agent: Agent = ureq::AgentBuilder::new()
|
||||
.user_agent("bobosm/0.1")
|
||||
.timeout_read(Duration::from_secs(6))
|
||||
.timeout_write(Duration::from_secs(6))
|
||||
.build();
|
||||
|
||||
let (mut rl, thread) = raylib::init()
|
||||
.size(1000, 1000)
|
||||
.vsync()
|
||||
.title("BobOSM")
|
||||
.build();
|
||||
|
||||
let config = read_config()
|
||||
.context("Read config")?;
|
||||
|
||||
let mut layers: Vec<Layer> = vec![
|
||||
load_static_cities_layer(&config.static_layers.base_data_path).context("Loading static cities layer")?,
|
||||
load_static_osm_layer("./data/centre_vernon.json").context("Loading static osm data")?
|
||||
];
|
||||
|
||||
enum MoveState {
|
||||
Started { start_pos: Vector2 },
|
||||
Done
|
||||
}
|
||||
|
||||
// let i = Image::load_image("assets/spreadsheet.png").expect("could not load image billboard");
|
||||
// let static_t = rl
|
||||
// .load_texture_from_image(&thread, &i)
|
||||
// .expect("could not load texture from image");
|
||||
|
||||
let mut move_state = MoveState::Done;
|
||||
|
||||
// first point is left bottom, second point is top right point
|
||||
// let mut current_bounds: (Vector2, Vector2) = ((-4.0, -4.0).into(), (4.0, 4.0).into());
|
||||
// let mut current_bounds: (Vector2, Vector2) = ((-6., 37.0).into(), (12., 55.0).into());
|
||||
|
||||
|
||||
|
||||
// additional
|
||||
let points_repr: Vec<(f32, f32)> = vec![
|
||||
(0.0, 0.0), (1.0, 1.0), (0.5, 0.5), (-2.0, -2.0), (0.0, -1.0), (1.0, -0.5)
|
||||
];
|
||||
for (i, repr) in points_repr.iter().enumerate() {
|
||||
tree.insert(LabeledPoint {
|
||||
importance: 1,
|
||||
name: format!("{}", i),
|
||||
pos: Vector2::new(repr.0, repr.1)
|
||||
});
|
||||
}
|
||||
// let points_repr: Vec<(f32, f32)> = vec![
|
||||
// (0.0, 0.0), (1.0, 1.0), (0.5, 0.5), (-2.0, -2.0), (0.0, -1.0), (1.0, -0.5)
|
||||
// ];
|
||||
// for (i, repr) in points_repr.iter().enumerate() {
|
||||
// tree.insert(LabeledPoint {
|
||||
// importance: 1,
|
||||
// name: format!("{}", i),
|
||||
// pos: Vector2::new(repr.0, repr.1)
|
||||
// });
|
||||
// }
|
||||
|
||||
// load a geojson list of all bigs cities in france
|
||||
// draw the cities points
|
||||
|
@ -229,7 +360,10 @@ fn main() -> Result<()> {
|
|||
|
||||
let mut tmp_state = 0;
|
||||
|
||||
let mut screen_def: (i32, i32) = (0, 0);
|
||||
|
||||
let mut camera = Camera {
|
||||
// compute bounds from screen width and screen height
|
||||