Constructor
new ElevationLayer(properties)
Base constructor for elevation layers.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
properties | Object | Properties
|
- Source
Extends
Methods
_simpleMeshFromElevation(bounds, width, height, extendedElevation, geometry, skirtGeometry) → {Promise(THREE.Vector3)}
A default mesh generation function given some elevation.
Parameters:
Name | Type | Description |
---|---|---|
bounds | THREE. | |
width | Number | |
height | Number | |
extendedElevation | Array.<Number> | elevation array extended by 1 in all directions (for correct normals on the edges) |
geometry | THREE. | |
skirtGeometry | THREE. |
- Source
Returns:
the shift to apply to the tile (for numerical stability)
- Type:
- Promise(THREE.
Vector3)
_simpleMeshFromElevationAsync(bounds, width, height, extendedElevation, geometry, skirtGeometry) → {Promise(THREE.Vector3)}
A default mesh generation function given some elevation using web workers.
Parameters:
Name | Type | Description |
---|---|---|
bounds | THREE. | |
width | Number | |
height | Number | |
extendedElevation | Array.<Number> | elevation array extended by 1 in all directions (for correct normals on the edges) |
geometry | THREE. | |
skirtGeometry | THREE. |
- Source
Returns:
the shift to apply to the tile (for numerical stability)
- Type:
- Promise(THREE.
Vector3)
_trimEdges(arr, width, height)
Trims the edges of an elevation array by 1 on all sides
Parameters:
Name | Type | Description |
---|---|---|
arr | * | elevation array width+2 height+2 |
width | * | the desired width |
height | * | the desired height |
- Source
Returns:
the trimmed array
addListener(key, listener)
Adds a listener for layer events
Parameters:
Name | Type | Description |
---|---|---|
key | * | can be anything but should be unique |
listener | function | a function : (layer, eventType)=>{} |
- Overrides
- Source
dispose()
disposes of any resources used by this layer
- Overrides
- Source
getBounds() → {THREE.Box2}
- Overrides
- Source
Returns:
bounds in longitude latitude (degrees)
- Type:
- THREE.
Box2
getCenter(sfct) → {THREE.Vector3}
Moves a given point to this layer's center in degree longitude/latitude
Parameters:
Name | Type | Description |
---|---|---|
sfct | THREE. | a point to move |
- Overrides
- Source
Returns:
the input point
- Type:
- THREE.
Vector3
getElevation(bounds, width, height, geometry, skirtGeometry) → {Promise}
Returns a 2D elevation array and populates a tile's geometry and skirtGeometry. The generated geometry does not have to match the elevation array exactly. It can represent overhanging features for example but the elevation array is expected to correspond at least roughly to the geometry's highest points.
Parameters:
Name | Type | Description |
---|---|---|
bounds | THREE. | |
width | Number | width resolution for the elevation |
height | Number | height resolution for the elevation |
geometry | THREE. | a tile's buffer geometry to be filled with actual geometry |
skirtGeometry | THREE. | a skirt geometry to be filled with actual skirts |
- Source
Returns:
a promise for an elevation array
- Type:
- Promise
getID()
- Overrides
- Source
Returns:
layer id
getName()
- Overrides
- Source
Returns:
layer name
getSelectableObjects()
Get all the selectable objects of this layer.
- Overrides
- Source
Returns:
an array of ray-castable objects with a property "layer" pointing to this layer.
removeListener(key)
Removes the listener associated to the given key
Parameters:
Name | Type | Description |
---|---|---|
key | * | can be anything but should be unique |
- Overrides
- Source
select(objectsToSelect) → {Boolean}
selects an object from this layer
Parameters:
Name | Type | Description |
---|---|---|
objectsToSelect | Object |
- Overrides
- Source
Returns:
true if the object was selected, false otherwise
- Type:
- Boolean
setName(name)
change the layer name
Parameters:
Name | Type | Description |
---|---|---|
name | String |
- Overrides
- Source
setVisible(visible)
Modifies the layer visibility
Parameters:
Name | Type | Description |
---|---|---|
visible | Boolean |
- Overrides
- Source
unselect(objectsToUnselect) → {Boolean}
un-selects an object from this layer
Parameters:
Name | Type | Description |
---|---|---|
objectsToUnselect | Object |
- Overrides
- Source
Returns:
true if the object was un-selected, false otherwise
- Type:
- Boolean