levels
This commit is contained in:
parent
b29b26c5e7
commit
fcbc5d2db4
282
Cargo.lock
generated
282
Cargo.lock
generated
@ -99,8 +99,8 @@ dependencies = [
|
|||||||
"lazycell",
|
"lazycell",
|
||||||
"log",
|
"log",
|
||||||
"peeking_take_while",
|
"peeking_take_while",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"regex",
|
"regex",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"shlex",
|
"shlex",
|
||||||
@ -245,11 +245,13 @@ dependencies = [
|
|||||||
"glib",
|
"glib",
|
||||||
"glib-build-tools",
|
"glib-build-tools",
|
||||||
"gtk4",
|
"gtk4",
|
||||||
|
"ndarray",
|
||||||
"npyz",
|
"npyz",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"plotters",
|
"plotters",
|
||||||
"plotters-backend",
|
"plotters-backend",
|
||||||
"proj",
|
"proj",
|
||||||
|
"quadtree_rs",
|
||||||
"shapefile",
|
"shapefile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@ -284,7 +286,7 @@ dependencies = [
|
|||||||
"ansi_term",
|
"ansi_term",
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"strsim",
|
"strsim 0.8.0",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"vec_map",
|
"vec_map",
|
||||||
@ -407,6 +409,41 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fcfbcb0c5961907597a7d1148e3af036268f2b773886b8bb3eeb1e1281d3d3d6"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"darling_macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_core"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6afc018370c3bff3eb51f89256a6bdb18b4fdcda72d577982a14954a7a0b402c"
|
||||||
|
dependencies = [
|
||||||
|
"fnv",
|
||||||
|
"ident_case",
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"strsim 0.7.0",
|
||||||
|
"syn 0.15.44",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_macro"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"syn 0.15.44",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbase"
|
name = "dbase"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -417,6 +454,31 @@ dependencies = [
|
|||||||
"time 0.3.21",
|
"time 0.3.21",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive_builder"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4"
|
||||||
|
dependencies = [
|
||||||
|
"darling",
|
||||||
|
"derive_builder_core",
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"syn 0.15.44",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive_builder_core"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37"
|
||||||
|
dependencies = [
|
||||||
|
"darling",
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"syn 0.15.44",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.10.7"
|
version = "0.10.7"
|
||||||
@ -536,6 +598,12 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e"
|
checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "font-kit"
|
name = "font-kit"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@ -635,8 +703,8 @@ version = "0.3.28"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -734,8 +802,8 @@ dependencies = [
|
|||||||
name = "geo-macros"
|
name = "geo-macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -843,8 +911,8 @@ dependencies = [
|
|||||||
"heck",
|
"heck",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -962,8 +1030,8 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro-error",
|
"proc-macro-error",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1045,6 +1113,12 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ident_case"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.24.6"
|
version = "0.24.6"
|
||||||
@ -1055,7 +1129,7 @@ dependencies = [
|
|||||||
"byteorder",
|
"byteorder",
|
||||||
"color_quant",
|
"color_quant",
|
||||||
"jpeg-decoder",
|
"jpeg-decoder",
|
||||||
"num-rational",
|
"num-rational 0.4.1",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"png",
|
"png",
|
||||||
]
|
]
|
||||||
@ -1146,6 +1220,16 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matrixmultiply"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"rawpointer",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
@ -1186,6 +1270,19 @@ dependencies = [
|
|||||||
"simd-adler32",
|
"simd-adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndarray"
|
||||||
|
version = "0.15.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
|
||||||
|
dependencies = [
|
||||||
|
"matrixmultiply",
|
||||||
|
"num-complex 0.4.3",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
"rawpointer",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "7.1.3"
|
version = "7.1.3"
|
||||||
@ -1203,11 +1300,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "80581878bc671c9c832a199569fdb6696a1948b32346a8095c939d12a1946178"
|
checksum = "80581878bc671c9c832a199569fdb6696a1948b32346a8095c939d12a1946178"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"num-bigint",
|
"num-bigint 0.4.3",
|
||||||
"py_literal",
|
"py_literal",
|
||||||
"zip",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"
|
||||||
|
dependencies = [
|
||||||
|
"num-bigint 0.2.6",
|
||||||
|
"num-complex 0.2.4",
|
||||||
|
"num-integer",
|
||||||
|
"num-iter",
|
||||||
|
"num-rational 0.2.4",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-bigint"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-bigint"
|
name = "num-bigint"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@ -1219,6 +1341,16 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-complex"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-complex"
|
name = "num-complex"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@ -1238,6 +1370,29 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-iter"
|
||||||
|
version = "0.1.43"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-rational"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-bigint 0.2.6",
|
||||||
|
"num-integer",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-rational"
|
name = "num-rational"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@ -1367,8 +1522,8 @@ checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"pest",
|
"pest",
|
||||||
"pest_meta",
|
"pest_meta",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1472,8 +1627,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error-attr",
|
"proc-macro-error-attr",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
@ -1484,11 +1639,20 @@ version = "1.0.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "0.4.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.58"
|
version = "1.0.58"
|
||||||
@ -1530,20 +1694,39 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "102df7a3d46db9d3891f178dcc826dc270a6746277a9ae6436f8d29fd490a8e1"
|
checksum = "102df7a3d46db9d3891f178dcc826dc270a6746277a9ae6436f8d29fd490a8e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint",
|
"num-bigint 0.4.3",
|
||||||
"num-complex",
|
"num-complex 0.4.3",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"pest",
|
"pest",
|
||||||
"pest_derive",
|
"pest_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quadtree_rs"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ec1506903c0f5cff273bd34df6646c7040f2a7c5b0a92a9179d89551bed9ffd"
|
||||||
|
dependencies = [
|
||||||
|
"derive_builder",
|
||||||
|
"num",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "0.6.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.27"
|
version = "1.0.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
|
checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1552,6 +1735,12 @@ version = "0.6.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rawpointer"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.16"
|
version = "0.2.16"
|
||||||
@ -1661,8 +1850,8 @@ version = "1.0.160"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
|
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1735,6 +1924,12 @@ version = "1.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@ -1747,14 +1942,25 @@ version = "2.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "0.15.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.30",
|
||||||
|
"quote 0.6.13",
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1764,8 +1970,8 @@ version = "2.0.16"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
|
checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1832,8 +2038,8 @@ version = "1.0.40"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1928,6 +2134,12 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vec_map"
|
name = "vec_map"
|
||||||
version = "0.8.2"
|
version = "0.8.2"
|
||||||
@ -1987,8 +2199,8 @@ dependencies = [
|
|||||||
"bumpalo",
|
"bumpalo",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@ -1999,7 +2211,7 @@ version = "0.2.85"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434"
|
checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2009,8 +2221,8 @@ version = "0.2.85"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869"
|
checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2 1.0.58",
|
||||||
"quote",
|
"quote 1.0.27",
|
||||||
"syn 2.0.16",
|
"syn 2.0.16",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
|
|||||||
@ -22,6 +22,8 @@ shapefile = { version = "0.4", features = ["geo-types"] }
|
|||||||
thiserror = "1.0.40"
|
thiserror = "1.0.40"
|
||||||
num-traits = "0.2.15"
|
num-traits = "0.2.15"
|
||||||
npyz = { version = "0.8.0", features = ["npz"] }
|
npyz = { version = "0.8.0", features = ["npz"] }
|
||||||
|
ndarray = "0.15.6"
|
||||||
|
quadtree_rs = "0.1.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
glib-build-tools = "0.17.0"
|
glib-build-tools = "0.17.0"
|
||||||
|
|||||||
144
src/data.rs
Normal file
144
src/data.rs
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
use ndarray::{array, s, Array, Array1, Array2, Array3};
|
||||||
|
use num_traits::{AsPrimitive, FromPrimitive, Num, ToPrimitive};
|
||||||
|
use quadtree_rs::Quadtree;
|
||||||
|
use std::{self, borrow::Borrow, f64::consts::PI};
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
|
type Lon = f64;
|
||||||
|
type Lat = f64;
|
||||||
|
|
||||||
|
#[derive(Error, Debug)]
|
||||||
|
pub enum DataError {
|
||||||
|
#[error("value")]
|
||||||
|
FormatError,
|
||||||
|
#[error("")]
|
||||||
|
IOError {
|
||||||
|
#[from]
|
||||||
|
source: std::io::Error,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum CoorType {
|
||||||
|
Polar,
|
||||||
|
LatLon,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RadarData2d<T: Num, X = f64, Y = f64>
|
||||||
|
where
|
||||||
|
T: Num,
|
||||||
|
X: Num,
|
||||||
|
Y: Num,
|
||||||
|
{
|
||||||
|
pub dim1: Array1<X>,
|
||||||
|
pub dim2: Array1<Y>,
|
||||||
|
pub data: Array2<T>,
|
||||||
|
pub coord_type: CoorType,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RadarData3d<T, X = f64, Y = f64, Z = f64>
|
||||||
|
where
|
||||||
|
T: Num,
|
||||||
|
X: Num,
|
||||||
|
Y: Num,
|
||||||
|
Z: Num,
|
||||||
|
{
|
||||||
|
pub dim1: Array1<X>,
|
||||||
|
pub dim2: Array1<Y>,
|
||||||
|
pub dim3: Array1<Z>,
|
||||||
|
pub data: Array3<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
trait MultiDimensionData<T: Num> {
|
||||||
|
fn levels(&self, levels: impl IntoIterator<Item = T>) -> Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Num + AsPrimitive<f64> + FromPrimitive> RadarData2d<T> {
|
||||||
|
fn resample(
|
||||||
|
&self,
|
||||||
|
width_rate: f64,
|
||||||
|
height_rate: f64,
|
||||||
|
filter_len: f64,
|
||||||
|
) -> Result<Array2<T>, DataError> {
|
||||||
|
let width_rate = width_rate.min(1.0);
|
||||||
|
let height_rate = height_rate.min(1.0);
|
||||||
|
match self.coord_type {
|
||||||
|
CoorType::Polar => Err(DataError::FormatError),
|
||||||
|
CoorType::LatLon => {
|
||||||
|
let width_filtered = Self::_resample(&self.data, width_rate, filter_len, false);
|
||||||
|
Ok(Self::_resample(
|
||||||
|
&width_filtered,
|
||||||
|
height_rate,
|
||||||
|
filter_len,
|
||||||
|
true,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn split(&self) {
|
||||||
|
let a = self.data.slice(s![0..10, 1..10]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _resample(data: &Array2<T>, rate: f64, filter_len: f64, reverse: bool) -> Array2<T> {
|
||||||
|
let ori_width = if reverse { data.nrows() } else { data.ncols() };
|
||||||
|
let ori_height = if reverse { data.ncols() } else { data.nrows() };
|
||||||
|
|
||||||
|
let new_width = (ori_width as f64 * rate).ceil() as usize;
|
||||||
|
let mut result: Array2<T> = Array2::zeros((ori_height, new_width));
|
||||||
|
(0..ori_height).into_iter().for_each(|height| {
|
||||||
|
for width in 0..new_width {
|
||||||
|
let center_x = (width as f64 + 0.5) / new_width as f64 * ori_width as f64;
|
||||||
|
let filter_start = center_x - filter_len / 2.0;
|
||||||
|
let start_idx = (filter_start - 0.5).ceil() as usize;
|
||||||
|
|
||||||
|
let mut value_sum = 0.0;
|
||||||
|
let mut filter_sum = 0.0;
|
||||||
|
|
||||||
|
for i in 0..filter_len as usize {
|
||||||
|
let input_x = start_idx + i;
|
||||||
|
let weight = windowed_sinc(
|
||||||
|
(input_x as f64 + 0.5 - center_x) * rate,
|
||||||
|
(input_x as f64 + 0.5 - filter_start) / filter_len,
|
||||||
|
);
|
||||||
|
value_sum += weight * data[[height, input_x.clamp(0, ori_width - 1)]].as_();
|
||||||
|
filter_sum += weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
result[[height, width]] = T::from_f64(value_sum / filter_sum).unwrap();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn windowed_sinc(x: f64, y: f64) -> f64 {
|
||||||
|
let x = x * PI;
|
||||||
|
let sinc = if x != 0.0 { f64::sin(x) / x } else { 1.0 };
|
||||||
|
let window = if 0f64 <= y && y <= 1.0 {
|
||||||
|
1.0 - (y - 0.5).abs() * 2.0
|
||||||
|
} else {
|
||||||
|
0f64
|
||||||
|
};
|
||||||
|
sinc * window
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct LevelData<T: Num> {
|
||||||
|
levels: Vec<RadarData2d<T>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Num> LevelData<T> {
|
||||||
|
fn new(levels: Vec<RadarData2d<T>>) -> Self {
|
||||||
|
let mut qt = Quadtree::<i32, RadarData2d<T>>::new(levels.len());
|
||||||
|
Self { levels }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// impl<T: Num + AsPrimitive<f64> + FromPrimitive> MultiDimensionData<T> for RadarData2d<T> {
|
||||||
|
// // fn levels(&self, levels: usize) -> Self {
|
||||||
|
// // let a: Vec<_> = Array1::linspace(0.0, 1.0, levels)
|
||||||
|
// // .into_iter()
|
||||||
|
// // .map(|scale| self.resample(scale, scale, 3.0))
|
||||||
|
// // .collect();
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
156
src/main.rs
156
src/main.rs
@ -1,27 +1,22 @@
|
|||||||
use backend::CairoBackend;
|
use backend::CairoBackend;
|
||||||
use plotters::chart::MeshStyle;
|
|
||||||
use plotters::prelude::*;
|
|
||||||
|
|
||||||
use geo_types::{MultiPolygon, Polygon};
|
|
||||||
use gtk::gdk::Display;
|
use gtk::gdk::Display;
|
||||||
use gtk::{
|
use gtk::{gio, glib, style_context_add_provider_for_display, Application, CssProvider};
|
||||||
gio, glib, style_context_add_provider_for_display, Application, ApplicationWindow, CssProvider,
|
|
||||||
StyleContext,
|
|
||||||
};
|
|
||||||
use plotters::coord::geo::*;
|
use plotters::coord::geo::*;
|
||||||
|
use plotters::prelude::*;
|
||||||
use shapefile;
|
use shapefile;
|
||||||
|
|
||||||
use gtk::{prelude::*, DrawingArea};
|
use gtk::{prelude::*, DrawingArea};
|
||||||
use proj::Proj;
|
use npyz::npz::NpzArchive;
|
||||||
// use plotters::prelude::{ChartBuilder, IntoDrawingArea, Rectangle};
|
use plotters::style::{BLACK, WHITE};
|
||||||
use npyz::npz::{self, NpzArchive};
|
|
||||||
use plotters::style::{HSLColor, BLACK, WHITE};
|
|
||||||
// use plotters::prelude::DrawingArea;
|
|
||||||
use window::Window;
|
use window::Window;
|
||||||
mod backend;
|
mod backend;
|
||||||
mod painter;
|
mod painter;
|
||||||
mod trees;
|
mod trees;
|
||||||
mod window;
|
mod window;
|
||||||
|
mod data;
|
||||||
|
|
||||||
|
use ndarray::{self, ArrayD};
|
||||||
|
use trees::get;
|
||||||
|
|
||||||
const APP_ID: &str = "org.gtk_rs.HelloWorld2";
|
const APP_ID: &str = "org.gtk_rs.HelloWorld2";
|
||||||
|
|
||||||
@ -39,6 +34,24 @@ fn main() -> glib::ExitCode {
|
|||||||
app.run()
|
app.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn load_npz() -> ArrayD<i8> {
|
||||||
|
use ndarray::ShapeBuilder;
|
||||||
|
|
||||||
|
let mut npz_file = NpzArchive::open("/home/ruomu/Desktop/test.npz").unwrap();
|
||||||
|
let reader = npz_file.by_name("value").unwrap().unwrap();
|
||||||
|
|
||||||
|
let shape = reader.shape().to_vec();
|
||||||
|
let order = reader.order();
|
||||||
|
let data = reader.into_vec::<i8>().unwrap();
|
||||||
|
|
||||||
|
let _shape: Vec<_> = shape.into_iter().map(|x| x as usize).collect();
|
||||||
|
|
||||||
|
let true_shape = _shape.set_f(order == npyz::Order::Fortran);
|
||||||
|
|
||||||
|
ndarray::ArrayD::from_shape_vec(true_shape, data)
|
||||||
|
.unwrap_or_else(|e| panic!("shape error: {}", e))
|
||||||
|
}
|
||||||
|
|
||||||
fn build_ui(app: &Application) {
|
fn build_ui(app: &Application) {
|
||||||
// Create a window and set the title
|
// Create a window and set the title
|
||||||
|
|
||||||
@ -53,21 +66,59 @@ fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
root.fill(&WHITE);
|
root.fill(&WHITE);
|
||||||
|
|
||||||
use trees::get;
|
let levels: Vec<i8> = vec![0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65];
|
||||||
|
|
||||||
let mut npz_file = NpzArchive::open("/Users/ruomu/test.npz").unwrap();
|
// ['#00ACA4', '#C0C0FE', '#7A72EE', '#1E26D0', '#A6FCA8', '#00EA00', '#10921A', '#FCF464', '#C8C802', '#8C8C00', '#FEACAC', '#FE645C', '#EE0230', '#D48EFE', '#AA24FA']
|
||||||
|
let colors = vec![
|
||||||
// let value = npz_file.by_name("value").unwrap().unwrap();
|
RGBColor(0, 172, 164),
|
||||||
let lon = npz_file.by_name("lon").unwrap().unwrap();
|
RGBColor(192, 192, 254),
|
||||||
// let lat = npz_file.by_name("lat").unwrap().unwrap();
|
RGBColor(122, 114, 238),
|
||||||
|
RGBColor(30, 38, 208),
|
||||||
|
RGBColor(166, 252, 168),
|
||||||
|
RGBColor(0, 234, 0),
|
||||||
|
RGBColor(16, 146, 26),
|
||||||
|
RGBColor(252, 244, 100),
|
||||||
|
RGBColor(200, 200, 2),
|
||||||
|
RGBColor(140, 140, 0),
|
||||||
|
RGBColor(254, 172, 172),
|
||||||
|
RGBColor(254, 100, 92),
|
||||||
|
RGBColor(238, 2, 48),
|
||||||
|
RGBColor(212, 142, 254),
|
||||||
|
RGBColor(170, 36, 250),
|
||||||
|
];
|
||||||
|
|
||||||
let mut polygons: Vec<(shapefile::Polygon, _)> =
|
let mut polygons: Vec<(shapefile::Polygon, _)> =
|
||||||
shapefile::read_as::<_, shapefile::Polygon, shapefile::dbase::Record>(
|
shapefile::read_as::<_, shapefile::Polygon, shapefile::dbase::Record>(
|
||||||
"/Users/ruomu/china/省界_region.shp",
|
"/home/ruomu/Desktop/china/省界_region.shp",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let (polygon, polygon_record) = polygons.first_mut().unwrap();
|
// let (polygon, polygon_record) = polygons.first_mut().unwrap();
|
||||||
|
|
||||||
|
let mut npz_file = NpzArchive::open("/home/ruomu/Desktop/test.npz").unwrap();
|
||||||
|
// let value = npz_file.by_name("value").unwrap().unwrap();
|
||||||
|
let lon = npz_file
|
||||||
|
.by_name("lon")
|
||||||
|
.unwrap()
|
||||||
|
.unwrap()
|
||||||
|
.into_vec::<f64>()
|
||||||
|
.unwrap();
|
||||||
|
let lat = npz_file
|
||||||
|
.by_name("lat")
|
||||||
|
.unwrap()
|
||||||
|
.unwrap()
|
||||||
|
.into_vec::<f64>()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// let val = npz_file
|
||||||
|
// .by_name("value")
|
||||||
|
// .unwrap()
|
||||||
|
// .unwrap()
|
||||||
|
// .into_vec::<i8>()
|
||||||
|
// .unwrap();
|
||||||
|
|
||||||
|
let val = load_npz();
|
||||||
|
|
||||||
|
|
||||||
let proj = Mercator::new().change_min_latitude(-80f64);
|
let proj = Mercator::new().change_min_latitude(-80f64);
|
||||||
|
|
||||||
@ -78,8 +129,8 @@ fn build_ui(app: &Application) {
|
|||||||
end: 121.0,
|
end: 121.0,
|
||||||
}),
|
}),
|
||||||
Some(std::ops::Range {
|
Some(std::ops::Range {
|
||||||
start: 29.0,
|
start: 30.0,
|
||||||
end: 30.0,
|
end: 31.0,
|
||||||
}),
|
}),
|
||||||
proj,
|
proj,
|
||||||
)
|
)
|
||||||
@ -95,38 +146,43 @@ fn build_ui(app: &Application) {
|
|||||||
// },
|
// },
|
||||||
// );
|
// );
|
||||||
|
|
||||||
let ring = polygon.ring(0).unwrap();
|
// let ring = polygon.ring(0).unwrap();
|
||||||
|
|
||||||
|
let lon_dpi = lon[1] - lon[0];
|
||||||
|
let lat_dpi = lat[1] - lat[0];
|
||||||
|
|
||||||
|
|
||||||
chart.draw_series(
|
chart.draw_series(
|
||||||
lon.into_vec::<f64>().unwrap().into_iter().map(|lon| {
|
lon.into_iter()
|
||||||
Rectangle::new([(lon, 29.1), (lon + 0.001, 29.1 + 0.001)], BLACK.filled())
|
.map(|inner_lon| {
|
||||||
}),
|
return lat.to_owned().into_iter().map(move |inner_lat| {
|
||||||
|
return (inner_lon, inner_lat);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.zip(val.t().into_iter())
|
||||||
|
.filter(|((_,_),val)| **val >-125)
|
||||||
|
.map(|((lon, lat), val)| {
|
||||||
|
Rectangle::new(
|
||||||
|
[(lon, lat), (lon + lon_dpi, lat + lat_dpi)],
|
||||||
|
get(&levels, &colors, val.clone()).filled(),
|
||||||
|
)
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// chart.draw_series(lon.into_vec::<f32>().unwrap().into_iter().map(|lon| {
|
|
||||||
// lat.into_vec::<f32>().unwrap().into_iter().map(|lat| {
|
|
||||||
// Rectangle::new(
|
|
||||||
// [
|
|
||||||
// (lon as f64, lat as f64),
|
|
||||||
// (lon as f64 + 0.001, lat as f64 + 0.001),
|
|
||||||
// ],
|
|
||||||
// BLACK.filled(),
|
|
||||||
// )
|
|
||||||
// })
|
|
||||||
// }));
|
|
||||||
|
|
||||||
for (polygon, _) in polygons.into_iter() {
|
// for (polygon, _) in polygons.into_iter() {
|
||||||
chart
|
// chart
|
||||||
.draw_series(
|
// .draw_series(
|
||||||
AreaSeries::new(
|
// AreaSeries::new(
|
||||||
polygon.ring(0).unwrap().points().iter().map(|x| (x.x, x.y)),
|
// polygon.ring(0).unwrap().points().iter().map(|x| (x.x, x.y)),
|
||||||
0.0,
|
// 0.0,
|
||||||
&RED.mix(0.2),
|
// &RED.mix(0.2),
|
||||||
)
|
// )
|
||||||
.border_style(&RED),
|
// .border_style(&RED),
|
||||||
)
|
// )
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
window.set_child(Some(&drawing_area));
|
window.set_child(Some(&drawing_area));
|
||||||
|
|||||||
22
src/tree.rs
Normal file
22
src/tree.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use num_traits::Num;
|
||||||
|
use plotters::style::RGBAColor;
|
||||||
|
pub fn get<T>(levels: &Vec<T>, colors: &Vec<RGBAColor>, v: T) -> RGBAColor
|
||||||
|
where
|
||||||
|
T: Num + PartialOrd,
|
||||||
|
{
|
||||||
|
let len = levels.len();
|
||||||
|
|
||||||
|
let mut left = 0;
|
||||||
|
let mut right = len - 1;
|
||||||
|
|
||||||
|
while left < right - 1 {
|
||||||
|
let middle = (right + left) / 2;
|
||||||
|
if v > levels[middle] {
|
||||||
|
left = middle;
|
||||||
|
} else {
|
||||||
|
right = middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
colors[left]
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
use num_traits::Num;
|
use num_traits::Num;
|
||||||
use plotters::style::RGBAColor;
|
use plotters::style::RGBColor;
|
||||||
pub fn get<T>(levels: &Vec<T>, colors: &Vec<RGBAColor>, v: T) -> RGBAColor
|
pub fn get<T>(levels: &Vec<T>, colors: &Vec<RGBColor>, v: T) -> RGBColor
|
||||||
where
|
where
|
||||||
T: Num + PartialOrd,
|
T: Num + PartialOrd,
|
||||||
{
|
{
|
||||||
@ -18,5 +18,5 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colors[left]
|
colors[left].clone()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user