Class OrthographicCamera

java.lang.Object
com.luciad.cameras.Camera
com.luciad.cameras.OrthographicCamera
All Implemented Interfaces:
AutoCloseable

public final class OrthographicCamera extends Camera implements AutoCloseable
A camera that uses an orthographic (or parallel) projection.

That the Camera API is a low-level API. For simple map navigation use cases, it's recommended to use the higher-level API. The MapNavigator API works in both 2D and 3D, on all map references. If you use the low-level Camera API, keep in mind that the same camera manipulation implementation might not work for other types of cameras (OrthographicCamera vs PerspectiveCamera) or other (types of) map references (projected vs. geocentric).

A camera transforms points from the map reference to the view (device independent pixel coordinates).

Orthographic Camera
Orthographic Camera

Cameras in LuciadCPillar are immutable. You can manipulate the map's camera by creating a modified copy using the builder. The new camera can then be set on the map.

Currently, the OrthographicCamera is only used in combination with projected (grid) references (aka 2D maps). For now, you cannot use this camera if the map has a geocentric (3D) reference.

For projected (grid) references, the camera should be positioned along the positive Z axis, facing the negative Z direction. This way, the camera is positioned facing the XY-plane, where the map is rendered in.

To manipulate an orthographic camera on a projected (grid) or cartesian reference, we recommend using look2D. This allows you to reason about the camera in 2D space, instead of a 3D space. It also allows you to easily rotate and zoom the camera around any arbitrary view / map point.

Map navigation constraints configured on MapNavigator are not enforced when this camera is updated on the map. Constraints are only respected when using MapNavigator.

// low-level manipulation of an orthographic camera: put the world's origin at pixel 200,200,
// and rotate the camera by 10 degrees (keeping the same scale)
var orthographicCamera = (OrthographicCamera) map.getCamera();
// Adjust a couple of parameters. scaleX and scaleY remain the same
Camera.Look2D cameraPosition = orthographicCamera.asLook2D();
Camera.Look2D newCameraPosition = new Camera.Look2D(
new Coordinate(0.0, 0.0),
new Coordinate(200.0, 200.0),
cameraPosition.getScaleX(), cameraPosition.getScaleY(),
new Azimuth((cameraPosition.getRotation().getDegrees() + 10.0))
);
Camera newCamera = orthographicCamera.asBuilder().look2D(newCameraPosition).build();
// ...
// Set the camera on the map, for example by using Map#getAnimationManager
map.setCamera(newCamera);
  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Camera
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class Camera
    • asBuilder Link icon

      @NotNull public OrthographicCamera.Builder asBuilder()
      Returns a Builder that can build cameras identical to this camera.
      Returns:
      a Builder that can build cameras identical to this camera.
    • asLook2D Link icon

      @NotNull public Camera.Look2D asLook2D()
      Returns a description of the camera location targeted towards a 2D top-down view of the map.
      Returns:
      a description of the camera location targeted towards a 2D top-down view of the map.