Skip to main content

class LightshipMapView

(Niantic.Lightship.Maps.LightshipMapView)

Overview

This class represents a single viewable area of the map, and is the primary API that games will use to interact with the Lightship Maps SDK. Most scenes will have a single LightshipMapView instance, although the Maps SDK supports any number of active map views in a given scene at a time.

class LightshipMapView:
MonoBehaviour,
Niantic.Lightship.Maps.ILightshipMapView,
IBuilderJobMonitorManager {
public:
// fields

static const int DefaultExecutionOrder = -10;
LatLng MapOrigin => _unitConverter.MapOrigin;
double MapScale => _unitConverter.MapScale;
IReadOnlyDictionary<ulong, IMapTile> ActiveMapTiles => _activeMapTiles;
bool IsMapCenteredAtOrigin => _centerMapAtOrigin;

// properties

LatLng MapCenter;
double MapRadius;

// 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 webMercator12);
double MetersToScene(double meters, double latitude);
double SceneToMeters(double sceneUnits, double latitude);
void SetMapTheme(MapTheme theme);
void RefreshMap();
};

Inherited Members

public:
// 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();

Detailed Documentation

This class represents a single viewable area of the map, and is the primary API that games will use to interact with the Lightship Maps SDK. Most scenes will have a single LightshipMapView instance, although the Maps SDK supports any number of active map views in a given scene at a time.

Methods

OffsetMapCenter

void OffsetMapCenter(Vector3 offset)

This method is called to offset the map view's position.

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).

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).

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).

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).

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).

SceneToLatLng

LatLng SceneToLatLng(Vector3 scenePosition)

Converts a position in Unity's world space to a location in LatLng coordinates.

LatLngToScene

Vector3 LatLngToScene(in LatLng location)

Converts a location in LatLng coordinates to a position in Unity's world space.

WebMercator12ToScene

Vector3 WebMercator12ToScene(in WebMercator12 webMercator12)

Converts a location in WebMercator12 coordinates to a position in Unity's world space.

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.

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.

SetMapTheme

void SetMapTheme(MapTheme theme)

Sets the current MapTheme

RefreshMap

void RefreshMap()

Refreshes the map at the current location.