Class ProjectionRegistry
- java.lang.Object
-
- org.openstreetmap.josm.data.projection.ProjectionRegistry
-
public final class ProjectionRegistry extends Object
Registry for a single, global projection instance.- Since:
- 14120
-
-
Field Summary
Fields Modifier and Type Field Description private static ProjectionBoundsProvider
boundsProvider
private static List<WeakReference<ProjectionChangeListener>>
listeners
private static Projection
proj
The projection method used.
-
Constructor Summary
Constructors Modifier Constructor Description private
ProjectionRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addProjectionChangeListener(ProjectionChangeListener listener)
Register a projection change listener.static void
clearProjectionChangeListeners()
Remove all projection change listeners.private static void
fireProjectionChanged(Projection oldValue, Projection newValue, Bounds oldBounds)
static ProjectionBoundsProvider
getBoundsProvider()
Returns the bounds provider called in projection events.static Projection
getProjection()
Replies the current projection.static void
removeProjectionChangeListener(ProjectionChangeListener listener)
Removes a projection change listener.static void
setboundsProvider(ProjectionBoundsProvider provider)
Sets the bounds provider called in projection events.static void
setProjection(Projection p)
Sets the current projection
-
-
-
Field Detail
-
proj
private static volatile Projection proj
The projection method used. UsegetProjection()
andsetProjection(Projection)
for access. UsesetProjection(Projection)
in order to trigger a projection change event.
-
boundsProvider
private static ProjectionBoundsProvider boundsProvider
-
listeners
private static final List<WeakReference<ProjectionChangeListener>> listeners
-
-
Constructor Detail
-
ProjectionRegistry
private ProjectionRegistry()
-
-
Method Detail
-
getProjection
public static Projection getProjection()
Replies the current projection.- Returns:
- the currently active projection
-
setProjection
public static void setProjection(Projection p)
Sets the current projection- Parameters:
p
- the projection
-
fireProjectionChanged
private static void fireProjectionChanged(Projection oldValue, Projection newValue, Bounds oldBounds)
-
addProjectionChangeListener
public static void addProjectionChangeListener(ProjectionChangeListener listener)
Register a projection change listener. The listener is registered to be weak, so keep a reference of it if you want it to be preserved.- Parameters:
listener
- the listener. Ignored ifnull
.
-
removeProjectionChangeListener
public static void removeProjectionChangeListener(ProjectionChangeListener listener)
Removes a projection change listener.- Parameters:
listener
- the listener. Ignored ifnull
.
-
clearProjectionChangeListeners
public static void clearProjectionChangeListeners()
Remove all projection change listeners. For testing purposes only.
-
getBoundsProvider
public static ProjectionBoundsProvider getBoundsProvider()
Returns the bounds provider called in projection events.- Returns:
- the bounds provider
-
setboundsProvider
public static void setboundsProvider(ProjectionBoundsProvider provider)
Sets the bounds provider called in projection events. Must not be null- Parameters:
provider
- the bounds provider
-
-