Class ProjectedVideoModel
- All Implemented Interfaces:
Model,IProjectedImageryModel,AutoCloseable
IProjectedImageryModel for a single live pinhole video source, such as a drone or a fixed camera.
The model exposes one projection and serves its current frame. Push a new frame together with the camera pose and field of view it was captured at through updateFrame, on every video frame, from any thread. The model takes care of the tile serving, change notification and observer bookkeeping, so a live video source needs no custom IProjectedImageryModel implementation.
Unless an override is set through ProjectedVideoModel.Builder#bounds, the model's bounds follow the camera: they are recomputed on every pushed frame from where its field of view intersects the earth ellipsoid.
Display it by adding it to a ProjectedImageryLayer and selecting its projection: layer->setSelectedProjections({{model->.
getProjectionId(), 1.0f}})
All methods are safe to call from any thread.
- Since:
- 2026.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(IProjectedImageryModelObserver observer) Registers an observer that will be notified of changes to this model.voidclose()protected voidfinalize()Returns the meta data for this model.Returns the stable identifier of the single projection this model exposes.List<@NotNull ProjectedImagery> Returns the projections held by this model.static ProjectedVideoModel.BuilderCreates a new builder with the default values.Returns the bounds of this model, if available.queryTile(String projectionId, ProjectionTileCoordinate tile, CancellationToken cancellationToken) Queries a single tile of a single projection.voidremoveObserver(IProjectedImageryModelObserver observer) Unregisters a previously added observer.voidupdateFrame(Image frame, Point location, double yaw, double pitch, double roll, double fovX, double fovY) Pushes a new video frame together with the camera pose and field of view it was captured at.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
newBuilder
Creates a new builder with the default values.- Returns:
- the new builder.
-
getModelMetadata
Returns the meta data for this model.- Specified by:
getModelMetadatain interfaceModel- Returns:
- the meta data for this model.
-
queryBounds
Returns the bounds of this model, if available.When the bounds of this model are not known, or if they are too expensive to calculate, this method may return no bounds.
- Specified by:
queryBoundsin interfaceModel- Returns:
- the bounds of this model, if available.
-
getProjections
Returns the projections held by this model.- Specified by:
getProjectionsin interfaceIProjectedImageryModel- Returns:
- the projections.
-
queryTile
@NotNull public ProjectionTileQueryResult queryTile(@NotNull String projectionId, @NotNull ProjectionTileCoordinate tile, @NotNull CancellationToken cancellationToken) throws IOException Queries a single tile of a single projection.This method must be thread-safe. It may be called on a background thread, for example for an initial tile load, but also on the render thread, for example when a projection is invalidated. A projection that fires
IProjectedImageryModelObserver#onImageryInvalidatedmust serve its tiles cheaply and synchronously. Honor the cancellation token for long-running work.The possible outcomes are not interchangeable, because each one decides whether the tile is ever requested again:
- A result holding an image supplies the tile.
- A result without an image means the tile does not exist, and that tile is not requested again.
- A failed retrieval also stops the tile from being requested again.
- A canceled request is the only outcome that leaves the tile eligible for a later request.
Throw a
java.util.concurrent.CancellationExceptionto report a canceled request. Any other exception counts as a failed retrieval, after which the tile is never requested again.
- Specified by:
queryTilein interfaceIProjectedImageryModel- Parameters:
projectionId- the identifier of the projection, as returned byProjectedImagery#getId.tile- the coordinate of the requested tile.cancellationToken- a token that signals when the result is no longer needed.- Returns:
- the tile result, or a result without an image when the tile does not exist.
- Throws:
IOException- when the tile could not be retrieved.
-
addObserver
Registers an observer that will be notified of changes to this model.- Specified by:
addObserverin interfaceIProjectedImageryModel- Parameters:
observer- the observer to add. Must not benull.
-
removeObserver
Unregisters a previously added observer.If the given observer was not previously added, this method has no effect.
- Specified by:
removeObserverin interfaceIProjectedImageryModel- Parameters:
observer- the observer to remove.
-
getProjectionId
Returns the stable identifier of the single projection this model exposes.Pass this ID to
ProjectedImageryLayer#setSelectedProjectionsto display the video.- Returns:
- the stable identifier of the single projection this model exposes.
-
updateFrame
public void updateFrame(@NotNull Image frame, @NotNull Point location, double yaw, double pitch, double roll, double fovX, double fovY) throws NullPointerException Pushes a new video frame together with the camera pose and field of view it was captured at.The frame becomes the imagery of the model's projection and observers are notified so the map re-fetches and repaints. The projection's pinhole structure follows the frame's pixel size.
- Parameters:
frame- the new video frame. Must not benull.location- the georeferenced camera position.yaw- rotation around the vertical axis, in degrees.pitch- rotation around the lateral axis, in degrees. Positive values tilt the camera down.roll- rotation around the longitudinal axis, in degrees.fovX- the horizontal field of view, in degrees.fovY- the vertical field of view, in degrees.- Throws:
NullPointerException- when frame isnull.
-