Package com.luciad.layers.grids.mgrs
Class MgrsGridTextProvider
java.lang.Object
com.luciad.layers.grids.mgrs.MgrsGridTextProvider
- All Implemented Interfaces:
AutoCloseable
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This callback can be used to be notified whenever the currently visible zone/square changes, by giving you its formatted location text. -
Constructor Summary
ConstructorDescriptionMgrsGridTextProvider
(Map map) Constructs a newMgrsGridTextProvider
for the givenMap
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCallback
(MgrsGridTextProvider.ICallback callback) Adds the given callback to theMgrsGridTextProvider
.void
close()
protected void
finalize()
void
removeCallback
(MgrsGridTextProvider.ICallback callback) Removes the given callback from theMgrsGridTextProvider
.
-
Constructor Details
-
MgrsGridTextProvider
Constructs a newMgrsGridTextProvider
for the givenMap
.MgrsGridTextProvider
must be instantiated on the UI thread.- Parameters:
map
- theMap
. Cannot benull
.- Throws:
NullPointerException
- when theMap
isnull
.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
addCallback
public void addCallback(@NotNull MgrsGridTextProvider.ICallback callback) throws NullPointerException Adds the given callback to theMgrsGridTextProvider
.After calling this method, the
MgrsGridTextProvider
starts calling the given callback instance.- Parameters:
callback
- a callback instance. Cannot benull
.- Throws:
NullPointerException
- when the callback isnull
.
-
removeCallback
public void removeCallback(@NotNull MgrsGridTextProvider.ICallback callback) throws NullPointerException Removes the given callback from theMgrsGridTextProvider
.After calling this method, the
MgrsGridTextProvider
stops calling the given callback instance.- Parameters:
callback
- a callback instance. Cannot benull
.- Throws:
NullPointerException
- when the callback isnull
.
-