Skip to content

Commit 93788e7

Browse files
committed
remove nature
1 parent d028617 commit 93788e7

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

src/build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{fs, path::Path, time};
33
use serde_json::json;
44

55
use crate::{
6-
types::{CountryData, ToCollection},
6+
types::{CountryData, ToCollection, ToFeatures},
77
utils::{
88
diff_countries, get_country, is_match, read_config, rewrite_if_some, rewrite_if_some_option,
99
},
@@ -82,8 +82,6 @@ pub fn build() {
8282
countries
8383
};
8484

85-
// TODO: Add nature support
86-
8785
{
8886
let generated_time = time::Instant::now();
8987
let countries_json = serde_json::to_string_pretty(&serde_json::Map::from_iter(

src/templates/config.toml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,3 @@ output_folder = "./out/map"
3030
# foundation_date = "2024-01-01"
3131
# flag = "https://example.com/flag.png"
3232
# about = "https://example.com/about.html"
33-
34-
# Additional nature layers
35-
[[nature]]
36-
id = "water"
37-
color = "#75cff0"
38-
39-
[[nature]]
40-
id = "sand"
41-
color = "#efe9e1"
42-
43-
[[nature]]
44-
id = "grass"
45-
color = "#d1e6be"

src/types.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,19 @@ impl ToFeatures for CountryData {
242242
impl ToCollection for Vec<CountryData> {
243243
fn to_collection(self) -> geojson::FeatureCollection {
244244
geojson::FeatureCollection {
245-
features: self
246-
.iter()
247-
.flat_map(|c| c.to_features())
248-
.collect::<Vec<geojson::Feature>>(),
245+
features: self.to_features(),
249246
bbox: None,
250247
foreign_members: None,
251248
}
252249
}
253250
}
254251

252+
impl ToFeatures for Vec<CountryData> {
253+
fn to_features(&self) -> Vec<geojson::Feature> {
254+
self.iter().flat_map(|c| c.to_features()).collect()
255+
}
256+
}
257+
255258
impl ToCollection for Vec<geojson::Feature> {
256259
fn to_collection(self) -> geojson::FeatureCollection {
257260
geojson::FeatureCollection {

0 commit comments

Comments
 (0)