Skip to main content

Module layout

Module layout 

Source
Expand description

A catalogue and a view, laid out in numbers (ADR-0015).

layout decides, and that is all that can be wrong in the drawing: the window and the scales, the vertical exaggeration they result in (written on the drawing), the graduations, what is drawn and in which order, the fills, the wells’ colours and labels, the warnings. crate::svg only writes what is decided here - which is why tests/layout.rs asserts on numbers, and tests/svg.rs on the markup.

Nothing is read and no geometry of the model is computed: a layout is cheap, and the front end redraws on every change of the view.

§Draw order

envelopes (the grids’ fills, at the back) → fills (the surfaces’) → outlines (the grids’ tops, bottoms and faults) → traces → wells → marks (vertices, crossings) → labels. The layers are in Layout::layers in that order; the writer follows it.

§What View does here

  • hidden - absent: no group, no label, no fill, and no fill from it nor towards it (a hidden line is not a neighbour);
  • highlight - marked (LaidObject::highlighted), nothing else changes;
  • portion - a truncation: what falls in [start, end], bounds included, abscissas unchanged (a well at 150 m stays at 150 m); a trace is cut at the bounds, a well is kept whole when its head’s abscissa is inside;
  • window - the viewport. None: everything, with a margin.

§Axes

AxisMode::Projected is drawn. Coordinates is drawn too - the trace is in the scene’s system, so the true (x, y) at each tick is one fence::point_at away. Geodesic is not: it needs a scale factor along the trace from energyml-proj (and a reprojection when the scene’s system is not the one the factor is known in), and this crate has no dependency on it. The layout falls back to the projected distance and says so in a warning (Layout::x_axis’s mode is the one actually drawn); the shape to fill - a function from s to a geodesic distance, applied to the tick values - is Axis: ticks carry their value and their label separately for that reason.

Structs§

Axis
One axis: its title, the mode actually drawn, its ticks.
LaidInterval
One stratigraphic interval of a well, drawn.
LaidObject
A group of shapes.
Layer
A group of objects drawn together, in one z-order slot.
Layout
Everything the SVG writer needs, decided: positions in pixels, ticks, fills, labels, warnings.
Metadata
What the SVG’s <metadata> holds: enough to refuse by name and to redraw - the format, the version of this crate, the inputs (the trace itself, in coordinates and system) and the view.
Rect
A rectangle, pixels.
Tick
A graduation.

Enums§

Anchor
Where a text sits against its anchor.
Attr
What a group is about - one attribute each, so that data-key stays the one-per-object handle the front end reads.
Shape
A primitive, in pixels. Colours are strings, written as attributes.

Constants§

HATCH_ID
The id of the <pattern> the hatched style strokes with - prefixed, so that it cannot clash with an id of a drawing this one is pasted into.

Functions§

hatch_ref
What the stroke or fill of the hatched style is: the pattern’s reference.
layout
Lay a catalogue out for a view. Reads nothing, computes no geometry of the model - only where things go.
unstratified_spans
The portions of a well’s path (as MD intervals) that no interval covers, between its first and last MD. None: the well has no MD to lay intervals on, so the whole path is one portion. The one reading of “unstratified”: the drawing, the note counting lost wells and the legend all ask it.