Skip to main content

PartView

Struct PartView 

Source
pub struct PartView {
Show 13 fields pub model: String, pub vertices: Vec<ViewVertex>, pub edges: Vec<ViewEdge>, pub faces: Vec<ViewFace>, pub sketches: Vec<ViewSketch>, pub datum_target: String, pub datums: Vec<ViewDatum>, pub annotations: Vec<ViewAnnotation>, pub solids: Vec<String>, pub instances: Vec<ViewInstance>, pub extent: Extent, pub color: Option<String>, pub face_colors: BTreeMap<String, String>, /* private fields */
}
Expand description

A part as the viewport draws it, every element by name — and, serialized, what a viewer draws. Each crate draws its own targets into it; then PartView::finish measures it.

Fields§

§model: String

The target its vertices, edges and faces are of: what a viewer matches an element’s target with to light it.

§vertices: Vec<ViewVertex>§edges: Vec<ViewEdge>§faces: Vec<ViewFace>§sketches: Vec<ViewSketch>§datum_target: String

The target its datums are of.

§datums: Vec<ViewDatum>§annotations: Vec<ViewAnnotation>

What its steps draw on it besides its topology: cosmetic threads.

§solids: Vec<String>

The part’s solids, oldest first.

§instances: Vec<ViewInstance>

Every part placed in it, and in those, however deep. Not serialized: a viewer is sent them apart, as they change, by name.

§extent: Extent

Where the drawing is and how big: the center and diagonal, at least one, of the box around it — for an empty part, EMPTY_EXTENT around the origin. Datum planes and axes, which are endless, are drawn this big around the point of them nearest the center.

§color: Option<String>

The part’s colour, #rrggbb; none for the viewer’s own.

§face_colors: BTreeMap<String, String>

The colours of its faces drawn in one of their own, #rrggbb, by the face’s name: over Self::color, and under a colour its instance is drawn in (ViewInstance::color). Asked by name, so a name no face has now is simply never asked for, and drawing them reads nothing of the faces.

Implementations§

Source§

impl PartView

Source

pub fn color_of_face(&self, face: &ViewFace) -> Option<&String>

The colour of its own face has, if one was given: by its name, or by what else it answers to.

Source

pub fn blank(extent: Extent) -> Self

Nothing drawn, reaching as far as extent: what a viewer is sent while a step is edited on a sheet of its own, which it frames.

Source

pub fn new() -> Self

Nothing drawn yet, to be drawn into: as big as an empty part.

Source

pub fn add(&mut self, drawn: &PartView)

What drawn drew added: what one drawer drew of a part, into what the others drew of it (see crate::registry::Drawings). Drawers draw what is theirs alone, so nothing is drawn twice.

Source

pub fn finish(self) -> Self

Done drawing: measured.

Source

pub fn part_to_drag( &self, pointer: &Pointer, hidden: &[String], ) -> Option<(&ViewInstance, Scalar)>

The placed part a drag at pointer moves, and how far along the ray it is hit: the one whose face the ray enters first — or, for a part placed in one placed rigid, the innermost one around it whose pose is a state of the part drawn and not fixed: what moves it. A part fixed in a sub-assembly moves with the sub-assembly, so a drag of it moves that. None where every part around it is fixed: no drag moves it.

Source

pub fn pick_instance( &self, instance: &str, pointer: &Pointer, hidden: &[String], ) -> Option<Scalar>

How far along pointer’s ray it first enters the placed part instance, if it does and is drawn.

Source

pub fn under( &self, pointer: &Pointer, accepts: &[String], hidden: &[String], ) -> Vec<ElementHit>

Every element drawn of a kind in accepts under the pointer, each once (see Scene::under). The first is the one meant at a glance. Frame datums are drawn on top of everything, so they come first. Otherwise a vertex or a sketch point, else an edge or a sketch curve, near the pointer — and not hidden behind a face — comes first: the smallest element under the pointer is the one meant. Else the nearest along the ray of the faces, sketches and other datums hit. Everything else under the pointer follows, front to back along the ray: the faces behind the first, and the vertices and edges they hide. The parts placed in the part count alike, each where it is (see PartView::layers): a vertex of one is hidden behind a face of another. What the viewer does not draw — named in hidden, sorted, as crate::editor::SceneState::hidden names it — is not hit, and hides nothing behind it: a pick is made in what is seen.

Source

pub fn pick( &self, pointer: &Pointer, accepts: &[String], hidden: &[String], ) -> Option<ElementHit>

What a click with pointer picks of a kind in accepts: of what lies PartView::under it, the one its Pointer::cycle names.

Trait Implementations§

Source§

impl Clone for PartView

Source§

fn clone(&self) -> PartView

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PartView

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PartView

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Scene for PartView

A part as drawn, all of it shown.

Source§

fn under(&self, pointer: &Pointer, accepts: &[String]) -> Vec<ElementHit>

Every element of the kinds accepts under pointer, each once: the one a click picks first — the smallest, in front, nearest the eye (see crate::view::PartView::under) — then the rest front to back along the ray, those hidden behind the first included. Its Pointer::cycle is not looked at.
Source§

fn hit_instance(&self, name: &str, pointer: &Pointer) -> Option<Scalar>

How far along pointer’s ray the placed part name is hit, if it is (see Shape::Instance).
Source§

fn pick(&self, pointer: &Pointer, accepts: &[String]) -> Option<ElementHit>

What a click with pointer picks: of what lies Scene::under it, the one its Pointer::cycle names, and where it is hit.
Source§

impl Serialize for PartView

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.