public final class MgrsGridTextProvider extends Object implements AutoCloseable
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.
Modifier and Type | Class and Description |
---|---|
static interface |
MgrsGridTextProvider.ICallback
This callback can be used to be notified whenever the currently visible zone/square changes, by giving you its formatted location text.
|
Constructor and Description |
---|
MgrsGridTextProvider(Map map)
Constructs a new
MgrsGridTextProvider for the given Map . |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(MgrsGridTextProvider.ICallback callback)
Adds the given callback to the
MgrsGridTextProvider . |
void |
close() |
protected void |
finalize() |
void |
removeCallback(MgrsGridTextProvider.ICallback callback)
Removes the given callback from the
MgrsGridTextProvider . |
public MgrsGridTextProvider(@NotNull Map map) throws NullPointerException
MgrsGridTextProvider
for the given Map
.
MgrsGridTextProvider
must be instantiated on the UI thread.
map
- the Map
. Cannot be null
.NullPointerException
- when the Map
is null
.public void close()
close
in interface AutoCloseable
public void addCallback(@NotNull MgrsGridTextProvider.ICallback callback) throws NullPointerException
MgrsGridTextProvider
.
After calling this method, the MgrsGridTextProvider
starts calling the given callback instance.
callback
- a callback instance. Cannot be null
.NullPointerException
- when the callback is null
.public void removeCallback(@NotNull MgrsGridTextProvider.ICallback callback) throws NullPointerException
MgrsGridTextProvider
.
After calling this method, the MgrsGridTextProvider
stops calling the given callback instance.
callback
- a callback instance. Cannot be null
.NullPointerException
- when the callback is null
.