Online Maps  v3
OnlineMapsLocationServiceBase Class Referenceabstract

Controls map using Location Service (GPS and compass). More...

Inheritance diagram for OnlineMapsLocationServiceBase:
IOnlineMapsSavableComponent OnlineMapsLocationServiceGenericBase< T >

Public Member Functions

void GetLocation (out float longitude, out float latitude)
 Returns the current GPS location or emulator location. More...
 
OnlineMapsSavableItem[] GetSavableItems ()
 Returns an array of items to save More...
 
abstract bool IsLocationServiceRunning ()
 Checks that the Location Service is running. More...
 
abstract void StopLocationService ()
 Stops Location Service More...
 
abstract bool TryStartLocationService ()
 Try to start Location Service. More...
 
void UpdatePosition ()
 Sets map position using GPS coordinates. More...
 
abstract void UpdateSpeed ()
 Updates the speed data. More...
 

Public Attributes

Action< float > OnCompassChanged
 This event is called when the user rotates the device More...
 
OnGetLocationDelegate OnGetLocation
 This event allows you to intercept receiving a GPS location More...
 
Action OnFindLocationByIPComplete
 This event is called when the IP location are found More...
 
Action< Vector2 > OnLocationChanged
 This event is called when changed your GPS location More...
 
Action OnLocationInited
 This event is called when the GPS is initialized (the first value is received) or location by IP is found More...
 
Action OnPositionRestored
 This event called after map position restored when timeout "Restore After" expires More...
 
bool autoStopUpdateOnInput = true
 Update stop position when user input More...
 
float compassThreshold = 8
 Threshold of compass More...
 
bool createMarkerInUserPosition = false
 Specifies the need to create a marker that indicates the current GPS coordinates More...
 
bool disableEmulatorInPublish = true
 Indicates whether to disable the emulator when used on the device More...
 
float emulatorCompass
 Emulated compass trueHeading. Do not use this field. Use OnlineMapsLocationService.trueHeading instead. More...
 
Vector2 emulatorPosition
 Emulated GPS position. Do not use this field. Use OnlineMapsLocationService.position instead. More...
 
bool findLocationByIP = false
 Specifies whether to search for a location by IP More...
 
bool lerpCompassValue = true
 Smooth rotation by compass. This helps to bypass the jitter. More...
 
float markerScale = 1
 Scale of the marker More...
 
string markerTooltip
 Tooltip of the marker More...
 
OnlineMapsLocationServiceMarkerType markerType = OnlineMapsLocationServiceMarkerType.twoD
 Type of the marker. More...
 
OnlineMapsAlign marker2DAlign = OnlineMapsAlign.Center
 Align of the 2D marker More...
 
Texture2D marker2DTexture
 Texture of 2D marker More...
 
GameObject marker3DPrefab
 Prefab of 3D marker. More...
 
OnlineMapsMarker3D.SizeType marker3DSizeType = OnlineMapsMarker3D.SizeType.scene
 Marker size type. More...
 
int maxPositionCount = 3
 The maximum number of stored positions.
It is used to calculate the speed. More...
 
Vector2 position = Vector2.zero
 Current GPS coordinates.
Important: position not available Start, because GPS is not already initialized.
Use OnLocationInited event, to determine the initialization of GPS.
More...
 
int restoreAfter = 10
 Use the GPS coordinates after seconds of inactivity. More...
 
bool rotateCameraByCompass = false
 Rotates the camera through a compass. Requires OnlineMapsCameraOrbit component. More...
 
float trueHeading = 0
 The heading in degrees relative to the geographic North Pole.
Important: position not available Start, because compass is not already initialized.
Use OnCompassChanged event, to determine the initialization of compass.
More...
 
bool updateEmulatorPositionByMarker = false
 Specifies the need to update the position of the emulator by marker position. More...
 
bool updatePosition = true
 Specifies whether the script will automatically update the location More...
 
bool useCompassForMarker = false
 Specifies the need for marker rotation More...
 
bool useGPSEmulator = false
 Specifies GPS emulator usage. Works only in Unity Editor. More...
 

Protected Member Functions

abstract void GetLocationFromSensor (out float longitude, out float latitude)
 Returns the current GPS location from sensor. More...
 

Properties

static OnlineMapsLocationServiceBase baseInstance [get]
 Instance of LocationService base. More...
 
static OnlineMapsMarkerBase marker [get, set]
 Instance of marker. More...
 
bool allowUpdatePosition [get, set]
 Is it allowed to update the position. More...
 
float speed [get]
 Speed km/h. Note: in Unity Editor will always be zero. More...
 

Detailed Description

Controls map using Location Service (GPS and compass).

Member Function Documentation

◆ GetLocation()

void OnlineMapsLocationServiceBase.GetLocation ( out float  longitude,
out float  latitude 
)

Returns the current GPS location or emulator location.

Parameters
longitudeLongitude
latitudeLatitude

◆ GetLocationFromSensor()

abstract void OnlineMapsLocationServiceBase.GetLocationFromSensor ( out float  longitude,
out float  latitude 
)
protectedpure virtual

Returns the current GPS location from sensor.

Parameters
longitudeLongitude
latitudeLatitude

◆ GetSavableItems()

OnlineMapsSavableItem [] OnlineMapsLocationServiceBase.GetSavableItems ( )

Returns an array of items to save

Returns
Array of items to save

Implements IOnlineMapsSavableComponent.

◆ IsLocationServiceRunning()

abstract bool OnlineMapsLocationServiceBase.IsLocationServiceRunning ( )
pure virtual

Checks that the Location Service is running.

Returns
True - location service is running, false - otherwise.

◆ StopLocationService()

abstract void OnlineMapsLocationServiceBase.StopLocationService ( )
pure virtual

Stops Location Service

◆ TryStartLocationService()

abstract bool OnlineMapsLocationServiceBase.TryStartLocationService ( )
pure virtual

Try to start Location Service.

Returns
True - success, false - otherwise.

◆ UpdatePosition()

void OnlineMapsLocationServiceBase.UpdatePosition ( )

Sets map position using GPS coordinates.

◆ UpdateSpeed()

abstract void OnlineMapsLocationServiceBase.UpdateSpeed ( )
pure virtual

Updates the speed data.

Member Data Documentation

◆ autoStopUpdateOnInput

bool OnlineMapsLocationServiceBase.autoStopUpdateOnInput = true

Update stop position when user input

◆ compassThreshold

float OnlineMapsLocationServiceBase.compassThreshold = 8

Threshold of compass

◆ createMarkerInUserPosition

bool OnlineMapsLocationServiceBase.createMarkerInUserPosition = false

Specifies the need to create a marker that indicates the current GPS coordinates

◆ disableEmulatorInPublish

bool OnlineMapsLocationServiceBase.disableEmulatorInPublish = true

Indicates whether to disable the emulator when used on the device

◆ emulatorCompass

float OnlineMapsLocationServiceBase.emulatorCompass

Emulated compass trueHeading. Do not use this field. Use OnlineMapsLocationService.trueHeading instead.

◆ emulatorPosition

Vector2 OnlineMapsLocationServiceBase.emulatorPosition

Emulated GPS position. Do not use this field. Use OnlineMapsLocationService.position instead.

◆ findLocationByIP

bool OnlineMapsLocationServiceBase.findLocationByIP = false

Specifies whether to search for a location by IP

◆ lerpCompassValue

bool OnlineMapsLocationServiceBase.lerpCompassValue = true

Smooth rotation by compass. This helps to bypass the jitter.

◆ marker2DAlign

OnlineMapsAlign OnlineMapsLocationServiceBase.marker2DAlign = OnlineMapsAlign.Center

Align of the 2D marker

◆ marker2DTexture

Texture2D OnlineMapsLocationServiceBase.marker2DTexture

Texture of 2D marker

◆ marker3DPrefab

GameObject OnlineMapsLocationServiceBase.marker3DPrefab

Prefab of 3D marker.

◆ marker3DSizeType

OnlineMapsMarker3D.SizeType OnlineMapsLocationServiceBase.marker3DSizeType = OnlineMapsMarker3D.SizeType.scene

Marker size type.

◆ markerScale

float OnlineMapsLocationServiceBase.markerScale = 1

Scale of the marker

◆ markerTooltip

string OnlineMapsLocationServiceBase.markerTooltip

Tooltip of the marker

◆ markerType

OnlineMapsLocationServiceMarkerType OnlineMapsLocationServiceBase.markerType = OnlineMapsLocationServiceMarkerType.twoD

Type of the marker.

◆ maxPositionCount

int OnlineMapsLocationServiceBase.maxPositionCount = 3

The maximum number of stored positions.
It is used to calculate the speed.

◆ OnCompassChanged

Action<float> OnlineMapsLocationServiceBase.OnCompassChanged

This event is called when the user rotates the device

◆ OnFindLocationByIPComplete

Action OnlineMapsLocationServiceBase.OnFindLocationByIPComplete

This event is called when the IP location are found

◆ OnGetLocation

OnGetLocationDelegate OnlineMapsLocationServiceBase.OnGetLocation

This event allows you to intercept receiving a GPS location

◆ OnLocationChanged

Action<Vector2> OnlineMapsLocationServiceBase.OnLocationChanged

This event is called when changed your GPS location

◆ OnLocationInited

Action OnlineMapsLocationServiceBase.OnLocationInited

This event is called when the GPS is initialized (the first value is received) or location by IP is found

◆ OnPositionRestored

Action OnlineMapsLocationServiceBase.OnPositionRestored

This event called after map position restored when timeout "Restore After" expires

◆ position

Vector2 OnlineMapsLocationServiceBase.position = Vector2.zero

Current GPS coordinates.
Important: position not available Start, because GPS is not already initialized.
Use OnLocationInited event, to determine the initialization of GPS.

◆ restoreAfter

int OnlineMapsLocationServiceBase.restoreAfter = 10

Use the GPS coordinates after seconds of inactivity.

◆ rotateCameraByCompass

bool OnlineMapsLocationServiceBase.rotateCameraByCompass = false

Rotates the camera through a compass. Requires OnlineMapsCameraOrbit component.

◆ trueHeading

float OnlineMapsLocationServiceBase.trueHeading = 0

The heading in degrees relative to the geographic North Pole.
Important: position not available Start, because compass is not already initialized.
Use OnCompassChanged event, to determine the initialization of compass.

◆ updateEmulatorPositionByMarker

bool OnlineMapsLocationServiceBase.updateEmulatorPositionByMarker = false

Specifies the need to update the position of the emulator by marker position.

◆ updatePosition

bool OnlineMapsLocationServiceBase.updatePosition = true

Specifies whether the script will automatically update the location

◆ useCompassForMarker

bool OnlineMapsLocationServiceBase.useCompassForMarker = false

Specifies the need for marker rotation

◆ useGPSEmulator

bool OnlineMapsLocationServiceBase.useGPSEmulator = false

Specifies GPS emulator usage. Works only in Unity Editor.

Property Documentation

◆ allowUpdatePosition

bool OnlineMapsLocationServiceBase.allowUpdatePosition
getset

Is it allowed to update the position.

◆ baseInstance

OnlineMapsLocationServiceBase OnlineMapsLocationServiceBase.baseInstance
staticget

Instance of LocationService base.

◆ marker

OnlineMapsMarkerBase OnlineMapsLocationServiceBase.marker
staticgetset

Instance of marker.

◆ speed

float OnlineMapsLocationServiceBase.speed
get

Speed km/h. Note: in Unity Editor will always be zero.