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: StringThe 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: StringThe 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: ExtentWhere 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
impl PartView
Sourcepub fn color_of_face(&self, face: &ViewFace) -> Option<&String>
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.
Sourcepub fn blank(extent: Extent) -> Self
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.
Sourcepub fn add(&mut self, drawn: &PartView)
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.
Sourcepub fn part_to_drag(
&self,
pointer: &Pointer,
hidden: &[String],
) -> Option<(&ViewInstance, Scalar)>
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.
Sourcepub fn pick_instance(
&self,
instance: &str,
pointer: &Pointer,
hidden: &[String],
) -> Option<Scalar>
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.
Sourcepub fn under(
&self,
pointer: &Pointer,
accepts: &[String],
hidden: &[String],
) -> Vec<ElementHit>
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.
Sourcepub fn pick(
&self,
pointer: &Pointer,
accepts: &[String],
hidden: &[String],
) -> Option<ElementHit>
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 Scene for PartView
A part as drawn, all of it shown.
impl Scene for PartView
A part as drawn, all of it shown.
Source§fn under(&self, pointer: &Pointer, accepts: &[String]) -> Vec<ElementHit>
fn under(&self, pointer: &Pointer, accepts: &[String]) -> Vec<ElementHit>
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 pick(&self, pointer: &Pointer, accepts: &[String]) -> Option<ElementHit>
fn pick(&self, pointer: &Pointer, accepts: &[String]) -> Option<ElementHit>
pointer picks: of what lies Scene::under
it, the one its Pointer::cycle names, and where it is hit.