LuciadCPillar 2026.1.02
Loading...
Searching...
No Matches
luciad::ProjectedVideoModel Class Referencefinal

A ready-to-use luciad::IProjectedImageryModel for a single live pinhole video source, such as a drone or a fixed camera. More...

#include <luciad/models/projectedimagery/ProjectedVideoModel.h>

Inheritance diagram for luciad::ProjectedVideoModel:
luciad::IProjectedImageryModel luciad::Model

Classes

class  Builder
 Builder for luciad::ProjectedVideoModel. More...

Public Member Functions

 ~ProjectedVideoModel () override
void addObserver (std::shared_ptr< IProjectedImageryModelObserver > observer) override
 Registers an observer that will be notified of changes to this model.
ModelMetadata getModelMetadata () const override
 Returns the meta data for this model.
const std::string & getProjectionId () const
 Returns the stable identifier of the single projection this model exposes.
std::vector< std::shared_ptr< ProjectedImagery > > getProjections () const override
 Returns the projections held by this model.
std::shared_ptr< Bounds > queryBounds () const override
 Returns the bounds of this model, if available.
luciad::expected< ProjectionTileQueryResult, ErrorInfo > queryTile (const std::string &projectionId, const ProjectionTileCoordinate &tile, const CancellationToken &cancellationToken) const override
 Queries a single tile of a single projection.
void removeObserver (const std::shared_ptr< IProjectedImageryModelObserver > &observer) override
 Unregisters a previously added observer.
void updateFrame (std::shared_ptr< Image > frame, const 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.
Public Member Functions inherited from luciad::Model
virtual ~Model ()=default

Static Public Member Functions

static Builder newBuilder ()
 Creates a new builder with the default values.

Detailed Description

A ready-to-use luciad::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 luciad::IProjectedImageryModel implementation.

Unless an override is set through luciad::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 luciad::ProjectedImageryLayer and selecting its projection: layer->setSelectedProjections({{model->getProjectionId(), 1.0f}}).

All methods are safe to call from any thread.

Since
2026.1

Constructor & Destructor Documentation

◆ ~ProjectedVideoModel()

luciad::ProjectedVideoModel::~ProjectedVideoModel ( )
override

Member Function Documentation

◆ addObserver()

void luciad::ProjectedVideoModel::addObserver ( std::shared_ptr< IProjectedImageryModelObserver > observer)
overridevirtual

Registers an observer that will be notified of changes to this model.

Parameters
observerthe observer to add. Must not be nullptr.

Implements luciad::IProjectedImageryModel.

◆ getModelMetadata()

ModelMetadata luciad::ProjectedVideoModel::getModelMetadata ( ) const
overridevirtual

Returns the meta data for this model.

Returns
the meta data for this model.

Implements luciad::Model.

◆ getProjectionId()

const std::string & luciad::ProjectedVideoModel::getProjectionId ( ) const

Returns the stable identifier of the single projection this model exposes.

Pass this ID to luciad::ProjectedImageryLayer::setSelectedProjections to display the video.

Returns
the stable identifier of the single projection this model exposes.

◆ getProjections()

std::vector< std::shared_ptr< ProjectedImagery > > luciad::ProjectedVideoModel::getProjections ( ) const
overridevirtual

Returns the projections held by this model.

Returns
the projections.

Implements luciad::IProjectedImageryModel.

◆ newBuilder()

Builder luciad::ProjectedVideoModel::newBuilder ( )
static

Creates a new builder with the default values.

Returns
the new builder.

◆ queryBounds()

std::shared_ptr< Bounds > luciad::ProjectedVideoModel::queryBounds ( ) const
overridevirtual

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.

Returns
the bounds of this model, if available.

Implements luciad::Model.

◆ queryTile()

luciad::expected< ProjectionTileQueryResult, ErrorInfo > luciad::ProjectedVideoModel::queryTile ( const std::string & projectionId,
const ProjectionTileCoordinate & tile,
const CancellationToken & cancellationToken ) const
overridevirtual

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 luciad::IProjectedImageryModelObserver::onImageryInvalidated must 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.

    Report a canceled request as an ErrorInfo object with the error code Canceled. Any other error code counts as a failed retrieval, after which the tile is never requested again.

Parameters
projectionIdthe identifier of the projection, as returned by luciad::ProjectedImagery::getId.
tilethe coordinate of the requested tile.
cancellationTokena token that signals when the result is no longer needed.
Returns
the tile result, a result without an image when the tile does not exist, or an error.

Implements luciad::IProjectedImageryModel.

◆ removeObserver()

void luciad::ProjectedVideoModel::removeObserver ( const std::shared_ptr< IProjectedImageryModelObserver > & observer)
overridevirtual

Unregisters a previously added observer.

If the given observer was not previously added, this method has no effect.

Parameters
observerthe observer to remove.

Implements luciad::IProjectedImageryModel.

◆ updateFrame()

void luciad::ProjectedVideoModel::updateFrame ( std::shared_ptr< Image > frame,
const 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.

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
framethe new video frame. Must not be nullptr.
locationthe georeferenced camera position.
yawrotation around the vertical axis, in degrees.
pitchrotation around the lateral axis, in degrees. Positive values tilt the camera down.
rollrotation around the longitudinal axis, in degrees.
fovXthe horizontal field of view, in degrees.
fovYthe vertical field of view, in degrees.
Exceptions
luciad::NullArgumentExceptionwhen frame is nullptr.