Draws a line segment at every stride-th point of a trajectory (OpenFrames' SegmentArtist), from the point given by the start data sources to the one given by the end data sources: e.g. radius vectors (the origin to the positions), or from the positions to points stored as an optional (a target). Default (an addition to OpenFrames, which draws nothing until the sources are set): from the frame's origin to the trajectory's positions.
Relative ends (set_end_relative, not in OpenFrames): the end sources give an offset from the start, so a vector stored per point (a thrust, a velocity) is drawn from each position, at a length set by the end sources' scale (set_end_scale), which can be changed without touching the trajectory (only this artist's segments are written again). Where the vector is zero (no thrust) nothing is drawn.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(LineChain), | private | :: | chain |
the line buffers (a pair of points per segment) |
|||
| real(kind=wp), | private | :: | color_(4) | = | [1.0_wp, 1.0_wp, 1.0_wp, 1.0_wp] |
segment color [r, g, b, a] (default white) |
|
| logical, | private | :: | default_data | = | .true. |
sources not set: the origin to the positions, per the DOF |
|
| type(DataSource), | private | :: | end_(3) |
start and end points' x, y, z data sources |
|||
| logical, | private | :: | end_relative_ | = | .false. |
the end sources: an offset from the start |
|
| integer, | private | :: | first_drawn_ | = | 1 |
the first of them (trace mode, decreasing times: later) |
|
| type(HighlightStyle), | private | :: | highlight_ |
(see set_highlight) |
|||
| integer, | private | :: | n_drawn | = | 0 |
segments drawn from it |
|
| integer, | private | :: | n_written | = | 0 |
segments written to the chain |
|
| integer, | private | :: | pattern_ | = | int(z'FFFF') |
16-bit dash pattern (z'FFFF': solid) |
|
| integer, | private | :: | pattern_factor | = | 1 |
window units per pattern bit (>= 1) |
|
| type(DataSource), | private | :: | start_(3) |
start and end points' x, y, z data sources |
|||
| integer, | private | :: | stride_ | = | 1 |
a segment at every stride_-th point (>= 1) |
|
| real(kind=wp), | private | :: | width_ | = | 1.0_wp |
segment width (window units) |
The SegmentArtist constructor: SegmentArtist(...) makes one (see new_segment_artist for its
arguments).
A segment artist for traj (optional), drawn in color color ([r, g,
b] or [r, g, b, a]; default white) and width (window units; default
1), at every stride-th point (default 1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Trajectory), | intent(in), | optional, | target | :: | traj |
the trajectory to draw (not owned) |
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1); width (window units, default 1) |
|
| real(kind=wp), | intent(in), | optional | :: | width |
[r, g, b] or [r, g, b, a] (0 to 1); width (window units, default 1) |
|
| integer, | intent(in), | optional | :: | stride |
a segment at every stride-th point (default 1) |
Create the chain of line buffers (sized for the segments now) under group.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(c_ptr), | intent(in) | :: | viewer |
compiles nodes made later (may be null); the parent group |
||
| type(c_ptr), | intent(in) | :: | group |
compiles nodes made later (may be null); the parent group |
The segments' color [r, g, b, a].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
The dash pattern's layout: DASH_SCENE or DASH_SCREEN.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
Segment s (at point 1 + (s-1) stride; first_drawn to first_drawn + num_drawn - 1 drawn) as written: read back from the line buffers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | s |
the segment (first_drawn to first_drawn + num_drawn - 1) |
||
| real(kind=wp), | intent(out) | :: | a(3) |
the segment's start (frame coordinates) |
||
| real(kind=wp), | intent(out) | :: | b(3) |
its end |
The x, y and z data sources of the segments' end points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
Whether the ends are relative (see set_end_relative).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
The first segment drawn (1, or in trace mode of decreasing times the earliest passed): segments first_drawn .. first_drawn + num_drawn - 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
The trajectory drawn (null if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryArtist), | intent(in) | :: | self |
The segments' highlight: HIGHLIGHT_* (added; HIGHLIGHT_NONE: not highlighted).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
Number of line buffers the segments are drawn with (0 until built).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
Number of segments drawn now (all of them, or in trace mode those at the points passed).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
The dash pattern: its factor and 16 pattern bits.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self | |||
| integer, | intent(out) | :: | factor |
window units per bit, 16 bits |
||
| integer, | intent(out) | :: | bits |
window units per bit, 16 bits |
Whether pick tests what this artist draws.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryArtist), | intent(in) | :: | self |
Forget the render nodes (see artist_release).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self |
The segments' color: [r, g, b] (alpha unchanged) or [r, g, b, a], 0 to 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
The dash pattern's layout (see set_dash_mode): screen-locked dashes start again at each segment's start, as GL_LINES; DASH_FIXED (strips only) is taken as DASH_SCENE.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | mode |
DASH_SCENE or DASH_SCREEN |
All three end sources at once (see set_start_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src(3) |
the end points' x, y, z data sources |
Relative ends (default false): each segment ends at its start plus the end sources' values (a vector drawn from each point), not at them.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | relative |
true: the ends are offsets from the starts |
Set the scale of all three end sources (with relative ends: the length drawn per unit of the stored vector, e.g. km per newton). Only this artist's segments are written again.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | scale |
the end sources' scale (e.g. km per newton) |
Where the x of the segments' end points come from (see set_start_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the end points' x data source |
Where the y of the segments' end points come from (see set_start_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the end points' y data source |
Where the z of the segments' end points come from (see set_start_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the end points' z data source |
Highlight the segments (see set_highlight): the arrows run along each segment from its start to its end.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | mode |
HIGHLIGHT_* (added) |
||
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
|
| real(kind=wp), | intent(in), | optional | :: | arrow_spacing |
between arrows (window units; default 40) |
|
| real(kind=wp), | intent(in), | optional | :: | arrow_speed |
(window units per second; default 50) |
|
| real(kind=wp), | intent(in), | optional | :: | band_width |
of the arrows' band (window units; default 12) |
|
| real(kind=wp), | intent(in), | optional | :: | pulse_period |
(s; default 1.5) |
A dash pattern (see set_pattern), starting again at the start of each segment.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | factor |
window units per bit (>= 1), 16 bits (z'FFFF': solid) |
||
| integer, | intent(in) | :: | pattern |
window units per bit (>= 1), 16 bits (z'FFFF': solid) |
Whether pick tests what this artist draws (default true; e.g. false for a spacecraft's marker beside its orbit's curve).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryArtist), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | pickable |
true: picked (default) |
All three start (end) sources at once, e.g. position_sources(3) or optional_sources(1). Returns whether the trajectory has their data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src(3) |
the start points' x, y, z data sources |
Where the x (y, z) of the segments' start (end) points come from. Returns whether the trajectory has the data of all sources.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the start points' x data source |
Where the y of the segments' start points come from (see set_start_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the start points' y data source |
Where the z of the segments' start points come from (see set_start_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
the start points' z data source |
Draw a segment at points 1, 1 + stride, 1 + 2 stride, ... (stride >= 1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | stride |
a segment at every stride-th point (>= 1) |
Draw only the part up to the current time (see the module documentation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryArtist), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | enabled |
true: draw only up to the current time |
Draw traj; with the default data sources, from the origin to its
positions (per its DOF).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| type(Trajectory), | intent(in), | target | :: | traj |
the trajectory to draw (not owned) |
The segments' width in window units (logical pixels).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | width |
window units |
The x, y and z data sources of the segments' start points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
The stride: a segment at every stride-th point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
Whether only the part up to the current time is drawn.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryArtist), | intent(in) | :: | self |
Write the segments added (all of them on a redraw), and draw them all or, in trace mode, those at the points passed at time t.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the current time |
The segments' width (window units).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(in) | :: | self |
type, extends(TrajectoryArtist), public :: SegmentArtist private type(DataSource) :: start_(3), end_(3) !! start and end points' x, y, z data sources logical :: default_data = .true. !! sources not set: the origin to the positions, per the DOF logical :: end_relative_ = .false. !! the end sources: an offset from the start integer :: stride_ = 1 !! a segment at every stride_-th point (>= 1) real(wp) :: color_(4) = [1.0_wp, 1.0_wp, 1.0_wp, 1.0_wp] !! segment color [r, g, b, a] (default white) real(wp) :: width_ = 1.0_wp !! segment width (window units) integer :: pattern_factor = 1 !! window units per pattern bit (>= 1) integer :: pattern_ = int(z'FFFF') !! 16-bit dash pattern (z'FFFF': solid) type(HighlightStyle) :: highlight_ !! (see set_highlight) ! rendering type(LineChain) :: chain !! the line buffers (a pair of points per segment) integer :: n_written = 0 !! segments written to the chain integer :: n_drawn = 0 !! segments drawn from it integer :: first_drawn_ = 1 !! the first of them (trace mode, decreasing times: later) contains procedure :: set_trajectory => segment_set_trajectory procedure :: set_start_x_data, set_start_y_data, set_start_z_data procedure :: set_end_x_data, set_end_y_data, set_end_z_data procedure :: set_start_data, set_end_data procedure :: start_data_sources, end_data_sources procedure :: set_end_relative, end_relative, set_end_scale procedure :: set_stride, stride procedure :: set_color => segment_set_color, color => segment_color procedure :: set_width => segment_set_width, width => segment_width procedure :: set_pattern => segment_set_pattern, pattern => segment_pattern procedure :: set_highlight => segment_set_highlight, highlight => segment_highlight procedure :: set_dash_mode => segment_set_dash_mode, dash_mode => segment_dash_mode procedure :: build => segment_build procedure :: update => segment_update procedure :: release => segment_release procedure :: num_chunks => segment_num_chunks, num_drawn => segment_num_drawn procedure :: first_drawn => segment_first_drawn procedure :: drawn_segment end type SegmentArtist