marker_update Subroutine

private subroutine marker_update(self, t)

Write the start, end and new intermediate markers if the trajectory changed, and draw them all or, in trace mode, those passed at time t.

Type Bound

MarkerArtist

Arguments

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

the current time


Calls

proc~~marker_update~~CallsGraph proc~marker_update MarkerArtist%marker_update num_colors num_colors proc~marker_update->num_colors proc~add_intermediates add_intermediates proc~marker_update->proc~add_intermediates proc~data_changed data_changed proc~marker_update->proc~data_changed proc~draw LineChain%draw proc~marker_update->proc~draw proc~draw_range LineChain%draw_range proc~marker_update->proc~draw_range proc~end_rgba end_rgba proc~marker_update->proc~end_rgba proc~is_colored LineChain%is_colored proc~marker_update->proc~is_colored proc~marker_point marker_point proc~marker_update->proc~marker_point proc~marker_uses_colors marker_uses_colors proc~marker_update->proc~marker_uses_colors proc~markers_passed markers_passed proc~marker_update->proc~markers_passed proc~rebuild_markers rebuild_markers proc~marker_update->proc~rebuild_markers proc~reset_markers reset_markers proc~marker_update->proc~reset_markers proc~source_points source_points proc~marker_update->proc~source_points proc~update_bounds update_bounds proc~marker_update->proc~update_bounds proc~write_marker write_marker proc~marker_update->proc~write_marker proc~add_intermediates->proc~is_colored proc~intermediates_by_data intermediates_by_data proc~add_intermediates->proc~intermediates_by_data proc~intermediates_by_distance intermediates_by_distance proc~add_intermediates->proc~intermediates_by_distance proc~intermediates_by_time intermediates_by_time proc~add_intermediates->proc~intermediates_by_time proc~write_intermediates write_intermediates proc~add_intermediates->proc~write_intermediates proc~generation Trajectory%generation proc~data_changed->proc~generation proc~motion_changed motion_changed proc~data_changed->proc~motion_changed proc~revision~2 Trajectory%revision proc~data_changed->proc~revision~2 proc~draw->proc~draw_range interface~vkf_line_set_range vkf_line_set_range proc~draw_range->interface~vkf_line_set_range proc~check_status check_status proc~draw_range->proc~check_status proc~end_rgba->proc~is_colored proc~point_rgba_or point_rgba_or proc~end_rgba->proc~point_rgba_or num_times num_times proc~marker_point->num_times proc~art_point art_point proc~marker_point->proc~art_point proc~to_shown_at to_shown_at proc~marker_point->proc~to_shown_at proc~marker_uses_colors->num_colors proc~markers_passed->num_times proc~decreasing_times decreasing_times proc~markers_passed->proc~decreasing_times proc~build_marker_nodes build_marker_nodes proc~rebuild_markers->proc~build_marker_nodes proc~detach LineChain%detach proc~rebuild_markers->proc~detach proc~num_points Trajectory%num_points proc~source_points->proc~num_points proc~verify_data Trajectory%verify_data proc~source_points->proc~verify_data proc~art_points art_points proc~update_bounds->proc~art_points proc~marker_style marker_style proc~update_bounds->proc~marker_style proc~color_slice LineChain%color_slice proc~write_marker->proc~color_slice proc~num_chunks~2 LineChain%num_chunks proc~write_marker->proc~num_chunks~2 proc~slice LineChain%slice proc~write_marker->proc~slice proc~split_points split_points proc~write_marker->proc~split_points proc~written LineChain%written proc~write_marker->proc~written proc~art_point->proc~to_shown_at proc~point~2 Trajectory%point proc~art_point->proc~point~2 proc~art_points->proc~to_shown_at proc~points Trajectory%points proc~art_points->proc~points proc~build_marker_nodes->proc~marker_uses_colors proc~build_marker_nodes->proc~marker_style proc~init LineChain%init proc~build_marker_nodes->proc~init proc~redraw_markers redraw_markers proc~build_marker_nodes->proc~redraw_markers proc~reserve LineChain%reserve proc~build_marker_nodes->proc~reserve proc~set_compile LineChain%set_compile proc~build_marker_nodes->proc~set_compile interface~vkf_line_colors vkf_line_colors proc~color_slice->interface~vkf_line_colors proc~detach->proc~check_status interface~vkf_node_remove_child vkf_node_remove_child proc~detach->interface~vkf_node_remove_child proc~release~2 LineChain%release proc~detach->proc~release~2 proc~intermediates_by_data->proc~art_point proc~counted counted proc~intermediates_by_data->proc~counted proc~push_intermediate push_intermediate proc~intermediates_by_data->proc~push_intermediate proc~intermediates_by_distance->proc~art_point proc~intermediates_by_distance->proc~counted proc~intermediates_by_distance->proc~push_intermediate proc~art_point_between art_point_between proc~intermediates_by_time->proc~art_point_between proc~intermediates_by_time->proc~counted proc~intermediates_by_time->proc~push_intermediate time_index time_index proc~intermediates_by_time->time_index proc~marker_style->proc~is_colored proc~set_marker_style LineChain%set_marker_style proc~marker_style->proc~set_marker_style proc~motion_key ReferenceFrame%motion_key proc~motion_changed->proc~motion_key proc~same_pointer same_pointer proc~motion_changed->proc~same_pointer proc~transformed transformed proc~motion_changed->proc~transformed proc~color~3 Trajectory%color proc~point_rgba_or->proc~color~3 proc~num_colors Trajectory%num_colors proc~point_rgba_or->proc~num_colors proc~line_buffer line_buffer proc~slice->proc~line_buffer proc~to_shown to_shown proc~to_shown_at->proc~to_shown proc~to_shown_at->proc~transformed proc~write_intermediates->proc~color_slice proc~write_intermediates->proc~num_chunks~2 proc~write_intermediates->proc~slice proc~write_intermediates->proc~split_points proc~write_intermediates->proc~written proc~write_intermediates->proc~reserve proc~written->proc~check_status interface~vkf_line_points_changed vkf_line_points_changed proc~written->interface~vkf_line_points_changed proc~measure measure proc~written->proc~measure proc~update_lod update_lod proc~written->proc~update_lod proc~art_point_between->proc~to_shown proc~art_point_between->proc~transformed proc~point_between Trajectory%point_between proc~art_point_between->proc~point_between interface~vkf_line_points vkf_line_points proc~line_buffer->interface~vkf_line_points proc~measure->proc~line_buffer proc~split_distances split_distances proc~measure->proc~split_distances proc~motion_key->proc~motion_key proc~data_revision TrajectoryFollower%data_revision proc~motion_key->proc~data_revision proc~motion_stamp TrajectoryFollower%motion_stamp proc~motion_key->proc~motion_stamp proc~push_intermediate->proc~is_colored proc~color_at color_at proc~push_intermediate->proc~color_at interface~vkf_node_delete vkf_node_delete proc~release~2->interface~vkf_node_delete proc~reserve->proc~check_status interface~vkf_compile_node vkf_compile_node proc~reserve->interface~vkf_compile_node interface~vkf_line_create vkf_line_create proc~reserve->interface~vkf_line_create interface~vkf_line_create_colored vkf_line_create_colored proc~reserve->interface~vkf_line_create_colored interface~vkf_marker_create vkf_marker_create proc~reserve->interface~vkf_marker_create interface~vkf_node_add_child vkf_node_add_child proc~reserve->interface~vkf_node_add_child interface~vkf_ribbon_create vkf_ribbon_create proc~reserve->interface~vkf_ribbon_create proc~apply_style apply_style proc~reserve->proc~apply_style proc~line_set_segments line_set_segments proc~reserve->proc~line_set_segments proc~move_chunks move_chunks proc~reserve->proc~move_chunks proc~set_marker_style->proc~apply_style proc~data_to_shown data_to_shown proc~to_shown->proc~data_to_shown proc~moves moves proc~to_shown->proc~moves proc~update_lod->proc~line_buffer proc~segment_distance segment_distance proc~update_lod->proc~segment_distance proc~send_lod send_lod proc~update_lod->proc~send_lod proc~apply_style->proc~check_status interface~vkf_line_set_dash_mode vkf_line_set_dash_mode proc~apply_style->interface~vkf_line_set_dash_mode interface~vkf_line_set_highlight vkf_line_set_highlight proc~apply_style->interface~vkf_line_set_highlight interface~vkf_line_set_trail vkf_line_set_trail proc~apply_style->interface~vkf_line_set_trail proc~line_set_pattern line_set_pattern proc~apply_style->proc~line_set_pattern proc~line_set_style line_set_style proc~apply_style->proc~line_set_style proc~marker_set_style marker_set_style proc~apply_style->proc~marker_set_style proc~color_at->num_times proc~color_at->proc~point_rgba_or proc~color_at->time_index proc~data_revision->proc~generation proc~data_revision->proc~revision~2 proc~rigid_inverse rigid_inverse proc~data_to_shown->proc~rigid_inverse proc~world_matrix_at ReferenceFrame%world_matrix_at proc~data_to_shown->proc~world_matrix_at interface~vkf_line_style vkf_line_style proc~line_set_segments->interface~vkf_line_style interface~vkf_line_style_changed vkf_line_style_changed proc~line_set_segments->interface~vkf_line_style_changed proc~moves->proc~moves proc~is_following ReferenceFrame%is_following proc~moves->proc~is_following proc~num_parents ReferenceFrame%num_parents proc~moves->proc~num_parents proc~parent ReferenceFrame%parent proc~moves->proc~parent proc~point_between->proc~num_points proc~point_between->proc~point~2 proc~time_fraction Trajectory%time_fraction proc~point_between->proc~time_fraction proc~send_lod->proc~check_status interface~vkf_line_set_lod vkf_line_set_lod proc~send_lod->interface~vkf_line_set_lod proc~lod_error~2 LineChain%lod_error proc~send_lod->proc~lod_error~2 proc~num_trajectories TrajectoryFollower%num_trajectories proc~is_following->proc~num_trajectories proc~line_set_pattern->interface~vkf_line_style proc~line_set_pattern->interface~vkf_line_style_changed proc~line_set_style->interface~vkf_line_style proc~line_set_style->interface~vkf_line_style_changed proc~marker_set_style->interface~vkf_line_style proc~marker_set_style->interface~vkf_line_style_changed proc~world_matrix_at->proc~world_matrix_at proc~local_matrix_at ReferenceFrame%local_matrix_at proc~world_matrix_at->proc~local_matrix_at proc~followed_pose followed_pose proc~local_matrix_at->proc~followed_pose proc~frame_matrix frame_matrix proc~local_matrix_at->proc~frame_matrix proc~followed_pose->proc~rigid_inverse proc~followed_pose->proc~world_matrix_at proc~quat_from_matrix quat_from_matrix proc~followed_pose->proc~quat_from_matrix proc~quat_multiply quat_multiply proc~followed_pose->proc~quat_multiply proc~quat_normalize quat_normalize proc~followed_pose->proc~quat_normalize proc~state_at TrajectoryFollower%state_at proc~followed_pose->proc~state_at proc~quat_to_matrix quat_to_matrix proc~frame_matrix->proc~quat_to_matrix proc~chosen_trajectory chosen_trajectory proc~state_at->proc~chosen_trajectory proc~data_valid TrajectoryFollower%data_valid proc~state_at->proc~data_valid proc~interpolate_attitude interpolate_attitude proc~state_at->proc~interpolate_attitude proc~interpolate_position interpolate_position proc~state_at->proc~interpolate_position proc~time_index Trajectory%time_index proc~state_at->proc~time_index proc~wrapped_time wrapped_time proc~state_at->proc~wrapped_time proc~time_distance Trajectory%time_distance proc~chosen_trajectory->proc~time_distance proc~data_valid->proc~verify_data proc~attitude~3 Trajectory%attitude proc~interpolate_attitude->proc~attitude~3 proc~num_attitudes Trajectory%num_attitudes proc~interpolate_attitude->proc~num_attitudes proc~quat_slerp quat_slerp proc~interpolate_attitude->proc~quat_slerp proc~interpolate_position->proc~num_points proc~interpolate_position->proc~point~2 proc~interpolate_position->proc~point_between proc~time_index->proc~time_distance proc~time_range~3 Trajectory%time_range proc~wrapped_time->proc~time_range~3

