LuciadCPillar 2023.1.04
luciad::MgrsGridTextProvider Class Referencefinal

An MGRS text provider that notifies callbacks whenever the currently visible zone/square of a given Map changes. More...

#include <luciad/layers/grids/mgrs/MgrsGridTextProvider.h>

Classes

class  ICallback
 This callback can be used to be notified whenever the currently visible zone/square changes, by giving you its formatted location text. More...
 

Public Member Functions

 MgrsGridTextProvider (const std::shared_ptr< Map > &map)
 Constructs a new MgrsGridTextProvider for the given Map. More...
 
 ~MgrsGridTextProvider ()
 
void addCallback (std::shared_ptr< ICallback > callback)
 Adds the given callback to the MgrsGridTextProvider. More...
 
void removeCallback (const std::shared_ptr< ICallback > &callback)
 Removes the given callback from the MgrsGridTextProvider. More...
 

Detailed Description

An MGRS text provider that notifies callbacks whenever the currently visible zone/square of a given Map changes.

Typically used to update a UI element in combination with an MGRS grid on the map, although this is not mandatory.

The text is formatted with a maximum precision of 100km squares.

MgrsGridTextProvider must be instantiated on the UI thread, and its registered ICallbacks are only called on the UI thread.

See the Working with MGRS article for more information.

Since
2023.1

Constructor & Destructor Documentation

◆ MgrsGridTextProvider()

luciad::MgrsGridTextProvider::MgrsGridTextProvider ( const std::shared_ptr< Map > &  map)
explicit

Constructs a new MgrsGridTextProvider for the given Map.

MgrsGridTextProvider must be instantiated on the UI thread.

Parameters
mapthe Map. Cannot be nullptr.
Exceptions
NullArgumentExceptionwhen the Map is nullptr.

◆ ~MgrsGridTextProvider()

luciad::MgrsGridTextProvider::~MgrsGridTextProvider ( )

Member Function Documentation

◆ addCallback()

void luciad::MgrsGridTextProvider::addCallback ( std::shared_ptr< ICallback callback)

Adds the given callback to the MgrsGridTextProvider.

After calling this method, the MgrsGridTextProvider starts calling the given callback instance.

Parameters
callbacka callback instance. Cannot be nullptr.
Exceptions
NullArgumentExceptionwhen the callback is nullptr.

◆ removeCallback()

void luciad::MgrsGridTextProvider::removeCallback ( const std::shared_ptr< ICallback > &  callback)

Removes the given callback from the MgrsGridTextProvider.

After calling this method, the MgrsGridTextProvider stops calling the given callback instance.

Parameters
callbacka callback instance. Cannot be nullptr.
Exceptions
NullArgumentExceptionwhen the callback is nullptr.