Add an artist (it must stay alive while added). Artists added after the frame is shown are built and compiled at the next update.
An orbit drawn as a line, with markers at its start and end:
orbit_line = CurveArtist(orbit, color=[1.0_wp, 0.8_wp, 0.2_wp], width=2.0_wp)
ends = MarkerArtist(orbit)
orbit_frame = DrawableTrajectory('Orbit')
call orbit_frame%add_artist(orbit_line)
call orbit_frame%add_artist(ends)
if (.not. earth%add_child(orbit_frame)) error stop 'add_child failed'
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(DrawableTrajectory), | intent(inout) | :: | self | |||
| class(TrajectoryArtist), | intent(in), | target | :: | a |
the artist to add (not owned) |
subroutine add_artist(self, a) class(DrawableTrajectory), intent(inout) :: self class(TrajectoryArtist), intent(in), target :: a !! the artist to add (not owned) type(ArtistPointer), allocatable :: tmp(:) integer :: k do k = 1, self%n_artists if (associated(self%artists(k)%p, a)) return end do if (.not. allocated(self%artists)) allocate(self%artists(4)) if (self%n_artists == size(self%artists)) then allocate(tmp(2 * self%n_artists)) tmp(1:self%n_artists) = self%artists(1:self%n_artists) call move_alloc(tmp, self%artists) end if self%n_artists = self%n_artists + 1 self%artists(self%n_artists)%p => a self%artists(self%n_artists)%group = c_null_ptr end subroutine add_artist