HoloMap.Control.Terrain (HoloMap v0.1.0)

Copy Markdown View Source

A button that lets the user turn 3D terrain on and off.

<HoloMap.Source.RasterDEM id="dem" url={@dem_url} encoding="terrarium" />
<HoloMap.Control.Terrain source="dem" exaggeration={1.5} />

Props

PropTypeNotes
positionstringCorner to place the control in. Default "top-right"
sourcestringRequired. The id of a HoloMap.Source.RasterDEM
exaggerationnumberVertical multiplier applied when the user turns terrain on

This is not HoloMap.Terrain

The two look similar and mean opposite things.

HoloMap.Terrain is a declaration: while the component is rendered, terrain is on. Your application decides.

HoloMap.Control.Terrain is a button: it hands the decision to the user, and the map starts flat.

Rendering both puts them in conflict. The declaration wins whenever it is re-applied, so a user who switches terrain off with the button will see it come back the next time the HoloMap.Terrain component's props change. Pick one. If you want a toggle and control over the initial state, use HoloMap.Terrain behind a conditional and drive it from your own state:

{%if @terrain_on}
  <HoloMap.Terrain source="dem" exaggeration={1.5} />
{/if}

Getting anything to show

Terrain does nothing at zero pitch. Give the map a pitch, raise max_pitch, and add HoloMap.Control.Navigation with visualize_pitch so the user can tilt back and forth. Otherwise the button appears to do nothing at all.

Summary

Functions

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Returns the list of property definitions for the compiled component.

Functions

__is_hologram_component__()

@spec __is_hologram_component__() :: boolean()

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Examples

iex> __is_hologram_component__()
true

__props__()

@spec __props__() :: [{atom(), atom(), keyword()}]

Returns the list of property definitions for the compiled component.