Source Code

    subroutine marker_update(self, t)
        class(MarkerArtist), intent(inout) :: self
        real(wp), intent(in) :: t                           !! the current time
        logical :: changed, redraw, zero, passed_start, passed_end
        integer :: n
        if (.not. c_associated(self%group)) return
        zero = all(self%sources_%src == SOURCE_ZERO) .or. .not. associated(self%traj)   ! (a marker at the origin)
        if (zero) then
            n = 1                                         ! a marker at the origin
        else
            n = source_points(self%traj, self%sources_)
        end if

        ! the trajectory's colors drawn or not (its first colors, or the setting,
        ! changed): the marker nodes made again, with or without colors
        if (marker_uses_colors(self) .neqv. self%inter%is_colored()) call rebuild_markers(self)
        changed = data_changed(self, redraw)
        if (.not. self%drawn) then
            changed = .true.
            redraw = .true.
            self%drawn = .true.
        end if
        if (changed) then
            if (self%inter%is_colored()) then                 ! (colors added or changed: all written again)
                if (self%traj%num_colors() /= self%n_colors_seen) redraw = .true.
                self%n_colors_seen = self%traj%num_colors()
            end if
            if (redraw .or. n < self%n_seen) call reset_markers(self)
            call update_bounds(self, n, zero)
            if (n >= 1) call write_marker(self%start_node, marker_point(self, 1, zero), &   ! (none: nothing drawn)
                                          end_rgba(self, 1, self%start_color))
            if (n > 1) call write_marker(self%end_node, marker_point(self, n, zero), end_rgba(self, n, self%end_color))
            if (iand(self%markers_, MARKER_INTERMEDIATE) /= 0 .and. .not. zero .and. n > 2) call add_intermediates(self, n)
        end if

        ! what is drawn: everything, or in trace mode the markers whose times
        ! have passed (the start and end markers at their points' times)
        passed_start = .true.
        passed_end = .true.
        if (self%trace .and. .not. zero .and. n >= 1) then
            passed_start = self%traj%time(1) <= t
            passed_end = self%traj%time(n) <= t
        end if
        self%start_shown = iand(self%markers_, MARKER_START) /= 0 .and. n >= 1 .and. passed_start
        call self%start_node%draw(merge(1, 0, self%start_shown))
        self%end_shown = iand(self%markers_, MARKER_END) /= 0 .and. n > 1 .and. passed_end
        call self%end_node%draw(merge(1, 0, self%end_shown))
        self%inter_first = 1
        self%n_inter_drawn = self%n_inter_written
        if (self%trace .and. self%n_inter_written > 0) call markers_passed(self, t, self%inter_first, self%n_inter_drawn)
        call self%inter%draw_range(self%inter_first, self%inter_first + self%n_inter_drawn - 1)
    end subroutine marker_update