interface ILightshipMapView
(Niantic.Lightship.Maps.ILightshipMapView)
Overview
This interface contains all of the members of LightshipMapView 's public API.
interface ILightshipMapView {
// properties
LatLng MapOrigin;
LatLng MapCenter;
double MapRadius;
double MapScale;
IReadOnlyDictionary<ulong, IMapTile> ActiveMapTiles;
bool IsMapCenteredAtOrigin;
// events
event MapTileAdded();
event MapTileRemoved();
event MapRadiusChanged();
event MapCenterChanged();
event MapOriginChanged();
// methods
void OffsetMapCenter(Vector3 offset);
void SetMapCenter(in LatLng latLng);
void SetMapCenter(Vector3 center);
void SetMapRadius(double mapRadius);
void SetViewableArea(in LatLng latLng, double mapRadius);
void SetViewableArea(Vector3 center, double mapRadius);
LatLng SceneToLatLng(Vector3 scenePosition);
Vector3 LatLngToScene(in LatLng location);
Vector3 WebMercator12ToScene(in WebMercator12 location);
double MetersToScene(double meters, double latitude);
double SceneToMeters(double sceneUnits, double latitude);
void SetMapTheme(MapTheme theme);
void RefreshMap();
};
// direct descendants
class LightshipMapView;
Detailed Documentation
This interface contains all of the members of LightshipMapView 's public API.
Properties
MapOrigin
LatLng MapOrigin
The LatLng that the map uses as its origin. Note that the map's position can be changed through its transform without affecting the MapOrigin 's location. However, large distances between the map's center (MapCenter) and its origin can lead to loss of precision, so setting the map's transform directly is not recommended.
MapCenter
LatLng MapCenter
The center of the map's viewable area
MapRadius
double MapRadius
The radius of the map's viewable area, in meters
MapScale
double MapScale
The map's scale
ActiveMapTiles
IReadOnlyDictionary<ulong, IMapTile> ActiveMapTiles
All active IMapTiles in the scene
IsMapCenteredAtOrigin
bool IsMapCenteredAtOrigin
If true, the map will always be centered at the scene's origin
Events
MapTileAdded
event MapTileAdded()
Event that's raised when a new IMapTile is added to the scene, after all of its meshes have been generated by feature builders.
MapTileRemoved
event MapTileRemoved()
Event that's raised when an IMapTile is no longer in view, just before its IMapTileObject is returned to the pool.
MapRadiusChanged
event MapRadiusChanged()
Event that's raised when the map's radius changes.
MapCenterChanged
event MapCenterChanged()
Event that's raised when the map's center changes.
MapOriginChanged
event MapOriginChanged()
Event that's raised when the map is repositioned back to the scene's origin.
Methods
OffsetMapCenter
void OffsetMapCenter(Vector3 offset)
This method is called to offset the map view's position.
Parameters:
offset
- The offset, in Unity's world space.
SetMapCenter
void SetMapCenter(in LatLng latLng)
This method is called to update the map view's position (in response to changes in the device's GPS, for example).
Parameters:
latLng
- The map's center, in lat/lng coordinates.
SetMapCenter
void SetMapCenter(Vector3 center)
This method is called to update the map view's position (in response to changes in the device's GPS, for example).
Parameters:
center
- The map's center, in Unity's world space.
SetMapRadius
void SetMapRadius(double mapRadius)
This method is called to update the map's viewable radius (when the map is zoomed in or out, for example).
Parameters:
mapRadius
- The map's viewable radius, in scene units.
SetViewableArea
void SetViewableArea(in LatLng latLng, double mapRadius)
This method is called to update the map view's position and viewable radius (in response to changes in the device's GPS or if the map is zoomed in or out, for example).
Parameters:
latLng
- The map's center, in lat/lng coordinates.
mapRadius
- The map's viewable radius, in scene units.
SetViewableArea
void SetViewableArea(Vector3 center, double mapRadius)
This method is called to update the map view's position and viewable radius (in response to changes in the device's GPS or if the map is zoomed in or out, for example).
Parameters:
center
- The map's center, in Unity's world space.
mapRadius
- The map's viewable radius, in scene units.
SceneToLatLng
LatLng SceneToLatLng(Vector3 scenePosition)
Converts a position in Unity's world space to a location in LatLng coordinates.
Parameters:
scenePosition
- The position to convert.
Returns:
A set of lat/lng coordinates for this location.
LatLngToScene
Vector3 LatLngToScene(in LatLng location)
Converts a location in LatLng coordinates to a position in Unity's world space.
Parameters:
location
- The location to convert.
Returns:
A world space position.
WebMercator12ToScene
Vector3 WebMercator12ToScene(in WebMercator12 location)
Converts a location in WebMercator12 coordinates to a position in Unity's world space.
Parameters:
location
- The location to convert.
Returns:
A world space position.
MetersToScene
double MetersToScene(double meters, double latitude)
Convert a distance in meters in the real world to Unity scene units. Note that latitude is required here because our map uses Web Mercator projection, which causes distances to stretch as you approach the poles.
Parameters:
meters
- The distance, in meters, to convert.
latitude
- The latitude at the location at which the conversion applies. A reasonable value for this would be the latitude at the map origin.
Returns:
The distance in Unity scene units.
SceneToMeters
double SceneToMeters(double sceneUnits, double latitude)
Convert a distance in Unity scene units to meters in the real world. Note that latitude is required here because our map uses Web Mercator projection, which causes distances to stretch as you approach the poles.
Parameters:
sceneUnits
- The distance, in Unity scene units, to convert.
latitude
- The latitude at the location at which the conversion applies. A reasonable value for this would be the latitude at the map origin.
Returns:
The distance in meters.
SetMapTheme
void SetMapTheme(MapTheme theme)
Sets the current MapTheme
Parameters:
theme
-
RefreshMap
void RefreshMap()
Refreshes the map at the current location.