split function testing
This commit is contained in:
parent
fcbc5d2db4
commit
39c89af9fe
594
Cargo.lock
generated
594
Cargo.lock
generated
@ -28,15 +28,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
@ -122,18 +113,6 @@ dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
@ -221,26 +200,12 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time 0.1.45",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cinrad_g"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cairo-rs",
|
||||
"geo-macros",
|
||||
"geo-types",
|
||||
"glib",
|
||||
"glib-build-tools",
|
||||
@ -248,8 +213,6 @@ dependencies = [
|
||||
"ndarray",
|
||||
"npyz",
|
||||
"num-traits",
|
||||
"plotters",
|
||||
"plotters-backend",
|
||||
"proj",
|
||||
"quadtree_rs",
|
||||
"shapefile",
|
||||
@ -301,77 +264,12 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "const-cstr"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed3d0b5ff30645a68f35ece8cea4556ca14ef8a1651455f789a099a0513532a6"
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.22.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-types"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-text"
|
||||
version = "19.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25"
|
||||
dependencies = [
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.7"
|
||||
@ -451,7 +349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3c1a2a9e9238982f599f25b54ec2c7cf1518cc97084cf0c8da475f8a3727fe7"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"time 0.3.21",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -490,48 +388,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dwrote"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"winapi",
|
||||
"wio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
@ -551,15 +407,6 @@ dependencies = [
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10"
|
||||
dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "field-offset"
|
||||
version = "0.3.5"
|
||||
@ -567,7 +414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"rustc_version 0.4.0",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -589,82 +436,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide 0.6.2",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float-ord"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e"
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "font-kit"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21fe28504d371085fae9ac7a3450f0b289ab71e07c8e57baa3fb68b9e57d6ce5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"core-text",
|
||||
"dirs-next",
|
||||
"dwrote",
|
||||
"float-ord",
|
||||
"freetype",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"pathfinder_geometry",
|
||||
"pathfinder_simd",
|
||||
"walkdir",
|
||||
"winapi",
|
||||
"yeslogic-fontconfig-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "freetype"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bee38378a9e3db1cc693b4f88d166ae375338a0ff75cb8263e1c601d51f35dc6"
|
||||
dependencies = [
|
||||
"freetype-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "freetype-sys"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.28"
|
||||
@ -818,27 +598,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gif"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045"
|
||||
dependencies = [
|
||||
"color_quant",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.17.9"
|
||||
@ -1090,50 +849,12 @@ version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.24.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "527909aa81e20ac3a44803521443a765550f09b5130c2c2fa1ea59c2f8f50a3a"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"jpeg-decoder",
|
||||
"num-rational 0.4.1",
|
||||
"num-traits",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
@ -1162,21 +883,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
@ -1260,16 +966,6 @@ dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndarray"
|
||||
version = "0.15.6"
|
||||
@ -1315,7 +1011,7 @@ dependencies = [
|
||||
"num-complex 0.2.4",
|
||||
"num-integer",
|
||||
"num-iter",
|
||||
"num-rational 0.2.4",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
@ -1393,17 +1089,6 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
@ -1457,25 +1142,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathfinder_geometry"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pathfinder_simd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pathfinder_simd"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39fe46acc5503595e5949c17b818714d26fdf9b4920eacf3b2947f0199f4a6ff"
|
||||
dependencies = [
|
||||
"rustc_version 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.11.0"
|
||||
@ -1556,60 +1222,6 @@ version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||
|
||||
[[package]]
|
||||
name = "plotters"
|
||||
version = "0.3.5"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"font-kit",
|
||||
"geo-macros",
|
||||
"image",
|
||||
"lazy_static",
|
||||
"num-traits",
|
||||
"pathfinder_geometry",
|
||||
"plotters-backend",
|
||||
"plotters-bitmap",
|
||||
"plotters-svg",
|
||||
"proj",
|
||||
"thiserror",
|
||||
"ttf-parser",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plotters-backend"
|
||||
version = "0.3.4"
|
||||
|
||||
[[package]]
|
||||
name = "plotters-bitmap"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"gif",
|
||||
"image",
|
||||
"plotters-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plotters-svg"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"plotters-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
"fdeflate",
|
||||
"flate2",
|
||||
"miniz_oxide 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.3.1"
|
||||
@ -1750,17 +1362,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.8.1"
|
||||
@ -1784,40 +1385,13 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
|
||||
dependencies = [
|
||||
"semver 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
dependencies = [
|
||||
"semver 1.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
|
||||
dependencies = [
|
||||
"semver-parser",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1826,15 +1400,6 @@ version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
||||
dependencies = [
|
||||
"pest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.160"
|
||||
@ -1903,12 +1468,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.8"
|
||||
@ -2043,17 +1602,6 @@ dependencies = [
|
||||
"syn 2.0.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.21"
|
||||
@ -2104,12 +1652,6 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.16.0"
|
||||
@ -2158,98 +1700,6 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2 1.0.58",
|
||||
"quote 1.0.27",
|
||||
"syn 2.0.16",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434"
|
||||
dependencies = [
|
||||
"quote 1.0.27",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.58",
|
||||
"quote 1.0.27",
|
||||
"syn 2.0.16",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weezl"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.0"
|
||||
@ -2292,15 +1742,6 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
@ -2376,15 +1817,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wio"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "2.21.0"
|
||||
@ -2404,18 +1836,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yeslogic-fontconfig-sys"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2bbd69036d397ebbff671b1b8e4d918610c181c5a16073b96f984a38d08c386"
|
||||
dependencies = [
|
||||
"const-cstr",
|
||||
"dlib",
|
||||
"once_cell",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.6.6"
|
||||
@ -2432,7 +1852,7 @@ dependencies = [
|
||||
"hmac",
|
||||
"pbkdf2",
|
||||
"sha1",
|
||||
"time 0.3.21",
|
||||
"time",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
|
||||
@ -14,9 +14,6 @@ proj = "0.27.0"
|
||||
|
||||
# gtk = "0.15.5"
|
||||
|
||||
plotters = { path = "../plotters/plotters" }
|
||||
plotters-backend = { path = "../plotters/plotters-backend" }
|
||||
|
||||
geo-types = "0.7.9"
|
||||
shapefile = { version = "0.4", features = ["geo-types"] }
|
||||
thiserror = "1.0.40"
|
||||
@ -28,3 +25,6 @@ quadtree_rs = "0.1.2"
|
||||
[build-dependencies]
|
||||
glib-build-tools = "0.17.0"
|
||||
# plotters = "0.3.4"
|
||||
|
||||
[dependencies.geo-macros]
|
||||
path = "geo-macros"
|
||||
|
||||
14
geo-macros/Cargo.toml
Normal file
14
geo-macros/Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "geo-macros"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { version = "2.0.16", features = ["full"] }
|
||||
quote = "1.0.27"
|
||||
proc-macro2 = "1.0.58"
|
||||
44
geo-macros/src/lib.rs
Normal file
44
geo-macros/src/lib.rs
Normal file
@ -0,0 +1,44 @@
|
||||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
use quote::format_ident;
|
||||
use quote::quote;
|
||||
use syn::parse_macro_input;
|
||||
use syn::Fields::Named;
|
||||
use syn::ItemStruct;
|
||||
|
||||
#[proc_macro_derive(Prj)]
|
||||
pub fn prj_macro(input: TokenStream) -> TokenStream {
|
||||
let struct_item = parse_macro_input!(input as ItemStruct);
|
||||
let stru_name = struct_item.ident;
|
||||
|
||||
match struct_item.fields {
|
||||
Named(fields) => {
|
||||
let idents = fields
|
||||
.named
|
||||
.iter()
|
||||
.filter(|x| {
|
||||
if let syn::Visibility::Public(_) = x.vis {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
.map(|x| x.ident.as_ref().unwrap());
|
||||
let idents_type = fields.named.iter().map(|x| &x.ty);
|
||||
let func_name = idents.clone().map(|x| format_ident!("change_{}", &x));
|
||||
quote!(
|
||||
impl #stru_name{
|
||||
#(pub fn #func_name (mut self,value:#idents_type) -> Self{
|
||||
self.#idents = value;
|
||||
self
|
||||
})*
|
||||
}
|
||||
)
|
||||
.into()
|
||||
}
|
||||
_ => quote!(
|
||||
struct A {}
|
||||
)
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,6 @@
|
||||
use cairo::{Context as CairoContext, FontSlant, FontWeight};
|
||||
|
||||
use plotters_backend::text_anchor::{HPos, VPos};
|
||||
#[allow(unused_imports)]
|
||||
use plotters_backend::{
|
||||
BackendColor, BackendCoord, BackendStyle, BackendTextStyle, DrawingBackend, DrawingErrorKind,
|
||||
FontStyle, FontTransform,
|
||||
};
|
||||
|
||||
/// The drawing backend that is backed with a Cairo context
|
||||
pub struct CairoBackend<'a> {
|
||||
|
||||
80
src/data.rs
80
src/data.rs
@ -1,4 +1,4 @@
|
||||
use ndarray::{array, s, Array, Array1, Array2, Array3};
|
||||
use ndarray::{array, s, Array, Array1, Array2, Array3, ArrayBase, ArrayView2, Ix2};
|
||||
use num_traits::{AsPrimitive, FromPrimitive, Num, ToPrimitive};
|
||||
use quadtree_rs::Quadtree;
|
||||
use std::{self, borrow::Borrow, f64::consts::PI};
|
||||
@ -18,20 +18,22 @@ pub enum DataError {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum CoorType {
|
||||
Polar,
|
||||
LatLon,
|
||||
}
|
||||
|
||||
pub struct RadarData2d<T: Num, X = f64, Y = f64>
|
||||
pub struct RadarData2d<T, Raw, X = f64, Y = f64>
|
||||
where
|
||||
T: Num,
|
||||
T: Num + Clone,
|
||||
Raw: ndarray::Data<Elem = T>,
|
||||
X: Num,
|
||||
Y: Num,
|
||||
{
|
||||
pub dim1: Array1<X>,
|
||||
pub dim2: Array1<Y>,
|
||||
pub data: Array2<T>,
|
||||
pub data: ArrayBase<Raw, Ix2>,
|
||||
pub coord_type: CoorType,
|
||||
}
|
||||
|
||||
@ -52,7 +54,11 @@ trait MultiDimensionData<T: Num> {
|
||||
fn levels(&self, levels: impl IntoIterator<Item = T>) -> Self;
|
||||
}
|
||||
|
||||
impl<T: Num + AsPrimitive<f64> + FromPrimitive> RadarData2d<T> {
|
||||
impl<T, Raw> RadarData2d<T, Raw>
|
||||
where
|
||||
T: Num + AsPrimitive<f64> + FromPrimitive + Clone,
|
||||
Raw: ndarray::Data<Elem = T>,
|
||||
{
|
||||
fn resample(
|
||||
&self,
|
||||
width_rate: f64,
|
||||
@ -64,7 +70,8 @@ impl<T: Num + AsPrimitive<f64> + FromPrimitive> RadarData2d<T> {
|
||||
match self.coord_type {
|
||||
CoorType::Polar => Err(DataError::FormatError),
|
||||
CoorType::LatLon => {
|
||||
let width_filtered = Self::_resample(&self.data, width_rate, filter_len, false);
|
||||
let width_filtered: ArrayBase<ndarray::OwnedRepr<T>, Ix2> =
|
||||
Self::_resample(&self.data, width_rate, filter_len, false);
|
||||
Ok(Self::_resample(
|
||||
&width_filtered,
|
||||
height_rate,
|
||||
@ -75,11 +82,48 @@ impl<T: Num + AsPrimitive<f64> + FromPrimitive> RadarData2d<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn split(&self) {
|
||||
let a = self.data.slice(s![0..10, 1..10]);
|
||||
fn split(&self) -> [RadarData2d<T, ndarray::ViewRepr<&T>>; 4] {
|
||||
let middle_dim1 = self.dim1.len() / 2;
|
||||
let middle_dim2 = self.dim2.len() / 2;
|
||||
let lt = self.data.slice(s![..middle_dim1, ..middle_dim2]);
|
||||
let rt = self.data.slice(s![middle_dim1.., ..middle_dim2]);
|
||||
let lb = self.data.slice(s![..middle_dim1, middle_dim2..]);
|
||||
let rb = self.data.slice(s![middle_dim1.., middle_dim2..]);
|
||||
|
||||
return [
|
||||
RadarData2d {
|
||||
dim1: self.dim1.slice(s![..middle_dim1]).to_owned(),
|
||||
dim2: self.dim2.slice(s![..middle_dim2]).to_owned(),
|
||||
data: lt,
|
||||
coord_type: self.coord_type,
|
||||
},
|
||||
RadarData2d {
|
||||
dim1: self.dim1.slice(s![middle_dim1..]).to_owned(),
|
||||
dim2: self.dim2.slice(s![..middle_dim2]).to_owned(),
|
||||
data: rt,
|
||||
coord_type: self.coord_type,
|
||||
},
|
||||
RadarData2d {
|
||||
dim1: self.dim1.slice(s![..middle_dim1]).to_owned(),
|
||||
dim2: self.dim2.slice(s![middle_dim2..]).to_owned(),
|
||||
data: lb,
|
||||
coord_type: self.coord_type,
|
||||
},
|
||||
RadarData2d {
|
||||
dim1: self.dim1.slice(s![middle_dim1..]).to_owned(),
|
||||
dim2: self.dim2.slice(s![middle_dim2..]).to_owned(),
|
||||
data: rb,
|
||||
coord_type: self.coord_type,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
fn _resample(data: &Array2<T>, rate: f64, filter_len: f64, reverse: bool) -> Array2<T> {
|
||||
fn _resample<'a, R: ndarray::Data<Elem = T>>(
|
||||
data: &'a ArrayBase<R, Ix2>,
|
||||
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() };
|
||||
|
||||
@ -123,16 +167,16 @@ fn windowed_sinc(x: f64, y: f64) -> f64 {
|
||||
sinc * window
|
||||
}
|
||||
|
||||
pub struct LevelData<T: Num> {
|
||||
levels: Vec<RadarData2d<T>>,
|
||||
}
|
||||
// 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> 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 {
|
||||
|
||||
199
src/main.rs
199
src/main.rs
@ -1,22 +1,18 @@
|
||||
use backend::CairoBackend;
|
||||
use geo_types::{MultiPolygon, Polygon};
|
||||
use gtk::gdk::Display;
|
||||
use gtk::{gio, glib, style_context_add_provider_for_display, Application, CssProvider};
|
||||
use plotters::coord::geo::*;
|
||||
use plotters::prelude::*;
|
||||
use shapefile;
|
||||
|
||||
use gtk::{
|
||||
gio, glib, style_context_add_provider_for_display, Application, ApplicationWindow, CssProvider,
|
||||
StyleContext,
|
||||
};
|
||||
use gtk::{prelude::*, DrawingArea};
|
||||
use npyz::npz::NpzArchive;
|
||||
use plotters::style::{BLACK, WHITE};
|
||||
use npyz::npz::{self, NpzArchive};
|
||||
// use plotters::prelude::DrawingArea;
|
||||
use window::Window;
|
||||
mod backend;
|
||||
mod painter;
|
||||
mod trees;
|
||||
mod window;
|
||||
// mod backend;
|
||||
mod data;
|
||||
|
||||
use ndarray::{self, ArrayD};
|
||||
use trees::get;
|
||||
// mod painter;
|
||||
// mod trees;
|
||||
mod window;
|
||||
|
||||
const APP_ID: &str = "org.gtk_rs.HelloWorld2";
|
||||
|
||||
@ -34,24 +30,6 @@ fn main() -> glib::ExitCode {
|
||||
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) {
|
||||
// Create a window and set the title
|
||||
|
||||
@ -59,117 +37,74 @@ fn build_ui(app: &Application) {
|
||||
|
||||
let drawing_area = DrawingArea::new();
|
||||
|
||||
drawing_area.set_draw_func(|a, b, c, d| {
|
||||
let root = CairoBackend::new(b, (500, 500))
|
||||
.expect("fuck")
|
||||
.into_drawing_area();
|
||||
// drawing_area.set_draw_func(|a, b, c, d| {
|
||||
// let root = CairoBackend::new(b, (500, 500))
|
||||
// .expect("fuck")
|
||||
// .into_drawing_area();
|
||||
|
||||
root.fill(&WHITE);
|
||||
// root.fill(&WHITE);
|
||||
|
||||
let levels: Vec<i8> = vec![0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65];
|
||||
// use trees::get;
|
||||
|
||||
// ['#00ACA4', '#C0C0FE', '#7A72EE', '#1E26D0', '#A6FCA8', '#00EA00', '#10921A', '#FCF464', '#C8C802', '#8C8C00', '#FEACAC', '#FE645C', '#EE0230', '#D48EFE', '#AA24FA']
|
||||
let colors = vec![
|
||||
RGBColor(0, 172, 164),
|
||||
RGBColor(192, 192, 254),
|
||||
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 npz_file = NpzArchive::open("/Users/ruomu/test.npz").unwrap();
|
||||
|
||||
let mut polygons: Vec<(shapefile::Polygon, _)> =
|
||||
shapefile::read_as::<_, shapefile::Polygon, shapefile::dbase::Record>(
|
||||
"/home/ruomu/Desktop/china/省界_region.shp",
|
||||
)
|
||||
.unwrap();
|
||||
// // let value = npz_file.by_name("value").unwrap().unwrap();
|
||||
// let lon = npz_file.by_name("lon").unwrap().unwrap();
|
||||
// // let lat = npz_file.by_name("lat").unwrap().unwrap();
|
||||
|
||||
// let mut polygons: Vec<(shapefile::Polygon, _)> =
|
||||
// shapefile::read_as::<_, shapefile::Polygon, shapefile::dbase::Record>(
|
||||
// "/Users/ruomu/china/省界_region.shp",
|
||||
// )
|
||||
// .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 proj = Mercator::new().change_min_latitude(-80f64);
|
||||
|
||||
// let val = npz_file
|
||||
// .by_name("value")
|
||||
// .unwrap()
|
||||
// .unwrap()
|
||||
// .into_vec::<i8>()
|
||||
// let mut chart = ChartBuilder::on(&root)
|
||||
// .build_geo_coord(
|
||||
// Some(std::ops::Range {
|
||||
// start: 119.0,
|
||||
// end: 121.0,
|
||||
// }),
|
||||
// Some(std::ops::Range {
|
||||
// start: 29.0,
|
||||
// end: 30.0,
|
||||
// }),
|
||||
// proj,
|
||||
// )
|
||||
// .unwrap();
|
||||
|
||||
let val = load_npz();
|
||||
|
||||
|
||||
let proj = Mercator::new().change_min_latitude(-80f64);
|
||||
|
||||
let mut chart = ChartBuilder::on(&root)
|
||||
.build_geo_coord(
|
||||
Some(std::ops::Range {
|
||||
start: 119.0,
|
||||
end: 121.0,
|
||||
}),
|
||||
Some(std::ops::Range {
|
||||
start: 30.0,
|
||||
end: 31.0,
|
||||
}),
|
||||
proj,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// chart.draw_mesh_lines(
|
||||
// (10, 5),
|
||||
// (true, true),
|
||||
// &ShapeStyle {
|
||||
// color: RGBAColor(0, 0, 0, 1f64),
|
||||
// filled: false,
|
||||
// stroke_width: 1,
|
||||
// },
|
||||
// );
|
||||
// // chart.draw_mesh_lines(
|
||||
// // (10, 5),
|
||||
// // (true, true),
|
||||
// // &ShapeStyle {
|
||||
// // color: RGBAColor(0, 0, 0, 1f64),
|
||||
// // filled: false,
|
||||
// // stroke_width: 1,
|
||||
// // },
|
||||
// // );
|
||||
|
||||
// let ring = polygon.ring(0).unwrap();
|
||||
|
||||
let lon_dpi = lon[1] - lon[0];
|
||||
let lat_dpi = lat[1] - lat[0];
|
||||
|
||||
|
||||
chart.draw_series(
|
||||
lon.into_iter()
|
||||
.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::<f64>().unwrap().into_iter().map(|lon| {
|
||||
// Rectangle::new([(lon, 29.1), (lon + 0.001, 29.1 + 0.001)], BLACK.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() {
|
||||
// chart
|
||||
@ -183,9 +118,9 @@ fn build_ui(app: &Application) {
|
||||
// )
|
||||
// .unwrap();
|
||||
// }
|
||||
});
|
||||
// });
|
||||
|
||||
window.set_child(Some(&drawing_area));
|
||||
// window.set_child(Some(&drawing_area));
|
||||
window.set_default_width(1000);
|
||||
window.set_default_height(800);
|
||||
|
||||
|
||||
8
src/painter/coords/mod.rs
Normal file
8
src/painter/coords/mod.rs
Normal file
@ -0,0 +1,8 @@
|
||||
use num_traits::Num;
|
||||
mod wgs84;
|
||||
|
||||
pub type ScreenCoord = (i32, i32);
|
||||
|
||||
pub(super) trait Coord<T: Num> {
|
||||
fn map(&self, axis_1: T, axis_2: T) -> ScreenCoord;
|
||||
}
|
||||
205
src/painter/coords/wgs84.rs
Normal file
205
src/painter/coords/wgs84.rs
Normal file
@ -0,0 +1,205 @@
|
||||
use super::Coord;
|
||||
use geo_macros::Prj;
|
||||
use proj::{Proj, ProjError};
|
||||
use thiserror::Error;
|
||||
|
||||
type Lat = f64;
|
||||
type Lon = f64;
|
||||
pub struct Range(pub f64, pub f64);
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum CoordError {
|
||||
#[error("")]
|
||||
ProjError {
|
||||
#[from]
|
||||
source: ProjError,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<(f64, f64)> for Range {
|
||||
fn from(value: (f64, f64)) -> Self {
|
||||
let (_min, _max) = (value.0.min(value.1), value.0.max(value.1));
|
||||
Self(_min, _max)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LatLonCoord<T: ProjectionS> {
|
||||
actual: ((i32, i32), (i32, i32)),
|
||||
logical: (Range, Range),
|
||||
pcs: PCS<T>,
|
||||
}
|
||||
|
||||
struct PCS<T: ProjectionS> {
|
||||
pub lon_range: Range,
|
||||
pub lat_range: Range,
|
||||
pub proj_param: T,
|
||||
transformer: Proj,
|
||||
}
|
||||
|
||||
impl<T: ProjectionS> LatLonCoord<T> {
|
||||
/// Creates a new `LatLonCoord` instance.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `lon` - An optional longitude range.
|
||||
/// * `lat` - An optional latitude range.
|
||||
/// * `actual` - A tuple containing the actual ranges.
|
||||
/// * `project` - A projection.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new `LatLonCoord` instance.
|
||||
pub fn new(
|
||||
lon: Option<Range>,
|
||||
lat: Option<Range>,
|
||||
actual: ((i32, i32), (i32, i32)),
|
||||
project: T,
|
||||
) -> Self {
|
||||
let pcs = PCS::new(project, lon, lat);
|
||||
let _box = pcs.bbox().unwrap();
|
||||
Self {
|
||||
actual,
|
||||
pcs: pcs,
|
||||
logical: _box,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ProjectionS> Coord<f64> for LatLonCoord<T> {
|
||||
fn map(&self, axis_1: f64, axis_2: f64) -> super::ScreenCoord {
|
||||
(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Projection {
|
||||
PlateCarree,
|
||||
LambertConformal,
|
||||
LambertCylindrical,
|
||||
Mercator,
|
||||
}
|
||||
|
||||
/// A trait for defining a projection.
|
||||
pub trait ProjectionS {
|
||||
/// Returns a proj-string of the projection.
|
||||
fn build(&self) -> String;
|
||||
|
||||
/// Returns the logical range of the projection.
|
||||
/// In common, different projections have different logical ranges.
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `lon_range` - An optional longitude range.
|
||||
/// * `lat_range` - An optional latitude range.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A tuple containing the longitude and latitude ranges.
|
||||
fn logic_range(&self, lon_range: Option<Range>, lat_range: Option<Range>) -> (Range, Range);
|
||||
}
|
||||
|
||||
impl<T: ProjectionS> PCS<T> {
|
||||
fn new(proj_param: T, lon_range: Option<Range>, lat_range: Option<Range>) -> Self {
|
||||
let (lon_range, lat_range) = proj_param.logic_range(lon_range, lat_range);
|
||||
Self {
|
||||
lon_range,
|
||||
lat_range,
|
||||
transformer: Proj::new(proj_param.build().as_str()).unwrap(),
|
||||
proj_param: proj_param,
|
||||
}
|
||||
}
|
||||
|
||||
fn bbox(&self) -> Result<(Range, Range), CoordError> {
|
||||
let _proj_transformer = &self.transformer;
|
||||
let lb = (self.lon_range.0.to_radians(), self.lat_range.0.to_radians());
|
||||
let rt = (self.lon_range.1.to_radians(), self.lat_range.1.to_radians());
|
||||
|
||||
let bl = _proj_transformer.convert(lb)?;
|
||||
let rt = _proj_transformer.convert(rt)?;
|
||||
|
||||
Ok((Range::from((bl.0, rt.0)), Range::from((bl.1, rt.1))))
|
||||
}
|
||||
|
||||
fn map(&self, lon_lat: (Lat, Lon)) -> (f64, f64) {
|
||||
let _proj_transformer = &self.transformer;
|
||||
let _lon_lat = _proj_transformer
|
||||
.convert((lon_lat.0.to_radians(), lon_lat.1.to_radians()))
|
||||
.unwrap();
|
||||
|
||||
_lon_lat
|
||||
}
|
||||
}
|
||||
#[derive(Prj)]
|
||||
/// A struct representing the Mercator projection.
|
||||
pub struct Mercator {
|
||||
/// The central longitude of the projection.
|
||||
pub central_lon: f64,
|
||||
/// The minimum latitude of the projection.
|
||||
pub min_latitude: f64,
|
||||
/// The maximum latitude of the projection.
|
||||
pub max_latitude: f64,
|
||||
/// The false easting of the projection.
|
||||
pub false_easting: f64,
|
||||
/// The false northing of the projection.
|
||||
pub false_northing: f64,
|
||||
/// The latitude of true scale of the projection.
|
||||
pub latitude_true_scale: f64,
|
||||
}
|
||||
|
||||
fn proj_string<'a>(vs: Vec<(&'a str, &'a str)>) -> String {
|
||||
vs.into_iter()
|
||||
.map(|(option, value)| format!("+{}={}", option, value))
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
impl Mercator {
|
||||
/// Creates a new instance of the `Mercator` projection with default values.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
central_lon: 0.0,
|
||||
min_latitude: 0.0,
|
||||
max_latitude: 70.0,
|
||||
false_easting: 0.0,
|
||||
false_northing: 0.0,
|
||||
latitude_true_scale: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ProjectionS for Mercator {
|
||||
fn build(&self) -> String {
|
||||
let _central_lon = format!("{:.1}", &self.central_lon);
|
||||
let _false_easting = format!("{:.1}", &self.false_easting);
|
||||
let _false_northing = format!("{:.1}", &self.false_northing);
|
||||
let _ts = format!("{:.1}", &self.latitude_true_scale);
|
||||
|
||||
let input = vec![
|
||||
("proj", "merc"),
|
||||
("lon_0", _central_lon.as_str()),
|
||||
("x_0", _false_easting.as_str()),
|
||||
("y_0", _false_northing.as_str()),
|
||||
("lat_ts", _ts.as_str()),
|
||||
("units", "m"),
|
||||
("ellps", "GRS80"),
|
||||
];
|
||||
let _proj_string = proj_string(input);
|
||||
_proj_string
|
||||
}
|
||||
|
||||
fn logic_range(&self, lon_range: Option<Range>, lat_range: Option<Range>) -> (Range, Range) {
|
||||
let lon_range = lon_range.unwrap_or(Range {
|
||||
0: -180f64,
|
||||
1: 180f64,
|
||||
});
|
||||
let lat_range = lat_range.unwrap_or(Range {
|
||||
0: self.min_latitude,
|
||||
1: self.max_latitude,
|
||||
});
|
||||
|
||||
let lat_range = Range {
|
||||
0: lat_range.start.max(self.min_latitude),
|
||||
1: lat_range.end.min(self.max_latitude),
|
||||
};
|
||||
(lon_range, lat_range)
|
||||
}
|
||||
}
|
||||
@ -1 +1,2 @@
|
||||
mod polar_coord;
|
||||
mod coords;
|
||||
mod painter;
|
||||
|
||||
37
src/painter/painter.rs
Normal file
37
src/painter/painter.rs
Normal file
@ -0,0 +1,37 @@
|
||||
use super::coords::{Coord, ScreenCoord};
|
||||
use gtk::{cairo::*, gdk::RGBA};
|
||||
pub struct Painter<T: Coord> {
|
||||
width: u32,
|
||||
height: u32,
|
||||
context: Context,
|
||||
coord: T,
|
||||
}
|
||||
|
||||
impl<T: Coord> Painter<T> {
|
||||
pub fn new(context: Context, coord: T, width: u32, height: u32) -> Self {
|
||||
Self {
|
||||
context,
|
||||
coord,
|
||||
width,
|
||||
height,
|
||||
}
|
||||
}
|
||||
|
||||
fn set_color(&self, color: &RGBA) {
|
||||
self.context
|
||||
.set_source_rgba(color.red(), color.green(), color.blue(), color.alpha());
|
||||
}
|
||||
|
||||
fn draw_pixel(&self, point: ScreenCoord) {}
|
||||
|
||||
fn draw_rect(&self, point: ScreenCoord, width: f64, height: f64) {}
|
||||
|
||||
fn draw_line(&self, start: ScreenCoord, end: ScreenCoord) {}
|
||||
|
||||
pub fn draw_2d_data(&self, data: &RadarArray2) {
|
||||
data.dim1.iter().zip(data.dim2.iter()).for_each(|(x, y)| {
|
||||
let (x, y) = self.coord.map(*x, *y);
|
||||
self.draw_pixel((x, y));
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
use plotters::{coord::ranged1d, prelude::Ranged};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct PolarCoord2d<R: Ranged, A: Ranged> {
|
||||
logic_r: R,
|
||||
logic_a: A,
|
||||
}
|
||||
|
||||
impl<R: Ranged, A: Ranged> PolarCoord2d<R, A> {
|
||||
pub fn new<IntoR: Into<R>, IntoA: Into<A>>(logic_r: IntoR, logic_a: IntoA) -> Self {
|
||||
Self {
|
||||
logic_r: logic_r.into(),
|
||||
logic_a: logic_a.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
22
src/trees.rs
22
src/trees.rs
@ -1,22 +0,0 @@
|
||||
use num_traits::Num;
|
||||
use plotters::style::RGBColor;
|
||||
pub fn get<T>(levels: &Vec<T>, colors: &Vec<RGBColor>, v: T) -> RGBColor
|
||||
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].clone()
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user