ChainArtist Derived Type

type, private, abstract, extends(TrajectoryArtist) :: ChainArtist

The base of the artists drawing a trajectory's points through one chain of buffers (CurveArtist: a line, a chain point per trajectory point; RibbonArtist: a surface, a pair of chain points per trajectory point): the chain and how much of it is written and drawn, the trace tail, the trajectory's colors, and the update (chain_update: the points written as they change, then drawn all or, in trace mode, those passed and the tail to the point at the current time). Each extension says what its chain is (chain_kind), how many points it draws (points), its tail's node (new_tail), its style (apply_style), how its points are written (write_points) and its tail drawn (draw_tail).


Inherits

type~~chainartist~~InheritsGraph type~chainartist ChainArtist c_ptr c_ptr type~chainartist->c_ptr group, tail type~linechain LineChain type~chainartist->type~linechain chain type~trajectoryartist TrajectoryArtist type~chainartist->type~trajectoryartist type~linechain->c_ptr group, image type~linechunk LineChunk type~linechain->type~linechunk chunks type~referenceframe ReferenceFrame type~trajectoryartist->type~referenceframe shown_in, data_frame, seen_data_frame type~trajectory Trajectory type~trajectoryartist->type~trajectory traj type~linechunk->c_ptr line type~lodlevel LodLevel type~linechunk->type~lodlevel lod type~referenceframe->c_ptr light_node, light_switch, node_, contents_node, axis_node, axis_label_node, axis_arrow, axis_text, name_label_node, name_text type~referenceframe->type~referenceframe follow_frame_ type~framepointer FramePointer type~referenceframe->type~framepointer children, parents type~trajectoryfollower TrajectoryFollower type~referenceframe->type~trajectoryfollower follower_ type~framepointer->type~referenceframe p type~datasource DataSource type~trajectoryfollower->type~datasource sources_ type~trajectorypointer TrajectoryPointer type~trajectoryfollower->type~trajectorypointer trajs type~trajectorypointer->type~trajectory p

Inherited by

type~~chainartist~~InheritedByGraph type~chainartist ChainArtist type~curveartist CurveArtist type~curveartist->type~chainartist type~ribbonartist RibbonArtist type~ribbonartist->type~chainartist

Components

Type Visibility Attributes Name Initial
type(LineChain), private :: chain

the buffers

logical, private :: compile = .false.

(chunks made later are compiled)

integer, private :: first_drawn_ = 1

the first of them (trace mode, decreasing times: later)

type(c_ptr), private :: group = c_null_ptr

the chain's group (to make it again, colored or not)

integer, private :: n_colored = 0

points written with the trajectory's own colors

integer, private :: n_drawn = 0

trajectory points drawn from it

integer, private :: n_written = 0

trajectory points written to the chain

logical, private :: point_colors_ = .true.

the trajectory's colors, if any (see set_point_colors)

type(c_ptr), private :: tail = c_null_ptr

to the point at the current time (trace mode)

logical, private :: tail_shown = .false.

the tail is drawn

real(kind=wp), private :: tail_time = huge(1.0_wp)

the time the tail was drawn for


Type-Bound Procedures

