Skip to main content

ogeom_doc/
view.rs

1//! Saved views and standalone notes.
2//!
3//! A saved view is how an annotated part organises its own presentation: a
4//! named camera, and the subset of the drawn callouts meant to be visible
5//! from it. Real AP242 files use views to sort PMI by sheet, and reading
6//! them without views flattens a structure the author meant. A note is
7//! smaller still: text a person attached to the document or to a product,
8//! with no geometry behind it.
9//!
10//! Both are document data like colours and layers: they take part in undo,
11//! they persist in the native document format, and views round-trip through
12//! STEP as the draughting models they are there.
13
14use ogeom_math::{Frame, Plane};
15
16/// A saved view: a camera and what it is meant to show.
17#[derive(Debug, Clone, PartialEq)]
18pub struct View {
19    /// The view's name, as the author gave it.
20    pub name: String,
21    /// The camera: origin is the eye's target, `z` the viewing direction,
22    /// `x` the screen's right.
23    pub frame: Frame,
24    /// A section plane the view clips at, where one was stated.
25    pub clipping: Option<Plane>,
26    /// Indices into the document's PMI callouts: the annotations this view
27    /// presents. An index rather than a copy, so restyling a callout
28    /// restyles it in every view that shows it.
29    pub callouts: Vec<usize>,
30}
31
32/// A note: text attached to the document or to a product, with an author.
33#[derive(Debug, Clone, PartialEq)]
34pub struct Note {
35    /// Who wrote it.
36    pub author: String,
37    /// The text.
38    pub text: String,
39    /// The product it is about, or `None` for the document itself.
40    pub product: Option<crate::structure::ProductId>,
41}