Prepare to display all operations

This commit is contained in:
Hanno Braun 2025-01-31 20:50:01 +01:00
parent 85fe6e959c
commit 81cfbed007
6 changed files with 16 additions and 0 deletions

View File

@ -3,6 +3,10 @@ use std::{ops::Deref, rc::Rc};
use super::tri_mesh::TriMesh;
pub trait Operation {
type Output
where
Self: Sized;
fn label(&self) -> &'static str;
fn tri_mesh(&self) -> TriMesh;
fn children(&self) -> Vec<AnyOp>;
@ -63,6 +67,8 @@ impl AnyOp {
}
impl Operation for AnyOp {
type Output = Self;
fn label(&self) -> &'static str {
self.inner.label()
}

View File

@ -19,6 +19,8 @@ where
}
impl Operation for Triangle {
type Output = Self;
fn label(&self) -> &'static str {
"Triangle"
}

View File

@ -65,6 +65,8 @@ impl Face {
}
impl Operation for Face {
type Output = Self;
fn label(&self) -> &'static str {
"Face"
}

View File

@ -88,6 +88,8 @@ impl Solid {
}
impl Operation for Solid {
type Output = Self;
fn label(&self) -> &'static str {
"Solid"
}

View File

@ -28,6 +28,8 @@ where
}
impl Operation for Vertex {
type Output = Self;
fn label(&self) -> &'static str {
"Vertex"
}

View File

@ -122,6 +122,8 @@ impl OperationView {
}
impl Operation for OperationView {
type Output = Self;
fn label(&self) -> &'static str {
self.operation.label()
}