diff --git a/Cargo.lock b/Cargo.lock index 5e45ef3..7b83fce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,7 +50,7 @@ dependencies = [ "abi_stable_shared", "as_derive_utils", "core_extensions", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "rustc_version", "syn 1.0.109", @@ -196,7 +196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff3c96645900a44cf11941c111bd08a6573b0e2f9f69bc9264b179d8fae753c4" dependencies = [ "core_extensions", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", ] @@ -207,9 +207,9 @@ version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -280,7 +280,7 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "regex", "rustc-hash", @@ -302,9 +302,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block" @@ -407,15 +407,14 @@ dependencies = [ [[package]] name = "cairo-rs" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2650f66005301bd33cc486dec076e1293c4cecf768bc7ba9bf5d2b1be339b99c" +checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69" dependencies = [ - "bitflags 2.4.2", - "cairo-sys-rs 0.19.2", - "glib 0.19.2", + "bitflags 2.6.0", + "cairo-sys-rs 0.20.0", + "glib 0.20.1", "libc", - "thiserror", ] [[package]] @@ -426,18 +425,18 @@ checksum = "691d0c66b1fb4881be80a760cb8fe76ea97218312f9dfe2c9cc0f496ca279cb1" dependencies = [ "glib-sys 0.17.10", "libc", - "system-deps", + "system-deps 6.1.1", ] [[package]] name = "cairo-sys-rs" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3bb3119664efbd78b5e6c93957447944f16bdbced84c17a9f41c7829b81e64" +checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ - "glib-sys 0.19.0", + "glib-sys 0.20.1", "libc", - "system-deps", + "system-deps 7.0.2", ] [[package]] @@ -482,6 +481,16 @@ dependencies = [ "target-lexicon", ] +[[package]] +name = "cfg-expr" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345c78335be0624ed29012dc10c49102196c6882c12dde65d9f35b02da2aada8" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -582,7 +591,7 @@ dependencies = [ "thiserror", "tokio", "tokio-condvar", - "toml 0.8.11", + "toml 0.8.19", "topojson", "tracing", "tracing-subscriber", @@ -1033,6 +1042,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + [[package]] name = "enum_dispatch" version = "0.3.12" @@ -1040,9 +1055,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" dependencies = [ "once_cell", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -1132,7 +1147,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad3cf7e8f8e3c684b418c2640c931afc8bbc7ebe547bed6bf64170f1f51d57c9" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "fnv", "glow", "image", @@ -1362,9 +1377,9 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -1399,59 +1414,59 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6a23f8a0b5090494fd04924662d463f8386cc678dd3915015a838c1a3679b92" +checksum = "8730751991b97419fc3f0c2dca2c9e45b48edf46e48e0f965964ecf33889812f" dependencies = [ "gdk-pixbuf-sys", "gio", - "glib 0.19.2", + "glib 0.20.1", "libc", ] [[package]] name = "gdk-pixbuf-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcbd04c1b2c4834cc008b4828bc917d062483b88d26effde6342e5622028f96" +checksum = "1ffbf649fd5b1c8c0f0feeb015b7533c3ef92da2887fb95ddd338bc2b1644a7c" dependencies = [ - "gio-sys 0.19.0", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "gio-sys 0.20.1", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "libc", - "system-deps", + "system-deps 7.0.2", ] [[package]] name = "gdk4" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100b25604183f2fd97f55ef087fae96ab4934d7215118a35303e422688e6e4b" +checksum = "4b7d7237c1487ed4b300aac7744efcbf1319e12d60d7afcd6f505414bd5b5dea" dependencies = [ - "cairo-rs 0.19.2", + "cairo-rs 0.20.1", "gdk-pixbuf", "gdk4-sys", "gio", - "glib 0.19.2", + "glib 0.20.1", "libc", "pango", ] [[package]] name = "gdk4-sys" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b76874c40bb8d1c7d03a7231e23ac75fa577a456cd53af32ec17ec8f121626" +checksum = "a67576c8ec012156d7f680e201a807b4432a77babb3157e0555e990ab6bcd878" dependencies = [ - "cairo-sys-rs 0.19.2", + "cairo-sys-rs 0.20.0", "gdk-pixbuf-sys", - "gio-sys 0.19.0", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "gio-sys 0.20.1", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "libc", "pango-sys", "pkg-config", - "system-deps", + "system-deps 7.0.2", ] [[package]] @@ -1493,10 +1508,10 @@ dependencies = [ name = "geo-macros" version = "0.1.0" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "regex", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -1577,20 +1592,19 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "gio" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eae10b27b6dd27e22ed0d812c6387deba295e6fc004a8b379e459b663b05a02" +checksum = "dcacaa37401cad0a95aadd266bc39c72a131d454fc012f6dfd217f891d76cc52" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-util", - "gio-sys 0.19.0", - "glib 0.19.2", + "gio-sys 0.20.1", + "glib 0.20.1", "libc", "pin-project-lite", "smallvec", - "thiserror", ] [[package]] @@ -1602,20 +1616,20 @@ dependencies = [ "glib-sys 0.17.10", "gobject-sys 0.17.10", "libc", - "system-deps", + "system-deps 6.1.1", "winapi", ] [[package]] name = "gio-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf8e1d9219bb294636753d307b030c1e8a032062cba74f493c431a5c8b81ce4" +checksum = "5237611e97e9b86ab5768adc3eef853ae713ea797aa3835404acdfacffc9fb38" dependencies = [ - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "libc", - "system-deps", + "system-deps 7.0.2", "windows-sys 0.52.0", ] @@ -1675,24 +1689,23 @@ dependencies = [ [[package]] name = "glib" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9e86540b5d8402e905ad4ce7d6aa544092131ab564f3102175af176b90a053" +checksum = "b19429cb83fcbf1f00b31ae3a123fab5cd3761bdd15b0cc07905804742f0d0e4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "futures-channel", "futures-core", "futures-executor", "futures-task", "futures-util", - "gio-sys 0.19.0", - "glib-macros 0.19.2", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "gio-sys 0.20.1", + "glib-macros 0.20.1", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "libc", "memchr", "smallvec", - "thiserror", ] [[package]] @@ -1708,10 +1721,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eca5c79337338391f1ab8058d6698125034ce8ef31b72a442437fa6c8580de26" dependencies = [ "anyhow", - "heck", + "heck 0.4.1", "proc-macro-crate 1.3.1", "proc-macro-error", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", ] @@ -1722,11 +1735,24 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f5897ca27a83e4cdc7b4666850bade0a2e73e17689aabafcc9acddad9d823b8" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-crate 3.1.0", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", +] + +[[package]] +name = "glib-macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960349f56469b75794157e93bf04f0bc8a622d0a6612d6a8f8d7eac41e0e1ee1" +dependencies = [ + "heck 0.5.0", + "proc-macro-crate 3.1.0", + "proc-macro2 1.0.86", + "quote 1.0.35", + "syn 2.0.75", ] [[package]] @@ -1736,17 +1762,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d80aa6ea7bba0baac79222204aa786a6293078c210abe69ef1336911d4bdc4f0" dependencies = [ "libc", - "system-deps", + "system-deps 6.1.1", ] [[package]] name = "glib-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630f097773d7c7a0bb3258df4e8157b47dc98bbfa0e60ad9ab56174813feced4" +checksum = "44edae63bea922f18f7e63977ee60a257ec27c4613aff1a6a9bb572ad0d88269" dependencies = [ "libc", - "system-deps", + "system-deps 7.0.2", ] [[package]] @@ -1785,52 +1811,52 @@ checksum = "cd34c3317740a6358ec04572c1bcfd3ac0b5b6529275fae255b237b314bb8062" dependencies = [ "glib-sys 0.17.10", "libc", - "system-deps", + "system-deps 6.1.1", ] [[package]] name = "gobject-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e2b1080b9418dd0c58b498da3a5c826030343e0ef07bde6a955d28de54979" +checksum = "fa3d1dcd8a1eb2e7c22be3d5e792b14b186f3524f79b25631730f9a8c169d49a" dependencies = [ - "glib-sys 0.19.0", + "glib-sys 0.20.1", "libc", - "system-deps", + "system-deps 7.0.2", ] [[package]] name = "graphene-rs" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e4d388e96c5f29e2b2f67045d229ddf826d0a8d6d282f94ed3b34452222c91" +checksum = "80aac87f74e81c0e13433e892a047237abdc37945c86887f5eed905038356e69" dependencies = [ - "glib 0.19.2", + "glib 0.20.1", "graphene-sys", "libc", ] [[package]] name = "graphene-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236ed66cc9b18d8adf233716f75de803d0bf6fc806f60d14d948974a12e240d0" +checksum = "cc2f91ecd32989efad60326cc20a8fb252bd2852239a08e4e70cde8c100de9ca" dependencies = [ - "glib-sys 0.19.0", + "glib-sys 0.20.1", "libc", "pkg-config", - "system-deps", + "system-deps 7.0.2", ] [[package]] name = "gsk4" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65036fc8f99579e8cb37b12487969b707ab23ec8ab953682ff347cbd15d396e" +checksum = "1f3cf2091e1af185b347b3450817d93dea6fe435df7abd4c2cd7fb5bcb4cfda8" dependencies = [ - "cairo-rs 0.19.2", + "cairo-rs 0.20.1", "gdk4", - "glib 0.19.2", + "glib 0.20.1", "graphene-rs", "gsk4-sys", "libc", @@ -1839,33 +1865,33 @@ dependencies = [ [[package]] name = "gsk4-sys" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd24c814379f9c3199dc53e52253ee8d0f657eae389ab282c330505289d24738" +checksum = "6aa69614a26d8760c186c3690f1b0fbb917572ca23ef83137445770ceddf8cde" dependencies = [ - "cairo-sys-rs 0.19.2", + "cairo-sys-rs 0.20.0", "gdk4-sys", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "graphene-sys", "libc", "pango-sys", - "system-deps", + "system-deps 7.0.2", ] [[package]] name = "gtk4" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa82753b8c26277e4af1446c70e35b19aad4fb794a7b143859e7eeb9a4025d83" +checksum = "eaffc6c743c9160514cc9b67eace364e5dc5798369fa809cdb04e035c21c5c5d" dependencies = [ - "cairo-rs 0.19.2", + "cairo-rs 0.20.1", "field-offset", "futures-channel", "gdk-pixbuf", "gdk4", "gio", - "glib 0.19.2", + "glib 0.20.1", "graphene-rs", "gsk4", "gtk4-macros", @@ -1876,42 +1902,40 @@ dependencies = [ [[package]] name = "gtk4-macros" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40300bf071d2fcd4c94eacc09e84ec6fe73129d2ceb635cf7e55b026b5443567" +checksum = "188211f546ce5801f6d0245c37b6249143a2cb4fa040e54829ca1e76796e9f09" dependencies = [ - "anyhow", "proc-macro-crate 3.1.0", - "proc-macro-error", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 1.0.109", + "syn 2.0.75", ] [[package]] name = "gtk4-sys" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db1b104138f087ccdc81d2c332de5dd049b89de3d384437cc1093b17cd2da18" +checksum = "1114a207af8ada02cf4658a76692f4190f06f093380d5be07e3ca8b43aa7c666" dependencies = [ - "cairo-sys-rs 0.19.2", + "cairo-sys-rs 0.20.0", "gdk-pixbuf-sys", "gdk4-sys", - "gio-sys 0.19.0", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "gio-sys 0.20.1", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "graphene-sys", "gsk4-sys", "libc", "pango-sys", - "system-deps", + "system-deps 7.0.2", ] [[package]] name = "gvdb" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb9136c388a1e7b3017d18fe7c2f263b0a2b13f215c48e8eb44935d413ce0f9" +checksum = "acfa8cd2aa58da96876eb6276afe617c414d5846d1229274a821c1f8e8aa9e02" dependencies = [ "byteorder", "flate2", @@ -1985,6 +2009,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1996,9 +2026,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hmac" @@ -2294,14 +2324,13 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libadwaita" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91b4990248b9e1ec5e72094a2ccaea70ec3809f88f6fd52192f2af306b87c5d9" +checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" dependencies = [ - "gdk-pixbuf", "gdk4", "gio", - "glib 0.19.2", + "glib 0.20.1", "gtk4", "libadwaita-sys", "libc", @@ -2310,18 +2339,18 @@ dependencies = [ [[package]] name = "libadwaita-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a748e4e92be1265cd9e93d569c0b5dfc7814107985aa6743d670ab281ea1a8" +checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" dependencies = [ "gdk4-sys", - "gio-sys 0.19.0", - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "gio-sys 0.20.1", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "gtk4-sys", "libc", "pango-sys", - "system-deps", + "system-deps 7.0.2", ] [[package]] @@ -2362,7 +2391,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "libc", "redox_syscall 0.4.1", ] @@ -2373,7 +2402,7 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "libc", "redox_syscall 0.4.1", ] @@ -2436,9 +2465,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" @@ -2515,6 +2544,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -2751,16 +2792,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.1", - "libc", -] - [[package]] name = "num_enum" version = "0.5.11" @@ -2786,7 +2817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", ] @@ -2798,9 +2829,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -2889,7 +2920,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2904,9 +2935,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -2959,26 +2990,26 @@ dependencies = [ [[package]] name = "pango" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7809e8af4df8d024a066106b72ca6bc7253a484ae3867041a96103ef8a13188d" +checksum = "5764e5a174a5a0ec054fe5962ce6d4fc7052e2d0dcc23bbc77202b40a4a403d3" dependencies = [ "gio", - "glib 0.19.2", + "glib 0.20.1", "libc", "pango-sys", ] [[package]] name = "pango-sys" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52ef6a881c19fbfe3b1484df5cad411acaaba29dbec843941c3110d19f340ea" +checksum = "fd317e1de76b14b3d3efe05518c08b360327f1ab7fec150473a89ffcad4b072d" dependencies = [ - "glib-sys 0.19.0", - "gobject-sys 0.19.0", + "glib-sys 0.20.1", + "gobject-sys 0.20.1", "libc", - "system-deps", + "system-deps 7.0.2", ] [[package]] @@ -3111,9 +3142,9 @@ checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -3142,9 +3173,9 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -3250,7 +3281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", "version_check", @@ -3262,7 +3293,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "version_check", ] @@ -3284,9 +3315,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -3386,7 +3417,7 @@ version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", ] [[package]] @@ -3503,9 +3534,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "relm4" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e0e187b58db367305e8486d3228158251da1c8ba1e18baa9de61894e822649" +checksum = "cf0363f92b6a7eefd985b47f27b7ae168dd2fd5cd4013a338c9b111c33744d1f" dependencies = [ "flume 0.11.0", "fragile", @@ -3513,6 +3544,7 @@ dependencies = [ "gtk4", "libadwaita", "once_cell", + "relm4-css", "relm4-macros", "tokio", "tracing", @@ -3520,9 +3552,9 @@ dependencies = [ [[package]] name = "relm4-components" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffcb6431605810fca4430b3da5d496fcf67d39f32db6a2799bcaac27469154b9" +checksum = "fb3d67f2982131c5e6047af4278d8fe750266767e57b58bc15f2e11e190eef36" dependencies = [ "once_cell", "relm4", @@ -3530,26 +3562,32 @@ dependencies = [ ] [[package]] -name = "relm4-icons" -version = "0.8.2" +name = "relm4-css" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8603f50e9ed5ca2e3759a9c6033e4058c7b984f1bd22b1fc3b1a162c5612eb64" +checksum = "1d3b924557df1cddc687b60b313c4b76620fdbf0e463afa4b29f67193ccf37f9" + +[[package]] +name = "relm4-icons" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15242978b4e65431be4ccd5cf539d3c142518e114b7ecfa72ffd02cd6432e6e3" dependencies = [ "gtk4", "gvdb", "serde", - "toml 0.8.11", + "toml 0.8.19", ] [[package]] name = "relm4-macros" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0774e846889823aa5766f5b62cface3189a5b36280e65b2faaa6df0319da1726" +checksum = "fc5885640821d60062497737dd42fd04248d13c7ecccee620caaa4b210fe9905" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -3654,7 +3692,7 @@ version = "0.38.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -3676,7 +3714,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88117946aa1bfb53c2ae0643ceac6506337f44887f8c9fbfb43587b1cc52ba49" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "bytemuck", "smallvec", "ttf-parser 0.20.0", @@ -3772,22 +3810,22 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -3803,9 +3841,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4074,18 +4112,18 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "unicode-ident", ] @@ -4102,7 +4140,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] @@ -4123,11 +4161,24 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3" dependencies = [ - "cfg-expr", - "heck", + "cfg-expr 0.15.3", + "heck 0.4.1", "pkg-config", "toml 0.7.5", - "version-compare", + "version-compare 0.1.1", +] + +[[package]] +name = "system-deps" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "070a0a5e7da2d24be457809c4b3baa57a835fd2829ad8b86f9a049052fe71031" +dependencies = [ + "cfg-expr 0.16.0", + "heck 0.5.0", + "pkg-config", + "toml 0.8.19", + "version-compare 0.2.0", ] [[package]] @@ -4143,9 +4194,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" @@ -4193,9 +4244,9 @@ version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -4283,21 +4334,20 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", + "mio 1.0.2", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -4311,13 +4361,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -4358,21 +4408,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.11" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af06656561d28735e9c1cd63dfd57132c8155426aa6af24f36a00a351f88c48e" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.7", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -4403,15 +4453,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.7" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18769cd1cec395d70860ceb4d932812a0b4d06b1a4bb336745a4d21b9496e992" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.5", + "winnow 0.6.18", ] [[package]] @@ -4449,9 +4499,9 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -4504,9 +4554,9 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca029746fbe0efda3298205de77bf759d7fef23ac97902641e0b49a623b0455f" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -4658,6 +4708,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.4" @@ -4708,9 +4764,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -4742,9 +4798,9 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4812,7 +4868,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "xml-rs 0.8.19", ] @@ -5120,7 +5176,7 @@ dependencies = [ "instant", "libc", "log", - "mio", + "mio 0.8.11", "ndk", "objc2", "once_cell", @@ -5160,9 +5216,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.5" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -5254,9 +5310,9 @@ version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", - "syn 2.0.48", + "syn 2.0.75", ] [[package]] @@ -5320,12 +5376,11 @@ dependencies = [ [[package]] name = "zvariant" -version = "3.15.0" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +checksum = "2c1b3ca6db667bfada0f1ebfc94b2b1759ba25472ee5373d4551bb892616389a" dependencies = [ - "byteorder", - "libc", + "endi", "serde", "static_assertions", "zvariant_derive", @@ -5333,12 +5388,12 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.15.0" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +checksum = "b7a4b236063316163b69039f77ce3117accb41a09567fd24c168e43491e521bc" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2 1.0.76", + "proc-macro-crate 3.1.0", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", "zvariant_utils", @@ -5346,11 +5401,11 @@ dependencies = [ [[package]] name = "zvariant_utils" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +checksum = "00bedb16a193cc12451873fee2a1bc6550225acece0e36f333e68326c73c8172" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2 1.0.86", "quote 1.0.35", "syn 1.0.109", ] diff --git a/Cargo.toml b/Cargo.toml index 8109431..3fb5ad3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] cairo-rs = { version = "0.17.0" } # glib = "0.17.9" -gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] } +gtk = { version = "0.9", package = "gtk4", features = ["v4_14"] } geo-types = "0.7.9" shapefile = { version = "0.4", features = ["geo-types"] } thiserror = "1.0.40" @@ -28,8 +28,8 @@ glow = "0.13.1" proj = "0.27.2" image = "0.24.7" anyhow = "1.0.72" -relm4 = { version = "0.8.1", features = ["libadwaita"] } -relm4-components = "0.8.1" +relm4 = { version = "0.9", features = ["libadwaita"] } +relm4-components = "0.9" rstar = "*" geo = "0.26.0" topojson = "0.5.1" @@ -43,7 +43,7 @@ tokio = { version = "1.36.0", features = ["full"] } async-trait = "0.1.77" lazy_static = "1.4.0" once_cell = "1.19.0" -relm4-icons = { version = "0.8.2" } +relm4-icons = { version = "0.9" } surfman = "0.8.1" euclid = "0.22.9" gl = "0.14.0" @@ -88,5 +88,5 @@ path = "radarg_plugin_interface" [dependencies.adw] package = "libadwaita" -version = "0.6.0" +version = "0.7.0" features = ["v1_4"] diff --git a/etws_loader/Cargo.lock b/etws_loader/Cargo.lock index 25c1f0e..37044d7 100644 --- a/etws_loader/Cargo.lock +++ b/etws_loader/Cargo.lock @@ -56,6 +56,24 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -77,6 +95,15 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "as_derive_utils" version = "0.11.0" @@ -194,6 +221,22 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "earcutr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79127ed59a85d7687c409e9978547cffb7dc79675355ed22da6b66fd5f6ead01" +dependencies = [ + "itertools", + "num-traits", +] + +[[package]] +name = "either" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" + [[package]] name = "etws_loader" version = "0.1.0" @@ -203,6 +246,7 @@ dependencies = [ "byteorder", "chrono", "flate2", + "geo", "nom", "nom-derive", "num-traits", @@ -222,6 +266,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float_next_after" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" + [[package]] name = "generational-arena" version = "0.2.9" @@ -231,6 +281,73 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "geo" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f811f663912a69249fa620dcd2a005db7254529da2d8a0b23942e81f47084501" +dependencies = [ + "earcutr", + "float_next_after", + "geo-types", + "geographiclib-rs", + "log", + "num-traits", + "robust", + "rstar", + "spade", +] + +[[package]] +name = "geo-types" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff16065e5720f376fbced200a5ae0f47ace85fd70b7e54269790281353b6d61" +dependencies = [ + "approx", + "num-traits", + "rstar", + "serde", +] + +[[package]] +name = "geographiclib-rs" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e5ed84f8089c70234b0a8e0aedb6dc733671612ddc0d37c6066052f9781960" +dependencies = [ + "libm", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + [[package]] name = "iana-time-zone" version = "0.1.59" @@ -254,6 +371,15 @@ dependencies = [ "cc", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -285,6 +411,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "lock_api" version = "0.4.11" @@ -361,6 +493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -441,6 +574,23 @@ dependencies = [ "tstr", ] +[[package]] +name = "robust" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" + +[[package]] +name = "rstar" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133315eb94c7b1e8d0cb097e5a710d850263372fd028fff18969de708afc7008" +dependencies = [ + "heapless", + "num-traits", + "smallvec", +] + [[package]] name = "rustc_version" version = "0.4.0" @@ -511,6 +661,24 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +[[package]] +name = "spade" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61addf9117b11d1f5b4bf6fe94242ba25f59d2d4b2080544b771bd647024fd00" +dependencies = [ + "hashbrown", + "num-traits", + "robust", + "smallvec", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "syn" version = "1.0.109" @@ -580,6 +748,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "wasm-bindgen" version = "0.2.90" @@ -778,3 +952,23 @@ name = "windows_x86_64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] diff --git a/etws_loader/Cargo.toml b/etws_loader/Cargo.toml index b092bd1..bea6ff5 100644 --- a/etws_loader/Cargo.toml +++ b/etws_loader/Cargo.toml @@ -10,6 +10,7 @@ anyhow = "1.0.79" byteorder = "1.5.0" chrono = {version="0.4.33", features=["serde"]} flate2 = "1.0.28" +geo = "0.28.0" nom = "7.1.3" nom-derive = "0.10.1" num-traits = "0.2.17" diff --git a/etws_loader/src/lib.rs b/etws_loader/src/lib.rs index 00d7b2c..45741bc 100644 --- a/etws_loader/src/lib.rs +++ b/etws_loader/src/lib.rs @@ -1,4 +1,5 @@ mod error; +use geo::{algorithm::haversine_destination::HaversineDestination, Point}; mod parser; use abi_stable::{ export_root_module, @@ -14,7 +15,7 @@ use abi_stable::{ }; use parser::{Record, ValueResult}; use radarg_plugin_interface::{ - CoordType, Error, MetaData, Plugin, PluginId, PluginMod, PluginMod_Ref, PluginResult, + CoordType, Error, Loc3, MetaData, Plugin, PluginId, PluginMod, PluginMod_Ref, PluginResult, PluginResultType, PluginType, Plugin_TO, }; @@ -27,6 +28,23 @@ struct ETWSLoader { id: PluginId, } +fn calculate_coverage(lat_deg: f64, lon_deg: f64, radius_km: f64) -> (f64, f64, f64, f64) { + let center = Point::new(lon_deg, lat_deg); + + // 计算四个方向(北、南、东、西)的点 + let north = center.haversine_destination(0.0, radius_km); + let south = center.haversine_destination(180.0, radius_km); + let east = center.haversine_destination(90.0, radius_km); + let west = center.haversine_destination(270.0, radius_km); + + let min_lat = south.y(); + let max_lat = north.y(); + let min_lon = west.x(); + let max_lon = east.x(); + + (min_lat, max_lat, min_lon, max_lon) +} + impl Plugin for ETWSLoader { fn plugin_id(&self) -> &PluginId { &self.id @@ -80,33 +98,55 @@ impl Plugin for ETWSLoader { }; let dimension_des = b.info.dimension_des; let c = if dimension_des.contains(&format!("lat")) { + let len = b.info.dimension_values.len(); + + let lon = b.info.dimension_values.get(len - 1).unwrap(); + let lat = b.info.dimension_values.get(len - 2).unwrap(); + + lon_range = [lon[0], lon[lon.len() - 1]]; + lat_range = [lat[0], lat[lat.len() - 1]]; + CoordType::Cartesian } else if dimension_des.contains(&format!("ele")) + || dimension_des.contains(&format!("el")) || dimension_des.contains(&format!("elevation")) { - CoordType::Polar + let (min_lat, max_lat, min_lon, max_lon) = calculate_coverage( + b.info.radar_lat.unwrap(), + b.info.radar_lon.unwrap(), + b.info.dimension_end[2], + ); + + lon_range = [min_lon, max_lon]; + lat_range = [min_lat, max_lat]; + CoordType::Polar( + Loc3 { + x: b.info.radar_lon.unwrap(), + y: b.info.radar_lat.unwrap(), + z: b.info.radar_alt.unwrap(), + }, + b.info.dimension_end[2], + ) } else { CoordType::Other }; - - let shape = match b.info.dimension_size.len() { 1 => radarg_plugin_interface::DataShape::Vector, 2 => { - let lat = b.info.dimension_values.get(0).unwrap(); - let lon = b.info.dimension_values.get(1).unwrap(); - lat_range = [lat[0], lat[lat.len() - 1]]; - lon_range = [lon[0], lon[lon.len() - 1]]; + // let lat = b.info.dimension_values.get(0).unwrap(); + // let lon = b.info.dimension_values.get(1).unwrap(); + // lat_range = [lat[0], lat[lat.len() - 1]]; + // lon_range = [lon[0], lon[lon.len() - 1]]; radarg_plugin_interface::DataShape::Matrix - }, + } _ => { - let lat = b.info.dimension_values.get(1).unwrap(); - let lon = b.info.dimension_values.get(2).unwrap(); - lat_range = [lat[0], lat[lat.len() - 1]]; - lon_range = [lon[0], lon[lon.len() - 1]]; + // let lat = b.info.dimension_values.get(1).unwrap(); + // let lon = b.info.dimension_values.get(2).unwrap(); + // lat_range = [lat[0], lat[lat.len() - 1]]; + // lon_range = [lon[0], lon[lon.len() - 1]]; radarg_plugin_interface::DataShape::Cube - }, + } }; let data_type = match b.info.value_name.as_str() { @@ -197,7 +237,7 @@ mod tests { fn test() { let result = - Record::parse_from_path("/Volumes/data2/RadarArray/HangZhou/radarData/OutputProducts/RadarProducts/FuseDataX/20220727/ZJHZAA_20220727200000_FR.dat.gz") + Record::parse_from_path("/Volumes/data2/RadarArray/ShaoXing/radarData/OutputProducts/RadarProducts/BasicProductsX/20230627/20230627163400/ZJSXAA_20230627163400_VIL.dat.gz") .unwrap(); } } diff --git a/etws_loader/src/parser.rs b/etws_loader/src/parser.rs index aa5bd6f..03f16f2 100644 --- a/etws_loader/src/parser.rs +++ b/etws_loader/src/parser.rs @@ -364,237 +364,13 @@ pub struct BlockJsonInfo { pub fill_value: f64, pub value_scale: f32, pub value_offset: f32, + pub radar_alt: Option, + pub radar_lat: Option, + pub radar_lon: Option, + pub radar_name: Option, } pub struct ParsedBlock { pub info: BlockJsonInfo, pub data: ValueResult, } - -// fn _parse_matrix( -// input: &[u8], -// type_: ValueTypes, -// order: Order, -// len: usize, -// offset: f32, -// scale: f32, -// fill_value: f64, -// ) -> IResult<&[u8], ValueResult> { -// use std::mem; -// let need_trans = offset != 0.0 || scale != 1.0; -// let trans_to_bigger = offset.trunc() != offset || scale != 1.0; -// match type_ { -// ValueTypes::I64 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const i64; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// if trans_to_bigger { -// let offset = offset as f32; -// ValueResult::F32( -// slice -// .into_iter() -// .map(|p| (p as f32 - offset) / scale) -// .collect::>(), -// ) -// } else { -// ValueResult::I64(if need_trans { -// let offset = offset as i64; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// } -// }; - -// Ok((input, result)) -// } -// ValueTypes::F64 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const f64; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// ValueResult::F64(if need_trans { -// let offset = offset as f64; -// slice -// .into_iter() -// .map(|p| (p - offset) / scale as f64) -// .collect::>() -// } else { -// slice -// }) -// }; - -// Ok((input, result)) -// } -// ValueTypes::I32 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const i32; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// if trans_to_bigger { -// let offset = offset as f32; -// ValueResult::F32( -// slice -// .into_iter() -// .map(|p| (p as f32 - offset) / scale) -// .collect::>(), -// ) -// } else { -// ValueResult::I32(if need_trans { -// let offset = offset as i32; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// } -// }; - -// Ok((input, result)) -// } - -// ValueTypes::U32 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const u32; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// if trans_to_bigger { -// let offset = offset as f32; -// ValueResult::F32( -// slice -// .into_iter() -// .map(|p| (p as f32 - offset) / scale) -// .collect::>(), -// ) -// } else { -// ValueResult::U32(if need_trans { -// let offset = offset as u32; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// } -// }; - -// Ok((input, result)) -// } -// ValueTypes::F32 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const f32; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// ValueResult::F32(if need_trans { -// let offset = offset as f32; -// slice -// .into_iter() -// .map(|p| (p - offset) / scale) -// .collect::>() -// } else { -// slice -// }) -// }; - -// Ok((input, result)) -// } -// ValueTypes::U64 => { -// let ratio = mem::size_of::() / mem::size_of::(); -// let (input, result) = take(len * ratio)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const u64; -// let slice = std::slice::from_raw_parts(ptr, len); -// let slice = slice.to_vec(); - -// if trans_to_bigger { -// let offset = offset as f64; -// let scale = scale as f64; -// ValueResult::F64( -// slice -// .into_iter() -// .map(|p| (p as f64 - offset) / scale) -// .collect::>(), -// ) -// } else { -// ValueResult::U64(if need_trans { -// let offset = offset as u64; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// } -// }; - -// Ok((input, result)) -// } -// ValueTypes::I8 => { -// let (input, result) = take(len)(input)?; -// let result = unsafe { -// let ptr = result.as_ptr() as *const i8; -// let slice = std::slice::from_raw_parts(ptr, len); - -// let slice = slice.to_vec(); - -// if trans_to_bigger { -// let offset = offset as f32; -// ValueResult::F32( -// slice -// .into_iter() -// .map(|p| (p as f32 - offset) / scale) -// .collect::>(), -// ) -// } else { -// ValueResult::I8(if need_trans { -// let offset = offset as i8; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// } -// }; -// Ok((input, result)) -// } - -// ValueTypes::U8 => { -// let (input, slice) = take(len)(input)?; -// let slice = slice.to_vec(); -// let result = if trans_to_bigger { -// let offset = offset as f32; -// ValueResult::F32( -// slice -// .into_iter() -// .map(|p| { -// if p as f64 != fill_value { -// (p as f32 - offset) / scale -// } else { -// p as f32 -// } -// }) -// .collect::>(), -// ) -// } else { -// ValueResult::U8(if need_trans { -// let offset = offset as u8; -// slice.into_iter().map(|p| p - offset).collect::>() -// } else { -// slice -// }) -// }; - -// Ok((input, result)) -// } -// } -// } diff --git a/etws_loader/target/.rustc_info.json b/etws_loader/target/.rustc_info.json index 14533f6..37f10c0 100644 --- a/etws_loader/target/.rustc_info.json +++ b/etws_loader/target/.rustc_info.json @@ -1 +1 @@ -{"rustc_fingerprint":6534886339914138005,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.77.0-nightly (d78329b92 2024-01-13)\nbinary: rustc\ncommit-hash: d78329b92e8d141d19505e7c1527181c4ab87ed4\ncommit-date: 2024-01-13\nhost: aarch64-apple-darwin\nrelease: 1.77.0-nightly\nLLVM version: 17.0.6\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/tsuki/.rustup/toolchains/nightly-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file +{"rustc_fingerprint":7112235087551312656,"outputs":{"16495917692426387086":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/tsuki/.rustup/toolchains/nightly-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nub_checks\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.80.0-nightly (867900499 2024-05-23)\nbinary: rustc\ncommit-hash: 8679004993f08807289911d9f400f4ac4391d2bc\ncommit-date: 2024-05-23\nhost: aarch64-apple-darwin\nrelease: 1.80.0-nightly\nLLVM version: 18.1.6\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader index 928d854..732c5d7 100644 --- a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader +++ b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader @@ -1 +1 @@ -16f3840281ed1c0f \ No newline at end of file +498af0718dbbcb83 \ No newline at end of file diff --git a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader.json b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader.json index 2d45bde..2e28829 100644 --- a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader.json +++ b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/lib-etws_loader.json @@ -1 +1 @@ -{"rustc":17942353898403517573,"features":"[]","declared_features":"","target":8454914719411586997,"profile":14094339167972473758,"path":17523903030608720598,"deps":[[3470807962260834726,"serde",false,3464438898850424389],[6147374319788932929,"serde_json",false,4018346002534341099],[6644485573429891122,"thiserror",false,15376366722783231122],[6954241390595330609,"nom",false,17004332135801955629],[8926101378076943148,"byteorder",false,6029042559770906212],[8944703748776155531,"chrono",false,14085117952510397354],[10043922549268360936,"radarg_plugin_interface",false,2929903515477199145],[11138931377059941435,"num_traits",false,16208028648554347177],[12701726091060201577,"abi_stable",false,46919867052192855],[12732307821348191974,"anyhow",false,13132421988549874417],[12935855096716563853,"flate2",false,9880693184163145737],[16098302879908240583,"nom_derive",false,9783335926581460414]],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/etws_loader-826e392dbec97b5d/dep-lib-etws_loader"}}],"rustflags":[],"metadata":41698518999418921,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file +{"rustc":17942353898403517573,"features":"[]","declared_features":"","target":8454914719411586997,"profile":14094339167972473758,"path":17523903030608720598,"deps":[[3470807962260834726,"serde",false,3464438898850424389],[6147374319788932929,"serde_json",false,4018346002534341099],[6644485573429891122,"thiserror",false,15376366722783231122],[6954241390595330609,"nom",false,17004332135801955629],[8926101378076943148,"byteorder",false,6029042559770906212],[8944703748776155531,"chrono",false,1826932702640569830],[10043922549268360936,"radarg_plugin_interface",false,2929903515477199145],[11138931377059941435,"num_traits",false,4243888007213205890],[11576086755270729966,"geo",false,13469853973119584516],[12701726091060201577,"abi_stable",false,46919867052192855],[12732307821348191974,"anyhow",false,13132421988549874417],[12935855096716563853,"flate2",false,9880693184163145737],[16098302879908240583,"nom_derive",false,9783335926581460414]],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/etws_loader-826e392dbec97b5d/dep-lib-etws_loader"}}],"rustflags":[],"metadata":41698518999418921,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/output-lib-etws_loader b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/output-lib-etws_loader index 194757b..6ef839e 100644 --- a/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/output-lib-etws_loader +++ b/etws_loader/target/release/.fingerprint/etws_loader-826e392dbec97b5d/output-lib-etws_loader @@ -1,6 +1,6 @@ {"$message_type":"diagnostic","message":"unused imports: `Write`, `self`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":327,"line_start":13,"line_end":13,"column_start":15,"column_end":19,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":335,"byte_end":340,"line_start":13,"line_end":13,"column_start":27,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":27,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_imports)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove the unused imports","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":329,"line_start":13,"line_end":13,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":21}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/parser.rs","byte_start":333,"byte_end":340,"line_start":13,"line_end":13,"column_start":25,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":25,"highlight_end":32}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused imports: `Write`, `self`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:13:15\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m13\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0muse std::io::{self, Read, Write};\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_imports)]` on by default\u001b[0m\n\n"} {"$message_type":"diagnostic","message":"unused variable: `hlen2`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":6651,"byte_end":6656,"line_start":198,"line_end":198,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_variables)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":6651,"byte_end":6656,"line_start":198,"line_end":198,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":"_hlen2","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:198:21\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m198\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (input, hlen2) = Self::_parse_u32(input, order)?;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_variables)]` on by default\u001b[0m\n\n"} {"$message_type":"diagnostic","message":"unused variable: `order`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":9035,"byte_end":9040,"line_start":279,"line_end":279,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":9035,"byte_end":9040,"line_start":279,"line_end":279,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":"_order","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `order`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:279:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m279\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m order: Order,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_order`\u001b[0m\n\n"} -{"$message_type":"diagnostic","message":"unused variable: `dimension_len`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":1109,"byte_end":1122,"line_start":43,"line_end":43,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":1109,"byte_end":1122,"line_start":43,"line_end":43,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":"_dimension_len","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `dimension_len`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:43:26\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m43\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (dimension_len, data) = match b.data {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_dimension_len`\u001b[0m\n\n"} +{"$message_type":"diagnostic","message":"unused variable: `dimension_len`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":1799,"byte_end":1812,"line_start":61,"line_end":61,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":1799,"byte_end":1812,"line_start":61,"line_end":61,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":"_dimension_len","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `dimension_len`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:61:26\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m61\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (dimension_len, data) = match b.data {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_dimension_len`\u001b[0m\n\n"} {"$message_type":"diagnostic","message":"variants `I64` and `U64` are never constructed","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":563,"byte_end":573,"line_start":28,"line_end":28,"column_start":6,"column_end":16,"is_primary":false,"text":[{"text":"enum ValueTypes {","highlight_start":6,"highlight_end":16}],"label":"variants in this enum","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":580,"byte_end":583,"line_start":29,"line_end":29,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" I64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":616,"byte_end":619,"line_start":33,"line_end":33,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" U64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variants `I64` and `U64` are never constructed\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:29:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m28\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0menum ValueTypes {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m----------\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mvariants in this enum\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m29\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m I64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m...\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m33\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m U64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"} {"$message_type":"diagnostic","message":"5 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 5 warnings emitted\u001b[0m\n\n"} diff --git a/etws_loader/target/release/deps/libetws_loader.dylib b/etws_loader/target/release/deps/libetws_loader.dylib index 09cb86d..b098128 100755 Binary files a/etws_loader/target/release/deps/libetws_loader.dylib and b/etws_loader/target/release/deps/libetws_loader.dylib differ diff --git a/etws_loader/target/release/deps/libetws_loader.rlib b/etws_loader/target/release/deps/libetws_loader.rlib index 53a656d..76a2396 100644 Binary files a/etws_loader/target/release/deps/libetws_loader.rlib and b/etws_loader/target/release/deps/libetws_loader.rlib differ diff --git a/etws_loader/target/release/libetws_loader.dylib b/etws_loader/target/release/libetws_loader.dylib index 09cb86d..b098128 100755 Binary files a/etws_loader/target/release/libetws_loader.dylib and b/etws_loader/target/release/libetws_loader.dylib differ diff --git a/etws_loader/target/release/libetws_loader.rlib b/etws_loader/target/release/libetws_loader.rlib index 53a656d..76a2396 100644 Binary files a/etws_loader/target/release/libetws_loader.rlib and b/etws_loader/target/release/libetws_loader.rlib differ diff --git a/radarg_plugin_interface/src/lib.rs b/radarg_plugin_interface/src/lib.rs index 2e55286..e27869e 100644 --- a/radarg_plugin_interface/src/lib.rs +++ b/radarg_plugin_interface/src/lib.rs @@ -19,11 +19,22 @@ pub struct PluginId { pub instance: u64, } +#[repr(C)] +#[derive(Debug, Clone, StableAbi, Copy)] +#[sabi(impl_InterfaceType(Sync, Send, Debug, Debug))] +pub struct Loc3 { + pub x: f64, + pub y: f64, + pub z: f64, +} + +pub type Range = f64; + #[repr(C)] #[derive(StableAbi, Clone, Debug, Copy)] #[sabi(impl_InterfaceType(Sync, Send, Debug, Debug))] pub enum CoordType { - Polar, + Polar(Loc3, Range), Cartesian, Other, } diff --git a/radarg_plugin_interface/target/.rustc_info.json b/radarg_plugin_interface/target/.rustc_info.json index 93dab57..d273de1 100644 --- a/radarg_plugin_interface/target/.rustc_info.json +++ b/radarg_plugin_interface/target/.rustc_info.json @@ -1 +1 @@ -{"rustc_fingerprint":8475780184195034948,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/ruomu/.rustup/toolchains/nightly-x86_64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.74.0-nightly (8142a319e 2023-09-13)\nbinary: rustc\ncommit-hash: 8142a319ed5c1d1f96e5a1881a6546e463b77c8f\ncommit-date: 2023-09-13\nhost: x86_64-apple-darwin\nrelease: 1.74.0-nightly\nLLVM version: 17.0.0\n","stderr":""}},"successes":{}} \ No newline at end of file +{"rustc_fingerprint":756262368934451307,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.77.0-nightly (d78329b92 2024-01-13)\nbinary: rustc\ncommit-hash: d78329b92e8d141d19505e7c1527181c4ab87ed4\ncommit-date: 2024-01-13\nhost: aarch64-apple-darwin\nrelease: 1.77.0-nightly\nLLVM version: 17.0.6\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/tsuki/.rustup/toolchains/nightly-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/src/components/app.rs b/src/components/app.rs index 743d26f..ef91b94 100644 --- a/src/components/app.rs +++ b/src/components/app.rs @@ -8,9 +8,9 @@ use super::{ }; use crate::components::sidebar::{SideBarInputMsg, SideBarModel}; use crate::data_utils::tools; +use crate::pipeline::element::Buffer; +use crate::pipeline::element::Element; use crate::pipeline::element_imp::{Context, ElementInput, GridImpConfig}; -use crate::pipeline::new_element::Buffer; -use crate::pipeline::new_element::Element; use crate::pipeline::runner::Runner; use crate::pipeline::{DataTarget, Key}; use crate::pipeline::{KVBuffer, OffscreenRenderer}; @@ -290,7 +290,7 @@ impl Component for AppModel { "CR", dialog_cms.clone(), dialog_dispatcher.clone(), - false, + true, cfg, path.clone(), dialog_buffer.clone(), diff --git a/src/data/mod.rs b/src/data/mod.rs index c88d402..93c4ceb 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -34,7 +34,7 @@ pub enum DataType { #[derive(Clone, Copy, Debug)] pub enum CoordType { - Polar, + Polar((f64,f64,f64), f64), LatLon, } pub trait MultiDimensionData diff --git a/src/data_utils.rs b/src/data_utils.rs index ae4fb17..6992e09 100644 --- a/src/data_utils.rs +++ b/src/data_utils.rs @@ -1,6 +1,9 @@ +use crate::pipeline::element_imp::ElementImpl::MultiLayerGrid; use crate::pipeline::element_imp::*; use crate::utils::*; use crate::CONFIG; +use abi_stable::traits::IntoOwned; +use num_traits::FromPrimitive; use radarg_plugin_interface::{CoordType, DataShape, PluginResult, PluginResultType}; use std::any::Any; use std::sync::Arc; @@ -16,7 +19,7 @@ macro_rules! dispatch { $branch => { let mut $v = $wrap::default(); $v.color_map = $conf.drawers.$v.color_mapper.clone(); - $v.fill_value = <$t>::from_f64($fill_value); + $v.fill_value = <$t>::from_f64($fill_value).unwrap(); Arc::new($v) as Arc } )+ @@ -26,20 +29,79 @@ macro_rules! dispatch { }; } +macro_rules! dispatch_polar { + ($block:ident,$conf:ident, $wrap:tt , $fill_value: ident, $center:ident, $( + { + $t:ty | $branch: pat => $v:ident + } + ),+ $(,)?) => { + match $block.data_type { + $( + $branch => { + let mut $v = $wrap::default(); + $v.color_map = $conf.drawers.$v.color_mapper.clone(); + $v.fill_value = <$t>::from_f64($fill_value).unwrap(); + $v.center = $center; + Arc::new($v) as Arc + } + )+ + + _ => { panic!("") } + } + }; +} + +macro_rules! dispatch_3d { + ($block:ident,$conf:ident, $wrap:tt , $fill_value: ident, $( + { + $t:ty | $branch: pat => $v:ident + } + ),+ $(,)?) => { + match $block.data_type { + $( + $branch => { + let mut $v = $wrap::default(); + $v.color_map = $conf.drawers.$v.color_mapper.clone(); + $v.fill_value = <$t>::from_f64($fill_value).unwrap(); + + let mut cfg = MultiLayerGridImpConfig{ + two_d_config: $v, + layer: 0, + }; + Arc::new(cfg) as Arc + } + )+ + + _ => { panic!("") } + } + }; +} + macro_rules! dis { - ($block:ident, $config:ident, $wrap:tt, $fill_value: ident) => { - dispatch!( - $block, $config, $wrap, $fill_value, + ($mac:ident ,$block:ident, $config:ident, $wrap:tt, $fill_value: ident, $($other:ident,)?) => { + $mac!( + $block, $config, $wrap, $fill_value, $($other,)? { i8|PluginResultType::R => reflectivity }, { i8|PluginResultType::DBZ => reflectivity }, { f32|PluginResultType::ZDR => differential_reflectivity }, { f32|PluginResultType::KDP => specific_differential_phase }, - { i8|PluginResultType::PHIDP => differential_phase } + { f32|PluginResultType::PHIDP => differential_phase }, + { i8 |PluginResultType::V => velocity }, + { i8 |PluginResultType::SW => spectrum_width }, + { f32|PluginResultType::CC => correlation_coefficient }, + { i8 |PluginResultType::HCA => hydrometeor_classification }, + { f32|PluginResultType::VIL => vertically_integrated_liquid }, + { f32|PluginResultType::OHP => one_hour_precipitation }, + { f32|PluginResultType::THP => three_hour_precipitation }, + { f32|PluginResultType::ET => echo_tops }, + { f32|PluginResultType::EB => echo_bases } ) }; } -pub fn tools(data: &PluginResult) -> (ElementImpl, Arc) { +type Cfg = Arc; + +pub fn tools(data: &PluginResult) -> (ElementImpl, Cfg) { let blocks_num = data.blocks.len(); if blocks_num == 0 { @@ -55,21 +117,22 @@ pub fn tools(data: &PluginResult) -> (ElementImpl, Arc) { let config = CONFIG.read().unwrap(); let imp = match block.coord_type { - CoordType::Polar => { - let cfg = dis!(block, config, PolarElementConfig, fill_value); + CoordType::Polar(loc, range) => { + let center = (loc.x, loc.y); + let cfg = dis!(dispatch_polar, block, config, PolarElementConfig, fill_value, center,); (PolarElementImp().into(), cfg) } - CoordType::Cartesian => { - let cfg = dis!(block, config, GridImpConfig, fill_value); - ( - match block.shape { - DataShape::Cube => MultiLayerGridImp().into(), - DataShape::Matrix => GridImp().into(), - _ => panic!("Invalid shape"), - }, - cfg, - ) - } + CoordType::Cartesian => match block.shape { + DataShape::Cube => { + let cfg = dis!(dispatch_3d, block, config, GridImpConfig, fill_value,); + (MultiLayerGridImp::new().into(), cfg) + } + DataShape::Matrix => ( + GridImp::new().into(), + dis!(dispatch, block, config, GridImpConfig, fill_value,), + ), + _ => panic!("Invalid shape"), + }, _ => { panic!("Invalid type") } diff --git a/src/pipeline/element.rs b/src/pipeline/element.rs index f5c4524..9ace5ad 100644 --- a/src/pipeline/element.rs +++ b/src/pipeline/element.rs @@ -1,323 +1,60 @@ -use super::{offscreen_renderer::CanvasWrapper, Dispatcher}; -use crate::components::Widget; +use super::dispatcher; +use super::element_imp::Context; +use super::element_imp::ElementImpl; +use super::element_imp::ElementOutput; +use super::offscreen_renderer; +use super::offscreen_renderer::CanvasWrapper; +use super::runner; +use super::runner::Runner; +use super::Dispatcher; use crate::coords::cms::CMS; use crate::coords::Range; use crate::data::MetaInfo; -use crate::errors::{PipelineError, RenderError}; -use crate::predefined::color_mapper::ColorMapper; +use crate::pipeline::OffscreenRenderer; use crate::widgets::Render; +use crate::PLUGIN_MANAGER; use crate::RUNTIME; -use chrono::{DateTime, TimeZone, Utc}; -use femtovg::{ImageFlags, ImageId}; -use futures::StreamExt; -use num_traits::{AsPrimitive, FromPrimitive, NumOps}; +use chrono::prelude::*; +use femtovg::ImageFlags; +use femtovg::ImageId; +use futures::future::BoxFuture; +use glow::HasContext; +use num_traits::AsPrimitive; +use num_traits::FromPrimitive; +use num_traits::Num; +use num_traits::NumOps; +use quick_cache::sync::Cache; use radarg_plugin_interface::PluginResult; use std::any::Any; -use std::borrow::Borrow; -use std::collections::{BTreeMap, HashMap}; -use std::fmt::Formatter; -use std::ops::{Deref, DerefMut}; +use std::borrow::BorrowMut; +use std::cell::RefCell; +use std::collections::HashMap; +use std::fmt::Debug; +use std::hash::Hash; +use std::path::PathBuf; use std::rc::Rc; -use std::sync::atomic::AtomicUsize; -use std::{ - fmt::Debug, - sync::{Arc, Mutex}, -}; -use tokio::sync::{ - oneshot::{channel, Receiver}, - Notify, -}; +use std::sync::atomic::AtomicI32; +use std::sync::Arc; +use std::sync::RwLock; +use std::time::Duration; +use tokio::sync::oneshot; +use tokio::sync::{mpsc, Mutex}; +use tracing::subscriber; -pub type ElementID = usize; -static ELEMENT_ID: AtomicUsize = AtomicUsize::new(0); +static ELEMENT_ID: AtomicI32 = AtomicI32::new(0); +pub type ElementID = i32; +pub type KVBuffer = Cache; +pub type Buffer = KVBuffer>>; -pub type Data = Box; -pub type Buffer = Arc, Option>>>; -type DrawFunc = Rc>; -type IResult = Result; +pub type Data = Arc; -#[derive(Debug)] -pub enum Element { - TimeSeries(TimeSeriesElement), - Instant(InstantElement), -} - -impl Element { - pub fn create_time_series( - imp: Arc, - dispatcher: Rc, - key: String, - cms: CMS, - ) -> Self { - Element::TimeSeries(TimeSeriesElement::new(imp, dispatcher, cms, key)) - } - pub fn create_instant( - _type: InstantElementDrawerType, - dispatcher: Rc, - key: String, - ) -> Self { - Element::Instant(InstantElement::new(_type, dispatcher, key)) - } - - pub fn id(&self) -> ElementID { - match self { - Element::TimeSeries(e) => e.id, - Element::Instant(e) => e.id, - } - } - pub fn key(&self) -> String { - match self { - Element::TimeSeries(e) => e.key.clone(), - Element::Instant(e) => e.key.clone(), - } - } - - pub fn get_instance(mut self) -> InstantElement { - match self { - Element::TimeSeries(e) => panic!("TimeSeries element does not have instance"), - Element::Instant(v) => v, - } - } - - pub fn get_time_series_instance(mut self) -> TimeSeriesElement { - match self { - Element::TimeSeries(v) => v, - Element::Instant(e) => panic!("Instant element does not have instance"), - } - } -} -#[derive(Debug)] -pub struct TimeSeriesElement { +#[derive(Debug, Hash, Eq, PartialEq, Clone)] +pub struct Key { pub id: ElementID, - pub key: String, - cms: CMS, - imp: Arc, - registers: Arc, Vec>>>>, - pipeline: Pipeline, - pub buffer: Buffer, - dispatcher: Rc, -} - -#[derive(Clone)] -pub enum InstantElementDrawerType { - Draw(DrawFunc), - Prepared(DataTarget), -} - -impl Debug for InstantElementDrawerType { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.debug_struct("InstantElementDrawerType").finish() - } -} -#[derive(Debug, Clone)] -pub struct InstantElement { - pub id: ElementID, - pub key: String, - draw_type: InstantElementDrawerType, - dispatcher: Rc, -} - -pub enum ElementImplMap { - ColorMap, - None, -} - -pub trait ElementImpl: Debug + Send + Sync + 'static { - fn render(&self, data: &PluginResult, canvas: &mut CanvasWrapper, cms: &mut CMS) -> Target; -} - -impl InstantElement { - fn new(_type: InstantElementDrawerType, dispatcher: Rc, key: String) -> Self { - let id = ELEMENT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - Self { - id, - key, - draw_type: _type, - dispatcher, - } - } - pub fn render(&mut self, render: &Render) { - match self.draw_type { - InstantElementDrawerType::Draw(ref func) => { - func(render); - } - InstantElementDrawerType::Prepared(ref mut target) => { - render.draw_img(target); - } - } - } - - pub fn imp(&self) -> &InstantElementDrawerType { - &self.draw_type - } - - pub fn to_time_series( - self, - dispatcher: Rc, - cms: CMS, - ) -> (TimeSeriesElement, DateTime) { - // let imp = Arc::new(InstantElementImpl::new(self)); - // if let InstantElementDrawerType::Prepared(mut target) = self.draw_type { - // let mut time_series = TimeSeriesElement::new(imp, dispatcher, cms, self.key); - // let data = target.take_data().unwrap(); - // let time_stamp = data.blocks.first().unwrap().datetime; - // let meta_info: MetaInfo = data.meta.clone().into(); - // use chrono::prelude::*; - // let time = Utc.timestamp_opt(time_stamp, 0).unwrap(); - // (*time_series.buffer) - // .lock() - // .unwrap() - // .insert(time, Some(RenderResult::new(target, meta_info))); - // (time_series, time) - // } else { - panic!("InstantElementDrawerType is not prepared"); - // } - } -} - -impl TimeSeriesElement { - fn new(imp: Arc, dispatcher: Rc, cms: CMS, key: String) -> Self { - let id = ELEMENT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - let mut pipeline = Pipeline::new(20, key.clone()); - pipeline.set_dispatcher(dispatcher.clone()); - let buffer = Arc::new(Mutex::new(BTreeMap::new())); - Self { - id, - key, - imp, - cms, - registers: Arc::new(Mutex::new(HashMap::new())), - buffer, - dispatcher, - pipeline, - } - } - - pub fn register( - &mut self, - datetime: DateTime, - ) -> IResult>> { - use tokio::sync::Notify; - use tokio::task; - - let (sender, recv) = channel::>(); - self.change_time(datetime)?; - - let buffer = self.buffer.lock().unwrap(); - if buffer.contains_key(&datetime) { - let target = buffer.get(&datetime).unwrap(); - - // Already in buffer - if let Some(target) = target { - sender.send(Ok(target.clone())).unwrap(); - } else { - let new_notifer = { - let n = Arc::new(Notify::new()); - let n_clone = n.clone(); - self.register_noti(datetime, n); - n_clone - }; - - let buffer = self.buffer.clone(); - task::spawn_local(async move { - new_notifer.notified().await; - let result = buffer.lock().unwrap().get(&datetime).unwrap().clone(); - sender.send(Ok(result.unwrap())).unwrap(); - }); - } - return Ok(recv); - } else { - return Err(PipelineError::DataError("No data found".to_string())); - } - } - - pub fn set_cms(&mut self, cms: CMS) { - self.cms = cms; - } - - pub fn imp(&self) -> &Arc { - &self.imp - } - - fn register_noti(&self, datetime: DateTime, noti: Arc) { - self.registers - .lock() - .unwrap() - .entry(datetime) - .or_insert_with(Vec::new) - .push(noti); - } - - fn change_time(&mut self, date_time: DateTime) -> IResult<()> { - let imp = self.imp.clone(); - println!("Change time to {:?}", date_time); - let tasks = self.pipeline.set_current( - date_time, - true, - 3, - Arc::new(move |data, canvas, cms| imp.render(data, canvas, cms)), - self.cms.clone(), - ); - - let tasks = tasks.map(|tms| tms.into_iter().map(|time| (time, None))); - if let Some(tasks) = tasks { - if tasks.len() == 0 { - return Err(PipelineError::DataError("No data found".to_string())); - } - - let mut buffer = self.buffer.lock().unwrap(); - buffer.extend(tasks); - let buffer = self.buffer.clone(); - let registers = self.registers.clone(); - - let listening_func = self.pipeline.listening(move |recv, idx| { - let buffer = buffer.clone(); - let registers = registers.clone(); - Box::pin(async move { - let registers = registers; - let (dt, result) = recv.await.unwrap(); - if let Ok(result) = result { - let mut buffer = buffer.lock().unwrap(); - *buffer.get_mut(&dt).unwrap() = Some(result); - } - - { - registers.lock().unwrap().get_mut(&dt).map(|x| { - x.into_iter().for_each(|n| { - n.notify_waiters(); - }) - }); - } - }) - }); - let runner = Pipeline::run(&mut self.pipeline); - - RUNTIME.spawn(listening_func); - RUNTIME.spawn(runner); - return Ok(()); - } - Err(PipelineError::DataError("No data found".to_string())) - } -} - -#[derive(Debug, Clone)] -pub struct RenderResult { - target: DataTarget, - meta_info: MetaInfo, -} - -impl RenderResult { - pub fn new(target: DataTarget, meta_info: MetaInfo) -> Self { - Self { target, meta_info } - } - - pub fn get_meta_info(&self) -> MetaInfo { - self.meta_info.clone() - } - - pub fn get_mut_target(&mut self) -> &mut Target { - &mut self.target - } + pub name: String, + pub root: std::path::PathBuf, + pub datetime: Option>, + pub unique_key: Option, } #[derive(Clone, Debug)] @@ -327,7 +64,6 @@ pub struct Target { pub width: f32, pub height: f32, pub bounds: (Range, Range), - // pub data: Option>, } #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] @@ -344,7 +80,6 @@ impl Target { height: f32, bounds: (Range, Range), thumbnail: Option, - // data: Option>, ) -> Self { Self { target, @@ -352,7 +87,6 @@ impl Target { height, bounds, thumbnail, - // data, } } @@ -526,38 +260,216 @@ impl Target { #[derive(Debug, Clone)] pub struct DataTarget { - data: Option, + pub data: Option, target: Target, } impl DataTarget { - pub fn new(data: Option, target: Target) -> Self { + pub fn new(data: Option, target: Target) -> Self { Self { data, target } } +} - pub fn take_data(&mut self) -> Option { - self.data.take() +#[derive(Debug, Clone)] +pub struct RenderResult { + unique_key: Option, + target: DataTarget, + meta_info: MetaInfo, +} + +impl RenderResult { + pub fn new(target: DataTarget, meta_info: MetaInfo, unique_key: Option) -> Self { + Self { target, meta_info,unique_key } + } + pub fn get_meta_info(&self) -> MetaInfo { + self.meta_info.clone() + } + pub fn get_mut_target(&mut self) -> &mut Target { + &mut self.target.target } - pub fn data(&self) -> Option<&PluginResult> { - self.data.as_ref() - } - - pub fn mut_data(&mut self) -> Option<&mut PluginResult> { - self.data.as_mut() + pub fn get_key(&self) -> Option<&String>{ + self.unique_key.as_ref() } } -impl Deref for DataTarget { - type Target = Target; - - fn deref(&self) -> &Self::Target { - &self.target - } +#[derive(Debug)] +pub struct Element { + pub id: i32, + pub name: String, + pub cache: bool, + root: std::path::PathBuf, + config: Arc, + imp: ElementImpl, + subscribers: Arc>>>>>>, + cancellers: Arc>>>, + current_key: Option, + dispatcher: Arc, + buffer: Arc>, + file_pool: Arc>>, + current_target: Option>>, + cms: CMS, } -impl DerefMut for DataTarget { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.target +pub enum ElementEvent<'a> { + Init, + Draw, + DateTime(DateTime), + Key(&'a Key), +} + +impl Element { + pub fn new( + name: impl Into, + cms: CMS, + dispatcher: Arc, + cache: bool, + config: Arc, + root: std::path::PathBuf, + buffer: Arc>, + file_pool: Arc>>, + imp: ElementImpl, + ) -> Self { + let id = ELEMENT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + Element { + id, + name: name.into(), + cache, + imp, + config, + root, + subscribers: Arc::new(Mutex::new(HashMap::new())), + cancellers: Arc::new(Mutex::new(HashMap::new())), + cms: cms, + current_key: None, + buffer, + file_pool, + current_target: None, + dispatcher, + } + } + + pub fn r<'b>(&mut self, event: ElementEvent<'b>, render: &Render) { + let need_cache = self.cache; + let output_type = self.imp.output_type(); + + fn _init( + this: &mut Element, + need_cache: bool, + output_type: ElementOutput, + render: &Render, + ) { + let data = this.file_pool.get(&this.root); + if let Some(data) = data { + let target = this._rrrr(data, need_cache, output_type, render); + if let Some(target) = target { + let time = target.meta_info.datetime.unwrap(); + if !need_cache { + this.current_target = Some(Arc::new(RwLock::new(target))); + return; + } + let unique_key = target.unique_key.clone(); + let key = this.generate_key(time, unique_key); + let target = Arc::new(RwLock::new(target)); + this.buffer.insert(key, target.clone()); + this.current_target = Some(target); + } + } + } + + match event { + ElementEvent::Init => { + _init(self, need_cache, output_type, render); + } + ElementEvent::Draw => { + if let Some(current) = self.current_target.as_ref() { + let mut img = current.write().unwrap(); + let mut img = img.get_mut_target(); + render.draw_img(img); + } else { + _init(self, need_cache, output_type, render); + if let ElementOutput::Target = output_type { + let mut _img = self.current_target.as_ref().unwrap(); + let mut img = _img.write().unwrap(); + let mut img = img.get_mut_target(); + render.draw_img(img); + } + } + } + ElementEvent::DateTime(time) => { + let path = self.dispatcher.get_single_path(&self.name, time, true); + path.map(|path| { + // let data = self.file_pool.get(&path); + }); + } + + ElementEvent::Key(key) => { + self.buffer.get(key); + } + } + } + + fn insert_target_to_buffer(&self, key: Key, render_result: RenderResult) { + let result = Arc::new(RwLock::new(render_result)); + self.buffer.insert(key, result); + } + + fn _rrrr( + &self, + data: Data, + need_cache: bool, + output_type: ElementOutput, + render: &Render, + ) -> Option { + match output_type { + ElementOutput::Target => { + use tokio::task; + let cms = self.cms.clone(); + let imp = self.imp.clone(); + let config = self.config.clone(); + + let handle = task::spawn_blocking(move || { + let mut offscreen_renderer = OffscreenRenderer::new(3000, 3000).unwrap(); + let mut canvas = offscreen_renderer.create_canvas(); + let mut context = Context::new(cms, &mut canvas); + let mut runner = Runner::new(imp, config, context); + let (target, unique_key) = runner.run(&data); + let meta = data.meta.clone().into(); + Some(RenderResult::new(DataTarget::new(Some(data), target), meta, unique_key)) + }); + RUNTIME.block_on(handle).ok().flatten() + } + + _ => { + let mut canvas = render.get_canvas(); + let mut canvas = canvas.as_mut().unwrap(); + let mut context = Context::new(self.cms.clone(), &mut canvas); + let mut runner = Runner::new(self.imp, self.config.clone(), context); + runner.run_without_target(&data); + None + } + } + } + + fn get_file(&self, path: impl AsRef) -> PluginResult { + let loader = PLUGIN_MANAGER.get_plugin_by_name("etws_loader").unwrap(); + let path = path.as_ref().as_os_str().to_str().unwrap(); + let mut loaded_data = loader.load(path.into()).unwrap(); + + loaded_data + } + + fn current_key(&self) -> Key { + self.current_key.clone().unwrap() + } + + fn generate_key(&self, datetime: DateTime, unique_key: Option) -> Key { + Key { + id: self.id, + name: self.name.clone(), + root: self.root.clone(), + datetime: Some(datetime), + unique_key, + } } } diff --git a/src/pipeline/element_imp.rs b/src/pipeline/element_imp.rs index 16be8c9..c6dff80 100644 --- a/src/pipeline/element_imp.rs +++ b/src/pipeline/element_imp.rs @@ -16,14 +16,14 @@ use std::fmt::Debug; const EARTH_RADIUS: f64 = 6371.0; macro_rules! impl_element_imp_dispatch { - ($({$Abc: ident, $t:ty},)+) => { + ($({$Abc: ident, $t:ty, $input:ident },)+) => { impl ElementImpl { pub fn process<'a,'b:'a, T>(&self, dims: (ArrayView2, ArrayView2), input: ElementInput<'a, T>, config: &dyn Any, context: &mut Context<'b> - ) + ) -> Option where T: Sync + Send + Debug + PartialOrd + PartialEq + Copy + Clone + FromPrimitive + 'static, { @@ -31,8 +31,9 @@ macro_rules! impl_element_imp_dispatch { $( Self::$Abc(imp) => { let config = config.downcast_ref::<<$t as ElementImp>::Config<'a, T>>().unwrap(); - if let ElementInput::$Abc(data) = input { + if let ElementInput::$input(data) = input { imp.process(dims, data, config, context); + imp.unique_key(config) } else { panic!("Invalid input type"); } @@ -57,7 +58,7 @@ macro_rules! impl_element_imp_dispatch { } macro_rules! impl_element_try_from_dispatch { - ($({ $Abc: ident, $t:ty},)+) => { + ($({ $Abc: ident, $t:ty $(, $other:ident)? },)+) => { $( impl TryFrom for $t { type Error = &'static str; @@ -73,7 +74,7 @@ macro_rules! impl_element_try_from_dispatch { } macro_rules! impl_element_into_dispatch { - ($({ $Abc: ident, $t:ty},)+) => { + ($({ $Abc: ident, $t:ty $(,$other:ident)? },)+) => { $( impl From<$t> for ElementImpl { fn from(value: $t) -> Self { @@ -85,7 +86,7 @@ macro_rules! impl_element_into_dispatch { } macro_rules! impl_element_input_into_dispatch { - ($({$Abc: ident, $t: ty},)+) => { + ($({$Abc: ident, $t: ty $(,$other:ident)?},)+) => { $( impl<'a, T> From<$t> for ElementInput<'a, T> { fn from(value: $t) -> Self { @@ -99,9 +100,9 @@ macro_rules! impl_element_input_into_dispatch { macro_rules! for_all_variants { ($macro: tt) => { $macro! { - {Grid, GridImp}, - {MultiLayerGrid, MultiLayerGridImp}, - {Polar, PolarElementImp}, + {Grid, GridImp, Grid}, + {MultiLayerGrid, MultiLayerGridImp, Grid}, + {Polar, PolarElementImp, Grid}, } }; } @@ -154,6 +155,8 @@ pub trait ElementImp: Debug + TryFrom + Into { where Self: 'a; + fn new() -> Self; + fn process<'a, 'b: 'a, T>( &self, dims: (ArrayView2, ArrayView2), @@ -164,6 +167,13 @@ pub trait ElementImp: Debug + TryFrom + Into { T: Sync + Send + Debug + PartialOrd + PartialEq + Copy + Clone + FromPrimitive; fn output_type(&self) -> ElementOutput; + + fn unique_key<'a, T>(&self, config: &Self::Config<'a, T>) -> Option + where + T: Sync + Send + Debug + PartialOrd + PartialEq + Copy + Clone + FromPrimitive + 'static, + { + None + } } pub trait ElementConfig { @@ -181,7 +191,7 @@ where T: PartialOrd + PartialEq + Send + Sync + Debug + Clone, { pub color_map: ColorMapperComb, - pub fill_value: T + pub fill_value: T, } impl GridImp { @@ -238,6 +248,10 @@ impl ElementImp for GridImp { type Config<'a, T: Sync + Send + Debug + PartialOrd + PartialEq + Clone + FromPrimitive> = GridImpConfig where T: 'a; type Input<'a, T: 'a> = ArrayViewD<'a, T>; + + fn new() -> Self { + Self() + } fn process<'a, 'b: 'a, T>( &self, dims: (ArrayView2, ArrayView2), @@ -262,7 +276,7 @@ impl ElementImp for GridImp { } #[derive(Debug, Clone, Copy)] -pub struct MultiLayerGridImp(); +pub struct MultiLayerGridImp(GridImp); impl MultiLayerGridImp { fn draw<'a, 'b: 'a, T>( @@ -274,7 +288,8 @@ impl MultiLayerGridImp { ) where T: PartialOrd + PartialEq + Send + Sync + Debug + Copy + FromPrimitive, { - let two = config.twod.clone(); + // let two = config.twod.clone(); + let two = self.0; let _layer = data.into_dimensionality::().unwrap(); let data = _layer.index_axis(Axis(0), config.layer).into_dyn(); @@ -286,9 +301,9 @@ pub struct MultiLayerGridImpConfig where T: PartialOrd + PartialEq + Send + Sync + Debug + Clone, { - twod: GridImp, - two_d_config: GridImpConfig, - layer: usize, + // twod: GridImp, + pub two_d_config: GridImpConfig, + pub layer: usize, } impl ElementImp for MultiLayerGridImp { @@ -296,6 +311,10 @@ impl ElementImp for MultiLayerGridImp { MultiLayerGridImpConfig; type Input<'a, T: 'a> = ArrayViewD<'a, T>; + fn new() -> Self { + Self(GridImp()) + } + fn process<'a, 'b: 'a, T>( &self, dims: (ArrayView2, ArrayView2), @@ -311,6 +330,13 @@ impl ElementImp for MultiLayerGridImp { fn output_type(&self) -> ElementOutput { ElementOutput::Target } + + fn unique_key<'a, T>(&self, config: &Self::Config<'a, T>) -> Option + where + T: Sync + Send + Debug + PartialOrd + PartialEq + Copy + Clone + FromPrimitive + 'static, + { + Some(format!("l_{}", config.layer)) + } } #[derive(Debug, Clone, Copy)] @@ -363,7 +389,7 @@ impl PolarElementImp { let distance = EARTH_RADIUS * c * 1000.0; - if distance > max_r + dpi.1 { + if distance > max_r + dpi.0 { return None; } @@ -373,20 +399,20 @@ impl PolarElementImp { let ori_degree = y.atan2(x).to_degrees(); let degree = (ori_degree + 360.0) % 360.0; - let distance_dpi = dpi.1; - let degree_dpi = dpi.0; + let distance_dpi = dpi.0; + let degree_dpi = dpi.1; let final_degree = self.closest_value(degree, degree_dpi); let final_distance = self.closest_value(distance, distance_dpi); Some((final_degree, final_distance)) } - fn draw<'a, T>( + fn draw<'a,'b:'a, T>( &self, dims: (ArrayView2, ArrayView2), center: (f64, f64), data: ArrayView2, config: &'a PolarElementConfig, - context: &mut Context<'a>, + context: &mut Context<'b>, ) where T: PartialOrd + PartialEq + Send + Sync + Debug + Copy + FromPrimitive, { @@ -396,10 +422,10 @@ impl PolarElementImp { let dpi = ( dims.0[[0, 1]] - dims.0[[0, 0]], - dims.1[[1, 1]] - dims.1[[1, 0]], + dims.1[[1, 0]] - dims.1[[0, 0]], ); - let (azs, rs) = dims; + let (rs, azs) = dims; let (w, h) = (canvas.width(), canvas.height()); @@ -410,6 +436,7 @@ impl PolarElementImp { continue; } if let Some((_x, _y)) = self.map_to_polar(center, dpi, 0.0, map_point.unwrap()) { + println!("{}, {}", _x, _y); let (_x, _y) = (_x as usize, _y as usize); let value = data[[_x, _y]]; let color = config.color_map.color(value); @@ -431,6 +458,10 @@ impl ElementImp for PolarElementImp { type Config<'a, T: Sync + Send + Debug + PartialOrd + PartialEq + Clone + FromPrimitive> = PolarElementConfig where T: 'a; type Input<'a, T: 'a> = ArrayViewD<'a, T>; + + fn new() -> Self { + Self() + } fn process<'a, 'b: 'a, T>( &self, dims: (ArrayView2, ArrayView2), @@ -443,9 +474,10 @@ impl ElementImp for PolarElementImp { let shape = input.shape(); if shape.len() == 2 { let data = input.into_dimensionality::().unwrap(); - // self.draw(dims, config.center, data, config, context); + self.draw(dims, config.center, data, config, context); } else if shape.len() == 3 { let data = input.into_dimensionality::().unwrap(); + self.draw(dims, config.center, data.index_axis(Axis(0), 5), config, context); } } @@ -477,10 +509,12 @@ pub enum ElementImpl { #[derive(Debug)] pub enum ElementInput<'a, T> { Grid(ArrayViewD<'a, T>), - MultiLayerGrid(ArrayViewD<'a, T>), - Polar(ArrayViewD<'a, T>), } for_all_variants!(impl_element_into_dispatch); for_all_variants!(impl_element_try_from_dispatch); for_all_variants!(impl_element_imp_dispatch); + +impl_element_input_into_dispatch!( + {Grid, ArrayViewD<'a, T>}, +); diff --git a/src/pipeline/element_impl.rs b/src/pipeline/element_impl.rs deleted file mode 100644 index 6a9e00e..0000000 --- a/src/pipeline/element_impl.rs +++ /dev/null @@ -1,74 +0,0 @@ -use super::predefined::GridFieldRenderer; -use super::renders::DataRenderer; -use crate::components::Widget; -use crate::data::{Radar2d, Radar3d}; -use crate::pipeline::element::{ElementImpl, ElementImplMap, Target}; -use crate::pipeline::offscreen_renderer::CanvasWrapper; -use crate::predefined::color_mapper::ColorMapper; -use crate::widgets::LayerImpl; -use num_traits::{AsPrimitive, FromPrimitive, Num, NumOps}; -use radarg_plugin_interface::{DataShape, PluginResult}; -use std::any::Any; -use std::fmt::Debug; - -#[derive(Debug)] -pub struct GridElementImpl -where - T: Num + NumOps + PartialOrd + FromPrimitive + AsPrimitive + Send + Sync + Debug, - CMAP: ColorMapper, -{ - renderer: GridFieldRenderer, -} - -impl GridElementImpl -where - T: Num + NumOps + PartialOrd + FromPrimitive + AsPrimitive + Send + Sync + Debug, - CMAP: ColorMapper, -{ - pub fn new(color: CMAP) -> Self { - Self { - renderer: GridFieldRenderer::new(color), - } - } -} - -impl ElementImpl for GridElementImpl -where - T: Num - + NumOps - + PartialOrd - + Copy - + Clone - + Debug - + Send - + Sync - + FromPrimitive - + AsPrimitive, - CMAP: ColorMapper + Debug + 'static, -{ - fn render( - &self, - data: &PluginResult, - canvas: &mut CanvasWrapper, - cms: &mut crate::coords::cms::CMS, - ) -> crate::pipeline::element::Target { - let first_block = data.blocks.first().unwrap(); - match first_block.shape { - DataShape::Vector => { - panic!("Vector data is not supported") - } - DataShape::Matrix => { - let data: Radar2d = first_block.clone().into(); - let data = data.as_ref(); - let result = self.renderer.render(canvas, cms, &data, (3000.0, 3000.0)); - result - } - DataShape::Cube => { - let data: Radar3d = first_block.clone().into(); - let data = data.index_axis(ndarray::Axis(0), 0); - let result = self.renderer.render(canvas, cms, &data, (3000.0, 3000.0)); - result - } - } - } -} diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index 6ce9b4e..bfe5f6d 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -1,13 +1,12 @@ pub mod dispatcher; // pub mod element; // mod element_impl; -pub mod new_element; +pub mod element; // mod new_element_impl; // mod new_pipeline; pub mod offscreen_renderer; // mod predefined; pub mod element_imp; -mod renders; pub mod runner; // pub mod utils; @@ -15,5 +14,5 @@ pub use dispatcher::Dispatcher; // pub use element::*; // pub use element_impl::*; // pub use new_pipeline::Pipeline; -pub use new_element::*; +pub use element::*; pub use offscreen_renderer::OffscreenRenderer; diff --git a/src/pipeline/new_element.rs b/src/pipeline/new_element.rs deleted file mode 100644 index c1eab15..0000000 --- a/src/pipeline/new_element.rs +++ /dev/null @@ -1,468 +0,0 @@ -use super::dispatcher; -use super::element_imp::Context; -use super::element_imp::ElementImpl; -use super::element_imp::ElementOutput; -use super::offscreen_renderer; -use super::offscreen_renderer::CanvasWrapper; -use super::runner; -use super::runner::Runner; -use super::Dispatcher; -use crate::coords::cms::CMS; -use crate::coords::Range; -use crate::data::MetaInfo; -use crate::pipeline::OffscreenRenderer; -use crate::widgets::Render; -use crate::PLUGIN_MANAGER; -use crate::RUNTIME; -use chrono::prelude::*; -use femtovg::ImageFlags; -use femtovg::ImageId; -use futures::future::BoxFuture; -use glow::HasContext; -use num_traits::AsPrimitive; -use num_traits::FromPrimitive; -use num_traits::Num; -use num_traits::NumOps; -use quick_cache::sync::Cache; -use radarg_plugin_interface::PluginResult; -use std::any::Any; -use std::borrow::BorrowMut; -use std::cell::RefCell; -use std::collections::HashMap; -use std::fmt::Debug; -use std::hash::Hash; -use std::path::PathBuf; -use std::rc::Rc; -use std::sync::atomic::AtomicI32; -use std::sync::Arc; -use std::sync::RwLock; -use std::time::Duration; -use tokio::sync::oneshot; -use tokio::sync::{mpsc, Mutex}; -use tracing::subscriber; - -static ELEMENT_ID: AtomicI32 = AtomicI32::new(0); -pub type ElementID = i32; -pub type KVBuffer = Cache; -pub type Buffer = KVBuffer>>; - -pub type Data = Arc; - -#[derive(Debug, Hash, Eq, PartialEq, Clone)] -pub struct Key { - pub id: ElementID, - pub name: String, - pub root: std::path::PathBuf, - pub datetime: Option>, -} - -#[derive(Clone, Debug)] -pub struct Target { - pub target: TargetType, - pub thumbnail: Option, - pub width: f32, - pub height: f32, - pub bounds: (Range, Range), -} - -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] -pub enum TargetType { - ImageId(ImageId), - Mem(Vec), - NativeBuffer(Vec), -} - -impl Target { - pub fn new( - target: TargetType, - width: f32, - height: f32, - bounds: (Range, Range), - thumbnail: Option, - ) -> Self { - Self { - target, - width, - height, - bounds, - thumbnail, - } - } - - pub fn size(&self, cms: &Render) -> (f32, f32) { - let (x, y) = self.bounds; - - let p1 = (x.0, y.0); - let p2 = (x.1, y.1); - - let (x1, y1) = cms.map(p1).unwrap(); - let (x2, y2) = cms.map(p2).unwrap(); - - ((x2 - x1).abs(), (y2 - y1).abs()) - } - - pub fn native_buffer_to_native_texture( - &self, - gl: &glow::Context, - flags: ImageFlags, - ) -> glow::NativeTexture { - if let TargetType::NativeBuffer(ref mem) = self.target { - use glow::*; - let texture = unsafe { - let id = gl.create_texture().unwrap(); - gl.bind_texture(glow::TEXTURE_2D, Some(id)); - gl.pixel_store_i32(glow::UNPACK_ALIGNMENT, 1); - gl.pixel_store_i32(glow::UNPACK_ROW_LENGTH, 3000 as i32); - gl.pixel_store_i32(glow::UNPACK_SKIP_PIXELS, 0); - gl.pixel_store_i32(glow::UNPACK_SKIP_ROWS, 0); - id - }; - let width = 3000; // 纹理宽度 - let height = 3000; // 纹理高度 - unsafe { - gl.tex_image_2d( - glow::TEXTURE_2D, - 0, // level - glow::RGBA as i32, // internal_format - width, - height, - 0, // border - glow::RGBA, // format - glow::UNSIGNED_BYTE, // type - Some(&mem), // pixels - ); - } - - if flags.contains(ImageFlags::GENERATE_MIPMAPS) { - if flags.contains(ImageFlags::NEAREST) { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MIN_FILTER, - glow::NEAREST_MIPMAP_NEAREST as i32, - ); - } - } else { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MIN_FILTER, - glow::LINEAR_MIPMAP_LINEAR as i32, - ); - } - } - } else if flags.contains(ImageFlags::NEAREST) { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MIN_FILTER, - glow::NEAREST as i32, - ); - } - } else { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MIN_FILTER, - glow::LINEAR as i32, - ); - } - } - - if flags.contains(ImageFlags::NEAREST) { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MAG_FILTER, - glow::NEAREST as i32, - ); - } - } else { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_MAG_FILTER, - glow::LINEAR as i32, - ); - } - } - - if flags.contains(ImageFlags::REPEAT_X) { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_WRAP_S, - glow::REPEAT as i32, - ); - } - } else { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_WRAP_S, - glow::CLAMP_TO_EDGE as i32, - ); - } - } - - if flags.contains(ImageFlags::REPEAT_Y) { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_WRAP_T, - glow::REPEAT as i32, - ); - } - } else { - unsafe { - gl.tex_parameter_i32( - glow::TEXTURE_2D, - glow::TEXTURE_WRAP_T, - glow::CLAMP_TO_EDGE as i32, - ); - } - } - - unsafe { - gl.pixel_store_i32(glow::UNPACK_ALIGNMENT, 4); - gl.pixel_store_i32(glow::UNPACK_ROW_LENGTH, 0); - gl.pixel_store_i32(glow::UNPACK_SKIP_PIXELS, 0); - gl.pixel_store_i32(glow::UNPACK_SKIP_ROWS, 0); - } - - if flags.contains(ImageFlags::GENERATE_MIPMAPS) { - unsafe { - gl.generate_mipmap(glow::TEXTURE_2D); - } - } - - unsafe { - gl.bind_texture(glow::TEXTURE_2D, None); - } - - return texture; - } else { - panic!("Target is not mem"); - } - } - - pub fn origin(&self, cms: &Render) -> (f32, f32) { - let (x, y) = self.bounds; - let p1 = (x.0, y.1); - cms.map(p1).unwrap() - } - - pub fn set_target(&mut self, target: TargetType) { - self.target = target; - } -} - -#[derive(Debug, Clone)] -pub struct DataTarget { - pub data: Option, - target: Target, -} - -impl DataTarget { - pub fn new(data: Option, target: Target) -> Self { - Self { data, target } - } -} - -#[derive(Debug, Clone)] -pub struct RenderResult { - target: DataTarget, - meta_info: MetaInfo, -} - -impl RenderResult { - pub fn new(target: DataTarget, meta_info: MetaInfo) -> Self { - Self { target, meta_info } - } - pub fn get_meta_info(&self) -> MetaInfo { - self.meta_info.clone() - } - pub fn get_mut_target(&mut self) -> &mut Target { - &mut self.target.target - } -} - -#[derive(Debug)] -pub struct Element { - pub id: i32, - pub name: String, - pub cache: bool, - root: std::path::PathBuf, - config: Arc, - imp: ElementImpl, - subscribers: Arc>>>>>>, - cancellers: Arc>>>, - current_key: Option, - dispatcher: Arc, - buffer: Arc>, - file_pool: Arc>>, - current_target: Option>>, - cms: CMS, -} - -pub enum ElementEvent<'a> { - Init, - Draw, - DateTime(DateTime), - Key(&'a Key), -} - -impl Element { - pub fn new( - name: impl Into, - cms: CMS, - dispatcher: Arc, - cache: bool, - config: Arc, - root: std::path::PathBuf, - buffer: Arc>, - file_pool: Arc>>, - imp: ElementImpl, - ) -> Self { - let id = ELEMENT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); - Element { - id, - name: name.into(), - cache, - imp, - config, - root, - subscribers: Arc::new(Mutex::new(HashMap::new())), - cancellers: Arc::new(Mutex::new(HashMap::new())), - cms: cms, - current_key: None, - buffer, - file_pool, - current_target: None, - dispatcher, - } - } - - pub fn r<'b>(&mut self, event: ElementEvent<'b>, render: &Render) { - let need_cache = self.cache; - let output_type = self.imp.output_type(); - - fn _init( - this: &mut Element, - need_cache: bool, - output_type: ElementOutput, - render: &Render, - ) { - let data = this.file_pool.get(&this.root); - if let Some(data) = data { - let target = this._rrrr(data, need_cache, output_type, render); - if let Some(target) = target { - let time = target.meta_info.datetime.unwrap(); - let key = this.generate_key(time); - let target = Arc::new(RwLock::new(target)); - this.buffer.insert(key, target.clone()); - this.current_target = Some(target); - } - } - } - - match event { - ElementEvent::Init => { - _init(self, need_cache, output_type, render); - } - ElementEvent::Draw => { - if let Some(current) = self.current_target.as_ref() { - let mut img = current.write().unwrap(); - let mut img = img.get_mut_target(); - render.draw_img(img); - } else { - _init(self, need_cache, output_type, render); - if let ElementOutput::Target = output_type { - let mut _img = self.current_target.as_ref().unwrap(); - let mut img = _img.write().unwrap(); - let mut img = img.get_mut_target(); - render.draw_img(img); - } - } - } - ElementEvent::DateTime(time) => { - let path = self.dispatcher.get_single_path(&self.name, time, true); - path.map(|path| { - // let data = self.file_pool.get(&path); - }); - } - - ElementEvent::Key(key) => { - self.buffer.get(key); - } - } - } - - fn insert_target_to_buffer(&self, key: Key, render_result: RenderResult) { - let result = Arc::new(RwLock::new(render_result)); - self.buffer.insert(key, result); - } - - fn _rrrr( - &self, - data: Data, - need_cache: bool, - output_type: ElementOutput, - render: &Render, - ) -> Option { - match output_type { - ElementOutput::Target => { - use tokio::task; - let cms = self.cms.clone(); - let imp = self.imp.clone(); - let config = self.config.clone(); - - let handle = task::spawn_blocking(move || { - let mut offscreen_renderer = OffscreenRenderer::new(3000, 3000).unwrap(); - let mut canvas = offscreen_renderer.create_canvas(); - let mut context = Context::new(cms, &mut canvas); - let mut runner = Runner::new(imp, config, context); - let target = runner.run(&data); - let meta = data.meta.clone().into(); - Some(RenderResult::new(DataTarget::new(Some(data), target), meta)) - }); - let result = RUNTIME.block_on(handle).ok().flatten(); - result - // let result = RUNTIME.spawn(async {handle.await}); - } - - _ => { - let mut canvas = render.get_canvas(); - let mut canvas = canvas.as_mut().unwrap(); - let mut context = Context::new(self.cms.clone(), &mut canvas); - let mut runner = Runner::new(self.imp, self.config.clone(), context); - runner.run_without_target(&data); - None - } - } - } - - fn get_file(&self, path: impl AsRef) -> PluginResult { - let loader = PLUGIN_MANAGER.get_plugin_by_name("etws_loader").unwrap(); - let path = path.as_ref().as_os_str().to_str().unwrap(); - let mut loaded_data = loader.load(path.into()).unwrap(); - - loaded_data - } - - fn current_key(&self) -> Key { - self.current_key.clone().unwrap() - } - - fn generate_key(&self, datetime: DateTime) -> Key { - Key { - id: self.id, - name: self.name.clone(), - root: self.root.clone(), - datetime: Some(datetime), - } - } - fn key(&self) -> String { - format!("{}-{}", self.id, self.name) - } -} diff --git a/src/pipeline/new_element_impl.rs b/src/pipeline/new_element_impl.rs deleted file mode 100644 index 76d8983..0000000 --- a/src/pipeline/new_element_impl.rs +++ /dev/null @@ -1,104 +0,0 @@ -use super::{ - new_element::ElementImpl, offscreen_renderer::CanvasWrapper, predefined::GridFieldRenderer, - renders::DataRenderer, Target, -}; -use crate::{ - data::{Radar2d, Radar3d}, - predefined::color_mapper::{BoundaryNorm, ColorMapper}, -}; -use num_traits::{AsPrimitive, FromPrimitive, Num, NumOps}; -use radarg_plugin_interface::{DataShape, PluginResult}; -use std::{any::Any, fmt::Debug, marker::PhantomData}; - -macro_rules! create_element_imp { - ($imp: expr) => {{ - let c: ElementImp = $imp.into(); - c - }}; -} - -macro_rules! element { - ($generic:ident,$(($branch:tt,$imp:ty)),+) => { - pub(super) type ElementConfig = dyn Any + Send + Sync + 'static; - - pub enum ElementImp<$generic> - where - $generic: NumOps + PartialOrd + FromPrimitive + AsPrimitive + Send + Sync + Debug, - { - $( - $branch($imp), - )+ - } - - impl<$generic> ElementImp<$generic> - where - $generic: Num + NumOps + PartialOrd + FromPrimitive + AsPrimitive + Send + Sync + Debug, - { - pub fn render( - &self, - data: &PluginResult, - canvas: &mut CanvasWrapper, - cms: &mut crate::coords::cms::CMS, - config: &ElementConfig) -> Target - { - match self { - $( - ElementImp::$branch(imp) => imp.render(data,canvas,cms,config.downcast_ref::<<$imp as ElementImpl>::Config>().unwrap()), - )+ - } - } - } - - $( - impl<$generic> From<$imp> for ElementImp<$generic> - where - $generic: NumOps + PartialOrd + FromPrimitive + AsPrimitive + Send + Sync + Debug, - { - fn from(imp: $imp) -> Self { - ElementImp::$branch(imp) - } - } - )+ - }; -} - -// element!(T, (Grid, GridElementImpl)); - -#[derive(Debug)] -pub struct GridElementImpl {} - -impl GridElementImpl { - pub fn new() -> Self { - Self {} - } -} - -impl ElementImpl for GridElementImpl { - type Config = GridFieldRenderer, T>; - fn render( - &self, - data: &PluginResult, - canvas: &mut CanvasWrapper, - cms: &mut crate::coords::cms::CMS, - config: &Self::Config, - ) -> super::Target { - let first_block = data.blocks.first().unwrap(); - match first_block.shape { - DataShape::Vector => { - panic!("Vector data is not supported") - } - DataShape::Matrix => { - let data: Radar2d = first_block.clone().into(); - let data = data.as_ref(); - let result = config.render(canvas, cms, &data, (3000.0, 3000.0)); - result - } - DataShape::Cube => { - let data: Radar3d = first_block.clone().into(); - let data = data.index_axis(ndarray::Axis(0), 0); - let result = config.render(canvas, cms, &data, (3000.0, 3000.0)); - result - } - } - } -} diff --git a/src/pipeline/new_pipeline.rs b/src/pipeline/new_pipeline.rs deleted file mode 100644 index 943ba09..0000000 --- a/src/pipeline/new_pipeline.rs +++ /dev/null @@ -1,196 +0,0 @@ -use super::{ - dispatcher::Dispatcher, - element::{DataTarget, RenderResult}, - offscreen_renderer::{CanvasWrapper, OffscreenRenderer}, - // utils::data_to_element, -}; -use crate::coords::cms::CMS; -use crate::pipeline::element::Target; -use crate::{ - coords::{proj::Mercator, Mapper}, - data::MetaInfo, - errors::RenderError, - widgets::Layer, - PLUGIN_MANAGER, -}; -use chrono::prelude::*; -use femtovg::{renderer::OpenGl, Canvas, ImageId}; -use futures::{future::BoxFuture, Future}; -use radarg_plugin_interface::PluginResult; -use smallvec::SmallVec; -use std::fmt::{Debug, Formatter}; -use std::{ - cell::RefCell, - rc::Rc, - sync::{Arc, Mutex}, -}; -use tokio::{ - sync::{mpsc, oneshot}, - task, -}; - -type RenderR = Result; -pub struct Pipeline { - pool: Vec>, - results: SmallVec<[RenderResult; 20]>, - dispatcher: Option>, - handlers: Option, RenderR)>>>, - handler: Option>, - sender: Option>, - key: String, -} - -impl Debug for Pipeline { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Pipeline").finish() - } -} - -impl Pipeline { - pub fn new(len: usize, key: String) -> Self { - Self { - pool: Vec::new(), - results: SmallVec::new(), - dispatcher: None, - handlers: None, - handler: None, - sender: None, - key, - } - } - - pub fn set_dispatcher(&mut self, dispatcher: Rc) { - self.dispatcher = Some(dispatcher); - } - - pub fn init(&mut self) -> &mut Self { - self - } - - pub fn set_current( - &mut self, - current_time: DateTime, - check_existed: bool, - max_retry_time: usize, - task: Arc Target + Send + Sync>, - cms: CMS, - ) -> Option>> { - let paths = { - self.dispatcher.as_ref().unwrap().get_path( - &self.key, - current_time, - check_existed, - max_retry_time, - ) - }; - - if let Some(paths) = paths { - let mut recvs = Vec::new(); - let mut result = Vec::new(); - for (path, datetime) in paths.into_iter() { - let (sender, mut receiver) = oneshot::channel(); - self.add_task( - datetime, - self.worker(datetime, task.clone(), cms.clone(), path), - sender, - ); - recvs.push(receiver); - result.push(datetime); - } - self.handlers.replace(recvs); - Some(result) - } else { - None - } - } - - pub fn work_num(&self) -> usize { - self.pool.len() - } - - fn worker( - &self, - datetime: DateTime, - task: Arc Target + Send + Sync>, - mut cms: CMS, - path: impl AsRef + Send + 'static, - ) -> BoxFuture<'static, RenderR> { - Box::pin(async move { - let loader = PLUGIN_MANAGER.get_plugin_by_name("etws_loader").unwrap(); - let mut loaded_data = loader.load(path.as_ref().into()).unwrap(); - let meta = loaded_data.meta.clone().into(); - - let handle = task::spawn_blocking(move || { - let mut offscreen_renderer = OffscreenRenderer::new(3000, 3000).unwrap(); - let mut canvas_wrapper = offscreen_renderer.create_canvas(); - let target = task(&loaded_data, &mut canvas_wrapper, &mut cms); - DataTarget::new(Some(loaded_data), target) - }); - - let target = handle.await.unwrap(); - Ok(RenderResult::new(target, meta)) - }) - } - - pub fn add_task( - &mut self, - time: DateTime, - task: TASK, - tx: oneshot::Sender<(DateTime, RenderR)>, - ) where - TASK: Future + 'static + Send, - { - let future = async move { - let data = task.await; - tx.send((time, data)).unwrap(); - }; - - self.pool.push(Box::pin(future)); - } - - pub fn run(value: &mut Self) -> BoxFuture<'static, ()> { - let pool = value.get_pool(); - Box::pin(async move { - for f in pool.into_iter() { - task::spawn(f); - } - }) - } - - pub fn listening(&mut self, f: F) -> BoxFuture<'static, ()> - where - F: Fn(oneshot::Receiver<(DateTime, RenderR)>, usize) -> BoxFuture<'static, ()> - + Send - + 'static - + Sync, - { - let mut handler = self.handlers.take().unwrap(); - Box::pin(async move { - let l = handler.into_iter().enumerate().map(|(h, i)| f(i, h)); - for f in l { - task::spawn(f); - } - }) - } - - pub fn listening_one_by_one(&mut self, f: Vec) -> BoxFuture<'static, ()> - where - F: FnOnce(oneshot::Receiver<(DateTime, RenderR)>) -> BoxFuture<'static, ()> - + Send - + 'static - + Sync, - { - let mut handler = self.handlers.take().unwrap(); - Box::pin(async move { - for (h, f) in handler.into_iter().zip(f) { - task::spawn(f(h)); - } - }) - } - - pub fn get_pool(&mut self) -> Vec> { - use std::mem::replace; - let pool = replace(&mut self.pool, Vec::new()); - pool - } -} diff --git a/src/pipeline/pool copy.rs b/src/pipeline/pool copy.rs deleted file mode 100644 index f3ada8f..0000000 --- a/src/pipeline/pool copy.rs +++ /dev/null @@ -1,168 +0,0 @@ -use crate::errors::PoolError; -use smallvec::SmallVec; -use sorted_vec::SortedSet; -use std::collections::VecDeque; - -type PResult = Result; - -pub struct Pool -where - T: Send + Sync + Ord, -{ - items: SortedSet, - current: Option<(i64, usize)>, - len: usize, -} - -impl Pool -where - T: Send + Sync + Ord, -{ - pub fn new(len: usize) -> Self { - Pool { - items: VecDeque::new(), - current: None, - len, - } - } - - pub fn init(&mut self, timestamp: i64, item: T) -> PResult<()> { - let len = self.items.len(); - - if len == 0 { - self.items.push_back((timestamp, item)); - self.current.replace((timestamp, 0)); - return Ok(()); - } else { - return Err(PoolError::PoolInitialized("Pool is already initialized")); - } - } - - pub fn add(&mut self, item: T, timestamp: i64) -> PResult<()> { - let len = self.items.len(); - if len == self.len { - return Err(PoolError::PoolFull); - } - if len == 0 { - return Err(PoolError::PoolInitialized("Pool is not initialized")); - } - if len == 1 { - if self.items[0].0 < timestamp { - self.items.push_back((timestamp, item)); - } else { - self.items.push_front((timestamp, item)); - self.current.replace((timestamp, 1)); - } - return Ok(()); - } - - let back = self - .items - .back() - .map(|(last_timestamp, _)| *last_timestamp < timestamp) - .unwrap(); - let front = self - .items - .front() - .map(|(first_timestamp, _)| *first_timestamp > timestamp) - .unwrap(); - - if !(back || front) { - return Err(PoolError::TimestampError); - } - - if back { - self.items.push_back((timestamp, item)); - } else { - self.items.push_front((timestamp, item)); - self.current.as_mut().map(|(_, index)| *index += 1); - } - - Ok(()) - } - - pub fn prev(&self) -> Option<&T> { - self.current - .map(|(_, index)| &self.items[index]) - .map(|(_, item)| item) - } - - pub fn next(&mut self) -> Option<&T> { - let len = self.items.len(); - let current = self.current.as_mut().map(|(_, index)| index); - - if let Some(index) = current { - if *index + 1 < len { - *index += 1; - self.current - .as_ref() - .map(|(_, index)| &self.items[*index]) - .map(|(_, item)| item) - } else { - None - } - } else { - None - } - } - - pub fn get(&self, index: isize) -> Option<&T> { - self.current - .as_ref() - .map(|(_, current_index)| *current_index as isize + index) - .and_then(|index| { - if index >= 0 && index < self.items.len() as isize { - Some(&self.items[index as usize]) - } else { - None - } - }) - .map(|(_, item)| item) - } - - pub fn get_mut(&mut self, index: isize) -> Option<&mut T> { - self.current - .as_ref() - .map(|(_, current_index)| *current_index as isize + index) - .and_then(|index| { - if index >= 0 && index < self.items.len() as isize { - Some(&mut self.items[index as usize]) - } else { - None - } - }) - .map(|(_, item)| item) - } - - pub fn iter(&self) -> impl Iterator { - self.items.iter().map(|(_, item)| item) - } - - pub fn iter_mut(&mut self) -> impl Iterator { - self.items.iter_mut().map(|(_, item)| item) - } - - pub fn set_current(&mut self, timestamp: i64, item: T) -> PResult<()> { - if self.items.len() == 0 { - return Err(PoolError::PoolInitialized("Pool is not initialized")); - } - - let position = self.items.iter().position(|(time, _)| *time == timestamp); - - if let Some(p) = position { - let start = (p - self.len / 2).max(0); - let end = (p + self.len / 2).min(self.items.len() - 1); - self.items = self.items.drain(start..end).collect(); - self.current.replace((timestamp, self.len / 2)); - return Ok(()); - } else { - self.items.clear(); - self.init(timestamp, item); - return Ok(()); - } - } - - pub fn len(&self) -> usize { - self.items.len() - } -} diff --git a/src/pipeline/render_pipeline.rs b/src/pipeline/render_pipeline.rs deleted file mode 100644 index 28d4494..0000000 --- a/src/pipeline/render_pipeline.rs +++ /dev/null @@ -1,210 +0,0 @@ -use super::{ - dispatcher::Dispatcher, - offscreen_renderer::{CanvasWrapper, OffscreenRenderer}, -}; -use crate::{ - coords::{cms::CMS, proj::Mercator, Mapper}, - data::MetaInfo, - errors::RenderError, - widgets::Layer, - PLUGIN_MANAGER, -}; -use chrono::prelude::*; -use femtovg::{renderer::OpenGl, Canvas, ImageId}; -use futures::{future::BoxFuture, Future}; -use smallvec::SmallVec; -use std::{ - cell::RefCell, - rc::Rc, - sync::{Arc, Mutex}, -}; -use tokio::{ - sync::{mpsc, oneshot}, - task, -}; - -#[derive(Clone, Debug)] -pub struct RenderResult { - pub meta: MetaInfo, - pub layer: Layer, - time: DateTime, -} - -impl RenderResult { - pub fn new(layer: Layer, time: DateTime, meta: MetaInfo) -> Self { - Self { layer, time, meta } - } - - pub fn timestamp(&self) -> i64 { - self.time.timestamp() - } - - pub fn time(&self) -> DateTime { - self.time - } -} - -type RenderR = Result; -pub struct Pipeline { - pool: Vec>, - results: SmallVec<[RenderResult; 20]>, - dispatcher: Option>>, - handlers: Option>>, - handler: Option>, - sender: Option>, - key: String, -} - -impl Pipeline { - pub fn new(len: usize, key: String) -> Self { - Self { - pool: Vec::new(), - results: SmallVec::new(), - dispatcher: None, - handlers: None, - handler: None, - sender: None, - key, - } - } - - pub fn set_dispatcher(&mut self, dispatcher: Rc>) { - self.dispatcher = Some(dispatcher); - } - - pub fn init(&mut self) -> &mut Self { - self - } - - pub fn set_current( - &mut self, - current_time: DateTime, - check_existed: bool, - max_retry_time: usize, - ) -> Option>> { - let paths = { - let dispatcher = self.dispatcher.as_ref().unwrap(); - let dispatcher = dispatcher.borrow(); - dispatcher.get_path(&self.key, current_time, check_existed, max_retry_time) - }; - if let Some(paths) = paths { - let mut recvs = Vec::new(); - let mut result = Vec::new(); - for (path, datetime) in paths.into_iter() { - let (sender, mut receiver) = oneshot::channel::(); - self.add_task(datetime.timestamp(), self.worker(datetime, path), sender); - recvs.push(receiver); - result.push(datetime); - } - self.handlers.replace(recvs); - Some(result) - } else { - None - } - } - - pub fn work_num(&self) -> usize { - self.pool.len() - } - - fn worker( - &self, - datetime: DateTime, - path: impl AsRef + Send + 'static, - ) -> BoxFuture<'static, RenderR> { - Box::pin(async move { - let loader = PLUGIN_MANAGER.get_plugin_by_name("etws_loader").unwrap(); - let mut loaded_data = loader.load(path.as_ref().into()).unwrap(); - let first_block = loaded_data.blocks.pop().unwrap(); - if let Some((_, layer)) = data_to_layer(first_block) { - let handle = task::spawn_blocking(move || { - let mut offscreen_renderer = OffscreenRenderer::new(3000, 3000).unwrap(); - let canvas_wrapper = offscreen_renderer.create_canvas(); - let canvas_mutex = std::sync::Arc::new(std::sync::Mutex::new(canvas_wrapper)); - - let f = { - let p = layer.get_prepare(); - let mut _p = p.lock().unwrap(); - _p.take() - }; - - let target = if let Some(f) = f { - let imp = layer.get_imp().unwrap(); - let map: Mapper = Mercator::default().into(); - let cms = CMS::new(map, (3000.0, 3000.0)); - let canvas = canvas_mutex.clone(); - let c = f(imp, canvas.clone(), cms); - let canvas = canvas.lock().unwrap(); - Some(c) - } else { - None - }; - - layer.set_render_target(target.unwrap()); - layer - }); - let target = handle.await.unwrap(); - Ok(RenderResult::new(target, datetime, loaded_data.meta.into())) - } else { - println!("no layer"); - Err(RenderError::None) - } - }) - } - - pub fn add_task(&mut self, timestamp: i64, task: TASK, tx: oneshot::Sender) - where - TASK: Future + 'static + Send, - { - let future = async move { - let data = task.await; - tx.send(data).unwrap(); - }; - - self.pool.push(Box::pin(future)); - } - - pub fn run(value: &mut Self) -> BoxFuture<'static, ()> { - let pool = value.get_pool(); - Box::pin(async move { - for f in pool.into_iter() { - task::spawn(f); - // f.await; - } - }) - } - - pub fn listening(&mut self, f: F) -> BoxFuture<'static, ()> - where - F: Fn(oneshot::Receiver, usize) -> BoxFuture<'static, ()> + Send + 'static + Sync, - { - let mut handler = self.handlers.take().unwrap(); - Box::pin(async move { - let l = handler.into_iter().enumerate().map(|(h, i)| f(i, h)); - for f in l.into_iter() { - f.await; - } - }) - } - - pub fn listening_one_by_one(&mut self, f: Vec) -> BoxFuture<'static, ()> - where - F: FnOnce(oneshot::Receiver) -> BoxFuture<'static, ()> + Send + 'static + Sync, - { - let mut handler = self.handlers.take().unwrap(); - Box::pin(async move { - for (h, f) in handler.into_iter().zip(f) { - task::spawn(f(h)); - // f(h).await; - } - }) - } - - pub fn get_pool(&mut self) -> Vec> { - use std::mem::replace; - let pool = replace(&mut self.pool, Vec::new()); - pool - } - - pub fn cancel_task(&mut self, timestamp: i64) {} -} diff --git a/src/pipeline/runner.rs b/src/pipeline/runner.rs index c9ca982..3583726 100644 --- a/src/pipeline/runner.rs +++ b/src/pipeline/runner.rs @@ -26,11 +26,12 @@ macro_rules! impl_for_runner { $( $t(ref v) => { let input = ArrayViewD::from_shape($size, v.as_ref()).unwrap(); - let data = ElementInput::Grid(input); - $imp.process($dims, data, $config, $context ); + let data = input.into(); + $imp.process($dims, data, $config, $context ) } - )+ + _ => { panic!("") } + } }; } @@ -50,7 +51,7 @@ impl<'a> Runner<'a> { } } - pub fn run(&mut self, data: &PluginResult) -> Target { + pub fn run(&mut self, data: &PluginResult) -> (Target, Option) { use femtovg::{ImageFlags, PixelFormat::Rgba8}; let canvas = &mut self.context.canvas; let (w, h) = (canvas.width(), canvas.height()); @@ -62,7 +63,7 @@ impl<'a> Runner<'a> { canvas.set_render_target(RenderTarget::Image(new_img)); // Drawing - let dims = self.run_without_target(data); + let (dims, key) = self.run_without_target(data); // Reading Pixels let mut pixels: Vec = vec![0; w as usize * h as usize * 4]; @@ -79,21 +80,28 @@ impl<'a> Runner<'a> { debug_assert_eq!(gl::GetError(), gl::NO_ERROR); } self.context.canvas.set_render_target(RenderTarget::Screen); - let d1_start = (dims.0.view()).first().unwrap().clone(); - let d1_end = (dims.0.view()).last().unwrap().clone(); - let d2_start = dims.1.view().first().unwrap().clone(); - let d2_end = dims.1.view().last().unwrap().clone(); + // let d1_start = (dims.0.view()).first().unwrap().clone(); + // let d1_end = (dims.0.view()).last().unwrap().clone(); + // let d2_start = dims.1.view().first().unwrap().clone(); + // let d2_end = dims.1.view().last().unwrap().clone(); - Target::new( + let lon_range = data.meta.lon_range.unwrap().to_vec(); + let lat_range = data.meta.lat_range.unwrap().to_vec(); + + (Target::new( TargetType::NativeBuffer(pixels), w as f32, h as f32, - ((d1_start, d1_end).into(), (d2_start, d2_end).into()), + ((lon_range[0], lon_range[1]).into(), (lat_range[0], lat_range[1]).into()), None, - ) + ), key) } - pub fn run_without_target(&mut self, data: &PluginResult) -> (Array2, Array2) { + pub fn run_without_target(&mut self, data: &PluginResult) -> ((Array2, Array2), Option) { + + let lon_range = data.meta.lon_range.unwrap().to_vec(); + let lat_range = data.meta.lat_range.unwrap().to_vec(); + let block = data.blocks.first().unwrap(); let data = &block.data; let dims = &block.dimension_values; @@ -119,19 +127,12 @@ impl<'a> Runner<'a> { let cms = &mut context.cms; let canvas = &mut context.canvas; let (w, h) = (canvas.width(), canvas.height()); - - let lat_start = dims.1.view().first().unwrap().clone(); - let lat_end = dims.1.view().last().unwrap().clone(); - - let lon_start = dims.0.view().first().unwrap().clone(); - let lon_end = dims.0.view().last().unwrap().clone(); - - cms.set_lat_range(lat_start..lat_end); - cms.set_lon_range(lon_start..lon_end); + cms.set_lat_range(lat_range[0]..lat_range[1]); + cms.set_lon_range(lon_range[0]..lon_range[1]); use VecResult::*; - impl_for_runner!( + let unique_key = impl_for_runner!( imp, data, (dims.0.view(), dims.1.view()), @@ -149,6 +150,6 @@ impl<'a> Runner<'a> { { U32 }, ); context.canvas.flush(); - dims + (dims, unique_key) } } diff --git a/src/plugin_system/utils.rs b/src/plugin_system/utils.rs index f1ccbd4..07a3cd7 100644 --- a/src/plugin_system/utils.rs +++ b/src/plugin_system/utils.rs @@ -15,7 +15,7 @@ macro_rules! match_in_macro_3d { let data_shape: Vec = $block.size.into(); let coord_type = match $block.coord_type{ radarg_plugin_interface::CoordType::Cartesian => CoordType::LatLon, - radarg_plugin_interface::CoordType::Polar => CoordType::Polar, + radarg_plugin_interface::CoordType::Polar(loc, range) => CoordType::Polar((loc.x, loc.y, loc.z), range), _ => panic!("Unsupported coord type") }; match data { @@ -48,7 +48,7 @@ macro_rules! match_in_macro { let data_shape: Vec = $block.size.into(); let coord_type = match $block.coord_type{ radarg_plugin_interface::CoordType::Cartesian => CoordType::LatLon, - radarg_plugin_interface::CoordType::Polar => CoordType::Polar, + radarg_plugin_interface::CoordType::Polar(loc, range) => CoordType::Polar((loc.x, loc.y, loc.z), range), _ => panic!("Unsupported coord type") }; match data { diff --git a/src/widgets/render/imp.rs b/src/widgets/render/imp.rs index 892784a..da400dd 100644 --- a/src/widgets/render/imp.rs +++ b/src/widgets/render/imp.rs @@ -4,7 +4,7 @@ use super::{Layer, WindowCoord}; use crate::coords::proj::Mercator; use crate::coords::Mapper; use crate::map_tile::MapTile; -use crate::pipeline::new_element::{Target, TargetType}; +use crate::pipeline::element::{Target, TargetType}; use femtovg::{Canvas, Color, FontId, Paint, Renderer}; use glow::HasContext; use gtk::glib::{self, prelude::*, Properties}; diff --git a/src/widgets/render/interior/layers.rs b/src/widgets/render/interior/layers.rs index d2afc49..5893a12 100644 --- a/src/widgets/render/interior/layers.rs +++ b/src/widgets/render/interior/layers.rs @@ -1,7 +1,7 @@ use super::super::Render; use crate::errors::PipelineError; -use crate::pipeline::new_element::{self, Target}; -use crate::pipeline::new_element::{Element, ElementEvent}; +use crate::pipeline::element::{self, Target}; +use crate::pipeline::element::{Element, ElementEvent}; use crate::RUNTIME; use femtovg::{renderer::OpenGl, Canvas}; use std::cell::RefCell;