egml-core 0.0.2-alpha.5

Core primitives and operations for processing GML data.
Documentation
use crate::model::base::{
    AssociationAttributes, HasAssociationAttributes, HasAssociationAttributesMut,
    HasOwnershipAttributes, HasOwnershipAttributesMut, OwnershipAttributes,
};
use crate::model::geometry::aggregates::MultiCurve;
use crate::model::xlink::HRef;

#[derive(Debug, Clone, PartialEq)]
pub struct MultiCurveProperty {
    object: Option<MultiCurve>,
    association: AssociationAttributes,
    ownership: OwnershipAttributes,
}

impl MultiCurveProperty {
    pub fn new(
        object: Option<MultiCurve>,
        association: AssociationAttributes,
        ownership: OwnershipAttributes,
    ) -> Self {
        Self {
            object,
            association,
            ownership,
        }
    }

    pub fn from_object(object: MultiCurve) -> Self {
        Self {
            object: Some(object),
            association: AssociationAttributes::default(),
            ownership: OwnershipAttributes::default(),
        }
    }

    pub fn from_href(href: HRef) -> Self {
        Self {
            object: None,
            association: AssociationAttributes::new_href(href),
            ownership: OwnershipAttributes::default(),
        }
    }

    pub fn object(&self) -> Option<&MultiCurve> {
        self.object.as_ref()
    }

    pub fn object_mut(&mut self) -> Option<&mut MultiCurve> {
        self.object.as_mut()
    }

    pub fn take_object(&mut self) -> Option<MultiCurve> {
        self.object.take()
    }

    pub fn set_object(&mut self, object: MultiCurve) {
        self.object = Some(object);
    }

    pub fn set_object_opt(&mut self, object: Option<MultiCurve>) {
        self.object = object;
    }

    pub fn clear_object(&mut self) {
        self.object = None;
    }
}

impl HasAssociationAttributes for MultiCurveProperty {
    fn association(&self) -> &AssociationAttributes {
        &self.association
    }
}

impl HasAssociationAttributesMut for MultiCurveProperty {
    fn association_mut(&mut self) -> &mut AssociationAttributes {
        &mut self.association
    }
}

impl HasOwnershipAttributes for MultiCurveProperty {
    fn ownership(&self) -> &OwnershipAttributes {
        &self.ownership
    }
}

impl HasOwnershipAttributesMut for MultiCurveProperty {
    fn ownership_mut(&mut self) -> &mut OwnershipAttributes {
        &mut self.ownership
    }
}