mod binary;
mod conversion;
mod params;
pub use binary::{FromBinary, ToBinary};
pub use conversion::{FromParamList, FromParamValue, ToParamList, ToParamValue};
pub use params::{FromParams, ToParams};
use crate::types::{CoordPoint, CoordRect, Layer};
pub trait AltiumRecord: Sized + Clone + Default {
fn record_type_name() -> &'static str;
fn supports_unknown_preservation() -> bool {
true
}
}
pub trait SchPrimitive: AltiumRecord + FromParams + ToParams {
const RECORD_ID: i32;
fn owner_index(&self) -> i32;
fn set_owner_index(&mut self, index: i32);
fn calculate_bounds(&self) -> CoordRect;
fn location(&self) -> Option<CoordPoint> {
None
}
fn record_type_name(&self) -> &'static str;
fn get_property(&self, _name: &str) -> Option<String> {
None
}
}
pub trait PcbPrimitive: AltiumRecord + FromBinary + ToBinary {
const OBJECT_ID: crate::records::pcb::PcbObjectId;
fn layer(&self) -> Layer;
fn calculate_bounds(&self) -> CoordRect;
}
pub trait Locatable {
fn location(&self) -> (i32, i32);
fn set_location(&mut self, x: i32, y: i32);
}
pub trait Graphical: Locatable {
fn color(&self) -> i32;
fn set_color(&mut self, color: i32);
fn area_color(&self) -> i32;
fn set_area_color(&mut self, color: i32);
}
pub trait Container: AltiumRecord {
type Child: AltiumRecord;
fn is_root_container() -> bool {
false
}
}