#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TitleBlockPosition {
BottomRight,
BottomLeft,
}
#[derive(Debug, Clone)]
pub struct TitleBlock {
pub project: Option<String>,
pub title: Option<String>,
pub drawn_by: Option<String>,
pub checked_by: Option<String>,
pub date: Option<String>,
pub scale: Option<String>,
pub sheet: Option<String>,
pub rev: Option<String>,
pub drawing_no: Option<String>,
pub position: TitleBlockPosition,
pub width: f64,
pub height: f64,
}
impl Default for TitleBlock {
fn default() -> Self {
Self {
project: None,
title: None,
drawn_by: None,
checked_by: None,
date: None,
scale: None,
sheet: None,
rev: None,
drawing_no: None,
position: TitleBlockPosition::BottomRight,
width: 380.0,
height: 90.0,
}
}
}
impl TitleBlock {
pub fn new() -> Self {
Self::default()
}
pub fn project(mut self, s: impl Into<String>) -> Self {
self.project = Some(s.into());
self
}
pub fn title(mut self, s: impl Into<String>) -> Self {
self.title = Some(s.into());
self
}
pub fn drawn_by(mut self, s: impl Into<String>) -> Self {
self.drawn_by = Some(s.into());
self
}
pub fn checked_by(mut self, s: impl Into<String>) -> Self {
self.checked_by = Some(s.into());
self
}
pub fn date(mut self, s: impl Into<String>) -> Self {
self.date = Some(s.into());
self
}
pub fn scale(mut self, s: impl Into<String>) -> Self {
self.scale = Some(s.into());
self
}
pub fn sheet(mut self, s: impl Into<String>) -> Self {
self.sheet = Some(s.into());
self
}
pub fn rev(mut self, s: impl Into<String>) -> Self {
self.rev = Some(s.into());
self
}
pub fn drawing_no(mut self, s: impl Into<String>) -> Self {
self.drawing_no = Some(s.into());
self
}
pub fn position(mut self, p: TitleBlockPosition) -> Self {
self.position = p;
self
}
pub fn size(mut self, width: f64, height: f64) -> Self {
self.width = width;
self.height = height;
self
}
}