Skip to content

Commit

Permalink
Merge pull request #87 from jonmmease/jonmmease/name-scenegraph
Browse files Browse the repository at this point in the history
Rename avenger crate to avenger-scenegraph, Add Scene prefix to marks
  • Loading branch information
jonmmease authored Dec 2, 2024
2 parents ecc26ad + 7e58cb8 commit cf887c8
Show file tree
Hide file tree
Showing 72 changed files with 277 additions and 261 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

env:
CARGO_TERM_COLOR: always
Expand All @@ -27,24 +27,25 @@ jobs:
run: cargo fmt --all -- --check
- name: Check no rustc warnings
run: |
cd avenger && cargo check --tests && cd ..
cd avenger-scenegraph && cargo check --tests && cd ..
cd avenger-vega && cargo check --tests && cd ..
cd avenger-wgpu && cargo check --tests && cd ..
cd avenger-vega-test-data && cargo check --tests && cd ..
- name: Check for clippy warnings
run: |
cd avenger && cargo clippy && cd ..
cd avenger-scenegraph && cargo clippy && cd ..
cd avenger-vega && cargo clippy && cd ..
cd avenger-wgpu && cargo clippy && cd ..
cd avenger-vega-test-data && cargo clippy && cd ..
- name: Build
run: |
cd avenger && cargo build && cd ..
cd avenger-scenegraph && cargo build && cd ..
cd avenger-vega && cargo build && cd ..
cd avenger-wgpu && cargo build && cd ..
cd avenger-vega-test-data && cargo build && cd ..
pushd examples/scatter-panning && cargo build && popd
pushd examples/wgpu-winit && cargo build && popd
# # Tests currently fail with `MakeWgpuAdapterError`
# - name: Run tests
# run: cargo test --verbose
Expand Down Expand Up @@ -76,4 +77,4 @@ jobs:
# uses: actions/upload-artifact@v4
# with:
# name: images-macos
# path: avenger-wgpu/tests/output
# path: avenger-wgpu/tests/output
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
"avenger",
"avenger-scenegraph",
"avenger-vega",
"avenger-wgpu",
"avenger-vega-test-data",
Expand Down
4 changes: 2 additions & 2 deletions avenger-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ crate-type = [ "cdylib",]
pythonize = { workspace = true }
pollster = "0.3"

[dependencies.avenger]
path = "../avenger"
[dependencies.avenger-scenegraph]
path = "../avenger-scenegraph"
features = [ "pyo3",]
version = "0.0.8"