procedure(apply_style_interface), public, deferred :: apply_style

  • subroutine apply_style_interface(self) Prototype

    The style (the artist's color, width, ...) given to the chain and the tail.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self

procedure, public :: build => chain_build

  • private subroutine chain_build(self, viewer, group)

    Create the chain of buffers (sized for the points now) and the trace tail under group.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    type(c_ptr), intent(in) :: viewer

    compiles what is made later (null: nothing to)

    type(c_ptr), intent(in) :: group

    the artist's group

procedure(chain_kind_interface), public, deferred :: chain_kind

  • pure function chain_kind_interface(self) Prototype

    The kind of chain (LineChain's CHAIN_STRIP or CHAIN_RIBBON).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value integer

procedure(draw_tail_interface), public, deferred :: draw_tail

  • subroutine draw_tail_interface(self, t, k, k2) Prototype

    The trace tail: from point k (the latest passed) to the point interpolated at time t toward point k2 (the next in time); none if either isn't a point written.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    real(kind=wp), intent(in) :: t

    the current time

    integer, intent(in) :: k

    the tail's ends (0: none)

    integer, intent(in) :: k2

    the tail's ends (0: none)

procedure, public :: first_drawn

  • private pure function first_drawn(self)

    The first point drawn (1, or in trace mode of decreasing times the earliest point passed): points first_drawn .. first_drawn + num_drawn - 1.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value integer

procedure, public :: get_trajectory

  • private function get_trajectory(self) result(traj)

    The trajectory drawn (null if none).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(in) :: self

    Return Value type(Trajectory), pointer

procedure, public :: init_chain => chain_init

  • private subroutine chain_init(self)

    The chain, colored if the trajectory's colors are drawn.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self

procedure(new_tail_interface), public, deferred :: new_tail

  • function new_tail_interface(self) result(node) Prototype

    The trace tail's node (null on failure), made with the chain.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value type(c_ptr)

procedure, public :: num_chunks

  • private pure function num_chunks(self)

    Number of buffers the artist is drawn with (0 until built).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value integer

procedure, public :: num_drawn

  • private pure function num_drawn(self)

    Number of trajectory points drawn now (all of them, or in trace mode those passed).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value integer

procedure, public :: pickable => artist_pickable

  • private pure function artist_pickable(self)

    Whether pick tests what this artist draws.

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(in) :: self

    Return Value logical

procedure, public :: point_colors

  • private pure function point_colors(self)

    Whether a trajectory's colors are drawn.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value logical

procedure(chain_points_interface), public, deferred :: points

  • function chain_points_interface(self) result(n) Prototype

    The number of trajectory points to draw (0 if none).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(in) :: self

    Return Value integer

procedure, public :: release => chain_release

  • private subroutine chain_release(self)

    Forget the render nodes: the chain and the tail (see artist_release).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self

procedure, public :: set_pickable => artist_set_pickable

  • private subroutine artist_set_pickable(self, pickable)

    Whether pick tests what this artist draws (default true; e.g. false for a spacecraft's marker beside its orbit's curve).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(inout) :: self
    logical, intent(in) :: pickable

    true: picked (default)

procedure, public :: set_point_colors

  • private subroutine set_point_colors(self, enabled)

    Whether a trajectory with colors is drawn in them (default true); points without a color yet (colors arriving after positions) in the artist's color. A curve: each segment blended from its first point's color to its second's (with level of detail, a color lasting fewer points than are skipped may not show from far away); a surface: each point's pair in its color, times the artist's alpha. False: all in the artist's color.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    logical, intent(in) :: enabled

    true: the trajectory's colors

procedure, public :: set_trace_mode

  • private subroutine set_trace_mode(self, enabled)

    Draw only the part up to the current time (see the module documentation).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(inout) :: self
    logical, intent(in) :: enabled

    true: draw only up to the current time

procedure, public :: set_trajectory

  • private subroutine set_trajectory(self, traj)

    Draw traj (it must stay alive while drawn).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(inout) :: self
    type(Trajectory), intent(in), target :: traj

    the trajectory to draw (not owned)

procedure, public :: trace_mode

  • private pure function trace_mode(self)

    Whether only the part up to the current time is drawn.

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(in) :: self

    Return Value logical

procedure, public :: update => chain_update

  • private subroutine chain_update(self, t)

    Write the points added (all of them on a redraw), and draw them all or, in trace mode, those passed and the tail to the point at time t.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    real(kind=wp), intent(in) :: t

    the current time

procedure(write_points_interface), public, deferred :: write_points

  • subroutine write_points_interface(self, i1, i2) Prototype

    Write trajectory points i1 .. i2 into the chain (and upload the chunks written to).

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    integer, intent(in) :: i1

    the trajectory points

    integer, intent(in) :: i2

    the trajectory points

Source Code

    type, abstract, extends(TrajectoryArtist) :: ChainArtist
        private
        logical :: point_colors_ = .true.           !! the trajectory's colors, if any (see set_point_colors)
        ! rendering
        type(c_ptr) :: group = c_null_ptr           !! the chain's group (to make it again, colored or not)
        logical :: compile = .false.                !! (chunks made later are compiled)
        type(LineChain) :: chain                    !! the buffers
        type(c_ptr) :: tail = c_null_ptr            !! to the point at the current time (trace mode)
        integer :: n_written = 0                    !! trajectory points written to the chain
        integer :: n_drawn = 0                      !! trajectory points drawn from it
        integer :: first_drawn_ = 1                 !! the first of them (trace mode, decreasing times: later)
        integer :: n_colored = 0                    !! points written with the trajectory's own colors
        logical :: tail_shown = .false.             !! the tail is drawn
        real(wp) :: tail_time = huge(1.0_wp)        !! the time the tail was drawn for
    contains
        procedure :: set_point_colors, point_colors
        procedure :: num_chunks, num_drawn, first_drawn
        procedure :: build => chain_build
        procedure :: update => chain_update
        procedure :: release => chain_release
        procedure :: init_chain => chain_init
        procedure(chain_kind_interface), deferred :: chain_kind
        procedure(chain_points_interface), deferred :: points
        procedure(new_tail_interface), deferred :: new_tail
        procedure(apply_style_interface), deferred :: apply_style
        procedure(write_points_interface), deferred :: write_points
        procedure(draw_tail_interface), deferred :: draw_tail
    end type ChainArtist