Rocky's tiling profile ('': Rocky's default, the Earth).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TerrainBody), | intent(in) | :: | self |
function new_terrain_body(name, profile, units_per_meter, color) result(b) character(len=*), intent(in) :: name !! the frame's name character(len=*), intent(in), optional :: profile !! Rocky's tiling profile (default '') real(wp), intent(in), optional :: units_per_meter !! scene units per meter (default 1e-3) real(wp), intent(in), optional :: color(:) !! [r, g, b] or [r, g, b, a] (0 to 1) type(TerrainBody) :: b b%ReferenceFrame = ReferenceFrame(name, color) b%profile_ = '' if (present(profile)) b%profile_ = profile if (present(units_per_meter)) b%units_per_meter_ = units_per_meter allocate(b%layers(4)) end function new_terrain_body !> Add an image layer: `uri` (a URL, URL template or file) of a `source` !> kind (LAYER_*; default LAYER_TMS). Layers added later are drawn on top. subroutine add_image_layer(self, uri, source) class(TerrainBody), intent(inout) :: self character(len=*), intent(in) :: uri !! a URL, URL template or file integer, intent(in), optional :: source !! a LAYER_* constant (default LAYER_TMS) type(MapLayer) :: layer layer%uri = uri if (present(source)) layer%source = source call add_layer(self, layer) end subroutine add_image_layer !> Add an elevation layer: `uri` of a `source` kind (LAYER_*; default !> LAYER_TMS), heights in meters or `encoding` (ELEVATION_*; default !> ELEVATION_HEIGHTS). subroutine add_elevation_layer(self, uri, source, encoding) class(TerrainBody), intent(inout) :: self character(len=*), intent(in) :: uri !! a URL, URL template or file integer, intent(in), optional :: source !! a LAYER_* constant (default LAYER_TMS) integer, intent(in), optional :: encoding !! an ELEVATION_* constant (default ELEVATION_HEIGHTS) type(MapLayer) :: layer layer%elevation = .true. layer%uri = uri if (present(source)) layer%source = source if (present(encoding)) layer%encoding = encoding call add_layer(self, layer) end subroutine add_elevation_layer !> Keep `layer`, and add it to the map if it is made. subroutine add_layer(self, layer) type(TerrainBody), intent(inout) :: self type(MapLayer), intent(in) :: layer !! the layer as given type(MapLayer), allocatable :: tmp(:) if (.not. allocated(self%layers)) allocate(self%layers(4)) if (self%n_layers == size(self%layers)) then allocate(tmp(2 * self%n_layers)) tmp(1:self%n_layers) = self%layers(1:self%n_layers) call move_alloc(tmp, self%layers) end if self%n_layers = self%n_layers + 1 self%layers(self%n_layers) = layer if (c_associated(self%map)) call apply_layer(self, layer) end subroutine add_layer !> Number of layers (image and elevation). pure integer function num_layers(self) class(TerrainBody), intent(in) :: self num_layers = self%n_layers end function num_layers !> Light the body with the scene's lights (default), or show its imagery as it is. subroutine set_lighting(self, lit) class(TerrainBody), intent(inout) :: self logical, intent(in) :: lit !! true: lit by the scene's lights; false: imagery as it is self%lighting_ = lit call apply_settings(self) end subroutine set_lighting !> True if the body is lit by the scene's lights. pure logical function lighting(self) class(TerrainBody), intent(in) :: self lighting = self%lighting_ end function lighting !> Rocky's tiling profile ('': Rocky's default, the Earth). function profile(self) result(p) class(TerrainBody), intent(in) :: self character(len=:), allocatable :: p p = self%profile_ end function profile