mirror of
https://github.com/CIMEngine/cimengine-build-tools.git
synced 2024-11-24 21:06:23 +03:00
feat!: init project v2
This commit is contained in:
parent
f10f91c676
commit
ff8e88b39b
25 changed files with 924 additions and 4115 deletions
23
.eslintrc.js
23
.eslintrc.js
|
@ -1,23 +0,0 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
commonjs: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
extends: "eslint:recommended",
|
||||
overrides: [
|
||||
{
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
files: [".eslintrc.{js,cjs}"],
|
||||
parserOptions: {
|
||||
sourceType: "script",
|
||||
},
|
||||
},
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
},
|
||||
rules: {},
|
||||
};
|
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -1,2 +0,0 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
128
.gitignore
vendored
128
.gitignore
vendored
|
@ -1,127 +1 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
/target
|
||||
|
|
730
Cargo.lock
generated
Normal file
730
Cargo.lock
generated
Normal file
|
@ -0,0 +1,730 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[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 = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cimengine-build-tools"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"geo",
|
||||
"geojson",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml_edit",
|
||||
"wax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "const_format"
|
||||
version = "0.2.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673"
|
||||
dependencies = [
|
||||
"const_format_proc_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_format_proc_macros"
|
||||
version = "0.2.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[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 = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "float_next_after"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
|
||||
|
||||
[[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 = "geojson"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5d728c1df1fbf328d74151efe6cb0586f79ee813346ea981add69bd22c9241b"
|
||||
dependencies = [
|
||||
"geo-types",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[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.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
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 = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[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.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "pori"
|
||||
version = "0.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a63d338dec139f56dacc692ca63ad35a6be6a797442479b55acd611d79e906"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
|
||||
[[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 = "ryu"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
|
||||
[[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 = "serde"
|
||||
version = "1.0.198"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.198"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.116"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[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 = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wax"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d12a78aa0bab22d2f26ed1a96df7ab58e8a93506a3e20adb47c51a93b4e1357"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"itertools",
|
||||
"nom",
|
||||
"pori",
|
||||
"regex",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134306a13c5647ad6453e8deaec55d3a44d6021970129e6188735e74bf546697"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
19
Cargo.toml
Normal file
19
Cargo.toml
Normal file
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "cimengine-build-tools"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.4", features = ["derive"] }
|
||||
geo = "0.28.0"
|
||||
geojson = "0.24.1"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
toml_edit = "0.22.12"
|
||||
wax = "0.6.0"
|
||||
|
||||
[[bin]]
|
||||
name = "cimengine"
|
||||
path = "src/main.rs"
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Artemy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
51
README.md
51
README.md
|
@ -1,50 +1,3 @@
|
|||
# CIMEngine build tools
|
||||
This is new version. WIP rewriting on rust.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm i cimengine-build-tools
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
npm i cimengine-build-tools -g
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Tools
|
||||
|
||||
1. cimengine-init - Initializes the cimengine project
|
||||
2. cimengine-build - Assembles project files into a single geojson
|
||||
3. cimengine-country-fix - Transforms the country geojson file (merges polygons and simplifies them)
|
||||
|
||||
### cimengine-init
|
||||
|
||||
params: name - name of project
|
||||
usage: `cimengine-init --name map`
|
||||
|
||||
### cimengine-build
|
||||
|
||||
params:
|
||||
|
||||
1. projectFolder - folder with project generated by cimengine-init (If this parameter is specified, no other parameters are needed)
|
||||
2. layers - path to layers.yaml
|
||||
3. properties - path to properties.yaml
|
||||
4. config - path to config.yaml
|
||||
5. countries - path to countries folder
|
||||
6. natureObjects - path to nature folder
|
||||
7. roads - path to roads folder
|
||||
8. output - path to output file
|
||||
|
||||
usage: `cimengine-build --projectFolder ./map`
|
||||
|
||||
### cimengine-country-fix
|
||||
|
||||
params:
|
||||
|
||||
1. countryPath - path to country file
|
||||
2. simplify - Simplification accuracy of polygons (optional)
|
||||
|
||||
usage: `cimengine-country-fix --countryPath ./map/src/countries/usa.geojson`
|
||||
To see the old version, goto [old-branch](https://github.com/CIMEngine/cimengine-build-tools/tree/old-js)
|
||||
|
|
3251
package-lock.json
generated
3251
package-lock.json
generated
File diff suppressed because it is too large
Load diff
42
package.json
42
package.json
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"name": "cimengine-build-tools",
|
||||
"version": "1.6.0",
|
||||
"description": "Geojson data processing tools for CIMEngine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"bin": {
|
||||
"cimengine-build": "./tools/GeoBuilder.js",
|
||||
"cimengine-country-fix": "./tools/CountryFixer.js",
|
||||
"cimengine-init": "./tools/ProjectInit.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/CIMEngine/cimengine-build-tools.git"
|
||||
},
|
||||
"keywords": [
|
||||
"cimengine",
|
||||
"geojson",
|
||||
"geo",
|
||||
"map",
|
||||
"tools",
|
||||
"processing"
|
||||
],
|
||||
"author": "artegoser",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/CIMEngine/cimengine-build-tools/issues"
|
||||
},
|
||||
"homepage": "https://github.com/CIMEngine/cimengine-build-tools#readme",
|
||||
"dependencies": {
|
||||
"@turf/turf": "^6.5.0",
|
||||
"lodash": "^4.17.21",
|
||||
"md5": "^2.3.0",
|
||||
"yaml": "^2.3.1",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.56.0"
|
||||
}
|
||||
}
|
1
src/build/mod.rs
Normal file
1
src/build/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub fn build() {}
|
23
src/init.rs
Normal file
23
src/init.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
use std::{fs, path::Path};
|
||||
|
||||
pub fn init(name: String) {
|
||||
let config = include_str!("./templates/config.toml");
|
||||
let country_config = include_str!("./templates/country.toml");
|
||||
let geojson = include_str!("./templates/sample.geojson");
|
||||
|
||||
let root_folder = Path::new(&name);
|
||||
let country_folder = Path::new(&name).join("countries").join("sample_country_id");
|
||||
let nature_folder = Path::new(&name).join("nature");
|
||||
|
||||
fs::create_dir_all(&country_folder).unwrap();
|
||||
fs::create_dir_all(&nature_folder).unwrap();
|
||||
|
||||
fs::write(root_folder.join("config.toml"), config).unwrap();
|
||||
|
||||
fs::write(country_folder.join("country.toml"), country_config).unwrap();
|
||||
fs::write(country_folder.join("country.geojson"), geojson).unwrap();
|
||||
|
||||
fs::write(nature_folder.join("water.geojson"), geojson).unwrap();
|
||||
fs::write(nature_folder.join("sand.geojson"), geojson).unwrap();
|
||||
fs::write(nature_folder.join("grass.geojson"), geojson).unwrap();
|
||||
}
|
17
src/main.rs
Normal file
17
src/main.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use clap::Parser;
|
||||
|
||||
mod build;
|
||||
mod init;
|
||||
mod types;
|
||||
|
||||
use types::Commands;
|
||||
|
||||
fn main() {
|
||||
let args = types::Cli::parse();
|
||||
|
||||
match args.cmd {
|
||||
Commands::Build => build::build(),
|
||||
Commands::Init { name } => init::init(name),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
39
src/templates/config.toml
Normal file
39
src/templates/config.toml
Normal file
|
@ -0,0 +1,39 @@
|
|||
[country]
|
||||
# Order matters when building countries. This affects the processing of area intersections
|
||||
layers = ["sample_country_id"]
|
||||
|
||||
[[processing]]
|
||||
output_folder = "out"
|
||||
countries_file = "countries.json"
|
||||
geo_file = "geo.geojson"
|
||||
|
||||
# generate_colors = false
|
||||
# show_markers = false
|
||||
|
||||
# Include or exclude countries based on tags
|
||||
# Glob syntax is supported
|
||||
[[processing.tags]]
|
||||
include = [] # [] = not filtered
|
||||
# exclude = ["test", "test2"]
|
||||
|
||||
# [[processing.countries_rewrite]]
|
||||
# name = "name"
|
||||
# color = "#000000"
|
||||
|
||||
# Information for public repository in cimengine. See: https://github.com/CIMEngine/MapList
|
||||
# [[processing.public]]
|
||||
# name = "Sample Map"
|
||||
# geo = "https://example.com/geo.geojson"
|
||||
# countries = "https://example.com/countries.json"
|
||||
|
||||
[[nature]]
|
||||
id = "water"
|
||||
color = "#75cff0"
|
||||
|
||||
[[nature]]
|
||||
id = "sand"
|
||||
color = "#efe9e1"
|
||||
|
||||
[[nature]]
|
||||
id = "grass"
|
||||
color = "#d1e6be"
|
5
src/templates/country.toml
Normal file
5
src/templates/country.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
name = "Sample Country"
|
||||
description = "This is a sample country"
|
||||
foundation_date = "2024-01-01"
|
||||
flag = "https://example.com/flag.png"
|
||||
about = "https://example.com/about.html"
|
87
src/types.rs
Normal file
87
src/types.rs
Normal file
|
@ -0,0 +1,87 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "cimengine", bin_name = "cimengine")]
|
||||
#[command(about = "CIMEngine build tools")]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub cmd: Commands,
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
#[clap(author, version, about)]
|
||||
pub enum Commands {
|
||||
/// Build project
|
||||
Build,
|
||||
/// Initialize a new project
|
||||
Init {
|
||||
#[clap(default_value = "map")]
|
||||
name: String,
|
||||
},
|
||||
/// Fix geospatial file
|
||||
Fix {
|
||||
/// Path to geospatial file supported by cimengine
|
||||
#[clap(short, long)]
|
||||
path: String,
|
||||
},
|
||||
/// Utility for creating countries, roads, etc.
|
||||
New {
|
||||
#[command(subcommand)]
|
||||
cmd: NewCommands,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum NewCommands {
|
||||
/// Create new country
|
||||
Country { name: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Config {
|
||||
country: CountryConfig,
|
||||
processing: Vec<ProcessingConfig>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct CountryConfig {
|
||||
layers: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct ProcessingConfig {
|
||||
generate_colors: Option<bool>,
|
||||
show_markers: Option<bool>,
|
||||
output_folder: String,
|
||||
countries_file: String,
|
||||
geo_file: String,
|
||||
|
||||
tags: Option<ProcessingTagsConfig>,
|
||||
countries_rewrite: Option<CountryRewriteConfig>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct ProcessingTagsConfig {
|
||||
include: Vec<String>,
|
||||
exclude: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct CountryRewriteConfig {
|
||||
name: Option<String>,
|
||||
description: Option<String>,
|
||||
foundation_date: Option<String>,
|
||||
flag: Option<String>,
|
||||
about: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Country {
|
||||
name: String,
|
||||
description: String,
|
||||
foundation_date: String,
|
||||
flag: String,
|
||||
about: Option<String>,
|
||||
tags: Option<Vec<String>>,
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const turf = require("@turf/turf");
|
||||
const fs = require("fs");
|
||||
|
||||
const yargs = require("yargs/yargs");
|
||||
const { hideBin } = require("yargs/helpers");
|
||||
const args = yargs(hideBin(process.argv)).argv;
|
||||
|
||||
let simplify = Number(args.simplify) || false;
|
||||
|
||||
let co_features = JSON.parse(fs.readFileSync(args.countryPath));
|
||||
|
||||
let nonPoly = co_features.features.filter(
|
||||
(v) => !v.geometry.type.endsWith("Polygon")
|
||||
);
|
||||
|
||||
nonPoly = nonPoly.map((v) => {
|
||||
if (v.properties.type === "landmark") {
|
||||
v.properties.type = "landmark-0";
|
||||
}
|
||||
|
||||
if (!v.properties.type) {
|
||||
v.properties.type = "city";
|
||||
}
|
||||
|
||||
return v;
|
||||
});
|
||||
|
||||
let polygons = co_features.features.filter((v) =>
|
||||
v.geometry.type.endsWith("Polygon")
|
||||
);
|
||||
let props = {};
|
||||
|
||||
for (let feature of polygons) {
|
||||
if (props[feature.properties.name]) continue;
|
||||
props[feature.properties.name] = {
|
||||
stroke: feature.properties.stroke,
|
||||
fill: feature.properties.fill,
|
||||
type: feature.properties.type,
|
||||
tags: feature.properties.tags,
|
||||
};
|
||||
}
|
||||
|
||||
polygons = turf.dissolve(turf.featureCollection(polygons), {
|
||||
propertyName: "some-undefined-value",
|
||||
});
|
||||
|
||||
if (simplify !== false) {
|
||||
polygons = turf.simplify(polygons, {
|
||||
tolerance: simplify,
|
||||
highQuality: true,
|
||||
});
|
||||
}
|
||||
|
||||
polygons.features = polygons.features.map((v) => {
|
||||
v.properties = {
|
||||
name: v.properties.name,
|
||||
fill: props[v.properties.name].fill,
|
||||
stroke: props[v.properties.name].stroke,
|
||||
type: props[v.properties.name].type,
|
||||
tags: props[v.properties.name].tags,
|
||||
};
|
||||
return v;
|
||||
});
|
||||
|
||||
polygons.features = polygons.features.concat(nonPoly);
|
||||
|
||||
console.log("done");
|
||||
fs.writeFileSync(args.countryPath, JSON.stringify(polygons, null, " "));
|
|
@ -1,419 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const turf = require("@turf/turf");
|
||||
const fs = require("fs");
|
||||
const YAML = require("yaml");
|
||||
const _ = require("lodash");
|
||||
const path = require("node:path");
|
||||
const md5 = require("md5");
|
||||
|
||||
const yargs = require("yargs/yargs");
|
||||
const { hideBin } = require("yargs/helpers");
|
||||
const args = yargs(hideBin(process.argv)).argv;
|
||||
|
||||
const geofixConf = {
|
||||
projectFolder: args.projectFolder,
|
||||
layers: args.layers || path.join(args.projectFolder, "src", "layers.yaml"),
|
||||
properties:
|
||||
args.properties || path.join(args.projectFolder, "src", "properties.yaml"),
|
||||
config: args.config || path.join(args.projectFolder, "src", "config.yaml"),
|
||||
countries:
|
||||
args.countries || path.join(args.projectFolder, "src", "countries"),
|
||||
naturesObjects:
|
||||
args.naturesObjects || path.join(args.projectFolder, "src", "nature"),
|
||||
roads: args.roads || path.join(args.projectFolder, "src", "roads"),
|
||||
output: args.output || path.join(args.projectFolder, "geo.geojson"),
|
||||
};
|
||||
|
||||
let layers = YAML.parse(fs.readFileSync(geofixConf.layers, "utf-8"));
|
||||
let countries_properties =
|
||||
YAML.parse(fs.readFileSync(geofixConf.properties, "utf-8")) || {};
|
||||
let config = YAML.parse(fs.readFileSync(geofixConf.config, "utf-8"));
|
||||
|
||||
let features = [];
|
||||
|
||||
for (let country of layers) {
|
||||
let properties = countries_properties[country] || {};
|
||||
|
||||
let co_features = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(geofixConf.countries, `${country}.geojson`),
|
||||
"utf-8"
|
||||
)
|
||||
);
|
||||
|
||||
co_features.features = co_features.features.flatMap((val) => {
|
||||
if (val?.geometry?.type === "MultiPolygon") {
|
||||
return val.geometry.coordinates.map((coordinateSet) => {
|
||||
return {
|
||||
...val,
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: coordinateSet,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
});
|
||||
|
||||
co_features.features = co_features.features.map((val) => {
|
||||
if (val?.geometry?.type.endsWith("Polygon")) {
|
||||
val.properties = {};
|
||||
}
|
||||
|
||||
return val;
|
||||
});
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(geofixConf.countries, `${country}.geojson`),
|
||||
JSON.stringify(co_features, null, " ")
|
||||
);
|
||||
|
||||
if (!properties.fill) {
|
||||
properties.fill = `#${md5(country).substring(0, 6)}`;
|
||||
}
|
||||
|
||||
if (!properties.stroke) {
|
||||
properties.stroke = `#${md5(country).substring(6, 12)}`;
|
||||
}
|
||||
|
||||
co_features = co_features.features;
|
||||
|
||||
features.unshift(
|
||||
...co_features.map((val) => {
|
||||
if (val.geometry.type == "Polygon") {
|
||||
val.properties = properties || {};
|
||||
val.properties.name = country;
|
||||
}
|
||||
|
||||
return val;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
let geo = {
|
||||
type: "FeatureCollection",
|
||||
features,
|
||||
};
|
||||
|
||||
geo.features = geo.features.filter((v) => v.properties.name);
|
||||
|
||||
console.time("Total");
|
||||
|
||||
console.log("Dissolve");
|
||||
console.time("Dissolve");
|
||||
let nonPoly = geo.features.filter((v) => !v.geometry.type.endsWith("Polygon"));
|
||||
|
||||
nonPoly = nonPoly.map((v) => {
|
||||
if (v.properties.type === "landmark") {
|
||||
v.properties.type = "landmark-0";
|
||||
}
|
||||
|
||||
if (!v.properties.type) {
|
||||
v.properties.type = "city";
|
||||
}
|
||||
|
||||
return v;
|
||||
});
|
||||
|
||||
let polygons = geo.features.filter((v) => v.geometry.type.endsWith("Polygon"));
|
||||
let props = {};
|
||||
|
||||
for (let feature of polygons) {
|
||||
if (props[feature.properties.name]) continue;
|
||||
props[feature.properties.name] = {
|
||||
stroke: feature.properties.stroke,
|
||||
fill: feature.properties.fill,
|
||||
type: feature.properties.type,
|
||||
tags: feature.properties.tags,
|
||||
};
|
||||
}
|
||||
|
||||
let dissolved = turf.dissolve(turf.featureCollection(polygons), {
|
||||
propertyName: "name",
|
||||
});
|
||||
|
||||
dissolved.features = dissolved.features.map((v) => {
|
||||
v.properties = {
|
||||
name: v.properties.name,
|
||||
fill: props[v.properties.name].fill,
|
||||
stroke: props[v.properties.name].stroke,
|
||||
type: props[v.properties.name].type,
|
||||
tags: props[v.properties.name].tags,
|
||||
};
|
||||
return v;
|
||||
});
|
||||
geo.features = dissolved.features.concat(nonPoly);
|
||||
console.timeEnd("Dissolve");
|
||||
console.log();
|
||||
|
||||
console.log("Polygons to MultiPolygons");
|
||||
console.time("Polygons to MultiPolygons");
|
||||
|
||||
polygons = geo.features.filter((v) => v.geometry.type.endsWith("Polygon"));
|
||||
nonPoly = geo.features.filter((v) => !v.geometry.type.endsWith("Polygon"));
|
||||
|
||||
let countries = {};
|
||||
|
||||
for (let somePolygon of polygons) {
|
||||
if (!countries[somePolygon.properties.name]) {
|
||||
countries[somePolygon.properties.name] = {
|
||||
type: "Feature",
|
||||
properties: somePolygon.properties,
|
||||
geometry: {
|
||||
type: "MultiPolygon",
|
||||
coordinates: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (somePolygon.geometry.type === "MultiPolygon") {
|
||||
countries[somePolygon.properties.name].geometry.coordinates = countries[
|
||||
somePolygon.properties.name
|
||||
].concat(somePolygon.geometry.coordinates);
|
||||
} else if (somePolygon.geometry.type === "Polygon") {
|
||||
countries[somePolygon.properties.name].geometry.coordinates.push(
|
||||
somePolygon.geometry.coordinates
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let multiPolygons = Object.values(countries);
|
||||
|
||||
geo.features = multiPolygons.concat(nonPoly);
|
||||
|
||||
console.timeEnd("Polygons to MultiPolygons");
|
||||
console.log();
|
||||
|
||||
console.log("Difference");
|
||||
console.time("Difference");
|
||||
for (let g = 0; g < geo.features.length; g++) {
|
||||
for (let i = 0; i < geo.features.length; i++) {
|
||||
try {
|
||||
if (
|
||||
geo.features[g] === geo.features[i] ||
|
||||
geo.features[i]?.properties.type === "sand" ||
|
||||
geo.features[i]?.properties.type === "water" ||
|
||||
geo.features[i]?.properties.type === "grass" ||
|
||||
geo.features[g]?.properties.type === "sand" ||
|
||||
geo.features[g]?.properties.type === "water" ||
|
||||
geo.features[g]?.properties.type === "grass"
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
(geo.features[g]?.geometry.type === "Polygon" ||
|
||||
geo.features[g]?.geometry.type === "MultiPolygon") &&
|
||||
(geo.features[i]?.geometry.type === "Polygon" ||
|
||||
geo.features[i]?.geometry.type === "MultiPolygon")
|
||||
) {
|
||||
let p1 =
|
||||
geo.features[g]?.geometry.type === "MultiPolygon"
|
||||
? turf.multiPolygon(
|
||||
geo.features[g].geometry.coordinates,
|
||||
geo.features[g].properties
|
||||
)
|
||||
: turf.polygon(
|
||||
geo.features[g].geometry.coordinates,
|
||||
geo.features[g].properties
|
||||
);
|
||||
let p2 =
|
||||
geo.features[i]?.geometry.type === "MultiPolygon"
|
||||
? turf.multiPolygon(
|
||||
geo.features[i].geometry.coordinates,
|
||||
geo.features[i].properties
|
||||
)
|
||||
: turf.polygon(
|
||||
geo.features[i].geometry.coordinates,
|
||||
geo.features[i].properties
|
||||
);
|
||||
|
||||
let diff = turf.difference(p1, p2);
|
||||
geo.features[g] = diff ? diff : geo.features[g];
|
||||
} else continue;
|
||||
} catch (e) {
|
||||
console.log("Error, skip \n", e, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
console.timeEnd("Difference");
|
||||
console.log();
|
||||
|
||||
console.log("Add Map Components");
|
||||
console.time("Add Map Components");
|
||||
|
||||
let sand = JSON.parse(
|
||||
fs.readFileSync(path.join(geofixConf.naturesObjects, "sand.geojson"), "utf-8")
|
||||
).features;
|
||||
|
||||
let water = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(geofixConf.naturesObjects, "water.geojson"),
|
||||
"utf-8"
|
||||
)
|
||||
).features;
|
||||
|
||||
let grass = JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(geofixConf.naturesObjects, "grass.geojson"),
|
||||
"utf-8"
|
||||
)
|
||||
).features;
|
||||
|
||||
let white_road = JSON.parse(
|
||||
fs.readFileSync(path.join(geofixConf.roads, "white.geojson"), "utf-8")
|
||||
).features;
|
||||
|
||||
let orange_road = JSON.parse(
|
||||
fs.readFileSync(path.join(geofixConf.roads, "orange.geojson"), "utf-8")
|
||||
).features;
|
||||
|
||||
let yellow_road = JSON.parse(
|
||||
fs.readFileSync(path.join(geofixConf.roads, "yellow.geojson"), "utf-8")
|
||||
).features;
|
||||
|
||||
let road_sizes = JSON.parse(
|
||||
fs.readFileSync(path.join(geofixConf.roads, "sizes.json"), "utf-8")
|
||||
);
|
||||
|
||||
let map_comps = [
|
||||
...water.map((val) => {
|
||||
val.properties.type = "water";
|
||||
val.properties.fill = "#75cff0";
|
||||
val.properties.stroke = "#75cff0";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
return val;
|
||||
}),
|
||||
...sand.map((val) => {
|
||||
val.properties.type = "sand";
|
||||
val.properties.fill = "#efe9e1";
|
||||
val.properties.stroke = "#efe9e1";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
return val;
|
||||
}),
|
||||
...grass.map((val) => {
|
||||
val.properties.type = "grass";
|
||||
val.properties.fill = "#d1e6be";
|
||||
val.properties.stroke = "#d1e6be";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
return val;
|
||||
}),
|
||||
...white_road.map((val) => {
|
||||
let total = turf.buffer(
|
||||
val,
|
||||
road_sizes[val.properties.type] || road_sizes["middle"]
|
||||
);
|
||||
total.properties.type = "white_road";
|
||||
|
||||
val.properties.fill = "#fff";
|
||||
val.properties.stroke = "#fff";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
|
||||
return total;
|
||||
}),
|
||||
...yellow_road.map((val) => {
|
||||
let total = turf.buffer(
|
||||
val,
|
||||
road_sizes[val.properties.type] || road_sizes["middle"]
|
||||
);
|
||||
total.properties.type = "yellow_road";
|
||||
val.properties.fill = "#ffc107";
|
||||
val.properties.stroke = "#ffc107";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
return total;
|
||||
}),
|
||||
...orange_road.map((val) => {
|
||||
let total = turf.buffer(
|
||||
val,
|
||||
road_sizes[val.properties.type] || road_sizes["big"]
|
||||
);
|
||||
total.properties.type = "orange_road";
|
||||
val.properties.fill = "#fd7e14";
|
||||
val.properties.stroke = "#fd7e14";
|
||||
val.properties["fill-opacity"] = 1;
|
||||
return total;
|
||||
}),
|
||||
];
|
||||
|
||||
props = {};
|
||||
|
||||
for (let feature of map_comps) {
|
||||
if (props[feature.properties.type]) continue;
|
||||
props[feature.properties.type] = {
|
||||
stroke: feature.properties.stroke,
|
||||
fill: feature.properties.fill,
|
||||
type: feature.properties.type,
|
||||
tags: feature.properties.tags,
|
||||
"fill-opacity": feature.properties["fill-opacity"],
|
||||
};
|
||||
}
|
||||
|
||||
map_comps = turf.dissolve(turf.featureCollection(map_comps), {
|
||||
propertyName: "type",
|
||||
});
|
||||
|
||||
map_comps.features = map_comps.features.map((v) => {
|
||||
v.properties = {
|
||||
fill: props[v.properties.type].fill,
|
||||
stroke: props[v.properties.type].stroke,
|
||||
type: props[v.properties.type].type,
|
||||
tags: props[v.properties.type].tags,
|
||||
"fill-opacity": props[v.properties.type]["fill-opacity"],
|
||||
};
|
||||
return v;
|
||||
});
|
||||
|
||||
geo.features = [...map_comps.features, ...geo.features];
|
||||
console.timeEnd("Add Map Components");
|
||||
console.log();
|
||||
|
||||
if (config?.tags) {
|
||||
console.log("Filter countries by tags");
|
||||
console.time("Filter countries by tags");
|
||||
|
||||
geo.features = geo.features.filter((val) => {
|
||||
if (_.intersection(config.tags, val.properties.tags).length === 0)
|
||||
return false;
|
||||
// else if (config?.cities == false && val.geometry.type === "Point")
|
||||
// return false;
|
||||
else return true;
|
||||
});
|
||||
|
||||
console.timeEnd("Filter countries by tag");
|
||||
console.log();
|
||||
}
|
||||
|
||||
if (config?.reProperty) {
|
||||
console.log("replace Properties");
|
||||
console.time("replace Properties");
|
||||
|
||||
geo.features = geo.features.map((val) => {
|
||||
val.properties = config.reProperty;
|
||||
return val;
|
||||
});
|
||||
|
||||
console.timeEnd("replace Properties");
|
||||
console.log();
|
||||
}
|
||||
|
||||
console.log("Set new ids and area");
|
||||
console.time("Set new ids and area");
|
||||
|
||||
let id = 0;
|
||||
geo.features = geo.features.map((val) => {
|
||||
val.id = id++;
|
||||
if (val.geometry.type.endsWith("Polygon") && !val.properties.type) {
|
||||
val.properties.area = (turf.area(val) / 1000000)
|
||||
.toFixed(2)
|
||||
.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 ");
|
||||
}
|
||||
return val;
|
||||
});
|
||||
|
||||
console.timeEnd("Set new ids and area");
|
||||
|
||||
fs.writeFileSync(geofixConf.output, JSON.stringify(geo, null, " "));
|
||||
console.timeEnd("Total");
|
|
@ -1,70 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const yargs = require("yargs/yargs");
|
||||
const { hideBin } = require("yargs/helpers");
|
||||
const args = yargs(hideBin(process.argv)).argv;
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
let geojsonTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "geojson.geojson")
|
||||
);
|
||||
|
||||
let configTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "config.yaml")
|
||||
);
|
||||
|
||||
let propertiesTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "properties.yaml")
|
||||
);
|
||||
|
||||
let layersTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "layers.yaml")
|
||||
);
|
||||
|
||||
let countriesTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "countries.json")
|
||||
);
|
||||
|
||||
let roadSizesTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "roadSizes.json")
|
||||
);
|
||||
|
||||
let settingsTemplate = fs.readFileSync(
|
||||
path.join(__dirname, "file_templates", "map_settings.json")
|
||||
);
|
||||
|
||||
let name = args.name || "cime-project";
|
||||
|
||||
let currpath = path.join(process.cwd(), name, "src");
|
||||
|
||||
fs.mkdirSync(path.join(currpath, "countries"), { recursive: true });
|
||||
fs.mkdirSync(path.join(currpath, "nature"), { recursive: true });
|
||||
fs.mkdirSync(path.join(currpath, "roads"), { recursive: true });
|
||||
|
||||
fs.writeFileSync(path.join(currpath, "config.yaml"), configTemplate);
|
||||
fs.writeFileSync(path.join(currpath, "properties.yaml"), propertiesTemplate);
|
||||
fs.writeFileSync(path.join(currpath, "layers.yaml"), layersTemplate);
|
||||
fs.writeFileSync(path.join(currpath, "countries.json"), countriesTemplate);
|
||||
fs.writeFileSync(
|
||||
path.join(currpath, "..", "map_settings.json"),
|
||||
settingsTemplate
|
||||
);
|
||||
|
||||
fs.writeFileSync(path.join(currpath, "roads", "sizes.json"), roadSizesTemplate);
|
||||
|
||||
let geoTemplateFiles = [
|
||||
path.join("roads", "orange.geojson"),
|
||||
path.join("roads", "white.geojson"),
|
||||
path.join("roads", "yellow.geojson"),
|
||||
path.join("nature", "grass.geojson"),
|
||||
path.join("nature", "sand.geojson"),
|
||||
path.join("nature", "water.geojson"),
|
||||
];
|
||||
|
||||
for (let geoFile of geoTemplateFiles) {
|
||||
fs.writeFileSync(path.join(currpath, geoFile), geojsonTemplate);
|
||||
}
|
||||
|
||||
console.log("Done!");
|
|
@ -1,11 +0,0 @@
|
|||
# config is optional
|
||||
# ---
|
||||
# tags:
|
||||
# - tags
|
||||
# - for
|
||||
# - polygon
|
||||
# - selection
|
||||
# reProperty:
|
||||
# new: "Properties"
|
||||
# for: "Polygons"
|
||||
# cities: false
|
|
@ -1,11 +0,0 @@
|
|||
// example:
|
||||
// [
|
||||
// {
|
||||
// "idc": "usa",
|
||||
// "description": "strong country",
|
||||
// "name": "United States of America",
|
||||
// "date": "January 2, 1776",
|
||||
// "img": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Flag_of_the_United_States_%28DoS_ECA_Color_Standard%29.svg/125px-Flag_of_the_United_States_%28DoS_ECA_Color_Standard%29.svg.png",
|
||||
// "about": "https://en.wikipedia.org/wiki/United_States"
|
||||
// }
|
||||
// ]
|
|
@ -1,3 +0,0 @@
|
|||
# ids of countries
|
||||
# - usa
|
||||
# - china
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"name": "Map name",
|
||||
"geoURL": "link to geo.geojson",
|
||||
"countryInfoURL": "link to countries.json"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
# ---
|
||||
# usa:
|
||||
# fill: "#09aa1c"
|
||||
# stroke: "#09aa1c"
|
||||
# tags:
|
||||
# - nato
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"small": 0.006,
|
||||
"middle": 0.014,
|
||||
"big": 0.028
|
||||
}
|
Loading…
Add table
Reference in a new issue