Camera

Use the Camera API methods to change the user's view of the rendered scene.

Methods

(static) focusOnBounds(bounds)

Animates the engine camera to focus on a region specified by a bounding box. The engine will calculate the correct view such that the bounds are fully displayed.
Example
var bounds = {
  sw: { latitude: 44.5, longitude: 6.3 },
  ne: { latitude: 44.4, longitude: 6.4 }
};
Procedural.focusOnBounds ( bounds );

// Optionally can also supply:
// - viewing angle,
// - a bearing,
// - animation duration (in seconds)
var bounds = {
  sw: { latitude: 44.5, longitude: 6.3 },
  ne: { latitude: 44.4, longitude: 6.4 },
  angle: 25, bearing: 180,
  animationDuration: 0.5
};
Procedural.focusOnBounds ( bounds );
Parameters:
Name Type Description
bounds Object An Object specifying a bounding box. Pass the coordinates for the south-west and north-east corners of the box.

(static) focusOnLocation(location)

Animates the engine camera to focus on a location
Example
var target = { latitude: 44.5, longitude: 6.3 };
Procedural.focusOnLocation ( target );

// Optionally can also supply:
// - viewing angle,
// - a bearing,
// - a distance,
// - animation duration (in seconds)
var target = {
  latitude: 44.5, longitude: 6.3,
  angle: 20, bearing: 30, distance: 1000
  animationDuration: 0.5
};
Procedural.focusOnLocation ( target );
Parameters:
Name Type Description
location Object An Object specifying a longitude and latitude

(static) onCameraChange()

Callback function for when the camera position changes. Note this method will fire very often, so you may want to throttle updates. Performing significant work every time this method fires will negatively impact performance
Example
Procedural.onCameraChange = function ( location ) {
  // `location` will contain:
  // - longitude
  // - latitude
  // - height
  // - angle
  // - bearing
  // - distance
  console.log( 'Location changed': location );
};

(static) orbitTarget()

Animates the engine camera around the current camera target

(static) setCameraMode(mode)

Selects the current camera mode for the engine
Example
Procedural.setCameraMode ( '2D' );
Parameters:
Name Type Description
mode String An String specifying the camera mode. Currently '2D' and '3D' are supported