From add67bd23ffe626efaf88b4dee5bec2034e8d0d0 Mon Sep 17 00:00:00 2001 From: Michael Kreil Date: Tue, 2 Jul 2024 07:11:53 +0000 Subject: [PATCH] refactor: move debug tile code --- Cargo.lock | 5 ++- Cargo.toml | 1 + versatiles_geometry/Cargo.toml | 1 - versatiles_geometry/src/vector_tile/mod.rs | 2 -- versatiles_image/Cargo.toml | 4 +-- versatiles_image/assets/trim.ttf | Bin 15492 -> 0 bytes versatiles_image/src/helper.rs | 29 +--------------- versatiles_pipeline/Cargo.toml | 2 ++ .../src/operations/read/from_debug/image.rs | 31 ++++++++++++++++++ .../read/{from_debug.rs => from_debug/mod.rs} | 10 +++--- .../src/operations/read/from_debug}/trim.ttf | Bin .../src/operations/read/from_debug/vector.rs | 12 +++---- 12 files changed, 50 insertions(+), 47 deletions(-) delete mode 100644 versatiles_image/assets/trim.ttf create mode 100644 versatiles_pipeline/src/operations/read/from_debug/image.rs rename versatiles_pipeline/src/operations/read/{from_debug.rs => from_debug/mod.rs} (94%) rename {versatiles_geometry/assets => versatiles_pipeline/src/operations/read/from_debug}/trim.ttf (100%) rename versatiles_geometry/src/vector_tile/debug.rs => versatiles_pipeline/src/operations/read/from_debug/vector.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index 5cbb0379..bdea9baa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2629,7 +2629,6 @@ dependencies = [ name = "versatiles_geometry" version = "0.11.5" dependencies = [ - "ab_glyph", "anyhow", "byteorder", "lazy_static", @@ -2643,10 +2642,8 @@ dependencies = [ name = "versatiles_image" version = "0.11.5" dependencies = [ - "ab_glyph", "anyhow", "image", - "imageproc", "versatiles_core", "webp", ] @@ -2655,10 +2652,12 @@ dependencies = [ name = "versatiles_pipeline" version = "0.11.5" dependencies = [ + "ab_glyph", "anyhow", "assert_fs", "async-trait", "futures", + "imageproc", "itertools 0.13.0", "log", "nom", diff --git a/Cargo.toml b/Cargo.toml index f3954f67..f0da5c4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,7 @@ clap = { version = "4.5.7" } clap-verbosity-flag = { version = "2.2.0", default-features = false } enumset = { version = "1.1.3", default-features = false } futures = { version = "0.3.30", default-features = false } +image = { version = "0.25.0", default-features = false, features = ["jpeg", "png"] } itertools = { version = "0.13.0", default-features = false } lazy_static = { version = "1.4.0", default-features = false } log = { version = "0.4.21", default-features = false } diff --git a/versatiles_geometry/Cargo.toml b/versatiles_geometry/Cargo.toml index 9d5c78e1..80c80b0b 100644 --- a/versatiles_geometry/Cargo.toml +++ b/versatiles_geometry/Cargo.toml @@ -13,7 +13,6 @@ repository.workspace = true version.workspace = true [dependencies] -ab_glyph.workspace = true anyhow.workspace = true byteorder.workspace = true lazy_static.workspace = true diff --git a/versatiles_geometry/src/vector_tile/mod.rs b/versatiles_geometry/src/vector_tile/mod.rs index 0000450e..e2d32897 100644 --- a/versatiles_geometry/src/vector_tile/mod.rs +++ b/versatiles_geometry/src/vector_tile/mod.rs @@ -1,4 +1,3 @@ -mod debug; mod feature; mod geometry_type; mod layer; @@ -6,6 +5,5 @@ mod property_manager; mod tile; mod value; -pub use debug::create_debug_vector_tile; pub use layer::VectorTileLayer; pub use tile::VectorTile; diff --git a/versatiles_image/Cargo.toml b/versatiles_image/Cargo.toml index c829c8a1..b63e077d 100644 --- a/versatiles_image/Cargo.toml +++ b/versatiles_image/Cargo.toml @@ -13,10 +13,8 @@ repository.workspace = true version.workspace = true [dependencies] -ab_glyph.workspace = true anyhow.workspace = true -image = { version = "0.25.0", default-features = false, features = ["jpeg", "png"] } -imageproc = { version = "0.25.0", default-features = false } +image.workspace = true webp = { version = "0.3.0", default-features = false, features = ["img"] } versatiles_core.workspace = true diff --git a/versatiles_image/assets/trim.ttf b/versatiles_image/assets/trim.ttf deleted file mode 100644 index 92f3d135150fe4f6cd93bfbd5c30964f5aea2f9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15492 zcmc(m2bdK__UKRb?VceB0)ntem=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RJ`k~QUt?U(obk7SUa zA?y6gGMIFzze9$2=cTpH2L)uEceTv%w(2(jZP`kGL-I~pXUqLVGQ{E3?DkUU;6Md>D4-o9y}~9ec-sEeMZ}CN>%!1z16H%!xmOe6yYcx zjSQ?JDO{}Ce`~CXX_dmp(vf!QY-9}2{*;Wv4D3&SH2JZphjf?P_hGb2!CyHbTg@%B z9*U&wN4w!}jA}SpM^iG)jXjX@hBEr-tkM+cjTaSHD5SMva>^y}DWR7T2_Fb#3c5ZQHfKuEX^= z+}QD^w3|EK(z(m6w{`8-y+_aNv;F_cTZ*+bZ~x^s2^85+wC(?@PO?{HyxTj$YP>gb aS7pc0RY!?m1GxOuUqZwNAVmL_D*pp`5nMX} diff --git a/versatiles_image/src/helper.rs b/versatiles_image/src/helper.rs index ef4ccb82..e7ae98de 100644 --- a/versatiles_image/src/helper.rs +++ b/versatiles_image/src/helper.rs @@ -1,34 +1,7 @@ use crate::format::*; -use ab_glyph::{FontArc, PxScale}; use anyhow::Result; use image::{DynamicImage, GrayAlphaImage, GrayImage, Luma, LumaA, Rgb, RgbImage, Rgba, RgbaImage}; -use imageproc::drawing::draw_text_mut; -use versatiles_core::types::{Blob, TileCoord3, TileFormat}; - -static mut FONT: Option = None; - -pub fn create_debug_image(coord: &TileCoord3) -> DynamicImage { - let font = unsafe { - if FONT.is_none() { - FONT.insert(FontArc::try_from_slice(include_bytes!("../assets/trim.ttf")).unwrap()) - } else { - FONT.as_ref().unwrap() - } - }; - - let br = ((coord.x + coord.y) % 2) as u8 * 16 + 224; - let mut image1 = RgbImage::from_pixel(512, 512, Rgb::from([br, br, br])); - - let mut draw = |y: i32, c: Rgb, text: String| { - draw_text_mut(&mut image1, c, 220, y, PxScale::from(40f32), font, &text) - }; - - draw(195, Rgb([127, 30, 16]), format!("z: {}", coord.z)); - draw(225, Rgb([0, 92, 45]), format!("x: {}", coord.x)); - draw(255, Rgb([30, 23, 98]), format!("y: {}", coord.y)); - - DynamicImage::ImageRgb8(image1) -} +use versatiles_core::types::{Blob, TileFormat}; /// Generate a DynamicImage with RGBA colors pub fn create_image_rgba() -> DynamicImage { diff --git a/versatiles_pipeline/Cargo.toml b/versatiles_pipeline/Cargo.toml index f8720e40..54b3a7e4 100644 --- a/versatiles_pipeline/Cargo.toml +++ b/versatiles_pipeline/Cargo.toml @@ -13,9 +13,11 @@ repository.workspace = true version.workspace = true [dependencies] +ab_glyph.workspace = true anyhow.workspace = true async-trait.workspace = true futures.workspace = true +imageproc = { version = "0.25.0", default-features = false } itertools.workspace = true log.workspace = true nom = { version = "7.1.3" } diff --git a/versatiles_pipeline/src/operations/read/from_debug/image.rs b/versatiles_pipeline/src/operations/read/from_debug/image.rs new file mode 100644 index 00000000..6ef00f0b --- /dev/null +++ b/versatiles_pipeline/src/operations/read/from_debug/image.rs @@ -0,0 +1,31 @@ +use ab_glyph::{FontArc, PxScale}; +use imageproc::{ + drawing::draw_text_mut, + image::{DynamicImage, Rgb, RgbImage}, +}; +use versatiles_core::types::TileCoord3; + +static mut FONT: Option = None; + +pub fn create_debug_image(coord: &TileCoord3) -> DynamicImage { + let font = unsafe { + if FONT.is_none() { + FONT.insert(FontArc::try_from_slice(include_bytes!("./trim.ttf")).unwrap()) + } else { + FONT.as_ref().unwrap() + } + }; + + let br = ((coord.x + coord.y) % 2) as u8 * 16 + 224; + let mut image1 = RgbImage::from_pixel(512, 512, Rgb::from([br, br, br])); + + let mut draw = |y: i32, c: Rgb, text: String| { + draw_text_mut(&mut image1, c, 220, y, PxScale::from(40f32), font, &text) + }; + + draw(195, Rgb([127, 30, 16]), format!("z: {}", coord.z)); + draw(225, Rgb([0, 92, 45]), format!("x: {}", coord.x)); + draw(255, Rgb([30, 23, 98]), format!("y: {}", coord.y)); + + DynamicImage::ImageRgb8(image1) +} diff --git a/versatiles_pipeline/src/operations/read/from_debug.rs b/versatiles_pipeline/src/operations/read/from_debug/mod.rs similarity index 94% rename from versatiles_pipeline/src/operations/read/from_debug.rs rename to versatiles_pipeline/src/operations/read/from_debug/mod.rs index 70231921..3c028812 100644 --- a/versatiles_pipeline/src/operations/read/from_debug.rs +++ b/versatiles_pipeline/src/operations/read/from_debug/mod.rs @@ -1,10 +1,13 @@ -#![allow(dead_code, unused_variables, unreachable_code)] +mod image; +mod vector; use crate::{traits::*, vpl::VPLNode, PipelineFactory}; use anyhow::{bail, Result}; use async_trait::async_trait; use futures::future::BoxFuture; +use image::create_debug_image; use std::fmt::Debug; +use vector::create_debug_vector_tile; use versatiles_core::{ types::{ Blob, TileBBox, TileBBoxPyramid, TileCompression, TileCoord3, TileFormat, TileStream, @@ -12,8 +15,7 @@ use versatiles_core::{ }, utils::compress, }; -use versatiles_geometry::vector_tile::create_debug_vector_tile; -use versatiles_image::helper::{create_debug_image, image2blob}; +use versatiles_image::helper::image2blob; #[derive(versatiles_derive::VPLDecode, Clone, Debug)] /// Generates mocked tiles. @@ -57,7 +59,7 @@ impl Operation { impl ReadOperationTrait for Operation { fn build( vpl_node: VPLNode, - factory: &PipelineFactory, + _factory: &PipelineFactory, ) -> BoxFuture<'_, Result>> where Self: Sized + OperationTrait, diff --git a/versatiles_geometry/assets/trim.ttf b/versatiles_pipeline/src/operations/read/from_debug/trim.ttf similarity index 100% rename from versatiles_geometry/assets/trim.ttf rename to versatiles_pipeline/src/operations/read/from_debug/trim.ttf diff --git a/versatiles_geometry/src/vector_tile/debug.rs b/versatiles_pipeline/src/operations/read/from_debug/vector.rs similarity index 97% rename from versatiles_geometry/src/vector_tile/debug.rs rename to versatiles_pipeline/src/operations/read/from_debug/vector.rs index bc6c0058..5810c924 100644 --- a/versatiles_geometry/src/vector_tile/debug.rs +++ b/versatiles_pipeline/src/operations/read/from_debug/vector.rs @@ -1,12 +1,12 @@ -use super::{VectorTile, VectorTileLayer}; -use crate::{ - AreaTrait, Feature, Geometry, LineStringGeometry, MultiLineStringGeometry, MultiPolygonGeometry, - PointGeometry, RingGeometry, -}; use ab_glyph::{Font, FontArc, Outline, OutlineCurve::*, Point}; use anyhow::Result; use std::{f64::consts::PI, ops::Div, vec}; use versatiles_core::types::{Blob, TileCoord3}; +use versatiles_geometry::{ + vector_tile::{VectorTile, VectorTileLayer}, + AreaTrait, Feature, Geometry, LineStringGeometry, MultiLineStringGeometry, MultiPolygonGeometry, + PointGeometry, RingGeometry, +}; static mut FONT: Option = None; @@ -24,7 +24,7 @@ pub fn create_debug_vector_tile(coord: &TileCoord3) -> Result { fn draw_text(name: &str, y: f32, text: String) -> VectorTileLayer { let font = unsafe { if FONT.is_none() { - FONT.insert(FontArc::try_from_slice(include_bytes!("../../assets/trim.ttf")).unwrap()) + FONT.insert(FontArc::try_from_slice(include_bytes!("./trim.ttf")).unwrap()) } else { FONT.as_ref().unwrap() }