Expand Down
2 changes: 1 addition & 1 deletion avenger-python/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use avenger::scene_graph::SceneGraph as RsSceneGraph;
use avenger_scenegraph::scene_graph::SceneGraph as RsSceneGraph;
use avenger_vega::scene_graph::VegaSceneGraph;
use avenger_wgpu::canvas::{Canvas, CanvasDimensions, PngCanvas};
use avenger_wgpu::register_font_directory as register_font_directory_rs;
Expand Down
2 changes: 1 addition & 1 deletion avenger/Cargo.toml → avenger-scenegraph/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "avenger"
name = "avenger-scenegraph"
version = "0.0.8"
edition = "2021"
description = "A visualization engine and renderer"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ArcMark {
pub struct SceneArcMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -23,7 +23,7 @@ pub struct ArcMark {
pub zindex: Option<i32>,
}

impl ArcMark {
impl SceneArcMark {
pub fn x_iter(&self) -> Box<dyn Iterator<Item = &f32> + '_> {
self.x.as_iter(self.len as usize, self.indices.as_ref())
}
Expand Down Expand Up @@ -67,7 +67,7 @@ impl ArcMark {
}
}

impl Default for ArcMark {
impl Default for SceneArcMark {
fn default() -> Self {
Self {
name: "arc_mark".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct AreaMark {
pub struct SceneAreaMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -23,7 +23,7 @@ pub struct AreaMark {
pub zindex: Option<i32>,
}

impl AreaMark {
impl SceneAreaMark {
pub fn x_iter(&self) -> Box<dyn Iterator<Item = &f32> + '_> {
self.x.as_iter(self.len as usize, None)
}
Expand All @@ -45,7 +45,7 @@ impl AreaMark {
}
}

impl Default for AreaMark {
impl Default for SceneAreaMark {
fn default() -> Self {
Self {
name: "area_mark".to_string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::marks::mark::SceneMark;
use crate::marks::path::{PathMark, PathTransform};
use crate::marks::path::{PathTransform, ScenePathMark};
use crate::marks::value::{ColorOrGradient, EncodingValue, Gradient};
use lyon_path::geom::euclid::Point2D;
use lyon_path::geom::Box2D;
Expand Down Expand Up @@ -70,7 +70,7 @@ pub struct SceneGroup {
}

impl SceneGroup {
pub fn make_path_mark(&self) -> Option<PathMark> {
pub fn make_path_mark(&self) -> Option<ScenePathMark> {
if self.fill.is_none() && self.stroke.is_none() {
return None;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ impl SceneGroup {
)),
};

Some(PathMark {
Some(ScenePathMark {
name: format!("path_{}", self.name),
clip: false,
len: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct ImageMark {
pub struct SceneImageMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -20,7 +20,7 @@ pub struct ImageMark {
pub zindex: Option<i32>,
}

impl ImageMark {
impl SceneImageMark {
pub fn image_iter(&self) -> Box<dyn Iterator<Item = &RgbaImage> + '_> {
self.image.as_iter(self.len as usize, self.indices.as_ref())
}
Expand All @@ -46,7 +46,7 @@ impl ImageMark {
}
}

impl Default for ImageMark {
impl Default for SceneImageMark {
fn default() -> Self {
Self {
name: "image_mark".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LineMark {
pub struct SceneLineMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -19,7 +19,7 @@ pub struct LineMark {
pub zindex: Option<i32>,
}

impl LineMark {
impl SceneLineMark {
pub fn x_iter(&self) -> Box<dyn Iterator<Item = &f32> + '_> {
self.x.as_iter(self.len as usize, None)
}
Expand All @@ -33,7 +33,7 @@ impl LineMark {
}
}

impl Default for LineMark {
impl Default for SceneLineMark {
fn default() -> Self {
Self {
name: "line_mark".to_string(),
Expand Down
40 changes: 20 additions & 20 deletions avenger/src/marks/mark.rs → avenger-scenegraph/src/marks/mark.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
use crate::marks::arc::ArcMark;
use crate::marks::area::AreaMark;
use crate::marks::arc::SceneArcMark;
use crate::marks::area::SceneAreaMark;
use crate::marks::group::SceneGroup;
use crate::marks::image::ImageMark;
use crate::marks::line::LineMark;
use crate::marks::path::PathMark;
use crate::marks::rect::RectMark;
use crate::marks::rule::RuleMark;
use crate::marks::symbol::SymbolMark;
use crate::marks::text::TextMark;
use crate::marks::trail::TrailMark;
use crate::marks::image::SceneImageMark;
use crate::marks::line::SceneLineMark;
use crate::marks::path::ScenePathMark;
use crate::marks::rect::SceneRectMark;
use crate::marks::rule::SceneRuleMark;
use crate::marks::symbol::SceneSymbolMark;
use crate::marks::text::SceneTextMark;
use crate::marks::trail::SceneTrailMark;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum SceneMark {
Arc(ArcMark),
Area(AreaMark),
Path(PathMark),
Symbol(SymbolMark),
Line(LineMark),
Trail(TrailMark),
Rect(RectMark),
Rule(RuleMark),
Text(Box<TextMark>),
Image(Box<ImageMark>),
Arc(SceneArcMark),
Area(SceneAreaMark),
Path(ScenePathMark),
Symbol(SceneSymbolMark),
Line(SceneLineMark),
Trail(SceneTrailMark),
Rect(SceneRectMark),
Rule(SceneRuleMark),
Text(Box<SceneTextMark>),
Image(Box<SceneImageMark>),
Group(SceneGroup),
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub type PathTransform = Transform2D<f32, UnknownUnit, UnknownUnit>;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct PathMark {
pub struct ScenePathMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -22,7 +22,7 @@ pub struct PathMark {
pub zindex: Option<i32>,
}

impl PathMark {
impl ScenePathMark {
pub fn path_iter(&self) -> Box<dyn Iterator<Item = &lyon_path::Path> + '_> {
self.path.as_iter(self.len as usize, self.indices.as_ref())
}
Expand Down Expand Up @@ -59,7 +59,7 @@ impl PathMark {
}
}

impl Default for PathMark {
impl Default for ScenePathMark {
fn default() -> Self {
Self {
name: "rule_mark".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RectMark {
pub struct SceneRectMark {
pub name: String,
pub clip: bool,
pub len: u32,
Expand All @@ -20,7 +20,7 @@ pub struct RectMark {
pub zindex: Option<i32>,
}

impl RectMark {
impl SceneRectMark {
pub fn x_iter(&self) -> Box<dyn Iterator<Item = &f32> + '_> {
self.x.as_iter(self.len as usize, self.indices.as_ref())
}
Expand Down Expand Up @@ -92,7 +92,7 @@ impl RectMark {
}
}

impl Default for RectMark {
impl Default for SceneRectMark {
fn default() -> Self {
Self {
name: "rule_mark".to_string(),
Expand Down
Loading

0 comments on commit cf887c8

Please sign in to comment.