mapserver: Fix unzoom gen
This commit is contained in:
parent
c40541963f
commit
2e9c8a6975
|
@ -604,16 +604,6 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctrlc"
|
|
||||||
version = "3.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf"
|
|
||||||
dependencies = [
|
|
||||||
"nix",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dashmap"
|
name = "dashmap"
|
||||||
version = "4.0.2"
|
version = "4.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
@ -1097,7 +1087,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"ctrlc",
|
|
||||||
"http-types",
|
"http-types",
|
||||||
"image",
|
"image",
|
||||||
"log",
|
"log",
|
||||||
|
@ -1157,19 +1146,6 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
|
||||||
version = "0.23.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"cc",
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"libc",
|
|
||||||
"memoffset",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.44"
|
version = "0.1.44"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
|
@ -6,7 +6,6 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-std = { version = "1.6.5", features = ["attributes"] }
|
async-std = { version = "1.6.5", features = ["attributes"] }
|
||||||
crossbeam-channel = "0.5.2"
|
crossbeam-channel = "0.5.2"
|
||||||
ctrlc = "3.2.1"
|
|
||||||
http-types = "2.12.0"
|
http-types = "2.12.0"
|
||||||
image = "0.24.1"
|
image = "0.24.1"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
|
|
@ -120,49 +120,66 @@ fn generate_tile(
|
||||||
run_minetestmapper(z, x, y, tile_dir, tile_path, config)?
|
run_minetestmapper(z, x, y, tile_dir, tile_path, config)?
|
||||||
}
|
}
|
||||||
std::cmp::Ordering::Less => {
|
std::cmp::Ordering::Less => {
|
||||||
let tile1_path =
|
|
||||||
get_dep_tile(z + 1, x * 2, y * 2, tasks.clone(), config.clone())?;
|
|
||||||
let tile2_path = get_dep_tile(
|
|
||||||
z + 1,
|
|
||||||
x * 2,
|
|
||||||
y * 2 + 1,
|
|
||||||
tasks.clone(),
|
|
||||||
config.clone(),
|
|
||||||
)?;
|
|
||||||
let tile3_path = get_dep_tile(
|
|
||||||
z + 1,
|
|
||||||
x * 2 + 1,
|
|
||||||
y * 2,
|
|
||||||
tasks.clone(),
|
|
||||||
config.clone(),
|
|
||||||
)?;
|
|
||||||
let tile4_path = get_dep_tile(
|
|
||||||
z + 1,
|
|
||||||
x * 2 + 1,
|
|
||||||
y * 2 + 1,
|
|
||||||
tasks.clone(),
|
|
||||||
config.clone(),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let tile1 = image::open(tile1_path).map_err(Error::Image)?.into_rgb8();
|
|
||||||
let tile2 = image::open(tile2_path).map_err(Error::Image)?.into_rgb8();
|
|
||||||
let tile3 = image::open(tile3_path).map_err(Error::Image)?.into_rgb8();
|
|
||||||
let tile4 = image::open(tile4_path).map_err(Error::Image)?.into_rgb8();
|
|
||||||
|
|
||||||
let mut tile = image::ImageBuffer::<image::Rgb<u8>, Vec<u8>>::new(
|
let mut tile = image::ImageBuffer::<image::Rgb<u8>, Vec<u8>>::new(
|
||||||
config.tile_size as u32 * 2,
|
config.tile_size as u32 * 2,
|
||||||
config.tile_size as u32 * 2,
|
config.tile_size as u32 * 2,
|
||||||
);
|
);
|
||||||
image::imageops::replace(&mut tile, &tile1, 0, 0);
|
if let Ok(ntile_path) =
|
||||||
image::imageops::replace(&mut tile, &tile2, 0, config.tile_size as i64);
|
get_dep_tile(z + 1, x * 2, y * 2, tasks.clone(), config.clone())
|
||||||
image::imageops::replace(&mut tile, &tile3, config.tile_size as i64, 0);
|
{
|
||||||
image::imageops::replace(
|
if let Ok(ntile) = image::open(ntile_path) {
|
||||||
&mut tile,
|
image::imageops::replace(&mut tile, &ntile.into_rgb8(), 0, 0);
|
||||||
&tile4,
|
}
|
||||||
config.tile_size as i64,
|
}
|
||||||
config.tile_size as i64,
|
if let Ok(ntile_path) =
|
||||||
);
|
get_dep_tile(z + 1, x * 2, y * 2 + 1, tasks.clone(), config.clone())
|
||||||
tile.save(tile_path).map_err(Error::Image)?;
|
{
|
||||||
|
if let Ok(ntile) = image::open(ntile_path) {
|
||||||
|
image::imageops::replace(
|
||||||
|
&mut tile,
|
||||||
|
&ntile.into_rgb8(),
|
||||||
|
0,
|
||||||
|
config.tile_size as i64,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Ok(ntile_path) =
|
||||||
|
get_dep_tile(z + 1, x * 2 + 1, y * 2, tasks.clone(), config.clone())
|
||||||
|
{
|
||||||
|
if let Ok(ntile) = image::open(ntile_path) {
|
||||||
|
image::imageops::replace(
|
||||||
|
&mut tile,
|
||||||
|
&ntile.into_rgb8(),
|
||||||
|
config.tile_size as i64,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Ok(ntile_path) = get_dep_tile(
|
||||||
|
z + 1,
|
||||||
|
x * 2 + 1,
|
||||||
|
y * 2 + 1,
|
||||||
|
tasks.clone(),
|
||||||
|
config.clone(),
|
||||||
|
) {
|
||||||
|
if let Ok(ntile) = image::open(ntile_path) {
|
||||||
|
image::imageops::replace(
|
||||||
|
&mut tile,
|
||||||
|
&ntile.into_rgb8(),
|
||||||
|
config.tile_size as i64,
|
||||||
|
config.tile_size as i64,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
image::imageops::resize(
|
||||||
|
&tile,
|
||||||
|
config.tile_size as u32,
|
||||||
|
config.tile_size as u32,
|
||||||
|
image::imageops::Triangle,
|
||||||
|
)
|
||||||
|
.save(tile_path)
|
||||||
|
.map_err(Error::Image)?;
|
||||||
}
|
}
|
||||||
std::cmp::Ordering::Greater => Err(Error::Todo)?,
|
std::cmp::Ordering::Greater => Err(Error::Todo)?,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue