Skip to main content

struct ViewPoint

(Niantic.Lightship.Maps.Core.Coordinates.ViewPoint)

Overview

ViewPoint describes viewpoint parameters to configure the map. The viewpoint consists of a location somewhere in the world along with a desired radius of interest for map data. These parameters are used to determine the map ROI and then determine the tile resolution needed for the map rendering. Each tile resolution is database specific, but their representation on screen is up to the user.

struct ViewPoint {
// fields

double LongitudeDeg => Center.Longitude;
double LatitudeDeg => Center.Latitude;
readonly LatLng Center;
readonly double MapAreaRadiusM;
bool IsValid => Center.IsValid&& MapAreaRadiusM> 0.0d;
static ViewPoint Invalid =>
new(double.MaxValue, double.MaxValue, double.MinValue);

// methods

ViewPoint(double longitudeDeg, double latitudeDeg, double mapAreaRadiusM);
ViewPoint(in LatLng latLng, double mapAreaRadiusM);
ViewPoint WithNewLatLng(in LatLng latLng);
ViewPoint WithNewMapRadius(double mapRadius);
override string ToString();
};

Detailed Documentation

ViewPoint describes viewpoint parameters to configure the map. The viewpoint consists of a location somewhere in the world along with a desired radius of interest for map data. These parameters are used to determine the map ROI and then determine the tile resolution needed for the map rendering. Each tile resolution is database specific, but their representation on screen is up to the user.

Fields

LongitudeDeg

double LongitudeDeg => Center.Longitude

Longitude of the viewpoint's center, in degrees.

LatitudeDeg

double LatitudeDeg => Center.Latitude

Latitude of the viewpoint's center, in degrees.

Center

readonly LatLng Center

The center of the viewable map area, in latitude and longitude coordinates.

MapAreaRadiusM

readonly double MapAreaRadiusM

Desired viewpoint map area radius, in meters.

IsValid

bool IsValid => Center.IsValid&& MapAreaRadiusM> 0.0d

Returns true if the ViewPoint 's latitude and longitude are a valid geographic location and the map radius is non-negative.

Invalid

static ViewPoint Invalid =>
new(double.MaxValue, double.MaxValue, double.MinValue)

Returns an invalid ViewPoint

Methods

ViewPoint

ViewPoint(double longitudeDeg, double latitudeDeg, double mapAreaRadiusM)

Constructor

    Parameters:

    longitudeDeg - Longitude of the viewpoint's center, in degrees.

    latitudeDeg - Latitude of the viewpoint's center, in degrees.

    mapAreaRadiusM - Desired viewpoint map area radius, in meters.

ViewPoint

ViewPoint(in LatLng latLng, double mapAreaRadiusM)

Constructor

    Parameters:

    latLng - The latitude and longitude of the viewpoint's center.

    mapAreaRadiusM - Desired viewpoint map area radius in meters.

WithNewLatLng

ViewPoint WithNewLatLng(in LatLng latLng)

Constructs a ViewPoint with a new LatLng and the same MapAreaRadiusM

    Parameters:

    latLng - The new viewpoint center

    Returns:

    A new ViewPoint

WithNewMapRadius

ViewPoint WithNewMapRadius(double mapRadius)

Constructs a ViewPoint with a new MapAreaRadiusM and the same LatLng

    Parameters:

    mapRadius - Desired viewpoint map area radius in meters

    Returns:

    A new ViewPoint