|
use dyn_any::DynAny; |
|
use glam::DVec2; |
|
use kurbo::Point; |
|
|
|
|
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] |
|
#[widget(Radio)] |
|
pub enum CentroidType { |
|
|
|
#[default] |
|
Area, |
|
|
|
Length, |
|
} |
|
|
|
pub trait AsU64 { |
|
fn as_u64(&self) -> u64; |
|
} |
|
impl AsU64 for u32 { |
|
fn as_u64(&self) -> u64 { |
|
*self as u64 |
|
} |
|
} |
|
impl AsU64 for u64 { |
|
fn as_u64(&self) -> u64 { |
|
*self |
|
} |
|
} |
|
impl AsU64 for f64 { |
|
fn as_u64(&self) -> u64 { |
|
*self as u64 |
|
} |
|
} |
|
|
|
pub trait AsI64 { |
|
fn as_i64(&self) -> i64; |
|
} |
|
impl AsI64 for u32 { |
|
fn as_i64(&self) -> i64 { |
|
*self as i64 |
|
} |
|
} |
|
impl AsI64 for u64 { |
|
fn as_i64(&self) -> i64 { |
|
*self as i64 |
|
} |
|
} |
|
impl AsI64 for f64 { |
|
fn as_i64(&self) -> i64 { |
|
*self as i64 |
|
} |
|
} |
|
|
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] |
|
#[widget(Radio)] |
|
pub enum GridType { |
|
#[default] |
|
Rectangular, |
|
Isometric, |
|
} |
|
|
|
#[repr(C)] |
|
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] |
|
#[widget(Radio)] |
|
pub enum ArcType { |
|
#[default] |
|
Open, |
|
Closed, |
|
PieSlice, |
|
} |
|
|
|
#[repr(C)] |
|
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] |
|
#[widget(Radio)] |
|
pub enum MergeByDistanceAlgorithm { |
|
#[default] |
|
Spatial, |
|
Topological, |
|
} |
|
|
|
#[repr(C)] |
|
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)] |
|
#[widget(Radio)] |
|
pub enum PointSpacingType { |
|
#[default] |
|
|
|
Separation, |
|
|
|
Quantity, |
|
} |
|
|
|
pub fn point_to_dvec2(point: Point) -> DVec2 { |
|
DVec2 { x: point.x, y: point.y } |
|
} |
|
|
|
pub fn dvec2_to_point(value: DVec2) -> Point { |
|
Point { x: value.x, y: value.y } |
|
} |
|
|