markers Function

private pure function markers(self)

Which markers are drawn (an ior of MARKER_* flags).

Type Bound

MarkerArtist

Arguments

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

Return Value integer


Source Code

    function new_marker_artist(traj, markers, size, color) result(a)
        type(Trajectory), intent(in), target, optional :: traj !! the trajectory to draw (not owned)
        integer, intent(in), optional :: markers            !! an ior of MARKER_* flags (default start and end)
        real(wp), intent(in), optional :: size, color(:)    !! window units (default 10); [r, g, b] or [r, g, b, a]
        type(MarkerArtist) :: a
        a%sources_ = position_sources(3)
        a%image_file = ''
        if (present(traj)) call a%set_trajectory(traj)
        if (present(markers)) a%markers_ = markers
        if (present(size)) a%size_ = size
        if (present(color)) call a%set_marker_color(ior(ior(MARKER_START, MARKER_INTERMEDIATE), MARKER_END), color)
    end function new_marker_artist

    !> Draw `traj`; with the default data sources, its positions (per its DOF).
    subroutine marker_set_trajectory(self, traj)
        class(MarkerArtist), intent(inout) :: self
        type(Trajectory), intent(in), target :: traj        !! the trajectory to draw (not owned)
        self%traj => traj
        if (self%default_data) self%sources_ = position_sources(traj%dof())
        self%seen_generation = -1
    end subroutine marker_set_trajectory

    !> Where the x (y, z) of the markers come from. Returns whether the
    !> trajectory has those data.
    logical function marker_set_x_data(self, src) result(valid)
        class(MarkerArtist), intent(inout) :: self
        type(DataSource), intent(in) :: src                 !! the x data source
        valid = set_marker_source(self, 1, src)
    end function marker_set_x_data

    !> Where the y of the markers come from (see set_x_data).
    logical function marker_set_y_data(self, src) result(valid)
        class(MarkerArtist), intent(inout) :: self
        type(DataSource), intent(in) :: src                 !! the y data source
        valid = set_marker_source(self, 2, src)
    end function marker_set_y_data

    !> Where the z of the markers come from (see set_x_data).
    logical function marker_set_z_data(self, src) result(valid)
        class(MarkerArtist), intent(inout) :: self
        type(DataSource), intent(in) :: src                 !! the z data source
        valid = set_marker_source(self, 3, src)
    end function marker_set_z_data

    !> Set data source k (1: x, 2: y, 3: z), redrawing the markers; returns whether
    !> the trajectory has the data.
    logical function set_marker_source(self, k, src) result(valid)
        class(MarkerArtist), intent(inout) :: self
        integer, intent(in) :: k                            !! the component (1: x, 2: y, 3: z)
        type(DataSource), intent(in) :: src                 !! its data source
        self%sources_(k) = src
        self%default_data = .false.
        call redraw_markers(self)
        valid = .true.
        if (associated(self%traj)) valid = self%traj%verify_data(self%sources_)
    end function set_marker_source

    !> The x, y and z data sources.
    pure function marker_data_sources(self) result(s)
        class(MarkerArtist), intent(in) :: self
        type(DataSource) :: s(3)
        s = self%sources_
    end function marker_data_sources

    !> Which markers to draw: an ior of MARKER_START, MARKER_INTERMEDIATE and
    !> MARKER_END (0 for none).
    subroutine set_markers(self, markers)
        class(MarkerArtist), intent(inout) :: self
        integer, intent(in) :: markers                      !! an ior of MARKER_* flags (0: none)
        if (markers == self%markers_) return
        self%markers_ = markers
        call redraw_markers(self)
    end subroutine set_markers

    !> Which markers are drawn (an ior of MARKER_* flags).
    pure integer function markers(self)
        class(MarkerArtist), intent(in) :: self
        markers = self%markers_
    end function markers